contentview_CreateObjects.js 111 KB
Newer Older
1

2 3 4 5 6 7 8 9 10 11
//名前空間用のオブジェクトを用意する
var CONTENTVIEW_CREATEOBJECT = {};

//CONTENTVIEW_CREATEOBJECT.check;
//CONTENTVIEW_CREATEOBJECT._isEnableRotate = false;

CONTENTVIEW_CREATEOBJECT.alertMessageLevel = {
	    ShowAlert : '1',
	    RequirePassword : '2',
	    None : '0'  
12
};
13

14 15
/* ----------------------------------- Create memo --------------------------------*/

16
CONTENTVIEW_CREATEOBJECT.memoObjects = [];
17 18

/* constructor */
19
CONTENTVIEW_CREATEOBJECT.MemoObject = function (id, text, x, y, width, heigth, imageUrl, action) {
20 21 22 23

};

/* setup each properties */
24
CONTENTVIEW_CREATEOBJECT.MemoObject.prototype.setup = function (id, text, x, y, w, h, imageUrl) {
25 26 27 28 29 30 31 32 33 34
    this.text = text;
    this.id = id;
    this.x = x;
    this.y = y;
    this.width = w;
    this.height = h;
    this.imageUrl = imageUrl;
};

/* prototype hitTest */
35
CONTENTVIEW_CREATEOBJECT.MemoObject.prototype.hitTest = function (px, py) {
36 37 38 39

    //#11478
    var canvasWidth = $('#offscreen').width();
    var canvasHeight = $('#offscreen').height();
40
    var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
41 42 43
    if( tempRatioWidth < 1 ){
        tempRatioWidth = 1;
    }
44
    var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
45 46 47 48 49 50 51 52 53 54
    if( tempRatioHeight < 1 ){
        tempRatioHeight = 1;
    }
    var tmpX = this.x * tempRatioWidth;
    var tmpY = this.y * tempRatioHeight;
    var tmpW = this.width * tempRatioWidth;
    var tmpH = this.height * tempRatioHeight;

    if (tmpX <= px && px <= (tmpX + tmpW)) {
        if (tmpY <= py && py <= (tmpY + tmpH)) {
55 56 57
            return true;
        }
    }
58 59 60 61 62
    //if (this.x <= px && px <= (this.x + this.width)) {
    //    if (this.y <= py && py <= (this.y + this.height)) {
    //        return true;
    //    }
    //}
63 64 65 66
    return false;
};

/* draw Memo */
67
CONTENTVIEW_CREATEOBJECT.MemoObject.prototype.drawMemo = function (context, opt) {
68 69 70 71

    //#1478
    var canvasWidth = $('#offscreen').width();
    var canvasHeight = $('#offscreen').height();
72
    var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
73 74 75
    if( tempRatioWidth < 1 ){
        tempRatioWidth = 1;
    }
76
    var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
77 78 79 80 81 82 83 84 85 86 87 88
    if( tempRatioHeight < 1 ){
        tempRatioHeight = 1;
    }
    
    var posX = this.x * tempRatioWidth;
    var posY = this.y * tempRatioHeight;
    var objWidth = this.width * tempRatioWidth;
    var objHeigth = this.height * tempRatioHeight;
    //var posX = this.x;
    //var posY = this.y;
    //var objWidth = this.width;
    //var objHeigth = this.height;
89 90 91 92
    var imageObj = new Image();

    imageObj.onload = function () {
        context.drawImage(imageObj, posX, posY, objWidth, objHeigth);
93
        CONTENTVIEW.flip(opt);
94 95 96 97 98 99
    };
    imageObj.src = this.imageUrl;

};

/* create memo object */
100
CONTENTVIEW_CREATEOBJECT.memo = function (id, text, x, y, w, h, imageUrl) {
101 102
    this.setup(id, text, x, y, w, h, imageUrl);
    this.action = function () {
103
    	CONTENTVIEW_MEMO.EditMemo(id, 0, 0, $('#divDialogMemo'), function () {
104 105 106 107 108 109
            /*set flag change memo */
            ClientData.isChangedMemo(true);
        });
    };
};

110
CONTENTVIEW_CREATEOBJECT.memo.prototype = new CONTENTVIEW_CREATEOBJECT.MemoObject();
111 112

/*click showEditMemo() */
113 114
CONTENTVIEW_CREATEOBJECT.showEditMemo = function() {
	CONTENTVIEW_GENERAL.objEditMemo.action();
115 116 117
};

/*click copyMemo() */
118 119 120 121
CONTENTVIEW_CREATEOBJECT.copyMemo = function() {
    //CONTENTVIEW_GENERAL.isCopyMemo = true;
    ClientData.memo_copyText(CONTENTVIEW_GENERAL.objEditMemo.text);
    //CONTENTVIEW.disableControlsCopyMemo();
122 123 124 125 126 127 128 129 130
    $("#pop_up_memo").hide();
};


/* ----------------------------------- End create memo -----------------------------*/


/* ----------------------------------- Create webGetContentType4 --------------------------------*/

131
CONTENTVIEW_CREATEOBJECT.webGetContentType4Objects = [];
132 133

/* constructor */
134
CONTENTVIEW_CREATEOBJECT.WebGetContentTyp4Object = function (id, x, y, width, heigth, imageUrl, action) {
135 136 137 138

};

/* setup each properties */
139
CONTENTVIEW_CREATEOBJECT.WebGetContentTyp4Object.prototype.setup = function (id, x, y, w, h, imageUrl) {
140 141 142 143 144 145 146 147 148
    this.id = id;
    this.x = x;
    this.y = y;
    this.width = w;
    this.height = h;
    this.imageUrl = imageUrl;
};

/* prototype hitTest */
149
CONTENTVIEW_CREATEOBJECT.WebGetContentTyp4Object.prototype.hitTest = function (px, py) {
150 151 152 153

    //#11478
    var canvasWidth = $('#offscreen').width();
    var canvasHeight = $('#offscreen').height();
154
    var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
155 156 157
    if( tempRatioWidth < 1 ){
        tempRatioWidth = 1;
    }
158
    var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
159 160 161 162 163 164 165 166 167 168
    if( tempRatioHeight < 1 ){
        tempRatioHeight = 1;
    }
    var tmpX = this.x * tempRatioWidth;
    var tmpY = this.y * tempRatioHeight;
    var tmpW = this.width * tempRatioWidth;
    var tmpH = this.height * tempRatioHeight;

    if (tmpX <= px && px <= (tmpX + tmpW)) {
        if (tmpY <= py && py <= (tmpY + tmpH)) {
169 170 171 172 173 174 175
            return true;
        }
    }
    return false;
};

/* draw Memo */
176
CONTENTVIEW_CREATEOBJECT.WebGetContentTyp4Object.prototype.drawObject = function (context, opt) {
177 178 179 180
    
    //#11478
    var canvasWidth = $('#offscreen').width();
    var canvasHeight = $('#offscreen').height();
181
    var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
182 183 184
    if( tempRatioWidth < 1 ){
        tempRatioWidth = 1;
    }
185
    var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
186 187 188 189 190 191 192 193
    if( tempRatioHeight < 1 ){
        tempRatioHeight = 1;
    }
    
    var posX = this.x * tempRatioWidth;
    var posY = this.y * tempRatioHeight;
    var objWidth = this.width * tempRatioWidth;
    var objHeigth = this.height * tempRatioHeight;
194 195 196 197 198 199 200
    var imageObj = new Image();
    imageObj.onload = function () {
        context.globalAlpha = 0.4;

        context.drawImage(imageObj, posX, posY, objWidth, objHeigth);
        
        //Start Function : No.4 - Editor: Long - Date : 08/14/2013 - Summary : handle lazy loading
201
        CONTENTVIEW.flip(opt);
202 203 204 205 206 207 208 209
       //Start Function : No.4 - Editor: Long - Date : 08/14/2013 - Summary : handle lazy loading   
        context.globalAlpha = 1;
    };
    imageObj.src = this.imageUrl;

};

/* create memo object */
210
CONTENTVIEW_CREATEOBJECT.webContentType4 = function (id, x, y, w, h, imageUrl, linkKind, destURI, destPageNumber) {
211 212 213 214 215 216 217 218
    this.setup(id, x, y, w, h, imageUrl);
    this.action = function () {
        if (linkKind == "1") {
            //START TRB00070
            window.onbeforeunload = null;
            //window.open(destURI, "_blank", "new window");
            window.open(destURI, "_self");
            
Masaru Abe committed
219
            setTimeout(function(){COMMON.ToogleLogoutNortice();}, 200);
220 221 222 223 224
            
            //END TRB00070
            
        } 
        else if (linkKind == "0") {
225
        	CONTENTVIEW.changePage(CONTENTVIEW.changePageNo(destPageNumber));
226 227 228
        }
    };
};
229
CONTENTVIEW_CREATEOBJECT.webContentType4.prototype = new CONTENTVIEW_CREATEOBJECT.WebGetContentTyp4Object();
230 231 232 233 234 235 236 237

/* ----------------------------------- End create webGetContentType4 -----------------------------*/

/**
* PageObject Class Definition 
*/

/* constructor */
238
CONTENTVIEW_CREATEOBJECT.PageObject = function (id, imageUrl, x, y, w, h, visible, actionFunction, displayBorder) {
239 240 241
};

/* setup each properties */
242
CONTENTVIEW_CREATEOBJECT.PageObject.prototype.setup = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, actionFunction, displayBorder, objectId) {
243 244 245 246 247 248 249 250 251 252 253 254 255

    this.mediaType = mediaType;
    this.actionType = actionType;
    this.id = id;
    this.x = x;
    this.y = y;
    this.width = w;
    this.height = h;
    this.displayBorder = displayBorder;
    this.visible = visible;
    this.imageUrl = imageUrl;
    this.image = new Image();
    this.image.src = this.imageUrl;
256
    
Masaru Abe committed
257
    this.objectId = objectId;
258
    
259 260 261
};

