[racktables-users] Re: Change numbering order in rack (bis)

  • From: Rémi Bouhl <rbouhl@xxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Wed, 03 Mar 2010 12:16:02 +0100

Ok, I've tried to add the feature, but got errors. I give it up. Just
for information, here is the patch, if someone wants to give it a try.
diff -ru -x secret.php racktables-dev/RackTables-0.17.8/inc/database.php 
racktables/inc/database.php
--- racktables-dev/RackTables-0.17.8/inc/database.php   2010-03-03 
12:01:55.000000000 +0100
+++ racktables/inc/database.php 2010-02-09 12:59:47.000000000 +0100
@@ -117,7 +117,6 @@
                        'height' => 'height',
                        'comment' => 'comment',
                        'row_id' => 'row_id',
-                       'up_to_down' => 'up_to_down',
                        'row_name' => '(select name from RackRow where 
RackRow.id = row_id)',
                ),
                'keycolumn' => 'id',
@@ -578,9 +577,8 @@
        return $ret;
 }
 
-function commitAddRack ($name, $height = 0, $row_id = 0, $comment, 
$up_to_down, $taglist)
+function commitAddRack ($name, $height = 0, $row_id = 0, $comment, $taglist)
 {
- 
        if ($row_id <= 0 or $height <= 0 or !strlen ($name))
                return FALSE;
        $result = useInsertBlade
@@ -591,7 +589,6 @@
                        'row_id' => $row_id,
                        'name' => "'${name}'",
                        'height' =>  $height,
-                       'up_to_down' => $up_to_down,
                        'comment' => "'${comment}'"
                )
        );
diff -ru -x secret.php racktables-dev/RackTables-0.17.8/inc/interface.php 
racktables/inc/interface.php
--- racktables-dev/RackTables-0.17.8/inc/interface.php  2010-02-16 
17:14:34.000000000 +0100
+++ racktables/inc/interface.php        2010-02-09 16:21:21.000000000 +0100
@@ -456,10 +456,12 @@
        echo "<table class=rack border=0 cellspacing=0 cellpadding=1>\n";
        echo "<tr><th width='10%'>&nbsp;</th><th width='20%'>Front</th>";
        echo "<th width='50%'>Interior</th><th width='20%'>Back</th></tr>\n";
-       $up_to_down=$rackData['up_to_down'];
        for ($i = $rackData['height']; $i > 0; $i--)
-       {       
-               echo "<tr><th>".($i + ($up_to_down * ($rackData['height'] - 
2*$i + 1)))."</th>";
+       //for ($i = 1; $i < $rackData['height'] +1; $i++)
+       {
+               echo "<tr><th>${i}</th>";
+               //$tempvar = $rackData['height']+1-$i;
+               //echo '<tr><th>'.$tempvar.'</th>';
                for ($locidx = 0; $locidx < 3; $locidx++)
                {
                        if (isset ($rackData[$i][$locidx]['skipped']))
@@ -523,9 +525,7 @@
        echo "</td></tr>\n";
        echo "<tr><th class=tdright>Height in units (*):</th><td 
class=tdleft><input type=text name=rack_height1 tabindex=2 
value='${defh}'></td></tr>\n";
        echo "<tr><th class=tdright>Comment:</th><td class=tdleft><input 
type=text name=rack_comment tabindex=3></td></tr>\n";
-       echo "<tr><th class=tdright>Numbers Up to Down?</th><td 
class=tdleft><input type=text name=up_to_down tabindex=4></td></tr>\n";
        echo "<tr><td class=submit colspan=2>";
-
        printImageHREF ('CREATE', 'Add', TRUE);
        echo "</td></tr></table></form>";
        finishPortlet();
Seulement dans racktables/inc/: interface.php.bak
diff -ru -x secret.php racktables-dev/RackTables-0.17.8/inc/ophandlers.php 
racktables/inc/ophandlers.php
--- racktables-dev/RackTables-0.17.8/inc/ophandlers.php 2010-03-03 
12:01:57.000000000 +0100
+++ racktables/inc/ophandlers.php       2009-11-23 06:48:44.000000000 +0100
@@ -1633,14 +1633,13 @@
 {
        assertUIntArg ('row_id', __FUNCTION__);
        $taglist = isset ($_REQUEST['taglist']) ? $_REQUEST['taglist'] : 
array();
-       echo($taglist);
        if (isset ($_REQUEST['got_data']))
        {
                assertStringArg ('rack_name', __FUNCTION__);
                assertUIntArg ('rack_height1', __FUNCTION__);
                assertStringArg ('rack_comment', __FUNCTION__, TRUE);
 
-               if (commitAddRack ($_REQUEST['rack_name'], 
$_REQUEST['rack_height1'], $_REQUEST['row_id'], $_REQUEST['rack_comment'], 
$_REQUEST['up_to_down'], $taglist) === TRUE)
+               if (commitAddRack ($_REQUEST['rack_name'], 
$_REQUEST['rack_height1'], $_REQUEST['row_id'], $_REQUEST['rack_comment'], 
$taglist) === TRUE)
                        return buildRedirectURL (__FUNCTION__, 'OK', array 
($_REQUEST['rack_name']));
                else
                        return buildRedirectURL (__FUNCTION__, 'ERR1', array 
($_REQUEST['rack_name']));
@@ -1664,7 +1663,7 @@
                }
                global $msgcode;
                foreach ($names2 as $cname)
-                       if (commitAddRack ($cname, $_REQUEST['rack_height2'], 
$_REQUEST['row_id'], '', $_REQUEST['up_to_down'], $taglist) === TRUE)
+                       if (commitAddRack ($cname, $_REQUEST['rack_height2'], 
$_REQUEST['row_id'], '', $taglist) === TRUE)
                                $log['m'][] = array ('c' => 
$msgcode[__FUNCTION__]['OK'], 'a' => array ($cname));
                        else
                                $log['m'][] = array ('c' => 
$msgcode[__FUNCTION__]['ERR1'], 'a' => array ($cname));
Seulement dans racktables/inc/: secret-sample.php
Seulement dans racktables-dev/RackTables-0.17.8/inc/: secret-sample.php~

Other related posts: