source: extensions/mypolls/admin/plugin_admin_create2.tpl @ 17449

Last change on this file since 17449 was 3397, checked in by grum, 15 years ago

Add plugin MyPolls - this release is not published in PEM (functionnal but not tested yet...)

  • Property svn:executable set to *
File size: 5.9 KB
Line 
1<!-- manage poll's questions -->
2
3{literal}
4<script type="text/javascript">
5
6var answers = new Array();
7var next_question_id = 0;
8
9  function enabled_submit()
10  {
11    var objquestion = document.getElementById('iquestion');
12    var objansw1 = document.getElementById('iansw0');
13    var objansw2 = document.getElementById('iansw1');
14    var objbutton = document.getElementById('isubmit1');
15    var objqtype = document.getElementById('iqtype');
16    var objmax = document.getElementById('imaxanswers');
17    var objallowcreate = document.getElementById('iallowcreate');
18
19    if((objquestion.value.length>0)&&(objansw1.value.length>0)&&(objansw2.value.length>0))
20    { objbutton.disabled=false; } else { objbutton.disabled=true; }
21    if((objqtype.value=='multi')&&(objmax.value.length==0))
22    { objbutton.disabled=true; }
23    if(objbutton.disabled==true)
24    { objallowcreate.value="n"; } else { objallowcreate.value="y"; }
25  }
26
27  function change_qtype()
28  {
29    var objqtype = document.getElementById('iqtype');
30    var objmax = document.getElementById('imaxanswers');
31
32    if(objqtype.value=='multi')
33    { objmax.disabled=false; } else { objmax.disabled=true; }
34    enabled_submit();
35  }
36
37  function add_answer(ans_value, ans_id)
38  {
39    answers[answers.length] = new Array(ans_value, ans_id);
40    next_question_id++;
41  }
42
43  function init_answers_list()
44  {
45    {/literal}{$datas.MYPOLLS_INIT_ANSWERS_LIST}{literal}
46    next_question_id={/literal}{$datas.MYPOLLS_NEXT_QUESTION}{literal};
47  }
48
49  function display_answers_list()
50  {
51    var objanswers = document.getElementById('ianswers');
52
53    text='<ol>';
54    for(i=0;i<answers.length;i++)
55    {
56      obj=document.getElementById('iansw'+answers[i][1]);
57
58      if(obj!=null)
59      {answers[i][0]=obj.value;}
60
61      text+='<li style="padding-bottom:3px;">';
62      text+='<input type="text" name="fmypolls_att_answ'+answers[i][1]+'" id="iansw'+answers[i][1]+'" maxlength=250 size=80 value="'+answers[i][0]+'" ';
63      if(i<=1)
64      {
65        text+='onkeyup="enabled_submit()" onblur="enabled_submit()">';
66        text+='&nbsp;<sup style="color:rgb(255,255,0)">*</sup';
67      }
68      text+='></li>';
69    }
70    text+='</ol>';
71    text+='<input type="button" value="{/literal}{'mypolls_add_answer'|@translate}{literal}" onclick="add_answer(\'\', next_question_id);display_answers_list();">';
72
73    objanswers.innerHTML = text;
74
75  }
76</script>
77{/literal}
78
79<div>
80  <div style="text-align:right;margin:0px;margin-right:8px;float:right;{$datas.MYPOLLS_ICN_HIDDEN}">
81    <a href="{$datas.MYPOLLS_LNK_VIEW}" title="{'mypolls_list_lnk_view'|@translate}">
82    <img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'mypolls_list_lnk_view'|@translate}"/></a>
83    <a href="{$datas.MYPOLLS_LNK_MODIFY}" title="{'mypolls_list_lnk_modify_parent'|@translate}">
84    <img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'mypolls_list_lnk_modify_parent'|@translate}"/></a>
85  </div>
86  <i>{'mypolls_cm_stars_are_needed'|@translate}</i>
87</div>
88
89
90<form method="post" action="" class="general">
91
92  <fieldset >
93    <table class="formtable">
94      <tr>
95        <td>{'mypolls_att_language'|@translate}</td>
96        <td>
97          <input type="hidden" name="fmypolls_att_default_lang" value="{$datas.MYPOLLS_ATT_LANG}">
98          <select  disabled>
99            {html_options values=$mypolls_language_list_values output=$mypolls_language_list_labels selected=$mypolls_language_selected}
100          </select>
101        </td>
102      </tr>
103    </table>
104  </fieldset >
105
106  <fieldset >
107    <legend>{'mypolls_cm_question'|@translate}</legend>
108    <table class="formtable">
109      <tr>
110        <td>{'mypolls_cm_question'|@translate}<sup style="color:rgb(255,255,0)">*</sup></td>
111        <td>
112          <textarea name="fmypolls_att_description"
113                    id="iquestion"
114                    rows=6 cols=80
115                    onkeyup="enabled_submit()"
116                    onblur="enabled_submit()">{$datas.MYPOLLS_ATT_DESCRIPTION}</textarea>
117        </td>
118      </tr>
119
120      <tr>
121        <td>{'mypolls_att_question_type'|@translate}</td>
122        <td>
123          <select name="fmypolls_att_question_type" onchange="change_qtype();" id="iqtype">
124            {html_options values=$mypolls_question_type_list_values output=$mypolls_question_type_list_labels selected=$mypolls_question_type_selected}
125          </select>
126        </td>
127      </tr>
128
129      <tr>
130        <td>{'mypolls_att_multi_max_answers'|@translate}</td>
131        <td>
132          <input type="text" name="fmypolls_att_multi_max_answers" id="imaxanswers"
133                  value="{$datas.MYPOLLS_ATT_MULTI_MAX_ANSWERS}" maxlength=2 size=5
134                  onkeyup="enabled_submit()"
135                  onblur="enabled_submit()">
136        </td>
137      </tr>
138
139    </table>
140  </fieldset>
141
142  <fieldset >
143    <legend>{'mypolls_cm_answers'|@translate}</legend>
144    <div class="formtable" id="ianswers">
145      <script type="text/javascript">init_answers_list();display_answers_list();</script>
146    </div>
147  </fieldset>
148
149
150  <input type="hidden" name="mypolls_step" value="{$datas.MYPOLLS_STEP_VALUE}">
151  <input type="hidden" name="fmypolls_att_id" value="{$datas.MYPOLLS_ATT_ID}">
152  <input type="hidden" name="mypolls_allow_create" value="n" id="iallowcreate">
153  <input type="hidden" name="action" value="{$datas.MYPOLLS_ACTION}">
154
155  {if isset($datas.mypolls_adding_question) and $datas.mypolls_adding_question=='yes'}
156    <p>
157      <input type="submit" name="fmypolls_add_question" id="isubmit1" value="{'mypolls_cnp_submit4'|@translate}" >
158    </p>
159  {/if}
160
161  {if isset($datas.mypolls_en_modification) and $datas.mypolls_en_modification=='yes'}
162    <p>
163      <input type="submit" name="fmypolls_modify_question" id="isubmit1" value="{'mypolls_mp_submit'|@translate}" >
164      <input type="submit" name="fmypolls_delete_question" value="{'mypolls_dqp_submit'|@translate}" >
165    </p>
166  {/if}
167
168</form>
169
170<script type="text/javascript">
171  change_qtype();
172  enabled_submit();
173</script>
Note: See TracBrowser for help on using the repository browser.