Ignore:
Timestamp:
Apr 1, 2010, 9:03:36 PM (14 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

Location:
extensions/AMenuManager
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/admin/amm_linkslist.tpl

    r3681 r5545  
    3131    if(action_todo!='')
    3232    {
    33       http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
    34       http_request.send(null);
    35       doc.innerHTML=http_request.responseText;
     33      doc.innerHTML=$.ajax({
     34        type: "POST",
     35        url: "{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}"+action_todo,
     36        async: false,
     37      }).responseText;
    3638    }
    3739  }
  • extensions/AMenuManager/admin/amm_personalisedlist.tpl

    r3681 r5545  
    2626    if(action_todo!='')
    2727    {
    28       http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
    29       http_request.send(null);
    30       doc.innerHTML=http_request.responseText;
     28      doc.innerHTML=$.ajax({
     29        type: "POST",
     30        url: "{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}"+action_todo,
     31        async: false,
     32      }).responseText;
    3133    }
    3234  }
  • extensions/AMenuManager/admin/amm_randompicconfig.tpl

    r5429 r5545  
    77    width:350px;
    88    height:10px;
    9     border:1px solid;
     9    border-width:1px;
     10    border-style:solid;
    1011    margin-right:5px;
    1112    padding-right:14px;
     
    1617    position:relative;
    1718    top:-2px;
    18     border:1px solid;
     19    border-width:1px;
     20    border-style:solid;
    1921    display:block;
    2022  }
     
    5052        slide: function(event, ui) { formatDelay(ui.value); }
    5153      });
     54    $("#iamm_rp_pc_slider a").addClass('gcBgInput');
    5255
    5356    formatHeight({/literal}{$datas.height}{literal});
     
    6063        slide: function(event, ui) { formatHeight(ui.value); }
    6164      });
     65    $("#iamm_rp_height_slider a").addClass('gcBgInput');
    6266  }
    6367
     
    160164        <td>
    161165          <input type="hidden" name="famm_randompicture_height" id="iamm_randompicture_height" value="{$datas.height}">
    162           <div id="iamm_rp_height_slider"></div>
     166          <div id="iamm_rp_height_slider" class="gcBgInput gcBorderInput"></div>
    163167        </td>
    164168        <td width="90px">
     
    204208          <td>
    205209            <input type="hidden" name="famm_randompicture_periodicchange" id="iamm_randompicture_periodicchange" value="{$datas.periodic_change}">
    206             <div id="iamm_rp_pc_slider"></div>
     210            <div id="iamm_rp_pc_slider" class="gcBgInput gcBorderInput"></div>
    207211          </td>
    208212          <td width="70px">
  • extensions/AMenuManager/admin/plugin_admin.php

    r3681 r5545  
    2323$main_plugin_object = get_plugin_data($plugin_id);
    2424
    25 $plugin_ai = new AMM_AIP($prefixeTable, $main_plugin_object->get_filelocation());
     25$plugin_ai = new AMM_AIP($prefixeTable, $main_plugin_object->getFileLocation());
    2626$plugin_ai->manage();
    2727
  • extensions/AMenuManager/amm_aim.class.inc.php

    r3681 r5545  
    2020
    2121class AMM_AIM extends AMM_root
    22 { 
     22{
    2323  function AMM_AIM($prefixeTable, $filelocation)
    2424  {
     
    2929    initialize events call for the plugin
    3030  */
    31   function init_events()
     31  function initEvents()
    3232  {
    33     parent::init_events();
    34     add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
     33    parent::initEvents();
     34    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') );
    3535  }
    3636
  • extensions/AMenuManager/amm_aip.class.inc.php

    r5427 r5545  
    1919include_once(PHPWG_ROOT_PATH.'include/block.class.php');
    2020include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    21 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
    22 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php');
    23 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php');
     21include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
     22include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php');
     23include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTranslate.class.inc.php');
    2424
    2525class AMM_AIP extends AMM_root
     
    2727  protected $google_translate;
    2828  protected $tabsheet;
    29   protected $ajax;
    3029  protected $sectionsId=array('menu' => 'Menu', 'special' => 'Specials');
    3130
     
    3635    parent::__construct($prefixeTable, $filelocation);
    3736
    38     $this->load_config();
    39     $this->init_events();
     37    $this->loadConfig();
     38    $this->initEvents();
    4039
    4140    $this->tabsheet = new tabsheet();
    4241    $this->tabsheet->add('setmenu',
    4342                          l10n('g002_setmenu'),
    44                           $this->page_link.'&amp;fAMM_tabsheet=setmenu');
     43                          $this->getAdminLink().'&amp;fAMM_tabsheet=setmenu');
    4544    $this->tabsheet->add('links',
    4645                          l10n('g002_addlinks'),
    47                           $this->page_link.'&amp;fAMM_tabsheet=links');
     46                          $this->getAdminLink().'&amp;fAMM_tabsheet=links');
    4847    $this->tabsheet->add('randompict',
    4948                          l10n('g002_randompict'),
    50                           $this->page_link.'&amp;fAMM_tabsheet=randompict');
     49                          $this->getAdminLink().'&amp;fAMM_tabsheet=randompict');
    5150    $this->tabsheet->add('personnalblock',
    5251                          l10n('g002_personnalblock'),
    53                           $this->page_link.'&amp;fAMM_tabsheet=personnalblock');
    54     $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
    55     $this->ajax = new Ajax();
    56     $this->google_translate = new translate();
     52                          $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock');
     53    $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css");
     54    $this->google_translate = new GPCTranslate();
    5755  }
    5856
     
    8078    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
    8179
    82     $template_plugin["AMM_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('g002_version').AMM_VERSION;
     80    $template_plugin["AMM_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('g002_version').AMM_VERSION;
    8381    $template_plugin["AMM_PAGE"] = $_REQUEST['fAMM_tabsheet'];
    8482    $template_plugin["PATH"] = AMM_PATH;
     
    189187    initialize events call for the plugin
    190188  */
    191   public function init_events()
    192   {
    193     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
     189  public function initEvents()
     190  {
     191    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
    194192  }
    195193
     
    244242          break;
    245243      }
    246       //$template->
    247       $this->ajax->return_result($result);
     244
     245      GPCAjax::returnResult($result);
    248246    }
    249247  }
     
    282280    global $template, $user;
    283281    $template->set_filename('body_page',
    284                             dirname($this->filelocation).'/admin/amm_linkslist.tpl');
     282                            dirname($this->getFileLocation()).'/admin/amm_linkslist.tpl');
    285283
    286284    $tmp=$this->get_count_url();
     
    300298
    301299    $template_datas=array(
    302       'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=create',
    303       'lnk_config' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=config',
    304       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
     300      'lnk_create' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=create',
     301      'lnk_config' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=config',
     302      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=",
    305303      'nburl' => $tmp
    306304    );
     
    317315    global $template, $user;
    318316    $template->set_filename('body_page',
    319                             dirname($this->filelocation).'/admin/amm_linksconfig.tpl');
     317                            dirname($this->getFileLocation()).'/admin/amm_linksconfig.tpl');
    320318
    321319    $template_datas=array(
    322       'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links',
    323       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
    324       'show_icons_selected' => $this->my_config['amm_links_show_icons'],
     320      'lnk_list' => $this->getAdminLink().'&amp;fAMM_tabsheet=links',
     321      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=",
     322      'show_icons_selected' => $this->config['amm_links_show_icons'],
    325323      'lang_selected' => $user['language'],
    326324      'fromlang' => substr($user['language'],0,2)
     
    328326
    329327    $template_datas['language_list'] = array();
    330     foreach($this->my_config['amm_links_title'] as $key => $val)
     328    foreach($this->config['amm_links_title'] as $key => $val)
    331329    {
    332330      $template_datas['language_list'][] = array(
     
    362360    global $template, $user;
    363361    $template->set_filename('body_page',
    364                             dirname($this->filelocation).'/admin/amm_linkslist_edit.tpl');
     362                            dirname($this->getFileLocation()).'/admin/amm_linkslist_edit.tpl');
    365363
    366364    $extensions_list=array('jpg'=>0,'jpeg'=>0,'gif'=>0,'png'=>0);
    367365    $template_icons_list=array();
    368     $directory=dir(dirname($this->filelocation).'/links_pictures/');
     366    $directory=dir(dirname($this->getFileLocation()).'/links_pictures/');
    369367    while($file=$directory->read())
    370368    {
     
    403401    }
    404402
    405     $template_datas['lnk_list'] = $this->page_link.'&amp;fAMM_tabsheet=links';
     403    $template_datas['lnk_list'] = $this->getAdminLink().'&amp;fAMM_tabsheet=links';
    406404    $template_datas['icons_img'] = AMM_PATH."links_pictures/".$template_datas['icons_selected'];
    407405    $template_datas['icons_values'] = array();
     
    455453  protected function action_links_modify_config()
    456454  {
    457     $this->my_config['amm_links_show_icons']=$_POST['famm_links_show_icons'];
     455    $this->config['amm_links_show_icons']=$_POST['famm_links_show_icons'];
    458456    $languages=get_languages();
    459457    foreach($languages as $key => $val)
    460458    {
    461       $this->my_config['amm_links_title'][$key]=base64_encode($_POST['famm_links_title_'.$key]);
    462     }
    463     $this->save_config();
     459      $this->config['amm_links_title'][$key]=base64_encode($_POST['famm_links_title_'.$key]);
     460    }
     461    $this->saveConfig();
    464462  }
    465463
     
    469467  protected function action_randompic_modify_config()
    470468  {
    471     $this->my_config['amm_randompicture_height']=$_POST['famm_randompicture_height'];
    472     $this->my_config['amm_randompicture_periodicchange']=$_POST['famm_randompicture_periodicchange'];
    473     $this->my_config['amm_randompicture_showname']=$_POST['famm_randompicture_showname'];
    474     $this->my_config['amm_randompicture_showcomment']=$_POST['famm_randompicture_showcomment'];
     469    $this->config['amm_randompicture_height']=$_POST['famm_randompicture_height'];
     470    $this->config['amm_randompicture_periodicchange']=$_POST['famm_randompicture_periodicchange'];
     471    $this->config['amm_randompicture_showname']=$_POST['famm_randompicture_showname'];
     472    $this->config['amm_randompicture_showcomment']=$_POST['famm_randompicture_showcomment'];
    475473    $languages=get_languages();
    476474    foreach($languages as $key => $val)
    477475    {
    478       $this->my_config['amm_randompicture_title'][$key]=base64_encode(stripslashes($_POST['famm_randompicture_title_'.$key]));
    479     }
    480     $this->save_config();
     476      $this->config['amm_randompicture_title'][$key]=base64_encode(stripslashes($_POST['famm_randompicture_title_'.$key]));
     477    }
     478    $this->saveConfig();
    481479  }
    482480
     
    489487  {
    490488    global $template, $user, $page;
    491     $template->set_filename('body_page', dirname($this->filelocation).'/admin/amm_sections.tpl');
     489    $template->set_filename('body_page', dirname($this->getFileLocation()).'/admin/amm_sections.tpl');
    492490
    493491    if(isset($_POST['fList']) && !$this->adviser_abort())
     
    503501        $properties=explode("#", $items[$i]);
    504502        $properties[0]=explode(",", $properties[0]);
    505         $this->my_config['amm_sections_items'][$properties[0][0]]['container']=$properties[0][1];
    506         $this->my_config['amm_sections_items'][$properties[0][0]]['order']=$properties[0][2];
    507         $this->my_config['amm_sections_items'][$properties[0][0]]['visibility']=$properties[1];
     503        $this->config['amm_sections_items'][$properties[0][0]]['container']=$properties[0][1];
     504        $this->config['amm_sections_items'][$properties[0][0]]['order']=$properties[0][2];
     505        $this->config['amm_sections_items'][$properties[0][0]]['visibility']=$properties[1];
    508506      }
    509507      $this->sortSectionsItems();
    510       if($this->save_config())
     508      if($this->saveConfig())
    511509      {
    512510        array_push($page['infos'], l10n('g002_config_saved'));
     
    518516    }
    519517
    520     foreach($this->my_config['amm_sections_items'] as $key=>$val)
    521     {
    522       $this->my_config['amm_sections_items'][$key]['visibilityForm'] = $this->makeVisibility($val['visibility'], $key);
     518    foreach($this->config['amm_sections_items'] as $key=>$val)
     519    {
     520      $this->config['amm_sections_items'][$key]['visibilityForm'] = $this->makeVisibility($val['visibility'], $key);
    523521      $this->defaultMenus[$key]['visibilityForm'] = $this->makeVisibility("guest,generic,normal,webmaster,admin/", $key);
    524522    }
     
    526524    $this->sortSectionsItems();
    527525
    528     $users=new users("");
    529     $groups=new groups("");
     526    $users=new GPCUsers("");
     527    $groups=new GPCGroups("");
    530528
    531529
     
    533531    $template->assign("sections", $this->sectionsId);
    534532    $template->assign("defaultValues", $this->defaultMenus);
    535     $template->assign("items", $this->my_config['amm_sections_items']);
     533    $template->assign("items", $this->config['amm_sections_items']);
    536534    $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
    537535  }
     
    545543    global $template, $user;
    546544    $template->set_filename('body_page',
    547                             dirname($this->filelocation).'/admin/amm_randompicconfig.tpl');
     545                            dirname($this->getFileLocation()).'/admin/amm_randompicconfig.tpl');
    548546
    549547    $template_datas=array(
    550       'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links',
    551       'showname_selected' => $this->my_config['amm_randompicture_showname'],
    552       'showcomment_selected' => $this->my_config['amm_randompicture_showcomment'],
    553       'periodic_change' => $this->my_config['amm_randompicture_periodicchange'],
    554       'height' => $this->my_config['amm_randompicture_height'],
     548      'lnk_list' => $this->getAdminLink().'&amp;fAMM_tabsheet=links',
     549      'showname_selected' => $this->config['amm_randompicture_showname'],
     550      'showcomment_selected' => $this->config['amm_randompicture_showcomment'],
     551      'periodic_change' => $this->config['amm_randompicture_periodicchange'],
     552      'height' => $this->config['amm_randompicture_height'],
    555553      'lang_selected' => $user['language'],
    556554      'fromlang' => substr($user['language'],0,2)
     
    558556
    559557    $template_datas['language_list'] = array();
    560     foreach($this->my_config['amm_randompicture_title'] as $key => $val)
     558    foreach($this->config['amm_randompicture_title'] as $key => $val)
    561559    {
    562560      $template_datas['language_list'][] = array(
     
    603601    global $template, $user;
    604602    $template->set_filename('body_page',
    605                             dirname($this->filelocation).'/admin/amm_personalisedlist.tpl');
     603                            dirname($this->getFileLocation()).'/admin/amm_personalisedlist.tpl');
    606604
    607605    $sql="SELECT COUNT(DISTINCT ID) as countid FROM ".$this->tables['personalised'];
     
    632630
    633631    $template_datas=array(
    634       'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=create',
    635       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
     632      'lnk_create' => $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock&amp;action=create',
     633      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=",
    636634      'nbsections' => $tmp
    637635    );
     
    650648    global $template, $user;
    651649    $template->set_filename('body_page',
    652                             dirname($this->filelocation).'/admin/amm_personalisedlist_edit.tpl');
     650                            dirname($this->getFileLocation()).'/admin/amm_personalisedlist_edit.tpl');
    653651
    654652    $template_datas=array();
     
    697695    $template_datas['lang_selected'] = $user['language'];
    698696
    699     $template_datas['personalised_list'] = $this->page_link.'&amp;fAMM_tabsheet=personnalblock';
     697    $template_datas['personalised_list'] = $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock';
    700698    $template_datas['yesno_values'] = array('y','n');
    701699    $template_datas['yesno_labels'][] = l10n('g002_yesno_y');
     
    754752    $local_tpl = new Template(AMM_PATH."admin/", "");
    755753    $local_tpl->set_filename('body_page',
    756                   dirname($this->filelocation).'/admin/amm_sections_visibility.tpl');
     754                  dirname($this->getFileLocation()).'/admin/amm_sections_visibility.tpl');
    757755
    758756
    759757    $parameters=explode("/", $visibility);
    760758
    761     $users=new users(str_replace(",", "/", $parameters[0]));
    762     $users->set_allowed('admin', true);
    763     $groups=new groups(str_replace(",", "/", $parameters[1]));
     759    $users=new GPCUsers(str_replace(",", "/", $parameters[0]));
     760    $users->setAllowed('admin', true);
     761    $groups=new GPCGroups(str_replace(",", "/", $parameters[1]));
    764762
    765763    $local_tpl->assign('name', $id);
     
    780778    if(is_adviser())
    781779    {
    782       $this->display_result(l10n("g002_adviser_not_allowed"), false);
     780      $this->displayResult(l10n("g002_adviser_not_allowed"), false);
    783781      return(true);
    784782    }
     
    940938    $local_tpl = new Template(AMM_PATH."admin/", "");
    941939    $local_tpl->set_filename('body_page',
    942                   dirname($this->filelocation).'/admin/amm_linkslist_detail.tpl');
     940                  dirname($this->getFileLocation()).'/admin/amm_linkslist_detail.tpl');
    943941
    944942    $template_datas['urls']=array();
     
    953951        'up' =>  ($i==0)?false:true,
    954952        'down' =>  ($i<(count($urls)-1))?true:false,
    955         'edit' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=modify&amp;fItem='.$urls[$i]['id'],
     953        'edit' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=modify&amp;fItem='.$urls[$i]['id'],
    956954        'ID' => $urls[$i]['id'],
    957955        'IDPREV' => ($i==0)?0:$urls[$i-1]['id'],
     
    999997    $local_tpl = new Template(AMM_PATH."admin/", "");
    1000998    $local_tpl->set_filename('body_page',
    1001                   dirname($this->filelocation).'/admin/amm_personalisedlist_detail.tpl');
     999                  dirname($this->getFileLocation()).'/admin/amm_personalisedlist_detail.tpl');
    10021000
    10031001    $template_datas['sections']=array();
     
    10111009        $template_datas['sections'][]=array(
    10121010          'title' => ($val['title']!='')?$val['title']:l10n('g002_notitle'),
    1013           'edit' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=modify&amp;fItem='.$val['id'],
     1011          'edit' => $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock&amp;action=modify&amp;fItem='.$val['id'],
    10141012          'ID' => $val['id'],
    10151013          'visible' => l10n('g002_yesno_'.$val['visible']),
  • extensions/AMenuManager/amm_install.class.inc.php

    r5421 r5545  
    1616  include_once('amm_version.inc.php');
    1717  include_once('amm_root.class.inc.php');
    18   include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
     18  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
    1919
    2020
    2121  class AMM_install extends AMM_root
    2222  {
    23     private $tablef;
     23    private $tablesManager;
    2424    private $exportfile;
    2525
     
    2727    {
    2828      parent::__construct($prefixeTable, $filelocation);
    29       $this->tablef= new manage_tables($this->tables);
    30       $this->exportfile=dirname($this->filelocation).'/'.$this->plugin_name_files.'.sql';
     29      $this->tablesManager= new GPCTables($this->tables);
     30      $this->exportfile=dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().'.sql';
    3131    }
    3232
     
    3737    public function install()
    3838    {
    39       $this->init_config();
    40       $this->load_config();
    41       $this->my_config['installed']=AMM_VERSION2;
    42       $this->save_config();
     39      $this->initConfig();
     40      $this->loadConfig();
     41      $this->config['installed']=AMM_VERSION2;
     42      $this->saveConfig();
    4343
    4444      $tables_def=array(
     
    6767      //$table_def array
    6868      $tables_def = create_table_add_character_set($tables_def);
    69       $result=$this->tablef->create_tables($tables_def);
     69      $result=$this->tablesManager->create($tables_def);
    7070      return($result);
    7171    }
     
    7777    public function uninstall()
    7878    {
    79       $this->tablef->export($this->exportfile);
    80       $this->delete_config();
    81       $this->tablef->drop_tables();
     79      $this->tablesManager->export($this->exportfile);
     80      $this->deleteConfig();
     81      $this->tablesManager->drop();
    8282    }
    8383
     
    8686      global $template;
    8787
    88       $this->init_config();
    89       $this->load_config();
     88      $this->initConfig();
     89      $this->loadConfig();
    9090
    9191      $this->udpateTablesDef();
    9292
    93       $this->my_config['installed']=AMM_VERSION2; //update the installed release number
    94       $this->save_config();
     93      $this->config['installed']=AMM_VERSION2; //update the installed release number
     94      $this->saveConfig();
    9595    }
    9696
     
    113113       * This function aim to import the old conf into the new conf property
    114114      */
    115       if(isset($this->my_config['amm_sections_modspecials']))
     115      if(isset($this->config['amm_sections_modspecials']))
    116116      {
    117         foreach($this->my_config['amm_sections_modspecials'] as $key=>$val)
     117        foreach($this->config['amm_sections_modspecials'] as $key=>$val)
    118118        {
    119           $this->my_config['amm_sections_items'][$key]['visibility']=($val=="y")?"guest,generic,normal,admin/":"admin/";
     119          $this->config['amm_sections_items'][$key]['visibility']=($val=="y")?"guest,generic,normal,admin/":"admin/";
    120120        }
    121         unset($this->my_config['amm_sections_modspecials']);
     121        unset($this->config['amm_sections_modspecials']);
    122122      }
    123123
    124       if(isset($this->my_config['amm_sections_modmenu']))
     124      if(isset($this->config['amm_sections_modmenu']))
    125125      {
    126         foreach($this->my_config['amm_sections_modmenu'] as $key=>$val)
     126        foreach($this->config['amm_sections_modmenu'] as $key=>$val)
    127127        {
    128           $this->my_config['amm_sections_items'][$key]['visibility']=($val=="y")?"guest,generic,normal,admin/":"admin/";
     128          $this->config['amm_sections_items'][$key]['visibility']=($val=="y")?"guest,generic,normal,admin/":"admin/";
    129129        }
    130         unset($this->my_config['amm_sections_modmenu']);
     130        unset($this->config['amm_sections_modmenu']);
    131131      }
    132132
    133       if(!array_key_exists('installed', $this->my_config))
     133      if(!array_key_exists('installed', $this->config))
    134134      {
    135135        /*
     
    137137         * 2.2.0 release
    138138         */
    139         $this->my_config['installed']="02.01.06";
     139        $this->config['installed']="02.01.06";
    140140      }
    141141
    142       if($this->my_config['installed']<="02.01.06")
     142      if($this->config['installed']<="02.01.06")
    143143      {
    144144        /*
     
    153153        pwg_query($sql);
    154154
    155         foreach($this->my_config['amm_sections_items'] as $key => $val)
     155        foreach($this->config['amm_sections_items'] as $key => $val)
    156156        {
    157           $this->my_config['amm_sections_items'][$key]['translation'] = $this->defaultMenus[$key]['translation'];
     157          $this->config['amm_sections_items'][$key]['translation'] = $this->defaultMenus[$key]['translation'];
    158158        }
    159159      }
  • extensions/AMenuManager/amm_pip.class.inc.php

    r5427 r5545  
    1717
    1818include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php');
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
    2020
    2121class AMM_PIP extends AMM_root
    2222{
    23   protected $ajax;
    2423  protected $displayRandomImageBlock=true;
    2524
     
    2726  {
    2827    parent::__construct($prefixeTable, $filelocation);
    29     $this->ajax = new Ajax();
    30     $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files."2.css");
    31 
    32     $this->load_config();
    33     $this->init_events();
     28    $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."2.css");
     29
     30    $this->loadConfig();
     31    $this->initEvents();
    3432  }
    3533
     
    4341    initialize events call for the plugin
    4442  */
    45   public function init_events()
     43  public function initEvents()
    4644  {
    4745    //TODELETE: add_event_handler('loc_begin_menubar', array(&$this, 'modify_menu') );
    48     parent::init_events();
     46    parent::initEvents();
    4947    add_event_handler('loading_lang', array(&$this, 'load_lang'));
    5048    add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') );
    51     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
     49    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
    5250    add_event_handler('loc_end_page_tail', array(&$this, 'applyJS'));
    5351  }
     
    7876    if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) )
    7977    {
    80       $block->set_title(  base64_decode($this->my_config['amm_randompicture_title'][$user['language']]) );
     78      $block->set_title(  base64_decode($this->config['amm_randompicture_title'][$user['language']]) );
    8179      $block->data = array(
    82         "delay" => $this->my_config['amm_randompicture_periodicchange'],
    83         "blockHeight" => $this->my_config['amm_randompicture_height'],
     80        "delay" => $this->config['amm_randompicture_periodicchange'],
     81        "blockHeight" => $this->config['amm_randompicture_height'],
    8482        "firstPicture" => $this->ajax_amm_get_random_picture()
    8583      );
     
    9997      if ( count($urls)>0 )
    10098      {
    101         if($this->my_config['amm_links_show_icons']=='y')
     99        if($this->config['amm_links_show_icons']=='y')
    102100        {
    103101          for($i=0;$i<count($urls);$i++)
     
    107105        }
    108106
    109         $block->set_title( base64_decode($this->my_config['amm_links_title'][$user['language']]) );
     107        $block->set_title( base64_decode($this->config['amm_links_title'][$user['language']]) );
    110108        $block->template = dirname(__FILE__).'/menu_templates/menubar_links.tpl';
    111109
    112110        $block->data = array(
    113111          'LINKS' => $urls,
    114           'icons' => $this->my_config['amm_links_show_icons']
     112          'icons' => $this->config['amm_links_show_icons']
    115113        );
    116114      }
     
    178176    $blocks['special']->data=Array();
    179177
    180     $users=new users("");
    181     $groups=new groups("");
     178    $users=new GPCUsers("");
     179    $groups=new GPCGroups("");
    182180    $user_groups=$this->get_user_groups($user['id']);
    183181
    184     foreach($this->my_config['amm_sections_items'] as $key => $val)
     182    foreach($this->config['amm_sections_items'] as $key => $val)
    185183    {
    186184      if(isset($menuItems[$key]))
    187185      {
    188186        $access=explode("/",$val['visibility']);
    189         $users->set_alloweds(str_replace(",", "/", $access[0]));
    190         $groups->set_alloweds(str_replace(",", "/", $access[1]));
     187        $users->setAlloweds(str_replace(",", "/", $access[0]));
     188        $groups->setAlloweds(str_replace(",", "/", $access[1]));
    191189
    192190        /* test if user status is allowed to access the menu item
    193191         * if access is managed by group, the user have to be associated with an allowed group to access the menu item
    194192        */
    195         if($users->is_allowed($user['status']) && (
     193        if($users->isAllowed($user['status']) && (
    196194            ($access[1]=='') ||
    197             (($access[1]!='') && $groups->are_allowed($user_groups)))
     195            (($access[1]!='') && $groups->areAllowed($user_groups)))
    198196        )
    199197        {
     
    241239            break;
    242240        }
    243         $this->ajax->return_result($result);
     241        GPCAjax::returnResult($result);
    244242      }
    245243    }
     
    254252    $local_tpl = new Template(AMM_PATH."menu_templates/", "");
    255253    $local_tpl->set_filename('body_page',
    256                   dirname($this->filelocation).'/menu_templates/menubar_randompic_inner.tpl');
     254                  dirname($this->getFileLocation()).'/menu_templates/menubar_randompic_inner.tpl');
    257255
    258256      $sql="SELECT i.id as image_id, i.file as image_file, i.comment, i.path, i.tn_ext, c.id as catid, c.name, c.permalink, RAND() as rndvalue, i.name as imgname
     
    285283          'IMGNAME' => $nfo['imgname'],
    286284          'IMGCOMMENT' => $nfo['comment'],
    287           'SHOWNAME' => $this->my_config['amm_randompicture_showname'],
    288           'SHOWCOMMENT' => $this->my_config['amm_randompicture_showcomment']
     285          'SHOWNAME' => $this->config['amm_randompicture_showname'],
     286          'SHOWCOMMENT' => $this->config['amm_randompicture_showcomment']
    289287        );
    290288      }
     
    320318    {
    321319      $local_tpl = new Template(AMM_PATH."admin/", "");
    322       $local_tpl->set_filename('body_page', dirname($this->filelocation).'/menu_templates/menubar_randompic.js.tpl');
     320      $local_tpl->set_filename('body_page', dirname($this->getFileLocation()).'/menu_templates/menubar_randompic.js.tpl');
    323321
    324322      $data = array(
    325         "delay" => $this->my_config['amm_randompicture_periodicchange'],
    326         "blockHeight" => $this->my_config['amm_randompicture_height'],
     323        "delay" => $this->config['amm_randompicture_periodicchange'],
     324        "blockHeight" => $this->config['amm_randompicture_height'],
    327325        "firstPicture" => $this->ajax_amm_get_random_picture()
    328326      );
  • extensions/AMenuManager/amm_root.class.inc.php

    r5426 r5545  
    1717if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
    1818
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
    20 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/users_groups.class.inc.php');
    21 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
    22 
    23 
    24 class AMM_root extends common_plugin
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     20include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCUsersGroups.class.inc.php');
     21include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
     22
     23
     24class AMM_root extends CommonPlugin
    2525{
    2626  protected $css;   //the css object
     
    4141  );
    4242
    43   function AMM_root($prefixeTable, $filelocation)
    44   {
    45     $this->plugin_name="Advanced Menu Manager";
    46     $this->plugin_name_files="amm";
     43  public function __construct($prefixeTable, $filelocation)
     44  {
     45    $this->setPluginName("Advanced Menu Manager");
     46    $this->setPluginNameFiles("amm");
    4747    parent::__construct($prefixeTable, $filelocation);
    4848
    4949    $list=array('urls', 'personalised');
    50     $this->set_tables_list($list);
     50    $this->setTablesList($list);
     51  }
     52
     53  public function __destruct()
     54  {
     55    unset($this->css);
     56    unset($this->defaultMenus);
     57    parent::__destruct();
    5158  }
    5259
     
    5663
    5764  /* this function initialize var $my_config with default values */
    58   public function init_config()
    59   {
    60     $this->my_config=array(
     65  public function initConfig()
     66  {
     67    $this->config=array(
    6168      'amm_links_show_icons' => 'y',
    6269      'amm_links_title' => array(),
     
    7481      if($key=='fr_FR')
    7582      {
    76         $this->my_config['amm_links_title'][$key]=base64_encode('Liens');
    77         $this->my_config['amm_randompicture_title'][$key]=base64_encode('Une image au hasard');
     83        $this->config['amm_links_title'][$key]=base64_encode('Liens');
     84        $this->config['amm_randompicture_title'][$key]=base64_encode('Une image au hasard');
    7885      }
    7986      else
    8087      {
    81         $this->my_config['amm_links_title'][$key]=base64_encode('Links');
    82         $this->my_config['amm_randompicture_title'][$key]=base64_encode('A random picture');
    83       }
    84     }
    85   }
    86 
    87   public function load_config()
    88   {
    89     parent::load_config();
    90   }
    91 
    92   public function init_events()
     88        $this->config['amm_links_title'][$key]=base64_encode('Links');
     89        $this->config['amm_randompicture_title'][$key]=base64_encode('A random picture');
     90      }
     91    }
     92  }
     93
     94  public function loadConfig()
     95  {
     96    parent::loadConfig();
     97  }
     98
     99  public function initEvents()
    93100  {
    94101    add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') );
     
    204211  protected function sortSectionsItems()
    205212  {
    206     uasort($this->my_config['amm_sections_items'], array($this, "sortSectionsItemsCompare"));
     213    uasort($this->config['amm_sections_items'], array($this, "sortSectionsItemsCompare"));
    207214  }
    208215
  • extensions/AMenuManager/language/fr_FR/plugin.lang.php

    r4389 r5545  
    11<?php
    22
    3 $lang['Grum Plugin Classes is not installed'] = 'Le plugin <b>Grum Plugin Classes</b> n\'est pas installé';
     3$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';
    44
    55$lang['g002_title_page'] = 'Gestion avancée du menu';
  • extensions/AMenuManager/main.inc.php

    r5421 r5545  
    127127  include_once("amm_aim.class.inc.php");
    128128  $obj = new AMM_AIM($prefixeTable, __FILE__);
    129   $obj->init_events();
     129  $obj->initEvents();
    130130  set_plugin_data($plugin['id'], $obj);
    131131}
  • extensions/AMenuManager/maintain.inc.php

    r5427 r5545  
    88defined('AMM_DIR') || define('AMM_DIR' , basename(dirname(__FILE__)));
    99defined('AMM_PATH') || define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
    10 @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
     10
     11include_once('amm_version.inc.php'); // => Don't forget to update this file !!
     12include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php');
     13include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
    1114
    1215
    13 global $gpc_installed, $lang; //needed for plugin manager compatibility
     16global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
    1417
    1518/* -----------------------------------------------------------------------------
     
    1720----------------------------------------------------------------------------- */
    1821$gpc_installed=false;
    19 if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
     22$gpcNeeded="3.0.0";
     23if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    2024{
    21   @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
    22   // need GPC release greater or equal than 2.0.5
    23 
    24   if(checkGPCRelease(2,0,5))
     25  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     26  // need GPC release greater or equal than 3.0.0
     27  if(CommonPlugin::checkGPCRelease(3,0,0))
    2528  {
    2629    @include_once("amm_install.class.inc.php");
     
    3134function gpcMsgError(&$errors)
    3235{
    33   array_push($errors, sprintf(l10n('Grum Plugin Classes is not installed (release >= %s)'), "2.0.5"));
     36  global $gpcNeeded;
     37  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     38  if(is_array($errors))
     39  {
     40    array_push($errors, $msg);
     41  }
     42  else
     43  {
     44    $errors=Array($msg);
     45  }
    3446}
    3547// -----------------------------------------------------------------------------
     
    4153function plugin_install($plugin_id, $plugin_version, &$errors)
    4254{
    43   global $prefixeTable, $gpc_installed;
     55  global $prefixeTable, $gpc_installed, $gpcNeeded;
    4456  if($gpc_installed)
    4557  {
     
    4860    $amm=new AMM_install($prefixeTable, __FILE__);
    4961    $result=$amm->install();
     62    GPCCore::register($amm->getPluginName(), AMM_VERSION, $gpcNeeded);
    5063  }
    5164  else
     
    6982function plugin_uninstall($plugin_id)
    7083{
    71   global $prefixeTable;
     84  global $prefixeTable, $gpc_installed;
    7285  if($gpc_installed)
    7386  {
    7487    $amm=new AMM_install($prefixeTable, __FILE__);
    7588    $result=$amm->uninstall();
     89    GPCCore::unregister($amm->getPluginName());
    7690  }
    7791  else
  • extensions/AMenuManager/menu_templates/menubar_randompic.tpl

    r4363 r5545  
    1 {known_script id="jquery" src=$ROOT_URL|cat:"template-common/lib/jquery.packed.js"}
     1{known_script id="jquery" src=$ROOT_URL|cat:"themes/default/js/jquery.packed.js"}
    22
    33<!-- random picture menu bar -->
Note: See TracChangeset for help on using the changeset viewer.