remove submit button from get_account_name; first account will be chosen by default
smbaker [Tue, 20 Nov 2012 03:14:43 +0000 (19:14 -0800)]
apps/gacksadmin/gacks_functions.php

index 6afca78..b025c59 100644 (file)
@@ -462,12 +462,6 @@ function get_account_name($api, $_person_id, $form=NULL, $url=NULL)
         $account_name = $session['account_name'];
     }
 
-// this would be if we want to do it like how plc does loging...
-//    if ($account_name == NULL) {
-//        Header("Location: /db/gacks/set_account.php?url=" . urlencode($url));
-//        exit();
-//    }
-
     drupal_add_js("misc/popup.js");
 
     if ($form == NULL) {
@@ -485,24 +479,22 @@ function get_account_name($api, $_person_id, $form=NULL, $url=NULL)
         $account_name = NULL;
     }
 
-    if ($account_name == NULL) {
-        print "Slice name:<br>";
-        print $form->select_html("account_name", $selectors);
-        print $form->submit_html("submit", "submit");
+    print "Slice name:<br>";
+    if ($url != NULL) {
+        $onChange = "PopupMessage(); this.form.action=\"$url\"; this.form.submit();";
     } else {
-        print "Slice name:<br>";
-        if ($url != NULL) {
-            $onChange = "PopupMessage(); this.form.action=\"$url\"; this.form.submit();";
-        } else {
-            $onChange = "PopupMessage(); this.form.submit();";
-        }
-        print $form->select_html("account_name", $selectors, array("onChange"=> $onChange));
+        $onChange = "PopupMessage(); this.form.submit();";
     }
+    print $form->select_html("account_name", $selectors, array("onChange"=> $onChange));
 
     if ($needFormEnd) {
         $form->end();
     }
 
+    if ((!$account_name) && ($selectors)) {
+        $account_name = $selectors[0]["value"];
+    }
+
     return $account_name;
 }