/* prototype hitTest */
262
CONTENTVIEW_CREATEOBJECT.PageObject.prototype.hitTest = function (px, py) {
263 264 265 266

    //#11478
    var canvasWidth = $('#offscreen').width();
    var canvasHeight = $('#offscreen').height();
267
    var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
268 269 270
    if( tempRatioWidth < 1 ){
        tempRatioWidth = 1;
    }
271
    var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
272 273 274 275 276 277 278 279 280 281
    if( tempRatioHeight < 1 ){
        tempRatioHeight = 1;
    }
    var tmpX = this.x * tempRatioWidth;
    var tmpY = this.y * tempRatioHeight;
    var tmpW = this.width * tempRatioWidth;
    var tmpH = this.height * tempRatioHeight;
    
    if ( tmpX <= px && px <= (tmpX + tmpW)) {
        if (tmpY <= py && py <= (tmpY + tmpH)) {
282 283 284
            return true;
        }
    }
285 286 287 288 289
    //if (this.x <= px && px <= (this.x + this.width)) {
    //    if (this.y <= py && py <= (this.y + this.height)) {
    //        return true;
    //    }
    //}
290 291 292 293
    return false;
};
/* draw page Object */
//Start Function: No.4 - Editor : Long - Date: 08/09/2013 - Summary : Edit function to draw object on next page
294
CONTENTVIEW_CREATEOBJECT.PageObject.prototype.drawPageObject = function (context, opt) {
295 296
    
    var nObjectCnt = 0;
297 298 299 300 301
    //#11478
    var tempRatioWidth = 1;
    var tempRatioHeight = 1;
    var canvasWidth = 0;
    var canvasHeight = 0;
302 303 304
    
    //Check which pageObject to be count
    if(opt == null || opt == 0){
305
        nObjectCnt = CONTENTVIEW_GENERAL.pageObjects.length;
306 307 308 309
        
        //#11478
        canvasWidth = $('#offscreen').width();
        canvasHeight = $('#offscreen').height();
310
        tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
311 312 313
        if( tempRatioWidth < 1 ){
            tempRatioWidth = 1;
        }
314
        var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
315 316 317 318
        if( tempRatioHeight < 1 ){
            tempRatioHeight = 1;
        }
        
319 320
    }
    else if(opt == 1){
321
        nObjectCnt = CONTENTVIEW_GENERAL.nextPageObjects.length;
322 323 324 325
        
        //#11478
        canvasWidth = $('#offscreenNext').width();
        canvasHeight = $('#offscreenNext').height();
326
        tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachNextPageApi;
327 328 329
        if( tempRatioWidth < 1 ){
            tempRatioWidth = 1;
        }
330
        var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachNextPageApi;
331 332 333 334
        if( tempRatioHeight < 1 ){
            tempRatioHeight = 1;
        }
        
335 336
    }
    else if(opt == 2){
337
        nObjectCnt = CONTENTVIEW_GENERAL.prevPageObjects.length;
338 339 340 341
        
        //#11478
        canvasWidth = $('#offscreenPre').width();
        canvasHeight = $('#offscreenPre').height();
342
        tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPrevPageApi;
343 344 345
        if( tempRatioWidth < 1 ){
            tempRatioWidth = 1;
        }
346
        var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPrevPageApi;
347 348 349 350
        if( tempRatioHeight < 1 ){
            tempRatioHeight = 1;
        }
        
351 352 353 354 355 356
    }
    
    if (this.visible) {
        /* init data */
        var mediaType = this.mediaType;
        var displayBorder = this.displayBorder;
357 358 359 360 361 362 363
        
        //#11478
        var x = this.x * tempRatioWidth;
        var y = this.y * tempRatioHeight;
        var w = this.width * tempRatioWidth;
        var h = this.height * tempRatioHeight;
        
364 365 366 367 368 369 370 371 372 373
        var tempUrl = this.imageUrl;
        var isUsedTempImg = false;
        
        //START TRB00046 - Editor : Long - Date: 09/19/2013 - Summary : Fix for draw video object at center
        if(mediaType == '6' && tempUrl == 'img/iPad_video.png'){
            isUsedTempImg = true;
        }
        //END TRB00046 - Editor : Long - Date: 09/19/2013 - Summary : Fix for draw video object at center
        
        if (mediaType == '5') {
374
        	CONTENTVIEW_GENERAL.nCountObjectLoad++;
375 376 377 378
            context.strokeStyle = "black";
            context.lineWidth = "1";
            context.strokeRect(x, y, w, h);
            
379
            CONTENTVIEW.flip(opt);
380 381 382 383 384 385 386
        }

        if (this.imageUrl != '') {
            /* init image  */
            var img = new Image();

            img.onload = function () {
387
            	CONTENTVIEW_GENERAL.nCountObjectLoad++;
388 389 390 391 392 393 394 395 396 397 398 399 400


                /* create object store value image */
                var objTemp = [];
                objTemp.mediaType = mediaType;
                objTemp.img = img;
                objTemp.x = x;
                objTemp.y = y;
                objTemp.w = w;
                objTemp.h = h;
                objTemp.displayBorder = displayBorder;

                /* push to array */
401
                CONTENTVIEW_GENERAL.arrImage.push(objTemp);
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443

                if (mediaType == '2') {/*  media */
                    img.width = 50;
                    img.height = 50;

                    if (img.width > w) {
                        context.drawImage(img, x, y, w, h);
                    } else {
                        /*draw image and border */
                        context.drawImage(img, x + ((w - img.width) / 2), y + ((h - img.height) / 2), img.width, img.height);
                        if (displayBorder == '1') {/* draw border */
                            context.strokeStyle = "black";
                            context.lineWidth = "1";
                            context.strokeRect(x, y, w, h);
                        }
                    }

                } 
                else if (mediaType == '3') {/* audio */
                    img.width = 50;
                    img.height = 50;
                    
                    //START TRB00035 - Editor : Long - Date: 09/17/2013 - Summary : Fix for draw audio object at center
                    context.drawImage(img, x + (w/2 - img.width/2), y + (h/2 - img.height/ 2), img.width, img.height);                 
                    //END TRB00035 - Editor : Long - Date: 09/17/2013 - Summary : Fix for draw audio object at center                                      
                    
                }
                else if(mediaType == '6' && isUsedTempImg){
                    img.width = 50;
                    img.height = 50;
                    
                    //START TRB00046 - Editor : Long - Date: 09/19/2013 - Summary : Fix for draw video object at center
                    context.drawImage(img, x + (w/2 - img.width/2), y + (h/2 - img.height/ 2), img.width, img.height);   
                                        
                    isUsedTempImg = false;              
                    //END TRB00046 - Editor : Long - Date: 09/19/2013 - Summary : Fix for draw video object at center  

                }
                else {
                    context.drawImage(img, x, y, w, h);
                }
                
444
                CONTENTVIEW.flip(opt);
445
                
446
                if (CONTENTVIEW_GENERAL.nCountObjectLoad >= nObjectCnt) {                       
447 448

                    /* draw marking */
449
                	CONTENTVIEW.drawMarkingOnScreen(opt);
450 451 452

                    /*set status is loading page */
                    //Start Function : No.4 - Summary : make sure all page is loaded
453 454
                    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                        if(CONTENTVIEW_GENERAL.totalPage > 1){
455
                            if(opt != 0 && opt != null){
456
                            	CONTENTVIEW_GENERAL.isLoadingObject = false;
457 458 459
                            }
                        }
                        else{
460
                        	CONTENTVIEW_GENERAL.isLoadingObject = false;
461 462 463
                        }                                          
                    }
                    else{
464
                    	CONTENTVIEW_GENERAL.isLoadingObject = false;
465 466 467 468 469
                    }
                    //End Function : No.4 - Summary : make sure all page is loaded

                    /* enable controls in page */
                    if (ClientData.IsAddingMarking() == true) {
470
                    	CONTENTVIEW_GENERAL.disableAllControl();
471
                        //Start Function : No.4 - Summary : make sure all page is loaded
472 473
                        if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                            if(CONTENTVIEW_GENERAL.totalPage > 1){
474
                                if(opt != 0 && opt != null){
475
                                	CONTENTVIEW_MARKING.enableButtonMarking();
476 477 478
                                }   
                            }
                            else{
479
                            	CONTENTVIEW_MARKING.enableButtonMarking();
480 481 482
                            }                     
                        }
                        else{
483
                        	CONTENTVIEW_MARKING.enableButtonMarking();
484 485 486 487 488
                        }
                        //End Function : No.4 - Summary : make sure all page is loaded                       
                    } 
                    else {
                        //Start Function : No.4 - Summary : make sure all page is loaded
489 490
                        if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                            if(CONTENTVIEW_GENERAL.totalPage > 1){
491
                                if(opt != 0 && opt != null){
492
                                	CONTENTVIEW_GENERAL.enableAllControl();
493 494 495
                                }
                            }
                            else{
496
                            	CONTENTVIEW_GENERAL.enableAllControl();
497 498 499
                            }                     
                        }
                        else{
500
                        	CONTENTVIEW_GENERAL.enableAllControl();
501 502 503 504 505 506
                        }
                        //End Function : No.4 - Summary : make sure all page is loaded  
                    }

                    /*finish loading */
                     //Start Function : No.4 - Summary : make sure all page is loaded
507 508
                    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                        if(CONTENTVIEW_GENERAL.totalPage > 1){
509 510 511 512 513 514 515 516 517 518 519 520 521 522
                            if(opt != 0 && opt != null){
                                 $('#divImageLoading').css('display', 'none');
                            }
                        }
                        else{
                            $('#divImageLoading').css('display', 'none');
                        }                                                  
                    }
                    else{
                          $('#divImageLoading').css('display', 'none');
                    }
                    //End Functi

                    /* set pos video */
523
                    CONTENTVIEW.zoomVideo();
524 525 526 527 528
                }
            };
            img.src = this.imageUrl;
        } 
        else {
529
            if (CONTENTVIEW_GENERAL.nCountObjectLoad >= nObjectCnt) {
530
                /* draw marking */
531
            	CONTENTVIEW.drawMarkingOnScreen(opt);
532 533

                /*set status is loading page */
534
            	CONTENTVIEW_GENERAL.isLoadingObject = false;
535 536
                /* enable controls in page */
                if (ClientData.IsAddingMarking() == true) {
537
                	CONTENTVIEW_GENERAL.disableAllControl();
538
                     //Start Function : No.4 - Summary : make sure all page is loaded
539 540
                    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                        if(CONTENTVIEW_GENERAL.totalPage > 1){
541
                            if(opt != 0 && opt != null){
542
                            	CONTENTVIEW_MARKING.enableButtonMarking();
543 544 545
                            }
                        }
                        else{
546
                        	CONTENTVIEW_MARKING.enableButtonMarking();
547 548 549
                        }                       
                    }
                    else{
550
                    	CONTENTVIEW_MARKING.enableButtonMarking();
551 552 553 554
                    }
                    //End Function : No.4 - Summary : make sure all page is loaded  
                } else {
                    //Start Function : No.4 - Summary : make sure all page is loaded
555 556
                    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                        if(CONTENTVIEW_GENERAL.totalPage > 1){
557
                            if(opt != 0 && opt != null){
558
                            	CONTENTVIEW_GENERAL.enableAllControl();
559 560 561
                            }     
                        }
                        else{
562
                        	CONTENTVIEW_GENERAL.enableAllControl(); 
563 564 565
                        }                   
                    }
                    else{
566
                    	CONTENTVIEW_GENERAL.enableAllControl();
567 568 569 570 571 572
                    }
                    //End Function : No.4 - Summary : mak
                }

                /*finish loading */ 
                //Start Function : No.4 - Summary : make sure all page is loaded
573 574
                if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
                    if(CONTENTVIEW_GENERAL.totalPage > 1){
575 576 577 578 579 580 581 582 583 584 585 586 587
                        if(opt != 0 && opt != null){
                             $('#divImageLoading').css('display', 'none');
                        }    
                    }
                    else{
                        $('#divImageLoading').css('display', 'none');
                    }                    
                }
                else{
                      $('#divImageLoading').css('display', 'none');
                }
                //End Func
                /* set pos video */
588
                CONTENTVIEW.zoomVideo();
589 590 591 592 593 594 595 596 597
            }
        }
    }
};
//End Function: No.4 - Editor : Long - Date: 08/09/2013 - Summary : Edit function to draw object on next page

//Start Function : No.9

/*mediaType = 8 3d object*/
598
CONTENTVIEW_CREATEOBJECT.object3d = function (mediaType, actionType, id, imageUrl, x, y, w, h, hCnt, vCnt, visible, imageObjects, objectId){
599
    
600
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
601 602
    this.action = function (imagePt){      
                    
Masaru Abe committed
603 604
        //abe
        //alert("object3d");
605 606 607 608
        
        //#11478
        var canvasWidth = $('#offscreen').width();
        var canvasHeight = $('#offscreen').height();
609
        var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
610 611 612
        if( tempRatioWidth < 1 ){
            tempRatioWidth = 1;
        }
613
        var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
614 615 616 617 618 619 620 621
        if( tempRatioHeight < 1 ){
            tempRatioHeight = 1;
        }
        var tmpX = x *  tempRatioWidth;
        var tmpY = y * tempRatioHeight;
        var tmpW = w *  tempRatioWidth;
        var tmpH = h * tempRatioHeight;
        
622 623
       if(CONTENTVIEW_3D._3dAction == CONTENTVIEW_3D._3dActionType.TouchStart_MouseDown){
    	   CONTENTVIEW_3D.OnMouseDown3D(id, imagePt, tmpX, tmpY);
624
       }
625 626
       else if(CONTENTVIEW_3D._3dAction == CONTENTVIEW_3D._3dActionType.TouchMove_MouseMove){
    	   CONTENTVIEW_3D.OnMouseMove3D(id, imagePt, tmpX, tmpY, tmpW, tmpH, hCnt, vCnt);
627
       }
628 629
       else if(CONTENTVIEW_3D._3dAction == CONTENTVIEW_3D._3dActionType.TouchEnd_MouseUp){
    	   CONTENTVIEW_3D.OnMouseEnd3D(id, hCnt, vCnt);
Masaru Abe committed
630 631 632
           
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
633 634
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
635 636 637 638 639 640 641 642 643 644
            objectLog.objectId = objectId;
            objectLog.resourceId = "";
            objectLog.mediaType = mediaType;
            objectLog.actionType = actionType;
            objectLog.actionValue = "";
            objectLog.actionTime = "0";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
645
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
646 647
            //---
           
648 649 650
       }              
    };
};
651
CONTENTVIEW_CREATEOBJECT.object3d.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
652 653 654 655

//End Function : No.9

