1var gallery_album_list; 2var gallery_album_effect_create = false; 3var gallery_album_list_current=0; 4var gallery_current=0; 5var gallery_list = []; 6var gallery_edit_mode=false; 7var gallery_uploadify = []; 8 9 10function album_add_check(){ 11 if(gallery_album_list_current==0) return; 12 var name = $('#album_name').val(); 13 var effect = $('#album_type_'+WIDGET_ID).selectbox('get_key'); 14 show_loading(); 15 $.ajax({ 16 type:'POST', 17 data:{'widget_id':WIDGET_ID,'album':gallery_album_list_current,'name':name,'effect':effect}, 18 url:('/pc/backpg/gallery_album_edit.cm'), 19 dataType:'json', 20 async:false, 21 cache:false, 22 success:function(result){ 23 hide_loading(); 24 if(result.msg=='SUCCESS') 25 load_config_album_list(gallery_album_list_current); 26 else 27 alert(result.msg); 28 } 29 }); 30 31} 32 33function gallery_name_edit(idx){ 34 var o = $('#gallery_text_'+idx); 35 o.find('div.text').hide(); 36 o.find('div.input').show().find('input').select().focus() 37 .blur(function(){ 38 gallery_name_edit_complete(idx); 39 }) 40 .keydown(function(e){ 41 if(e.keyCode==13) 42 gallery_name_edit_complete(idx); 43 else if(e.keyCode==27) 44 gallery_name_edit_cancel(idx); 45 }); 46 gallery_edit_mode=true; 47 48} 49 50 51function gallery_name_edit_cancel(idx){ 52 if(!gallery_edit_mode) return; 53 var o = $('#gallery_text_'+idx); 54 o.find('div.input').hide(); 55 o.find('div.text').show(); 56 gallery_edit_mode=false; 57} 58function gallery_name_edit_complete(idx){ 59 if(!gallery_edit_mode) return; 60 var o = $('#gallery_text_'+idx); 61 gallery_name_change(idx,o.find('input').val()); 62 gallery_name_edit_cancel(idx); 63} 64/** 65 * ì§ë ì´ë¦ ë³ê²½ 66 */ 67function gallery_name_change(sel_idx,name){ 68 if($.trim(name)=='') return; 69 $.ajax({ 70 type:'POST', 71 data:{'album':gallery_album_list_current,'type':'name','idx':sel_idx,'name':name}, 72 url:('/pc/backpg/gallery_edit.cm'), 73 dataType:'json', 74 async:false, 75 cache:false, 76 success:function(result){ 77 if(result.msg=='SUCCESS'){ 78 var o = $('#gallery_text_'+sel_idx); 79 o.find('div.text a').text(name); 80 }else if(result.msg!='') 81 alert(result.msg); 82 83 } 84 }); 85} 86 87/** 88 * ê°¤ë¬ë¦¬ ì¬ì§ ìì 89 */ 90function gallery_img_edit(filename){ 91 if(gallery_album_list_current==0) return; 92 if(gallery_current==0) return; 93 94 $.ajax({ 95 type:'POST', 96 data:{'album':gallery_album_list_current,'type':'img','filename':filename,'idx':gallery_current}, 97 url:('/pc/backpg/gallery_edit.cm'), 98 dataType:'json', 99 async:false, 100 cache:false, 101 success:function(result){ 102 if(result.msg=='SUCCESS') 103 gallery_load(gallery_current,true); 104 else 105 alert(result.msg); 106 } 107 }); 108} 109 110/** 111 * ê°¤ë¬ë¦¬ ì¬ì§ ì¶ê° 112 */ 113var gallery_add_idx=0; 114function gallery_add(filename){ 115 if(gallery_album_list_current==0) return; 116 117 $.ajax({ 118 type:'POST', 119 data:{'widget_id':WIDGET_ID,'album':gallery_album_list_current,'filename':filename}, 120 url:('/pc/backpg/gallery_add.cm'), 121 dataType:'json', 122 async:false, 123 cache:false, 124 success:function(result){ 125 if(result.msg=='SUCCESS') 126 gallery_add_idx = result.idx; 127 else 128 alert(result.msg); 129 } 130 }); 131} 132 133/** 134 * ê°¤ë¬ë¦¬ ì¬ì§ ìì¹ ë³ê²½ 135 */ 136function gallery_move(move_type){ 137 if(gallery_album_list_current==0) return; 138 if(gallery_current==0) { 139 alert('ì´ë¯¸ì§ë¥¼ ì ííì¸ì.'); 140 return; 141 } 142 143 $.ajax({ 144 type:'POST', 145 data:{'album':gallery_album_list_current,'idx':gallery_current,'move_type':move_type}, 146 url:('/pc/backpg/gallery_move.cm'), 147 dataType:'json', 148 async:false, 149 cache:false, 150 success:function(result){ 151 if(result.msg=='SUCCESS'){ 152 gallery_load(gallery_current); 153 }else 154 alert(result.msg); 155 } 156 }); 157} 158/** 159 * ê°¤ë¬ë¦¬ ì¬ì§ ì í í´ì 160 */ 161function gallery_deselect(){ 162 if(gallery_album_list_current==0) return; 163 if(gallery_current==0) return; 164 gallery_name_edit_complete(gallery_current); 165 var o = $('#gallery_item_'+gallery_current); 166 o.find('div.img_border').removeClass('current'); 167 o.find('div.cf').hide(); 168 gallery_current=0; 169} 170/** 171 * ê°¤ë¬ë¦¬ ì¬ì§ ì í 172 */ 173function gallery_select(idx,pos){ 174 if(gallery_album_list_current==0) return; 175 176 if(gallery_current==idx && pos) return; 177 178 gallery_deselect(); 179 180 var o = $('#gallery_item_'+idx); 181 o.find('div.img_border').addClass('current'); 182 o.find('div.cf').show(); 183 gallery_current = idx; 184 185 //ë²í¼ íì±í 186 187 $('#gallery_next_button').show(); 188 $('#gallery_next_button_disable').hide(); 189 $('#gallery_prev_button').show(); 190 $('#gallery_prev_button_disable').hide(); 191 192 /**** 193 ì í ëììë íë² ìì±ë ì ë¡ëí¼ ê²ì¬íì¬ ë§ë¤ì§ ì기 ìì 194 */ 195 196 if($.inArray(idx,gallery_uploadify)===-1){ 197 198 $("#edit_gal_"+idx).fileupload({ 199 url : '//'+FILE_UPLOAD_DOMAIN+'/backpg/gallery_upload.cm', 200 dataType : 'json', 201 formData : {'from':'pc'}, 202 add:function (e, data) { 203 data.submit(); 204 }, 205 done: function (e, data) { 206 var msg = data.result.msg; 207 if(msg == "SUCCESS") { 208 var upload_info = data.result; 209 if(upload_info.msg=='SUCCESS') 210 gallery_img_edit(upload_info.filename_real); 211 } 212 else { 213 alert(msg); 214 } 215 } 216 }); 217 218 gallery_uploadify.push(idx); 219 } 220} 221 222/** 223 * ê°¤ë¬ë¦¬ ì¬ì§ ìì 224 */ 225function gallery_remove(idx){ 226 if(gallery_album_list_current==0) return;
227 if(idx==0) { alert(GetLangMsg('NO_SELECT_ALERT')); return; } 228 229 if(!confirm(GetLangMsg('ADMIN_ERR4'))) return; 230 231 $.ajax({ 232 type:'POST', 233 data:{'album':gallery_album_list_current,'idx':idx}, 234 url:('/pc/backpg/gallery_remove.cm'), 235 dataType:'json', 236 async:false, 237 cache:false, 238 success:function(result){ 239 if(result.msg=='SUCCESS') 240 gallery_load(0); 241 else 242 alert(result.msg); 243 } 244 }); 245} 246 247/** 248 * ê°¤ë¬ë¦¬ ì¬ì§ ë¡ë© 249 */ 250function gallery_load(sel_idx){ 251 $.ajax({ 252 type:'POST', 253 data:{'album':gallery_album_list_current}, 254 url:('/pc/backpg/gallery_load.cm'), 255 dataType:'json', 256 async:false, 257 cache:false, 258 success:function(result){ 259 if(result.msg=='SUCCESS'){ 260 var o = $('#gallery_list'); 261 o.empty(); 262 gallery_deselect(); 263 gallery_uploadify = []; 264 265 //ë²í¼ ë¹íì±í 266 $('#gallery_next_button').hide(); 267 $('#gallery_next_button_disable').show(); 268 $('#gallery_prev_button').hide(); 269 $('#gallery_prev_button_disable').show(); 270 271 var html = ''; 272 var first_idx=0; 273 if(result.image_list.length>0){ 274 $.each(result.image_list,function(idx,data){ 275 html += "<li>"; 276 html += "<div class='img' id='gallery_item_"+data.idx+"' onclick='gallery_select("+data.idx+",true)'>"; 277 html += "<div class='img_border'></div>"; 278 html += "<div class='img_wrap'><img src='"+data.img+"' /></div>"; 279 html += "<div class='cf' style='display:none'>"; 280 html += "<input id='edit_gal_"+data.idx+"' type='file' name='file' accept='image/gif,image/jpeg,image/png' style='display:none'>"; 281 html += "<div onclick = \"fileBtClick('edit_gal_"+data.idx+"')\" style='width:36px; height:28px;cursor: pointer'> <img src='/img/btn/btn_camera_h28.png'>"; 282 html += "<a href='javascript:;' onclick='gallery_remove("+data.idx+")'><img src='/img/pc/gallery_del.png' /></a>"; 283 html += "</div>"; 284 html += "</div>"; 285 html += "<div class='title' id='gallery_text_"+data.idx+"'>"; 286 html += "<div class='text'><a href='javascript:;' onclick='gallery_name_edit("+data.idx+")'>"+data.subject+"</a></div>"; 287 html += "<div class='input' style='display:none;'><input type='text' value='"+data.subject+"' name='' class='pc_input' /></div>"; 288 html += "</div>"; 289 html += '</li>'; 290 gallery_list.push(data); 291 if(idx==0) first_idx = data.idx; 292 }); 293 }else{ 294 html = "<li class='no_item'><p><img src='/img/pc/gallery_list_no_image.png' alt=''/></p><p>ì¨ë²ì ì´ë¯¸ì§ê° ììµëë¤. ì´ë¯¸ì§ë¥¼ ì¬ë ¤ì£¼ì¸ì.</p></li>"; 295 } 296 o.html(html); 297 if(sel_idx>=0) 298 gallery_select(sel_idx>0 ? sel_idx : first_idx,false); 299 }else 300 alert(result.msg); 301 } 302 }); 303} 304 305 306 307/** 308 * ê°¤ë¬ë¦¬ ì¨ë² ìì¹ ë³ê²½ 309 */ 310function gallery_move_album(move_type){ 311 if(gallery_album_list_current==0) return; 312 313 $.ajax({ 314 type:'POST', 315 data:{'widget_id':WIDGET_ID,'idx':gallery_album_list_current,'move_type':move_type}, 316 url:('/pc/backpg/gallery_move_album.cm'), 317 dataType:'json', 318 async:false, 319 cache:false, 320 success:function(result){ 321 if(result.msg=='SUCCESS'){ 322 load_config_album_list(gallery_album_list_current); 323 }else 324 alert(result.msg); 325 } 326 }); 327} 328 329 330/** 331 * ê°¤ë¬ë¦¬ ì¨ë² ìì 332 */ 333function gallery_album_remove(){ 334 if(gallery_album_list_current==0) { alert(GetLangMsg('NO_SELECT_ALERT')); return; } 335 336 if(!confirm(GetLangMsg('ADMIN_ERR4'))) return; 337 338 $.ajax({ 339 type:'POST', 340 data:{'widget_id':WIDGET_ID,'album':gallery_album_list_current}, 341 url:('/pc/backpg/gallery_album_remove.cm'), 342 dataType:'json', 343 async:false, 344 cache:false, 345 success:function(result){ 346 if(result.msg=='SUCCESS') 347 load_config_album_list(0); 348 else 349 alert(result.msg); 350 } 351 }); 352} 353 354/** 355 * ê°¤ë¬ë¦¬ ì¨ë² ì¶ê° 356 */ 357function gallery_add_album(){ 358 359 $.ajax({ 360 type:'POST', 361 data:{'widget_id':WIDGET_ID}, 362 url:('/pc/backpg/gallery_add_album.cm'), 363 dataType:'json', 364 async:false, 365 cache:false, 366 success:function(result){ 367 if(result.msg=='SUCCESS'){ 368 load_config_album_list(result.album_idx); 369 }else 370 alert(result.msg); 371 } 372 }); 373} 374 375function gallery_album_select(idx){ 376 377 var no = gallery_album_find(idx); 378 if(no==-1) return; 379 $('#album_info').show(); 380 $('#album_name').val(RemoveTag(gallery_album_list[no].name)); 381 album_list_select(idx); 382 if(!gallery_album_effect_create){ 383 $('#album_type_'+WIDGET_ID).selectbox({ 384 'default_key':gallery_album_list[no].effect, 385 'width' : 180, 386 'item': [
387 {key:'slide',value:GetLangMsg('ADMIN_RIGHT_GALLERY13')}, 388 {key:'paper',value:GetLangMsg('ADMIN_RIGHT_GALLERY14')} 389 ], 390 'max_height':246, 391 'change': function(key){ 392 album_add_check(); 393 } 394 }); 395 gallery_album_effect_create = true; 396 }else{ 397 $('#album_type_'+WIDGET_ID).selectbox('set_key',gallery_album_list[no].effect); 398 } 399 400 gallery_load(-1); 401} 402 403function album_list_select(idx){ 404 album_list_deselect(); 405 $('#gallery_album_list_item_'+idx).addClass('active'); 406 $('#album_up_button_disable').hide(); 407 $('#album_down_button_disable').hide(); 408 $('#album_top_button_disable').hide(); 409 $('#album_bottom_button_disable').hide(); 410 $('#album_up_button').show(); 411 $('#album_down_button').show(); 412 $('#album_top_button').show(); 413 $('#album_bottom_button').show(); 414 gallery_album_list_current = idx; 415} 416 417/** 418 * ì¤ë¥¸ìª½ ì§ë ëª©ë¡ ì íí´ì 419 */ 420function album_list_deselect(){ 421 if(gallery_album_list_current>0){ 422 $('#gallery_album_list_item_'+gallery_album_list_current).removeClass('active'); 423 gallery_album_list_current = 0; 424 $('#album_up_button_disable').show(); 425 $('#album_down_button_disable').show(); 426 $('#album_top_button_disable').show(); 427 $('#album_bottom_button_disable').show(); 428 $('#album_up_button').hide(); 429 $('#album_down_button').hide(); 430 $('#album_top_button').hide(); 431 $('#album_bottom_button').hide(); 432 } 433} 434 435function load_config_album_list(sel_idx){ 436 var o = $('#album_list_layer'); 437 $.ajax({ 438 type:'POST', 439 data:{'widget_id':WIDGET_ID}, 440 url:('/pc/backpg/gallery_load_album.cm'), 441 dataType:'json', 442 async:false, 443 cache:false, 444 success:function(result){ 445 if(result.msg=='SUCCESS'){ 446 var html = ''; 447 o.empty(); 448 gallery_album_list = result.album_list; 449 if(gallery_album_list.length>0){ 450 var first_idx = 0; 451 $.each(gallery_album_list,function(idx,data){ 452 html += "<li id='gallery_album_list_item_"+data.idx+"' onclick='gallery_album_select("+data.idx+");'>"; 453 html += "<span class='img'><img src='"+data.img+"' width='52' height='52' alt='"+data.name+"'/></span>"; 454 html += "<div><p><span class='album_type'></span> "+data.name+"</p>"; 455 html += "<p class='img_cnt'>"+data.cnt+"ì¥</p></div>"; 456 html += "</li>"; 457 if(idx==0) first_idx = data.idx; 458 }); 459 o.html(html); 460 $('#album_cnt').text(result.album_cnt); 461 if(sel_idx>=0){ 462 gallery_album_select(sel_idx>0 ? sel_idx : first_idx); 463 } 464 } 465 }else 466 alert(result.msg); 467 } 468 }); 469} 470/** 471 * ê°¤ë¬ë¦¬ ì¨ë² idxë¡ ê²ì 472 */ 473function gallery_album_find(idx){ 474 var i=0; 475 for(i=0; i<gallery_album_list.length; i++){ 476 if(gallery_album_list[i].idx==idx) 477 return i; 478 } 479 return -1; 480} 481 482/** 483 * ê°¤ë¬ë¦¬ idxë¡ ê²ì 484 */ 485function gallery_find(idx){ 486 var i=0; 487 for(i=0; i<gallery_list.length; i++){ 488 if(gallery_list[i].idx==idx) 489 return i; 490 } 491 return -1; 492}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.