Changeset 489
- Timestamp:
- 08/21/06 13:38:30
- Files:
-
- qPloneTabs/trunk/__init__.py (modified) (1 diff)
- qPloneTabs/trunk/skins/qPloneTabs/javascripts/qplonetabs.js (modified) (7 diffs)
- qPloneTabs/trunk/skins/qPloneTabs/qplonetabs.css.dtml (modified) (7 diffs)
- qPloneTabs/trunk/skins/qPloneTabs/qpt_add.py (modified) (2 diffs)
- qPloneTabs/trunk/skins/qPloneTabs/qpt_getroottabs.pt (modified) (1 diff)
- qPloneTabs/trunk/skins/qPloneTabs/qpt_gettabslist.pt (modified) (1 diff)
- qPloneTabs/trunk/utils.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneTabs/trunk/__init__.py
r488 r489 8 8 9 9 from Products.qPloneTabs.utils import getPortalTabs 10 from Products.qPloneTabs.utils import getRootTabs qPloneTabs/trunk/skins/qPloneTabs/javascripts/qplonetabs.js
r488 r489 60 60 if (Element.hasClassName(li, 'invisible')) { 61 61 Element.removeClassName(li, 'invisible'); 62 el.title = 'Hide';63 62 } 64 63 else { 65 64 Element.addClassName(li, 'invisible'); 66 el.title = 'Show';67 65 }; 68 66 }, … … 115 113 inputs.each(function(el,idx){(0<idx&&idx<5)?tmp.push(el.value):''}); 116 114 gBeforeEditData[inputs[0]] = tmp; 117 shiftClassNames('app', 'viewing', 'editing');118 Element.addClassName(li, ' current');115 // shiftClassNames('app', 'viewing', 'editing'); 116 Element.addClassName(li, 'editing'); 119 117 inputs[1].focus(); 120 118 } … … 134 132 afterFinish : function(){ 135 133 shiftClassNames(dl, 'expandedBlock', 'collapsedBlock'); 136 shiftClassNames('app', 'editing', 'viewing');137 Element.removeClassName(li, ' current');134 // shiftClassNames('app', 'editing', 'viewing'); 135 Element.removeClassName(li, 'editing'); 138 136 li.id = 'tabslist_'+title; 139 137 li.getElementsByTagName('SPAN')[1].update(title); … … 165 163 afterFinish : function(){ 166 164 shiftClassNames(dl, 'expandedBlock', 'collapsedBlock'); 167 shiftClassNames('app', 'editing', 'viewing');168 Element.removeClassName(li, ' current');165 // shiftClassNames('app', 'editing', 'viewing'); 166 Element.removeClassName(li, 'editing'); 169 167 } 170 168 }); 171 169 } 172 170 else { 173 shiftClassNames('app', 'editing', 'viewing');174 Element.removeClassName(li, ' current');171 // shiftClassNames('app', 'editing', 'viewing'); 172 Element.removeClassName(li, 'editing'); 175 173 }; 176 174 return false; … … 183 181 var re = new RegExp('[^a-zA-Z0-9-_~,.\\$\\(\\)# ]','g'), initialVal = $F(el); 184 182 el.onfocus = function(){ 185 shiftClassNames('app', 'viewing', 'adding');186 removeEdition(el);183 Element.addClassName('addaction', 'adding'); 184 // removeEdition(el); 187 185 }; 188 186 el.onkeyup = function() { … … 209 207 new Insertion.Bottom('tabslist', request.responseText); 210 208 Form.reset('addaction'); 211 shiftClassNames('app', 'adding', 'viewing'); 209 // shiftClassNames('app', 'adding', 'viewing'); 210 Element.removeClassName('addaction', 'adding'); 212 211 Behaviour.apply(); 213 212 } … … 233 232 shiftClassNames(dl, 'expandedBlock', 'collapsedBlock'); 234 233 Form.reset('addaction'); 235 shiftClassNames('app', 'adding', 'viewing'); 234 // shiftClassNames('app', 'adding', 'viewing'); 235 Element.removeClassName('addaction', 'adding'); 236 236 Behaviour.apply(); 237 237 } qPloneTabs/trunk/skins/qPloneTabs/qplonetabs.css.dtml
r488 r489 2 2 /* <dtml-call "REQUEST.set('portal_url', portal_url())"> (not this either :) */ 3 3 4 #app ul.csshover .delete {display: none;} 4 /* 5 There are two global self-excludes classes: 'viewing' and 'sorting', 6 one local class 'editing' for menu items which are expanded for editing, 7 and one more local class 'adding' for adding form when it's in open state. 8 9 Reorder action are always available, so it TEMPORARY stop other actions on the form: 10 editing items 11 deleting items 12 toggling item visibility 13 adding item 14 15 After returning to 'viewing' class after 'sorting' all items become to the same state they 16 be before sorting (in editing state or not). 17 18 And the same behaviour for adding form: form state ('adding' or not) become the same it was 19 before sorting. 20 21 All actions except reordering and deleting* could be done at any 22 in relationship to each other. 23 24 * deleting can't be done during the editing the same item 25 */ 26 27 #app.viewing .reorder-controls, 28 #app.sorting .sort-controls, 29 /* #app.sorting li.editing span, */ 30 #app.viewing li.editing .editform, 31 #app #addaction.adding .field-visible, 32 #app #addaction.adding .field-name dt, 33 #app #addaction.adding .field-action, 34 #app #addaction.adding .field-action label, 35 #app #addaction.adding .advanced, 36 #app #addaction.adding .field-id, 37 #app #addaction.adding .field-condition, 38 #app #addaction.adding .add-controls {display: block;} 39 40 #app #busy, 41 #app .reorder-controls, 42 #app .sort-controls, 43 #app.viewing li.editing .url-helper, 44 #app.viewing li.editing .tab-title, 45 #app .drag-handle, 46 #app .delete, 47 #app ul.csshover li.editing:hover .delete, 48 #app ul.csshover li.editing.hover .delete, 49 #app .visibility, 50 #app .editform, 51 #app.sorting #addaction, 52 #app .field-visible, 53 #app .field-name dt, 54 #app .field-action, 55 #app .advanced, 56 #app .field-id, 57 #app .field-condition, 58 #app .add-controls {display: none;} 59 60 #app.working #busy, 5 61 #app.viewing ul.csshover li:hover .delete, 6 62 #app.viewing ul.csshover li.hover .delete, 7 63 #app.viewing ul.csshover li:hover .visibility, 8 #app.viewing ul.csshover li.hover .visibility {display: inline;} 9 10 #app.viewing .reorder-controls, 11 #app.sorting .sort-controls, 12 #app.editing li.current .editform, 13 #app.adding .message-error, 14 #app.adding .field-visibility, 15 #app.adding .field-name dt, 16 #app.adding .field-action, 17 #app.adding .field-action label, 18 #app.adding .advanced, 19 #app.adding .field-id, 20 #app.adding .field-condition, 21 #app.adding .add-controls {display: block;} 22 23 .reorder-controls, 24 .sort-controls, 25 #app.editing li.current span, 26 .drag-handle, 27 #app .delete, 28 #app .visibility, 29 .editform, 30 #app.sorting #addaction, 31 /* #app.editing #addaction, */ 32 #addaction legend, 33 .field-visibility, 34 .field-name dt, 35 .field-action, 36 .advanced, 37 .field-id, 38 .field-condition, 39 .add-controls {display: none;} 40 41 #app.sorting .drag-handle {display: inline;} 42 43 #busy {display: none;} 44 #app.working #busy {display: inline;} 45 #app.sorting #tabslist img.drag-handle {cursor: move;} 64 #app.viewing ul.csshover li.hover .visibility, 65 #app.sorting .drag-handle {display: inline;} 66 67 #app.sorting #tabslist img.drag-handle {cursor: move;} 68 69 #app .invisible span.tab-title {color:#aaa;} 46 70 47 71 /*common***************************************************/ 48 49 #app .invisible span {color:#aaa;}50 72 51 73 div.reorder-controls, … … 96 118 } 97 119 98 #app ul.csshover li. current{120 #app ul.csshover li.editing { 99 121 padding:0; 100 122 margin: 0; … … 102 124 } 103 125 104 #app li. currentform {126 #app li.editing form { 105 127 margin:-0.1em; 106 128 } 107 129 108 * html #app li. currentform {130 * html #app li.editing form { 109 131 margin: -0.2em 0 0 0; 110 132 } … … 184 206 185 207 /*hover***************************************************/ 208 209 #app.viewing ul.csshover li.editing:hover, 210 #app.viewing ul.csshover li.editing.hover { 211 background-color: &dtml-backgroundColor;; 212 border: none; 213 cursor: auto; 214 } 186 215 187 216 #app.viewing ul.csshover li:hover, … … 250 279 } 251 280 252 #app .adding .field-action label {281 #app #addaction.adding .field-action label { 253 282 position:absolute; 254 283 line-height:2.1em; … … 260 289 } 261 290 262 #app .adding .field-action input {291 #app #addaction.adding .field-action input { 263 292 margin-top:0.1em; 264 293 padding-right:9em; … … 266 295 } 267 296 268 * html #app .adding .field-action input {297 * html #app #addaction.adding .field-action input { 269 298 padding-right:0.5em; 270 299 width:96.9%; qPloneTabs/trunk/skins/qPloneTabs/qpt_add.py
r488 r489 18 18 liClass = "" 19 19 visible = True 20 title = 'Hide'21 20 else: 22 21 checked = "" 23 22 liClass = "invisible" 24 23 visible = False 25 title = 'Show'26 24 params = {'id':id, 'name':name, 'action':action, 'condition':condition, 27 25 'permission':'View', 'category':'portal_tabs', 'visible':visible} … … 32 30 <li id="tabslist_%(id)s" class="%(class)s"> 33 31 <img class="drag-handle" src="drag.gif" alt="" height="11" width="25"> 34 <input class="visibility" value="1" name="i%(idx)s_visibility" %(checked)s type="checkbox" title= %(title)s>32 <input class="visibility" value="1" name="i%(idx)s_visibility" %(checked)s type="checkbox" title="visibility"> 35 33 <a class="delete" href="#">Delete</a> 36 34 <span class="url-helper">%(action)s</span> qPloneTabs/trunk/skins/qPloneTabs/qpt_getroottabs.pt
r488 r489 6 6 title tab/description|nothing; 7 7 class python:test(visible, '', 'invisible')"> 8 <input type="checkbox" class="visibility" value="1" id="id" name="rootvis" 8 <input type="checkbox" class="visibility" value="1" id="id" name="rootvis" title="visibility" 9 9 tal:attributes="name string:i${repeat/tab/index}_${attrs/name}; 10 10 id id; 11 checked python:test(visible, 'checked', None); 12 title python:test(visible, 'Hide', 'Show')" /> 11 checked python:test(visible, 'checked', None)" /> 13 12 <span class="url-helper" tal:content="python:tab['url']">Tab Action</span> 14 <span tal:content="tab/name">Tab Name</span>13 <span class="tab-title" tal:content="tab/name">Tab Name</span> 15 14 </li> 16 15 </tal:tabs> qPloneTabs/trunk/skins/qPloneTabs/qpt_gettabslist.pt
r488 r489 8 8 class python:test(visible, '', 'invisible')"> 9 9 <img class="drag-handle" src="drag.gif" alt="" height="11" width="25" /> 10 <input type="checkbox" class="visibility" value="1" name="visibility" 10 <input type="checkbox" class="visibility" value="1" name="visibility" title="visibility" 11 11 tal:attributes="checked python:test(visible, 'checked', None); 12 name string:i${index}_${attrs/name}; 13 title python:test(visible, 'Hide', 'Show')" /> 12 name string:i${index}_${attrs/name}" /> 14 13 <a class="delete" href="#">Delete</a> 15 14 <span class="url-helper" tal:content="tab/getActionExpression|nothing">Tab Action</span> qPloneTabs/trunk/utils.py
r488 r489 9 9 return filter(lambda a: a.category == 'portal_tabs', getToolByName(self, 'portal_actions')._cloneActions()) 10 10 11 def editAction(self, num, name, id, action='', condition='' ):11 def editAction(self, num, name, id, action='', condition='', visibility=[]): 12 12 """ Function for editing given action """ 13 13 actions = getToolByName(self, 'portal_actions')._actions 14 14 tabs = filter(lambda a: a.category == 'portal_tabs', actions) 15 15 tab = tabs[int(num)] 16 if visibility != []: 17 if visibility == 'true': visibility = True 18 else: visibility = False 19 tab.visible = visibility 20 return 'Changed visibility' 16 21 if id: tab.id = id 17 22 if name: tab.title = name … … 39 44 portal_actions.deleteActions([actions.index(tabs[int(idx)]),]) 40 45 return id 46 47 def processUrl(self, url): 48 """ Return url in a right format """ 49 import re 50 if url.find('/') == 0: return 'string:${portal_url}' + url 51 elif re.compile('^(ht|f)tps?\:', re.I).search(url): return 'string:' + url 52 elif re.compile('^(python:|string:|not:|exists:|nocall:|path:)', re.I).search(url): return url 53 else: return 'string:${object_url}/' + url 54 55 def getRootTabs(self): 56 """ Return all portal root elements which are displayed in poral globalnav """ 57 stp = getToolByName(self, 'portal_properties').site_properties 58 if stp.getProperty('disable_folder_sections', True): 59 return [] 60 result = [] 61 query = {} 62 portal_path = getToolByName(self, 'portal_url').getPortalPath() 63 query['path'] = {'query':portal_path, 'navtree':1} 64 utils = getToolByName(self, 'plone_utils') 65 ct = getToolByName(self, 'portal_catalog') 66 ntp = getToolByName(self, 'portal_properties').navtree_properties 67 views = stp.getProperty('typesUseViewActionInListings', ()) 68 query['portal_type'] = utils.typesToList() 69 if ntp.getProperty('sortAttribute', False): 70 query['sort_on'] = ntp.sortAttribute 71 if (ntp.getProperty('sortAttribute', False) and ntp.getProperty('sortOrder', False)): 72 query['sort_order'] = ntp.sortOrder 73 if ntp.getProperty('enable_wf_state_filtering', False): 74 query['review_state'] = ntp.wf_states_to_show 75 query['is_default_page'] = False 76 query['is_folderish'] = True 77 excluded_ids = {} 78 for exc_id in ntp.getProperty('idsNotToList', ()): 79 excluded_ids[exc_id] = 1 80 rawresult = ct(**query) 81 for item in rawresult: 82 if not excluded_ids.has_key(item.getId): 83 item_url = (item.portal_type in views and item.getURL() + '/view') or item.getURL() 84 data = {'name' : utils.pretty_title_or_id(item), 85 'id' : item.getId, 86 'url' : item_url, 87 'description' : item.Description, 88 'exclude_from_nav' : item.exclude_from_nav} 89 result.append(data) 90 return result