/* mediaType = 7 write text object*/
656
CONTENTVIEW_CREATEOBJECT.text = function (mediaType, actionType, id, x, y, w, h, visible, actionFunction, content, objectId) {
657
    //var imageUrl = displayText(x,y,w,h,id,content);
658
    var imageUrl = TEXTOBJECT.getTextObjectImage(w, h, content);
659
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, actionFunction, null, objectId);
660 661 662
    this.action = function () {
    };
};
663
CONTENTVIEW_CREATEOBJECT.text.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
664 665

/* mediaType=4  list image object : extends PageObject */
666
CONTENTVIEW_CREATEOBJECT.listImage = function (mediaType, id, imageUrl, x, y, w, h, visible, imageObjects, triggerType, objectId) {
667
    this.setup(mediaType, null, id, imageUrl, x, y, w, h, visible, null, null, objectId);
668
    this.action = function () {
669
    
670
        if (triggerType == '1') {
Masaru Abe committed
671 672 673 674 675 676
        
            //abe
            //alert("listImage triggerType=1");
        
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
677 678
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
679 680 681 682 683 684 685 686 687 688
            objectLog.objectId = objectId;
            //objectLog.resourceId = "";
            objectLog.mediaType = mediaType;
            objectLog.actionType = "";
            objectLog.actionValue = "";
            objectLog.actionTime = "0";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
689
            //COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
690 691
            //---
        
692
            CONTENTVIEW_GENERAL.mediaType4_changeImage++;
693 694

            /* check index bigger than length object */
695 696
            if (CONTENTVIEW_GENERAL.mediaType4_changeImage > (imageObjects.length - 1)) {
            	CONTENTVIEW_GENERAL.mediaType4_changeImage = 0;
697 698
            }

Masaru Abe committed
699
            //リソースIDセット
700 701
            objectLog.resourceId = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].resourceId;
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
702

703 704 705 706 707
            /* draw image */
            var imageObj = new Image();
            imageObj.onload = function () {
                var canvasObject = document.getElementById("offscreen");
                var contextObject = canvasObject.getContext("2d");
708 709 710 711
                
                //#11478
                var canvasWidth = $('#offscreen').width();
                var canvasHeight = $('#offscreen').height();
712
                var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
713 714 715
                if( tempRatioWidth < 1 ){
                    tempRatioWidth = 1;
                }
716
                var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
717 718 719 720 721 722 723 724 725
                if( tempRatioHeight < 1 ){
                    tempRatioHeight = 1;
                }
                var tmpX = x *  tempRatioWidth;
                var tmpY = y * tempRatioHeight;
                var tmpW = w *  tempRatioWidth;
                var tmpH = h * tempRatioHeight;
                
                contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH);
726
                CONTENTVIEW.flip();
727
            };
728
            imageObj.src = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].fileName;
Masaru Abe committed
729
            
730 731 732
        }
    };
};
733
CONTENTVIEW_CREATEOBJECT.listImage.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
734 735

/* mediaType=5 Replace Video object : extends PageObject */
736
CONTENTVIEW_CREATEOBJECT.listVideo = function (mediaType, id, imageUrl, x, y, w, h, visible, videoObjects, objectId) {
737
    this.setup(mediaType, null, id, imageUrl, x, y, w, h, visible, null, null, objectId);
738
    this.action = function () {
Masaru Abe committed
739 740
        //abe 
        //alert("listVideo");
741 742
    };
};
743
CONTENTVIEW_CREATEOBJECT.listVideo.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
744 745

/* mediaType=6 Trigger object : extends PageObject */
746
CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl, x, y, w, h, index, target, visible, actionFunction, objectId) {
747
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, actionFunction, null, objectId);
748
    this.action = function () {
Vo Duc Thang committed
749
        // draw object      
750

Masaru Abe committed
751
        //abe
752
        //alert("trigger:" + CONTENTVIEW_GETDATA.getPageIndex() + " id:" + id);
Masaru Abe committed
753 754 755

        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
756 757
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
758 759 760 761 762 763 764 765 766 767
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = "";
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
768

769 770 771 772 773 774
        for (var nIndex = 0; nIndex < CONTENTVIEW.objType4_5.length; nIndex++) {
            for (var nIndex1 = 0; nIndex1 < CONTENTVIEW.objType4_5[nIndex].dataObjects.length; nIndex1++) {
                if (CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].index == index
                    && CONTENTVIEW.objType4_5[nIndex].id == target) {
                    if (CONTENTVIEW.objType4_5[nIndex].mediaType == '4') {  /*image*/
                    	CONTENTVIEW.changeImageType4(CONTENTVIEW.objType4_5, nIndex, nIndex1);
Masaru Abe committed
775 776 777
                        //詳細ログ用 画像なので0セット
                        objectLog.actionTime = "0";
                        //リソースID
778
                        objectLog.resourceId = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId;
779
                    } else {   /* video */
780 781
                    	CONTENTVIEW.stopAllAudio();
                        CONTENTVIEW.showVideoObject(CONTENTVIEW.objType4_5[nIndex].x, CONTENTVIEW.objType4_5[nIndex].y, CONTENTVIEW.objType4_5[nIndex].width, CONTENTVIEW.objType4_5[nIndex].height, CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].fileName, false);
Masaru Abe committed
782 783 784
                        //詳細ログ用 動画なのでダミーで1以上
                        objectLog.actionTime = "1";
                        //リソースID
785
                        objectLog.resourceId = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId;
786 787 788 789 790
                    }
                    break;
                }
            }
        }
Masaru Abe committed
791 792
        
        //詳細ログ格納
793
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
794 795
        //---
        
796 797
    };
};
798
CONTENTVIEW_CREATEOBJECT.trigger.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
799 800

//Start Function : No.9 - Editor : Long - Date: 08/16/2013 - Summary : 
801
CONTENTVIEW_CREATEOBJECT.htmlLinkButton = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, resourceUrl, objectId) {
802

803
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
804
    this.action = function () {
805
    
Masaru Abe committed
806 807 808
        //abe
        //alert("htmlLinkButton");
    
809
        /*stop audio on page */
810
    	CONTENTVIEW.stopAllAudio();
811 812
        
        if (resourceUrl != "") {
Masaru Abe committed
813 814 815
        
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
816 817
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
818 819 820 821 822 823 824 825 826 827
            objectLog.objectId = objectId;
            objectLog.resourceId = "";
            objectLog.mediaType = mediaType;
            objectLog.actionType = actionType;
            objectLog.actionValue = "";
            objectLog.actionTime = "0";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
828
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
829 830
            //---
        
831 832
            CONTENTVIEW_CREATEOBJECT.showHtml(resourceUrl, objectId );
            CONTENTVIEW_GENERAL.showDialog(true);
833 834 835
        }        
    };
};
836 837 838
CONTENTVIEW_CREATEOBJECT.htmlLinkButton.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();

CONTENTVIEW_CREATEOBJECT.showHtml = function(url, objectId ){
839

Masaru Abe committed
840 841
    //abe
    //alert("showHtml");
842

843 844 845 846 847 848
    var $container = $('#dialog');
    
    $container.html('');
    $container.attr('style', 'background-color: white; width:100%; left:0% !important'); 
                 
   //START TRB00076 - EDITOR : Long - Date : 09/24/2013 - Summary : Fix for scrolling on ipad
849
    if(CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad"){       
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
        $container.html(
          '<h1>' 
        + '<img src="img/viewer/x.png" style="margin:3px 3px 0px 21px" id="btnClose" class="align_right" ></img>' 
        + '</h1>'
        + '<div id="html-wrap" style="height: 95%; position: absolute; width: 100%;">'
        + '<iframe src="'+ url +'" style="position: absolute; width: 100%; height: 100%; ">'
        + '</iframe>'
        + '</div>'
        );
        
        $('#html-wrap').css('overflow', 'scroll');
        $('#html-wrap').css('-webkit-overflow-scrolling', 'touch');
    }
    else{
        $container.html(
          '<h1>' 
        + '<img src="img/viewer/x.png" style="margin:3px 3px 0px 21px" id="btnClose" class="align_right" ></img>' 
        + '</h1>'
        + '<iframe src="'+ url +'" style="position: absolute; width: 100%; height: 95%; ">'
        + '</iframe>'
        );
    }
    //END TRB00076 - EDITOR : Long - Date : 09/24/2013 - Summary : Fix for scrolling on ipad 
    
    $('#dialog h1 img').click(function(){
Masaru Abe committed
875 876 877 878
    
        var dateEnd = new Date();
        var actionTime = dateEnd.subtractBySeconds(dateStart);
        //alert("actionTime:" + actionTime);
879
        COMMON.SetObjectLogActionTime( CONTENTVIEW_GENERAL.contentID, objectId, actionTime );
Masaru Abe committed
880
    
881
        $container.removeAttr('style');
882
        CONTENTVIEW_GENERAL.hideDialog();
Masaru Abe committed
883
        
884
    });
Masaru Abe committed
885 886 887
    
    var dateStart = new Date();
    
888
};
889

890
CONTENTVIEW_CREATEOBJECT.anket = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, questionNo, replyLimit, fullscreen, saveAs, resourceId, enquete, objectId) {
891

892
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
893
    this.action = function () {
894
    
Masaru Abe committed
895 896 897 898 899
        //abe
        //alert("anket");
    
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
900 901
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
902 903 904 905 906 907 908 909 910 911
        objectLog.objectId = objectId;
        objectLog.resourceId = resourceId;
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = enquete; //objectNameのほうが良かった
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
912
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
913
        //---
914
    
915
        /*stop audio on page */
916
        CONTENTVIEW.stopAllAudio();
917
         
918
        var url = CONTENTVIEW_GETDATA.getURLPageImage("webEnqueteReply/init") + "/?abObjectId="+objectId + "&sid=" + ClientData.userInfo_sid();
919 920 921 922 923 924
        
        var isFullScreen = false;
        if(parseInt(fullscreen) == 1){
            isFullScreen = true;
        }
        
925 926
        CONTENTVIEW_ANKET.showAnket(url, isFullScreen, objectId);
        CONTENTVIEW_GENERAL.showDialog(true);
927 928 929
           
    };
};
930
CONTENTVIEW_CREATEOBJECT.anket.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
931 932 933 934

//End Function : No.9 - Editor : Long - Date: 08/16/2013 - Summary : 

/* mediaType=3  Audio object : extends PageObject */
935
CONTENTVIEW_CREATEOBJECT.audioType3 = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, audioFile, audioResourceId, playType, objectId) {
936 937

    if (playType == "0") {
938
        this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
939
        this.action = function () {
Masaru Abe committed
940 941 942 943 944 945
        
            //abe
            //alert("audioType3_0");
    
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
946 947
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
948 949 950 951 952 953 954 955 956 957
            objectLog.objectId = objectId;
            objectLog.resourceId = audioResourceId;
            objectLog.mediaType = mediaType;
            objectLog.actionType = actionType;
            objectLog.actionValue = "";
            objectLog.actionTime = "0";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
958
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
959 960
            //---
        
961
            CONTENTVIEW_CREATEOBJECT.createAudio(audioFile, playType);
962 963 964 965 966
        };
    }
    else {
        //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
        if(playType == '2' || playType == 2){
Masaru Abe committed
967
            //
968 969
        }
        else{
Masaru Abe committed
970 971 972 973 974 975
        
            //abe
            //alert("audioType3_x");
    
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
976 977
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
978 979 980 981 982 983 984 985 986 987
            objectLog.objectId = objectId;
            objectLog.resourceId = audioResourceId;
            objectLog.mediaType = mediaType;
            objectLog.actionType = actionType;
            objectLog.actionValue = "";
            objectLog.actionTime = "0";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
988
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
989 990
            //---
        
991
            CONTENTVIEW_CREATEOBJECT.createAudio(audioFile, playType);
992 993
        }
        //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
994
        this.setup(mediaType, actionType, id, null, x, y, w, h, visible, null, null, objectId);
995
        this.action = function () {
Masaru Abe committed
996
            //
997 998 999
        };
    }
};
1000
CONTENTVIEW_CREATEOBJECT.audioType3.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1001 1002

