Inital commit

This commit is contained in:
2020-11-19 15:36:28 +01:00
parent 71f32f83d3
commit 66ce4ee218
18077 changed files with 2166122 additions and 35184 deletions

View File

@@ -22,7 +22,7 @@
</ul>
</div>
{module_include location='administrators_top'}
{hook name="administrators.top" location="administrators_top" }
<div class="row">
<div class="col-md-12">
@@ -33,7 +33,7 @@
<caption class="clearfix">
{intl l="Administrators"}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.administrator" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new administrator'}" href="#administrator_create_dialog" data-toggle="modal">
<a class="btn btn-primary pull-right" title="{intl l='Create a new administrator'}" href="#administrator_create_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
{/loop}
@@ -43,8 +43,10 @@
<th>{intl l="Login"}</th>
<th>{intl l="First Name"}</th>
<th>{intl l="Last Name"}</th>
<th>{intl l="E-mail"}</th>
<th>{intl l="Locale"}</th>
<th>{intl l="Profile"}</th>
{hook name="administrators.header" location="administrator_list_header" }
<th class="col-md-1">{intl l="Actions"}</th>
</tr>
</thead>
@@ -58,7 +60,7 @@
{$can_update = true}
{/loop}
<tr>
<tr class="js-admin-{$ID}">
<td data-field-class="js-login">
{if $can_update}
<a class="js-update-administrator" title="{intl l='Change this administrator'}" href="#administrator_update_dialog" data-id="{$ID}" data-toggle="modal">{$LOGIN}</a>
@@ -68,29 +70,41 @@
</td>
<td data-field-class="js-firstname">{$FIRSTNAME}</td>
<td data-field-class="js-lastname">{$LASTNAME}</td>
<td data-field-class="js-locale">{$LOCALE}</td>
{* Do not display invalid emails *}
{if $EMAIL|strpos:'@'}
<td data-field-class="js-email">{$EMAIL}</td>
{else}
<td class="text-warning">
<span class="glyphicon glyphicon-exclamation-sign"></span> {intl l="No email defined"}
</td>
{/if}
<td data-field-class="js-locale" data-value="{$LOCALE}">{$LOCALE}</td>
<td data-field-class="js-profile" data-value="{$PROFILE}">
{if $PROFILE}
{loop type="profile" name="admin-profile" id={$PROFILE}}
<a title="{intl l='Afficher ce profil'}" href="{url path="/admin/configuration/profiles/update/$ID"}">{$TITLE}</a>
<a title="{intl l='Afficher ce profil'}" href="{url path="/admin/configuration/profiles/update/%id" id=$ID}">{$TITLE}</a>
{/loop}
{else}
{intl l='Superadministrator'}
{/if}
</td>
<td>
<div class="btn-group">
{hook name="administrators.row" location="administrator_list_row" admin_id={$ID}}
<td class="actions">
<div class="btn-toolbar btn toolbar-primary">
<span class="glyphicon glyphicon-cog"></span>
</div>
<div class="toolbar-options hidden">
{* if admin is current admin :
- can UPDATE anyway
- cannot delete himself
*}
{if $can_update}
<a class="btn btn-default btn-xs js-update-administrator" title="{intl l='Change this administrator'}" href="#administrator_update_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-edit"></span></a>
<a class="js-update-administrator" title="{intl l='Change this administrator'}" href="#administrator_update_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-edit"></span></a>
{/if}
{if $ID != {admin attr="id"}}
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.administrator" access="DELETE"}
<a class="btn btn-default btn-xs js-delete-administrator" title="{intl l='Delete this administrator'}" href="#administrator_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
<a class="js-delete-administrator" title="{intl l='Delete this administrator'}" href="#administrator_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
{/loop}
{/if}
</div>
@@ -108,7 +122,7 @@
</div>
</div>
{module_include location='administrators_bottom'}
{hook name="administrators.bottom" location="administrators_bottom" }
</div>
</div>
@@ -125,79 +139,60 @@
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "administrator_create_dialog"}
{form_hidden_fields form=$form}
{form_hidden_fields}
{form_field form=$form field='login'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Login'}" placeholder="{intl l='Login'}" class="form-control" value="{if $form_error}{$value}{/if}">
<div class="row">
<div class="col-md-6">
{render_form_field field='login'}
{render_form_field field='email'}
</div>
{/form_field}
{form_field form=$form field='firstname'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='FirstName'}" placeholder="{intl l='FirstName'}" class="form-control" value="{if $form_error}{$value}{/if}">
<div class="col-md-6">
{render_form_field field='firstname'}
{render_form_field field='lastname'}
</div>
</div>
{form_field field='password_confirm'}
{$passwordError = $error}
{/form_field}
{form_field form=$form field='lastname'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='LastName'}" placeholder="{intl l='LastName'}" class="form-control" value="{if $form_error}{$value}{/if}">
<div class="row">
<div class="col-md-6">
{render_form_field field='password'}
</div>
{/form_field}
{form_field form=$form field='password_confirm'}
{$passwordError = $error}
{/form_field}
{form_field form=$form field='password'}
<div class="form-group {if $passwordError}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="password" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Password'}" class="form-control">
<div class="col-md-6">
{render_form_field field='password_confirm'}
</div>
{/form_field}
</div>
{form_field form=$form field='password_confirm'}
<div class="form-group {if $passwordError}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="password" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Password'}" class="form-control">
<div class="row">
<div class="col-md-6">
{custom_render_form_field field="locale"}
<select {form_field_attributes field="locale" no_standard_classes=1} data-toggle="selectpicker">
{loop name='lang-admin' type="lang"}
<option value="{$LOCALE}">{$LOCALE}: {$TITLE}</option>
{/loop}
</select>
{/custom_render_form_field}
</div>
{/form_field}
{form_field form=$form field='locale'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker">
{loop name='lang-admin' type="lang"}
<option value="{$LOCALE}">{$LOCALE}: {$TITLE}</option>
{/loop}
</select>
<div class="col-md-6">
{custom_render_form_field field="profile"}
<select {form_field_attributes field="profile" no_standard_classes=1} data-toggle="selectpicker">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0">{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}">{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
{/custom_render_form_field}
</div>
{/form_field}
</div>
{form_field form=$form field='profile'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0">{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}">{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
</div>
{/form_field}
{module_include location='administrator_create_form'}
{hook name="administrator.create-form" location="administrator_create_form" }
{/capture}
{include
@@ -211,7 +206,7 @@
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="/admin/configuration/administrators/add"}
form_enctype = {form_enctype form=$form}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
@@ -229,79 +224,73 @@
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "administrator_update_dialog"}
{form_hidden_fields form=$form}
{form_hidden_fields}
{form_field form=$form field='login'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Login'}" placeholder="{intl l='Login'}" class="form-control js-login" value="{if $form_error}{$value}{/if}">
{if $show_email_change_notice}
<div class="alert alert-warning">
{intl l="From Thelia 2.3, you have to <strong>add an email address</strong> to your administrator profile. Please enter your email address below."}
</div>
{/form_field}
{/if}
<div class="row">
<div class="col-md-6">
{render_form_field field='login' extra_classes='js-login'}
{render_form_field field='firstname' extra_classes='js-firstname'}
{form_field form=$form field='firstname'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='FirstName'}" placeholder="{intl l='FirstName'}" class="form-control js-firstname" value="{if $form_error}{$value}{/if}">
</div>
{/form_field}
{form_field form=$form field='lastname'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='LastName'}" placeholder="{intl l='LastName'}" class="form-control js-lastname" value="{if $form_error}{$value}{/if}">
<div class="col-md-6">
{custom_render_form_field field='email'}
<input type="email" {form_field_attributes field="email" extra_classes='js-email'}{if $show_email_change_notice} autofocus{/if}>
{/custom_render_form_field}
{render_form_field field='lastname' extra_classes='js-lastname'}
</div>
{/form_field}
</div>
{form_field form=$form field='password_confirm'}
{form_field field='password_confirm'}
{$passwordError = $error}
{/form_field}
{form_field form=$form field='password'}
<div class="form-group {if $passwordError}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="password" id="{$label_attr.for}" name="{$name}" title="{intl l='Password'}" placeholder="{intl l='Leave empty to keep current password'}" class="form-control">
<div class="row">
<div class="col-md-6">
{custom_render_form_field field='password'}
<input type="password" {form_field_attributes field="password"} autocomplete="off" placeholder="{intl l='Leave empty to keep current password'}">
{/custom_render_form_field}
</div>
{/form_field}
{form_field form=$form field='password_confirm'}
<div class="form-group {if $passwordError}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="password" id="{$label_attr.for}" name="{$name}" title="{intl l='Password'}" placeholder="{intl l='Leave empty to keep current password'}" class="form-control">
<div class="col-md-6">
{custom_render_form_field field='password_confirm'}
<input type="password" {form_field_attributes field="password_confirm"} autocomplete="off" placeholder="{intl l='Leave empty to keep current password'}">
{/custom_render_form_field}
</div>
{/form_field}
{form_field form=$form field='locale'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker">
{loop name='lang-admin' type="lang"}
<option value="{$LOCALE}" {if $LOCALE == $value}selected="selected"{/if}>{$LOCALE}: {$TITLE}</option>
{/loop}
</select>
</div>
<div class="row">
<div class="col-md-6">
{custom_render_form_field field="locale"}
<select {form_field_attributes field="locale" no_standard_classes=1 extra_classes='js-locale'} data-toggle="selectpicker">
{loop name='lang-admin' type="lang"}
<option value="{$LOCALE}" {if $LOCALE == $value}selected="selected"{/if}>{$LOCALE}: {$TITLE}</option>
{/loop}
</select>
{/custom_render_form_field}
</div>
{/form_field}
{form_field form=$form field='profile'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker" class="js-profile">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0">{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}">{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
<div class="col-md-6">
{custom_render_form_field field="profile"}
<select {form_field_attributes field="profile" no_standard_classes=1 extra_classes='js-profile'} data-toggle="selectpicker">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0">{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}">{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
{/custom_render_form_field}
</div>
{/form_field}
{module_include location='administrator_update_form'}
</div>
{hook name="administrator.update-form" location="administrator_update_form" }
{/capture}
{include
@@ -315,7 +304,7 @@
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="/admin/configuration/administrators/save"}
form_enctype = {form_enctype form=$form}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
@@ -326,7 +315,7 @@
{capture "administrator_delete_dialog"}
<input type="hidden" name="administrator_id" id="administrator_delete_id" value="" />
{module_include location='administrator_delete_form'}
{hook name="administrator.delete-form" location="administrator_delete_form" }
{/capture}
@@ -337,7 +326,7 @@
dialog_title = {intl l="Delete administrator"}
dialog_message = {intl l="Do you really want to delete this administrator ?"}
form_action = {url path='/admin/configuration/administrators/delete'}
form_action = {token_url path='/admin/configuration/administrators/delete'}
form_content = {$smarty.capture.administrator_delete_dialog nofilter}
}
@@ -357,10 +346,6 @@
<script src='{$asset_url}'></script>
{/javascripts}
{javascripts file='assets/js/main.js'}
<script src='{$asset_url}'></script>
{/javascripts}
<script type="text/javascript">
jQuery(function($) {
@@ -377,21 +362,24 @@ jQuery(function($) {
});
$(".js-update-administrator").click(function(e){
$('#administrator_update_id').val($(this).data('id'))
$('#administrator_update_id').val($(this).data('id'));
$(this).parents('tr').find('td').each(function(k, v) {
if(!$(v).data('field-class')) {
$('.js-admin-' + $(this).data('id')).find('td').each(function(k, v) {
$v = $(v);
if(!$v.data('field-class')) {
return true;
}
if($(v).data('value')) {
var fieldValue = $(v).data('value');
if($v.data('value')) {
var fieldValue = $v.data('value');
} else {
var fieldValue = $(v).text();
var fieldValue = $v.text();
}
$('.' + $(v).data('field-class')).val($.trim(fieldValue));
if($('.' + $(v).data('field-class')).is('select')) {
$('.' + $(v).data('field-class')).selectpicker('refresh');
$('.' + $v.data('field-class')).val($.trim(fieldValue));
if($('.' + $v.data('field-class')).is('select')) {
$('.' + $v.data('field-class')).selectpicker('refresh');
}
});
});
@@ -401,5 +389,23 @@ jQuery(function($) {
{/block}
{block name="javascript-last-call"}
{module_include location='administrators-js'}
{hook name="administrators.js" location="administrators-js" }
{if $show_update_dialog}
<script>
jQuery(function($) {
{if $show_email_change_notice}
{* We have to change email, highlight the field and set focus *}
$('#administrator_update_dialog').on('shown.bs.modal', function (e) {
var $emailInput = $('.js-email', $(this));
$emailInput.closest('.form-group').addClass('has-error');
$emailInput.focus();
});
{/if}
$('.js-update-administrator[data-id={admin attr='id'}]').first().click();
});
</script>
{/if}
{/block}