1+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
12< html >
2- < head >
3- < link rel ="stylesheet " type ="text/css " href ="_file/style.css ">
4- < meta http-equiv ="Content-Type " content ="text/html; charset=utf-8; ">
5- < script language ="JavaScript "
6- tal:condition ="python:request.form.has_key('property') "
7- tal:content ="structure string:
3+ < head >
4+ < link rel ="stylesheet " type ="text/css " href ="_file/style.css " />
5+ < meta http-equiv ="Content-Type " content ="text/html; charset=utf-8; " />
6+ < tal:block tal:condition ="python:request.form.has_key('property') ">
7+ < title tal:content ="string:${request/form/property/value} help "> Property</ title >
8+ < script language ="Javascript " type ="text/javascript "
9+ tal:content ="structure string:
10+ // this is the name of the field in the original form that we're working on
11+ field = '${request/form/property/value}'; " >
12+ </ script >
13+ < script src ="_file/help_controls.js " type ="text/javascript "> <!--
14+ //--> </ script >
15+ </ tal:block >
16+ </ head >
17+ < body class ="body " marginwidth ="0 " marginheight ="0 " onload ="resetList(); ">
18+ < form name ="frm_help " action ="">
19+
20+ < div id ="classhelp-controls ">
21+ <!--input type="button" name="btn_clear"
22+ value="Clear" onClick="clearList()"/ -->
23+ < input type ="text " name ="text_preview " size ="24 " class ="preview "
24+ onchange ="reviseList(this.value); "/>
25+ < input type ="button " name ="btn_reset "
26+ value =" Cancel " onclick ="resetList(); window.close(); "/>
27+ < input type ="button " name ="btn_apply " class ="apply "
28+ value =" Apply " onclick ="updateList(); window.close(); "/>
29+ </ div >
830
9- // this is the name of the field in the original form that we're working on
10- field = '${request/form/property/value}';
31+ < table class ="classhelp "
32+ tal:define ="props python:request.form['properties'].value.split(',') ">
33+ < tr >
34+ < th > < b > x</ b > </ th >
35+ < th tal:repeat ="prop props " tal:content ="prop "> </ th >
36+ </ tr >
37+ < tr tal:repeat ="item context/list ">
38+ < td >
39+ < input type ="checkbox " name ="check "
40+ onclick ="updatePreview(); "
41+ tal:define ="attr python:item[props[0]] "
42+ tal:attributes ="value attr; id attr " />
43+ </ td >
44+ < td tal:repeat ="prop props ">
45+ < label class ="classhelp-label "
46+ tal:attributes ="for python:item[props[0]] "
47+ tal:content ="structure python:item[prop] "> </ label >
48+ </ td >
49+ </ tr >
50+ < tr >
51+ < th > < b > x</ b > </ th >
52+ < th tal:repeat ="prop props " tal:content ="prop "> </ th >
53+ </ tr >
54+ </ table >
1155
12- function listClose() {
13- window.close();
14- }
15-
16- function listClear() {
17- window.opener.document.itemSynopsis[field].value = '';
18- }
19-
20- function pick(opt) {
21- if (window.opener && !window.opener.closed) {
22- window.opener.document.itemSynopsis[field].value = opt;
23- }
24- }
25-
26- // add a value to the form field
27- function add(opt) {
28- val = window.opener.document.itemSynopsis[field].value;
29- if (/^\s*$$/.test(val)) {
30- newval = opt; // existing is all whitespace, so just replace
31- } else {
32- newval = val + ', ' + opt;
33- }
34- pick(newval);
35- }
36-
37- // remove a value from the form field
38- function remove(opt) {
39- // ((opt(,\s*)?)|(,\s*opt))
40- replaceStr = new String('(('+opt+'(,\\s*)?)|(,\\s*'+opt+'))');
41- re = new RegExp(replaceStr);
42-
43- str = window.opener.document.itemSynopsis[field].value;
44-
45- // replace occurences with empty string
46- newstr = str.replace(re, '');
47- pick(newstr);
48- }
49- ">
50- </ script >
51- </ head >
52-
53- < body class ="body " marginwidth ="0 " marginheight ="0 ">
54- < form >
55- < div style ="padding:10px;text-align:center; ">
56- < script language ="javascript ">
57- // put up a 'reset' button if the field has values when we pop up this window
58-
59- // this is the name of the field in the original form that we're working on
60- orig = window . opener . document . itemSynopsis [ field ] . value ;
61- if ( / [ ^ \s ] / . test ( orig ) ) {
62- reset = '<input type="button" onclick="pick(orig);" ' +
63- 'value="Reset to original values" /> | ' ;
64- document . write ( reset ) ;
65- }
66- </ script >
67- < input type ="button "
68- tal:attributes ="value string:Clear all ${request/form/property/value} values "
69- onclick ="listClear(); " /> |
70- < input type ="button " onclick ="listClose(); " value ="Close this window " />
71- </ div >
72-
73- < table class ="classhelp "
74- tal:define ="props python:request.form['properties'].value.split(',') ">
75- < tr >
76- < th tal:condition ="python:request.form.has_key('property') "> add/remove</ th >
77- < th tal:repeat ="prop props " tal:content ="prop "> </ th >
78- </ tr >
79- < tr tal:repeat ="item context/list ">
80- < td tal:condition ="python:request.form.has_key('property') ">
81- < input type ="button " tal:define ="opt python: item[props[0]] "
82- tal:attributes ="onclick string:add('${opt}') " value =" + ">
83- < input type ="button " tal:define ="opt python: item[props[0]] "
84- tal:attributes ="onclick string:remove('${opt}') " value =" - " />
85- </ td >
86- < td tal:repeat ="prop props " tal:content ="structure python:item[prop] "> </ td >
87- </ tr >
88- </ table >
89- </ form >
90- </ body >
91- </ html >
56+ </ form >
57+ </ body >
58+ </ html >
0 commit comments