fix reloading viewdef in function edit. use printVal to display views correctly
authorchriskl <chriskl>
Thu, 15 May 2003 13:32:37 +0000 (13:32 +0000)
committerchriskl <chriskl>
Thu, 15 May 2003 13:32:37 +0000 (13:32 +0000)
views.php

index 18738fac37fa4cf67a50b59d2e3ce6aa989cf156..65f086524e79fdf3b4872c2fc72a11238750e0df 100644 (file)
--- a/views.php
+++ b/views.php
@@ -3,7 +3,7 @@
        /**
         * Manage views in a database
         *
-        * $Id: views.php,v 1.12 2003/05/06 07:13:04 chriskl Exp $
+        * $Id: views.php,v 1.13 2003/05/15 13:32:37 chriskl Exp $
         */
 
        // Include application functions
                $viewdata = &$localData->getView($_REQUEST['view']);
                
                if ($viewdata->recordCount() > 0) {
-                       echo "<form action=\"$PHP_SELF\" method=post>\n";
+                       
+                       if (!isset($_POST['formDefinition'])) $_POST['formDefinition'] = $viewdata->f[$data->vwFields['vwdef']];
+                       
+                       echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
                        echo "<table width=\"100%\">\n";
                        echo "<tr><th class=\"data\">{$lang['strname']}</th></tr>\n";
                        echo "<tr><td class=\"data1\">", htmlspecialchars($viewdata->f[$data->vwFields['vwname']]), "</td></tr>\n";
                        echo "<tr><th class=\"data\">{$lang['strdefinition']}</th></tr>\n";
                        echo "<tr><td class=\"data1\"><textarea style=\"width:100%;\" rows=\"20\" cols=\"50\" name=\"formDefinition\" wrap=\"virtual\">", 
-                               htmlspecialchars($viewdata->f[$data->vwFields['vwdef']]), "</textarea></td></tr>\n";
+                               htmlspecialchars($_POST['formDefinition']), "</textarea></td></tr>\n";
                        echo "</table>\n";
-                       echo "<input type=\"hidden\" name=\"action\" value=\"save_edit\">\n";
-                       echo "<input type=\"hidden\" name=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\">\n";
+                       echo "<input type=\"hidden\" name=\"action\" value=\"save_edit\" />\n";
+                       echo "<input type=\"hidden\" name=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\" />\n";
                        echo $misc->form;
-                       echo "<input type=\"submit\" value=\"{$lang['strsave']}\"> <input type=\"reset\" value=\"{$lang['strreset']}\">\n";
+                       echo "<input type=\"submit\" value=\"{$lang['strsave']}\" />\n";
+                       echo "<input type=\"reset\" value=\"{$lang['strreset']}\" />\n";
                        echo "</form>\n";
                }
                else echo "<p>{$lang['strnodata']}</p>\n";
                        echo "<tr><th class=\"data\">{$lang['strname']}</th></tr>\n";
                        echo "<tr><td class=\"data1\">", htmlspecialchars($viewdata->f[$data->vwFields['vwname']]), "</td></tr>\n";
                        echo "<tr><th class=\"data\">{$lang['strdefinition']}</th></tr>\n";
-                       echo "<tr><td class=\"data1\">", nl2br(htmlspecialchars($viewdata->f[$data->vwFields['vwdef']])), "</td></tr>\n";
+                       echo "<tr><td class=\"data1\">", $misc->printVal($viewdata->f[$data->vwFields['vwdef']]), "</td></tr>\n";
                        echo "</table>\n";
                }
                else echo "<p>{$lang['strnodata']}</p>\n";
                if ($views->recordCount() > 0) {
                        echo "<table>\n";
                        echo "<tr><th class=\"data\">{$lang['strview']}</th><th class=\"data\">{$lang['strowner']}</th>";
-                       echo "<th colspan=\"5\" class=\"data\">{$lang['stractions']}</th>\n";
+                       echo "<th colspan=\"5\" class=\"data\">{$lang['stractions']}</th></tr>\n";
                        $i = 0;
                        while (!$views->EOF) {
                                // @@@@@@@@@ FIX THIS!!!!!