<div class="adminnavi">
  <{if $module != null}>
    <a href="<{$smarty.const.XOOPS_URL}>/modules/<{$module->getShow('dirname')}>/<{$module->getInfo('adminindex')|xoops_escape}>"><{$module->getShow('name')}></a>
    <{if $category != null}>
      &raquo;&raquo; <a href="<{$smarty.const.XOOPS_URL}>/modules/<{$module->getVar('dirname')}>/admin/index.php?action=PreferenceList"><{$smarty.const._MI_LEGACY_MENU_PREFERENCE}></a>
      &raquo;&raquo; <{$category->getName()|xoops_escape}>
    <{else}>
      &raquo;&raquo; <span class="adminnaviTitle"><{$smarty.const._MI_LEGACY_MENU_PREFERENCE}></span>
    <{/if}>
  <{else}>
    <a href="<{$smarty.const.XOOPS_URL}>/modules/legacy/admin/index.php"><{$smarty.const._MI_LEGACY_NAME}></a>
    &raquo;&raquo; <a href="./index.php?action=PreferenceList"><{$smarty.const._MI_LEGACY_MENU_PREFERENCE}></a>
    &raquo;&raquo; <span class="adminnaviTitle"><{$category->getName()|xoops_escape}></span>
  <{/if}>
</div>

<h3 class="admintitle">
  <{if $category != null}>
    <{$category->getName()|xoops_escape}>
  <{else}>
    <{$smarty.const._MI_LEGACY_MENU_PREFERENCE}>
  <{/if}>
</h3>

<{if $actionForm->hasError()}>
<div class="error">
  <ul>
    <{foreach item=message from=$actionForm->getErrorMessages()}>
      <li><{$message|xoops_escape}></li>
    <{/foreach}>
  </ul>
</div>
<{/if}>

