Changeset 26198
- Timestamp:
- Dec 26, 2013, 12:07:19 PM (11 years ago)
- Location:
- extensions/Google2Piwigo
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Google2Piwigo/admin.php
r17475 r26198 1 1 <?php 2 if (!defined('PICASA_WA_PATH'))die('Hacking attempt!');2 defined('PICASA_WA_PATH') or die('Hacking attempt!'); 3 3 4 4 global $template, $page, $conf; … … 20 20 'PICASA_WA_ADMIN' => PICASA_WA_ADMIN, 21 21 )); 22 22 23 $template->assign_var_from_handle('ADMIN_CONTENT', 'picasa_web_albums'); 23 24 ?> -
extensions/Google2Piwigo/admin/import.php
r25788 r26198 1 1 <?php 2 if (!defined('PICASA_WA_PATH'))die('Hacking attempt!');2 defined('PICASA_WA_PATH') or die('Hacking attempt!'); 3 3 4 4 set_time_limit(600); … … 6 6 include_once(PICASA_WA_PATH . 'include/functions.inc.php'); 7 7 8 if ( !test_remote_download())8 if (!test_remote_download()) 9 9 { 10 array_push($page['errors'], l10n('No download method available'));10 $page['errors'][] = l10n('No download method available'); 11 11 $_GET['action'] = 'error'; 12 12 } … … 39 39 40 40 41 if (!isset($_GET['action'])) $_GET['action'] = 'main'; 41 if (!isset($_GET['action'])) 42 { 43 $_GET['action'] = 'main'; 44 } 42 45 43 46 switch ($_GET['action']) … … 102 105 foreach ($userFeed as $userEntry) 103 106 { 104 array_push($albums,array(107 $albums[] = array( 105 108 'title' => $userEntry->title->text, 106 109 'description' => $userEntry->mediaGroup->description->text, 107 110 'photos' => $userEntry->gphotoNumPhotos->text, 108 111 'U_LIST' => PICASA_WA_ADMIN . '-import&action=list_photos&album=' . $userEntry->gphotoId->text, 109 ) );112 ); 110 113 } 111 114 … … 139 142 foreach ($albumFeed as $albumEntry) 140 143 { 141 array_push($all_photos,array(144 $all_photos[] = array( 142 145 'id' => $albumEntry->getGphotoId()->getText(), 143 146 'name' => $albumEntry->mediaGroup->title->text, … … 145 148 'src' => $albumEntry->mediaGroup->content[0]->url, 146 149 'url' => $albumEntry->link[2]->href, 147 ) );150 ); 148 151 } 149 152 … … 170 173 if ($duplicates>0) 171 174 { 172 $page['infos'][] = '<a href="admin.php?page=batch_manager&prefilter=picasa">' 173 .l10n_dec('One picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates) 175 $page['infos'][] = '<a href="admin.php?page=batch_manager&filter=prefilter-picasa">' 176 .l10n_dec( 177 'One picture is not displayed because already existing in the database.', 178 '%d pictures are not displayed because already existing in the database.', 179 $duplicates) 174 180 .'</a>'; 175 181 } … … 260 266 if ($duplicates>0) 261 267 { 262 $page['infos'][] = '<a href="admin.php?page=batch_manager&prefilter=picasa">' 263 .l10n_dec('One picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates) 268 $page['infos'][] = '<a href="admin.php?page=batch_manager&filter=prefilter-picasa">' 269 .l10n_dec( 270 'One picture is not displayed because already existing in the database.', 271 '%d pictures are not displayed because already existing in the database.', 272 $duplicates) 264 273 .'</a>'; 265 274 } … … 267 276 $template->assign(array( 268 277 'nb_elements' => count($all_photos), 269 'all_elements' => json_encode($all_photos),278 'all_elements' => $all_photos, 270 279 'F_ACTION' => PICASA_WA_ADMIN . '-import&action=import_set', 271 280 )); … … 285 294 if (isset($_POST['done'])) 286 295 { 287 $_SESSION['page_infos'][] = sprintf(l10n('%d pictures imported'), $_POST['done']);296 $_SESSION['page_infos'][] = l10n('%d pictures imported', $_POST['done']); 288 297 } 289 298 redirect(PICASA_WA_ADMIN . '-import'); … … 292 301 293 302 294 $template->assign(array( 295 'ACTION' => $_GET['action'], 296 'GMAPS_LOADED' => !empty($pwg_loaded_plugins['rv_gmaps']) || !empty($pwg_loaded_plugins['piwigo-openstreetmap']), 297 )); 303 $template->assign('ACTION', $_GET['action']); 298 304 299 305 $template->set_filename('picasa_web_albums', realpath(PICASA_WA_PATH . '/admin/template/import.tpl')); 300 301 ?> -
extensions/Google2Piwigo/admin/template/import.list_all.tpl
r25788 r26198 1 1 {footer_script require='jquery.ajaxmanager,jquery.jgrowl'} 2 /* global vars */ 3 var errorHead = '{'ERROR'|@translate|@escape:'javascript'}'; 4 var errorMsg = '{'an error happened'|@translate|@escape:'javascript'}'; 5 var successHead = '{'Success'|@translate|@escape:'javascript'}'; 2 (function($){ 3 /* global vars */ 4 var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; 5 var import_done = 0; 6 var import_selected = {$nb_elements}; 7 var queuedManager = $.manageAjax.create('queued', { 8 queue: true, 9 maxRequests: 1 10 }); 6 11 7 var import_done = 0; 8 var import_selected = {$nb_elements}; 9 var queuedManager = jQuery.manageAjax.create('queued', {ldelim} 10 queue: true, 11 maxRequests: 1 12 }); 12 /* import queue */ 13 function performImport(photo, album, fills, pwa_album) { 14 queuedManager.add({ 15 type: 'GET', 16 dataType: 'json', 17 url: 'ws.php', 18 data: { 19 method: 'pwg.images.addPicasa', 20 id: photo, 21 category: album, 22 fills: fills, 23 pwa_album: pwa_album, 24 format: 'json' 25 }, 26 success: function(data) { 27 if (data['stat'] == 'ok') { 28 $.jGrowl(data['result'], { 29 theme: 'success', life: 4000, sticky: false, 30 header: '{'Success'|translate}' 31 }); 32 } 33 else { 34 $.jGrowl(data['result'], { 35 theme: 'error', sticky: true, 36 header: '{'ERROR'|translate}' 37 }); 38 } 39 40 import_done++; 41 $("#progress").html(import_done +"/"+ import_selected); 42 43 if (import_done == import_selected) { 44 $("#import_form").append('<input type="hidden" name="done" value="' + import_done + '">'); 45 $("#import_form").submit(); 46 } 47 }, 48 error: function(data) { 49 $.jGrowl('{'an error happened'|translate|escape:javascript}', { 50 theme: 'error', sticky: true, 51 header: '{'ERROR'|translate}' 52 }); 53 } 54 }); 55 } 13 56 14 {literal}15 /* import queue */16 function performImport(photo, album, fills, pwa_album) {17 queuedManager.add({18 type: 'GET',19 dataType: 'json',20 url: 'ws.php',21 data: { method: 'pwg.images.addPicasa', id: photo, category: album, fills: fills, pwa_album: pwa_album, format: 'json' },22 success: function(data) {23 if (data['stat'] == 'ok') {24 jQuery.jGrowl(data['result'], { theme: 'success', header: successHead, life: 4000, sticky: false });25 } else {26 jQuery.jGrowl(data['result'], { theme: 'error', header: errorHead, sticky: true });27 }28 29 import_done++;30 $("#progress").html(import_done +"/"+ import_selected);31 32 if (import_done == import_selected) {33 $("#import_form").append('<input type="hidden" name="done" value="' + import_done + '">');34 $("#import_form").submit();35 }36 },37 error: function(data) {38 jQuery.jGrowl(errorMsg, { theme: 'error', header: errorHead, sticky: true });39 }40 });41 }42 43 44 $(document).ready(function() {45 var all_elements = {/literal}{$all_elements}{literal};46 57 47 58 /* begin import */ 48 jQuery('#beginImport').click(function() {59 $('#beginImport').click(function() { 49 60 $("#loader_import").fadeIn(); 50 61 51 62 if ($("input[name='album_mode']:checked").val() == 'identical') { 52 63 album = "<!-- create -->"; 53 } else { 64 } 65 else { 54 66 album = $("#albumSelect option:selected").val(); 55 67 } … … 74 86 if ($(this).val() == 'one_album') { 75 87 $("#albumSelectWrapper").slideDown(); 76 } else { 88 } 89 else { 77 90 $("#albumSelectWrapper").slideUp(); 78 91 } 79 92 }); 80 }); 81 {/literal} 93 }(jQuery)); 82 94 {/footer_script} 83 95 … … 85 97 86 98 <fieldset> 87 <legend>{'Selection'| @translate}</legend>99 <legend>{'Selection'|translate}</legend> 88 100 89 101 {if $nb_elements} 90 {'%d elements ready for importation'| @translate|@sprintf:$nb_elements}102 {'%d elements ready for importation'|translate:$nb_elements} 91 103 {else} 92 <div>{'No photo in the current set.'| @translate}</div>104 <div>{'No photo in the current set.'|translate}</div> 93 105 {/if} 94 106 </fieldset> 95 107 96 108 <fieldset> 97 <legend>{'Import options'| @translate}</legend>109 <legend>{'Import options'|translate}</legend> 98 110 99 111 <p> 100 <label><input type="radio" name="album_mode" value="identical" checked="checked"> {'Reproduce Google albums'| @translate}</label><br>101 <label><input type="radio" name="album_mode" value="one_album"> {'Import all photos in this album'| @translate} :</label>112 <label><input type="radio" name="album_mode" value="identical" checked="checked"> {'Reproduce Google albums'|translate}</label><br> 113 <label><input type="radio" name="album_mode" value="one_album"> {'Import all photos in this album'|translate} :</label> 102 114 </p> 103 115 … … 106 118 {html_options options=$category_parent_options} 107 119 </select> 108 {'... or '| @translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>120 {'... or '|translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|translate}">{'create a new album'|translate}</a> 109 121 </p> 110 122 111 123 <p> 112 <b>{'Fill these fields from Google datas'| @translate}:</b>113 <label><input type="checkbox" name="fill_name" checked="checked"> {'Photo name'| @translate}</label>114 <label><input type="checkbox" name="fill_author" checked="checked"> {'Author'| @translate}</label>115 <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'| @translate}</label>116 <label><input type="checkbox" name="fill_date" checked="checked"> {'Creation date'| @translate}</label>117 <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'| @translate}</label>118 {if $GMAPS_LOADED}<label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>{/if}124 <b>{'Fill these fields from Google datas'|translate}:</b> 125 <label><input type="checkbox" name="fill_name" checked="checked"> {'Photo name'|translate}</label> 126 <label><input type="checkbox" name="fill_author" checked="checked"> {'Author'|translate}</label> 127 <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'|translate}</label> 128 <label><input type="checkbox" name="fill_date" checked="checked"> {'Creation date'|translate}</label> 129 <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|translate}</label> 130 <label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|translate}</label> 119 131 </p> 120 132 121 133 <p> 122 <input type="submit" name="import_set" id="beginImport" value="{'Begin transfer'| @translate}" {if not $nb_elements}style="display:none;"{/if}>123 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'| @translate}</i> <span id="progress"></span></span>134 <input type="submit" name="import_set" id="beginImport" value="{'Begin transfer'|translate}" {if not $nb_elements}style="display:none;"{/if}> 135 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'|translate}</i> <span id="progress"></span></span> 124 136 </p> 125 137 </fieldset> -
extensions/Google2Piwigo/admin/template/import.list_photos.tpl
r25788 r26198 1 1 {footer_script require='jquery.ajaxmanager,jquery.jgrowl'} 2 /* global vars */ 3 var nb_thumbs_page = {$nb_thumbs_page}; 4 var nb_thumbs_set = {$nb_thumbs_set}; 5 var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; 6 7 var errorHead = '{'ERROR'|@translate|@escape:'javascript'}'; 8 var errorMsg = '{'an error happened'|@translate|@escape:'javascript'}'; 9 var successHead = '{'Success'|@translate|@escape:'javascript'}'; 10 var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; 11 var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; 12 var selectedMessage_all = "{'All %d photos are selected'|@translate}"; 13 var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}"; 14 15 var import_done = 0; 16 var import_selected = 0; 17 var queuedManager = jQuery.manageAjax.create('queued', {ldelim} 18 queue: true, 19 maxRequests: 1 20 }); 21 22 {literal} 23 /* Shift-click: select all photos between the click and the shift+click */ 24 jQuery(document).ready(function() { 2 (function($){ 3 /* global vars */ 4 var nb_thumbs_set = {$nb_thumbs_set}; 5 var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; 6 var import_done = 0; 7 var import_selected = 0; 8 var queuedManager = $.manageAjax.create('queued', {ldelim} 9 queue: true, 10 maxRequests: 1 11 }); 12 13 /* Shift-click: select all photos between the click and the shift+click */ 25 14 var last_clicked=0; 26 15 var last_clickedstatus=true; 27 jQuery.fn.enableShiftClick = function() {16 $.fn.enableShiftClick = function() { 28 17 var inputs = []; 29 18 var count=0; … … 60 49 return true; 61 50 }); 62 $(this).click(function(event) {$(this).triggerHandler("shclick",event)}); 63 }); 64 } 65 }); 66 67 /* sprintf */ 68 function str_repeat(i, m) { 69 for (var o = []; m > 0; o[--m] = i); 70 return o.join(''); 71 } 72 73 function sprintf() { 74 var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = ''; 75 while (f) { 76 if (m = /^[^\x25]+/.exec(f)) { 77 o.push(m[0]); 78 } 79 else if (m = /^\x25{2}/.exec(f)) { 80 o.push('%'); 81 } 82 else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) { 83 if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) { 84 throw('Too few arguments.'); 85 } 86 if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) { 87 throw('Expecting number but found ' + typeof(a)); 88 } 89 switch (m[7]) { 90 case 'b': a = a.toString(2); break; 91 case 'c': a = String.fromCharCode(a); break; 92 case 'd': a = parseInt(a); break; 93 case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break; 94 case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break; 95 case 'o': a = a.toString(8); break; 96 case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break; 97 case 'u': a = Math.abs(a); break; 98 case 'x': a = a.toString(16); break; 99 case 'X': a = a.toString(16).toUpperCase(); break; 100 } 101 a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a); 102 c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' '; 103 x = m[5] - String(a).length - s.length; 104 p = m[5] ? str_repeat(c, x) : ''; 105 o.push(s + (m[4] ? a + p : p + a)); 106 } 107 else { 108 throw('Huh ?!'); 109 } 110 f = f.substring(m[0].length); 111 } 112 return o.join(''); 113 } 114 115 /* update displaying */ 116 function checkPermitAction() { 117 var nbSelected = 0; 118 if ($("input[name=setSelected]").is(':checked')) { 119 nbSelected = nb_thumbs_set; 120 } else { 121 $(".thumbnails input[type=checkbox]").each(function() { 122 if ($(this).is(':checked')) nbSelected++; 123 }); 124 } 125 126 if (nbSelected == 0) { 127 $("#beginImport").hide(); 128 } else { 129 $("#beginImport").show(); 130 } 131 132 $("#applyOnDetails").text( 133 sprintf( 134 applyOnDetails_pattern, 135 nbSelected 136 ) 137 ); 138 139 // display the number of currently selected photos in the "Selection" fieldset 140 if (nbSelected == 0) { 141 $("#selectedMessage").text( 51 $(this).click(function(event) { $(this).triggerHandler("shclick",event); }); 52 }); 53 }; 54 55 /* update displaying */ 56 function checkPermitAction() { 57 var nbSelected = 0; 58 if ($("input[name=setSelected]").is(':checked')) { 59 nbSelected = nb_thumbs_set; 60 } 61 else { 62 $(".thumbnails input[type=checkbox]").each(function() { 63 if ($(this).is(':checked')) nbSelected++; 64 }); 65 } 66 67 if (nbSelected == 0) { 68 $("#beginImport").hide(); 69 } 70 else { 71 $("#beginImport").show(); 72 } 73 74 $("#applyOnDetails").text( 142 75 sprintf( 143 selectedMessage_none,144 nb _thumbs_set76 '{'on the %d selected photos'|translate|escape:javascript}', 77 nbSelected 145 78 ) 146 79 ); 147 } else if (nbSelected == nb_thumbs_set) { 148 $("#selectedMessage").text( 149 sprintf( 150 selectedMessage_all, 151 nb_thumbs_set 152 ) 153 ); 154 } else { 155 $("#selectedMessage").text( 156 sprintf( 157 selectedMessage_pattern, 158 nbSelected, 159 nb_thumbs_set 160 ) 161 ); 80 81 // display the number of currently selected photos in the "Selection" fieldset 82 if (nbSelected == 0) { 83 $("#selectedMessage").text( 84 sprintf( 85 '{'No photo selected, %d photos in current set'|translate|escape:javascript}', 86 nb_thumbs_set 87 ) 88 ); 89 } 90 else if (nbSelected == nb_thumbs_set) { 91 $("#selectedMessage").text( 92 sprintf( 93 '{'All %d photos are selected'|translate|escape:javascript}', 94 nb_thumbs_set 95 ) 96 ); 97 } 98 else { 99 $("#selectedMessage").text( 100 sprintf( 101 '{'%d of %d photos selected'|translate|escape:javascript}', 102 nbSelected, 103 nb_thumbs_set 104 ) 105 ); 106 } 162 107 } 163 } 164 165 /* import queue */ 166 function performImport(photo, album, fills, pwa_album) { 167 queuedManager.add({ 168 type: 'GET', 169 dataType: 'json', 170 url: 'ws.php', 171 data: { method: 'pwg.images.addPicasa', id: photo, category: album, fills: fills, pwa_album: pwa_album, format: 'json' }, 172 success: function(data) { 173 if (data['stat'] == 'ok') { 174 jQuery.jGrowl(data['result'], { theme: 'success', header: successHead, life: 4000, sticky: false }); 175 jQuery("#photo-"+photo).fadeOut(function(){ $(this).remove(); }); 176 } else { 177 jQuery.jGrowl(data['result'], { theme: 'error', header: errorHead, sticky: true }); 108 109 /* import queue */ 110 function performImport(photo, album, fills, pwa_album) { 111 queuedManager.add({ 112 type: 'GET', 113 dataType: 'json', 114 url: 'ws.php', 115 data: { 116 method: 'pwg.images.addPicasa', 117 id: photo, 118 category: album, 119 fills: fills, 120 pwa_album: pwa_album, 121 format: 'json' 122 }, 123 success: function(data) { 124 if (data['stat'] == 'ok') { 125 $.jGrowl(data['result'], { 126 theme: 'success', life: 4000, sticky: false, 127 header: '{'Success'|translate}' 128 }); 129 $("#photo-"+photo).fadeOut(function(){ $(this).remove(); }); 130 } 131 else { 132 $.jGrowl(data['result'], { 133 theme: 'error', sticky: true, 134 header: '{'ERROR'|translate}' 135 }); 136 } 137 138 import_done++; 139 $("#progress").html(import_done +"/"+ import_selected); 140 141 if (import_done == import_selected) { 142 $("#import_form").append('<input type="hidden" name="done" value="' + import_done + '">'); 143 $("#import_form").submit(); 144 } 145 }, 146 error: function(data) { 147 $.jGrowl('{'an error happened'|translate|escape:javascript}', { 148 theme: 'error', sticky: true, 149 header: '{'ERROR'|translate}' 150 }); 178 151 } 179 180 import_done++; 181 $("#progress").html(import_done +"/"+ import_selected); 182 183 if (import_done == import_selected) { 184 $("#import_form").append('<input type="hidden" name="done" value="' + import_done + '">'); 185 $("#import_form").submit(); 186 } 187 }, 188 error: function(data) { 189 jQuery.jGrowl(errorMsg, { theme: 'error', header: errorHead, sticky: true }); 190 } 191 }); 192 } 193 194 195 $(document).ready(function() { 152 }); 153 } 154 155 196 156 checkPermitAction(); 197 157 $("a.preview-box").colorbox(); … … 207 167 /* thumbnail click */ 208 168 $(".wrap1 label").click(function (event) { 209 $("input[name=setSelected]"). attr('checked', false);169 $("input[name=setSelected]").prop('checked', false); 210 170 211 171 var wrap2 = $(this).children(".wrap2"); … … 226 186 /* select all */ 227 187 $("#selectAll").click(function () { 228 $("input[name=setSelected]"). attr('checked', false);188 $("input[name=setSelected]").prop('checked', false); 229 189 230 190 $(".thumbnails label").each(function() { … … 232 192 var checkbox = $(this).children("input[type=checkbox]"); 233 193 234 $(checkbox). attr('checked', true);194 $(checkbox).prop('checked', true); 235 195 $(wrap2).addClass("thumbSelected"); 236 196 }); … … 242 202 /* select none */ 243 203 $("#selectNone").click(function () { 244 $("input[name=setSelected]"). attr('checked', false);204 $("input[name=setSelected]").prop('checked', false); 245 205 246 206 $(".thumbnails label").each(function() { … … 248 208 var checkbox = $(this).children("input[type=checkbox]"); 249 209 250 $(checkbox). attr('checked', false);210 $(checkbox).prop('checked', false); 251 211 $(wrap2).removeClass("thumbSelected"); 252 212 }); … … 258 218 /* select invert */ 259 219 $("#selectInvert").click(function () { 260 $("input[name=setSelected]"). attr('checked', false);220 $("input[name=setSelected]").prop('checked', false); 261 221 262 222 $(".thumbnails label").each(function() { … … 264 224 var checkbox = $(this).children("input[type=checkbox]"); 265 225 266 $(checkbox). attr('checked', !$(checkbox).is(':checked'));226 $(checkbox).prop('checked', !$(checkbox).is(':checked')); 267 227 268 228 if ($(checkbox).is(':checked')) { 269 229 $(wrap2).addClass("thumbSelected"); 270 } else { 230 } 231 else { 271 232 $(wrap2).removeClass('thumbSelected'); 272 233 } … … 279 240 /* select set */ 280 241 $("#selectSet").click(function () { 281 $("input[name=setSelected]"). attr('checked', true);242 $("input[name=setSelected]").prop('checked', true); 282 243 283 244 $(".thumbnails label").each(function() { … … 285 246 var checkbox = $(this).children("input[type=checkbox]"); 286 247 287 $(checkbox). attr('checked', true);248 $(checkbox).prop('checked', true); 288 249 $(wrap2).addClass("thumbSelected"); 289 250 }); … … 294 255 295 256 /* begin import */ 296 jQuery('#beginImport').click(function() {257 $('#beginImport').click(function() { 297 258 $("#loader_import").fadeIn(); 298 259 var album = $("#albumSelect option:selected").val(); 299 var pwa_album = "{ /literal}{$album}{literal}";260 var pwa_album = "{$album}"; 300 261 301 262 var fills = ''; … … 304 265 }); 305 266 306 if ( jQuery('input[name="setSelected"]').attr('checked')) {267 if ($('input[name="setSelected"]').prop('checked')) { 307 268 import_selected = all_elements.length; 308 269 $("#progress").html("0/"+ import_selected); … … 311 272 performImport(all_elements[i], album, fills, pwa_album); 312 273 } 313 } else { 274 } 275 else { 314 276 import_selected = $("input[name='selection[]']:checked").length; 315 277 $("#progress").html("0/"+ import_selected); 316 278 317 jQuery("input[name='selection[]']:checked").each(function() {318 performImport( jQuery(this).attr('value'), album, fills, pwa_album);279 $("input[name='selection[]']:checked").each(function() { 280 performImport($(this).attr('value'), album, fills, pwa_album); 319 281 }); 320 282 } … … 324 286 325 287 /* pagination loader */ 326 jQuery('#navigation a').click(function() {288 $('#navigation a').click(function() { 327 289 $("#loader_display").fadeIn(); 328 290 }); 329 }); 330 {/literal} 291 }(jQuery)); 331 292 {/footer_script} 293 332 294 333 295 <div id="batchManagerGlobal"> … … 335 297 336 298 <fieldset> 337 <legend>{'Selection'| @translate}</legend>299 <legend>{'Selection'|translate}</legend> 338 300 339 301 {if !empty($thumbnails)} 340 302 <p id="checkActions"> 341 {'Select:'| @translate}303 {'Select:'|translate} 342 304 {if $nb_thumbs_set > $nb_thumbs_page} 343 <a href="#" id="selectAll">{'The whole page'| @translate}</a>,344 <a href="#" id="selectSet">{'The whole set'| @translate}</a>,305 <a href="#" id="selectAll">{'The whole page'|translate}</a>, 306 <a href="#" id="selectSet">{'The whole set'|translate}</a>, 345 307 {else} 346 <a href="#" id="selectAll">{'All'| @translate}</a>,308 <a href="#" id="selectAll">{'All'|translate}</a>, 347 309 {/if} 348 <a href="#" id="selectNone">{'None'| @translate}</a>,349 <a href="#" id="selectInvert">{'Invert'| @translate}</a>310 <a href="#" id="selectNone">{'None'|translate}</a>, 311 <a href="#" id="selectInvert">{'Invert'|translate}</a> 350 312 351 313 <span id="selectedMessage"></span> 352 314 <input type="checkbox" name="setSelected" style="display:none"> 353 <span id="loader_display" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'| @translate}</i></span>315 <span id="loader_display" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'|translate}</i></span> 354 316 </p> 355 317 … … 360 322 <label> 361 323 <span class="wrap2"> 362 <div class="actions"><a href="{$thumbnail.src}" class="preview-box">{'Zoom'| @translate}</a> · <a href="{$thumbnail.url}" target="_blank" title="{'Open Google page in a new tab'|@translate}">Picasa</a></div>324 <div class="actions"><a href="{$thumbnail.src}" class="preview-box">{'Zoom'|translate}</a> · <a href="{$thumbnail.url}" target="_blank" title="{'Open Google page in a new tab'|translate}">Picasa</a></div> 363 325 <span> 364 326 <img src="{$thumbnail.thumb}" alt="{$thumbnail.title}" title="{$thumbnail.title|@escape:'html'}" class="thumbnail"> … … 380 342 {/if} 381 343 382 <div style="float:right;margin-top:10px;">{'display'| @translate}344 <div style="float:right;margin-top:10px;">{'display'|translate} 383 345 <a href="{$U_DISPLAY}&display=20">20</a> 384 346 · <a href="{$U_DISPLAY}&display=50">50</a> 385 347 · <a href="{$U_DISPLAY}&display=100">100</a> 386 · <a href="{$U_DISPLAY}&display=all">{'all'| @translate}</a>387 {'photos per page'| @translate}348 · <a href="{$U_DISPLAY}&display=all">{'all'|translate}</a> 349 {'photos per page'|translate} 388 350 </div> 389 351 </div> 390 352 391 353 {else} 392 <div>{'No photo in the current set.'| @translate}</div>354 <div>{'No photo in the current set.'|translate}</div> 393 355 {/if} 394 356 </fieldset> 395 357 396 358 <fieldset> 397 <legend>{'Import options'| @translate}</legend>359 <legend>{'Import options'|translate}</legend> 398 360 399 361 <p> 400 <label for="albumSelect"><b>{'Album'| @translate}:</b></label>362 <label for="albumSelect"><b>{'Album'|translate}:</b></label> 401 363 <select style="width:400px" name="associate" id="albumSelect" size="1"> 402 364 {html_options options=$category_parent_options} 403 365 </select> 404 {'... or '| @translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>366 {'... or '|translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|translate}">{'create a new album'|translate}</a> 405 367 </p> 406 368 407 369 <p> 408 <b>{'Fill these fields from Google datas'| @translate}:</b>409 <label><input type="checkbox" name="fill_name" checked="checked"> {'Photo name'| @translate}</label>410 <label><input type="checkbox" name="fill_author" checked="checked"> {'Author'| @translate}</label>411 <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'| @translate}</label>412 <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'| @translate}</label>413 <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'| @translate}</label>414 {if $GMAPS_LOADED}<label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>{/if}370 <b>{'Fill these fields from Google datas'|translate}:</b> 371 <label><input type="checkbox" name="fill_name" checked="checked"> {'Photo name'|translate}</label> 372 <label><input type="checkbox" name="fill_author" checked="checked"> {'Author'|translate}</label> 373 <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'|translate}</label> 374 <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'|translate}</label> 375 <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|translate}</label> 376 <label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|translate}</label> 415 377 </p> 416 378 417 379 <p> 418 380 <input type="hidden" name="album" value="{$album}"> 419 <input type="submit" name="import_set" id="beginImport" value="{'Begin transfer'| @translate}" style="display:none;">420 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'| @translate}</i> <span id="progress"></span></span>381 <input type="submit" name="import_set" id="beginImport" value="{'Begin transfer'|translate}" style="display:none;"> 382 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'|translate}</i> <span id="progress"></span></span> 421 383 </p> 422 384 </fieldset> -
extensions/Google2Piwigo/admin/template/import.tpl
r25788 r26198 1 1 {include file='include/colorbox.inc.tpl'} 2 2 {include file='include/add_album.inc.tpl'} 3 {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} 3 4 {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} 4 5 {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'} 5 6 {combine_css path="themes/default/js/plugins/jquery.jGrowl.css"} 6 7 7 {combine_css path=$PICASA_WA_PATH| @cat:"admin/template/style.css"}8 {combine_css path=$PICASA_WA_PATH|cat:"admin/template/style.css"} 8 9 9 {footer_script} {literal}10 {footer_script} 10 11 $("input.login").click(function() { 11 window.location.href = "{ /literal}{$picasa_login}{literal}";12 window.location.href = "{$picasa_login}"; 12 13 }); 13 14 $(".login_help").click(function() { 14 15 $(".infos.tip").slideToggle(); 15 16 }); 16 {/literal}{/footer_script} 17 {/footer_script} 18 17 19 18 20 <div class="titrePage"> … … 22 24 {* <!-- LOGIN --> *} 23 25 {if $ACTION == 'login'} 24 <p><input type="submit" class="login" value="{'Login'| @translate}"></p>25 <p><a href="#" class="login_help">{'Help! I get the error "The site [...] has not been registered."'| @translate}</a></p>26 <p><input type="submit" class="login" value="{'Login'|translate}"></p> 27 <p><a href="#" class="login_help">{'Help! I get the error "The site [...] has not been registered."'|translate}</a></p> 26 28 27 29 <div class="infos tip" style="display:none;"> … … 30 32 31 33 {* <!-- MAIN MENU --> *} 32 {else if $ACTION == 'main'}33 {footer_script} {literal}34 {else if $ACTION == 'main'} 35 {footer_script} 34 36 jQuery('input[type="submit"]').click(function() { 35 37 window.location.href = $(this).attr("data"); … … 38 40 $("#loader_import").fadeIn(); 39 41 }); 40 {/ literal}{/footer_script}42 {/footer_script} 41 43 42 44 <p> 43 <b>{'Logged in as'| @translate}</b> : {$username}<br><br>44 <input type="submit" data="{$logout_url}" value="{'Logout'| @translate}">45 <b>{'Logged in as'|translate}</b> : {$username}<br><br> 46 <input type="submit" data="{$logout_url}" value="{'Logout'|translate}"> 45 47 </p> 46 48 <br> 47 49 <p> 48 <input type="submit" data="{$list_albums_url}" class="load" value="{'List my albums'| @translate}">49 <input type="submit" data="{$import_all_url}" class="load" value="{'Import all my pictures'| @translate}">50 <input type="submit" data="{$list_albums_url}" class="load" value="{'List my albums'|translate}"> 51 <input type="submit" data="{$import_all_url}" class="load" value="{'Import all my pictures'|translate}"> 50 52 <br> 51 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'| @translate}</i></span>53 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'|translate}</i></span> 52 54 </p> 53 55 54 56 {* <!-- ALBUMS LIST --> *} 55 {else if $ACTION == 'list_albums'}56 {footer_script} {literal}57 {else if $ACTION == 'list_albums'} 58 {footer_script} 57 59 jQuery('.load').click(function() { 58 60 $("#loader_import").fadeIn(); 59 61 }); 60 {/ literal}{/footer_script}62 {/footer_script} 61 63 62 <h3>{'%d albums'| @translate|@sprintf:$total_albums}</h3>64 <h3>{'%d albums'|translate:$total_albums}</h3> 63 65 <ul id="albumsList"> 64 66 {foreach from=$albums item=album} 65 67 <li> 66 <b><a href="{$album.U_LIST}" class="load">{$album.title}</a></b> <i>{'(%d photos)'| @translate|@sprintf:$album.photos}</i>67 {if $album.description}- {$album.description| @truncate:100}{/if}68 <b><a href="{$album.U_LIST}" class="load">{$album.title}</a></b> <i>{'(%d photos)'|translate:$album.photos}</i> 69 {if $album.description}- {$album.description|truncate:100}{/if} 68 70 </li> 69 71 {/foreach} 70 72 </ul> 71 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'| @translate}</i></span>73 <span id="loader_import" style="display:none;"><img src="admin/themes/default/images/ajax-loader.gif"> <i>{'Processing...'|translate}</i></span> 72 74 73 75 {* <!-- PHOTOS LIST --> *} 74 {else if $ACTION == 'list_photos'}76 {else if $ACTION == 'list_photos'} 75 77 {include file=$PICASA_WA_ABS_PATH|@cat:'admin/template/import.list_photos.tpl'} 76 78 77 79 {* <!-- IMPORT ALL --> *} 78 {else if $ACTION == 'list_all'}80 {else if $ACTION == 'list_all'} 79 81 {include file=$PICASA_WA_ABS_PATH|@cat:'admin/template/import.list_all.tpl'} 80 82 -
extensions/Google2Piwigo/include/functions.inc.php
r20670 r26198 1 1 <?php 2 if (!defined('PICASA_WA_PATH'))die('Hacking attempt!');2 defined('PICASA_WA_PATH') or die('Hacking attempt!'); 3 3 4 4 /** … … 116 116 return false; 117 117 } 118 119 ?> -
extensions/Google2Piwigo/include/ws_functions.inc.php
r20670 r26198 1 1 <?php 2 if (!defined('PICASA_WA_PATH'))die('Hacking attempt!');2 defined('PICASA_WA_PATH') or die('Hacking attempt!'); 3 3 4 4 function picasa_wa_add_ws_method($arr) … … 15 15 'fills' => array('default' => 'fill_name,fill_author,fill_tags,fill_date,fill_description'), 16 16 ), 17 'Used by Picasa Web Albums' 17 'Used by Picasa Web Albums', 18 null, 19 array('hidden'=>true) 18 20 ); 19 21 } … … 72 74 $photo['path'] = PICASA_WA_CACHE . 'picasa-'.$photo['id'].'.'.get_extension($photo['url']); 73 75 74 if ($photoEntry->getGeoRssWhere() !== null && !empty($pwg_loaded_plugins['rv_gmaps']))76 if ($photoEntry->getGeoRssWhere() !== null) 75 77 { 76 78 $photo['latlon'] = $photoEntry->getGeoRssWhere()->getPoint()->getPos()->getText(); … … 136 138 if (in_array('fill_author', $params['fills'])) $updates['author'] = pwg_db_real_escape_string($photo['author']); 137 139 if (in_array('fill_description', $params['fills'])) $updates['comment'] = pwg_db_real_escape_string($photo['description']); 138 if (in_array('fill_geotag', $params['fills']) and !empty($photo['latlon']) 140 if (in_array('fill_geotag', $params['fills']) and !empty($photo['latlon'])) 139 141 { 140 142 $latlon = explode(' ', $photo['latlon']); 141 143 if (count($latlon) == 2) 142 144 { 143 $updates['lat '] = pwg_db_real_escape_string($latlon[0]);144 $updates['lon '] = pwg_db_real_escape_string($latlon[1]);145 $updates['latitude'] = pwg_db_real_escape_string($latlon[0]); 146 $updates['longitude'] = pwg_db_real_escape_string($latlon[1]); 145 147 } 146 148 } … … 155 157 } 156 158 157 if ( !empty($photo['tags']) and in_array('fill_tags', $params['fills']))159 if (!empty($photo['tags']) and in_array('fill_tags', $params['fills'])) 158 160 { 159 161 set_tags(get_tag_ids($photo['tags']), $photo['image_id']); … … 161 163 } 162 164 163 return sprintf(l10n('Photo "%s" imported'), $photo['title']);165 return l10n('Photo "%s" imported', $photo['title']); 164 166 } 165 166 ?> -
extensions/Google2Piwigo/main.inc.php
r24816 r26198 9 9 */ 10 10 11 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');11 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 12 12 13 13 global $conf; 14 14 15 define('PICASA_WA_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 16 define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__))); 15 define('PICASA_WA_ID', basename(dirname(__FILE__))); 16 define('PICASA_WA_PATH', PHPWG_PLUGINS_PATH . PICASA_WA_ID . '/'); 17 define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . PICASA_WA_ID); 17 18 define('PICASA_WA_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/'); 19 20 21 include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php'); 22 23 add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method'); 18 24 19 25 if (defined('IN_ADMIN')) 20 26 { 21 27 add_event_handler('get_admin_plugin_menu_links', 'picasa_wa_admin_menu'); 28 22 29 add_event_handler('get_batch_manager_prefilters', 'picasa_wa_add_batch_manager_prefilters'); 23 30 add_event_handler('perform_batch_manager_prefilters', 'picasa_wa_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 24 add_event_handler('loc_begin_admin_page', 'picasa_wa_prefilter_from_url');25 31 26 32 function picasa_wa_admin_menu($menu) 27 33 { 28 array_push($menu,array(34 $menu[] = array( 29 35 'NAME' => 'Google2Piwigo', 30 36 'URL' => PICASA_WA_ADMIN, 31 ));37 ); 32 38 return $menu; 33 39 } … … 35 41 function picasa_wa_add_batch_manager_prefilters($prefilters) 36 42 { 37 array_push($prefilters,array(43 $prefilters[] = array( 38 44 'ID' => 'picasa', 39 45 'NAME' => l10n('Imported from Google/Picasa'), 40 ));46 ); 41 47 return $prefilters; 42 48 } … … 51 57 WHERE file LIKE "picasa-%" 52 58 ;'; 53 $filter_sets[] = array_from_query($query, 'id');59 $filter_sets[] = query2array($query, null, 'id'); 54 60 } 55 61 56 62 return $filter_sets; 57 63 } 58 59 function picasa_wa_prefilter_from_url()60 {61 global $page;62 if ($page['page'] == 'batch_manager' && @$_GET['prefilter'] == 'picasa')63 {64 $_SESSION['bulk_manager_filter'] = array('prefilter' => 'picasa');65 unset($_GET['prefilter']);66 }67 }68 64 } 69 70 71 include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php');72 73 add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method');74 75 ?>
Note: See TracChangeset
for help on using the changeset viewer.