user_syndicate page, use tag and add action to set it
smbaker [Tue, 27 Nov 2012 04:09:05 +0000 (20:09 -0800)]
apps/gacksadmin/Makefile
apps/gacksadmin/action.php
apps/gacksadmin/user_syndicate.php

index de7702a..9345299 100644 (file)
@@ -1,9 +1,10 @@
 RPM_DIR = RPMS
 
-GACKS_PHP = accounts.php account.php action.php add_account.php invoices.php reservations.php reservation_set.php nodestatus.php weekly.php wizard.php user_reservations.php user_service_level.php user_confirm_service.php gackstable.php user_add_reservation.php user_persons.php user_summary.php user_nodelist.php user_image.php
+GACKS_PHP = accounts.php account.php action.php add_account.php invoices.php reservations.php reservation_set.php nodestatus.php weekly.php wizard.php user_reservations.php user_service_level.php user_confirm_service.php gackstable.php user_add_reservation.php user_persons.php user_summary.php user_nodelist.php user_image.php user_syndicate.php
 GACKS_JS = popup.js gackstable.js
 GACKS_MODULE = gacks.module vicci.module
 GACKS_INCLUDE = gacks_functions.php gacksclient.php
+GACKS_DB = 092-gacks
 
 rpms: rpm
 
@@ -15,10 +16,12 @@ gacksadminrpm:
        mkdir -p build/gacksadmin/var/www/html/modules/
        mkdir -p build/gacksadmin/var/www/html/planetlab/includes/
        mkdir -p build/gacksadmin/var/www/html/misc/
+       mkdir -p build/gacksadmin/etc/planetlab/db-config.d/
        cp $(GACKS_PHP) build/gacksadmin/var/www/html/planetlab/gacks/
        cp $(GACKS_MODULE) build/gacksadmin/var/www/html/modules/
        cp $(GACKS_INCLUDE) build/gacksadmin/var/www/html/planetlab/includes/ 
        cp $(GACKS_JS) build/gacksadmin/var/www/html/misc/
+       cp $(GACKS_DB) build/gacksadmin/etc/planetlab/db-config.d/
        # build it
        ravenbuilder gacksadmin build/gacksadmin $(RPM_DIR)
 
index 05c9708..1a73caa 100644 (file)
@@ -172,6 +172,19 @@ try {
             break;
         }
 
+        case 'set-syndicate': {
+            $account_name = $_POST['account_name'];
+            $enable_syndicate = $_POST['enable_syndicate'];
+            set_slice_tag($api, $account_name, "enable_syndicate", $enable_syndicate);
+            if ($enable_syndicate) {
+                drupal_set_message('Syndicate shared filesystem enabled. It may take a few minutes for the volume to show up in your slice');
+            } else {
+                drupal_set_message('Syndicate shared filesystem disabled.');
+            }
+            plc_redirect(l_gacks_syndicate());
+            break;
+        }
+
         case 'set-account': {
             $account_name = $_POST['account_name'];
             $url = $_POST['url'];
index 6b013d4..3e3b786 100644 (file)
@@ -46,32 +46,18 @@ $account_name = get_account_name($api, $_person_id);
 if ($account_name != NULL) {
     $gacksapi = new GACKSAPI();
 
-    $image = get_slice_image($api, $account_name);
-    if (!$image) {
-        $image = "";
-    }
-
-    $image_selectors = array();
-    $image_selectors []= array("display"=>"Default PlanetLab image", "value"=>"");
-    $image_selectors []= array("display"=>"Hadoop", "value"=>"hadoop");
-    $image_selectors []= array("display"=>"MPI", "value"=>"mpi");
-    if (!in_array($image, array("", "hadoop", "mpi"))) {
-        $image_selectors []= array("display"=> $image, "value"=> $image);
-    }
-    select_selector($image, $image_selectors);
-
-    $form = new PlekitForm(l_gacks_actions(), array("action"=>"set-image",
+    $form = new PlekitForm(l_gacks_actions(), array("action"=>"set-syndicate",
                                                     "account_name"=> $account_name));
     $form->start();
 
-    if (False) {
+    if (get_slice_tag($api, $account_name, "enable_syndicate")) {
         $syndicate_options=array('checked'=>'checked');
     } else {
         $syndicate_options=array();
     }
 
     print "<br>";
-    print $form->checkbox_html('syndicate-control', 'yes', $syndicate_options);
+    print $form->checkbox_html('enable_syndicate', '1', $syndicate_options);
     print "Enable Syndicate Shared Filesystem<br><br>";
 
     print $form->submit_html("submit", "submit");