Changeset 5548


Ignore:
Timestamp:
Apr 1, 2010, 9:05:29 PM (10 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

Location:
extensions/lmt
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • extensions/lmt/admin/plugin_admin.php

    r3396 r5548  
    2222$main_plugin_object = get_plugin_data($plugin_id);
    2323
    24 $plugin_aip = new LMT_AIP($prefixeTable, $main_plugin_object->get_filelocation());
     24$plugin_aip = new LMT_AIP($prefixeTable, $main_plugin_object->getFileLocation());
    2525$plugin_aip->manage();
    2626?>
  • extensions/lmt/admin/plugin_admin_list.tpl

    r4396 r5548  
    33  function loadpage(pagenum)
    44  {
    5     http_request=create_httpobject('get', '', '{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}'+pagenum+"&filter="+$("#filter").val(), false);
    6     http_request.send(null);
    7 
    8     tmp=http_request.responseText;
     5    tmp=$.ajax({
     6      type: "POST",
     7      url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}"+pagenum+"&filter="+$("#filter").val(),
     8      async: false,
     9     }).responseText;
    910
    1011    $("#nbphotos").attr("innerHTML", tmp.substr(0,tmp.indexOf("#")));
  • extensions/lmt/admin/plugin_admin_manage.tpl

    r3396 r5548  
    1010  function loadpage(pagenum)
    1111  {
    12     http_request=create_httpobject('get', '', '{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}'+pagenum, false);
    13     http_request.send(null);
     12    tmp=$.ajax({
     13      type: "POST",
     14      url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}"+pagenum,
     15      async: false,
     16     }).responseText;
    1417
    15     tmp=http_request.responseText;
    16    
    1718    $("#nbphotos").attr("innerHTML", tmp.substr(0,tmp.indexOf("#")));
    1819    $("#list").attr("innerHTML", tmp.substr(tmp.indexOf("#")+1));
     
    3233      $("#img"+id).attr("className", "is_on");
    3334      $(document).data("nbsel", $(document).data("nbsel")+1);
    34     }   
     35    }
    3536    $("#btsubmit").get(0).disabled=($(document).data("nbsel")==0);
    3637  }
     
    4344      case '-':
    4445        break;
    45       case 'all': 
     46      case 'all':
    4647        $(document).data("nbsel", {/literal}{$nbphotos}{literal});
    4748        $("input").filter(".none").each(
    48           function(i) 
    49           { 
    50             this.value="1"; 
     49          function(i)
     50          {
     51            this.value="1";
    5152            $("#img"+this.id).attr("className", "is_on");
    52           } 
    53         );       
     53          }
     54        );
    5455        break;
    5556      case 'none':
    5657        $(document).data("nbsel", 0);
    5758        $("input").filter(".none").each(
    58           function(i) 
    59           { 
    60             this.value="0"; 
     59          function(i)
     60          {
     61            this.value="0";
    6162            $("#img"+this.id).attr("className", "is_off");
    62           } 
    63         );       
     63          }
     64        );
    6465        break;
    6566      case 'invert':
    6667        $("input").filter(".none").each(
    67           function(i) 
    68           { 
     68          function(i)
     69          {
    6970            if(this.value=="1")
    7071            {
     
    7980              $(document).data("nbsel", $(document).data("nbsel")+1);
    8081            }
    81           } 
    82         );       
     82          }
     83        );
    8384        break;
    8485      default:
    8586        $(document).data("nbsel", 0);
    8687        $("input").filter(".none").each(
    87           function(i) 
    88           { 
     88          function(i)
     89          {
    8990            if(this.alt==act)
    9091            {
     
    9394              $(document).data("nbsel", $(document).data("nbsel")+1);
    9495            }
    95           } 
    96         );       
     96          }
     97        );
    9798        break;
    98     } 
     99    }
    99100    $("#selectlist").get(0).options[0].selected=true;
    100101    $("#btsubmit").get(0).disabled=($(document).data("nbsel")==0);
  • extensions/lmt/language/fr_FR/plugin.lang.php

    r4396 r5548  
    180180//1.1.0
    181181$lang["lmt_help_config"][10] = "Si activé, l'ouverture de la page vers laquelle pointe l'hyperlien sera effectuée dans une nouvelle fenêtre.";
    182 $lang["lmt_cfg_warning_target"] = "Forcer l'ouverture dans une nouvelle fenêtre"
     182$lang["lmt_cfg_warning_target"] = "Forcer l'ouverture dans une nouvelle fenêtre";
    183183
     184// 1.2.0
     185$lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'Pour installer ce plugin, vous devez au préalable, installer le plugin Grum Plugin Classes %s';
    184186
    185187
  • extensions/lmt/lmt_aim.class.inc.php

    r3396 r5548  
    1919
    2020class LMT_AIM extends LMT_root
    21 { 
    22   public function LMT_AIM($prefixeTable, $filelocation)
     21{
     22  public function __construct($prefixeTable, $filelocation)
    2323  {
    2424    parent::__construct($prefixeTable, $filelocation);
     
    2828    initialize events call for the plugin
    2929  */
    30   public function init_events()
     30  public function initEvents()
    3131  {
    32     parent::init_events();
    33     add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
     32    parent::initEvents();
     33    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') );
    3434  }
    3535
  • extensions/lmt/lmt_aip.class.inc.php

    r5431 r5548  
    1515
    1616include_once('lmt_root.class.inc.php');
    17 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php');
    18 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php');
    20 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/pages_navigation.class.inc.php');
     17include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTranslate.class.inc.php');
     18include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php');
     20include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPagesNavigation.class.inc.php');
    2121include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    2222
     
    2626  protected $tabsheet;
    2727
    28   public function LMT_AIP($prefixeTable, $filelocation)
     28  public function __construct($prefixeTable, $filelocation)
    2929  {
    3030    parent::__construct($prefixeTable, $filelocation);
    31     $this->load_config();
    32     $this->init_events();
     31    $this->loadConfig();
     32    $this->initEvents();
    3333
    3434    $this->tabsheet = new tabsheet();
    3535    $this->tabsheet->add('list',
    3636                          l10n('lmt_list'),
    37                           $this->page_link."&f_tabsheet=list");
     37                          $this->getAdminLink()."&f_tabsheet=list");
    3838    $this->tabsheet->add('manage',
    3939                          l10n('lmt_manage'),
    40                           $this->page_link."&f_tabsheet=manage");
     40                          $this->getAdminLink()."&f_tabsheet=manage");
    4141    $this->tabsheet->add('manageaut',
    4242                          l10n('lmt_manageaut'),
    43                           $this->page_link."&f_tabsheet=manageaut");
     43                          $this->getAdminLink()."&f_tabsheet=manageaut");
    4444    $this->tabsheet->add('config',
    4545                          l10n('lmt_config'),
    46                           $this->page_link."&f_tabsheet=config");
     46                          $this->getAdminLink()."&f_tabsheet=config");
    4747    $this->tabsheet->add('help',
    4848                          l10n('lmt_help'),
    49                           $this->page_link."&f_tabsheet=help");
    50 
    51     // don't create this object inside root classe otherwise header is modified
    52     // everywhere in admin pages
    53     $this->ajax = new Ajax();
     49                          $this->getAdminLink()."&f_tabsheet=help");
     50
    5451
    5552    // don't create the google_translate object everytime, otherwise google's js
     
    5956    /*if((isset($_POST['fmypolls_gomodify_translation'])||isset($_POST['fmypolls_goadd_translation'])))
    6057    {
    61       $this->google_translate = new translate();
     58      $this->google_translate = new GPCTranslate();
    6259    }
    6360    */
     61  }
     62
     63  public function __destruct()
     64  {
     65    unset($this->google_translate);
     66    unset($this->tabsheet);
     67    parent::__destruct();
    6468  }
    6569
     
    6771    initialize events call for the plugin
    6872  */
    69   public function init_events()
    70   {
    71     parent::init_events();
    72     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
    73     add_event_handler('loc_end_page_header', array(&$this->css_icn, 'apply_CSS'));
     73  public function initEvents()
     74  {
     75    parent::initEvents();
     76    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
     77    add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS'));
    7478  }
    7579
     
    117121    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
    118122
    119     $template_plugin["LMT_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('lmt_release').LMT_VERSION;
     123    $template_plugin["LMT_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('lmt_release').LMT_VERSION;
    120124    $template_plugin["LMT_PAGE"] = $_REQUEST['f_tabsheet'];
    121125    $template_plugin["LMT_TITLE"] = "";
     
    146150          break;
    147151      }
    148       //$template->
    149       $this->ajax->return_result($result);
     152      GPCAjax::returnResult($result);
    150153    }
    151154  }
     
    163166      if(isset($_POST['submit_save_config']))
    164167      {
    165         foreach($this->my_config as $key => $val)
     168        foreach($this->config as $key => $val)
    166169        {
    167170          if(is_array($val))
     
    171174              if(isset($_REQUEST[str2url('f_'.$key.'_'.$key2)]))
    172175              {
    173                 $this->my_config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES);
     176                $this->config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES);
    174177              }
    175178            }
     
    179182            if(isset($_REQUEST['f_'.$key]))
    180183            {
    181               $this->my_config[$key] = $_REQUEST['f_'.$key];
     184              $this->config[$key] = $_REQUEST['f_'.$key];
    182185            }
    183186          }
    184187
    185188        }
    186         $this->display_result(l10n('lmt_save_config'), $this->save_config());
     189        $this->displayResult(l10n('lmt_save_config'), $this->saveConfig());
    187190      }
    188191    }
     
    199202
    200203    $template->set_filename('body_page',
    201                 dirname($this->filelocation).'/admin/plugin_admin_help.tpl');
     204                dirname($this->getFileLocation()).'/admin/plugin_admin_help.tpl');
    202205
    203206    $template->assign('imgdir', LMT_PATH."img/");
     
    213216
    214217    $template->set_filename('body_page',
    215                 dirname($this->filelocation).'/admin/plugin_admin_list.tpl');
     218                dirname($this->getFileLocation()).'/admin/plugin_admin_list.tpl');
    216219
    217220    if(!isset($_REQUEST['filter']) ||
     
    230233
    231234    $datas=array(
    232       "LMT_AJAX_URL_LIST" =>  $this->page_link.'&ajaxfct=img_list&numpage='
     235      "LMT_AJAX_URL_LIST" =>  $this->getAdminLink().'&ajaxfct=img_list&numpage='
    233236    );
    234237
     
    247250    $filter_list_values = array_merge(array(''), $filter_list_values);
    248251    $filter_list_labels = array_merge(array(l10n('lmt_nofilter')), $filter_list_labels);
    249     $default_licence = l10n("lmt_lbl_cc-".strtolower($this->my_config['lmt_licence_default']));
    250     $default_licence_img =LMT_PATH."img/".strtolower($this->my_config['lmt_licence_default'])."_80x15.png";
     252    $default_licence = l10n("lmt_lbl_cc-".strtolower($this->config['lmt_licence_default']));
     253    $default_licence_img =LMT_PATH."img/".strtolower($this->config['lmt_licence_default'])."_80x15.png";
    251254
    252255    $results=true;
     
    272275      if((!$results)||(!$result))
    273276      {
    274         $this->display_result(l10n("lmt_caddie_not_updated"), false);
     277        $this->displayResult(l10n("lmt_caddie_not_updated"), false);
    275278      }
    276279      else
    277280      {
    278         $this->display_result(l10n("lmt_caddie_updated"), true);
     281        $this->displayResult(l10n("lmt_caddie_updated"), true);
    279282      }
    280283    }
     
    347350        if($results[0]!="")
    348351        {
    349           $this->display_result($results[0], true);
     352          $this->displayResult($results[0], true);
    350353        }
    351354
    352355        if($results[1]!="")
    353356        {
    354           $this->display_result($results[1], false);
     357          $this->displayResult($results[1], false);
    355358        }
    356359      }
    357360      else
    358361      {
    359         $this->display_result(l10n("lmt_no_element_selected"), false);
     362        $this->displayResult(l10n("lmt_no_element_selected"), false);
    360363      }
    361364    }
     
    363366
    364367    $template->set_filename('body_page',
    365                 dirname($this->filelocation).'/admin/plugin_admin_manage.tpl');
     368                dirname($this->getFileLocation()).'/admin/plugin_admin_manage.tpl');
    366369
    367370    $datas=array(
    368       "LMT_AJAX_URL_LIST" =>  $this->page_link.'&ajaxfct=manage_list&numpage='
     371      "LMT_AJAX_URL_LIST" =>  $this->getAdminLink().'&ajaxfct=manage_list&numpage='
    369372    );
    370373
     
    435438
    436439    $template->set_filename('body_page',
    437                 dirname($this->filelocation).'/admin/plugin_admin_config.tpl');
     440                dirname($this->getFileLocation()).'/admin/plugin_admin_config.tpl');
    438441
    439442
     
    441444      "img_directory" => LMT_PATH."img/"
    442445    );
    443     foreach($this->my_config as $key => $val)
     446    foreach($this->config as $key => $val)
    444447    {
    445448      if(!is_array($val))
     
    489492      $datas['lmt_warning_texts'][]=array(
    490493        'lang' => str2url($key),
    491         'text' => $this->my_config['lmt_warning_texts'][$key]
     494        'text' => $this->config['lmt_warning_texts'][$key]
    492495      );
    493496
     
    495498      {
    496499        $datas['lmt_redirect_urls'][str2url('lmt_redirect_url-'.strToLower($val2))]['langs'][str2url($key)]=
    497             $this->my_config['lmt_redirect_url-'.strToLower($val2)][$key];
     500            $this->config['lmt_redirect_url-'.strToLower($val2)][$key];
    498501      }
    499502    }
     
    565568        if($result)
    566569        {
    567           $this->display_result(l10n("lmt_author_added"), true);
     570          $this->displayResult(l10n("lmt_author_added"), true);
    568571          $_REQUEST['action']="list";
    569572        }
    570573        else
    571574        {
    572           $this->display_result(l10n("lmt_cannot_add_author"), false);
     575          $this->displayResult(l10n("lmt_cannot_add_author"), false);
    573576        }
    574577      }
    575578      else
    576579      {
    577         $this->display_result(l10n("lmt_no_text"), false);
     580        $this->displayResult(l10n("lmt_no_text"), false);
    578581      }
    579582    }
     
    593596        if($result)
    594597        {
    595           $this->display_result(l10n("lmt_author_modified"), true);
     598          $this->displayResult(l10n("lmt_author_modified"), true);
    596599          $_REQUEST['action']="list";
    597600        }
    598601        else
    599602        {
    600           $this->display_result(l10n("lmt_cannot_modify_author"), false);
     603          $this->displayResult(l10n("lmt_cannot_modify_author"), false);
    601604        }
    602605      }
    603606      else
    604607      {
    605         $this->display_result(l10n("lmt_no_text"), false);
     608        $this->displayResult(l10n("lmt_no_text"), false);
    606609      }
    607610    }
     
    618621        if(pwg_db_changes()==1)
    619622        {
    620           $this->display_result(l10n("lmt_author_deleted"), true);
     623          $this->displayResult(l10n("lmt_author_deleted"), true);
    621624
    622625          $sql="UPDATE ".$this->tables["images"]." SET author_id = NULL
     
    628631            if($nbimages>0)
    629632            {
    630               $this->display_result($nbimages."&nbsp;".l10n("lmt_author_nb_images_updated"), true);
     633              $this->displayResult($nbimages."&nbsp;".l10n("lmt_author_nb_images_updated"), true);
    631634            }
    632635          }
    633636          else
    634637          {
    635             $this->display_result(l10n("lmt_cannot_delete_author"), false);
     638            $this->displayResult(l10n("lmt_cannot_delete_author"), false);
    636639          }
    637640        }
    638641        else
    639642        {
    640           $this->display_result(l10n("lmt_cannot_delete_author"), false);
     643          $this->displayResult(l10n("lmt_cannot_delete_author"), false);
    641644        }
    642645      }
    643646      else
    644647      {
    645         $this->display_result(l10n("lmt_cannot_delete_author"), false);
     648        $this->displayResult(l10n("lmt_cannot_delete_author"), false);
    646649      }
    647650      $this->display_manageaut_page_list();
     
    667670
    668671    $template->set_filename('body_page',
    669                 dirname($this->filelocation).'/admin/plugin_admin_manageaut.tpl');
     672                dirname($this->getFileLocation()).'/admin/plugin_admin_manageaut.tpl');
    670673
    671674    $datas=array(
    672675      "author_list" => array(),
    673676      "img_directory" => LMT_PATH."img/",
    674       "default_licencepublished" => l10n("lmt_lbl_under-".strToLower($this->my_config['lmt_licence_default'])),
    675       "default_licenceL" => strToLower($this->my_config['lmt_licence_default']),
    676       "default_licenceU" => l10n("lmt_lbl_cc_s-".strToLower($this->my_config['lmt_licence_default'])),
    677       "lmt_licence_logo" => $this->my_config['lmt_licence_logo'],
     677      "default_licencepublished" => l10n("lmt_lbl_under-".strToLower($this->config['lmt_licence_default'])),
     678      "default_licenceL" => strToLower($this->config['lmt_licence_default']),
     679      "default_licenceU" => l10n("lmt_lbl_cc_s-".strToLower($this->config['lmt_licence_default'])),
     680      "lmt_licence_logo" => $this->config['lmt_licence_logo'],
    678681      "nbauthor" => 0,
    679       "add_link" => $this->page_link.'&amp;f_tabsheet=manageaut&amp;action=add'
     682      "add_link" => $this->getAdminLink().'&amp;f_tabsheet=manageaut&amp;action=add'
    680683    );
    681684
     
    690693          "text1" => $row['text1'],
    691694          "text2" => $row['text2'],
    692           "lnk_delete" => $this->page_link.'&amp;f_tabsheet=manageaut&amp;action=delete&amp;id='.$row['id'],
    693           "lnk_edit" => $this->page_link.'&amp;f_tabsheet=manageaut&amp;action=edit&amp;id='.$row['id']
     695          "lnk_delete" => $this->getAdminLink().'&amp;f_tabsheet=manageaut&amp;action=delete&amp;id='.$row['id'],
     696          "lnk_edit" => $this->getAdminLink().'&amp;f_tabsheet=manageaut&amp;action=edit&amp;id='.$row['id']
    694697        );
    695698      }
     
    707710
    708711    $template->set_filename('body_page',
    709                 dirname($this->filelocation).'/admin/plugin_admin_manageaut_edit.tpl');
     712                dirname($this->getFileLocation()).'/admin/plugin_admin_manageaut_edit.tpl');
    710713
    711714    if($_REQUEST["action"]=="edit")
     
    745748    }
    746749
    747     $datas["urllist"] = $this->page_link.'&f_tabsheet=manageaut';
     750    $datas["urllist"] = $this->getAdminLink().'&f_tabsheet=manageaut';
    748751
    749752    $template->assign('datas', $datas);
     
    761764    if(is_adviser())
    762765    {
    763       $this->display_result(l10n("lmt_adviser_not_allowed"), false);
     766      $this->displayResult(l10n("lmt_adviser_not_allowed"), false);
    764767      return(true);
    765768    }
     
    775778    $local_tpl = new Template(LMT_PATH."admin/", "");
    776779    $local_tpl->set_filename('body_page',
    777                   dirname($this->filelocation).'/admin/lmt_js.tpl');
     780                  dirname($this->getFileLocation()).'/admin/lmt_js.tpl');
    778781
    779782    $lmt_licence_default_values=array_slice($this->licences,0,count($this->licences)-1);
     
    833836    $local_tpl = new Template(LMT_PATH."admin/", "");
    834837    $local_tpl->set_filename('body_page',
    835                   dirname($this->filelocation).'/admin/plugin_admin_listitems.tpl');
     838                  dirname($this->getFileLocation()).'/admin/plugin_admin_listitems.tpl');
    836839
    837840    if(!isset($_REQUEST['filter']) ||
     
    870873    $sql.=" GROUP BY lmti.image_id ORDER BY cat.id, img.id ";
    871874
    872     if($this->my_config['lmt_list_maxitems']>0)
    873     {
    874       $refdbt = ($pagenum-1)*$this->my_config['lmt_list_maxitems'];
    875       $sql.=" LIMIT ".$refdbt.", ".$this->my_config['lmt_list_maxitems'];
     875    if($this->config['lmt_list_maxitems']>0)
     876    {
     877      $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems'];
     878      $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems'];
    876879    }
    877880
     
    921924    $nb=pwg_db_fetch_row($result);
    922925
    923     $pages_navigation = new pages_navigation();
    924     $pages_navigation->set_nb_items($nb[0]);
    925     $pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']);
    926     $pages_navigation->set_current_page($pagenum);
    927     $pages_navigation->set_options(array(
     926    $GPCPagesNavigation = new GPCPagesNavigation();
     927    $GPCPagesNavigation->setNbItems($nb[0]);
     928    $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']);
     929    $GPCPagesNavigation->setCurrentPage($pagenum);
     930    $GPCPagesNavigation->setOptions(array(
    928931      "text_prev" => l10n("lmt_nav_prev"),
    929932      "text_next" => l10n("lmt_nav_next"),
     
    931934      "text_last" => l10n("lmt_nav_last")
    932935    ));
    933     $navbar=$pages_navigation->make_navigation("loadpage");
     936    $navbar=$GPCPagesNavigation->makeNavigation("loadpage");
    934937    if($navbar!="")
    935938    {
     
    947950    $local_tpl = new Template(LMT_PATH."admin/", "");
    948951    $local_tpl->set_filename('body_page',
    949                   dirname($this->filelocation).'/admin/plugin_admin_manageitems.tpl');
     952                  dirname($this->getFileLocation()).'/admin/plugin_admin_manageitems.tpl');
    950953
    951954    if(!isset($_REQUEST['select']))
     
    972975          ORDER BY cat.id, img.id ";
    973976
    974     if($this->my_config['lmt_list_maxitems']>0)
    975     {
    976       $refdbt = ($pagenum-1)*$this->my_config['lmt_list_maxitems'];
    977       $sql.=" LIMIT ".$refdbt.", ".$this->my_config['lmt_list_maxitems'];
     977    if($this->config['lmt_list_maxitems']>0)
     978    {
     979      $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems'];
     980      $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems'];
    978981    }
    979982
     
    10231026    $nb=pwg_db_fetch_row($result);
    10241027
    1025     $pages_navigation = new pages_navigation();
    1026     $pages_navigation->set_nb_items($nb[0]);
    1027     $pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']);
    1028     $pages_navigation->set_current_page($pagenum);
    1029     $pages_navigation->set_options(array(
     1028    $GPCPagesNavigation = new GPCPagesNavigation();
     1029    $GPCPagesNavigation->setNbItems($nb[0]);
     1030    $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']);
     1031    $GPCPagesNavigation->setCurrentPage($pagenum);
     1032    $GPCPagesNavigation->setOptions(array(
    10301033      "text_prev" => l10n("lmt_nav_prev"),
    10311034      "text_next" => l10n("lmt_nav_next"),
     
    10331036      "text_last" => l10n("lmt_nav_last")
    10341037    ));
    1035     $navbar=$pages_navigation->make_navigation("loadpage");
     1038    $navbar=$GPCPagesNavigation->makeNavigation("loadpage");
    10361039    if($navbar!="")
    10371040    {
     
    10451048} //class
    10461049
     1050
    10471051?>
  • extensions/lmt/lmt_install.class.inc.php

    r3396 r5548  
    1313
    1414  --------------------------------------------------------------------------- */
     15
     16   include_once('lmt_version.inc.php'); // => Don't forget to update this file !!
    1517  @include_once('lmt_root.class.inc.php');
    16   @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
    17 
     18  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
    1819
    1920  /* lmt class for install process */
     
    2324    private $exportfile;
    2425
    25     public function LMT_Install($prefixeTable, $filelocation)
     26    public function __construct($prefixeTable, $filelocation)
    2627    {
    2728      parent::__construct($prefixeTable, $filelocation);
    28       $this->tablef= new manage_tables($this->tables);
    29       $this->exportfile=dirname($this->filelocation).'/'.$this->plugin_name_files.'.sql';
     29      $this->tablef= new GPCTables($this->tables);
     30      $this->exportfile=dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().'.sql';
    3031    }
    3132
    32     /*
    33         function for installation process
    34         return true if install process is ok, otherwise false
    35     */
     33    public function __destruct()
     34    {
     35      unset($this->tablef);
     36      unset($this->exportfile);
     37      parent::__destruct();
     38    }
     39
     40    /*
     41        function for installation process
     42        return true if install process is ok, otherwise false
     43    */
    3644    public function install()
    3745    {
     46      $this->initConfig();
     47      $this->loadConfig();
     48      $this->config['installed']=LMT_VERSION2;
     49      $this->saveConfig();
     50
    3851      $tables_def=array(
    3952"CREATE TABLE   `".$this->tables['images']."` (
     
    4457  KEY `by_licence` (`licence_type`),
    4558  KEY `by_author_id` (`author_id`)
    46 ) 
    47 ENGINE=MyISAM 
     59)
     60ENGINE=MyISAM
    4861CHARACTER SET utf8 COLLATE utf8_general_ci",
    4962
     
    5972
    6073      //if present, try to import backup
    61       //if backup file 
     74      //if backup file
    6275      $import=$this->tablef->import($this->exportfile);
    6376      if($import['errors']<0)
    6477      {
    65         $result=$this->tablef->create_tables($tables_def);
     78        $result=$this->tablef->create($tables_def);
    6679        return($result);
    6780      }
     
    7992    {
    8093      $this->tablef->export($this->exportfile);
    81       $this->delete_config();
    82       $this->tablef->drop_tables();
     94      $this->deleteConfig();
     95      $this->tablef->drop();
    8396      return('');
    8497    }
     
    88101      global $template;
    89102
    90       $this->init_config();
    91       $this->load_config();
    92       $this->save_config();
     103      $this->initConfig();
     104      $this->loadConfig();
     105      $this->config['installed']=LMT_VERSION2;
     106      $this->saveConfig();
    93107      return('');
    94108    }
  • extensions/lmt/lmt_pip.class.inc.php

    r4396 r5548  
    1515
    1616include_once('lmt_root.class.inc.php');
    17 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/public_integration.class.inc.php');
     17//include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php');
    1818
    1919class LMT_PIP extends LMT_root
     
    2121  protected $section_page;
    2222
    23   public function LMT_PIP($prefixeTable, $filelocation)
     23  public function __construct($prefixeTable, $filelocation)
    2424  {
    2525    parent::__construct($prefixeTable, $filelocation);
    26     $this->load_config();
     26    $this->loadConfig();
    2727
    28     // don't create this object inside root classe otherwise header is modified
    29     // everywhere in admin pages
    30     $this->ajax = new Ajax();
     28    $this->initEvents();
     29    $this->load_lang();
     30  }
    3131
    32     $this->init_events();
    33     $this->load_lang();
     32  public function __destruct()
     33  {
     34    unset($section_page);
     35    parent::__destruct();
    3436  }
    3537
     
    5153    initialize events call for the plugin
    5254  */
    53   public function init_events()
     55  public function initEvents()
    5456  {
    55     parent::init_events();
     57    parent::initEvents();
    5658/*
    5759    add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') );
    5860    add_event_handler('loading_lang', array(&$this, 'load_lang'));
    5961*/
    60     if($this->my_config['lmt_licence_activated']=='y')
     62    if($this->config['lmt_licence_activated']=='y')
    6163    {
    62       add_event_handler('loc_end_page_header', array(&$this->css_icn, 'apply_CSS'));
     64      add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS'));
    6365      add_event_handler('loc_end_picture', array(&$this, 'manage_licence_element'));
    6466
    65       if($this->my_config['lmt_warning_visible']=='y')
     67      if($this->config['lmt_warning_visible']=='y')
    6668      {
    6769        add_event_handler('loc_end_page_tail', array(&$this, 'manage_warning_text'));
     
    8587    }
    8688
    87     if($this->my_config['lmt_redirect_activated']=='y')
     89    if($this->config['lmt_redirect_activated']=='y')
    8890    {
    89       $url=$this->my_config['lmt_redirect_url-'.strToLower($licence['licence'])][$user['language']];
     91      $url=$this->config['lmt_redirect_url-'.strToLower($licence['licence'])][$user['language']];
    9092      if($url=='')
    9193      {
    92         $url=$this->my_config['lmt_redirect_url-'.strToLower($licence['licence'])]['en_UK'];
     94        $url=$this->config['lmt_redirect_url-'.strToLower($licence['licence'])]['en_UK'];
    9395      }
    9496    }
     
    100102    $style="";
    101103    $text="";
    102     $target=($this->my_config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
    103     switch($this->my_config['lmt_licence_logo'])
     104    $target=($this->config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
     105    switch($this->config['lmt_licence_logo'])
    104106    {
    105107      case '80x15':
     
    144146
    145147
    146     if(isset($this->my_config['lmt_warning_texts'][$user['language']]))
     148    if(isset($this->config['lmt_warning_texts'][$user['language']]))
    147149    {
    148       $text=$this->my_config['lmt_warning_texts'][$user['language']];
     150      $text=$this->config['lmt_warning_texts'][$user['language']];
    149151    }
    150152    else
    151153    {
    152       $text=$this->my_config['lmt_warning_texts']['en_UK'];
     154      $text=$this->config['lmt_warning_texts']['en_UK'];
    153155    }
    154156
    155157    $patterns = array('/\[logo=80x15\]/i', '/\[logo=88x31\]/i', '/\[logo=text\]/i');
    156158    $replacements = array(
    157       "<img class='logo80x15' src='". LMT_PATH."img/".strToLower($this->my_config['lmt_licence_default'])."_80x15.png'>",
    158       "<img class='logo88x31' src='". LMT_PATH."img/".strToLower($this->my_config['lmt_licence_default'])."_88x31.png'>",
    159       l10n("lmt_lbl_cc_s-".strToLower($this->my_config['lmt_licence_default']))
     159      "<img class='logo80x15' src='". LMT_PATH."img/".strToLower($this->config['lmt_licence_default'])."_80x15.png'>",
     160      "<img class='logo88x31' src='". LMT_PATH."img/".strToLower($this->config['lmt_licence_default'])."_88x31.png'>",
     161      l10n("lmt_lbl_cc_s-".strToLower($this->config['lmt_licence_default']))
    160162    );
    161163
    162     if($this->my_config['lmt_redirect_activated']=='y')
     164    if($this->config['lmt_redirect_activated']=='y')
    163165    {
    164       $url=$this->my_config['lmt_redirect_url-'.strToLower($this->my_config['lmt_licence_default'])][$user['language']];
     166      $url=$this->config['lmt_redirect_url-'.strToLower($this->config['lmt_licence_default'])][$user['language']];
    165167      if($url=='')
    166168      {
    167         $url=$this->my_config['lmt_redirect_url-'.strToLower($this->my_config['lmt_licence_default'])]['en_UK'];
     169        $url=$this->config['lmt_redirect_url-'.strToLower($this->config['lmt_licence_default'])]['en_UK'];
    168170      }
    169171      if($url!="")
    170172      {
    171         $target=($this->my_config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
     173        $target=($this->config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
    172174        $replacements[0]="<a href='".$url."'".$target.">".$replacements[0]."</a>";
    173175        $replacements[1]="<a href='".$url."'".$target.">".$replacements[1]."</a>";
  • extensions/lmt/lmt_root.class.inc.php

    r5431 r5548  
    1313
    1414  --------------------------------------------------------------------------- */
    15   include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
    16   include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
    17   include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
    18   global $ajax;
    19 
    20   class LMT_root extends common_plugin
     15  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     16  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
     17  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
     18
     19  class LMT_root extends CommonPlugin
    2120  {
    2221    protected $css;   //the css object
     
    2524    protected $licences=array('BY', 'BY-ND', 'BY-NC', 'BY-NC-ND', 'BY-NC-SA', 'BY-SA', 'CRIGHT', 'CLEFT', 'DEFAULT');
    2625
    27     public function LMT_root($prefixeTable, $filelocation)
    28     {
    29       $this->plugin_name='LMT';
    30       $this->plugin_name_files="lmt";
    31       parent::common_plugin($prefixeTable, $filelocation);
    32       $this->section_name=$this->plugin_name_files;
    33 
    34       $this->set_tables_list(array('images', 'licence_author', 'licence_doc'));
    35 
    36 
    37       $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
    38       $this->css_icn = new css(dirname($this->filelocation).'/'.$this->plugin_name_files."_icn.css");
    39     }
    40 
    41     public function init_events()
     26    public function __construct($prefixeTable, $filelocation)
     27    {
     28      $this->setPluginName('LMT');
     29      $this->setPluginNameFiles("lmt");
     30      parent::__construct($prefixeTable, $filelocation);
     31      $this->section_name=$this->getPluginNameFiles();
     32
     33      $this->setTablesList(array('images', 'licence_author'));
     34
     35
     36      $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css");
     37      $this->css_icn = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."_icn.css");
     38    }
     39
     40    public function __destruct()
     41    {
     42      unset($this->css);
     43      unset($this->css_icn);
     44      unset($this->licences);
     45      parent::__destruct();
     46    }
     47
     48    public function initEvents()
    4249    {
    4350      add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') );
     
    5461
    5562    /*
    56       surchage of common_plugin->save_config function
    57     */
    58     public function save_config()
    59     {
    60       if(parent::save_config())
    61       {
    62         $this->css->make_CSS($this->generate_CSS());
    63         $this->css_icn->make_CSS($this->generate_CSS2());
     63      surchage of CommonPlugin->saveConfig function
     64    */
     65    public function saveConfig()
     66    {
     67      if(parent::saveConfig())
     68      {
     69        $this->css->makeCSS($this->generate_CSS());
     70        $this->css_icn->makeCSS($this->generate_CSS2());
    6471        return(true);
    6572      }
     
    6875
    6976    /*
    70       surchage of common_plugin->save_config function
    71     */
    72     public function load_config()
    73     {
    74       parent::load_config();
    75       if(!$this->css->css_file_exists())
    76       {
    77         $this->css->make_CSS($this->generate_CSS());
    78       }
    79       if(!$this->css_icn->css_file_exists())
    80       {
    81         $this->css_icn->make_CSS($this->generate_CSS2());
     77      surchage of CommonPlugin->saveConfig function
     78    */
     79    public function loadConfig()
     80    {
     81      parent::loadConfig();
     82      if(!$this->css->fileExists())
     83      {
     84        $this->css->makeCSS($this->generate_CSS());
     85      }
     86      if(!$this->css_icn->fileExists())
     87      {
     88        $this->css_icn->makeCSS($this->generate_CSS2());
    8289      }
    8390    }
     
    8693      intialize default values
    8794    */
    88     public function init_config()
     95    public function initConfig()
    8996    {
    9097      //global $user;
    91       $this->my_config=array(
     98      $this->config=array(
    9299        'lmt_mouseovercolor' => '303030', /**/
    93100        'lmt_list_maxheight' => '650',
     
    117124        $lang=substr($key,0,2)."/";
    118125        if($lang=="en/") { $lang=""; }
    119         $this->my_config['lmt_warning_texts'][$key]='';
    120         $this->my_config['lmt_redirect_url-by'][$key]='http://creativecommons.org/licenses/by/2.0/'.$lang;
    121         $this->my_config['lmt_redirect_url-by-nd'][$key]='http://creativecommons.org/licenses/by-nd/2.0/'.$lang;
    122         $this->my_config['lmt_redirect_url-by-nc'][$key]='http://creativecommons.org/licenses/by-nc/2.0/'.$lang;
    123         $this->my_config['lmt_redirect_url-by-nc-nd'][$key]='http://creativecommons.org/licenses/by-nc-nd/2.0/'.$lang;
    124         $this->my_config['lmt_redirect_url-by-nc-sa'][$key]='http://creativecommons.org/licenses/by-nc-sa/2.0/'.$lang;
    125         $this->my_config['lmt_redirect_url-by-sa'][$key]='http://creativecommons.org/licenses/by-sa/2.0/'.$lang;
    126         $this->my_config['lmt_redirect_url-cright'][$key]='';
    127         $this->my_config['lmt_redirect_url-cleft'][$key]='';
     126        $this->config['lmt_warning_texts'][$key]='';
     127        $this->config['lmt_redirect_url-by'][$key]='http://creativecommons.org/licenses/by/2.0/'.$lang;
     128        $this->config['lmt_redirect_url-by-nd'][$key]='http://creativecommons.org/licenses/by-nd/2.0/'.$lang;
     129        $this->config['lmt_redirect_url-by-nc'][$key]='http://creativecommons.org/licenses/by-nc/2.0/'.$lang;
     130        $this->config['lmt_redirect_url-by-nc-nd'][$key]='http://creativecommons.org/licenses/by-nc-nd/2.0/'.$lang;
     131        $this->config['lmt_redirect_url-by-nc-sa'][$key]='http://creativecommons.org/licenses/by-nc-sa/2.0/'.$lang;
     132        $this->config['lmt_redirect_url-by-sa'][$key]='http://creativecommons.org/licenses/by-sa/2.0/'.$lang;
     133        $this->config['lmt_redirect_url-cright'][$key]='';
     134        $this->config['lmt_redirect_url-cleft'][$key]='';
    128135      }
    129136
     
    138145.TableRow:hover
    139146{
    140   background-color:#".$this->my_config['lmt_mouseovercolor'].";
     147  background-color:#".$this->config['lmt_mouseovercolor'].";
    141148}
    142149
     
    307314      }
    308315
    309       if(($return["licence"]=="")&&($this->my_config["lmt_licence_visible"]=="y"))
     316      if(($return["licence"]=="")&&($this->config["lmt_licence_visible"]=="y"))
    310317      {
    311318        $return=array(
    312319          "defaut" => "y",
    313           "licence" => $this->my_config["lmt_licence_default"],
     320          "licence" => $this->config["lmt_licence_default"],
    314321          "aut_text1" => "",
    315322          "aut_text2" => ""
     
    317324
    318325        $sql="SELECT * FROM ".$this->tables['licence_author']."
    319               WHERE id = '".$this->my_config["lmt_licence_default_author"]."'";
     326              WHERE id = '".$this->config["lmt_licence_default_author"]."'";
    320327        $result=pwg_query($sql);
    321328        if($result)
     
    354361    }
    355362
    356   protected function display_result($action_msg, $result)
     363  protected function displayResult($action_msg, $result)
    357364  {
    358365    global $page;
  • extensions/lmt/main.inc.php

    r5431 r5548  
    7676define('LMT_PATH' , PHPWG_PLUGINS_PATH . LMT_DIR . '/');
    7777
    78 define('LMT_VERSION' , '1.2.0'); // => ne pas oublier la version dans l'entête !!
     78include_once('lmt_version.inc.php'); // => Don't forget to update this file !!
    7979
    8080global $prefixeTable;
    81 
    8281
    8382if(defined('IN_ADMIN'))
     
    8685  include_once("lmt_aim.class.inc.php");
    8786  $obj=new LMT_AIM($prefixeTable, __FILE__);
    88   $obj->init_events();
     87  $obj->initEvents();
    8988}
    9089else
  • extensions/lmt/maintain.inc.php

    r5431 r5548  
    2020//ini_set('display_errors', true);
    2121
    22 global $gpc_installed, $lang; //needed for plugin manager compatibility
     22global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
    2323
    2424/* -----------------------------------------------------------------------------
     
    2626----------------------------------------------------------------------------- */
    2727$gpc_installed=false;
    28 if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
     28$gpcNeeded="3.0.0";
     29if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    2930{
    30   @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
    31   // need GPC release greater or equal than 2.0.5
    32   if(checkGPCRelease(2,0,5))
     31  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     32  // need GPC release greater or equal than 3.0.0
     33  if(CommonPlugin::checkGPCRelease(3,0,0))
    3334  {
    3435    @include_once('lmt_install.class.inc.php');
     
    3940function gpcMsgError(&$errors)
    4041{
    41   array_push($errors, sprintf(l10n('lmt_gpc2_not_installed'), "2.0.5"));
     42  global $gpcNeeded;
     43  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     44  if(is_array($errors))
     45  {
     46    array_push($errors, $msg);
     47  }
     48  else
     49  {
     50    $errors=Array($msg);
     51  }
    4252}
    4353// -----------------------------------------------------------------------------
     
    5161function plugin_install($plugin_id, $plugin_version, &$errors)
    5262{
    53   global $prefixeTable, $gpc_installed;
     63  global $prefixeTable, $gpc_installed, $gpcNeeded;
    5464
    5565  if($gpc_installed)
     
    6171      array_push($errors, "error");
    6272    }
     73    GPCCore::register($obj->getPluginName(), LMT_VERSION, $gpcNeeded);
    6374  }
    6475  else
     
    109120    $obj = new LMT_Install($prefixeTable, __FILE__);
    110121    $obj->uninstall();
     122    GPCCore::unregister($obj->getPluginName());
    111123  }
    112124  else
Note: See TracChangeset for help on using the changeset viewer.