Small changes needed for client-side validation support.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 8 May 2009 10:19:49 +0000 (10:19 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 8 May 2009 10:19:49 +0000 (10:19 +0000)
includes/current_user.inc
includes/errors.inc
includes/main.inc
includes/page/footer.inc
includes/page/header.inc
includes/session.inc

index 97afe9d0cdbd1d2e55df7b858a2d0632a184afdd..53e7855cdc931db5ccd15d2734719c5b24a8626c 100644 (file)
@@ -315,7 +315,7 @@ function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl
 }
 
 function add_user_js_data() {
-       global $path_to_root, $thoseps, $decseps;
+       global $path_to_root, $thoseps, $decseps, $date_system, $dateseps;
 
        $ts = $thoseps[user_tho_sep()];
        $ds = $decseps[user_dec_sep()];
@@ -324,7 +324,10 @@ function add_user_js_data() {
          . "var user = {\n"
          . "theme: '". $path_to_root . '/themes/'. user_theme().'/'."',\n"
          . "loadtxt: '"._('Requesting data...')."',\n"
-         . "date: '".Today()."',\n"
+         . "date: '".Today()."',\n"    // server date
+         . "datesys: ".$date_system.",\n"
+         . "datefmt: ".user_date_format().",\n"
+         . "datesep: '".$dateseps[user_date_sep()]."',\n"
          . "ts: '$ts',\n"
          . "ds: '$ds',\n"
          . "pdec : " . user_price_dec() . "}\n";
index 1a39f1637ce3bffef74fbc61c28e42582ad843f8..1c0f2f97e9108209678d7bd4380afb9c420356f8 100644 (file)
@@ -38,7 +38,7 @@ function fmt_errors($center=false) {
 
   $type = E_USER_NOTICE;
   $content = '';
-  $class = 'no_msg';
+//  $class = 'no_msg';
   if (count($messages)) {
        foreach($messages as $cnt=>$msg) {
                if ($msg[0]>$type) continue;
@@ -59,11 +59,10 @@ function fmt_errors($center=false) {
                $content .= ($cnt ? '<hr>' : '').$str;
        }               
        $class = $msg_class[$type];
+    $content = "<div class='$class'>$content</div>";
   } else
-   if ($path_to_root=='.')
-    return '';
-  
-  $content = "<div class='$class'>$content</div>";
+  if ($path_to_root=='.')
+       return '';
   return $content;
 }
 //-----------------------------------------------------------------------------
index 4687f7070c0caf81215aa68642deee85271b0cea..e45f5973856f65c3dd4b55ca3036bac4963f4fd8 100644 (file)
@@ -20,6 +20,7 @@ include_once($path_to_root . "/includes/prefs/sysprefs.inc");
 include_once($path_to_root . "/includes/db/comments_db.inc");
 include_once($path_to_root . "/includes/db/sql_functions.inc");
 include_once($path_to_root . "/includes/db/audit_trail_db.inc");
+include_once($path_to_root . "/includes/validation.inc");
 
 include_once($path_to_root . "/admin/db/users_db.inc");
 include_once($path_to_root . "/includes/ui/ui_view.inc");
@@ -36,7 +37,7 @@ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $scri
        include($path_to_root . "/includes/page/header.inc");
 
        page_header($title, $no_menu, $is_index, $onload, $js);
-       error_box();
+//     error_box();
        if($script_only) {              
                echo '<noscript>';
                echo display_heading(_('This page is usable only with javascript enabled browsers.'));
index a105d75503e87c71d5736e9a713f0cca410e7dcc..0ba9b52a1f56f18bbe0bc39890228f42c0dfd4a9 100644 (file)
@@ -11,7 +11,7 @@
 ***********************************************************************/
 function page_footer($no_menu=false, $is_index=false)
 {
-       global $path_to_root, $js_lib;
+       global $path_to_root, $js_lib, $Validate;
 
        if (in_ajax())
                return;// just for speed up
@@ -21,7 +21,10 @@ function page_footer($no_menu=false, $is_index=false)
        include_once($path_to_root."/themes/".user_theme()."/renderer.php");
        $rend = new renderer();
        $rend->menu_footer($no_menu, $is_index);
-       echo "<script>_focus = '".get_post('_focus')."';</script>";
+       echo "<script>
+               _focus = '" . get_post('_focus') . "';
+               _validate = " . JsHttpRequest::php2js($Validate).";
+       </script>";
 
        add_user_js_data();
        echo "\n<script type=\"text/javascript\"><!--\n";
index 197f27fb3c3955b3a738c62387daf31bea6f0273..ac9283ec471113936c7248f9259cae7b3f920058 100644 (file)
@@ -124,6 +124,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        include_once($local_path_to_root."/themes/".user_theme()."/renderer.php");
        $rend = new renderer();
        $rend->menu_header($title, $no_menu, $is_index);
+       error_box();
 }
 
 ?>
\ No newline at end of file
index 6de875b93bc78f3a81febbf9a816ef7b1a6be44b..236d90e2245a2a7167fce39c23057669c269cd3a 100644 (file)
@@ -128,8 +128,12 @@ language::set_language($_SESSION['language']->code);
 include_once($path_to_root . "/config.php");
 include_once($path_to_root . "/includes/main.inc");
 
+// Ajax communication object
 $Ajax =& new Ajax();
 
+// js/php validation rules container
+$Validate = array();
+
 // intercept all output to destroy it in case of ajax call
 register_shutdown_function('ob_end_flush');
 ob_start('output_html',0);