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; border-radius: 5px;
margin: auto; margin: auto;
position: absolute; position: absolute;
z-index: 4; z-index: 2001;
display: none; display: none;
position: absolute; position: absolute;
background-color: #000; background-color: #000;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,14 +4,16 @@
<!-- Tabs - Start Title --> <!-- Tabs - Start Title -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{foreach from=$LSform_layout item=tab key=tab_key} {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} {/foreach}
</ul> </ul>
<!-- Tabs - End Title --> <!-- Tabs - End Title -->
{/if}
<div class="row"> <div class="row">
<div class="col-lg-8"> <div class="col-lg-8">
{if $LSform_layout}
<!-- Tabs - Start Content --> <!-- Tabs - Start Content -->
{foreach from=$LSform_layout item=tab key=tab_key} {foreach from=$LSform_layout item=tab key=tab_key}
<a name='{$tab_key}'></a> <a name='{$tab_key}'></a>
@ -27,9 +29,9 @@
</div> </div>
{if $LSform_fields[$arg].errors != ''} {if $LSform_fields[$arg].errors != ''}
{foreach from=$LSform_fields[$arg].errors item=error} {foreach from=$LSform_fields[$arg].errors item=error}
<div class="form-group"> <div class="form-group LSform-errors">
<div class='col-md-offset-4 col-md-8 has-error LSform-errors'>{$error}</div> <div class='col-md-offset-4 col-md-8 has-error'>{$error}</div>
</div> </div>
{/foreach} {/foreach}
{/if} {/if}
{/if} {/if}
@ -44,6 +46,29 @@
</div> </div>
{/foreach} {/foreach}
<!-- Tabs - End Content --> <!-- 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>
<div class="col-lg-4"> <div class="col-lg-4">
{if $LSformElement_image!=''} {if $LSformElement_image!=''}
@ -62,41 +87,4 @@
</div> </div>
</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> </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_objecttype' id='LSform_objecttype' value='{$LSform_object.type}'/>
<input type='hidden' name='LSform_objectdn' id='LSform_objectdn' value='{$LSform_object.dn}'/> <input type='hidden' name='LSform_objectdn' id='LSform_objectdn' value='{$LSform_object.dn}'/>
{if $LSform_layout} {if $LSform_layout}
@ -8,51 +9,63 @@
{/foreach} {/foreach}
</ul> </ul>
<!-- Tabs - End Title --> <!-- Tabs - End Title -->
{/if}
<div class="row">
<div class="col-lg-8">
{if $LSform_layout}
<!-- Tabs - Start Content --> <!-- Tabs - Start Content -->
{foreach from=$LSform_layout item=tab key=tab_key} {foreach from=$LSform_layout item=tab key=tab_key}
<a name='{$tab_key}'></a> <a name='{$tab_key}'></a>
<h2 class='LSform_layout'>{$tab.label}</h2> <h2 class='LSform_layout'>{$tab.label}</h2>
<div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'> <div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'>
{if $LSformElement_image!='' && $tab.img==1} <div class='LSform_container'>
<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'>
{assign var='field' value='non'} {assign var='field' value='non'}
{foreach from=$tab.args item=arg} {foreach from=$tab.args item=arg}
{if $LSform_fields[$arg]} {if $LSform_fields[$arg]}
{assign var='field' value='oui'} {assign var='field' value='oui'}
<dt class='LSform'>{$LSform_fields[$arg].label}</dt> <div class="LSform_attribute form-group">
<dd class='LSform'>{$LSform_fields[$arg].html}</dd> <label class="col-md-4 control-label">{$LSform_fields[$arg].label}</label>
<div class="col-md-8">{$LSform_fields[$arg].html}</div>
</div>
{/if} {/if}
{/foreach} {/foreach}
{if $field=='non'} {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} {/if}
</dl> </div>
</div> </div>
{/foreach} {/foreach}
<!-- Tabs - End Content --> <!-- Tabs - End Content -->
{else} {else}
{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'> <div class='LSform'>
<dl class='LSform'> <div class='LSform_container'>
{foreach from=$LSform_fields item=field} {foreach from=$LSform_fields item=field}
<dt class='LSform'>{$field.label}</dt> <div class="LSform_attribute form-group">
<dd class='LSform'>{$field.html}</dd> <label class="col-md-4 control-label">{$field.label}</label>
<div class="col-md-8">{$field.html}</div>
</div>
{/foreach} {/foreach}
</dl> </div>
</div> </div>
{/if} {/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>
</div>
</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> <li><a href="index.php?LSsession_topDn={$index}"{if $index==$LSsession_subDn} class="LSsession_subDn_selected"{/if}>{$name}</a></li>
{/foreach} {/foreach}
<li role="separator" class="divider"></li> <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> </ul>
</li> </li>
{/if} {/if}