/* mediaType = 1 and actionType = 5 jumpPage object*/
1003
CONTENTVIEW_CREATEOBJECT.jumpPage = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, jumpPage, objectId) {
1004
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1005
    this.action = function () {
1006
    
Masaru Abe committed
1007 1008 1009 1010 1011
        //abe
        //alert("jumpPage");
    
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1012 1013
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = jumpPage; //ページ飛び先
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1024
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1025
        //---
1026
    
1027 1028 1029
        if ((Number(jumpPage) - 1) != CONTENTVIEW_GETDATA.getPageIndex()) {
        	CONTENTVIEW_EVENTS.createLockLayout(true);
            CONTENTVIEW.changePage(Number(jumpPage) - 1);
1030 1031 1032
        }
    };
};
1033
CONTENTVIEW_CREATEOBJECT.jumpPage.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1034 1035

/* mediaType = 1 and actionType = 6 send mail object*/
1036
CONTENTVIEW_CREATEOBJECT.sendMail = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, emailSubject, emailAddress, objectId) {
1037
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1038
    this.action = function () {
Masaru Abe committed
1039 1040 1041
    
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1042 1043
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = emailAddress; //メールアドレス
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1054
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1055 1056
        //---
    
1057
        CONTENTVIEW_POPUPTEXT.MailTo(emailAddress, emailSubject);
1058 1059
    };
};
1060
CONTENTVIEW_CREATEOBJECT.sendMail.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1061 1062

/* mediaType = 1 and actionType = 8 open popup object*/
1063
CONTENTVIEW_CREATEOBJECT.openPopUp = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, content, objectId) {
1064
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1065
    this.action = function () {
1066
    
Masaru Abe committed
1067
        //abe
1068
        //alert("openPopUp:" + CONTENTVIEW_GETDATA.getPageIndex() + " id:" + objectId);
Masaru Abe committed
1069 1070 1071
        
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1072 1073
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = "";
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1084
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1085 1086
        //---
        
1087 1088
        CONTENTVIEW_GENERAL.isOpenPopUpText = true;
        var pt1 = CONTENTVIEW.imageToScreen(x, y + h / 2);
1089

1090 1091
        if (CONTENTVIEW.userScale > 1) {
        	CONTENTVIEW_POPUPTEXT.OpenPopupText(CONTENTVIEW_GENERAL.posXPopupMemo, CONTENTVIEW_GENERAL.posYPopupMemo, content, $('#dialogPopUp'), $('#arrow'));
1092
        } else if ($("#header_toolbar").is(":hidden")) {
1093
        	CONTENTVIEW_POPUPTEXT.OpenPopupText(pt1.x, pt1.y - 65, content, $('#dialogPopUp'), $('#arrow'));
1094
        } else {
1095
        	CONTENTVIEW_POPUPTEXT.OpenPopupText(pt1.x, pt1.y, content, $('#dialogPopUp'), $('#arrow'));
1096 1097 1098
        }
    };
};
1099
CONTENTVIEW_CREATEOBJECT.openPopUp.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1100

1101
CONTENTVIEW_CREATEOBJECT.moveContentParam = {};
1102 1103

/* mediaType = 1 and actionType = 10 move to Content object*/
1104
CONTENTVIEW_CREATEOBJECT.moveToContent = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, contentId, pageNo, objectId) {
1105
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1106
    this.action = function () {
Masaru Abe committed
1107 1108 1109
    
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1110 1111
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = contentId;
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1122
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1123 1124
        //---
    
1125
        ///* set end log */
1126
        //COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
Masaru Abe committed
1127
        //COMMON.RegisterLog();
1128
        //START TRB00033 - EDITOR: Long - Date : 09/12/2013 - Summary : limit content
1129
        AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
1130 1131 1132 1133 1134
             "webGetContent",
             "GET",
             { contentId: contentId, sid: ClientData.userInfo_sid(), getType: 1 },
             function (data) {
                 
1135
                 /* set end log */
1136
                 COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
Masaru Abe committed
1137
                 COMMON.RegisterLog();
1138
                 
1139 1140
                 if(data.contentData.alertMessageLevel){                    
                     
1141
                     if(data.contentData.alertMessageLevel == CONTENTVIEW_CREATEOBJECT.alertMessageLevel.ShowAlert){
1142
                         if(data.contentData.alertMessage){                           
1143
                            var oldContent = { oldContentID: CONTENTVIEW_GENERAL.contentID, oldPageIndex: CONTENTVIEW_GETDATA.getPageIndex() };
1144
                            
1145 1146
                            CONTENTVIEW_CREATEOBJECT.moveContentParam = {};                          
                            CONTENTVIEW_CREATEOBJECT.moveContentParam = {
1147 1148 1149 1150 1151
                                'preContentId' : contentId,
                                'prePageNo' : pageNo,
                                'oldContent' : oldContent
                            };   
                                                                                 
1152
                            CONTENTVIEW_CREATEOBJECT.showContentConfirmDialog(data.contentData.alertMessageLevel, data.contentData.alertMessage);                                                                               
1153 1154
                         }
                     }
1155
                     else if(data.contentData.alertMessageLevel == CONTENTVIEW_CREATEOBJECT.alertMessageLevel.RequirePassword){
1156
                                                
1157
                            var oldContent = { oldContentID: CONTENTVIEW_GENERAL.contentID, oldPageIndex: CONTENTVIEW_GETDATA.getPageIndex() };
1158
                            
1159 1160
                            CONTENTVIEW_CREATEOBJECT.moveContentParam = {};                          
                            CONTENTVIEW_CREATEOBJECT.moveContentParam = {
1161 1162 1163 1164 1165
                                'preContentId' : contentId,
                                'prePageNo' : pageNo,
                                'oldContent' : oldContent
                            };   
                                                 
1166
                            CONTENTVIEW_CREATEOBJECT.showContentConfirmDialog(data.contentData.alertMessageLevel);
1167
                     }
1168
                     else if(data.contentData.alertMessageLevel == CONTENTVIEW_CREATEOBJECT.alertMessageLevel.None){
1169 1170 1171 1172
                            ClientData.common_preContentId(contentId);
                            ClientData.common_prePageNo(pageNo);
                
                            /* store old page */   
1173
                            var oldContent = { oldContentID: CONTENTVIEW_GENERAL.contentID, oldPageIndex: CONTENTVIEW_GETDATA.getPageIndex() };                                   
1174 1175 1176
                            var dataJump = ClientData.JumpQueue();                
                            dataJump.push(oldContent);               
                            ClientData.JumpQueue(dataJump);                                       
1177
                            AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
1178 1179 1180 1181 1182 1183 1184 1185
                     }
                 }
                 //Type 0
                 else{
                        ClientData.common_preContentId(contentId);
                        ClientData.common_prePageNo(pageNo);
                
                        /* store old page */   
1186
                        var oldContent = { oldContentID: CONTENTVIEW_GENERAL.contentID, oldPageIndex: CONTENTVIEW_GETDATA.getPageIndex() };                                   
1187 1188 1189
                        var dataJump = ClientData.JumpQueue();                
                        dataJump.push(oldContent);               
                        ClientData.JumpQueue(dataJump);  
1190
                        AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
1191 1192 1193
                 }
                          
             },
1194 1195
             function (xmlHttpRequest, txtStatus, errorThrown) {
                 if (xmlHttpRequest.status == 404) {
1196
                     showAlertScreen(I18N.i18nText('msgContentNotExist'));
1197 1198 1199
                 }
                 else {
                     // Show system error
1200
                	 AVWEB.showSystemError();
1201 1202 1203 1204
                 }
             }
        );
        //END TRB00033 - EDITOR: Long - Date : 09/12/2013 - Summary : limit content                                     
1205 1206 1207
    };
    
};
1208
CONTENTVIEW_CREATEOBJECT.moveToContent.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1209 1210
//START TRB00033 - EDITOR: Long - Date : 09/12/2013 - Summary : limit content

1211
CONTENTVIEW_CREATEOBJECT.showContentConfirmDialog = function(type, msg) {  
1212
    
1213 1214 1215
    if(type == CONTENTVIEW_CREATEOBJECT.alertMessageLevel.ShowAlert){
    	CONTENTVIEW_CREATEOBJECT.createAlertTypeDialog(msg);
        CONTENTVIEW_GENERAL.showDialog(true);
1216
    }
1217 1218 1219
    else if(type == CONTENTVIEW_CREATEOBJECT.alertMessageLevel.RequirePassword){
    	CONTENTVIEW_CREATEOBJECT.createPwdRequiredTypeDialog();
        CONTENTVIEW_GENERAL.showDialog(true);
1220 1221 1222
    }
};

1223
CONTENTVIEW_CREATEOBJECT.createAlertTypeDialog = function(msg){
1224 1225 1226 1227 1228 1229
    var $container = $('#dialog');
    $container.html('');
    $container.addClass('sectionLimitAccess');

    $container.draggable({ handle: "h1" });
    $container.html(
1230
    '  <h1 class="lang" lang="txtContentWarning">'+ I18N.i18nText("txtContentWarning") +'</h1>'
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240
    +'  <p class="message">'
    +       msg     
    +'  </p>'
    +'  <p class="deletebtn">'
    +'      <a lang="dspOK" class="ok lang" id="contentAlertOk">OK</a>'
    +'      <a lang="dspCancel" class="cancel lang" id="contentAlertCancel">キャンセル</a>'
    +'  </p>'
    );               
    $container.center(); 
    $('#dialog a#contentAlertCancel').click(function(){
1241
    	CONTENTVIEW_GENERAL.hideDialog();        
1242 1243 1244 1245 1246 1247 1248
        var removeTimeOut = setTimeout(function(){
            $container.removeClass('sectionLimitAccess');
        }, 200);      
    });
    
    $('#dialog a#contentAlertOk').click(function(){
        
1249 1250
        ClientData.common_preContentId(CONTENTVIEW_CREATEOBJECT.moveContentParam.preContentId);
        ClientData.common_prePageNo(CONTENTVIEW_CREATEOBJECT.moveContentParam.prePageNo);
1251 1252 1253
        
        /* store old page */                                      
        var dataJump = ClientData.JumpQueue();                
1254
        dataJump.push(CONTENTVIEW_CREATEOBJECT.moveContentParam.oldContent);                      
1255
        ClientData.JumpQueue(dataJump);                  
1256
        AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);        
1257 1258 1259
    });
};

1260
CONTENTVIEW_CREATEOBJECT.createPwdRequiredTypeDialog = function(){
1261 1262 1263 1264 1265
    var $container = $('#dialog');
    $container.html('');
    $container.addClass('sectionLimitAccess');
    $container.draggable({ handle: "h1" });
    $container.html(
1266
    '  <h1 class="lang" lang="txtContentPWTitle">'+ I18N.i18nText("txtContentPWTitle") +'</h1>'
1267
    +' <p class="message">'
1268
    +'  <label class="text lang" lang="txtContentPWMsg">'+ I18N.i18nText("txtContentPWMsg") +'</label>'
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
    +'      <input type="password" />'
    +'      <label class="error" id="lblMessageLimitError"></label> '  
    +'  </p>'
    +'  <p class="deletebtn">'
    +'      <a lang="dspOK" class="ok lang" id="contentAlertOk">OK</a>'
    +'      <a lang="dspCancel" class="cancel lang" id="contentAlertCancel">キャンセル</a>'
    +'  </p>'
    );           
    $container.center();       
    
    $('#dialog a#contentAlertCancel').click(function(){
1280
    	CONTENTVIEW_GENERAL.hideDialog();        
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291
        var removeTimeOut = setTimeout(function(){
            $container.removeClass('sectionLimitAccess');
        }, 200);
        
    });

    
    $('#dialog a#contentAlertOk').click(
        function () {
            var password = $('.sectionLimitAccess .message input').val();
            if (!ValidationUtil.CheckRequiredForText(password)) {
1292
                $('#lblMessageLimitError').html(I18N.i18nText('msgPwdEmpty')).show();
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303
                return;
            }

            // start login
            var params = {
                previousSid: ClientData.userInfo_sid(),
                loginId: ClientData.userInfo_loginId_session(),
                password: password,
                urlpath: ClientData.userInfo_accountPath()
            };
            // Get url to login
1304
            var sysSettings = AVWEB.avwSysSetting();
1305 1306
            var apiLoginUrl = sysSettings.apiLoginUrl;

1307
            AVWEB.avwCmsApiSyncWithUrl(apiLoginUrl, null, 'webClientLogin', 'GET', params,
1308 1309
        function (data) {
            if (data.result == 'success') {                
1310 1311
                ClientData.common_preContentId(CONTENTVIEW_CREATEOBJECT.moveContentParam.preContentId);
                ClientData.common_prePageNo(CONTENTVIEW_CREATEOBJECT.moveContentParam.prePageNo);
1312 1313 1314
                
                /* store old page */                                      
                var dataJump = ClientData.JumpQueue();                
1315
                dataJump.push(CONTENTVIEW_CREATEOBJECT.moveContentParam.oldContent);                      
1316 1317 1318 1319 1320 1321
                ClientData.JumpQueue(dataJump);        
                
                
                // update sid id
                ClientData.userInfo_sid(data.sid);  
                        
1322
                AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);                                         
1323 1324
            }
            else {
1325
                $('#lblMessageLimitError').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString()).show();
1326 1327 1328 1329 1330 1331 1332
            }
        },
        function (xhr, statusText, errorThrown) {
            var errorCode = 'E001';
            if (xhr.responseText && xhr.status != 0) {
                errorCode = JSON.parse(xhr.responseText).errorMessage;
            }
1333
            $('#lblMessageLimitError').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), errorCode).toString()).show();
