moved some stuff back to lib from plugins
authorpaulr <me@pjr.cc>
Tue, 26 Apr 2011 14:22:47 +0000 (00:22 +1000)
committerpaulr <me@pjr.cc>
Tue, 26 Apr 2011 14:22:47 +0000 (00:22 +1000)
doc/globals.txt
lib/datastore.php [moved from lib/plugins/datastore.php with 68% similarity]
lib/db.php [moved from lib/plugins/db.php with 100% similarity]
lib/lib.php
lib/messages.php [moved from lib/plugins/messages.php with 100% similarity]
lib/www.php [moved from lib/plugins/www.php with 90% similarity]

index e77fa2d..49b5a27 100644 (file)
@@ -4,5 +4,9 @@ $BASE_URLS["ypc"]["function"] = "yp_contentUrlsCtl";
 $MENU_ITEMS["yp"]["title"] = "YUM Proxy";
 $MENU_ITEMS["yp"]["link"] = "/ypc/proxycontrol";
 
+$VERSION["item"]["major"] 
+$VERSION["item"]["minor"] 
+$VERSION["item"]["release"] 
+
 $GLOBAL_BASE_URL="/src/eclipse-workspace/glcas/www/";
 $DB_URL="sqlite:$BASE_DIR/var/ds_store.db";
similarity index 68%
rename from lib/plugins/datastore.php
rename to lib/datastore.php
index db51d36..a074cc3 100644 (file)
@@ -3,10 +3,44 @@ global $BASE_URLS, $MENU_ITEMS, $GLOBAL_BASE_URL;
 
 $BASE_URLS["ds"]["base"] = "ds"; // ap for apt-proxy
 $BASE_URLS["ds"]["function"] = "ds_contentUrls"; // the page builder function for us
+
+// the datastore post url
+$BASE_URLS["dsp"]["base"] = "dsp"; // ap for apt-proxy
+$BASE_URLS["dsp"]["function"] = "ds_contentPostUrls"; // the page builder function for us
+
 $MENU_ITEMS["ds"]["title"] = "DataStores";
 $MENU_ITEMS["ds"]["link"] = "/ds/control";
 
 
+function ds_contentPostUrls()
+{
+       $calls["needs_base_page"] = false;
+       $calls["page_builder"] = "ds_postContent";
+       
+       return $calls;
+}
+
+function ds_postContent()
+{
+       global $URL_COMPONENTS;
+       $call = $URL_COMPONENTS[1];
+       
+       switch($call) {
+               case "createds":
+                       $dsname = $_REQUEST["dsname"];
+                       $dsloc = $_REQUEST["dsloc"];
+                       ds_createDS($dsname, $dsloc);
+                       msg_addMessage("#008800", "DataStore, $dsname created at $dsloc");
+                       break;
+       }
+               
+       $loc = urlCreate("/ds/control");
+       header("Location: $loc");
+       
+       return 0;
+       
+}
+
 function ds_contentPane()
 {
        global $URL_COMPONENTS;
@@ -30,13 +64,24 @@ function ds_contentPane()
 
 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>";
+       global $GLOBAL_BASE_URL;
+       echo "<h3>DataStores</h3>";
+       $dss = ds_listDS();
        
-       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\">";
+       if($dss != false) {
+               echo "<table border=1>";
+               echo "<tr><td>DataStore Name</td><td>DataStore Path</td><td>Size</td><td>Usage</td><td>Control</td></tr>";
+               foreach($dss as $dsl) {
+                       $dsname = $dsl["dsname"];
+                       $dspath = $dsl["dslocation"];
+                       echo "<tr><td>$dsname</td><td>$dspath</td></tr>";
+               }
+               echo "</table>";
+       }
+       echo "<h3>Create DataStore</h3>";
+       echo "<form method=\"post\" action=\"".urlCreate("/dsp/createds")."\">";
+       echo "DataStore Name: <input type=\"text\" name=\"dsname\"><br>";
+       echo "DataStore Location: <input type=\"text\" name=\"dsloc\"><br>";
        echo "<input type=\"submit\" name=\"create\" value=\"create\">";
        echo "</form>";
        
@@ -45,7 +90,7 @@ function ds_controlPane()
 function ds_leftMenu()
 {
        global $GLOBAL_BASE_URL;
-       echo "<b>Browse</b><br>";
+       echo "<h3>Browse</h3>";
        $dss = ds_listDS();
        //echo "<pre>";
        //print_r($dss);
similarity index 100%
rename from lib/plugins/db.php
rename to lib/db.php
index e446b09..63462fe 100644 (file)
@@ -2,7 +2,8 @@
 
 require_once("config.php");
 require_once("wsdl.php");
-
+require_once("www.php");
+require_once("db.php");
 
 // first and foremost, load the plugins
 $basedir = dirname(__FILE__);
similarity index 100%
rename from lib/plugins/messages.php
rename to lib/messages.php
similarity index 90%
rename from lib/plugins/www.php
rename to lib/www.php
index 3d5b9d1..f356ca0 100644 (file)
@@ -41,7 +41,7 @@ function www_basePage($calls)
                www_header();
        }
        
-       echo "<table><tr><td>";
+       echo "<table><tr><td colspan=\"2\">";
        
        // top
        if(isset($calls["top_function"])) {
@@ -71,7 +71,7 @@ function www_basePage($calls)
                www_contentpane();
        }
        
-       echo "</td></tr><tr><td>";
+       echo "</td></tr><tr colspan=\"2\"><td>";
        
        // footer
        if(isset($calls["footer_function"])) {
@@ -95,7 +95,9 @@ function www_basePage($calls)
 
 function www_header()
 {
-       echo "<html><head></head><body>";
+       echo "<html><head>";
+       echo "<link rel=\"stylesheet\" href=\"".urlCreate("/css/content.css")."\" type=\"text/css\" media=\"screen, projection\" /> ";
+       echo "</head><body>";
 }
 
 function www_top()
@@ -115,7 +117,7 @@ function www_top()
        
        echo "</tr></table>";
        if(function_exists("msg_haveMessages")) if(msg_haveMessages()) {
-               echo "<table bgcolor=\"#ddddff\">";
+               echo "<table bgcolor=\"#eeeeff\">";
                $msgs = msg_getMessages();
                
                foreach($msgs as $msg) {