Changeset 1086

Show
Ignore:
Timestamp:
03/11/08 10:21:50
Author:
piv
Message:

added action removing with kss

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/browser/kssactions.zcml

    r1084 r1086  
    2727        /> 
    2828     
     29    <browser:page 
     30        for="plone.app.kss.interfaces.IPortalObject" 
     31        attribute="deleteAction" 
     32        class=".plonetabs.PloneTabsControlPanel" 
     33        name="plonetabs-deleteAction" 
     34        permission="cmf.ManagePortal" 
     35        /> 
     36     
    2937</configure> 
  • qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/browser/plonetabs.py

    r1085 r1086  
    195195            withKssSetup="False") 
    196196     
     197     
     198    # XXX TODO 
     199    #def updateSection(self, ksscore, section): 
     200        #""" Method for updating global-sections on client """ 
     201         
     202        #replace_id = section 
     203        #macro = SECTION_MAPPING.get(section, None) 
     204         
     205        #if macro is not None: 
     206            #ksscore.replaceHTML( 
     207                #ksscore.getHtmlIdSelector(replace_id), 
     208                #self.macroContent(macro), 
     209                ##self.sections_template(), 
     210                #withKssSetup="False") 
     211     
    197212    @kssaction 
    198213    def toggleGeneratedTabs(self, field, checked='0'): 
     
    226241         
    227242        cat_container = portal_actions[category] 
    228         if act_id not in cat_container.objectIds(): 
     243        if act_id not in map(lambda x: x.id, filter(lambda x: IAction.providedBy(x), cat_container.objectValues())): 
    229244            raise KSSExplicitError, "%s action does not exist in %s category" % (act_id, category) 
    230245         
     
    243258         
    244259        # update global-sections viewlet 
    245         self.updateGlobalSections(ksscore) 
     260        if category == "portal_tabs": 
     261            self.updateGlobalSections(ksscore) 
    246262     
    247263    @kssaction 
     
    272288        self.updateGlobalSections(ksscore) 
    273289     
    274  
    275  
    276  
    277  
     290    @kssaction 
     291    def deleteAction(self, id, category): 
     292        """ Delete portal action with given id & category """ 
     293        portal_actions = getToolByName(self.context, "portal_actions") 
     294         
     295        if category not in portal_actions.objectIds(): 
     296            raise KSSExplicitError, "Unexistent root portal actions category %s" % category 
     297         
     298        # remove prefix, added for making ids on configlet unique ("tabslist_") 
     299        act_id = id[len("tabslist_"):] 
     300         
     301        cat_container = portal_actions[category] 
     302        if act_id not in map(lambda x: x.id, filter(lambda x: IAction.providedBy(x), cat_container.objectValues())): 
     303            raise KSSExplicitError, "%s action does not exist in %s category" % (act_id, category) 
     304         
     305        cat_container.manage_delObjects(ids=[act_id,]) 
     306         
     307        # update action list on client 
     308        ksscore = self.getCommandSet("core") 
     309         
     310        ksscore.deleteNode(ksscore.getHtmlIdSelector(id)) 
     311         
     312        # add "noitems" class to Reorder controls to hide it 
     313        if not filter(lambda x: IAction.providedBy(x), cat_container.objectValues()): 
     314            ksscore.addClass(ksscore.getHtmlIdSelector("reorder"), value="noitems") 
     315         
     316        # XXX TODO: fade effect during removing, for this kukit js action/command plugin needed 
     317         
     318        # update global-sections viewlet 
     319        if category == "portal_tabs": 
     320            self.updateGlobalSections(ksscore) 
     321     
     322 
     323 
     324 
     325 
     326 
     327 
     328 
  • qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/browser/resources/plonetabs.kss

    r1084 r1086  
    2222} 
    2323 
    24 /* Hovering for IE especially  
     24 /*Hovering for IE especially */ 
    2525#app li:mouseover { 
    2626    action-client: addClass; 
     
    3232    removeClass-value: onHover; 
    3333} 
    34 */ 
     34 
    3535 
    3636/* Automatically generated tabs */ 
     
    6060    plonetabs-toggleRootsVisibility-checked: currentFormVar(); 
    6161} 
     62 
     63/* Delete action link */ 
     64#tabslist .delete:click { 
     65    evt-click-preventdefault: True; 
     66    evt-click-allowbubbling: True; 
     67    action-server: plonetabs-deleteAction; 
     68    plonetabs-deleteAction-id: nodeAttr(id, true); 
     69    plonetabs-deleteAction-category: stateVar(plonetabs-category); 
     70} 
     71 
     72 
  • qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/config.py

    r1082 r1086  
    11PROPERTY_SHEET = "tabs_properties" 
    22FIELD_NAME     = "titles" 
     3 
     4# XXX TODO 
     5SECTION_MAPPING = {"portal-globalnav"   : "global_sections/macros/portal_tabs", 
     6                   "user"               : "", 
     7                   "portal-siteactions" : ""} 
    38 
    49""" Example javascript 
  • qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/plugins/plugin.js

    r1084 r1086  
    2424 
    2525}); 
    26 kukit.commandsGlobalRegistry.registerFromAction('plonetabs-redirectTo', 
    27     kukit.cr.makeSelectorCommand); 
    2826 
     27kukit.commandsGlobalRegistry.registerFromAction('plonetabs-redirectTo', kukit.cr.makeSelectorCommand); 
     28