1334 1335 1336 1337 1338 1339 1340 1341
        });

        }
    );
};
//END TRB00033 - EDITOR: Long - Date : 09/12/2013 - Summary : limit content

/* mediaType=2  Video object : extends PageObject */
1342
CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, mediaFile, media, embed, objectId) {
1343

1344
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, embed, objectId);
1345
    this.action = function () {
1346
    
Masaru Abe committed
1347
        //abe
1348
        //alert("videoType2:" + CONTENTVIEW_GETDATA.getPageIndex());
Masaru Abe committed
1349 1350 1351
    
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1352 1353
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363
        objectLog.objectId = objectId;
        objectLog.resourceId = media; //mediaにリソースIDが入っている
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = "";
        objectLog.actionTime = "1";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1364
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1365
        //---
1366
    
1367
        /*stop audio on page */
1368
        CONTENTVIEW.stopAllAudio();
1369
        if (embed == "1") {
1370
        	CONTENTVIEW.showVideoObject(x, y, w, h, mediaFile, false);
1371 1372 1373 1374 1375
        } 
        else {
            if (media != '') {
                $('#playvideo').children().remove();

1376
                CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
1377 1378

                $("#btnCloseVideo").click(function (e) {
Masaru Abe committed
1379 1380 1381 1382
                
                    //時間記録
                    
                
1383
                	CONTENTVIEW_GENERAL.hideDialog();
1384
                    /*play audio if exist */
1385
                    CONTENTVIEW.playAllAudio();
Masaru Abe committed
1386
                    
1387 1388
                });

1389
                CONTENTVIEW_GENERAL.showDialog(true);
1390 1391 1392 1393
            }
        }
    };
};
1394
CONTENTVIEW_CREATEOBJECT.videoType2.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1395 1396

/* mediaType = 1 and actionType = 0 linkURL object*/
1397
CONTENTVIEW_CREATEOBJECT.imageNoAction = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, objectId) {
1398
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1399 1400 1401 1402
    this.action = function () {
        //no action
    };
};
1403
CONTENTVIEW_CREATEOBJECT.imageNoAction.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1404 1405

/* mediaType=1  Video object : extends PageObject */
1406
CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, mediaFile, media, mediaResourceId, objectId) {
1407
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1408
    this.action = function () {
1409
    
1410
        if (media != '') {
Masaru Abe committed
1411 1412
        
            //abe
1413
            //alert("videoType1:" + CONTENTVIEW_GETDATA.getPageIndex());
Masaru Abe committed
1414 1415
            //詳細ログ作成
            var objectLog = new ObjectLogEntity();
1416 1417
            objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
            objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427
            objectLog.objectId = objectId;
            objectLog.resourceId = mediaResourceId; //リソースID
            objectLog.mediaType = mediaType;
            objectLog.actionType = actionType;
            objectLog.actionValue = media; //リソースファイル名
            objectLog.actionTime = "1";
            objectLog.locationX = x;
            objectLog.locationY = y;
            objectLog.locationHeight = h;
            objectLog.locationWidth = w;
1428
            COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1429 1430
            //---
        
1431
            /* stop all audio on page */
1432
            CONTENTVIEW.stopAllAudio();
1433

1434
            CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
1435 1436

            $("#btnCloseVideo").click(function (e) {
Masaru Abe committed
1437 1438 1439 1440 1441
            
                //時間記録
                var dateEnd = new Date();
                var actionTime = dateEnd.subtractBySeconds(dateStart);
                //alert("actionTime:" + actionTime);
1442
                COMMON.SetObjectLogActionTime( CONTENTVIEW_GENERAL.contentID, objectId, actionTime );
Masaru Abe committed
1443
            
1444
                CONTENTVIEW_GENERAL.hideDialog();
1445
                /* play audio  */
1446
                CONTENTVIEW.playAllAudio();
1447 1448
            });

1449
            CONTENTVIEW_GENERAL.showDialog(true);
Masaru Abe committed
1450
            
1451
        }
Masaru Abe committed
1452 1453 1454 1455
        
        //時間記録
        var dateStart = new Date();
        
1456 1457
    };
};
1458
CONTENTVIEW_CREATEOBJECT.videoType1.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1459 1460

/* mediaType=1 and actionType = 2  Audio object : extends PageObject */
1461
CONTENTVIEW_CREATEOBJECT.audioType1 = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, audioFile, audio, audioResourceId, objectId) {
1462
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1463
    this.action = function () {
1464
    
Masaru Abe committed
1465 1466 1467 1468
        //abe
        //alert("audioType1");
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1469 1470
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1471 1472 1473 1474 1475 1476 1477 1478 1479 1480
        objectLog.objectId = objectId;
        objectLog.resourceId = audioResourceId; //リソースID
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = audio;
        objectLog.actionTime = "1";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1481
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1482
        //---
1483
    
1484
        CONTENTVIEW_CREATEOBJECT.createAudio(audioFile, "0")
1485 1486
    };
};
1487
CONTENTVIEW_CREATEOBJECT.audioType1.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1488 1489

/* mediaType = 1 and actionType = 3 linkURL object*/
1490
CONTENTVIEW_CREATEOBJECT.linkURL = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, actionFunction, linkUrl, browserType, objectId) {
1491
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, actionFunction, null, objectId);
1492
    this.action = function () {
1493
    
Masaru Abe committed
1494 1495
        //abe
        //alert("linkURL");
1496
        
Masaru Abe committed
1497 1498
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1499 1500
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        objectLog.actionValue = linkUrl;
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
1511
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1512
        //---
1513 1514 1515 1516
        
        var linkUrlTmp = linkUrl;
        //DHカスタム
        if( ClientData.serviceOpt_daihatsu() == 'Y'){
Masaru Abe committed
1517
            var apiUrl = AVWEB.getApiUrl(ClientData.userInfo_accountPath());
1518 1519 1520 1521
            linkUrlTmp = linkUrlTmp + "?sid=" + ClientData.userInfo_sid() + "&apiurl=" + apiUrl ;
        }
        
        if( browserType == 0 ){
1522 1523
        	CONTENTVIEW_CREATEOBJECT.showHtml(linkUrlTmp, objectId );
            CONTENTVIEW_GENERAL.showDialog(true);
1524 1525 1526 1527
        } else {
            window.open(linkUrlTmp, "_blank", "new window, scrollbars=yes");
        }
        
1528 1529
    };
};
1530
CONTENTVIEW_CREATEOBJECT.linkURL.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1531 1532

/* mediaType = 1 and actionType = 4 imagePreview object*/
1533
CONTENTVIEW_CREATEOBJECT.imagePreview = function (mediaType, actionType, id, imageUrl, x, y, w, h, visible, imagePreview, imagePreviewResourceIds, objectId) {
1534
    this.setup(mediaType, actionType, id, imageUrl, x, y, w, h, visible, null, null, objectId);
1535 1536
    this.action = function () {

Masaru Abe committed
1537 1538 1539 1540
        //abe
        //alert("imagePreview");
        //詳細ログ作成
        var objectLog = new ObjectLogEntity();
1541 1542
        objectLog.contentid = CONTENTVIEW_GENERAL.contentID;
        objectLog.pageNo = CONTENTVIEW_GETDATA.getPageIndex() + 1; //0始まりのページ番号
Masaru Abe committed
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565
        objectLog.objectId = objectId;
        objectLog.resourceId = "";
        objectLog.mediaType = mediaType;
        objectLog.actionType = actionType;
        //objectLog.actionValue = "";
        objectLog.actionTime = "0";
        objectLog.locationX = x;
        objectLog.locationY = y;
        objectLog.locationHeight = h;
        objectLog.locationWidth = w;
        
        //プレビュー画像のリソースIDカンマ区切りでセット
        var actionVal = "";
        if(imagePreviewResourceIds){
            for (var nIndex = 0; nIndex < imagePreviewResourceIds.length; nIndex++) {
                if( nIndex > 0 ){
                    actionVal = actionVal + ",";
                }
                actionVal = actionVal + imagePreviewResourceIds[nIndex];
            }
        }
        objectLog.actionValue = actionVal;
        
1566
        COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
Masaru Abe committed
1567
        //---
1568

1569
        CONTENTVIEW_CREATEOBJECT.createImagePreview();
1570

1571
        CONTENTVIEW_IMAGEPREVIEW.showImagePreview($('#divImagePreview'), imagePreview);
1572

Masaru Abe committed
1573 1574 1575 1576 1577 1578
        $("#btnClose").live('click', function (e) {
        
            //時間記録
            var dateEnd = new Date();
            var actionTime = dateEnd.subtractBySeconds(dateStart);
            //alert("actionTime:" + actionTime);
1579
            COMMON.SetObjectLogActionTime( CONTENTVIEW_GENERAL.contentID, objectId, actionTime );
Masaru Abe committed
1580
        
1581
            CONTENTVIEW_GENERAL.hideDialog();
Masaru Abe committed
1582
        });
1583

1584
        CONTENTVIEW_GENERAL.showDialog(true);
Masaru Abe committed
1585 1586 1587 1588
        
        //時間記録
        var dateStart = new Date();
        
1589 1590
    };
};
1591
CONTENTVIEW_CREATEOBJECT.imagePreview.prototype = new CONTENTVIEW_CREATEOBJECT.PageObject();
1592 1593

/* rect object */
1594
CONTENTVIEW_CREATEOBJECT.Rect = function (x, y, w, h) {
1595 1596 1597 1598 1599 1600 1601
    this.left = Math.floor(x);
    this.top = Math.floor(y);
    this.right = Math.floor(x + w);
    this.bottom = Math.floor(y + h);
    this.width = w;
    this.height = h;
};
1602
CONTENTVIEW_CREATEOBJECT.Rect.prototype.add = function (x, y) {
1603 1604 1605 1606 1607 1608 1609
    this.left = Math.floor(this.left + x);
    this.right = Math.floor(this.right + x);
    this.top = Math.floor(this.top + y);
    this.bottom = Math.floor(this.bottom + y);
    this.width = this.right - this.left;
    this.height = this.bottom - this.top;
};
1610
CONTENTVIEW_CREATEOBJECT.Rect.prototype.center = function () {
1611 1612
    var x = (this.left + this.right) / 2;
    var y = (this.top + this.bottom) / 2;
1613
    return new CONTENTVIEW.Point(Math.floor(x), Math.floor(y));
1614 1615 1616 1617 1618
};

/**
* Content Class Definition 
*/
1619
CONTENTVIEW_CREATEOBJECT.Content = function () {
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629

    this.pageCount = 0;
    this.pageIndex = 0;
    this.pageImages = null;
    this.pageObjects = null;
    this.currentPage = null;

};

/* ste page images (json data) */
1630
CONTENTVIEW_CREATEOBJECT.Content.prototype.setPageImages = function (pageCount, imageUrls) {
1631 1632 1633 1634 1635 1636
    this.pageCount = pageCount;
    this.pageImages = imageUrls;
    return this;
};

/* set page objects data (json data) */
1637
CONTENTVIEW_CREATEOBJECT.Content.prototype.setPageObjects = function (pageObjects) {
1638 1639 1640 1641 1642
    this.pageObjects = pageObjects;
    return this;
};

