Changeset 26198


Ignore:
Timestamp:
Dec 26, 2013, 12:07:19 PM (10 years ago)
Author:
mistic100
Message:

update for Piwigo 2.6

Location:
extensions/Google2Piwigo
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Google2Piwigo/admin.php

    r17475 r26198  
    11<?php
    2 if (!defined('PICASA_WA_PATH')) die('Hacking attempt!');
     2defined('PICASA_WA_PATH') or die('Hacking attempt!');
    33
    44global $template, $page, $conf;
     
    2020  'PICASA_WA_ADMIN' => PICASA_WA_ADMIN,
    2121  ));
     22
    2223$template->assign_var_from_handle('ADMIN_CONTENT', 'picasa_web_albums');
    23 
    24 ?>
  • extensions/Google2Piwigo/admin/import.php

    r25788 r26198  
    11<?php
    2 if (!defined('PICASA_WA_PATH')) die('Hacking attempt!');
     2defined('PICASA_WA_PATH') or die('Hacking attempt!');
    33
    44set_time_limit(600);
     
    66include_once(PICASA_WA_PATH . 'include/functions.inc.php');
    77
    8 if ( !test_remote_download() )
     8if (!test_remote_download())
    99{
    10   array_push($page['errors'], l10n('No download method available'));
     10  $page['errors'][] = l10n('No download method available');
    1111  $_GET['action'] = 'error';
    1212}
     
    3939
    4040
    41 if (!isset($_GET['action'])) $_GET['action'] = 'main';
     41if (!isset($_GET['action']))
     42{
     43  $_GET['action'] = 'main';
     44}
    4245
    4346switch ($_GET['action'])
     
    102105    foreach ($userFeed as $userEntry)
    103106    {
    104       array_push($albums, array(
     107      $albums[] = array(
    105108        'title' =>       $userEntry->title->text,
    106109        'description' => $userEntry->mediaGroup->description->text,
    107110        'photos' =>      $userEntry->gphotoNumPhotos->text,
    108111        'U_LIST' => PICASA_WA_ADMIN . '-import&amp;action=list_photos&amp;album=' . $userEntry->gphotoId->text,
    109         ));
     112        );
    110113    }
    111114   
     
    139142    foreach ($albumFeed as $albumEntry)
    140143    {
    141       array_push($all_photos, array(
     144      $all_photos[] = array(
    142145        'id' =>    $albumEntry->getGphotoId()->getText(),
    143146        'name' =>  $albumEntry->mediaGroup->title->text,
     
    145148        'src' =>   $albumEntry->mediaGroup->content[0]->url,
    146149        'url' =>   $albumEntry->link[2]->href,
    147         ));
     150        );
    148151    }
    149152   
     
    170173    if ($duplicates>0)
    171174    {
    172       $page['infos'][] = '<a href="admin.php?page=batch_manager&amp;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&amp;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)
    174180        .'</a>';
    175181    }
     
    260266    if ($duplicates>0)
    261267    {
    262       $page['infos'][] = '<a href="admin.php?page=batch_manager&amp;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&amp;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)
    264273        .'</a>';
    265274    }
     
    267276    $template->assign(array(
    268277      'nb_elements' =>  count($all_photos),
    269       'all_elements' => json_encode($all_photos),
     278      'all_elements' => $all_photos,
    270279      'F_ACTION' =>     PICASA_WA_ADMIN . '-import&amp;action=import_set',
    271280      ));
     
    285294    if (isset($_POST['done']))
    286295    {
    287       $_SESSION['page_infos'][] = sprintf(l10n('%d pictures imported'), $_POST['done']);
     296      $_SESSION['page_infos'][] = l10n('%d pictures imported', $_POST['done']);
    288297    }
    289298    redirect(PICASA_WA_ADMIN . '-import');
     
    292301
    293302
    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']);
    298304
    299305$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  
    11{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  });
    611
    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  }
    1356
    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};
    4657 
    4758  /* begin import */
    48   jQuery('#beginImport').click(function() {
     59  $('#beginImport').click(function() {
    4960    $("#loader_import").fadeIn();
    5061   
    5162    if ($("input[name='album_mode']:checked").val() == 'identical') {
    5263      album = "<!-- create -->";
    53     } else {
     64    }
     65    else {
    5466      album = $("#albumSelect option:selected").val();
    5567    }
     
    7486    if ($(this).val() == 'one_album') {
    7587      $("#albumSelectWrapper").slideDown();
    76     } else {
     88    }
     89    else {
    7790      $("#albumSelectWrapper").slideUp();
    7891    }
    7992  });
    80 });
    81 {/literal}
     93}(jQuery));
    8294{/footer_script}
    8395
     
    8597
    8698  <fieldset>
    87     <legend>{'Selection'|@translate}</legend>
     99    <legend>{'Selection'|translate}</legend>
    88100
    89101  {if $nb_elements}
    90     {'%d elements ready for importation'|@translate|@sprintf:$nb_elements}
     102    {'%d elements ready for importation'|translate:$nb_elements}
    91103  {else}
    92     <div>{'No photo in the current set.'|@translate}</div>
     104    <div>{'No photo in the current set.'|translate}</div>
    93105  {/if}
    94106  </fieldset>
    95107 
    96108  <fieldset>
    97     <legend>{'Import options'|@translate}</legend>
     109    <legend>{'Import options'|translate}</legend>
    98110   
    99111    <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>
    102114    </p>
    103115
     
    106118        {html_options options=$category_parent_options}
    107119      </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>
    109121    </p>
    110122   
    111123    <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>
    119131    </p>
    120132   
    121133    <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>
    124136    </p>
    125137  </fieldset>
  • extensions/Google2Piwigo/admin/template/import.list_photos.tpl

    r25788 r26198  
    11{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 */
    2514  var last_clicked=0;
    2615  var last_clickedstatus=true;
    27   jQuery.fn.enableShiftClick = function() {
     16  $.fn.enableShiftClick = function() {
    2817    var inputs = [];
    2918    var count=0;
     
    6049        return true;
    6150      });
    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(
    14275      sprintf(
    143         selectedMessage_none,
    144         nb_thumbs_set
     76        '{'on the %d selected photos'|translate|escape:javascript}',
     77        nbSelected
    14578      )
    14679    );
    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    }
    162107  }
    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        });
    178151      }
    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
    196156  checkPermitAction();
    197157  $("a.preview-box").colorbox();
     
    207167  /* thumbnail click */
    208168  $(".wrap1 label").click(function (event) {
    209     $("input[name=setSelected]").attr('checked', false);
     169    $("input[name=setSelected]").prop('checked', false);
    210170
    211171    var wrap2 = $(this).children(".wrap2");
     
    226186  /* select all */
    227187  $("#selectAll").click(function () {
    228     $("input[name=setSelected]").attr('checked', false);
     188    $("input[name=setSelected]").prop('checked', false);
    229189   
    230190    $(".thumbnails label").each(function() {
     
    232192      var checkbox = $(this).children("input[type=checkbox]");
    233193
    234       $(checkbox).attr('checked', true);
     194      $(checkbox).prop('checked', true);
    235195      $(wrap2).addClass("thumbSelected");
    236196    });
     
    242202  /* select none */
    243203  $("#selectNone").click(function () {
    244     $("input[name=setSelected]").attr('checked', false);
     204    $("input[name=setSelected]").prop('checked', false);
    245205   
    246206    $(".thumbnails label").each(function() {
     
    248208      var checkbox = $(this).children("input[type=checkbox]");
    249209
    250       $(checkbox).attr('checked', false);
     210      $(checkbox).prop('checked', false);
    251211      $(wrap2).removeClass("thumbSelected");
    252212    });
     
    258218  /* select invert */
    259219  $("#selectInvert").click(function () {
    260     $("input[name=setSelected]").attr('checked', false);
     220    $("input[name=setSelected]").prop('checked', false);
    261221   
    262222    $(".thumbnails label").each(function() {
     
    264224      var checkbox = $(this).children("input[type=checkbox]");
    265225
    266       $(checkbox).attr('checked', !$(checkbox).is(':checked'));
     226      $(checkbox).prop('checked', !$(checkbox).is(':checked'));
    267227
    268228      if ($(checkbox).is(':checked')) {
    269229        $(wrap2).addClass("thumbSelected");
    270       } else {
     230      }
     231      else {
    271232        $(wrap2).removeClass('thumbSelected');
    272233      }
     
    279240  /* select set */
    280241  $("#selectSet").click(function () {
    281     $("input[name=setSelected]").attr('checked', true);
     242    $("input[name=setSelected]").prop('checked', true);
    282243   
    283244    $(".thumbnails label").each(function() {
     
    285246      var checkbox = $(this).children("input[type=checkbox]");
    286247
    287       $(checkbox).attr('checked', true);
     248      $(checkbox).prop('checked', true);
    288249      $(wrap2).addClass("thumbSelected");
    289250    });
     
    294255 
    295256  /* begin import */
    296   jQuery('#beginImport').click(function() {
     257  $('#beginImport').click(function() {
    297258    $("#loader_import").fadeIn();
    298259    var album = $("#albumSelect option:selected").val();
    299     var pwa_album = "{/literal}{$album}{literal}";
     260    var pwa_album = "{$album}";
    300261   
    301262    var fills = '';
     
    304265    });
    305266   
    306     if (jQuery('input[name="setSelected"]').attr('checked')) {
     267    if ($('input[name="setSelected"]').prop('checked')) {
    307268      import_selected = all_elements.length;
    308269      $("#progress").html("0/"+ import_selected);
     
    311272        performImport(all_elements[i], album, fills, pwa_album);
    312273      }
    313                 } else {
     274                }
     275    else {
    314276      import_selected = $("input[name='selection[]']:checked").length;
    315277      $("#progress").html("0/"+ import_selected);
    316278     
    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);
    319281      });
    320282    }
     
    324286 
    325287  /* pagination loader */
    326   jQuery('#navigation a').click(function() {
     288  $('#navigation a').click(function() {
    327289    $("#loader_display").fadeIn();
    328290  });
    329 });
    330 {/literal}
     291}(jQuery));
    331292{/footer_script}
     293
    332294
    333295<div id="batchManagerGlobal">
     
    335297
    336298  <fieldset>
    337     <legend>{'Selection'|@translate}</legend>
     299    <legend>{'Selection'|translate}</legend>
    338300
    339301  {if !empty($thumbnails)}
    340302    <p id="checkActions">
    341       {'Select:'|@translate}
     303      {'Select:'|translate}
    342304    {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>,
    345307    {else}
    346       <a href="#" id="selectAll">{'All'|@translate}</a>,
     308      <a href="#" id="selectAll">{'All'|translate}</a>,
    347309    {/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>
    350312
    351313      <span id="selectedMessage"></span>
    352314      <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>
    354316    </p>
    355317
     
    360322                                        <label>
    361323                                                <span class="wrap2">
    362                                                 <div class="actions"><a href="{$thumbnail.src}" class="preview-box">{'Zoom'|@translate}</a> &middot; <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> &middot; <a href="{$thumbnail.url}" target="_blank" title="{'Open Google page in a new tab'|translate}">Picasa</a></div>
    363325                                                        <span>
    364326                                                                <img src="{$thumbnail.thumb}" alt="{$thumbnail.title}" title="{$thumbnail.title|@escape:'html'}" class="thumbnail">
     
    380342    {/if}
    381343   
    382       <div style="float:right;margin-top:10px;">{'display'|@translate}
     344      <div style="float:right;margin-top:10px;">{'display'|translate}
    383345        <a href="{$U_DISPLAY}&amp;display=20">20</a>
    384346        &middot; <a href="{$U_DISPLAY}&amp;display=50">50</a>
    385347        &middot; <a href="{$U_DISPLAY}&amp;display=100">100</a>
    386         &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
    387         {'photos per page'|@translate}
     348        &middot; <a href="{$U_DISPLAY}&amp;display=all">{'all'|translate}</a>
     349        {'photos per page'|translate}
    388350      </div>
    389351    </div>
    390352
    391353  {else}
    392     <div>{'No photo in the current set.'|@translate}</div>
     354    <div>{'No photo in the current set.'|translate}</div>
    393355  {/if}
    394356  </fieldset>
    395357 
    396358  <fieldset>
    397     <legend>{'Import options'|@translate}</legend>
     359    <legend>{'Import options'|translate}</legend>
    398360
    399361    <p>
    400       <label for="albumSelect"><b>{'Album'|@translate}:</b></label>
     362      <label for="albumSelect"><b>{'Album'|translate}:</b></label>
    401363      <select style="width:400px" name="associate" id="albumSelect" size="1">
    402364        {html_options options=$category_parent_options}
    403365      </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>
    405367    </p>
    406368   
    407369    <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>
    415377    </p>
    416378
    417379    <p>
    418380      <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>
    421383    </p>
    422384  </fieldset>
  • extensions/Google2Piwigo/admin/template/import.tpl

    r25788 r26198  
    11{include file='include/colorbox.inc.tpl'}
    22{include file='include/add_album.inc.tpl'}
     3{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
    34{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
    45{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
    56{combine_css path="themes/default/js/plugins/jquery.jGrowl.css"}
    67
    7 {combine_css path=$PICASA_WA_PATH|@cat:"admin/template/style.css"}
     8{combine_css path=$PICASA_WA_PATH|cat:"admin/template/style.css"}
    89
    9 {footer_script}{literal}
     10{footer_script}
    1011$("input.login").click(function() {
    11   window.location.href = "{/literal}{$picasa_login}{literal}";
     12  window.location.href = "{$picasa_login}";
    1213});
    1314$(".login_help").click(function() {
    1415  $(".infos.tip").slideToggle();
    1516});
    16 {/literal}{/footer_script}
     17{/footer_script}
     18
    1719
    1820<div class="titrePage">
     
    2224{* <!-- LOGIN --> *}
    2325{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>
    2628
    2729<div class="infos tip" style="display:none;">
     
    3032
    3133{* <!-- MAIN MENU --> *}
    32 {elseif $ACTION == 'main'}
    33 {footer_script}{literal}
     34{else if $ACTION == 'main'}
     35{footer_script}
    3436jQuery('input[type="submit"]').click(function() {
    3537  window.location.href = $(this).attr("data");
     
    3840  $("#loader_import").fadeIn();
    3941});
    40 {/literal}{/footer_script}
     42{/footer_script}
    4143
    4244<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}">
    4547</p>
    4648<br>
    4749<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}">
    5052  <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>
    5254</p>
    5355
    5456{* <!-- ALBUMS LIST --> *}
    55 {elseif $ACTION == 'list_albums'}
    56 {footer_script}{literal}
     57{else if $ACTION == 'list_albums'}
     58{footer_script}
    5759jQuery('.load').click(function() {
    5860  $("#loader_import").fadeIn();
    5961});
    60 {/literal}{/footer_script}
     62{/footer_script}
    6163
    62 <h3>{'%d albums'|@translate|@sprintf:$total_albums}</h3>
     64<h3>{'%d albums'|translate:$total_albums}</h3>
    6365<ul id="albumsList">
    6466{foreach from=$albums item=album}
    6567  <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}
    6870  </li>
    6971{/foreach}
    7072</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>
    7274
    7375{* <!-- PHOTOS LIST --> *}
    74 {elseif $ACTION == 'list_photos'}
     76{else if $ACTION == 'list_photos'}
    7577{include file=$PICASA_WA_ABS_PATH|@cat:'admin/template/import.list_photos.tpl'}
    7678
    7779{* <!-- IMPORT ALL --> *}
    78 {elseif $ACTION == 'list_all'}
     80{else if $ACTION == 'list_all'}
    7981{include file=$PICASA_WA_ABS_PATH|@cat:'admin/template/import.list_all.tpl'}
    8082
  • extensions/Google2Piwigo/include/functions.inc.php

    r20670 r26198  
    11<?php
    2 if (!defined('PICASA_WA_PATH')) die('Hacking attempt!');
     2defined('PICASA_WA_PATH') or die('Hacking attempt!');
    33
    44/**
     
    116116  return false;
    117117}
    118 
    119 ?>
  • extensions/Google2Piwigo/include/ws_functions.inc.php

    r20670 r26198  
    11<?php
    2 if (!defined('PICASA_WA_PATH')) die('Hacking attempt!');
     2defined('PICASA_WA_PATH') or die('Hacking attempt!');
    33
    44function picasa_wa_add_ws_method($arr)
     
    1515      'fills' => array('default' => 'fill_name,fill_author,fill_tags,fill_date,fill_description'),
    1616      ),
    17     'Used by Picasa Web Albums'
     17    'Used by Picasa Web Albums',
     18    null,
     19    array('hidden'=>true)
    1820    );
    1921}
     
    7274  $photo['path'] = PICASA_WA_CACHE . 'picasa-'.$photo['id'].'.'.get_extension($photo['url']);
    7375 
    74   if ($photoEntry->getGeoRssWhere() !== null && !empty($pwg_loaded_plugins['rv_gmaps']))
     76  if ($photoEntry->getGeoRssWhere() !== null)
    7577  {
    7678    $photo['latlon'] = $photoEntry->getGeoRssWhere()->getPoint()->getPos()->getText();
     
    136138    if (in_array('fill_author', $params['fills']))      $updates['author'] = pwg_db_real_escape_string($photo['author']);
    137139    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']))
    139141    {
    140142      $latlon = explode(' ', $photo['latlon']);
    141143      if (count($latlon) == 2)
    142144      {
    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]);
    145147      }
    146148    }
     
    155157    }
    156158   
    157     if ( !empty($photo['tags']) and in_array('fill_tags', $params['fills']) )
     159    if (!empty($photo['tags']) and in_array('fill_tags', $params['fills']))
    158160    {
    159161      set_tags(get_tag_ids($photo['tags']), $photo['image_id']);
     
    161163  }
    162164 
    163   return sprintf(l10n('Photo "%s" imported'), $photo['title']);
     165  return l10n('Photo "%s" imported', $photo['title']);
    164166}
    165 
    166 ?>
  • extensions/Google2Piwigo/main.inc.php

    r24816 r26198  
    99*/
    1010
    11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1212
    1313global $conf;
    1414
    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__)));
     15define('PICASA_WA_ID',    basename(dirname(__FILE__)));
     16define('PICASA_WA_PATH',  PHPWG_PLUGINS_PATH . PICASA_WA_ID . '/');
     17define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . PICASA_WA_ID);
    1718define('PICASA_WA_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/');
     19
     20
     21include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php');
     22
     23add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method');
    1824
    1925if (defined('IN_ADMIN'))
    2026{
    2127  add_event_handler('get_admin_plugin_menu_links', 'picasa_wa_admin_menu');
     28
    2229  add_event_handler('get_batch_manager_prefilters', 'picasa_wa_add_batch_manager_prefilters');
    2330  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');
    2531
    2632  function picasa_wa_admin_menu($menu)
    2733  {
    28     array_push($menu, array(
     34    $menu[] = array(
    2935      'NAME' => 'Google2Piwigo',
    3036      'URL' => PICASA_WA_ADMIN,
    31     ));
     37      );
    3238    return $menu;
    3339  }
     
    3541  function picasa_wa_add_batch_manager_prefilters($prefilters)
    3642  {
    37     array_push($prefilters, array(
     43    $prefilters[] = array(
    3844      'ID' => 'picasa',
    3945      'NAME' => l10n('Imported from Google/Picasa'),
    40     ));
     46      );
    4147    return $prefilters;
    4248  }
     
    5157    WHERE file LIKE "picasa-%"
    5258  ;';
    53       $filter_sets[] = array_from_query($query, 'id');
     59      $filter_sets[] = query2array($query, null, 'id');
    5460    }
    5561   
    5662    return $filter_sets;
    5763  }
    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   }
    6864}
    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.