Commit 15d6ab02 authored by Sebastien Robin's avatar Sebastien Robin

2010-02-17 Seb

* Make Base_updateDialogForm and ListBox_initializeFastInput able
to support listbox with another id than "listbox"

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32662 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ba7d282
......@@ -60,18 +60,19 @@ from string import zfill\n
\n
for k in kw.keys():\n
v = kw[k]\n
if k == \'listbox\':\n
if k.endswith(\'listbox\'):\n
listbox = {}\n
listbox_key = "%s_key" % k\n
if v is not None:\n
i = 1\n
for line in v:\n
if line.has_key(\'listbox_key\'):\n
key = \'%s\' % line[\'listbox_key\']\n
if line.has_key(listbox_key):\n
key = \'%s\' % line[listbox_key]\n
else:\n
key = str(zfill(i,3))\n
listbox[key] = line\n
i+=1\n
request.set(\'listbox\',listbox)\n
request.set(k,listbox)\n
else:\n
request.set(\'my_%s\' % k, v)\n
request.set(\'%s\' % k, v)\n
......@@ -122,6 +123,7 @@ for k in kw.keys():\n
<string>_getitem_</string>
<string>v</string>
<string>listbox</string>
<string>listbox_key</string>
<string>None</string>
<string>i</string>
<string>line</string>
......
......@@ -55,7 +55,8 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempBase\n
from string import zfill\n
\n
if listbox_id is None:\n
listbox_id = \'listbox\'\n
\n
request = context.REQUEST\n
\n
......@@ -69,9 +70,10 @@ first_empty_line_id = 1\n
portal_object = context.getPortalObject()\n
int_len = 3\n
\n
if hasattr(request, \'listbox\'):\n
if hasattr(request, listbox_id):\n
listbox_key = "%s_key" % listbox_id\n
# initialize the listbox \n
listbox=request[\'listbox\']\n
listbox=request[listbox_id]\n
\n
keys_list = listbox.keys()\n
\n
......@@ -88,7 +90,7 @@ if hasattr(request, \'listbox\'):\n
for key in listbox[i]:\n
value = listbox[i][key]\n
# 0 was added because of checkbox field in some fast input\n
if (value not in [\'\',None,0]) and (key != \'listbox_key\'):\n
if (value not in [\'\',None,0]) and (key != listbox_key):\n
is_empty = 0\n
if (request.has_key(\'field_errors\')):\n
is_empty = 0\n
......@@ -119,7 +121,7 @@ return l\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>empty_line_number=0, **kw</string> </value>
<value> <string>empty_line_number=0, listbox_id=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -139,18 +141,20 @@ return l\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>empty_line_number</string>
<string>listbox_id</string>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>string</string>
<string>zfill</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
......@@ -160,6 +164,7 @@ return l\n
<string>portal_object</string>
<string>int_len</string>
<string>hasattr</string>
<string>listbox_key</string>
<string>listbox</string>
<string>keys_list</string>
<string>int</string>
......@@ -169,7 +174,6 @@ return l\n
<string>is_empty</string>
<string>key</string>
<string>value</string>
<string>None</string>
<string>range</string>
<string>str</string>
</tuple>
......@@ -185,6 +189,7 @@ return l\n
<value>
<tuple>
<int>0</int>
<none/>
</tuple>
</value>
</item>
......
1475
\ No newline at end of file
1476
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment