1 | ## Script (Python) "qpt_add" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= idx, name, action='', id, condition='' |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | |
---|
11 | if action: |
---|
12 | end = action.find(':') |
---|
13 | if end != -1: |
---|
14 | if action[:end] not in ['path', 'exists', 'nocall', 'not', 'string', 'python']: action = 'string:' + action |
---|
15 | else: action = 'string:${object_url}/' + action |
---|
16 | params = {'id':id, 'name':name, 'action':action, 'condition':condition, |
---|
17 | 'permission':'View', 'category':'portal_tabs', 'visible':1} |
---|
18 | act_tool = context.portal_actions |
---|
19 | act_tool.addAction(**params) |
---|
20 | params.update({'idx':idx, 'abs_url':context.portal_url()}) |
---|
21 | return """ |
---|
22 | <li id="tabslist_%(id)s" > |
---|
23 | <img class="drag-handle" src="drag.gif" alt="" height="11" width="25"> |
---|
24 | <a class="delete" href="#">Delete</a> |
---|
25 | <span>%(name)s</span> |
---|
26 | <form class="editform" method="post" action="%(abs_url)s/prefs_tabs_form" name="f%(idx)s"> |
---|
27 | <input type="hidden" name="idx" value="%(idx)s" /> |
---|
28 | <fieldset> |
---|
29 | <legend>Edit '%(name)s' Action</legend> |
---|
30 | <dl> |
---|
31 | <dt><label>Name</label></dt> |
---|
32 | <dd><input type="text" value="%(name)s" name="i%(idx)s_name" /></dd> |
---|
33 | </dl> |
---|
34 | <dl class="collapsible collapsedBlockCollapsible"> |
---|
35 | <dt class="collapsibleHeader">Advanced</dt> |
---|
36 | <dd class="collapsibleContent"> |
---|
37 | <dl> |
---|
38 | <dt><label>URL (Expression)</label></dt> |
---|
39 | <dd><input type="text" value="%(action)s" name="i%(idx)s_action" size="30" /></dd> |
---|
40 | </dl> |
---|
41 | <dl> |
---|
42 | <dt><label>Id</label></dt> |
---|
43 | <dd><input type="text" value="%(id)s" name="i%(idx)s_id" /></dd> |
---|
44 | </dl> |
---|
45 | <dl> |
---|
46 | <dt><label>Condition (Expression)</label></dt> |
---|
47 | <dd><input type="text" value="%(condition)s" name="i%(idx)s_condition" size="30" /></dd> |
---|
48 | </dl> |
---|
49 | <div class="visualClear"><!-- --></div> |
---|
50 | </dd> |
---|
51 | </dl> |
---|
52 | </fieldset> |
---|
53 | <div> |
---|
54 | <input type="submit" class="editsave" value="Save" /> |
---|
55 | <input type="submit" class="editcancel" value="Cancel" /> |
---|
56 | </div> |
---|
57 | </form> |
---|
58 | </li>\n""" % params |
---|