Changeset 351

Show
Ignore:
Timestamp:
06/16/06 10:15:11
Author:
piv
Message:

corrected README.txt, TODO.txt, modified reorder function ...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneTabs/trunk/README.txt

    r350 r351  
    11Quintagroup Plone Tabs 
    22 
    3   The product allows Plone websites to update modify portal_tabs 
     3  The product allows Plone websites to modify portal_tabs 
    44  actions from portal_control_panel form. 
    55 
     
    1111 
    1212  * Firefox 
     13 
    1314  * IE 5.5 - 6.0 
    1415 
  • qPloneTabs/trunk/TODO.txt

    r350 r351  
    11  * write css 
    22  * Opera compatible 
    3   * reorder modification 
    43  * adding some effects 
    54  * 'portal-globalnav' visualization without page reloading 
  • qPloneTabs/trunk/skins/qPloneTabs/javascripts/qplonetabs.js

    r350 r351  
    1010  '#save' : function(el){ 
    1111    el.onclick = function(){ 
     12      var params = ''; 
     13      $A($('tabslist').getElementsByTagName('INPUT')).findAll(function(h){return h.type=='hidden';}).each(function(f,idx){params += idx==0?'idxs='+f.value:'&idxs='+f.value;}); 
    1214      new Ajax.Request('qpt_reorder', 
    1315        {method: 'post', 
    14          parameters: Sortable.serialize('tabslist').replace(/\[\]/g, ''), 
     16         parameters: params, 
     17         onSuccess: function(request){ 
     18           $A($('tabslist').getElementsByTagName('INPUT')).findAll(function(h){return h.type=='hidden';}).each(function(f,idx){f.value=idx;}); 
     19           Element.classNames('app').set('viewing'); 
     20           Sortable.destroy('tabslist'); 
     21           new Effect.Highlight('tabslist',{}); 
     22         }, 
    1523         onComplete: function(request){ 
    16            Element.classNames('app').set('viewing'); 
    17            new Effect.Highlight('tabslist',{}); 
    18             $A($('tabslist').getElementsByTagName('LI')).each(function(li){new Element.ClassNames(li).remove('hover');}); 
     24           $A($('tabslist').getElementsByTagName('LI')).each(function(li){new Element.ClassNames(li).remove('hover');}); 
    1925           Behaviour.apply(); 
    2026         } 
    2127        } 
    2228      ); 
    23       Sortable.destroy('tabslist'); 
    2429      return false; 
    2530    } 
     
    114119    el.onfocus = function(){ 
    115120      Element.classNames('app').set('adding'); 
     121      removeEdition(el); 
    116122    }; 
    117123    el.onkeyup = function() { 
  • qPloneTabs/trunk/skins/qPloneTabs/prefs_tabs_form.cpt

    r350 r351  
    8282               value="1" 
    8383               tal:attributes="checked python:test(generated_tabs, 'checked', None)" /> 
    84         <label i18n:translate="label_generated_tabs_enable">Automatically generate tabs</label> 
     84        <label for="generated_tabs" i18n:translate="label_generated_tabs_enable">Automatically generate tabs</label> 
    8585        <div class="formHelp" i18n:translate="help_generated_tabs"> 
    8686          By default, all folders created at the root level will have global section 
  • qPloneTabs/trunk/skins/qPloneTabs/qpt_reorder.py

    r350 r351  
    55##bind script=script 
    66##bind subpath=traverse_subpath 
    7 ##parameters= tabslist 
     7##parameters= idxs 
    88##title= 
    99## 
    1010 
    11 act_tool = context.portal_actions 
    12 moveUp = act_tool.moveUpActions 
    13 moveDown = act_tool.moveDownActions 
     11from Products.qPloneTabs.utils import reorderActions 
    1412 
    15 actions = act_tool.listActionInfos([],context,0,0,0) 
    16 tabs = [[action['id'], actions.index(action)] for action in actions if action['category'] == 'portal_tabs'] 
    17 new_tabs = tabs 
    18  
    19 def swap(idx1, idx2, idx1_local, idx2_local, pt_list): 
    20     if idx1 == idx2: return pt_list 
    21     if idx2 > idx1: 
    22         for idx in range(int(idx2-idx1)): 
    23            moveUp([idx2-idx]) 
    24         for idx in range(int(idx2-idx1)-1): 
    25            moveDown([idx1+1+idx]) 
    26     elif idx2 < idx1: 
    27         for idx in range(int(idx1-idx2)): 
    28            moveUp([idx1-idx]) 
    29         for idx in range(int(idx1-idx2)-1): 
    30            moveDown([idx2+1+idx]) 
    31     temp = pt_list[idx2_local][0] 
    32     pt_list[idx2_local][0] = pt_list[idx1_local][0] 
    33     pt_list[idx1_local][0] = temp 
    34     return pt_list 
    35  
    36 for idx in range(len(tabslist)): 
    37     for tab in tabs: 
    38         if tabslist[idx] == tab[0]: 
    39              if idx != tabs.index(tab): 
    40                  new_tabs = swap(new_tabs[idx][1], tab[1], idx, new_tabs.index(tab), new_tabs) 
    41     tabs = new_tabs 
    42  
    43 return tabslist 
     13return reorderActions(context, idxs) 
  • qPloneTabs/trunk/utils.py

    r350 r351  
    1515    tabs[int(num)].edit(id=id,title=name, action=action, condition=condition) 
    1616    return True 
     17 
     18def reorderActions(self, idxs): 
     19    """ Reorder portal_tabs actions in given order """ 
     20    idxs = list(map(int,idxs)) 
     21    portal_actions = getToolByName(self, 'portal_actions') 
     22    actions = portal_actions._cloneActions() 
     23    tabs = [[action, actions.index(action)] for action in actions if action.category == 'portal_tabs'] 
     24    for idx in range(len(idxs)): 
     25        actions[tabs[idx][1]] = tabs[idxs[idx]][0] 
     26    portal_actions._actions = tuple(actions) 
     27    return idxs