Changeset 6174


Ignore:
Timestamp:
May 13, 2010, 10:12:38 PM (14 years ago)
Author:
grum
Message:

Improve functionnalities for GPCTabSheet and GPCRequestBuilder classes

Location:
extensions/GrumPluginClasses
Files:
2 added
4 edited

Legend:

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

    r6106 r6174  
    100100
    101101
     102  /**
     103   * this function is called by the request builder to make the search page, and
     104   * must return the HTML & JS code of the dialogbox used to select criterion
     105   *
     106   * Notes :
     107   *  - the dialogbox is a JS object with a public method 'show'
     108   *  - when the method show is called, one parameter is given by the request
     109   *    builder ; the parameter is an object defined as this :
     110   *      {
     111   *        cBuilder: an instance of the criteriaBuilder object used in the page,
     112   *      }
     113   *
     114   *
     115   *
     116   *
     117   * @param String $mode : can take 'admin' or 'public' values, allowing to
     118   *                       return different interface if needed
     119   * @return String : HTML formatted value
     120   */
     121  static public function getInterfaceContent($mode='admin')
     122  {
     123    return("");
     124  }
     125
     126  /**
     127   * this function returns the label displayed in the criterion menu
     128   *
     129   * @return String : label displayed in the criterions menu
     130   */
     131  static public function getInterfaceLabel()
     132  {
     133    return(l10n('gpc_rb_unknown_interface'));
     134  }
     135
     136  /**
     137   * this function returns the name of the dialog box class
     138   *
     139   * @return String : name of the dialogbox class
     140   */
     141  static public function getInterfaceDBClass()
     142  {
     143    return('');
     144  }
     145
     146
    102147}
    103148
     
    119164   * @return Boolean : true if registering is Ok, otherwise false
    120165   */
    121   static public function register($pluginName, $fileName)
     166  static public function register($pluginName, $fileName, $dialogBoxObject)
    122167  {
    123168    $config=Array();
     
    127172        'name' => $pluginName,
    128173        'fileName' => $fileName,
     174        'dialogBox' => $dialogBoxObject,
    129175        'date' => date("Y-m-d H:i:s"),
    130176        'version' => self::$version,
     
    880926
    881927
     928
     929  /**
     930   * display search page
     931   */
     932  static public function displaySearchPage()
     933  {
     934    global $template, $lang;
     935
     936    load_language('rbuilder.lang', GPC_PATH);
     937
     938    $template->set_filename('gpc_search_page',
     939                dirname(dirname(__FILE__)).'/templates/GPCRequestBuilder_search.tpl');
     940
     941    $registeredPlugin=self::getRegistered();
     942    $dialogBox=Array();
     943    foreach($registeredPlugin as $key=>$val)
     944    {
     945      if(array_key_exists($key, $registeredPlugin))
     946      {
     947        if(file_exists($registeredPlugin[$key]['fileName']))
     948        {
     949          include_once($registeredPlugin[$key]['fileName']);
     950
     951          $dialogBox[]=Array(
     952            'handle' => $val['name'].'DB',
     953            'dialogBoxClass' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceDBClass')),
     954            'label' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceLabel')),
     955            'content' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceContent')),
     956          );
     957        }
     958      }
     959    }
     960
     961    $datas=Array(
     962      'dialogBox' => $dialogBox,
     963      'themeName' => $template->get_themeconf('name'),
     964    );
     965
     966    $template->assign('datas', $datas);
     967
     968    return($template->parse('gpc_search_page', true));
     969  } //displaySearchPage
     970
    882971}
    883972
  • extensions/GrumPluginClasses/classes/GPCTabSheet.class.inc.php

    r5918 r6174  
    6262  }
    6363
     64
     65  function add($name, $caption, $url, $selected = false, $onClick='')
     66  {
     67    if(parent::add($name,$caption,$url,$selected))
     68    {
     69      $this->sheets[$name]['onClick'] = $onClick;
     70      return(true);
     71    }
     72    return(false);
     73  }
    6474
    6575  public function setClasses($classes)
  • extensions/GrumPluginClasses/css/rbuilder.css

    r6106 r6174  
    1919  margin-left:0px;
    2020}
     21
     22.cPnActive, .cPnDisabled, .cPnInactive { margin:2px; padding:2px;  min-width:20px; text-align:center; }
     23.pnInactiveclear, .pnInactiveroma { cursor:pointer; }
     24.pnInactiveclear:hover { background:#F1F1F1; }
     25.pnActiveclear { background:#F1F1F1; font-weight:bold; }
     26.pnInactiveroma:hover { background:#999999; color:#444444; }
     27.pnActiveroma { background:#999999; color:#444444; font-weight:bold; }
     28#iPagesNavigator ul { margin:0px; }
     29
     30
     31.cbGroup { border-width:1px; border-style:solid; padding:0px; margin:2px; min-height:30px; list-style:none; }
     32.cbItem {   padding:2px; margin:8px; min-height:34px; list-style:none; }
     33
     34#iListSelectedCriterions { padding:0px; }
     35
     36#dragHelper ul li.cbItem { padding:2px; }
     37#dragHelper ul li {
     38  clear:both;
     39  min-height:32px;
     40  list-style-image:none;
     41  list-style-position:outside;
     42  list-style-type:none;
     43  margin:4px;
     44  padding:0px;
     45}
     46
     47.cbItemButtons { padding:2px; }
     48.cbItem img { cursor: pointer; }
     49
     50.cbSortHandle { cursor:move; }
     51
     52
     53.helper {
     54 border:2px dashed #777777;
     55}
     56
     57div.cbOperator {
     58 cursor:pointer;
     59 padding:4px;
     60 text-align:left;
     61 font-weight:bold;
     62}
     63
     64div.cbOperatorBgroma {
     65 background:#333333;
     66}
     67
     68div.cbOperatorBgclear {
     69 background:#dbe8f3;
     70}
     71
     72.cbButtons {
     73  float:left;
     74  margin:2px;
     75  padding:8px;
     76  height:15px;
     77}
     78
     79
     80div#iMenuCriterions div#iMenuCItems {
     81  display:none;
     82  list-style-type:none;
     83  max-height:30px;
     84  position:absolute;
     85  padding:0px;
     86  margin:36px 2px 2px;
     87}
     88
     89
     90div#iMenuCriterions ul {
     91  padding:2px;
     92}
     93
     94div#iMenuCriterions ul li {
     95  list-style-type:none;
     96  padding:4px;
     97}
     98
     99div#iMenuCriterions:hover  div#iMenuCItems
     100{
     101  cursor:pointer;
     102  display:block;
     103}
     104
     105div#iMenuCriterions:hover div#iMenuCTitle
     106{
     107  margin-bottom:0px;
     108  padding-bottom:11px;
     109}
     110
     111div#iMenuCriterions div#iMenuCTitle
     112{
     113  margin-bottom:3px;
  • extensions/GrumPluginClasses/templates/GPCTabSheet.tpl

    r5918 r6174  
    11{if isset($tabsheet) and count($tabsheet)}
    22<ul {if isset($tabsheet_classes)}class="{$tabsheet_classes}"{/if} {if isset($tabsheet_id)}id="{$tabsheet_id}"{/if} >
    3 {foreach from=$tabsheet key=name item=sheet}
    4   <li class="{if ($name == $tabsheet_selected)}selected_tab{else}normal_tab{/if}">
    5     <a href="{$sheet.url}"><span>{$sheet.caption}</span></a>
     3{foreach from=$tabsheet key=name item=sheet name=tabs}
     4  <li {if isset($tabsheet_id)}id="{$tabsheet_id}{$smarty.foreach.tabs.index}"{/if} class="{if ($name == $tabsheet_selected)}selected_tab{else}normal_tab{/if}">
     5    <a {if $sheet.url!=''}href="{$sheet.url}"{/if} {if $sheet.onClick!=''}onclick="{$sheet.onClick}"{/if} ><span>{$sheet.caption}</span></a>
    66  </li>
    77{/foreach}
    88</ul>
     9
     10  {if isset($tabsheet_id)}
     11  {literal}
     12  <script type="text/javascript">
     13    $('#{/literal}{$tabsheet_id}{literal} li').bind('click',
     14      function ()
     15      {
     16        $('#{/literal}{$tabsheet_id}{literal} li').removeClass('selected_tab').addClass('normal_tab');
     17        $(this).removeClass('normal_tab').addClass('selected_tab');
     18      }
     19    );
     20  {/literal}
     21  </script>
     22
     23  {/if}
     24
    925{/if}
Note: See TracChangeset for help on using the changeset viewer.