Commit 58910f7c authored by Jean-Paul Smets's avatar Jean-Paul Smets

2007-01-01 JPS - Various changes to support Web mode

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11830 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 062c6f65
...@@ -66,6 +66,20 @@ function submitAction(form,act) {\n ...@@ -66,6 +66,20 @@ function submitAction(form,act) {\n
form.submit();\n form.submit();\n
}\n }\n
\n \n
// The first input element with an "autofocus" class will get the focus,\n
// else, the first input is chosen.\n
// XXX - this requires to be fixed\n
function autoFocus() {\n
var inputs = document.getElementsByTagName("input");\n
var input_to_focus = inputs[0];\n
for (i=0;i<inputs.length;i++) {\n
if (inputs[i].className == "autofocus") {\n
input_to_focus = inputs[i];\n
}\n
}\n
input_to_focus.focus();\n
}\n
\n
function fixLeftRightHeight(){\n function fixLeftRightHeight(){\n
var lh = 0;\n var lh = 0;\n
var lfieldset;\n var lfieldset;\n
...@@ -101,7 +115,11 @@ function fixLeftRightHeight(){\n ...@@ -101,7 +115,11 @@ function fixLeftRightHeight(){\n
rfieldset.style.marginLeft = "-11px";\n rfieldset.style.marginLeft = "-11px";\n
}\n }\n
}\n }\n
\n
function fixLeftRightHeightAndFocus() { \n
fixLeftRightHeight();\n
autoFocus();\n
}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -71,7 +71,8 @@ ...@@ -71,7 +71,8 @@
dummy python: request.set(\'here\', here);\n dummy python: request.set(\'here\', here);\n
\n \n
global css_list css_list | python: [];\n global css_list css_list | python: [];\n
dummy python: css_list.append(\'%s/erp5.css\' % (portal_path, ));\n css_list_template css_list_template | python: [\'%s/erp5.css\' % (portal_path, )];\n
dummy python: css_list.extend(css_list_template);\n
global js_list js_list | python: [];\n global js_list js_list | python: [];\n
dummy python: js_list.append(\'%s/erp5.js\' % (portal_path, ));\n dummy python: js_list.append(\'%s/erp5.js\' % (portal_path, ));\n
\n \n
......
...@@ -87,14 +87,17 @@ IDEAS:\n ...@@ -87,14 +87,17 @@ IDEAS:\n
layout_form_id here/getApplicableLayout | nothing;\n layout_form_id here/getApplicableLayout | nothing;\n
layout_form python: layout_form_id and getattr(here, layout_form_id, None) or None;\n layout_form python: layout_form_id and getattr(here, layout_form_id, None) or None;\n
is_web_mode python: (layout_form is not None) and (not ignore_layout);\n is_web_mode python: (layout_form is not None) and (not ignore_layout);\n
editable_mode python: (not is_web_mode) or request.get(\'editable_mode\', 0);\n editable_mode python: (not is_web_mode) or request.get(\'editable_mode\', False);\n
editable_mode_backup editable_mode;\n
dummy python: request.set(\'editable_mode\', editable_mode);\n dummy python: request.set(\'editable_mode\', editable_mode);\n
page_template python: is_web_mode and ((layout_form.meta_type==\'Page Template\' and layout_form.id) or getattr(layout_form, \'pt\', None)) or \'template_erp5_xhtml_style\';">\n page_template python: is_web_mode and ((layout_form.meta_type==\'Page Template\' and layout_form.id) or getattr(layout_form, \'pt\', None)) or \'template_erp5_xhtml_style\';">\n
<tal:block metal:use-macro="python: getattr(here, page_template).macros[\'master\']">\n <tal:block metal:use-macro="python: getattr(here, page_template).macros[\'master\']">\n
<tal:block metal:fill-slot="context_bar">\n <tal:block metal:fill-slot="context_bar">\n
<tal:block metal:define-slot="context_bar"/>\n <tal:block metal:define-slot="context_bar"/>\n
</tal:block>\n </tal:block>\n
<tal:block metal:fill-slot="main">\n <tal:block metal:fill-slot="main"\n
tal:define="editable_mode editable_mode_backup;\n
dummy python: request.set(\'editable_mode\', editable_mode);">\n
<tal:block metal:define-slot="main"/>\n <tal:block metal:define-slot="main"/>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
......
...@@ -98,7 +98,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n ...@@ -98,7 +98,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
tal:define="actions actions/object_view | python: []">\n tal:define="actions actions/object_view | python: []">\n
<div class="actions"\n <div class="actions"\n
tal:condition="python: (not is_web_mode or editable_mode) and len(actions)">\n tal:condition="python: (not is_web_mode or editable_mode) and len(actions)">\n
<button tal:condition="form_action"\n <button tal:condition="python: not is_web_mode and form_action"\n
type="submit" class="save" title="Save"\n type="submit" class="save" title="Save"\n
tal:attributes="name python: \'%s:method\' % (form_action, )"\n tal:attributes="name python: \'%s:method\' % (form_action, )"\n
i18n:attributes="title" i18n:domain="ui">\n i18n:attributes="title" i18n:domain="ui">\n
...@@ -117,6 +117,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n ...@@ -117,6 +117,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
<div tal:attributes="class python: editable_mode and \'content editable\' or \'content\'">\n <div tal:attributes="class python: editable_mode and \'content editable\' or \'content\'">\n
<tal:block metal:define-slot="main"/>\n <tal:block metal:define-slot="main"/>\n
</div>\n </div>\n
<div class="bottom_actions"\n
tal:condition="python: is_web_mode and editable_mode and len(actions) and form_action">\n
<input type="hidden" name="form_action" value=""\n
tal:attributes="value form_action"/>\n
<input type="hidden" name="edit_document_url" value=""\n
tal:attributes="value python:here.WebSite_getDocumentUrl(form_id=form_id, ignore_reference=1)"/>\n
<input type="hidden" name="view_document_url" value=""\n
tal:attributes="value python:here.WebSite_getDocumentUrl(form_id=\'view\', ignore_reference=1)"/>\n
<button type="submit" class="saveView" title="Save &amp; View"\n
name="Base_editAndViewAsWeb:method"\n
i18n:attributes="title" i18n:domain="ui">\n
<span class="image"></span>\n
<span class="description" i18n:translate="" i18n:domain="ui">Save &amp; View</span>\n
</button>\n
<button type="submit" class="saveEdit" title="Save &amp; Edit"\n
name="Base_editAndEditAsWeb:method"\n
i18n:attributes="title" i18n:domain="ui">\n
<span class="image"></span>\n
<span class="description" i18n:translate="" i18n:domain="ui">Save &amp; Edit</span>\n
</button>\n
</div>\n
</div>\n </div>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
......
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