Changeset 6269 for extensions


Ignore:
Timestamp:
May 22, 2010, 1:07:30 AM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Compatibility with Piwigo 2.1

Location:
extensions/event_cats
Files:
1 added
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/admin/evntcats_admin.php

    r4885 r6269  
    380380print '<pre>';
    381381//print_r('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
    382 print('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
     382print('ROOT_URL + ... : '.preg_match('/(\d+\.\d+)\.(\d+)/', PHPWG_VERSION, $matches));
     383print('<br />');
     384print_r($matches);
    383385print '</pre>';
    384386*/
    385387
    386 $template->assign('ec_howto',
    387  ($ec_howto and (count($page['errors']) ==0 and count($page['infos']) == 0)));
    388 
    389 $template->assign('ec_help_banner_OK', (read_ec_conf('in_help_display') == '1'));
     388$template->assign(
     389 'HeaderIncTPL', realpath('plugins/event_cats/admin/template/header.inc.tpl')
     390);
     391
     392$template->assign(
     393 'FooterIncTPL', realpath('plugins/event_cats/admin/template/footer.inc.tpl')
     394);
     395
     396$template->assign(
     397 'ec_howto',
     398 ($ec_howto and (count($page['errors']) == 0 and count($page['infos']) == 0))
     399);
     400
     401$template->assign(
     402 'ec_help_banner_OK',
     403 (read_ec_conf('in_help_display') == '1')
     404);
    390405
    391406$template->assign('EVNTCATS_PATH', EVNTCATS_PATH);
    392407$template->assign('RACINE_URL', ROOT_URL);
    393 $template->assign('U_HELP', get_root_url().'popuphelp.php?page=ec_help');
     408$template->assign('U_HELP', get_root_url().'popuphelp.php?page=help');
    394409
    395410if (isset($conf['ec_debug1'])) $template->assign('ec_debug1', array(
  • extensions/event_cats/admin/template/autolog_entries.tpl

    r5058 r6269  
    33{* <!-- Keeps file coded in UTF-8 without BOM : é --> *}
    44
    5 {include file='../../../plugins/event_cats/admin/template/header.inc.tpl'}
     5{include file=$HeaderIncTPL}
    66
    77{* <!-- Whether plugin Additionnal Pages is active or not, and help banner management --> *}
     
    3232  {/if}
    3333</div><span id = "ec_help_ban"></span>
     34
     35<br />
    3436
    3537{* <!-- Form to view codes --> *}
     
    158160</script>
    159161
    160 {include file='../../../plugins/event_cats/admin/template/footer.inc.tpl'}
     162{include file=$FooterIncTPL}
  • extensions/event_cats/admin/template/autolog_new.tpl

    r5058 r6269  
    33{* <!-- Keeps file coded in UTF-8 without BOM : é --> *}
    44
    5 {include file='../../../plugins/event_cats/admin/template/header.inc.tpl'}
     5{include file=$HeaderIncTPL}
    66
    77{* <!-- Whether plugin Additionnal Pages is active or not, and help banner management --> *}
     
    338338//--></script>
    339339
    340 {include file='../../../plugins/event_cats/admin/template/footer.inc.tpl'}
     340{include file=$FooterIncTPL}
  • extensions/event_cats/admin/template/config.tpl

    r5058 r6269  
    33{* <!-- Keeps file coded in UTF-8 without BOM : é --> *}
    44
    5 {include file='../../../plugins/event_cats/admin/template/header.inc.tpl'}
     5{include file=$HeaderIncTPL}
    66
    77{* <!-- Whether plugin Additionnal Pages is active or not, and help banner management --> *}
     
    208208//--></script>
    209209
    210 {include file='../../../plugins/event_cats/admin/template/footer.inc.tpl'}
     210{include file=$FooterIncTPL}
  • extensions/event_cats/admin/template/duplication.tpl

    r5058 r6269  
    33{* <!-- Keeps file coded in UTF-8 without BOM : é --> *}
    44
    5 {include file='../../../plugins/event_cats/admin/template/header.inc.tpl'}
     5{include file=$HeaderIncTPL}
    66
    77{* <!-- For help banner --> *}
     
    182182</form>
    183183
    184 {include file='../../../plugins/event_cats/admin/template/footer.inc.tpl'}
     184{include file=$FooterIncTPL}
    185185
  • extensions/event_cats/admin/template/header.inc.tpl

    r5058 r6269  
    66
    77{* <!-- Page title --> *}
    8 <div class = "titrePage" style = "margin-top: -20px;">
     8<div class = "titrePage">
    99  <h2>{'Admin page title'|@translate} {$EVNTCATS_VERSION}</h2>
    1010</div>
     
    2323    {'Acknowledgement'|@translate}
    2424  </div>
    25   <p>
     25  <br />
    2626{/if}
    2727
  • extensions/event_cats/main.inc.php

    r5058 r6269  
    33/*
    44Plugin Name: Event Cats
    5 Version: auto
     5Version: 1.2.1
    66Description: A single URL can be enough to be identified, and a user can duplicate his account to create a new one getting immediately the same properties. / On peut être identifié grâce à un simple URL, et on peut dupliquer son compte pour créer un nouveau compte ayant immédiatement les mêmes propriétés.
    7 Plugin URI: http://piwigo.org/ext/extension_svn.php?eid=326
     7Plugin URI: http://piwigo.org/ext/extension_view.php?eid=326
    88Author: LucMorizur
    99Author URI: http://lucmorizur.free.fr
     
    4444define( // -------------------------------------------------------------------
    4545  'EVNTCATS_INFO_VERSION', // VERSION HISTORY :
    46    '1.2.1' // Improve EN translation thanks to Tosca
     46   '1.2.2' // Corrections for Piwigo 2.1 compatibility
     47// '2.1.0' // When done, will simplfy and allow EC management from categories
     48//            management pages in admin pages... yes yes...
     49// '1.2.1' // Improve EN translation thanks to Tosca
    4750// '1.2.0' // Add feature 1335, Possibility to display the 'Connection'
    4851//         // link in identification block menu for generic users ;
     
    7376include_once(EVNTCATS_PATH.'include/evntcats_main_funcs.inc.php');
    7477
    75 function ec_cat_modify_prefilter($content, &$smarty) {
    76   $search = '<fieldset id="image_order">';
    77   // $addon = '<fieldset id="event_cats_inc"><legend>YESSSSSSSSSSSSSS !!!</legend></fieldset>';
    78   $addon = "{include file='../../../plugins/event_cats/admin/template/ec_cat_modify.inc.tpl'} ";
    79   $replacement = $addon.$search;
    80   return str_replace($search, $replacement, $content);
    81   // return $content;
    82 }
    83 
    8478class event_cats {
    8579// Sets the administration panel of the plugin
    8680  function plugin_admin_menu($menu) {
    87     global $template;
    88    
    8981    array_push($menu,
    9082      array(
     
    9486      )
    9587    );
    96    
    97                                                                                // to be removed :
    98                                                                                   $template->delete_compiled_templates();
    99     $template->set_prefilter('categories', 'ec_cat_modify_prefilter');
    100    
    10188    return $menu;
    10289  }
    103  
    104   function ec_cat_modify() {
    105     global $template;
    106     $template->set_prefilter('categories', 'ec_cat_modify_prefilter');
    107   }
    108  
    10990} // End class
    11091
     
    120101function ec_popup_help_content($popup_help_content, $page) {
    121102  return (
    122    $help_content = (is_admin() and $page == 'ec_help') ?
    123     load_language('help.html', EVNTCATS_PATH, array('return' => true)) : false
     103   $help_content = (is_admin() and $page = 'help') ?
     104    load_language($page.'.html', EVNTCATS_PATH, array('return' => true)) : false
    124105  ) ? $popup_help_content.$help_content : $popup_help_content;
    125106}
     
    149130    if (!is_a_guest()) {
    150131      $url = '';
    151       foreach ($_GET as $item => $value) $url.= '&'.$item.'='.$value;
     132      foreach ($_GET as $item => $value) {
     133        $url.= '&'.$item.'='.$value;
     134      }
    152135      logout_user();
    153136      redirect(make_index_url().$url);
     
    305288 * required in the configuration.
    306289 *
     290 * ec_duplicate_prefilter
     291 * is used to modify the "quick connect" block in identification menu block,
     292 * so that visitors identifying themselves this way, are redirected to the
     293 * page they're currently displaying, instead of home page. This
     294 * functionnality has been added at version 2.1.0 in Piwigo core
     295 * (see bug:1484 Redirection after quickconnect), thus it is useless to
     296 * implement it from here for Piwigo versions higher or equal to 2.1.0.
     297 *
    307298 * @param no parameter
    308299 * @return no return value
     
    311302add_event_handler('blockmanager_apply', 'duplicate_account_url');
    312303
     304function ec_duplicate_prefilter($content, &$smarty) {
     305  $search = "<legend>{'Quick connect'|@translate}</legend>";
     306  $addon = '<input type="hidden" name="redirect" value="{$U_REDIRECT}">';
     307  $replacement = "<legend>{'Quick connect'|@translate}</legend>".$addon;
     308  return str_replace($search, $replacement, $content);
     309}
     310
    313311function duplicate_account_url() {
    314312  global $lang, $template, $user;
    315    
     313 
     314  if (version_compare(PHPWG_VERSION, '2.1.0', '<')) {
    316315    // Makes the "quick connect" fieldset able to redirect to current page
    317     // after user identification, just as does above "connection" link.
     316    // after user identification, just as does the "connection" link.
    318317    $template->assign(array('U_REDIRECT' => $_SERVER['REQUEST_URI']));
    319318    $template->set_prefilter('menubar', 'ec_duplicate_prefilter');
     319  }
    320320 
    321321  // Adds duplication link, if needed
     
    349349}
    350350
    351 function ec_duplicate_prefilter($content, &$smarty) {
    352   $search = "<legend>{'Quick connect'|@translate}</legend>";
    353   $addon = '<input type="hidden" name="redirect" value="{$U_REDIRECT}">';
    354   $replacement = "<legend>{'Quick connect'|@translate}</legend>".$addon;
    355   return str_replace($search, $replacement, $content);
    356 }
    357 
    358 // add_event_handler('get_admin_plugin_menu_links','ec_cat_modify');
    359 
    360351add_event_handler(
    361352 'get_admin_plugin_menu_links',
Note: See TracChangeset for help on using the changeset viewer.