/* Set up page */
1643
CONTENTVIEW_CREATEOBJECT.Content.prototype.setUpPage = function (pageIndex, opt) {
1644

1645
    this.currentPage = CONTENTVIEW_CREATEOBJECT.createPage(
Vo Duc Thang committed
1646 1647 1648 1649
                            this.pageIndex,
                            this.pageImages,
                            this.pageObjects,
                            function () {
1650 1651
                                //adjustPage(opt);
                            	CONTENTVIEW.drawCanvas(opt);
Vo Duc Thang committed
1652
                            });
1653 1654 1655 1656
    return this;
};

/* check next page exists */
1657
CONTENTVIEW_CREATEOBJECT.Content.prototype.hasNextPage = function () {
1658 1659 1660 1661 1662 1663 1664 1665

    if ((this.pageIndex + 1) > (this.pageCount - 1)) {
        return false;
    }
    return true;
};

/* setup next page */
1666
CONTENTVIEW_CREATEOBJECT.Content.prototype.nextPage = function () {
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676
    this.pageIndex++;
    if (this.pageIndex > (this.pageCount - 1)) {
        
        this.pageIndex = this.pageCount - 1;
    }
    this.setUpPage(this.pageIndex, 1);
    return this;
};

/* check previous page exists */
1677
CONTENTVIEW_CREATEOBJECT.Content.prototype.hasPreviousPage = function () {
1678 1679 1680 1681 1682 1683 1684
    if ((this.pageIndex - 1) < 0) {
        return false;
    }
    return true;
};

/* setup previous page */
1685
CONTENTVIEW_CREATEOBJECT.Content.prototype.previousPage = function () {
1686 1687 1688 1689 1690 1691 1692 1693 1694
    this.pageIndex--;
    if (this.pageIndex < 0) {
        this.pageIndex = 0;
    }
    this.setUpPage(this.pageIndex, 2);
    return this;
};

/* setup previous page */
1695
CONTENTVIEW_CREATEOBJECT.Content.prototype.toPage = function (index) {
1696 1697 1698 1699 1700 1701 1702
    this.pageIndex = eval(index);
    if (this.pageIndex < 0) {
        this.pageIndex = 0;
    }
    this.setUpPage(this.pageIndex);
    
    //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
1703
    CONTENTVIEW_CREATEOBJECT.createPageBGM();
1704 1705 1706 1707 1708 1709 1710
    //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
    return this;
};

/**
* Transition Class Definition 
*/
1711
CONTENTVIEW_CREATEOBJECT.Transition = function(){ };
1712 1713 1714

//Start Functon : No.4 - Editor : Long - Date : 08/09/2013 - Summary : 
/* Flip Next Page Transition */
1715
CONTENTVIEW_CREATEOBJECT.Transition.prototype.flipNextPage = function () {
1716
    
1717 1718 1719
    //#12373
    var tmpScale = 1;
    
1720
    var w = $('#canvasWrapper').width();
1721 1722 1723
    CONTENTVIEW.removeObject();
    if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_FadeIn){
        $('#mainNext').css('left', CONTENTVIEW.marginX + 'px');
1724 1725 1726 1727 1728 1729 1730
        $('#mainNext').css('display', 'block');
        $('#main').css('z-index', '1');
    }
    else{
        $('#mainNext').css('display', 'block');
    }
         
1731
    if (CONTENTVIEW_GETDATA.getContent().hasNextPage()) {
1732
       
1733 1734 1735
       tmpScale = CONTENTVIEW.userScale;
       CONTENTVIEW.userScale = 1;
       CONTENTVIEW.flip(1);
1736
       
1737
       if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_Slide){
1738 1739 1740
           $('#canvasWrapper').stop(true).animate(
                { left: '-' + w + 'px' },
                {
1741
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
1742
                    complete: function () {                                                                                                                            
1743
                        
1744
                    	CONTENTVIEW_GETDATA.assignCurrentContentPage(1);
1745
                        
1746
                        //Change id of canvas
1747
                        CONTENTVIEW_GETDATA.switchCanvas(1);
1748 1749
                        
                        //restore canvas event
1750
                        CONTENTVIEW.setDefaultEvent();
1751 1752
                        
                        //init image bookmark                       
1753
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
1754 1755
                                                                        
                        //Change slider
1756
                        CONTENTVIEW.changeSlider(CONTENTVIEW_GETDATA.getContent().pageIndex);
1757 1758
                        
                        //Draw marking on current screen
1759
                        //CONTENTVIEW.drawMarkingOnScreen();                                            
1760 1761
                        
                        //Correct position of canvas for next flipping
1762
                        CONTENTVIEW_GETDATA.correctCanvasPosition();
1763 1764
                       
                       //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
1765
                        CONTENTVIEW_CREATEOBJECT.createPageBGM();
1766
                       //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM                             
1767
                        if(CONTENTVIEW_GETDATA.getPageIndex() < CONTENTVIEW_GENERAL.totalPage - 1){
1768 1769
                            
                            //Get Next Page Object
1770
                        	CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() + 1);
1771 1772
                                                        
                            //Load Next
1773
                            CONTENTVIEW_GETDATA.renderNextPage();                                     
1774 1775 1776
                            
                        }else{
                            //Enable all control
1777
                        	CONTENTVIEW_GENERAL.enableAllControl(); 
1778
                            $('#divImageLoading').css('display', 'none');
1779
                            CONTENTVIEW_GENERAL.isLoadingObject = false;
1780 1781 1782
                        }                                                 
                                                                                                        
                        /* init image had draw */
1783
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
1784 1785
                        
                        /* change title of page */
1786 1787 1788
                        if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex]) {
                            if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] + ' | ' + I18N.i18nText('sysAppTitle');
1789
                            } else {
1790
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1791 1792
                            }
                        } else {
1793
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1794 1795
                        }
                        /* set end log */
1796 1797 1798
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_EVENTS.createLockLayout(false);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
1799 1800 1801 1802
                        
                        //#12373
                        //console.log("tmpScale:" + tmpScale);
                        if (tmpScale != 1) {
1803 1804 1805 1806
                        	CONTENTVIEW.userScale = tmpScale;
                        	CONTENTVIEW.changeScale(CONTENTVIEW.userScale);
                            CONTENTVIEW.flip();
                            CONTENTVIEW.checkDisableButtonZoom();
1807 1808
                        }
                        
1809 1810 1811
                    }
                });
       }
1812
       else if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_FadeIn){
1813 1814
           $('#main').stop(true).fadeOut(
                {                   
1815
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
1816 1817
                    complete: function () {                                                                                                                            
                              
1818
                    	CONTENTVIEW_GETDATA.assignCurrentContentPage(1);
1819 1820
                                                                                    
                        //Change id of canvas
1821
                        CONTENTVIEW_GETDATA.switchCanvas(1);
1822 1823
                        
                        //restore canvas event
1824
                        CONTENTVIEW.setDefaultEvent();
1825 1826
                        
                        //init image bookmark                       
1827
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
1828 1829
                                                                        
                        //Change slider
1830
                        CONTENTVIEW.changeSlider(CONTENTVIEW_GETDATA.getContent().pageIndex);
1831 1832
                        
                        //Draw marking on current screen
1833
                        //CONTENTVIEW.drawMarkingOnScreen();                                            
1834 1835
                        
                        //Correct position of canvas for next flipping
1836
                        CONTENTVIEW_GETDATA.correctCanvasPosition();
1837 1838
                                        
                                        
1839
                        if(CONTENTVIEW_GETDATA.getPageIndex() < CONTENTVIEW_GENERAL.totalPage - 1){
1840 1841
                            
                            //Get Next Page Object
1842
                        	CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() + 1);
1843 1844
                                                        
                            //Load Next
1845
                            CONTENTVIEW_GETDATA.renderNextPage();
1846 1847 1848 1849
                                         
                        }
                        else{
                            //Enable all control
1850
                        	CONTENTVIEW_GENERAL.enableAllControl(); 
1851
                            $('#divImageLoading').css('display', 'none');
1852
                            CONTENTVIEW_GENERAL.isLoadingObject = false;
1853 1854 1855
                        }                                                
                                 
                        /* init image had draw */
1856
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
1857 1858
                                      
                        /* change title of page */
1859 1860 1861
                        if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex]) {
                            if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] + ' | ' + I18N.i18nText('sysAppTitle');
1862
                            } else {
1863
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1864 1865
                            }
                        } else {
1866
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1867 1868
                        }
                        /* set end log */
1869 1870 1871
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_EVENTS.createLockLayout(false);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
1872 1873 1874
                    }
                });
        }
1875
       CONTENTVIEW_INITOBJECT.initImageCheckMarking();          
1876 1877 1878
    }
};
/* Flip Previous Page Transition */
1879
CONTENTVIEW_CREATEOBJECT.Transition.prototype.flipPreviousPage = function () {
1880 1881 1882 1883

    //#12373
    var tmpScale = 1;

1884
    var w = $('#canvasWrapper').width();
1885 1886 1887
    CONTENTVIEW.removeObject();
    if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_FadeIn){
        $('#mainPre').css('left', CONTENTVIEW.marginX + 'px');
1888 1889 1890 1891 1892 1893
        $('#mainPre').css('display', 'block');
        $('#main').css('z-index', '1');
    }
    else{
        $('#mainPre').css('display', 'block');
    }
1894
    if (CONTENTVIEW_GETDATA.getContent().hasPreviousPage()) {
1895
    
1896 1897 1898
        tmpScale = CONTENTVIEW.userScale;
        CONTENTVIEW.userScale = 1;
        CONTENTVIEW.flip(2);
1899
    
1900
        if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_Slide){
Vo Duc Thang committed
1901
            $('#canvasWrapper').stop(true).animate(
1902 1903
                { left: w + 'px' },
                {
1904
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
1905 1906
                    complete: function () {                                                                                                                            
                              
1907
                    	CONTENTVIEW_GETDATA.assignCurrentContentPage(2);
1908 1909
                                                                                    
                        //Change id of canvas
1910
                        CONTENTVIEW_GETDATA.switchCanvas(2);
1911 1912
                        
                        //restore canvas event
1913
                        CONTENTVIEW.setDefaultEvent();
1914 1915
                        
                        //init image bookmark                       
1916
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
1917 1918
                                                                        
                        //Change slider
1919
                        CONTENTVIEW.changeSlider(CONTENTVIEW_GETDATA.getContent().pageIndex);
1920 1921
                        
                        //Draw marking on current screen
1922
                        //CONTENTVIEW.drawMarkingOnScreen();                                            
1923 1924
                        
                        //Correct position of canvas for next flipping
1925
                        CONTENTVIEW_GETDATA.correctCanvasPosition();
1926 1927
                        
                        //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM              
1928
                        CONTENTVIEW_CREATEOBJECT.createPageBGM();
1929
                        //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
1930
                        if(CONTENTVIEW_GETDATA.getPageIndex() > 0){
1931 1932
                            
                            //Get Next Page Object
1933
                        	CONTENTVIEW_GETDATA.getPrevPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() - 1);
1934 1935
                                                        
                            //Load Next
1936
                            CONTENTVIEW_GETDATA.renderPrevPage();
1937 1938
                        }else{
                            //Enable all control
1939
                        	CONTENTVIEW_GENERAL.enableAllControl(); 
1940
                            $('#divImageLoading').css('display', 'none');
1941
                            CONTENTVIEW_GENERAL.isLoadingObject = false;
1942 1943 1944
                        }                                                                            
                               
                        /* init image had draw */
1945
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
1946
                        /* change title of page */
1947 1948 1949
                        if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex]) {
                            if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] + ' | ' + I18N.i18nText('sysAppTitle');
1950
                            } else {
1951
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1952 1953
                            }
                        } else {
1954
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
1955 1956
                        }
                        /* set end log */
1957 1958 1959
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_EVENTS.createLockLayout(false);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
1960 1961 1962 1963
                        
                        //#12373
                        //console.log("tmpScale:" + tmpScale);
                        if (tmpScale != 1) {
1964 1965 1966 1967
                        	CONTENTVIEW.userScale = tmpScale;
                        	CONTENTVIEW.changeScale(CONTENTVIEW.userScale);
                            CONTENTVIEW.flip();
                            CONTENTVIEW.checkDisableButtonZoom();
1968 1969 1970
                        }
                        
                        
