aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AMenuManager/admin/amm_randompicconfig.tpl
blob: df70311f01ca80d2119cd4271a998626746b16f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{literal}
<script type="text/javascript">

  //global var ; need to not have to initialize them every time a value is changed
  var objlang;
  var objnames = new Array('iamm_randompicture_title');
  var objinput = new Array();   //input text from form => objinput[name]
  var objhidden = new Array();  //input hidden from form => objhidden[name][lang]

  function init()
  {
    objlang = document.getElementById('islang');
    for(i=0;i<objnames.length;i++)
    {
      objinput[i] = document.getElementById(objnames[i]);
      objhidden[i] = new Array();
      for(j=0;j<objlang.options.length;j++)
      {
        objhidden[i][j] = document.getElementById(objnames[i]+'_'+objlang.options[j].value);
      }
    }
  }

  function change_lang()
  {
    for(i=0;i<objnames.length;i++)
    {
      objinput[i].value = objhidden[i][objlang.options.selectedIndex].value;
    }
  }

  function apply_changes(input_id)
  {
    var obj=document.getElementById(input_id);
    objhidden[objnames.indexOf(input_id)][objlang.options.selectedIndex].value = obj.value;
  }

  function do_translation()
  {
    var inputid = document.getElementById('iamm_randompicture_title');
    var tolang = objlang.options[objlang.options.selectedIndex].value.substr(0,2);

    google_translate(inputid.value, '{/literal}{$datas.fromlang}{literal}', tolang, inputid, 'value', apply_changes, inputid.id);

  }


</script>
{/literal}



<h3>{'g002_configrandompic'|@translate}</h3>


<form method="post" action="" class="general">
  <fieldset>
    <legend>{'g002_setting_block_menu'|@translate}</legend>

    {if isset($datas.language_list) and count($datas.language_list)}
      {foreach from=$datas.language_list key=name item=language_row}
        <input type="hidden" name="famm_randompicture_title_{$language_row.LANG}"
                id="iamm_randompicture_title_{$language_row.LANG}" value="{$language_row.MENUBARTIT}">
      {/foreach}
    {/if}

    <table class="formtable">
      <tr>
        <td>{'g002_setting_block_active'|@translate}</td>
        <td>
          <select name="famm_randompicture_active" id="iamm_randompicture_active">
            {html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.active_selected}
          </select>
        </td>
      </tr>

      <tr>
        <td>{'g002_setting_block_title'|@translate}</td>
        <td>
          <input type="text" id="iamm_randompicture_title" value="" maxlength="50" onkeyup="apply_changes('iamm_randompicture_title');" onblur="apply_changes('iamm_randompicture_title');"/>
          <select onchange="change_lang();" id="islang">
            {html_options values=$datas.language_list_values output=$datas.language_list_labels selected=$datas.lang_selected}
          </select><br>
        </td>
      </tr>
      <tr>
        <td></td>
        <td style="font-size:80%;">
          <a style="cursor:pointer;" onclick="do_translation()">{'g002_translate'|@translate}</a>
        </td>
      </tr>

    </table>

  </fieldset>

  <fieldset>
    <legend>{'g002_setting_randompic_aboutpicture'|@translate}</legend>
      <table class="formclass">
        <tr>
          <td>{'g002_setting_randompic_showname'|@translate}</td>
          <td>
            <select name="famm_randompicture_showname" id="iamm_randompicture_showname">
              {html_options values=$datas.show_values output=$datas.show_labels selected=$datas.showname_selected}
            </select>
          </td>
        </tr>

        <tr>
          <td>{'g002_setting_randompic_showcomment'|@translate}</td>
          <td>
            <select name="famm_randompicture_showcomment" id="iamm_randompicture_showcomment">
              {html_options values=$datas.show_values output=$datas.show_labels selected=$datas.showcomment_selected}
            </select>
          </td>
        </tr>

      </table>
  </fieldset>

  <p>
    <input type="submit" name="famm_submit_apply" id="iamm_submit_apply" value="{'g002_apply'|@translate}" >
  </p>

  <input type="hidden" name="famm_modeedit" value="config">

</form>

<script type="text/javascript">
  init();
  change_lang();
</script>