Switch personal/configuration/create/edit users to smartified config.

This commit is contained in:
Matthias Mees 2013-06-06 20:41:33 +02:00
parent 357285a579
commit a7e100888b
6 changed files with 44 additions and 81 deletions

View File

@ -703,14 +703,6 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
$data['OUT_STACK_REST'] = $out_stack;
// is left here without any use for archiv issues only - we now use external js file outsourced to templates/default/admin/admin_scripts.js
// see passed vars in serendipity_plugin_config.fnc.tpl - can get erased, as not being used any more if keeping Smartification.
ob_start();
serendipity_printConfigJS();
$config_js = ob_get_contents();
$data['serendipity_printConfigJS'] = $config_js;
ob_end_clean();
// this is new - allowing easier access to script handling like toogle
$data['allow_admin_scripts'] = true;

View File

@ -5,52 +5,40 @@
{$formToken}
{/if}
{if $config|@sizeof > 1 AND $allowToggle}
<a class="button_link" href="#" onClick="showConfigAll({$config|@sizeof})">{$CONST.TOGGLE_ALL}</a>
<a id="show_config_all" class="button_link" href="#serendipity_config_options">{$CONST.TOGGLE_ALL}</a>
{/if}
{foreach $config as $category}
<div class="configuration_group">
<div id="serendipity_config_options">
{foreach $config as $category}
<div class="configuration_group">
{if $config|@sizeof > 1}
<h3>
{if $allowToggle}
<a href="#" onClick="showConfig('el{$category@index}'); return false">
{$category.title}
</a>
{else}
{$category.title}
{/if}
</h3>
<h3>{if $allowToggle}<a id="optionel{$category@iteration}" class="show_config_option" href="#el{$category@index}" title="{$CONST.TOGGLE_OPTION}"><span class="icon-minus-circle"></span> {$category.title}</a>{else}{$category.title}{/if}</h3>
{/if}
<fieldset id="el{$category@index}" class="clearfix">
<legend><span>{$category.description}</span></legend>
{foreach $category.items as $item}
{if $item.guessedInput}
{if $item.type == 'bool'}
<fieldset>
<legend>
<span>{$item.title}
<span>{$item.description}</span>
</span>
</legend>
<div class="clearfix">
{$item.guessedInput}
</div>
</fieldset>
{else}
<div class="form_{$item.type}">
<label for="{$item.var}">{$item.title}<span>{$item.description}</span></label>
{$item.guessedInput}
</div>
{/if}
<fieldset id="el{$category@index}" class="config_optiongroup{if $config_groupkeys@last} config_optiongroup_last{/if} additional_info">
<legend><span>{$category.description}</span></legend>
{foreach $category.items as $item}
{if $item.guessedInput}
{if $item.type == 'bool'}
<fieldset>
<legend><span>{$item.title} <span>{$item.description}</span></span></legend>
<div class="clearfix">
{$item.guessedInput}
</div>
</fieldset>
{else}
<div class="form_{if $item.type == 'list'}select{elseif $item.type == 'multilist'}multiselect{elseif $item.type == 'textarea'}area{else}field{/if}">
<label for="{$item.var}">{$item.title}<span>{$item.description}</span></label>
{$item.guessedInput}
</div>
{/if}
{/foreach}
</fieldset>
{/if}
{/foreach}
</fieldset>
</div>
{/foreach}
</div>
{/foreach}
{if NOT $noForm}
<div class="form_buttons">
<input type="submit" value="{$CONST.CHECK_N_SAVE}">
</div>
</form>
{/if}
{/if}

View File

@ -20,5 +20,5 @@
{else}
<h2>{$CONST.CONFIGURATION}</h2>
{$config|replace:'class="form_string"':'class="form_field"'|replace:'class="form_fullprotected"':'class="form_field"'|replace:'class="form_list"':'class="form_select"'|replace:'class="form_multilist"':'class="form_multiselect"'|replace:'class="form_int"':'class="form_field"'|replace:'class="form_textarea"':'class="form_area"'}
{$config}
{/if}

View File

