added images to make this an all-in-one package.
authorStephen Soltesz <soltesz@cs.princeton.edu>
Tue, 2 Jun 2009 18:05:27 +0000 (18:05 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Tue, 2 Jun 2009 18:05:27 +0000 (18:05 +0000)
updated register to handle cases when the node already exists by forcing user
to assign pcu to node.
update download with new boot states
update confirm to report errors correctly on failed API call.
view enhancements.
disabled floppy/generic iso as an option.

application/controllers/confirm.php
application/controllers/download.php
application/controllers/register.php
application/views/stage1_pcu_choose.php
application/views/stage45_pcuport.php
application/views/stage5_bootimage.php
application/views/stage8_rebootpcu.php
images/all-in-one-cd.png [new file with mode: 0644]
images/all-in-one-usb.png [new file with mode: 0644]

index 83fe71c..dfd0184 100644 (file)
@@ -11,7 +11,6 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
 include 'plc_objects.php';
 
 
 include 'plc_objects.php';
 
 
@@ -164,12 +163,12 @@ class Confirm extends Controller {
        {
                global $api, $plc;
                $hostname = $data['node_id'];
        {
                global $api, $plc;
                $hostname = $data['node_id'];
-               $api->UpdateNode( $hostname, array( "boot_state" => 'rins') );
+               $api->UpdateNode( $hostname, array( "boot_state" => 'reinstall') );
                $ret = $api->RebootNodeWithPCU( $hostname );
                if ( "$ret" != "0" ) {
                $ret = $api->RebootNodeWithPCU( $hostname );
                if ( "$ret" != "0" ) {
-                       $data['error'] = $ret;
-               } else {
                        $data['error'] = $api->error();
                        $data['error'] = $api->error();
+               } else {
+                       $data['error'] = $ret;
                }
        }
 }
                }
        }
 }
index 06e1737..fa64938 100644 (file)
@@ -11,7 +11,6 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
 include 'plc_objects.php';
 
 
 include 'plc_objects.php';
 
 
@@ -108,7 +107,7 @@ class Download extends Controller {
                                        $basename=PLC_NAME."-BootCD.usb";
                                }
 
                                        $basename=PLC_NAME."-BootCD.usb";
                                }
 
-                               $api->UpdateNode( $hostname, array( "boot_state" => 'disable',
+                               $api->UpdateNode( $hostname, array( "boot_state" => 'disabled',
                                                                                                        "version" => $this->get_bootcd_version() ) );
                                /* exits on success */
                                $success = $this->deliver_bootmedium($node_id, $boot_action, $basename);
                                                                                                        "version" => $this->get_bootcd_version() ) );
                                /* exits on success */
                                $success = $this->deliver_bootmedium($node_id, $boot_action, $basename);
@@ -140,7 +139,7 @@ class Download extends Controller {
                                }
 
                                $hostname= $node_detail['hostname'];
                                }
 
                                $hostname= $node_detail['hostname'];
-                               $return= $api->GetNodeNetworks( array( "node_id" => $node_id ), NULL );
+                               $return= $api->GetInterfaces( array( "node_id" => $node_id ), NULL );
                   
                                $can_gen_config= 1;
                                $data['has_primary']= 0;
                   
                                $can_gen_config= 1;
                                $data['has_primary']= 0;
@@ -216,7 +215,7 @@ class Download extends Controller {
                                        }        
                                        if ($action != 'download-node-floppy')
                                        {
                                        }        
                                        if ($action != 'download-node-floppy')
                                        {
-                                               $api->UpdateNode( $hostname, array( "boot_state" => 'disable',
+                                               $api->UpdateNode( $hostname, array( "boot_state" => 'disabled',
                                                                                  "version" => $this->get_bootcd_version() ) );
                                        }
                                        /* exits on success */
                                                                                  "version" => $this->get_bootcd_version() ) );
                                        }
                                        /* exits on success */
