Changeset 7175


Ignore:
Timestamp:
Oct 13, 2010, 5:22:04 PM (14 years ago)
Author:
grum
Message:

Packing js files + add categorySelector functionnalities

Location:
extensions/GrumPluginClasses
Files:
22 added
11 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/GPCCore.class.inc.php

    r6948 r7175  
    33/* -----------------------------------------------------------------------------
    44  class name     : GPCCore
    5   class version  : 1.2.0
    6   plugin version : 3.2.0
     5  class version  : 1.3.0
     6  plugin version : 3.3.0
    77  date           : 2010-07-28
    88  ------------------------------------------------------------------------------
     
    2020| 1.2.0   | 2010/07/28 | * add the loadConfigFromFile function
    2121|         |            |
    22 |         |            |
     22| 1.3.0   | 2010/10/13 | * add the addHeaderCSS, addHeaderJS functions
    2323|         |            |
    2424|         |            |
     
    3535    - static function unregister
    3636    - static function BBtoHTML
     37    - static function addHeaderCSS
     38    - static function addHeaderJS
    3739   ---------------------------------------------------------------------- */
    3840
     
    4244{
    4345  static public $pluginName = "GPCCore";
     46  static protected $headerItems = array(
     47    'css' => array(),
     48    'js'  => array()
     49  );
    4450
    4551  /* ---------------------------------------------------------------------------
     
    305311  }
    306312
     313  /**
     314   * used to add a css file in the header
     315   *
     316   * @param String $id : a unique id for the file
     317   * @param String $file : the css file
     318   */
     319  static public function addHeaderCSS($id, $file)
     320  {
     321    if(!array_key_exists($file, self::$headerItems['css']))
     322    {
     323      self::$headerItems['css'][$id]=$file;
     324    }
     325  }
     326  static public function addHeaderJS($id, $file)
     327  {
     328    global $template;
     329
     330    if(!array_key_exists($id,  $template->known_scripts) and !array_key_exists($file, self::$headerItems['js']))
     331    {
     332     $template->known_scripts[$id]=$url;
     333     self::$headerItems['js'][$id]=$file;
     334    }
     335  }
     336
     337  /**
     338   * declared as public to be accessible by the event manager, but this funcion
     339   * is not aimed to be used directly
     340   */
     341  static public function applyHeaderItems()
     342  {
     343    global $template;
     344
     345    foreach(self::$headerItems['css'] as $file)
     346    {
     347      $template->block_html_head(null, '<link rel="stylesheet" type="text/css" href="'.$file.'"/>', $template->smarty, $false);
     348    }
     349
     350    foreach(self::$headerItems['js'] as $file)
     351    {
     352      $template->block_html_head(null, '<script type="text/javascript" src="'.$file.'"></script>', $template->smarty, $false);
     353    }
     354  }
     355
    307356} //class
    308357
     358add_event_handler('loc_end_page_header', array('GPCCore', 'applyHeaderItems'));
     359
     360
    309361?>
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r6975 r7175  
    466466    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'external/interface/interface.js"></script>');
    467467    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'external/inestedsortable.pack.js"></script>');
    468     $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'criteriaBuilder.js"></script>');
     468    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'criteriaBuilder.packed.js"></script>');
    469469    $template->append('head_elements',
    470470"<script type=\"text/javascript\">
  • extensions/GrumPluginClasses/css/gpc.css

    r7146 r7175  
    9090}
    9191
    92 
    93 .ui-icon-selector {
    94   background:none no-repeat scroll 2px 2px;
    95   padding:2px;
    96 }
    97 .ui-icon-selector-icon {
    98   background: none no-repeat scroll 2px 2px;
    99   padding:2px;
    100   float:left;
    101 }
    102 
    103 
    104 div.roma div.ui-icon-selector {
    105   background-color:#444444;
    106   border:1px solid #666666;
    107 }
    108 div.roma div.ui-icon-selector-list {
    109   background-color:#444444;
    110   border:1px solid #666666;
    111   margin-top:-1px;
    112 }
    113 div.roma div.ui-icon-selector-list li.ui-icon-selector-icon:hover {
    114   background-color:#666666;
    115 }
    116 div.roma div.ui-icon-selector-list li.ui-icon-selector-selected-icon {
    117   background-color:#777777;
    118 }
    119 
    120 
    121 div.clear div.ui-icon-selector {
    122   background-color:#CCCCCC;
    123    border:1px solid #777777;
    124 }
    125 div.clear div.ui-icon-selector-list {
    126   background-color:#CCCCCC;
    127   border:1px solid #777777;
    128   margin-top:-1px;
    129 }
    130 div.clear div.ui-icon-selector-list li.ui-icon-selector-icon:hover {
    131   background-color:#777777;
    132 }
    133 div.clear div.ui-icon-selector-list li.ui-icon-selector-selected-icon {
    134   background-color:#888888;
    135 }
  • extensions/GrumPluginClasses/gpc_ajax.php

    r6894 r7175  
    1616 *
    1717 * manage all the ajax requests
     18 *
     19 * known functions :
     20 *  - admin.rbuilder.fillCaddie
     21 *  - admin.categorySelector.getList
     22 *
    1823 * -----------------------------------------------------------------------------
    1924 */
     
    6873      // check if asked function is valid
    6974      if(!(
    70            $_REQUEST['ajaxfct']=='admin.rbuilder.fillCaddie'
     75           $_REQUEST['ajaxfct']=='admin.rbuilder.fillCaddie' or
     76           $_REQUEST['ajaxfct']=='admin.categorySelector.getList' or
     77           $_REQUEST['ajaxfct']=='public.categorySelector.getList'
    7178          )
    7279        ) $_REQUEST['ajaxfct']='';
     
    7784      {
    7885        /*
    79          * check admin.makeStats.getList values
     86         * check admin.rbuilder.fillCaddie values
    8087         */
    8188        if($_REQUEST['ajaxfct']=="admin.rbuilder.fillCaddie")
     
    8895          if(!isset($_REQUEST['requestNumber'])) $_REQUEST['ajaxfct']="";
    8996        }
     97
     98        /*
     99         * check admin.categorySelector.getList values
     100         */
     101        if($_REQUEST['ajaxfct']=="admin.categorySelector.getList" or
     102           $_REQUEST['ajaxfct']=="public.categorySelector.getList")
     103        {
     104          if(!isset($_REQUEST['filter'])) $_REQUEST['filter']="accessible";
     105
     106          if(!($_REQUEST['filter']=="public" or
     107               $_REQUEST['filter']=="accessible" or
     108               $_REQUEST['filter']=="all")
     109            ) $_REQUEST['filter']="accessible";
     110
     111          if(!isset($_REQUEST['galleryRoot'])) $_REQUEST['galleryRoot']="y";
     112
     113          if(!($_REQUEST['galleryRoot']=="y" or
     114               $_REQUEST['galleryRoot']=="n")
     115            ) $_REQUEST['galleryRoot']="y";
     116
     117          if(!isset($_REQUEST['tree'])) $_REQUEST['tree']="n";
     118
     119          if(!($_REQUEST['tree']=="y" or
     120               $_REQUEST['tree']=="n")
     121            ) $_REQUEST['tree']="n";
     122        }
     123
     124
    90125      }
    91     }
     126    } //checkRequest()
    92127
    93128
     
    102137        case 'admin.rbuilder.fillCaddie':
    103138          $result=$this->ajax_gpc_admin_rbuilderFillCaddie($_REQUEST['fillMode'], $_REQUEST['requestNumber']);
     139          break;
     140        case 'admin.categorySelector.getList':
     141          $result=$this->ajax_gpc_admin_CategorySelectorGetList($_REQUEST['filter'], $_REQUEST['galleryRoot'], $_REQUEST['tree']);
     142          break;
     143        case 'public.categorySelector.getList':
     144          $result=$this->ajax_gpc_public_CategorySelectorGetList($_REQUEST['filter'], $_REQUEST['galleryRoot'], $_REQUEST['tree']);
    104145          break;
    105146      }
     
    141182    }
    142183
     184
     185
     186    /**
     187     * return the list of all categories
     188     *
     189     * @param String $filter : 'public' or 'accessible' or 'all'
     190     * @param String $galleryRoot : 'y' if the gallery root is in the list
     191     * @param String $tree : 'y' to obtain a recursive array, 'n' to obtain a flat array
     192     * @return String : json string
     193     */
     194    private function ajax_gpc_admin_CategorySelectorGetList($filter, $galleryRoot, $tree)
     195    {
     196      global $user;
     197
     198      include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCategorySelector.class.inc.php');
     199
     200      $categorySelector=new GPCCategorySelector(
     201        array(
     202          'filter' => $filter,
     203          'galleryRoot' => ($galleryRoot=='y')?true:false,
     204          'tree' => ($tree=='y')?true:false,
     205          'userMode' => 'admin'
     206        )
     207      );
     208
     209      $returned=array(
     210        'userId' => $user['id'],
     211        'nbCategories' => 0,
     212        'categories' => $categorySelector->getCategoryList(),
     213        'status' => array(
     214          0=>l10n('Private'),
     215          1=>l10n('Public')
     216        )
     217      );
     218      $returned['nbCategories']=count($returned['categories']);
     219
     220      return(json_encode($returned));
     221    } //ajax_gpc_admin_CategorySelectorGetList
     222
     223
     224    /**
     225     * return the list of all categories
     226     *
     227     * @param String $filter : 'public' or 'accessible' or 'all'
     228     * @param String $galleryRoot : 'y' if the gallery root is in the list
     229     * @param String $tree : 'y' to obtain a recursive array, 'n' to obtain a flat array
     230     * @param String $userMode : 'public' or 'admin'
     231     * @return String : json string
     232     */
     233    private function ajax_gpc_public_CategorySelectorGetList($filter, $galleryRoot, $tree)
     234    {
     235      global $user;
     236
     237      include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCategorySelector.class.inc.php');
     238
     239      $categorySelector=new GPCCategorySelector(
     240        array(
     241          'filter' => $filter,
     242          'galleryRoot' => ($galleryRoot=='y')?true:false,
     243          'tree' => ($tree=='y')?true:false,
     244          'userMode' => 'public'
     245        )
     246      );
     247
     248      $returned=array(
     249        'userId' => $user['id'],
     250        'nbCategories' => 0,
     251        'categories' => $categorySelector->getCategoryList(),
     252        'status' => array(
     253          0=>l10n('Private'),
     254          1=>l10n('Public')
     255        )
     256      );
     257      $returned['nbCategories']=count($returned['categories']);
     258
     259      return(json_encode($returned));
     260    } //ajax_gpc_public_CategorySelectorGetList
     261
     262
     263
    143264  } //class
    144265
  • extensions/GrumPluginClasses/js/criteriaBuilder.js

    r7142 r7175  
    6969{
    7070  var itemsId = {
    71     group:'iCbGroup',
    72     item:'iCbItem',
    73     container:container,
    74   }
    75 
    76   var counters = {
    77     group:0,
    78     item:0,
    79   }
    80 
    81   var options = {
    82       textAND:'AND',
    83       textOR:'OR',
    84       textHint:'',
    85       classGroup:'',
    86       classItem:'',
    87       classOperator:'',
    88       classHelper:'helper',
    89       opacity:0.8,
    90       onEdit:null,
    91       onDelete:null,
    92       onRequestSuccess:null,
    93       onRequestError:null,
    94       onGetPageSuccess:null,
    95       onGetPageError:null,
    96       imgEditUrl:'',
    97       imgDeleteUrl:'',
    98       ajaxUrl:'',
    99     };
    100 
    101   var extraData = new Array();
     71          group:'iCbGroup',
     72          item:'iCbItem',
     73          container:container,
     74        },
     75      counters = {
     76          group:0,
     77          item:0,
     78        },
     79      options = {
     80          textAND:'AND',
     81          textOR:'OR',
     82          textHint:'',
     83          classGroup:'',
     84          classItem:'',
     85          classOperator:'',
     86          classHelper:'helper',
     87          opacity:0.8,
     88          onEdit:null,
     89          onDelete:null,
     90          onRequestSuccess:null,
     91          onRequestError:null,
     92          onGetPageSuccess:null,
     93          onGetPageError:null,
     94          imgEditUrl:'',
     95          imgDeleteUrl:'',
     96          ajaxUrl:'',
     97        },
     98      extraData = new Array();
    10299
    103100  if(arguments.length==2)
     
    213210        break;
    214211    }
    215   }
     212  };
    216213
    217214  /**
     
    243240
    244241    applyNested();
    245   }
     242  };
    246243
    247244  /**
     
    253250  {
    254251    $('#'+groupId).remove();
    255   }
     252  };
    256253
    257254  /**
     
    292289
    293290    extraData[counters.item]=data;
    294   }
     291  };
    295292
    296293  /**
     
    309306      manage();
    310307    }
    311   }
     308  };
    312309
    313310  /**
     
    327324      extraData[eval(re.exec(itemId)[0])]=data;
    328325    }
    329   }
     326  };
    330327
    331328  /**
     
    339336    counters.group=0;
    340337    extraData=new Array();
    341   }
     338  };
    342339
    343340  /**
     
    370367    }
    371368    return(returned);
    372   }
     369  };
    373370
    374371
     
    410407
    411408    return(serialized);
    412   }
     409  };
    413410
    414411
     
    423420
    424421    return(extraData[extraDataNumber]);
    425   }
     422  };
    426423
    427424
     
    433430  {
    434431    options = jQuery.extend(options, optionsToSet);
    435   }
     432  };
    436433
    437434  /**
     
    465462      }
    466463    }
    467   }
     464  };
    468465
    469466  /**
     
    505502      }
    506503    );
    507   }
     504  };
    508505
    509506  /**
     
    531528      }
    532529    );
    533   }
     530  };
    534531
    535532  /**
     
    554551      $('#'+groupId+'OpOR').css('display', 'none');
    555552    }
    556   }
     553  };
    557554
    558555  /**
     
    580577     );
    581578
    582   }
     579  };
    583580
    584581  /**
     
    606603     );
    607604
    608   }
     605  };
    609606
    610607  applyNested();
  • extensions/GrumPluginClasses/js/pagesNavigator.js

    r7142 r7175  
    5656{
    5757  var itemsId = {
    58     first:'iNavFirst',
    59     last:'iNavLast',
    60     previous:'iNavPrevious',
    61     next:'iNavNext',
    62     pageNumber:'iNavPage',
    63     morePrevious:'iNavPrevMore',
    64     moreNext:'iNavNextMore',
    65     container:container,
    66   };
    67 
    68   var pages = {
    69     num:0,
    70     current:1,
    71   }
    72 
    73   var options = {
    74     numberItem:0,
    75     itemPerPage:25,
    76     defaultPage:0,
    77     displayNumPage:7,
    78     displayFirst:true,
    79     displayLast:true,
    80     displayPrevious:true,
    81     displayNext:true,
    82     hideMode:'1,<', // "1": hide nav if only 1 page to display, "<": hide nav First, Previous, Next & Last if num of page < displayNumPage
    83     textFirst:'&lt;&lt;',
    84     textLast:'&gt;&gt;',
    85     textPrevious:'&lt;',
    86     textNext:'&gt;',
    87     textMore:'...',
    88     onPageChange:null,
    89     classActive:'',
    90     classInactive:'',
    91     classDisabled:'',
    92   };
     58          first:'iNavFirst',
     59          last:'iNavLast',
     60          previous:'iNavPrevious',
     61          next:'iNavNext',
     62          pageNumber:'iNavPage',
     63          morePrevious:'iNavPrevMore',
     64          moreNext:'iNavNextMore',
     65          container:container,
     66        },
     67      pages = {
     68          num:0,
     69          current:1,
     70        },
     71      options = {
     72        numberItem:0,
     73        itemPerPage:25,
     74        defaultPage:0,
     75        displayNumPage:7,
     76        displayFirst:true,
     77        displayLast:true,
     78        displayPrevious:true,
     79        displayNext:true,
     80        hideMode:'1,<', // "1": hide nav if only 1 page to display, "<": hide nav First, Previous, Next & Last if num of page < displayNumPage
     81        textFirst:'&lt;&lt;',
     82        textLast:'&gt;&gt;',
     83        textPrevious:'&lt;',
     84        textNext:'&gt;',
     85        textMore:'...',
     86        onPageChange:null,
     87        classActive:'',
     88        classInactive:'',
     89        classDisabled:'',
     90      };
    9391
    9492
     
    110108        break;
    111109    }
    112   }
     110  };
    113111
    114112  /**
     
    122120  {
    123121    return(Math.ceil(numItems/numPerPage));
    124   }
     122  };
    125123
    126124  /**
     
    143141      build();
    144142    }
    145   }
     143  };
    146144
    147145  /**
     
    195193
    196194    $('#'+itemsId.container).css('visibility', 'visible');
    197   }
     195  };
    198196
    199197
     
    206204      prev=pages.current-1;
    207205    }
    208     next=options.displayNumPage-1-prev
     206    next=options.displayNumPage-1-prev;
     207
    209208    if(pages.current+next>=pages.num)
    210209    {
     
    283282    );
    284283
    285   }
     284  };
    286285
    287286
     
    325324    displayNav();
    326325    if(options.onPageChange!=null && jQuery.isFunction(options.onPageChange)) options.onPageChange(pages.current);
    327   }
     326  };
    328327
    329328  if(arguments.length==2)
  • extensions/GrumPluginClasses/js/simpleTip.js

    r6732 r7175  
    8181function simpleTip()
    8282{
    83   var items = new Array();
    84   var itemIndexInc = 0;
    85   var options={
    86     name:'',
    87   }
     83  var items = new Array(),
     84      itemIndexInc = 0,
     85      options={
     86          name:'',
     87        };
    8888
    8989  if(arguments.length>=1)
     
    134134        break;
    135135    }
    136   }
     136  };
    137137
    138138  var add = function (item, options)
     
    169169    }
    170170
    171   }
     171  };
    172172
    173173
     
    191191      items.splice(index,1);
    192192    }
    193   }
     193  };
    194194
    195195
     
    216216    }
    217217    itemIndexInc=0;
    218   }
     218  };
    219219
    220220
     
    228228    }
    229229    return(-1);
    230   }
     230  };
    231231
    232232  /**
     
    255255          display: 'block',
    256256        }
    257       )
     257      );
    258258
    259259    switch(items[itemIndex].options.targetPos)
     
    415415      .addClass(items[itemIndex].options.classes);
    416416
    417   }
     417  };
    418418
    419419  var show = function ()
    420420  {
    421421    $('#iSimpleTip'+options.name).css('display', 'block');
    422   }
     422  };
    423423
    424424  var hide = function ()
    425425  {
    426426    $('#iSimpleTip'+options.name).css('display', 'none');
    427   }
     427  };
    428428
    429429
     
    435435      $('body').append(text);
    436436    }
    437   }
     437  };
    438438
    439439
  • extensions/GrumPluginClasses/js/ui.iconSelector.js

    r7146 r7175  
    128128              if(opt) $.extend(options, opt);
    129129
    130               if(!data)
    131               {
    132                 $this.data('options', options);
    133                 options.initialized=false;
    134               }
     130              $this.data('options', options);
    135131
    136132              if(!properties)
     
    239235          {
    240236            // set images list values
    241             this.each(function()
    242               {
    243                 var $this=$(this);
    244                 privateMethods.setImages($this, list);
    245                 return($this);
     237            return this.each(function()
     238              {
     239                privateMethods.setImages($(this), list);
    246240              }
    247241            );
     
    250244          {
    251245            // return images list values
    252             var data = this.data('options');
    253 
    254             if(data)
    255             {
    256               return(data.images);
     246            var options = this.data('options');
     247
     248            if(options)
     249            {
     250              return(options.images);
    257251            }
    258252            else
     
    267261          {
    268262            // set numCols values
    269             this.each(function()
    270               {
    271                 var $this=$(this);
    272                 privateMethods.setCols($this, value);
    273                 return($this);
     263            return this.each(function()
     264              {
     265                privateMethods.setCols($(this), value);
    274266              }
    275267            );
     
    278270          {
    279271            // return images list values
    280             var data = this.data('options');
    281 
    282             if(data)
    283             {
    284               return(data.numCols);
     272            var options = this.data('options');
     273
     274            if(options)
     275            {
     276              return(options.numCols);
    285277            }
    286278            else
     
    295287          {
    296288            // set numRows values
    297             this.each(function()
    298               {
    299                 var $this=$(this);
    300                 privateMethods.setRows($this, value);
    301                 return($this);
     289            return this.each(function()
     290              {
     291                privateMethods.setRows($(this), value);
    302292              }
    303293            );
     
    306296          {
    307297            // return images list values
    308             var data = this.data('options');
    309 
    310             if(data)
    311             {
    312               return(data.numRows);
     298            var options = this.data('options');
     299
     300            if(options)
     301            {
     302              return(options.numRows);
    313303            }
    314304            else
     
    323313          {
    324314            // set cell width values
    325             this.each(function()
    326               {
    327                 var $this=$(this);
    328                 privateMethods.setCellWidth($this, value);
    329                 return($this);
     315            return this.each(function()
     316              {
     317                privateMethods.setCellWidth($(this), value);
    330318              }
    331319            );
     
    334322          {
    335323            // return images list values
    336             var data = this.data('options');
    337 
    338             if(data)
    339             {
    340               return(data.cellWidth);
     324            var options = this.data('options');
     325
     326            if(options)
     327            {
     328              return(options.cellWidth);
    341329            }
    342330            else
     
    351339          {
    352340            // set cell width values
    353             this.each(function()
    354               {
    355                 var $this=$(this);
    356                 privateMethods.setCellHeight($this, value);
    357                 return($this);
     341            return this.each(function()
     342              {
     343                privateMethods.setCellHeight($(this), value);
    358344              }
    359345            );
     
    362348          {
    363349            // return images list values
    364             var data = this.data('options');
    365 
    366             if(data)
    367             {
    368               return(data.cellHeight);
     350            var options = this.data('options');
     351
     352            if(options)
     353            {
     354              return(options.cellHeight);
    369355            }
    370356            else
     
    379365          {
    380366            // set selected value
    381             this.each(function()
    382               {
    383                 var $this=$(this);
    384                 privateMethods.setValue($this, value);
    385                 return($this);
     367            return this.each(function()
     368              {
     369                privateMethods.setValue($(this), value);
    386370              }
    387371            );
     
    390374          {
    391375            // return the selected value
    392             var data=this.data('options'),
     376            var options=this.data('options'),
    393377                properties=this.data('properties');
    394378
    395             if(data && properties && properties.index>-1)
    396             {
    397               return(data.images[properties.index]);
     379            if(options && properties && properties.index>-1 && properties.index<options.images.length)
     380            {
     381              return(options.images[properties.index]);
    398382            }
    399383            else
     
    408392          {
    409393            // set selected value
    410             this.each(function()
    411               {
    412                 var $this=$(this);
    413                 privateMethods.setEventPopup($this, value);
    414                 return($this);
     394            return this.each(function()
     395              {
     396                privateMethods.setEventPopup($(this), value);
    415397              }
    416398            );
     
    419401          {
    420402            // return the selected value
    421             var data=this.data('options');
    422 
    423             if(data)
    424             {
    425               return(data.popup);
     403            var options=this.data('options');
     404
     405            if(options)
     406            {
     407              return(options.popup);
    426408            }
    427409            else
     
    436418          {
    437419            // set selected value
    438             this.each(function()
    439               {
    440                 var $this=$(this);
    441                 privateMethods.setEventChange($this, value);
    442                 return($this);
     420            return this.each(function()
     421              {
     422                privateMethods.setEventChange($(this), value);
    443423              }
    444424            );
     
    447427          {
    448428            // return the selected value
    449             var data=this.data('options');
    450 
    451             if(data)
    452             {
    453               return(data.change);
     429            var options=this.data('options');
     430
     431            if(options)
     432            {
     433              return(options.change);
    454434            }
    455435            else
     
    458438            }
    459439          }
    460         }, // popup
    461 
    462     } // methods
     440        } // popup
     441
     442    }; // methods
    463443
    464444
     
    470450      updateListArea : function (object)
    471451        {
    472           var data=object.data('options'),
     452          var options=object.data('options'),
    473453              objects=object.data('objects'),
    474454              icon=objects.list.children().first(),
    475               width=icon.outerWidth()*data.numCols,
    476               height=icon.outerHeight()*data.numRows;
     455              width=icon.outerWidth()*options.numCols,
     456              height=icon.outerHeight()*options.numRows;
    477457
    478458          objects.listContainer.css(
     
    492472      setImages : function (object, value)
    493473        {
    494           var data=object.data('options'),
     474          var options=object.data('options'),
    495475              objects=object.data('objects'),
    496476              properties=object.data('properties');
    497           data.images=value;
     477          options.images=value;
    498478
    499479          objects.list.children().unbind();
    500480          objects.list.html('');
    501           for(var i=0;i<data.images.length;i++)
     481          for(var i=0;i<options.images.length;i++)
    502482          {
    503483            liClass=' ui-icon-selector-icon ';
     
    507487            }
    508488            objects.list.append(
    509               $('<li indexValue="'+i+'" class="'+liClass+'" style="display:inline-block;width:'+data.cellWidth+'px;height:'+data.cellHeight+'px;background-image:url('+data.images[i]+');"></li>')
     489              $('<li indexValue="'+i+'" class="'+liClass+'" style="display:inline-block;width:'+options.cellWidth+'px;height:'+options.cellHeight+'px;background-image:url('+options.images[i]+');"></li>')
    510490                .bind('click',
    511491                  {object:object},
     
    519499          }
    520500
    521           return(data.images);
     501          return(options.images);
    522502        },
    523503      setNumCols : function (object, value)
    524504        {
    525           var data=object.data('options'),
     505          var options=object.data('options'),
    526506              properties=object.data('properties');
    527           if((!properties.initialized || data.numCols!=value) && value>0)
    528           {
    529             data.numCols=value;
    530           }
    531           return(data.numCols);
     507          if((!properties.initialized || options.numCols!=value) && value>0)
     508          {
     509            options.numCols=value;
     510          }
     511          return(options.numCols);
    532512        },
    533513      setNumRows : function (object, value)
    534514        {
    535           var data=object.data('options'),
     515          var options=object.data('options'),
    536516              properties=object.data('properties');
    537           if((!properties.initialized || data.numRows!=value) && value>0)
    538           {
    539             data.numRows=value;
    540           }
    541           return(data.numRows);
     517          if((!properties.initialized || options.numRows!=value) && value>0)
     518          {
     519            options.numRows=value;
     520          }
     521          return(options.numRows);
    542522        },
    543523      setCellWidth : function (object, value)
    544524        {
    545           var data=object.data('options'),
     525          var options=object.data('options'),
    546526              properties=object.data('properties'),
    547527              objects=object.data('objects');
    548           if((!properties.initialized || data.cellWidth!=value) && value>=0)
    549           {
    550             data.cellWidth=value;
     528          if((!properties.initialized || options.cellWidth!=value) && value>=0)
     529          {
     530            options.cellWidth=value;
    551531            objects.container.css('width', value+'px');
    552532          }
    553           return(data.cellWidth);
     533          return(options.cellWidth);
    554534        },
    555535      setCellHeight : function (object, value)
    556536        {
    557           var data=object.data('options'),
     537          var options=object.data('options'),
    558538              properties=object.data('properties'),
    559539              objects=object.data('objects');
    560           if((!properties.initialized || data.cellHeight!=value) && value>=0)
    561           {
    562             data.cellHeight=value;
     540          if((!properties.initialized || options.cellHeight!=value) && value>=0)
     541          {
     542            options.cellHeight=value;
    563543            objects.container.css('height', value+'px');
    564544          }
    565           return(data.cellHeight);
     545          return(options.cellHeight);
    566546        },
    567547      setValue : function (object, value)
    568548        {
    569           var data=object.data('options'),
     549          var options=object.data('options'),
    570550              properties=object.data('properties'),
    571551              index=-1;
     
    574554          {
    575555            case ':first':
    576               if(data.images.length>0) index=0;
     556              if(options.images.length>0) index=0;
    577557              break;
    578558            case ':last':
    579               index=data.images.length-1;
     559              index=options.images.length-1;
    580560              break;
    581561            default:
    582               index=$.inArray(value, data.images);
     562              index=$.inArray(value, options.images);
    583563              break;
    584564          }
     
    588568            privateMethods.setValueByIndex(object, index, false);
    589569          }
    590           return(data.images[properties.index]);
     570          return(options.images[properties.index]);
    591571        },
    592572      setValueByIndex : function (object, value, trigger)
    593573        {
    594           var data=object.data('options'),
     574          var options=object.data('options'),
    595575              properties=object.data('properties'),
    596576              objects=object.data('objects');
    597           if((!properties.initialized || properties.index!=value) && value>-1 && value<data.images.length)
     577          if((!properties.initialized || properties.index!=value) && value>-1 && value<options.images.length)
    598578          {
    599579            objects.list.children('.ui-icon-selector-selected-icon').removeClass('ui-icon-selector-selected-icon');
    600580            objects.list.children('[indexValue="'+value+'"]').addClass('ui-icon-selector-selected-icon');
    601581            properties.index=value;
    602             objects.container.css('background-image', 'url('+data.images[properties.index]+')');
    603             if(trigger && data.change) object.trigger('iconSelectorChange', [properties.index]);
    604           }
    605           return(data.images[properties.index]);
     582            objects.container.css('background-image', 'url('+options.images[properties.index]+')');
     583            if(trigger && options.change) object.trigger('iconSelectorChange', [properties.index]);
     584          }
     585          return(options.images[properties.index]);
    606586        },
    607587      displaySelector : function (object, value)
    608588        {
    609           var data=object.data('options'),
     589          var options=object.data('options'),
    610590              properties=object.data('properties'),
    611591              objects=object.data('objects');
     
    625605              objects.listContainer.css('display', 'none');
    626606            }
    627             if(data.popup) object.trigger('iconSelectorPopup', [properties.selectorVisible]);
     607            if(options.popup) object.trigger('iconSelectorPopup', [properties.selectorVisible]);
    628608          }
    629609          return(properties.selectorVisible);
     
    631611      setEventPopup : function (object, value)
    632612        {
    633           var data=object.data('options');
    634           data.popup=value;
     613          var options=object.data('options');
     614          options.popup=value;
    635615          object.unbind('iconSelectorPopup');
    636           if(value) object.bind('iconSelectorPopup', data.popup);
    637           return(data.popup);
     616          if(value) object.bind('iconSelectorPopup', options.popup);
     617          return(options.popup);
    638618        },
    639619      setEventChange : function (object, value)
    640620        {
    641           var data=object.data('options');
    642           data.change=value;
     621          var options=object.data('options');
     622          options.change=value;
    643623          object.unbind('iconSelectorChange');
    644           if(value) object.bind('iconSelectorChange', data.change);
    645           return(data.change);
     624          if(value) object.bind('iconSelectorChange', options.change);
     625          return(options.change);
    646626        }
    647     }
     627    };
    648628
    649629
  • extensions/GrumPluginClasses/language/fr_FR/plugin.lang.php

    r6106 r7175  
    1010$lang['Infos'] = 'Informations';
    1111$lang['Some plugins are dependent on Grum Plugin Classes: before uninstall, you must first uninstall the plugins dependent'] = 'Certains plugins sont dépendants de Grum Plugin Classes : avant le désinstaller, il faut au préalable désinstaller les plugins dépendants';
     12
     13// gpc > 3.3.0
     14$lang['Public'] = 'Publique';
     15$lang['Private'] = 'Privée';
     16$lang['All the gallery'] = 'Toute la galerie';
     17
    1218?>
  • extensions/GrumPluginClasses/main.inc.php

    r7146 r7175  
    11<?php
    22/*
    3 Plugin Name: Grum Plugins Classes.3
    4 Version: 3.2.1
    5 Description: Collection de classes partagées entre mes plugins (existants, ou à venir) / Partaged classes between my plugins (actuals or futures)
    6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=199
     3Plugin Name: GMaps
     4Version: 0.2.0
     5Description: Display and manage (google) maps
     6Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=
    77Author: grum@piwigo.org
    8 Author URI: http://photos.grum.fr/
     8Author URI: http://photos.grum.fr
    99*/
    1010
     
    1212--------------------------------------------------------------------------------
    1313  Author     : Grum
    14     email    : grum@piwigo.org
     14    email    : grum@piwigo.com
    1515    website  : http://photos.grum.fr
     16    PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
    1617
    1718    << May the Little SpaceFrog be with you ! >>
     
    2122
    2223| release | date       |
    23 | 2.0.0   | 2008/07/20 | * convert classes for piwigo 2.0
     24| 0.1.0   | 2010-08-22 | * first lines of code
     25|         |            |   . release not published
    2426|         |            |
    25 | 2.0.1   | 2008/12/28 | * convert classe tables.class.inc to php5
     27| 0.2.0   | 2010-09-30 | * first official release
    2628|         |            |
    27 | 2.0.2   | 2009/04/26 | * add setOptions/getOptions for GPCPagesNavigation class
    28 |         |            | * add option to set first/prev/next/last textes
    2929|         |            |
    30 | 2.0.3   | 2009/07/24 | * modify common_plugin class config loader (r2.0.1)
    3130|         |            |
    32 | 2.0.4   | 2009/11/29 | * modify users class
    3331|         |            |
    34 | 3.0.0   | 2010/03/28 | * Uses piwigo pwg_db_* functions instead of mysql_* functions
    35 |         |            | * update classes & functions names
    36 |         |            | * include the JpegMetaData class
    3732|         |            |
    38 | 3.0.1   | 2010/04/11 | * little bug on the template (call of an undefined var)
    39 |         |            | * Add new languages
    40 |         |            |   . es_ES
    41 |         |            |   . hu_HU
    42 |         |            |   . it_IT
    4333|         |            |
    44 | 3.1.0   | 2010/04/24 | * add the GPCTabSheet class
    45 |         |            | * add the GPCRequestBuilder class
    46 |         |            | * add the pageNavigator.js
    47 |         |            | * update the GPCCore class
    48 |         |            | * Add new languages
    49 |         |            |   . nl_NL
    50 |         |            |   . de_DE
    51 |         |            |
    52 | 3.1.1   | 2010/05/18 | * fix bug in the install process (CommonPlugin not
    53 |         |            |   included)
    54 |         |            |
    55 | 3.2.0   | 2010/09/12 | * Enhance GPCTabSheet functionnalities
    56 |         |            |   - possibility to choose tab classes
    57 |         |            | * Add the simpleTip.js
    58 |         |            | * Enhance GPCRequestBuilder functionnalities
    59 |         |            |   - now abble to manage complex request with multi-record
    60 |         |            |   - result can be stored in the caddie
    61 |         |            |
    62 | 3.2.1   | 2010/10/09 | * Enhance GPCTabSheet functionnalities
    63 |         |            |   - add 'id' attribute for tabs (<li> items)
    64 |         |            |
    65 |         |            | * Fix JS & CSS bug with IE8
    66 |         |            |
    67 | 3.2.2   | 2010/mm/dd | *
    68 |         |            |
    69 |         |            | ===== Don't forget to update the plugin version ! =====
    7034|         |            |
    7135|         |            |
     
    8246:: TO DO
    8347
    84 :: WHAT ? WHY ?
    85 This plugin doesn't do anything itself. It just provide classes for others plugins.
     48--------------------------------------------------------------------------------
    8649
    87 Classes version for this package
    88     CommonPlugin.class.php
    89     GPCAjax.class.php
    90     GPCCss.class.php
    91     GPCPagesNavigation.class.php
    92     GPCPublicIntegration.class.php
    93     GPCTables.class.php -v1.5
    94     GPCTranslate.class.inc.php + google_translate.js
    95     GPCUsersGroups.class.inc.php
    96     GPCTabSheet.class.inc.php
     50:: NFO
     51  GMaps_root : common classe for admin and public classes
     52  GMaps_AIM  : classe to manage plugin integration into plugin menu
     53  GMaps_AIP  : classe to manage plugin admin pages
     54  GMaps_PIP  : classe to manage plugin public pages
    9755
    98     genericjs.class.inc.php  + genericjs.js
    99 
    100 See each file to know more about them
    10156--------------------------------------------------------------------------------
    10257*/
    10358
     59// pour faciliter le debug :o)
     60 //ini_set('error_reporting', E_ALL);
     61 //ini_set('display_errors', true);
     62
    10463if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    10564
    106 define('GPC_DIR' , basename(dirname(__FILE__)));
    107 define('GPC_PATH' , PHPWG_PLUGINS_PATH . GPC_DIR . '/');
    10865
    109 include_once('gpc_version.inc.php'); // => Don't forget to update this file !!
    110 include_once(GPC_PATH.'classes/GPCCore.class.inc.php');
     66define('GMAPS_DIR' , basename(dirname(__FILE__)));
     67define('GMAPS_PATH' , PHPWG_PLUGINS_PATH . GMAPS_DIR . '/');
     68
     69include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     70include_once('gmaps_version.inc.php'); // => Don't forget to update this file !!
    11171
    11272global $prefixeTable;
    11373
    114 
    115 
    116 $config=Array();
    117 GPCCore::loadConfig('gpc', $config);
    118 
    119 if(!isset($config['installed'])) $config['installed']='03.01.00';
    120 if($config['installed']!=GPC_VERSION2)
     74if(defined('IN_ADMIN'))
    12175{
    122   /* the plugin was updated without being deactivated
    123    * deactivate + activate the plugin to process the database upgrade
    124    */
    125   include(GPC_PATH."gpc_install.class.inc.php");
    126   $gpc=new GPC_Install($prefixeTable, __FILE__);
    127   $gpc->deactivate();
    128   $gpc->activate();
     76  //GMaps admin interface loaded and active only if in admin page
     77  include_once("gmaps_aim.class.inc.php");
     78  $obj=new GMaps_AIM($prefixeTable, __FILE__);
     79  $obj->initEvents();
     80}
     81else
     82{
     83  if(CommonPlugin::checkGPCRelease(GMAPS_GPC_NEEDED))
     84  {
     85    //GMaps public interface loaded and active only if in public page
     86    include_once("gmaps_pip.class.inc.php");
     87    $obj=new GMaps_PIP($prefixeTable, __FILE__);
     88  }
    12989}
    13090
    131 
    132 if(defined('IN_ADMIN'))
    133 {
    134   //GPC admin interface is loaded and active only if in admin page
    135   include_once("gpc_aim.class.inc.php");
    136 
    137   $obj = new GPC_AIM($prefixeTable, __FILE__);
    138   $obj->initEvents();
    139   set_plugin_data($plugin['id'], $obj);
    140 }
     91set_plugin_data($plugin['id'], $obj);
    14192
    14293?>
  • extensions/GrumPluginClasses/templates/GPCRequestBuilder_search.tpl

    r6894 r7175  
    33{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js"}
    44
    5 {known_script id="gpc.pagesNavigator" src=$ROOT_URL|@cat:"plugins/GrumPluginClasses/js/pagesNavigator.js"}
     5{known_script id="gpc.pagesNavigator" src=$ROOT_URL|@cat:"plugins/GrumPluginClasses/js/pagesNavigator.packed.js"}
    66
    77
Note: See TracChangeset for help on using the changeset viewer.