1971 1972 1973 1974 1975 1976
                    }
                });
        }
        else{
            $('#main').stop(true).fadeOut(
                {
1977
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
1978 1979
                    complete: function () {                                                                                                                            
                              
1980
                    	CONTENTVIEW_GETDATA.assignCurrentContentPage(2);
1981 1982
                                                                                    
                        //Change id of canvas
1983
                        CONTENTVIEW_GETDATA.switchCanvas(2);
1984 1985
                        
                        //restore canvas event
1986
                        CONTENTVIEW.setDefaultEvent();
1987 1988
                        
                        //init image bookmark                       
1989
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
1990 1991
                                                                        
                        //Change slider
1992
                        CONTENTVIEW.changeSlider(CONTENTVIEW_GETDATA.getContent().pageIndex);
1993 1994
                        
                        //Draw marking on current screen
1995
                        //CONTENTVIEW.drawMarkingOnScreen();                                            
1996 1997
                        
                        //Correct position of canvas for next flipping
1998
                        CONTENTVIEW_GETDATA.correctCanvasPosition();
1999 2000
                                        
                                        
2001
                        if(CONTENTVIEW_GETDATA.getPageIndex() > 0){
2002 2003
                            
                            //Get Next Page Object
2004
                        	CONTENTVIEW_GETDATA.getPrevPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() - 1);
2005 2006
                                                        
                            //Load Next
2007
                            CONTENTVIEW_GETDATA.renderPrevPage();
2008 2009
                        }else{
                            //Enable all control
2010
                        	CONTENTVIEW_GENERAL.enableAllControl(); 
2011
                            $('#divImageLoading').css('display', 'none');
2012
                            CONTENTVIEW_GENERAL.isLoadingObject = false;
2013 2014 2015
                        }                                                                        
                                                       
                        /* init image had draw */
2016
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
2017 2018
     
                        /* change title of page */
2019 2020 2021
                        if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex]) {
                            if (CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[CONTENTVIEW_GETDATA.getContent().pageIndex] + ' | ' + I18N.i18nText('sysAppTitle');
2022
                            } else {
2023
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
2024 2025
                            }
                        } else {
2026
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
2027 2028
                        }
                        /* set end log */
2029 2030 2031
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_EVENTS.createLockLayout(false);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
2032 2033 2034 2035 2036 2037 2038 2039
                    }
                });
        }
        
    }
};
//Start Functon : No.4 - Editor : Long - Date : 08/09/2013 - Summary : 
/* Flip  Page Transition */
2040
CONTENTVIEW_CREATEOBJECT.Transition.prototype.flipToPage = function (index) {
2041

2042
    //#12373
2043
    var tmpScale = CONTENTVIEW.userScale;
2044

2045 2046
    var w = $('#main').attr('width');
    
2047
    if (index == CONTENTVIEW_GETDATA.getContent().pageIndex) {
2048
        /* init image had draw */
2049 2050 2051 2052
    	CONTENTVIEW_INITOBJECT.initDisplayMarking();       
    } else if (index < CONTENTVIEW_GETDATA.getContent().pageIndex) {
    	CONTENTVIEW_GENERAL.context_main.clearRect(0, 0, CONTENTVIEW_GENERAL.canvas_main.width, CONTENTVIEW_GENERAL.canvas_main.height);
        CONTENTVIEW.removeObject();
2053
        $('#main').animate(
Vo Duc Thang committed
2054 2055
                { left: w + 'px' },
                {
2056
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
Vo Duc Thang committed
2057 2058 2059
                    complete: function () {
                        $('#main').css('left', -w + 'px');
                        $('#main').animate(
2060 2061
                            { left: CONTENTVIEW.marginX + 'px' },
                            { duration: CONTENTVIEW_GENERAL.animatePeriod,
Vo Duc Thang committed
2062
                                complete: function () {
2063 2064
                                	CONTENTVIEW_GENERAL.isFirstLoad = true;
                                    //CONTENTVIEW.screenFit();
Vo Duc Thang committed
2065 2066 2067
                                }
                            });
                        //change pageIndex and image bookmark
2068 2069
                        CONTENTVIEW.userScale = 1;
                        CONTENTVIEW.userScaleNow = 1;
Vo Duc Thang committed
2070
                        //START TRB00097
2071 2072 2073 2074
                        //CONTENTVIEW.changeScale(CONTENTVIEW.userScale);   
                        CONTENTVIEW.srcRect = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.srcRectNext = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.srcRectPrev = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
2075
                        
2076 2077 2078
                        CONTENTVIEW.destRect = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.destRectNext = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.destRectPrev = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
2079
                        
Vo Duc Thang committed
2080
                        //END TRB00097                  
2081 2082
                        CONTENTVIEW.checkDisableButtonZoom();
                        CONTENTVIEW_GETDATA.getContent().toPage(index);                      
Vo Duc Thang committed
2083
                        
2084
                        if(index > 0){
2085 2086 2087
                        	CONTENTVIEW_GENERAL.prevContent.pageIndex = CONTENTVIEW_GETDATA.getPageIndex();
                        	CONTENTVIEW_GETDATA.getPrevPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, index - 1);               
                            CONTENTVIEW_GETDATA.renderPrevPage();
2088 2089 2090
            
                        }
                        
2091 2092 2093 2094
                        if(index < CONTENTVIEW_GENERAL.totalPage - 1){
                        	CONTENTVIEW_GENERAL.nextContent.pageIndex = CONTENTVIEW_GETDATA.getPageIndex();
                        	CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, index + 1);
                            CONTENTVIEW_GETDATA.renderNextPage();
2095
                        }
Vo Duc Thang committed
2096
                    
2097 2098 2099
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
                        CONTENTVIEW.checkExistNextPrePage();
                        CONTENTVIEW.changeSlider(index);
Vo Duc Thang committed
2100
                        /* init image had draw */
2101
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
Vo Duc Thang committed
2102
                        /* change title of page */
2103 2104 2105
                        if (CONTENTVIEW_GENERAL.dataPageTitle[index]) {                         
                            if (CONTENTVIEW_GENERAL.dataPageTitle[index] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[index] + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2106
                            } else {
2107
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2108 2109
                            }
                        } else {
2110
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2111 2112
                        }
                        /* set end log */
2113 2114
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
Vo Duc Thang committed
2115
                        
2116
                        CONTENTVIEW_EVENTS.createLockLayout(false);
2117 2118 2119 2120
                        
                        //#12373
                        //console.log("tmpScale:" + tmpScale);
                        if (tmpScale != 1) {
2121 2122 2123
                        	CONTENTVIEW.userScale = tmpScale;
                        	CONTENTVIEW.changeScale(CONTENTVIEW.userScale);
                            CONTENTVIEW.flip();
2124 2125
                        }
                        
Vo Duc Thang committed
2126 2127 2128
                    }
                }
             );
2129 2130
    } 
    else {
2131 2132
    	CONTENTVIEW_GENERAL.context_main.clearRect(0, 0, CONTENTVIEW_GENERAL.canvas_main.width, CONTENTVIEW_GENERAL.canvas_main.height);
        CONTENTVIEW.removeObject();
2133
        $('#main').animate(
Vo Duc Thang committed
2134 2135
                { left: '-' + w + 'px' },
                {
2136
                    duration: CONTENTVIEW_GENERAL.animatePeriod,
Vo Duc Thang committed
2137 2138 2139
                    complete: function () {
                        $('#main').css('left', w + 'px');
                        $('#main').animate(
2140 2141
                            { left: CONTENTVIEW.marginX + 'px' },
                            { duration: CONTENTVIEW_GENERAL.animatePeriod,
Vo Duc Thang committed
2142
                                complete: function () {
2143 2144
                                	CONTENTVIEW_GENERAL.isFirstLoad = true;
                                    //CONTENTVIEW.screenFit();
Vo Duc Thang committed
2145 2146 2147
                                }
                            });
                        //change pageIndex and image bookmark
2148
                        CONTENTVIEW.userScale = 1;
2149
                        //START TRB00097
2150 2151 2152 2153
                        //CONTENTVIEW.changeScale(CONTENTVIEW.userScale);   
                        CONTENTVIEW.srcRect = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.srcRectNext = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.srcRectPrev = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
2154
                        
2155 2156 2157
                        CONTENTVIEW.destRect = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.destRectNext = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
                        CONTENTVIEW.destRectPrev = new CONTENTVIEW_CREATEOBJECT.Rect(0, 0, 0, 0);
2158 2159
                        
                        //END TRB00097  
2160 2161
                        CONTENTVIEW.checkDisableButtonZoom();
                        CONTENTVIEW_GETDATA.getContent().toPage(index);    
Vo Duc Thang committed
2162 2163
                        
                        if(index > 0){
2164 2165 2166
                        	CONTENTVIEW_GENERAL.prevContent.pageIndex = CONTENTVIEW_GETDATA.getPageIndex();
                        	CONTENTVIEW_GETDATA.getPrevPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, index - 1);                
                            CONTENTVIEW_GETDATA.renderPrevPage();
Vo Duc Thang committed
2167 2168 2169
            
                        }
                        
2170 2171 2172 2173
                        if(index < CONTENTVIEW_GENERAL.totalPage - 1){
                        	CONTENTVIEW_GENERAL.nextContent.pageIndex = CONTENTVIEW_GETDATA.getPageIndex();
                        	CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, index + 1);
                            CONTENTVIEW_GETDATA.renderNextPage();
Vo Duc Thang committed
2174 2175
                        }

2176 2177 2178
                        CONTENTVIEW_INITOBJECT.initImageBookmark();
                        CONTENTVIEW.checkExistNextPrePage();
                        CONTENTVIEW.changeSlider(index);
Vo Duc Thang committed
2179
                        /* init image had draw */
2180
                        CONTENTVIEW_INITOBJECT.initDisplayMarking();
Vo Duc Thang committed
2181
                        /* change title of page */
2182 2183 2184
                        if (CONTENTVIEW_GENERAL.dataPageTitle[index]) {
                            if (CONTENTVIEW_GENERAL.dataPageTitle[index] != '') {
                                document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[index] + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2185
                            } else {
2186
                                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2187 2188
                            }
                        } else {
2189
                            document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
Vo Duc Thang committed
2190 2191
                        }
                        /* set end log */
2192 2193
                        COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
                        CONTENTVIEW_INITOBJECT.initImageCheckMarking();
Vo Duc Thang committed
2194
                        
2195
                        CONTENTVIEW_EVENTS.createLockLayout(false);
2196 2197 2198 2199
                        
                        //#12373
                        //console.log("tmpScale:" + tmpScale);
                        if (tmpScale != 1) {
2200 2201 2202
                        	CONTENTVIEW.userScale = tmpScale;
                        	CONTENTVIEW.changeScale(CONTENTVIEW.userScale);
                            CONTENTVIEW.flip();
2203 2204
                        }
                        
Vo Duc Thang committed
2205 2206
                    }
                });
2207 2208 2209 2210
    }   
    
};

2211
CONTENTVIEW_CREATEOBJECT.createTextConfirmAudio = function() {
2212
    var text = I18N.i18nText('msgBGMPlayConfirm');
2213 2214
    $('#txtAudio').html(text);

2215
    var text = I18N.i18nText('msgBGMPagePlayConfirm');
2216 2217 2218 2219
    $('#txtAudio_page').html(text);
};

/* create page */
2220
CONTENTVIEW_CREATEOBJECT.createPage = function(pageNumber, pageImage, pageObjects, onCompleteFunc) {
2221

2222 2223 2224
	//abe 次のページを作成している
	//alert("CreateObj_createPage:" + pageNumber);

2225
    var page = new CONTENTVIEW.ContentPage(pageNumber, pageImage);
2226 2227
    /* add page Object */
    //Start Function: No.12
2228
    if (CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile) {
2229 2230 2231 2232 2233 2234 2235 2236 2237
        page.addPageObjects(pageObjects);
    }
    //End Function: No.12
    /* load page */
    page.load(onCompleteFunc);

    return page;
};

