12 # distributed under the License is distributed on an "AS IS" BASIS, |
12 # distributed under the License is distributed on an "AS IS" BASIS, |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 # See the License for the specific language governing permissions and |
14 # See the License for the specific language governing permissions and |
15 # limitations under the License. |
15 # limitations under the License. |
16 |
16 |
17 """Sidebar |
17 """Module contains sidebar related functions. |
18 """ |
18 """ |
19 |
19 |
20 __authors__ = [ |
20 __authors__ = [ |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
22 ] |
22 ] |
23 |
23 |
24 |
24 |
25 from soc.views import out_of_band |
25 from soc.views import out_of_band |
26 from soc.views.helper import access |
26 from soc.views.helper import access |
|
27 |
27 |
28 |
28 SIDEBAR = [] |
29 SIDEBAR = [] |
29 |
30 |
30 |
31 |
31 def addMenu(callback): |
32 def addMenu(callback): |
96 request: the django request object |
97 request: the django request object |
97 params: a dict with params for this View |
98 params: a dict with params for this View |
98 |
99 |
99 Params usage: |
100 Params usage: |
100 The params dictionary is passed as argument to getSidebarItems, |
101 The params dictionary is passed as argument to getSidebarItems, |
101 see the docstring of getSidebarItems on how it uses it. |
102 see the docstring of getSidebarItems on how it uses it. |
102 |
103 |
103 rights: The rights dictionary is used to check if the user has |
104 rights: The rights dictionary is used to check if the user has |
104 the required rights to see a sidebar item. |
105 the required rights to see a sidebar item. |
105 See checkAccess for more details on how the rights dictionary |
106 See checkAccess for more details on how the rights dictionary |
106 is used to check access rights. |
107 is used to check access rights. |
107 sidebar_heading: The sidebar_heading value is used to set the |
108 sidebar_heading: The sidebar_heading value is used to set the |
108 heading variable in the result. |
109 heading variable in the result. |
109 name: The name value is used if sidebar_heading is not present. |
110 name: The name value is used if sidebar_heading is not present. |
110 |
111 |
111 Returns: A dictionary is returned with it's 'heading' value set |
112 Returns: |
112 as explained above. It's 'items' value is constructed by |
113 A dictionary is returned with it's 'heading' value set as explained above. |
113 calling _getSidebarItems. It constists of dictionaries with a |
114 It's 'items' value is constructed by calling _getSidebarItems. It constists |
114 url and a title field. |
115 of dictionaries with a url and a title field. |
115 """ |
116 """ |
116 |
117 |
117 rights = params['rights'] |
118 rights = params['rights'] |
118 |
119 |
119 items = [] |
120 items = [] |