<div class="adminnavi">
  <{if $module != null}>
    <a href="<{$smarty.const.XOOPS_URL}>/modules/<{$module->getVar('dirname')}>/admin/index.php"><{$module->getVar('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()|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()|escape}></span>
  <{/if}>
</div>

<h3 class="admintitle">
  <{if $category != null}>
    <{$category->getName()|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|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()|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') == 'select'}>
            <select name='<{$config->getVar('conf_name')}>' id='legacy_xoopsform_<{$config->getVar('conf_name')}>'>
              <{foreach item=option from=$config->getOptionItems()}>
                <option value='<{$option->getOptionKey()|escape}>' <{if $actionForm->get($config->get('conf_name')) == $option->getOptionKey()}>selected="selected"<{/if}>><{$option->getOptionLabel()|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()|escape}>" <{if $flag}>selected="selected"<{/if}>><{$option->getOptionLabel()|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 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 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 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 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|escape}>" <{if $actionForm->get($config->get('conf_name')) == $language}>selected="selected"<{/if}>><{$language|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 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 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|escape}>" <{if $value == $actionForm->get($config->get('conf_name'))}>selected<{/if}>><{$label|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|escape}>" <{if $flag}>selected="selected"<{/if}>><{$label|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>
