-[%- USE LxERP -%][%- USE L -%][%- USE HTML -%][%- USE JavaScript -%][% SET style="width: 500px" %]
+[%- USE LxERP -%][%- USE L -%][%- USE HTML -%][% SET style="width: 500px" %]
[% DEFAULT id_base = 'edit_text_block_' _ SELF.text_block.id %]
<form method="post" id="[% id_base %]_form">
<h2>
[%- END %]
</h2>
- [% L.hidden_tag(id_base _ '_id', SELF.text_block.id) %]
+ [% L.hidden_tag('form_prefix', id_base, id=id_base _ '_form_prefix') %]
+ [% L.hidden_tag('id', SELF.text_block.id, id=id_base _ '_id') %]
[% L.hidden_tag(id_base _ '.requirement_spec_id', SELF.text_block.requirement_spec_id) %]
[% L.hidden_tag(id_base _ '.output_position', SELF.text_block.output_position) %]
[% IF insert_after %]
<tr>
<th align="right" valign="top">[%- LxERP.t8("Description") %]:</th>
- <td valign="top">[% L.textarea_tag(id_base _ '.text', SELF.text_block.text, style = style, rows = 10) %]</td>
+ <td valign="top">[% L.textarea_tag(id_base _ '.text_as_restricted_html', SELF.text_block.text_as_restricted_html, id = id_base _ '_text', style = style _ '; height: 200px', class='texteditor') %]</td>
</tr>
</table>
<p>
- [% L.button_tag('submit_edit_text_block_form("' _ id_base _ '")', LxERP.t8('Save')) %]
- <a href="#" onclick="cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
+ [%- L.ajax_submit_tag('controller.pl?action=RequirementSpecTextBlock/ajax_' _ (SELF.text_block.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %]
+ <a href="#" onclick="kivi.requirement_spec.cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
</p>
[%- IF SELF.predefined_texts.size %]
<script type="text/javascript">
<!--
-function insert_selected_predefined_text() {
- var data = {
-[%- FOREACH pt = SELF.predefined_texts %]
- [% HTML.escape(pt.id) %]: {
- title: "[% JavaScript.escape(pt.title) %]",
- text: "[% JavaScript.escape(pt.text) %]"
- }[% UNLESS loop.last %],[% END %]
-[% END %]
- }
-
- var id = $('#[% id_base %]_predefined_text_block').val();
- var pt = data[id];
- if (!pt) {
- console.log("insert: case 1; id: " + id);
- return false;
- }
-
- var title_ctrl = $('#[% id_base %]_title');
-
- if ( ((title_ctrl.val() || '') != '')
- && ((pt.title || '') != '')
- && confirm('[%- LxERP.t8("Do you want to overwrite your current title?") %]'))
- title_ctrl.val(pt.title);
-
- if ((pt.text || '') != '') {
- var text_ctrl = $('#[% id_base %]_text');
- var text = text_ctrl.val() || '';
- if (text != '')
- text += "\n\n";
-
- text_ctrl.val(text + pt.text);
- }
-
- return false;
-}
+[% INCLUDE 'requirement_spec_text_block/_predefined_text_inserter.js' title_ctrl_id='_title' text_ctrl_id='_text' %]
-->
</script>
[%- END %]