index 0334251..242d860 100644 (file)
@@ -11,7 +11,7 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
+//require_once 'plc_sorts.php';
 include 'plc_objects.php';
 
 
 include 'plc_objects.php';
 
 
@@ -117,11 +117,12 @@ class Register extends Controller {
                global $api, $plc;
                // get sites depending on role and sites associated.
                if( $person->isAdmin() ) {
                global $api, $plc;
                // get sites depending on role and sites associated.
                if( $person->isAdmin() ) {
-                       $site_info= $api->GetSites( NULL, array( "name", "site_id", "login_base" ) );
+                       $site_info= $api->GetSites(array('peer_id' => NULL,'-SORT'=>'name'), 
+                                                                               array( "name", "site_id", "login_base" ) );
                } else {
                        $site_info= $api->GetSites( $person->getSites(), array( "name", "site_id", "login_base" ) );
                }
                } else {
                        $site_info= $api->GetSites( $person->getSites(), array( "name", "site_id", "login_base" ) );
                }
-               sort_sites( $site_info );
+               //sort_sites( $site_info );
                return $site_info;
        }
 
                return $site_info;
        }
 
@@ -385,8 +386,8 @@ class Register extends Controller {
                                }
                        }
 
                                }
                        }
 
-                       $nodenetwork_id= $api->AddNodeNetwork( $node_id, $optional_vals);
-                       if( $nodenetwork_id <= 0 ) {
+                       $interface_id= $api->AddInterface( $node_id, $optional_vals);
+                       if( $interface_id <= 0 ) {
                                $data['error'] = $api->error();
                                print $data['error'];
                        }
                                $data['error'] = $api->error();
                                print $data['error'];
                        }
@@ -480,14 +481,20 @@ class Register extends Controller {
                        print $this->validation->error_string . "<br>";
                }
 
                        print $this->validation->error_string . "<br>";
                }
 
-
                $data['node'] = $this->getnode($data['node_id']);
                $data['node'] = $this->getnode($data['node_id']);
-               $api_pcus = $api->GetPCUs($data['node']->pcu_ids);
-               $pcu = $api_pcus[0];
+               if ( sizeof($data['node']->pcu_ids) == 0)
+               {
+                       $data['pcu_assigned'] = False;
+                       $data['pcu_port'] = -1;
+               } else {
+                       $data['pcu_assigned'] = True;
+                       $api_pcus = $api->GetPCUs($data['node']->pcu_ids);
+                       $pcu = $api_pcus[0];
+                       # NOTE: find index of node id, then pull out that index of
+                       $index = array_search($data['node_id'], $pcu['node_ids']);
+                       $data['pcu_port'] = $pcu['ports'][$index];
+               }
 
 
-               # NOTE: find index of node id, then pull out that index of
-               $index = array_search($data['node_id'], $pcu['node_ids']);
-               $data['pcu_port'] = $pcu['ports'][$index];
                $data['stage'] = 4.5;
                #$data = $this->get_stage4_data($person, $data);
                $this->load->view('header', $data);
                $data['stage'] = 4.5;
                #$data = $this->get_stage4_data($person, $data);
                $this->load->view('header', $data);