<form action="./index.php?action=PreferenceEdit" method="post">
  <{xoops_token form=$actionForm}>
  <{xoops_input type=hidden name=$actionForm->mKeyName value=$actionForm->mKeyValue}>
  <table class="outer">
    <tr>
      <th colspan="2">
        <{$smarty.const._MI_LEGACY_MENU_PREFERENCE}>
        <{if $category != null}>
           - <{$category->getName()|xoops_escape}>
        <{/if}>
      </th>
    </tr>

    <{foreach item=config from=$objectArr}>
      <tr>
        <td class="head">
          <div class="legacy_list_title"><{$config->getTitle()}>
          <{if $config->get('conf_desc') != null}>
            <p class="legacy_list_description"><{$config->getDesc()}></p>
          <{/if}>
          </div>
        </td>
        <td class="<{cycle values="odd,even"}>">
          <{if $config->get('conf_formtype') == 'textarea'}>
            <{xoops_textarea name=$config->getVar('conf_name') rows=5 cols=50 value=$actionForm->get($config->get('conf_name'))}>


          <{elseif $config->get('conf_formtype') == 'server_module'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{foreach item=option from=$config->getRoledModuleList()}>
                <option value='<{$option}>' <{if $actionForm->get($config->get('conf_name')) == $option}>selected="selected"<{/if}>><{$option}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'select'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{foreach item=option from=$config->getOptionItems()}>
                <option value='<{$option->getOptionKey()|xoops_escape}>' <{if $actionForm->get($config->get('conf_name')) == $option->getOptionKey()}>selected="selected"<{/if}>><{$option->getOptionLabel()|xoops_escape}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'select_multi'}>
            <select name='<{$config->getVar('conf_name')}>[]' id='legacy_xoopsform_<{$config->getVar('conf_name')}>' size='5' multiple="multiple">
              <{foreach item=option from=$config->getOptionItems()}>
                <{assign var=flag value=0}>
                <{foreach item=selected from=$actionForm->get($config->get('conf_name'))}>
                  <{if $option->getOptionKey() == $selected}><{assign var=flag value=1}><{/if}>
                <{/foreach}>
                <option value="<{$option->getOptionKey()|xoops_escape}>" <{if $flag}>selected="selected"<{/if}>><{$option->getOptionLabel()|xoops_escape}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'yesno'}>
            <{*TODO ID conflict*}>
            <label><{xoops_input type=radio name=$config->get('conf_name') value=1 default=$actionForm->get($config->get('conf_name'))}><{$smarty.const._YES}></label>
            <label><{xoops_input type=radio name=$config->get('conf_name') value=0 default=$actionForm->get($config->get('conf_name'))}><{$smarty.const._NO}></label>


          <{elseif $config->get('conf_formtype') == 'theme'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{xoops_optionsArray id=$config->getVar('conf_name') value=dirname label=dirname from=$themeArr default=$actionForm->get($config->get('conf_name'))}>
            </select>

            
          <{elseif $config->get('conf_formtype') == 'theme_multi'}>
            <select name='<{$config->getVar('conf_name')}>[]' id='legacy_xoopsform_<{$config->getVar('conf_name')}>' size='5' multiple="multiple">
              <{xoops_optionsArray id=$config->getVar('conf_name') value=dirname label=dirname from=$themeArr default=$actionForm->get($config->get('conf_name'))}>
            </select>
            
            
          <{elseif $config->get('conf_formtype') == 'tplset'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{xoops_optionsArray id=$config->getVar('conf_name') value=tplset_name label=tplset_name from=$tplsetArr default=$actionForm->get($config->get('conf_name'))}>
            </select>
            
            
          <{elseif $config->get('conf_formtype') == 'timezone'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{xoops_optionsArray id=$config->getVar('conf_name') value=offset label=zone_name from=$timezoneArr default=$actionForm->get($config->get('conf_name'))}>
            </select>


          <{elseif $config->get('conf_formtype') == 'language'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{foreach item=language from=$languageArr}>
                <option value="<{$language|xoops_escape}>" <{if $actionForm->get($config->get('conf_name')) == $language}>selected="selected"<{/if}>><{$language|xoops_escape}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'startpage'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <option value="--"><{$smarty.const._AD_LEGACY_LANG_NONE}></option>
              <{xoops_optionsArray id=$config->getVar('conf_name') value=mid label=name from=$moduleArr default=$actionForm->get($config->get('conf_name'))}>
            </select>
            
            
          <{elseif $config->get('conf_formtype') == 'group'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{xoops_optionsArray id=$config->getVar('conf_name') value=groupid label=name from=$groupArr default=$actionForm->get($config->get('conf_name'))}>
            </select>


          <{elseif $config->get('conf_formtype') == 'group_multi'}>
            <select name='<{$config->getVar('conf_name')}>[]' id='legacy_xoopsform_<{$config->getVar('conf_name')}>' size='3' multiple="multiple">
              <{foreach item=group from=$groupArr}>
                <{assign var=flag value=0}>
                <{foreach item=selected from=$actionForm->get($config->get('conf_name'))}>
                  <{if $group->get('groupid') == $selected}><{assign var=flag value=1}><{/if}>
                <{/foreach}>
                <option value="<{$group->getVar('groupid')}>" <{if $flag}>selected="selected"<{/if}>><{$group->getVar('name')}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'user'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{foreach key=value item=label from=$userArr}>
                <option value="<{$value|xoops_escape}>" <{if $value == $actionForm->get($config->get('conf_name'))}>selected<{/if}>><{$label|xoops_escape}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'user_multi'}>
            <select name='<{$config->getVar('conf_name')}>[]' id='legacy_xoopsform_<{$config->getVar('conf_name')}>' size='3' multiple="multiple">
              <{foreach key=value item=label from=$userArr}>
                <{assign var=flag value=0}>
                <{foreach item=selected from=$actionForm->get($config->get('conf_name'))}>
                  <{if $value == $selected}><{assign var=flag value=1}><{/if}>
                <{/foreach}>
                <option value="<{$value|xoops_escape}>" <{if $flag}>selected="selected"<{/if}>><{$label|xoops_escape}></option>
              <{/foreach}>
            </select>


          <{elseif $config->get('conf_formtype') == 'module_cache'}>
            <{foreach item=module from=$moduleArr}>
              <{$module->getVar('name')}>
                <select name="<{$config->getVar('conf_name')}>[<{$module->getVar('mid')}>]" id="legacy_xoopsform_<{$config->getVar('conf_name')}>_<{$module->getVar('mid')}>">
                  <{foreach item=cachetime from=$cachetimeArr}>
                    <{if $actionForm->get($config->get('conf_name'), $module->get('mid')) == $cachetime->get('cachetime')}>
                      <option value="<{$cachetime->getVar('cachetime')}>" selected="selected"><{$cachetime->getVar('label')}></option>
                    <{else}>
                      <option value="<{$cachetime->getVar('cachetime')}>"><{$cachetime->getVar('label')}></option>
                    <{/if}>
                  <{/foreach}>
                </select>
              <br/>
            <{/foreach}>
            
            
          <{elseif $config->get('conf_formtype') == 'password'}>
            <{xoops_input type=password name=$config->get('conf_name') size=50 maxlength=255 value=$actionForm->get($config->get('conf_name'))}>


          <{elseif $config->get('conf_formtype') == 'textbox'}>
            <{xoops_input type=text name=$config->get('conf_name') size=50 maxlength=255 value=$actionForm->get($config->get('conf_name'))}>

          <{elseif $config->get('conf_formtype') == 'text'}> <{* deprecated *}>
            <{xoops_input type=text name=$config->get('conf_name') size=50 maxlength=255 value=$actionForm->get($config->get('conf_name'))}>

          <{/if}>
        </td>
      </tr>
    <{/foreach}>
    <tr>
      <td colspan="2" class="foot">
        <input class="formButton" type="submit" value="<{$smarty.const._SUBMIT}>" />
        <input class="formButton" type="submit" value="<{$smarty.const._BACK}>" name="_form_control_cancel" />
      </td>
    </tr>
  </table>
</form>
