all in the datastore.
authorpaulr <me@pjr.cc>
Wed, 20 Apr 2011 17:29:30 +0000 (03:29 +1000)
committerpaulr <me@pjr.cc>
Wed, 20 Apr 2011 17:29:30 +0000 (03:29 +1000)
lib/plugins/datastore.php
lib/plugins/www.php

index 16ae107..1b2ff4f 100644 (file)
@@ -9,12 +9,51 @@ $MENU_ITEMS["ds"]["link"] = "/ds/control";
 
 function ds_contentPane()
 {
-       echo "i am a ds content pane<br>";
+       global $URL_COMPONENTS;
+       if(isset($URL_COMPONENTS[1])) {
+               switch($URL_COMPONENTS[1]) {
+                       case "browse":
+                               $dsbr = $URL_COMPONENTS[2];
+                               echo "<h3>Browsing, $dsbr</h3><br>";
+                               break;
+                       case "createds":
+                               ds_createDS($_REQUEST["dsname"], $_REQUEST["dsloc"]);
+                               echo "DS Created, <a href=\"".urlCreate("/ds/control")."\">return</a>";
+                               break;
+                       case "control":
+                       default:
+                               ds_controlPane();
+                               // go thru the db and list the components
+               }
+       }
+}
+
+function ds_controlPane()
+{
+       echo "<table>";
+       echo "<tr><td>DataStore Name</td><td>DataStore Path</td><td>Size</td><td>Usage</td><td>Control</td></tr>";
+       
+       echo "</table>";
+       echo "<form method=\"post\" action=\"".urlCreate("/ds/createds")."\">";
+       echo "DataStore Name: <input type=\"text\" name=\"dsname\">";
+       echo "DataStore Location: <input type=\"text\" name=\"dsloc\">";
+       echo "<input type=\"submit\" name=\"create\" value=\"create\">";
+       echo "</form>";
+       
 }
 
 function ds_leftMenu()
 {
-       echo "i am a ds leftmenu";
+       global $GLOBAL_BASE_URL;
+       echo "<b>Browse</b><br>";
+       $dss = ds_listDS();
+       echo "<pre>";
+       //print_r($dss);
+       echo "</pre>";
+       foreach ($dss as $dsl) {
+               $dsname = $dsl["dsname"];
+               echo "<a href=\"".urlCreate("/ds/browse/$dsname")."\">$dsname</a><br>";
+       }
 }
 
 function ds_contentUrls()
@@ -51,10 +90,10 @@ function ds_deleteFile($ds_name, $file_name, $file_tag)
                        // we got ya
                        $afname = $kmm["dsfname"];
                        if(file_exists($afname)) unlink($afname);
-                       echo "name was: $afname\n";
+                       //echo "name was: $afname\n";
                }
        }
-       echo "now delete name was: $afname\n";
+       //echo "now delete name was: $afname\n";
        if($afname != "") db_deleteData("datastores_files", "dsfname", $afname);
 }
 
index d060677..ee6bc12 100644 (file)
@@ -51,7 +51,7 @@ function www_basePage($calls)
                www_top();
        }
        
-       echo "</td></tr><tr><td>";
+       echo "</td></tr><tr valign=\"top\"><td>";
        
        // left menu
        if(isset($calls["left_menu_function"])) {
@@ -136,4 +136,17 @@ function www_pageend()
 {
        echo "</body></html>";
 }
+
+function urlCreate($from)
+{
+       global $MENU_ITEMS, $GLOBAL_BASE_URL;
+
+       $mlink = "$GLOBAL_BASE_URL/".$from;
+       $mlink = preg_replace("/\/[\/]+/", "/", $mlink);
+       
+       return $mlink;
+       
+}
+
+
 ?>
\ No newline at end of file