@ -1,50 +1,33 @@
{if $type == 'bool'}
<div class="form_radio">
<input class="input_radio" id="radio_cfg_{$name}_yes" type="radio" name="{$name}" value="true"
{if $value == true} checked="checked" {/if}
/>
<input id="radio_cfg_{$name}_yes" type="radio" name="{$name}" value="true"{if $value == true} checked="checked" {/if}>
<label for="radio_cfg_{$name}_yes">{$CONST.YES}</label>
</div>
<div class="form_radio">
<input class="input_radio" id="radio_cfg_{$name}_no" type="radio" name="{$name}" value="false"
{if NOT $value == true} checked="checked" {/if}
/>
<input id="radio_cfg_{$name}_no" type="radio" name="{$name}" value="false"{if NOT $value == true} checked="checked" {/if}>
<label for="radio_cfg_{$name}_no">{$CONST.NO}</label>
</div>
{elseif $type == 'fullprotected'}
<input autocomplete="off" class="input_textbox" type="password" size="30" name="{$name}" value="{$value|escape:"html"}" />
<input id="{$name}" type="password" name="{$name}" value="{$value|escape:"html"}" autocomplete="off">
{elseif $type == 'protected'}
<input class="input_textbox" type="password" size="30" name="{$name}" value="{$value|escape:"html"}" />
<input id="{$name}" type="password" name="{$name}" value="{$value|escape:"html"}">
{elseif $type == 'multilist'}
<select name="{$name}[]" multiple="multiple" size="5">';
<select id="{$name}" name="{$name}[]" multiple="multiple" size="5">';
{foreach $default as $k => $v}
<option value="{$v.confkey}" {if $selected.$name.$k.selected} selected="selected" {/if} >
{$v.confvalue}
</option>
<option value="{$v.confkey}"{if $selected.$name.$k.selected} selected="selected"{/if}>{$v.confvalue}</option>
{/foreach}
</select>
{elseif $type == 'list'}
<select name="{$name}">
{foreach $default as $k => $v}
<option value="{$k}" {if $selected.$name.$k.selected} selected="selected" {/if} >
{$v}
</option>
{/foreach}
<select id="{$name}" name="{$name}">
{foreach $default as $k => $v}
<option value="{$k}"{if $selected.$name.$k.selected} selected="selected"{/if}>{$v}</option>
{/foreach}
</select>
{elseif $type == 'file'}
<input class="input_file" type="file" size="30" name="{$name}" />
<input id="{$name}" type="file" name="{$name}">
{elseif $type == 'textarea'}
<textarea rows="5" cols="40" name="{$name}">{$value|escape:"html"}</textarea>
<textarea id="{$name}" rows="5" name="{$name}">{$value|escape:"html"}</textarea>
{else}
<input class="input_textbox" type="text" size="30" name="{$name}" value="{$value|escape:"html"}" />
{/if}
<input id="{$name}" type="text" name="{$name}" value="{$value|escape:"html"}">
{/if}

View File

@ -12,7 +12,7 @@
{/if}
<form action="?serendipity[adminModule]=personal&amp;serendipity[adminAction]=save" method="post">
{$formToken}
{$config|replace:'class="form_string"':'class="form_field"'|replace:'class="form_fullprotected"':'class="form_field"'|replace:'class="form_list"':'class="form_select"'|replace:'class="form_multilist"':'class="form_multiselect"'|replace:'class="form_int"':'class="form_field"'|replace:'class="form_textarea"':'class="form_area"'}
{$config}
<div class="form_buttons">
<input name="SAVE" type="submit" value="{$CONST.SAVE}">
</div>

View File

@ -67,7 +67,7 @@
{$formToken}
{if $adminAction == 'edit'}{if $create_permission}<input name="serendipity[user]" type="hidden" value="{$from.authorid}">{/if}{/if}
<h2>{if $adminAction == 'edit'}{if $no_create_permission}{$CONST.CREATE_NOT_AUTHORIZED}: {$CONST.EDIT}{else}{if $create_permission}{$CONST.EDIT}{else}{$CONST.CREATE_NOT_AUTHORIZED}: {$CONST.EDIT}{/if}{/if}{else}{$CONST.CREATE}{/if}</h2>
{$config|replace:'class="form_string"':'class="form_field"'|replace:'class="form_fullprotected"':'class="form_field"'|replace:'class="form_list"':'class="form_select"'|replace:'class="form_multilist"':'class="form_multiselect"'|replace:'class="form_int"':'class="form_field"'|replace:'class="form_textarea"':'class="form_area"'}
{$config}
<div class="form_buttons">
{if $adminAction == 'edit'}
<input name="SAVE_EDIT" type="submit" value="{$CONST.SAVE}">