Changeset 1194 in products for quintagroup.dropdownmenu
- Timestamp:
- Jul 30, 2009 3:06:20 PM (15 years ago)
- Location:
- quintagroup.dropdownmenu/trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/configure.zcml
r1182 r1194 31 31 32 32 <!-- Register resources --> 33 33 <browser:resource 34 name="drop_down.css" 35 file="resources/drop_down.css" 36 /> 34 37 35 38 </configure> -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/resources/drop_down.css
r1182 r1194 1 /* <dtml-with base_properties> (do not remove this :) */ 2 /* <dtml-call "REQUEST.set('portal_url', portal_url())"> (not this either :) */ 1 /* DropDown Menu Styles */ 3 2 4 3 body { … … 16 15 17 16 #portal-globalnav li { 18 margin: 0; 17 margin: 0; 19 18 padding: 0; 20 border: 0; 19 border: 0; 21 20 display: inline; 22 21 float: left; … … 87 86 #portal-globalnav .csshover ul li ul li a:hover, 88 87 #portal-globalnav .csshover ul li ul li:hover a { 89 color: &dtml-globalFontColor;;88 color: #436976; 90 89 } 91 90 … … 96 95 97 96 #portal-globalnav ul li ul { 98 border: &dtml-borderWidth; &dtml-borderStyle; &dtml-globalBorderColor;;97 border: 1px solid #8cacbb; 99 98 padding-bottom: 1px; 100 99 overflow: hidden; … … 102 101 103 102 #portal-globalnav .csshover ul li:hover ul li:hover ul a { 104 color: &dtml-globalFontColor;;103 color: #436976; 105 104 } 106 105 … … 108 107 109 108 #portal-globalnav ul { 110 font-size: 8pt;111 list-style-type: none;112 list-style-image: none;109 font-size: 8pt; 110 list-style-type: none; 111 list-style-image: none; 113 112 } 114 113 115 114 #portal-globalnav ul li { 116 padding: 0;117 margin: 0;118 line-height: normal;115 padding: 0; 116 margin: 0; 117 line-height: normal; 119 118 } 120 119 121 120 #portal-globalnav ul li.selected a, 122 121 #portal-globalnav .csshover ul li a:hover { 123 background-color: &dtml-globalBackgroundColor;;124 color: &dtml-globalFontColor;;122 background-color: #dee7ec; 123 color: #436976; 125 124 } 126 125 127 126 #portal-globalnav .csshover ul li:hover ul { 128 margin: 0;129 border: &dtml-borderWidth; &dtml-borderStyle; &dtml-globalBorderColor;;130 background-color: &dtml-backgroundColor;;131 overflow: visible;127 margin: 0; 128 border: 1px solid #8cacbb; 129 background-color: White; 130 overflow: visible; 132 131 } 133 132 134 133 #portal-globalnav .csshover ul li:hover ul li { 135 padding: 0;136 margin: 0;134 padding: 0; 135 margin: 0; 137 136 } 138 137 139 138 #portal-globalnav .csshover ul li:hover ul li a { 140 color: &dtml-globalFontColor;!important;141 margin: 0;142 line-height: normal;143 width: auto;139 color: #436976 !important; 140 margin: 0; 141 line-height: normal; 142 width: auto; 144 143 } 145 144 146 145 #portal-globalnav .csshover ul li ul li a:hover { 147 background-image: none;146 background-image: none; 148 147 } 149 148 … … 154 153 /*Configlet styles************************************************************/ 155 154 156 .ieVisible {display: none;}155 .ieVisible {display: none;} 157 156 158 157 * html .ieHidden {display: none;} 159 158 160 159 * html .ieVisible {display: block;} 161 162 163 /* </dtml-with> (do not remove this either :) */ -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/templates/sections.pt
r1182 r1194 1 <tal:tabs i18n:domain="plone"> 1 <tal:tabs tal:condition="view/portal_tabs" 2 i18n:domain="plone"> 2 3 <h5 class="hiddenStructure" i18n:translate="heading_sections">Sections</h5> 3 4 <div id="portal-globalnav"> 4 5 <div class="csshover"> 5 <ul> 6 <span tal:replace="structure context/portal_properties/dropdownmenu_properties/menu|string:qPloneDropDownMenu broken" /> 7 <li class="invisibleHeightKeeper"> </li> 6 <ul class="globalSections"> 7 <li tal:replace="structure view/createMenu"> 8 DropDown Menu 9 </li> 10 <li class="invisibleHeightKeeper"> </li> 8 11 </ul> 9 12 </div> -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/browser/viewlets.py
r1182 r1194 1 from zope.component import getMultiAdapter 1 # -*- coding: utf-8 -*- 2 from Acquisition import aq_inner 3 4 from zope.component import getMultiAdapter, queryUtility 2 5 3 6 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile 7 from Products.CMFCore.utils import getToolByName 8 from Products.CMFCore.interfaces import IAction, IActionCategory 9 from Products.CMFCore.ActionInformation import ActionInfo 4 10 11 from plone.memoize.instance import memoize 5 12 from plone.app.layout.viewlets import common 13 from plone.registry.interfaces import IRegistry 14 15 from quintagroup.dropdownmenu.interfaces import IDropDownMenuSettings 6 16 7 17 8 18 class GlobalSectionsViewlet(common.GlobalSectionsViewlet): 9 19 index = ViewPageTemplateFile('templates/sections.pt') 20 recurse = ViewPageTemplateFile('templates/sections_recurse.pt') 10 21 11 22 def update(self): 12 super(GlobalSectionsViewlet, self).update() 23 # we may need some previously defined variables 24 #super(GlobalSectionsViewlet, self).update() 25 26 # prepare to gather portal tabs 27 tabs = [] 28 context = aq_inner(self.context) 29 self.conf = conf = self._settings() 30 self.tool = getToolByName(context, 'portal_actions') 31 32 # fetch actions-based tabs? 33 if conf.show_actions_tabs: 34 tabs.extend(self._actions_tabs()) 35 36 # fetch content structure-based tabs? 37 if conf.show_content_tabs: 38 # put content-based actions before content structure-based ones? 39 if conf.content_before_actions_tabs: 40 tabs = self._content_tabs() + tabs 41 else: 42 tabs.extend(self._content_tabs()) 43 44 # assign collected tabs eventually 45 self.portal_tabs = tabs 46 47 def _actions_tabs(self): 48 """Return tree of tabs based on portal_actions tool configuration""" 49 conf = self.conf 50 tool = self.tool 51 context = aq_inner(self.context) 52 53 # check if we have required root actions category inside tool 54 if conf.actions_category not in tool.objectIds(): 55 return [] 56 57 #category_ids = category.objectIds() 58 #selectedTabs = self.context.restrictedTraverse('selectedTabs') 59 ## try to find out selected subtab 60 #if tab['id'] == self.selected_portal_tab: 61 #selection = selectedTabs(None, None, tab['subtabs']) 62 #self.selected_sub_tab = selection['portal'] 63 return self._subactions(tool._getOb(conf.actions_category), context) 64 65 def _subactions(self, category, object, level=0): 66 tabs = [] 67 for info in self._actionInfos(category, object): 68 # prepare data for action 69 # TODO: implement current element functionality, maybe should be 70 # done on a template level because of separate content and 71 # actions tabs are rendered separately 72 currentItem = False 73 currentParent = False 74 # TODO: adjust img tag 75 icon = info['icon'] and '<img src="%s" />' % info['icon'] or '' 76 77 # look up children for a given action 78 children = [] 79 if level <= self.conf.actions_tabs_level: 80 # try to find out appropriate subcategory 81 subcat_id = self.conf.nested_category_prefix + info['id'] + \ 82 self.conf.nested_category_sufix 83 if subcat_id in category.objectIds(): 84 subcat = category._getOb(subcat_id) 85 if IActionCategory.providedBy(subcat): 86 children = self._subactions(subcat, object, level+1) 87 88 # make up final tab dictionary 89 tab = {'Title': info['title'], 90 'Description': info['description'], 91 'getURL': info['url'], 92 'show_children': len(children) > 0, 93 'children': children, 94 'currentItem': currentItem, 95 'currentParent': currentParent, 96 'item_icon': {'html_tag': icon}, 97 'normalized_review_state': 'visible'} 98 tabs.append(tab) 99 return tabs 100 101 def _actionInfos(self, category, object, check_visibility=1, 102 check_permissions=1, check_condition=1, max=-1): 103 """Return action infos for a given category""" 104 context = aq_inner(self.context) 105 ec = self.tool._getExprContext(object) 106 actions = [ActionInfo(action, ec) for action in category.objectValues() 107 if IAction.providedBy(action)] 108 109 action_infos = [] 110 for ai in actions: 111 if check_visibility and not ai['visible']: 112 continue 113 if check_permissions and not ai['allowed']: 114 continue 115 if check_condition and not ai['available']: 116 continue 117 action_infos.append(ai) 118 if max + 1 and len(action_infos) >= max: 119 break 120 return action_infos 121 122 def _content_tabs(self): 123 """Return tree of tabs based on content structure""" 124 return [] 125 126 @memoize 127 def _settings(self): 128 """Fetch dropdown menu settings registry""" 129 registry = queryUtility(IRegistry) 130 return registry.forInterface(IDropDownMenuSettings) 131 132 def createMenu(self): 133 return self.recurse(children=self.portal_tabs, level=1) 134 135 def _old_update(self): 13 136 context_state = getMultiAdapter((self.context, self.request), 14 137 name=u'plone_context_state') -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/interfaces.py
r1181 r1194 57 57 u"nested menu stops. 0 means no limit. 1 only includes " 58 58 u"the root folder."), 59 default=0) 59 default=0, 60 required=False) 60 61 61 62 actions_category = schema.TextLine( … … 75 76 u"to 'pre_index_html_sub' will be looked up on the same " 76 77 u"level to get nested menu for 'index_html' action."), 77 default=u"") 78 default=u"", 79 required=False) 78 80 79 81 nested_category_sufix = schema.TextLine( -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/profiles/default/cssregistry.xml
r1182 r1194 1 1 <?xml version="1.0"?> 2 2 <object name="portal_css" meta_type="Stylesheets Registry"> 3 <stylesheet title="DropDown Menu" cacheable="True" compression="safe" cookable="True"3 <stylesheet title="DropDown Menu" cacheable="True" compression="safe" cookable="True" 4 4 enabled="1" expression="" id="++resource++drop_down.css" media="screen" 5 5 rel="stylesheet" rendering="import"/>
Note: See TracChangeset
for help on using the changeset viewer.