View Issue Details

IDProjectCategoryView StatusLast Update
587RackTablesdefaultpublic2012-07-27 19:00
Reportereven Assigned Toadoom42  
PrioritylowSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
Product Version0.19.13 
Summary587: Unable to change rack numbering order
DescriptionWhen starting to use racktables I discovered the numbering on the racks at our hosting provider is the other way around. After searching, I was unable to find a way in the interface to make racks be numbered in the reverse from the default order. Then finding some people also asking for it on the mailinglist (http://www.freelists.org/post/racktables-users/Change-numbering-order-in-rack-bis) I decided to have a go at it. I've managed to create a drop down list to select the numbering order in the add rack and edit rack properties.
While the code could be prettier, I thought I'd send it because it could be useful to other people.

######## DB changes begin ###


alter table Rack ADD numbering tinytext NOT NULL AFTER height;
alter table RackHistory add numbering tinytext not null after height;

update Rack set numbering="descending" where numbering="";
update RackHistory set numbering="descending" where numbering="";


######## DB changes end ###

######## File changes begin ###################

user@machine:~$ diff ophandlers.php RackTables-0.19.13/wwwroot/inc/ophandlers.php
2032d2031
< assertStringArg ('rack_numbering1');
2034c2033
< commitAddRack ($_REQUEST['rack_name'], $_REQUEST['rack_height1'], $_REQUEST['rack_numbering1'], $_REQUEST['row_id'], $_REQUEST['rack_comment'], $taglist);
---
> commitAddRack ($_REQUEST['rack_name'], $_REQUEST['rack_height1'], $_REQUEST['row_id'], $_REQUEST['rack_comment'], $taglist);
2057,2058c2056
< commitAddRack ($cname, $_REQUEST['rack_height2'], $_REQUEST['rack_numbering2'], $_REQUEST['row_id'], '', $taglist);
< echo "<tr><th class=tdright> *** testing *** Up to down numbering ( 0 or 1) (required):</th><td class=tdleft><input type=checkbox name=rack_up_to_down value='${rack['up_to_down']}'></td></tr>\n";
---
> commitAddRack ($cname, $_REQUEST['rack_height2'], $_REQUEST['row_id'], '', $taglist);
2089d2086
< assertStringArg ('rack_numbering');
2094c2091
< if (TRUE === commitUpdateRack ($rack_id, $_REQUEST['rack_name'], $_REQUEST['rack_height'], $_REQUEST['rack_numbering'], $_REQUEST['rack_row_id'], $_REQUEST['rack_comment']))
---
> if (TRUE === commitUpdateRack ($rack_id, $_REQUEST['rack_name'], $_REQUEST['rack_height'], $_REQUEST['rack_row_id'], $_REQUEST['rack_comment']))


user@machine:~$ diff database.php RackTables-0.19.13/wwwroot/inc/database.php
143d142
< 'numbering' => 'numbering',
613c612
< function commitAddRack ($name, $height, $numbering, $row_id, $comment, $taglist)
---
> function commitAddRack ($name, $height, $row_id, $comment, $taglist)
623d621
< 'numbering' => $numbering,
911c909
< function commitUpdateRack ($rack_id, $new_name, $new_height, $new_numbering, $new_row_id, $new_comment)
---
> function commitUpdateRack ($rack_id, $new_name, $new_height, $new_row_id, $new_comment)
926d923
< 'numbering' => $new_numbering,


user@machine:~$ diff interface.php RackTables-0.19.13/wwwroot/inc/interface.php
344d343
< //echo "numbering: {$rackData['numbering']}";
350,364c349
< // hack begin
< if ($rackData['numbering'] == "ascending")
< {
< $max_rack_height = $rackData['height'];
< $reverse_number = $max_rack_height - $i + 1;
< echo "<tr><th>${reverse_number}</th>";
< }
< else
< {
< echo "<tr><th>${i}</th>";
< }
< // original begin
< //echo "<tr><th>${i}</th>";
< // original end
< // hack end
---
> echo "<tr><th>${i}</th>";
439,443d423
< echo "<tr><th class=tdright>Numbering (*):</th><td class=tdleft>
< <select id='numbering1' name='rack_numbering1'>
< <option selected='selected' value='descending'>Descending</option>
< <option value='ascending'>Ascending</option>
< </select></td></tr>\n";
456,460d435
< echo "<tr><th class=tdright>Numbering (*):</th><td class=tdleft>
< <select id='numbering2' name='rack_numbering2'>
< <option selected='selected' value='descending'>Descending</option>
< <option value='ascending'>Ascending</option>
< </select></td></tr>\n";
603d577
<
619,634d592
< if ($rack['numbering'] == "descending")
< {
< echo "<tr><th class=tdright>Numbering (required):</th><td class=tdleft>
< <select id='numbering' name='rack_numbering'>
< <option selected='selected' value='descending'>Descending</option>
< <option value='ascending'>Ascending</option>
< </select></td></tr>\n";
< }
< else
< {
< echo "<tr><th class=tdright>Numbering (required):</th><td class=tdleft>
< <select id='numbering' name='rack_numbering'>
< <option value='descending'>Descending</option>
< <option selected='selected' value='ascending'>Ascending</option>
< </select></td></tr>\n";
< }
1988c1946
< $query = "select ctime, user_name, name, numbering, comment from RackRowHistory where id = ? order by ctime";
---
> $query = "select ctime, user_name, name, comment from RackRowHistory where id = ? order by ctime";
1994c1952
< "select ctime, user_name, rh.name, rr.name as name, rh.height, rh.numbering, rh.comment " .
---
> "select ctime, user_name, rh.name, rr.name as name, rh.height, rh.comment " .
1997,1998c1955,1956
< $header = '<tr><th>change time</th><th>author</th><th>rack name</th><th>rack row name</th><th>rack height</th><th>numbering</th><th>rack comment</th></tr>';
< $extra = 6;
---
> $header = '<tr><th>change time</th><th>author</th><th>rack name</th><th>rack row name</th><th>rack height</th><th>rack comment</th></tr>';
> $extra = 5;
3866,3878c3824
< // hack begin
< if ($data['numbering'] == "ascending")
< {
< $max_rack_height = $data['height'];
< $reverse_number = $max_rack_height - $unit_no + 1;
< echo "<tr><th><a href='javascript:;' onclick=\"toggleRowOfAtoms('${rack_id}','${unit_no}')\">${reverse_number}</a></th>";
< }
< // original
< else
< {
< echo "<tr><th><a href='javascript:;' onclick=\"toggleRowOfAtoms('${rack_id}','${unit_no}')\">${unit_no}</a></th>";
< }
< // hack end
---
> echo "<tr><th><a href='javascript:;' onclick=\"toggleRowOfAtoms('${rack_id}','${unit_no}')\">${unit_no}</a></th>";

######## File changes end #####################
TagsNo tags attached.

Relationships

duplicate of 370 closedadoom42 Sort Row manually 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2012-07-27 16:49 even New Issue
2012-07-27 18:59 adoom42 Assigned To => adoom42
2012-07-27 18:59 adoom42 Status new => closed
2012-07-27 18:59 adoom42 Resolution open => won't fix
2012-07-27 18:59 adoom42 Product Version => 0.19.13
2012-07-27 19:00 adoom42 Relationship added duplicate of 370