@@ -673,7 +680,7 @@ class Register extends Controller {
                        if ( count($optional_vals) > 0 )
                        {
                                print_r($optional_vals);
                        if ( count($optional_vals) > 0 )
                        {
                                print_r($optional_vals);
-                               $ret = $api->UpdateNodeNetwork( $node_obj->nodenetwork_id, $optional_vals);
+                               $ret = $api->UpdateInterface( $node_obj->interface_id, $optional_vals);
                                if( $ret <= 0 ) {
                                        $data['error'] = $api->error();
                                        print $data['error'];
                                if( $ret <= 0 ) {
                                        $data['error'] = $api->error();
                                        print $data['error'];
index ff4845c..5a279b5 100644 (file)
@@ -51,6 +51,8 @@
                                                        <td>
                                                        </td>
                                                </tr>
                                                        <td>
                                                        </td>
                                                </tr>
+                       <?php else: ?>
+                                       <tr><th>ERROR:</th><td>No sites returned...</td></tr>
                        <?php endif; ?>
                                        <tr><th>Model: </th>
                                                <td>
                        <?php endif; ?>
                                        <tr><th>Model: </th>
                                                <td>
index e076a59..5b25bcb 100644 (file)
@@ -15,6 +15,7 @@ if( isset($errors) && count($errors) > 0 )
 Please confirm that the node is associated with the correct port on the PCU.
 Most newer models have this function built-in, where as older models allow for
 multiple 'ports'.  Port 1 is appropriate for built-in models.
 Please confirm that the node is associated with the correct port on the PCU.
 Most newer models have this function built-in, where as older models allow for
 multiple 'ports'.  Port 1 is appropriate for built-in models.
+<?php if ( $pcu_assigned ): ?>
 <?= form_open("download/stage5_bootimage/$pcu_id/$site_id/$node_id", array('method'=>'post')) ?>
 <center>
                <input type=hidden name='pcu_id' value='<?= $pcu_id ?>'>
 <?= form_open("download/stage5_bootimage/$pcu_id/$site_id/$node_id", array('method'=>'post')) ?>
 <center>
                <input type=hidden name='pcu_id' value='<?= $pcu_id ?>'>
@@ -23,6 +24,7 @@ multiple 'ports'.  Port 1 is appropriate for built-in models.
                <input type=submit name='node_confirm' value='Confirm & Proceed'>
 </center>
 </form>
                <input type=submit name='node_confirm' value='Confirm & Proceed'>
 </center>
 </form>
+<?php endif; ?>
 </div>
 <br>
 <div class="plroundedupdate">
 </div>
 <br>
 <div class="plroundedupdate">
index 919e458..1583d60 100644 (file)
@@ -16,29 +16,30 @@ function updateContinueEnabled()
        <table style="font-size: 100%">
        <tr>
          <td><input type='radio' name='action' value='download-node-iso' onchange='updateContinueEnabled();'></td>
        <table style="font-size: 100%">
        <tr>
          <td><input type='radio' name='action' value='download-node-iso' onchange='updateContinueEnabled();'></td>
-         <td><img src="/misc/all-in-one-cd.png"/></td><td><b>All-In-One ISO image</b>.  
+         <td><img src="/registerwizard/images/all-in-one-cd.png"/></td><td><b>All-In-One ISO image</b>.  
                        Includes plnode.txt.  No additional formatting required.</td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-usb' onchange='updateContinueEnabled();'></td>
                        Includes plnode.txt.  No additional formatting required.</td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-usb' onchange='updateContinueEnabled();'></td>
-         <td><img src="/misc/all-in-one-usb.png" /></td><td><b>All-In-One USB image</b>. Includes plnode.txt, and filesystem only.  Requires additional USB stick formatting.**</td>
+         <td><img src="/registerwizard/images/all-in-one-usb.png" /></td><td><b>All-In-One USB image</b>. Includes plnode.txt, and filesystem only.  Requires additional USB stick formatting.**</td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-usb-partition' onchange='updateContinueEnabled();'></td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-usb-partition' onchange='updateContinueEnabled();'></td>
-         <td><img src="/misc/all-in-one-usb.png" /></td><td><b>All-In-One partitioned, USB image</b>.  Includes, plnode.txt, MBR, partition table, and filesystem.  No additional formatting required.**</td>
+         <td><img src="/registerwizard/images/all-in-one-usb.png" /></td><td><b>All-In-One partitioned, USB image</b>.  Includes, plnode.txt, MBR, partition table, and filesystem.  No additional formatting required.**</td>
        </tr>
        </tr>
-       <tr>
+       <!--tr>
          <td><input type='radio' name='action' value='download-node-floppy-with-iso' onchange='updateContinueEnabled();'></td>
          <td><img src="/misc/generic-cd-and-floppy.png" /></td><td><b>Generic CD</b>, and <b>plnode.txt</b> on Floppy</td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-floppy-with-usb' onchange='updateContinueEnabled();'></td>
          <td><img src="/misc/generic-usb-and-floppy.png" /></td><td><b>Generic USB</b>, and <b>plnode.txt</b> on Floppy</td>
          <td><input type='radio' name='action' value='download-node-floppy-with-iso' onchange='updateContinueEnabled();'></td>
          <td><img src="/misc/generic-cd-and-floppy.png" /></td><td><b>Generic CD</b>, and <b>plnode.txt</b> on Floppy</td>
        </tr>
        <tr>
          <td><input type='radio' name='action' value='download-node-floppy-with-usb' onchange='updateContinueEnabled();'></td>
          <td><img src="/misc/generic-usb-and-floppy.png" /></td><td><b>Generic USB</b>, and <b>plnode.txt</b> on Floppy</td>
-       </tr>
+       </tr-->
        </table>
 
        </table>
 
+       <p></p>
        <p>Additional directions are provided on the next page.</p>
        <p>Additional directions are provided on the next page.</p>
-       <p>NOTE:  ** USB images are not guaranteed to work on all systems.</p>
+       <p>NOTE:  ** USB images are not guaranteed to work on all systems or with all USB memory sticks.</p>
 </div>
        <center>
        <input type=submit name='download_bootimage' disabled value='Select'> 
 </div>
        <center>
        <input type=submit name='download_bootimage' disabled value='Select'> 
index c5c26ea..dd0cf71 100644 (file)
@@ -2,15 +2,15 @@
 <div class="plroundedwhite">
 <h3>Confirm Reboot Node With PCU</h3>
 <dl>
 <div class="plroundedwhite">
 <h3>Confirm Reboot Node With PCU</h3>
 <dl>
-       <?php if ( $node['boot_state'] == "disable" ): ?>
+       <?php if ( $node['boot_state'] == "disabled" ): ?>
        <dt>Step 1</dt>
                <dd>
                        <span class='error'>
        <dt>Step 1</dt>
                <dd>
                        <span class='error'>
-                       Use the 'Test Reboot' button.  This will set the boot state to 'rins' and 
+                       Use the 'Test Reboot' button.  This will set the boot state to 'reinstall' and 
                        attempt to reboot your machine using the registered PCU.
                        </span>
                </dd>
                        attempt to reboot your machine using the registered PCU.
                        </span>
                </dd>
-       <?php elseif ( $node['boot_state'] == "rins" || $node['boot_state'] == "reinstall" ): ?>
+       <?php elseif ( $node['boot_state'] == "reinstall" ): ?>
 <?php if ( isset($error) && ! empty($error) ): ?>
        <dt>If Reboot fails,</dt><dd>
                        there will be an error displayed that will assist you in
 <?php if ( isset($error) && ! empty($error) ): ?>
        <dt>If Reboot fails,</dt><dd>
                        there will be an error displayed that will assist you in
@@ -52,7 +52,7 @@
                <td>
                <?php if ( $node['boot_state'] == "disable" ): ?>
                        <span class='error'> Start with the 'Test Reboot' button.</span>
                <td>
                <?php if ( $node['boot_state'] == "disable" ): ?>
                        <span class='error'> Start with the 'Test Reboot' button.</span>
-               <?php elseif ( $node['boot_state'] == "rins" ): ?>
+               <?php elseif ( $node['boot_state'] == "reinstall" ): ?>
                        <br>'Test Reboot' to start again.<br>
                        'Reload' to Reload this page.
                <?php else: ?>
                        <br>'Test Reboot' to start again.<br>
                        'Reload' to Reload this page.
                <?php else: ?>
diff --git a/images/all-in-one-cd.png b/images/all-in-one-cd.png
new file mode 100644 (file)
index 0000000..dcbc661
Binary files /dev/null and b/images/all-in-one-cd.png differ
diff --git a/images/all-in-one-usb.png b/images/all-in-one-usb.png
new file mode 100644 (file)
index 0000000..7f05d86
Binary files /dev/null and b/images/all-in-one-usb.png differ