Continue to work on conversion to use AdminLTE / Bootstrap / jQuery

This commit is contained in:
Benjamin Renard 2016-07-21 01:05:37 +02:00
parent 20d7d89d3f
commit 33d374e56a
9 changed files with 100 additions and 91 deletions

View file

@ -3,7 +3,7 @@
border-radius: 5px;
margin: auto;
position: absolute;
z-index: 4;
z-index: 2001;
display: none;
position: absolute;
background-color: #000;

View file

@ -7,7 +7,7 @@ div.LSinfosBox {
border: 1px solid #4096b8;
visibility: hidden;
color: #4096b8;
z-index: 100;
z-index: 2000;
top: 10px;
font-weight: bold;
}

View file

@ -14,8 +14,9 @@ ul.LSform_layout_active {
margin-bottom: 0;
}
li.LSform_layout_errors {
background-color: #f59a67;
li.LSform_layout_errors a {
color: #f59a67!important;
font-weight: bold;
}
h2.LSform_layout_active {
@ -66,6 +67,7 @@ dd.LSform {
ul.LSform {
list-style-type: none;
padding: 0;
padding-top: 7px;
margin: 0;
}
@ -93,9 +95,9 @@ input[type='submit'].LSform {
width: 8em;
}
li.LSform-errors {
color: #fff;
background-color: #f59a67;
div.LSform-errors {
color: #dd4b39;
font-weight: bold;
}
dd.LSform-errors {

View file

@ -17,6 +17,7 @@ ul.LSformElement_select_object_edit {
border: 1px solid #b5e4f6;
border-bottom: none;
width: 200px;
padding-top: 0;
}
li.LSformElement_select_object {

View file

@ -556,10 +556,10 @@ class LSsession {
LStemplate :: assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
if (isset ($_POST['LSsession_topDn']) && $_POST['LSsession_topDn']) {
if (self :: validSubDnLdapServer($_POST['LSsession_topDn'])) {
self :: $topDn = $_POST['LSsession_topDn'];
$_SESSION['LSsession']['topDn'] = $_POST['LSsession_topDn'];
if (isset ($_REQUEST['LSsession_topDn']) && $_REQUEST['LSsession_topDn']) {
if (self :: validSubDnLdapServer($_REQUEST['LSsession_topDn'])) {
self :: $topDn = $_REQUEST['LSsession_topDn'];
$_SESSION['LSsession']['topDn'] = $_REQUEST['LSsession_topDn'];
} // end if
} // end if
@ -583,8 +583,8 @@ class LSsession {
if (self :: LSldapConnect()) {
// topDn
if (isset($_POST['LSsession_topDn']) && $_POST['LSsession_topDn'] != '' ){
self :: $topDn = $_POST['LSsession_topDn'];
if (isset($_REQUEST['LSsession_topDn']) && $_REQUEST['LSsession_topDn'] != '' ){
self :: $topDn = $_REQUEST['LSsession_topDn'];
}
else {
self :: $topDn = self :: $ldapServer['ldap_config']['basedn'];

View file

@ -69,7 +69,7 @@ var LSform = new Class({
LIs.each(function(li) {
var Layout = this.getLayout(li);
if ($type(Layout)) {
if ($type(Layout.getElement('dt.LSform-errors'))) {
if ($type(Layout.getElement('div.LSform-errors'))) {
LSdebug('add');
li.addClass('LSform_layout_errors');
}
@ -278,7 +278,7 @@ var LSform = new Class({
data: this.LSform,
onSuccess: this.onAjaxSubmitComplete.bind(this),
url: this.LSform.get('action'),
imgload: varLSdefault.loadingImgDisplay($('LSform_title'),'inside')
imgload: varLSdefault.loadingImgDisplay($(event.target),'inside')
});
this.LSform.send();
}
@ -309,11 +309,12 @@ var LSform = new Class({
},
resetErrors: function() {
$$('dd.LSform-errors').each(function(dd) {
$$('div.LSform-errors').each(function(dd) {
dd.destroy();
});
$$('dt.LSform-errors').each(function(dt) {
dt.removeClass('LSform-errors');
$$('div.LSform_attribute').each(function(div) {
if (div.hasClass('has-error'))
div.removeClass('has-error');
});
$$('li.LSform_layout_errors').each(function(li) {
li.removeClass('LSform_layout_errors');
@ -326,16 +327,20 @@ var LSform = new Class({
if ($type(ul)) {
errors = new Array(errors);
errors.each(function(txt){
var dd = new Element('dd');
dd.addClass('LSform');
dd.addClass('LSform-errors');
dd.set('html',txt);
dd.injectAfter(this.getParent());
},ul);
var div_group = new Element('div');
div_group.addClass('form-group');
div_group.addClass('LSform-errors');
var div_error = new Element('div');
div_error.addClass('col-md-offset-4');
div_error.addClass('col-md-8');
div_error.addClass('has-error');
div_error.set('html',txt);
div_error.injectInside(div_group);
div_group.injectAfter(this);
},div_attr);
var dt = ul.getParent('dd.LSform').getPrevious('dt');
if ($type(dt)) {
dt.addClass('LSform-errors');
if ($type(div_attr)) {
div_attr.addClass('has-error');
}
var layout = ul.getParent('div.LSform_layout_active');

View file

@ -4,14 +4,16 @@
<!-- Tabs - Start Title -->
<ul class="nav nav-tabs">
{foreach from=$LSform_layout item=tab key=tab_key}
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{tr msg=$tab.label}</a></li>
<li role="presentation" class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{tr msg=$tab.label}</a></li>
{/foreach}
</ul>
<!-- Tabs - End Title -->
{/if}
<div class="row">
<div class="col-lg-8">
{if $LSform_layout}
<!-- Tabs - Start Content -->
{foreach from=$LSform_layout item=tab key=tab_key}
<a name='{$tab_key}'></a>
@ -27,8 +29,8 @@
</div>
{if $LSform_fields[$arg].errors != ''}
{foreach from=$LSform_fields[$arg].errors item=error}
<div class="form-group">
<div class='col-md-offset-4 col-md-8 has-error LSform-errors'>{$error}</div>
<div class="form-group LSform-errors">
<div class='col-md-offset-4 col-md-8 has-error'>{$error}</div>
</div>
{/foreach}
{/if}
@ -44,6 +46,29 @@
</div>
{/foreach}
<!-- Tabs - End Content -->
{else}
<div class='LSform_container'>
{foreach from=$LSform_fields item=field}
<div class="LSform_attribute form-group{if $field.errors != ''} has-error{/if}">
<label class="col-md-4 control-label">{$field.label}{if $field.required} *{/if}{if $field.help_info!=""} <img class='LStips' src="{img name='help'}" alt='?' title="{$field.help_info}"/>{/if}</label>
<div class="col-md-8">{$field.html}{if $field.add != ''} <span class='LSform-addfield'>+ Ajouter un champ</span>{/if}</div>
</div>
{if $field.errors != ''}
{foreach from=$field.errors item=error}
<div class="form-group LSform-errors">
<div class='col-md-offset-4 col-md-8 has-error'>{$error}</div>
</div>
{/foreach}
{/if}
{/foreach}
<div class="form-group">
<div class='col-md-offset-4 col-md-8'>
<button type="submit" class="btn btn-default">{$LSform_submittxt}</button>
</div>
</div>
</div>
{/if}
</div>
<div class="col-lg-4">
{if $LSformElement_image!=''}
@ -62,41 +87,4 @@
</div>
</div>
{else}
{if $LSformElement_image!=''}
<div class='LSformElement_image{if $LSformElement_image_errors} LSformElement_image_errors{/if}'>
{if $LSformElement_image_actions!='' && !$LSformElement_image_errors}
<ul class='LSformElement_image_actions'>
<li><img src='{img name='zoom'}' class='LSformElement_image_actions LSformElement_image_action_zoom' id='LSformElement_image_action_zoom_{$LSformElement_image.id}' /></li>
{foreach from=$LSformElement_image_actions item=item}
<li><img src='{img name=$item}' class='LSformElement_image_actions LSformElement_image_action_{$item}' id='LSformElement_image_action_{$item}_{$LSformElement_image.id}' /></li>
{/foreach}
</ul>
{/if}
<img src='{$LSformElement_image.img}' class='LSformElement_image LSsmoothbox' id='LSformElement_image_{$LSformElement_image.id}' />
</div>
{/if}
<div class='LSform_container'>
{foreach from=$LSform_fields item=field}
<div class="form-group{if $field.errors != ''} has-error{/if}">
<label class="col-md-4 control-label">{$field.label}{if $field.required} *{/if}{if $field.help_info!=""} <img class='LStips' src="{img name='help'}" alt='?' title="{$field.help_info}"/>{/if}</label>
<div class="col-md-8">{$field.html}{if $field.add != ''} <span class='LSform-addfield'>+ Ajouter un champ</span>{/if}</div>
</div>
{if $field.errors != ''}
{foreach from=$field.errors item=error}
<div class="form-group">
<div class='col-md-offset-4 col-md-8 has-error LSform-errors'>{$error}</div>
</div>
{/foreach}
{/if}
{/foreach}
<div class="form-group">
<div class='col-md-offset-4 col-md-8'>
<button type="submit" class="btn btn-default">{$LSform_submittxt}</button>
</div>
</div>
</div>
{/if}
</form>

View file

@ -1,3 +1,4 @@
<form class='LSform form-horizontal'>
<input type='hidden' name='LSform_objecttype' id='LSform_objecttype' value='{$LSform_object.type}'/>
<input type='hidden' name='LSform_objectdn' id='LSform_objectdn' value='{$LSform_object.dn}'/>
{if $LSform_layout}
@ -8,51 +9,63 @@
{/foreach}
</ul>
<!-- Tabs - End Title -->
{/if}
<div class="row">
<div class="col-lg-8">
{if $LSform_layout}
<!-- Tabs - Start Content -->
{foreach from=$LSform_layout item=tab key=tab_key}
<a name='{$tab_key}'></a>
<h2 class='LSform_layout'>{$tab.label}</h2>
<div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'>
{if $LSformElement_image!='' && $tab.img==1}
<div class='LSformElement_image'>
<a href='{$LSformElement_image.img}' rel='rien ici' title='comment' class='mb'><img src='{$LSformElement_image.img}' class='LSformElement_image LSsmoothbox' id='LSformElement_image_{$LSformElement_image.id}' /></a>
</div>
{/if}
<dl class='LSform'>
<div class='LSform_container'>
{assign var='field' value='non'}
{foreach from=$tab.args item=arg}
{if $LSform_fields[$arg]}
{assign var='field' value='oui'}
<dt class='LSform'>{$LSform_fields[$arg].label}</dt>
<dd class='LSform'>{$LSform_fields[$arg].html}</dd>
<div class="LSform_attribute form-group">
<label class="col-md-4 control-label">{$LSform_fields[$arg].label}</label>
<div class="col-md-8">{$LSform_fields[$arg].html}</div>
</div>
{/if}
{/foreach}
{if $field=='non'}
<dd class='LSform'>{$LSform_layout_nofield_label}</dd>
<div class="form-group">
<div class='col-md-offset-4 col-md-8'>
{$LSform_layout_nofield_label}
</div>
</div>
{/if}
</dl>
</div>
</div>
{/foreach}
<!-- Tabs - End Content -->
{else}
<div class='LSform'>
<div class='LSform_container'>
{foreach from=$LSform_fields item=field}
<div class="LSform_attribute form-group">
<label class="col-md-4 control-label">{$field.label}</label>
<div class="col-md-8">{$field.html}</div>
</div>
{/foreach}
</div>
</div>
{/if}
</div>
<div class="col-lg-4">
{if $LSformElement_image!=''}
<div class='LSformElement_image'>
<a href='{$LSformElement_image.img}' rel='rien ici' title='comment' class='mb'><img src='{$LSformElement_image.img}' class='LSformElement_image LSsmoothbox' id='LSformElement_image_{$LSformElement_image.id}' /></a>
</div>
{/if}
<div class='LSform'>
<dl class='LSform'>
{foreach from=$LSform_fields item=field}
<dt class='LSform'>{$field.label}</dt>
<dd class='LSform'>{$field.html}</dd>
{/foreach}
</dl>
</div>
</div>
{/if}
</form>

View file

@ -30,7 +30,7 @@
<li><a href="index.php?LSsession_topDn={$index}"{if $index==$LSsession_subDn} class="LSsession_subDn_selected"{/if}>{$name}</a></li>
{/foreach}
<li role="separator" class="divider"></li>
<li><a href="index.php?LSsession_refresh">{$_refresh}</li>
<li><a href="index.php?LSsession_refresh">{$_refresh}</a></li>
</ul>
</li>
{/if}