2238
CONTENTVIEW_CREATEOBJECT.createImagePreview = function() {
2239
    $('#dialog').prepend(
Vo Duc Thang committed
2240 2241 2242 2243 2244 2245
        '<h1>' +
        '<img src="img/viewer/x.png" style="margin:3px 3px 0px 21px" id="btnClose" class="align_right" ></img>' +
        '</h1>' +
        '<div id="divImagePreview" class="content_image_preview">' +
        '</div>'
    );
2246 2247 2248 2249 2250 2251 2252
    $('#dialog').css('box-shadow', '0px 0px 3px 1px #666');
    $('#dialog').css('border', 'solid 1px #666');

    $('#dialog').draggable({ handle: "h1" });
};

/* create video on page */
2253
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen = function(video, id) {
2254 2255 2256 2257 2258 2259 2260
    $('#dialog').css('box-shadow', '0px 0px 3px 1px #666');
    $('#dialog').css('border', 'solid 1px #666');
    $('#dialog').draggable({ handle: "h1" });

    $('#dialog').children().remove();
    if (ClientData.userOpt_videoMode() == "1") {/* loop video */
        $('#dialog').html(
Vo Duc Thang committed
2261 2262 2263 2264 2265 2266 2267 2268 2269
            '<h1>' +
            '   <img src="img/viewer/x.png" style="margin:3px 3px 0px 21px" id="btnCloseVideo" class="align_right" ></img>' +
            '</h1>' +
            '       <div id="videoMedia' + id + '">' +
            '           <video style="height:90%; width:100%;" class="mov" id="videoOnPopUp" autoplay controls loop>' +
            '            <source src="' + video + '" type="video/mp4"> ' +
            '    </video>' +
            '       </div>'
            );
2270 2271
    } else {
        $('#dialog').html(
Vo Duc Thang committed
2272 2273 2274 2275 2276 2277 2278 2279 2280
            '<h1>' +
            '   <img src="img/viewer/x.png" style="margin:3px 3px 0px 21px" id="btnCloseVideo" class="align_right" width=25px" ></img>' +
            '</h1>' +
            '       <div id="videoMedia' + id + '">' +
            '           <video style="height:90%; width:100%;" id="videoOnPopUp" class="mov" autoplay controls>' +
            '            <source src="' + video + '" type="video/mp4"> ' +
            '    </video>' +
            '       </div>'
            );
2281 2282
    }
    $('#videoOnPopUp').css('height', ($('#dialog').height() - 25) + "px");
2283
    //CONTENTVIEW.showControlsVideo($('#videoOnPopUp'));
2284 2285 2286
};

/* create audio on page */
2287 2288
CONTENTVIEW_CREATEOBJECT.createAudio = function(audio, type) {
    // if(CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox'){
2289 2290 2291 2292 2293
    // audio =  audio.replace("webResourceDownload/", "webResourceDownload");
    // }

    if (audio != '') {
        if (type == "0") { /* play when click */
2294
        	CONTENTVIEW.stopAllAudio();
2295

2296 2297
        	CONTENTVIEW.TypeAudio0 = type;
            CONTENTVIEW.srcAudioType0 = audio;
2298 2299

            if (ClientData.userOpt_musicMode() == "1") {
2300
                if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2301
                    $('#playaudio').html(
Vo Duc Thang committed
2302 2303
                        '    <embed id="play_audio_0" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" loop="true" hidden="true"> </embed>'
                    );
2304
                } else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2305
                    $('#playaudio').html(
Vo Duc Thang committed
2306 2307 2308 2309
                        '   <audio  id="play_audio_0" loop="loop"  >' +
                        '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                        '   </audio>'
                        );
2310 2311
                } else {
                    $('#playaudio').html(
Vo Duc Thang committed
2312 2313 2314 2315
                        '   <audio  id="play_audio_0" loop="loop"  autoplay ="autoplay">' +
                        '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                        '   </audio>'
                    );
2316 2317 2318
                }

            } else {
2319
                if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2320
                    $('#playaudio').html(
Vo Duc Thang committed
2321 2322
                        '    <embed id="play_audio_0" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" hidden="true"> </embed>'
                    );
2323
                } else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2324
                    $('#playaudio').html(
Vo Duc Thang committed
2325 2326 2327 2328
                        '   <audio  id="play_audio_0">' +
                        '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                        '   </audio>'
                        );
2329 2330
                } else {
                    $('#playaudio').html(
Vo Duc Thang committed
2331 2332 2333 2334
                        '   <audio  id="play_audio_0" autoplay ="autoplay">' +
                        '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                        '   </audio>'
                    );
2335 2336 2337 2338
                }

            }

2339
            if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2340 2341 2342 2343 2344 2345 2346 2347 2348 2349
                document.getElementById("play_audio_0").load();
                document.getElementById("play_audio_0").play();
            }

        } 
        else if (type == "1") { /* play all page */        
           
            if (document.getElementById("play_audio_1") != undefined) {

                if (ClientData.userOpt_musicMode() == "1") {
2350
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2351 2352
                        /*
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2353
                                                    '    <embed id="play_audio_1" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" loop="true"  hidden="true"> </embed>'
2354 2355 2356 2357
                                                );*/
                        
                    } 
                    else {
2358
                        if(!CONTENTVIEW.isPendingContentBGM){
2359 2360 2361 2362 2363
                            document.getElementById("play_audio_1").play();
                        }                       
                    }
                }
                else {
2364
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2365 2366
/*
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2367 2368
                            '    <embed id="play_audio_1" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" hidden="true"> </embed>'
                        );*/
2369 2370

                    } else {
2371
                        if(!CONTENTVIEW.isPendingContentBGM){
2372 2373 2374 2375 2376 2377
                            document.getElementById("play_audio_1").play();
                        }
                    }
                }
            } 
            else {
2378 2379
            	CONTENTVIEW.TypeAudio1 = type;
                CONTENTVIEW.srcAudioType1 = audio;
2380 2381

                if (ClientData.userOpt_musicMode() == "1") {                                        
2382
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2383
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2384 2385
                            '    <embed id="play_audio_1" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" loop="true"  hidden="true"> </embed>'
                        );
2386 2387

                    } 
2388
                    else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2389
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2390 2391 2392 2393
                             '  <audio  id="play_audio_1" loop="loop" >' +
                             '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                             '  </audio>'
                         );
2394 2395
                    }
                    else {                      
2396
                        if(CONTENTVIEW.isPendingContentBGM){
2397 2398 2399 2400 2401 2402
                            $('#playaudioallpage').html(
                                 '  <audio  id="play_audio_1" loop="loop" >' +
                                 '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                                 '  </audio>'
                             );
                             document.getElementById('play_audio_1').load();
2403
                             CONTENTVIEW.isPendingContentBGM = false;
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415
                             
                        }
                        else{
                            $('#playaudioallpage').html(
                                 '  <audio  id="play_audio_1" loop="loop" autoplay="autoplay" >' +
                                 '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                                 '  </audio>'
                             );
                        }
                    }
                }
                else {
2416
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2417
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2418 2419
                            '    <embed id="play_audio_1" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" hidden="true"> </embed>'
                        );
2420
                    } else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2421
                        $('#playaudioallpage').html(
Vo Duc Thang committed
2422 2423 2424 2425
                             '  <audio  id="play_audio_1" >' +
                             '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                             '  </audio>'
                         );
2426
                    } else {
2427
                        if(CONTENTVIEW.isPendingContentBGM){
2428 2429 2430 2431 2432 2433
                            $('#playaudioallpage').html(
                                 '  <audio  id="play_audio_1" >' +
                                 '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                                 '  </audio>'
                             );
                             document.getElementById('play_audio_1').load();
2434
                             CONTENTVIEW.isPendingContentBGM = false;
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446
                             
                        }
                        else{
                            $('#playaudioallpage').html(
                                 '  <audio  id="play_audio_1" autoplay="autoplay" >' +
                                 '       <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                                 '  </audio>'
                             );
                        }
                    }
                }
                // Check to play BGM on ipad
2447
                if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2448
                    //START TRB00069
2449
                    if(CONTENTVIEW.isPendingContentBGM){
2450
                        document.getElementById('play_audio_1').load();
2451
                        CONTENTVIEW.isPendingContentBGM = false;
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474
                    }
                    else{
                        // Show confim message to play background music
                        $("#bgmConfirm_dspCancel").unbind('click');
                        $("#bgmConfirm_dspCancel").click(function () {
                            $("#bgmConfirm").hide();
                        });
                        $("#bgmConfirm_dspOK").unbind('click');
                        $("#bgmConfirm_dspOK").click(function () {
                            document.getElementById('play_audio_1').load();
                            document.getElementById('play_audio_1').play();
                            $("#bgmConfirm").hide();
                        });
                        $("#bgmConfirm").show();
                        $("#bgmConfirm").center();
                    }
                    //END TRB00069
                }
            }
        }
        else if (type == "2") { /* play on page */                    
           
            if (document.getElementById("play_audio_2") == undefined) {
2475
            	CONTENTVIEW.stopAllAudio();
2476

2477 2478
            	CONTENTVIEW.TypeAudio2 = type;
                CONTENTVIEW.srcAudioType2 = audio;
2479 2480

                if (ClientData.userOpt_musicMode() == "1") {
2481
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2482
                        $('#playaudiopage').html(
Vo Duc Thang committed
2483 2484
                                '    <embed id="play_audio_2" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" loop="true" hidden="true"> </embed>'
                            );
2485
                    } else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2486
                        $('#playaudiopage').html(
Vo Duc Thang committed
2487 2488 2489 2490
                            '   <audio  id="play_audio_2" loop="loop" >' +
                            '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                            '   </audio>'
                        );
2491 2492
                    } else {
                        $('#playaudiopage').html(
Vo Duc Thang committed
2493 2494 2495 2496
                            '   <audio  id="play_audio_2" loop="loop" autoplay ="autoplay">' +
                            '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                            '   </audio>'
                        );
2497 2498
                    }
                } else {
2499
                    if (CONTENTVIEW_GENERAL.avwUserEnvObj.browser == 'firefox') {
2500
                        $('#playaudiopage').html(
Vo Duc Thang committed
2501 2502
                                '    <embed id="play_audio_2" src="' + audio + '&key=' + (new Date()).toIdString() + '" autostart="true" hidden="true"> </embed>'
                            );
2503
                    } else if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2504
                        $('#playaudiopage').html(
Vo Duc Thang committed
2505 2506 2507 2508
                            '   <audio  id="play_audio_2" >' +
                            '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                            '   </audio>'
                        );
2509 2510
                    } else {
                        $('#playaudiopage').html(
Vo Duc Thang committed
2511 2512 2513 2514
                            '   <audio  id="play_audio_2" autoplay ="autoplay">' +
                            '        <source src="' + audio + '&key=' + (new Date()).toIdString() + '" type="audio/mpeg" />' +
                            '   </audio>'
                        );
2515 2516 2517 2518
                    }
                }

                // Check to play BGM on ipad
2519
                if (CONTENTVIEW_GENERAL.avwUserEnvObj.os == "ipad") {
2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537
                    // Show confim message to play background music
                    $("#bgmConfirm_dspCancel_page").unbind('click');
                    $("#bgmConfirm_dspCancel_page").click(function () {
                        $("#bgmConfirm_page").hide();
                    });
                    $("#bgmConfirm_dspOK_page").unbind('click');
                    $("#bgmConfirm_dspOK_page").click(function () {
                        document.getElementById('play_audio_2').load();
                        document.getElementById('play_audio_2').play();
                        $("#bgmConfirm_page").hide();
                    });
                    $("#bgmConfirm_page").show();
                    $("#bgmConfirm_page").center();
                }
            }
        }
    }
    else {
2538
    	CONTENTVIEW.stopAllAudio();
2539 2540 2541 2542 2543
    }

};

//START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
2544
CONTENTVIEW_CREATEOBJECT.createPageBGM = function(){
2545
    
2546
    var currentPageObject = CONTENTVIEW_GETDATA.getContent().pageObjects;
2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557
    var audioFile  = '';
    var playType = '';
    $('#playaudiopage').html('');
    for(var i = 0; i < currentPageObject.length; i++){
        var BGMObject = currentPageObject[i];
        
        if(BGMObject.mediaType == '3' && BGMObject.actionType=='2' && BGMObject.playType == '2'){           
            
            audioFile = BGMObject.audioFile;
            playType = BGMObject.playType;
            
2558
            CONTENTVIEW_CREATEOBJECT.createAudio(audioFile, playType);
2559 2560 2561 2562 2563 2564
            
            break;
        }
    }                
};
//END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM