Added name duplication check when creating a variable
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{check_auth context="admin" roles="ADMIN" permissions="admin.configuration.variables.edit" login_tpl="admin/login"}
|
||||
{check_auth context="admin" roles="ADMIN" permissions="admin.configuration.variables.edit" login_tpl="/admin/login"}
|
||||
|
||||
{$page_title={intl l='Edit a system variable'}}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
{loop name="config_edit" type="config" hidden="*" id="$variable_id" backend_context="1" lang="$edition_language"}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='admin/configuration'}">{intl l="Configuration"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='admin/configuration/variables'}">{intl l="System variables"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='/admin/configuration/variables'}">{intl l="System variables"}</a> <span class="divider">/</span></li>
|
||||
<li>{intl l='Editing variable "%name"' name="{$NAME}"}</li>
|
||||
</ul>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<fieldset>
|
||||
|
||||
{form name="thelia.admin.variable.modification"}
|
||||
<form method="POST" action="{url path='admin/configuration/variables/save-change'}" {form_enctype form=$form}>
|
||||
<form method="POST" action="{url path='/admin/configuration/variables/save-change'}" {form_enctype form=$form}>
|
||||
|
||||
{* Be sure to get the variable ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="variable_id" value="{$variable_id}" />
|
||||
@@ -40,7 +40,7 @@
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='admin/configuration/variables'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow creation of hidden variables *}
|
||||
@@ -50,7 +50,7 @@
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='hidden'}
|
||||
<input type="hidden" name="{$name}" value="0" />
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
@@ -94,7 +94,7 @@
|
||||
</label>
|
||||
|
||||
<div class="controls">
|
||||
{form_field form=$form field='value'}
|
||||
{form_field form=$form field='secured'}
|
||||
<span {if $error}class="error"{/if}>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{check_auth context="admin" roles="ADMIN" permissions="admin.configuration.variables.view" login_tpl="admin/login"}
|
||||
{check_auth context="admin" roles="ADMIN" permissions="admin.configuration.variables.view" login_tpl="/admin/login"}
|
||||
|
||||
{$page_title={intl l='Thelia System Variables'}}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='admin/configuration'}">{intl l="Configuration"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a> <span class="divider">/</span></li>
|
||||
<li>{intl l="System variables"}</li>
|
||||
</ul>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
<form action="{url path='admin/configuration/variables/change-values'}" method="post">
|
||||
<form action="{url path='/admin/configuration/variables/change-values'}" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
@@ -60,14 +60,14 @@
|
||||
<td class="actions">
|
||||
{if ! $SECURED}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-mini cancel-edit" id="cancel_edit_btn_{$ID}" data-id="{$ID}" title="{intl l='Cancel changes and revert to original value'}" href="#"><i class="icon-remove-circle"></i></a>
|
||||
<a class="btn btn-mini cancel-edit" id="cancel_edit_btn_{$ID}" data-id="{$ID}" title="{intl l='Cancel changes and revert to original value'}" href="#"><i class="icon-remove"></i></a>
|
||||
|
||||
{loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
||||
<a class="btn btn-mini config-change" title="{intl l='Change this variable'}" href="{url path='admin/configuration/variables/change' variable_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
<a class="btn btn-mini config-change" title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/change' variable_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" context="admin" roles="ADMIN" permissions="admin.configuration.variables.delete"}
|
||||
<a class="btn btn-mini config-delete" title="{intl l='Delete this configuration variable'}" href="{url path='admin/configuration/variables/delete' id="$ID"}"><i class="icon-trash"></i></a>
|
||||
<a class="btn btn-mini config-delete" title="{intl l='Delete this variable'}" href="#delete_variable_dialog" data-id="{$ID}" data-toggle="modal"><i class="icon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -96,13 +96,23 @@
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.variable.creation"}
|
||||
<form method="POST" action="{url path='admin/configuration/variables/create'}" {form_enctype form=$form}>
|
||||
<form method="POST" action="{url path='/admin/configuration/variables/create'}" {form_enctype form=$form}>
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created variable ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='admin/configuration/variables/change' variable_id='_ID_'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/change' variable_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow users to create hidden or secured variables from here *}
|
||||
|
||||
{form_field form=$form field='hidden'}
|
||||
<input type="hidden" name="{$name}" value="0" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='secured'}
|
||||
<input type="hidden" name="{$name}" value="0" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
@@ -167,8 +177,8 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
|
||||
<button type="submit" class="btn btn-primary">{intl l="Create this variable"}</button>
|
||||
<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -176,17 +186,38 @@
|
||||
</div>
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
<div class="modal hide fade" id="delete_variable_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a variable"}</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{intl l="Do you really want to delete this variable ?"}</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="{url path='/admin/configuration/variables/delete'}">
|
||||
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">{intl l="Yes"}</button>
|
||||
<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{include file='includes/js.inc.html'}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Variable delete confirmation
|
||||
// Set proper variable ID in delete from
|
||||
$('a.config-delete').click(function(ev) {
|
||||
if (! confirm("{intl l='Do you really want to delete this variable ?'}")) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
$('#variable_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
{* display the form creation dialog if it contains errors *}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user