From 33d374e56aa7c4ff6fc93c51cfe68c7c55c2edd4 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 21 Jul 2016 01:05:37 +0200 Subject: [PATCH] Continue to work on conversion to use AdminLTE / Bootstrap / jQuery --- public_html/css/default/LSconfirmBox.css | 2 +- public_html/css/default/LSdefault.css | 2 +- public_html/css/default/LSform.css | 12 ++-- .../default/LSformElement_select_object.css | 1 + .../includes/class/class.LSsession.php | 12 ++-- public_html/includes/js/LSform.js | 33 +++++---- public_html/templates/default/LSform.tpl | 70 ++++++++----------- public_html/templates/default/LSform_view.tpl | 57 +++++++++------ public_html/templates/default/empty.tpl | 2 +- 9 files changed, 100 insertions(+), 91 deletions(-) diff --git a/public_html/css/default/LSconfirmBox.css b/public_html/css/default/LSconfirmBox.css index 83e133b5..93df08c5 100644 --- a/public_html/css/default/LSconfirmBox.css +++ b/public_html/css/default/LSconfirmBox.css @@ -3,7 +3,7 @@ border-radius: 5px; margin: auto; position: absolute; - z-index: 4; + z-index: 2001; display: none; position: absolute; background-color: #000; diff --git a/public_html/css/default/LSdefault.css b/public_html/css/default/LSdefault.css index 1e559cce..771a1c37 100644 --- a/public_html/css/default/LSdefault.css +++ b/public_html/css/default/LSdefault.css @@ -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; } diff --git a/public_html/css/default/LSform.css b/public_html/css/default/LSform.css index 40dc49c5..62a00491 100644 --- a/public_html/css/default/LSform.css +++ b/public_html/css/default/LSform.css @@ -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 { diff --git a/public_html/css/default/LSformElement_select_object.css b/public_html/css/default/LSformElement_select_object.css index 7c3d5ac7..9d091cc6 100644 --- a/public_html/css/default/LSformElement_select_object.css +++ b/public_html/css/default/LSformElement_select_object.css @@ -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 { diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php index 6f34dffb..33cd672c 100644 --- a/public_html/includes/class/class.LSsession.php +++ b/public_html/includes/class/class.LSsession.php @@ -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']; diff --git a/public_html/includes/js/LSform.js b/public_html/includes/js/LSform.js index 79120fcd..22033966 100644 --- a/public_html/includes/js/LSform.js +++ b/public_html/includes/js/LSform.js @@ -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'); diff --git a/public_html/templates/default/LSform.tpl b/public_html/templates/default/LSform.tpl index fd33c621..6a37e1cb 100644 --- a/public_html/templates/default/LSform.tpl +++ b/public_html/templates/default/LSform.tpl @@ -4,14 +4,16 @@ +{/if}
+{if $LSform_layout} {foreach from=$LSform_layout item=tab key=tab_key} @@ -27,9 +29,9 @@
{if $LSform_fields[$arg].errors != ''} {foreach from=$LSform_fields[$arg].errors item=error} -
-
{$error}
-
+
+
{$error}
+
{/foreach} {/if} {/if} @@ -44,6 +46,29 @@
{/foreach} +{else} +
+ {foreach from=$LSform_fields item=field} +
+ +
{$field.html}{if $field.add != ''} + Ajouter un champ{/if}
+
+ {if $field.errors != ''} + {foreach from=$field.errors item=error} +
+
{$error}
+
+ {/foreach} + {/if} + {/foreach} +
+
+ +
+
+
+ +{/if}
{if $LSformElement_image!=''} @@ -62,41 +87,4 @@
-{else} - {if $LSformElement_image!=''} -
- {if $LSformElement_image_actions!='' && !$LSformElement_image_errors} - - {/if} - -
- {/if} - -
- {foreach from=$LSform_fields item=field} -
- -
{$field.html}{if $field.add != ''} + Ajouter un champ{/if}
-
- {if $field.errors != ''} - {foreach from=$field.errors item=error} -
-
{$error}
-
- {/foreach} - {/if} - {/foreach} -
-
- -
-
-
- -{/if} diff --git a/public_html/templates/default/LSform_view.tpl b/public_html/templates/default/LSform_view.tpl index 6dfa3dc8..d353b83a 100644 --- a/public_html/templates/default/LSform_view.tpl +++ b/public_html/templates/default/LSform_view.tpl @@ -1,3 +1,4 @@ +
{if $LSform_layout} @@ -8,51 +9,63 @@ {/foreach} +{/if} +
+
+ +{if $LSform_layout} {foreach from=$LSform_layout item=tab key=tab_key}

{$tab.label}

- {if $LSformElement_image!='' && $tab.img==1} -
- -
- {/if} - -
+
{assign var='field' value='non'} {foreach from=$tab.args item=arg} {if $LSform_fields[$arg]} {assign var='field' value='oui'} -
{$LSform_fields[$arg].label}
-
{$LSform_fields[$arg].html}
+
+ +
{$LSform_fields[$arg].html}
+
{/if} {/foreach} {if $field=='non'} -
{$LSform_layout_nofield_label}
+
+
+ {$LSform_layout_nofield_label} +
+
{/if} -
- +
+
{/foreach} {else} - {if $LSformElement_image!=''} -
- -
- {/if} -
-
+
{foreach from=$LSform_fields item=field} -
{$field.label}
-
{$field.html}
+
+ +
{$field.html}
+
{/foreach} -
+
{/if} + +
+ {if $LSformElement_image!=''} +
+ +
+ {/if} +
+ + +
diff --git a/public_html/templates/default/empty.tpl b/public_html/templates/default/empty.tpl index 5677f04a..5c53d397 100644 --- a/public_html/templates/default/empty.tpl +++ b/public_html/templates/default/empty.tpl @@ -30,7 +30,7 @@
  • {$name}
  • {/foreach} -
  • {$_refresh}
  • +
  • {$_refresh}
  • {/if}