User interface mode detected on login.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 19 Oct 2008 20:00:53 +0000 (20:00 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 19 Oct 2008 20:00:53 +0000 (20:00 +0000)
access/login.php
includes/current_user.inc
includes/session.inc
includes/ui/ui_input.inc
includes/ui/ui_lists.inc

index 0b961a9795db37a17b4779daaddfcaee4498cbcc..5644151811e195cbd93c31dbdc909626cc5aa095 100644 (file)
@@ -23,6 +23,7 @@
 function defaultCompany()
 {
        document.forms[0].company_login_name.options[<?php echo $def_coy; ?>].selected = true;
+       document.getElementById('ui_mode').value = 1;
 }
 </script>
     <title><?php echo $app_title . " " . $version;?></title>
@@ -45,6 +46,7 @@ function defaultCompany()
                            <td colspan="2" rowspan="2">
                     <table width="346" border="0" cellpadding="0" cellspacing="0">
                                        <form action="<?php echo $_SERVER['PHP_SELF'];?>" name="loginform" method="post">
+                                               <input type="hidden" id=ui_mode name="ui_mode" value="0">
                         <tr>
                             <td colspan="5" bgcolor="#FFFFFF"><img src="<?php echo $def_theme; ?>/images/spacer.png" width="346" height="1" alt="" /></td>
 
index 0948b3d35641012a97027f3f7f6a3492be0efb37..05b98800643be3190a59d21175450dd77377b5a4 100644 (file)
@@ -14,7 +14,8 @@ class current_user
        var $access;
 
        var $logged;
-
+       var $ui_mode = 0;
+       
        var $prefs;
 
        function current_user()
@@ -118,6 +119,12 @@ function number_format2($number, $decimals=0)
        $dsep = $decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()];
        return number_format($number, $decimals, $dsep, $tsep);
 }
+//
+//     Current ui mode.
+//
+function fallback_mode() {
+    return $_SESSION["wa_current_user"]->ui_mode==0;
+}
 
 function price_format($number) {
     return number_format2($number,
index 0e7d31138d0d35d32eb9e774fad08fcddc5584fe..a08344aea10fad53ead55414cd55cf64cf7359e5 100644 (file)
         if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "")
         {
                include($path_to_root . "/access/login.php");
-               $Ajax->redirect($path_to_root . "/access/login.php");
+                       $Ajax->redirect($path_to_root . "/access/login.php");
             exit;
         }
        }
                $succeed = $_SESSION["wa_current_user"]->login($_POST["company_login_name"],
                        $_POST["user_name_entry_field"],
                        md5($_POST["password"]));
-
+               // select full vs fallback ui mode on login
+               $_SESSION["wa_current_user"]->ui_mode = $_POST['ui_mode'];
                if (!$succeed)
                {
                        // Incorrect password
index 230dd495b325439db6a65c82a1372d6c2cb50230..47cdd0a973e7339b2357c7e577169c150d5f8ef2 100644 (file)
@@ -102,7 +102,7 @@ function submit($name, $value, $echo=true, $title=false, $async=false, $icon=fal
        $submit_str = "<button class=\""
            .($async ? 'ajaxsubmit' : 'inputsubmit')
                ."\""
-               .($async === null ? (in_ajax() ? " style='display:none;'" : ' aspect="fallback"' ): 
+               .($async === null ? (fallback_mode() ? ' aspect="fallback"' : " style='display:none;'" ): 
                        ($async === 'process' ? 'aspect="process"' : '') )
            ." name=\"$name\"  id=\"$name\" value=\"$value\""
            .($title ? " title='$title'" : '')
index b0b8d68958e88e0c8f60a70d25778ceb6aeebf58..acfe058cb56a1584d996e446f1003505c61c56e3 100644 (file)
@@ -188,7 +188,7 @@ $opts = array(              // default options
                global $_select_button;
        // button class selects form reload/ajax selector update
                $selector .= sprintf($_select_button, $disabled, user_theme(),
-                       (in_ajax() ? 'display:none;':''),
+                       (fallback_mode() ? '' : 'display:none;'),
                        $select_submit)."\n";
        }
 // ------ make combo ----------
@@ -199,12 +199,12 @@ $opts = array(            // default options
                        $opts['size']."' maxlength='".$opts['max'].
                        "' value='$txt' class='$class' rel='$name' autocomplete='off' title='"
                        .$opts['box_hint']."'"
-                       .(in_ajax() && !$by_id ? " style=display:none;":'')
+                       .(!fallback_mode() && !$by_id ? " style=display:none;":'')
                        .">\n";
                if ($search_submit != false) {
                        global $_search_button;
                        $edit_entry .= sprintf($_search_button, $disabled, user_theme(),
-                               (in_ajax() ? 'display:none;':''),
+                               (fallback_mode() ? '' : 'display:none;'),
                                $search_submit)."\n";
                }
        }
@@ -307,7 +307,7 @@ $opts = array(              // default options
        if ($select_submit != false) { // if submit on change is used - add select button
                global $_select_button;
                $selector .= sprintf($_select_button, $disabled, user_theme(),
-                       (in_ajax() ? 'display:none;':''),
+                       (fallback_mode() ? '' : 'display:none;'),
                        $select_submit)."\n";
        }
        default_focus($name);