Pressing the link in the meta_forward function may result in a blank page.
[fa-stable.git] / includes / ui / ui_controls.inc
index 3452b0bd4725f8d8dd7bf9fed7a2146c65cc3c8c..217be194c3642061fa15fc7b5085deac3fda3106 100644 (file)
@@ -28,7 +28,7 @@ function end_form($breaks=0)
 {
        if ($breaks)
                br($breaks);
-       echo "<input type=\"hidden\" name=\"_focus\" value=\"".$_POST['_focus']."\">\n";
+       echo "<input type=\"hidden\" name=\"_focus\" value=\"".get_post('_focus')."\">\n";
        echo "</form>\n";
 }
 
@@ -52,7 +52,7 @@ function meta_forward($forward_to, $params="")
     global $Ajax;
        echo "<meta http-equiv='Refresh' content='0; url=$forward_to?$params'>\n";
        echo "<center><br>" . _("You should automatically be forwarded.");
-       echo " " . _("If this does not happen") . " " . "<a href='$forward_to'>" . _("click here") . "</a> " . _("to continue") . ".<br><br></center>\n";
+       echo " " . _("If this does not happen") . " " . "<a href='$forward_to?$params'>" . _("click here") . "</a> " . _("to continue") . ".<br><br></center>\n";
        $Ajax->redirect($forward_to.'?'.$params);
        exit;
 }
@@ -100,7 +100,7 @@ function hyperlink_params($target, $label, $params, $center=true)
 function hyperlink_params_td($target, $label, $params)
 {
        echo "<td>";
-       hyperlink_params($target, $label, $params);
+       hyperlink_params($target, $label, $params, false);
        echo "</td>\n";
 }
 
@@ -192,13 +192,18 @@ function br($num=1)
 
 $ajax_divs = array();
 
-function div_start($id='', $trigger=null)
+function div_start($id='', $trigger=null, $non_ajax=false)
 {
     global $ajax_divs;
 
-    array_push($ajax_divs, array($id, $trigger===null ? $id : $trigger));
-    echo "<div ". ($id !='' ? "id='$id'" : '').">";
-    ob_start();
+       if ($non_ajax) { // div for non-ajax elements
+               array_push($ajax_divs, array($id, null));
+               echo "<div style='display:none' class='js_only' ".($id !='' ? "id='$id'" : '').">";
+       } else { // ajax ready div
+               array_push($ajax_divs, array($id, $trigger===null ? $id : $trigger));
+               echo "<div ". ($id !='' ? "id='$id'" : '').">";
+               ob_start();
+       }
 }
 
 function div_end()
@@ -208,7 +213,8 @@ function div_end()
     if (count($ajax_divs))
     {
                $div = array_pop($ajax_divs);
-               $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
+               if ($div[1] !== null)
+                       $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
                echo "</div>";
     }
 }