/
RackPlannerPlugin.txt
178 lines (144 loc) · 14.4 KB
/
RackPlannerPlugin.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
%META:TOPICINFO{author="ProjectContributor" date="1181042297" format="1.0" version="$Rev$"}%
---+ <nop>RackPlannerPlugin
The <nop>RackPlannerPlugin handles the tag =%<nop>RACKPLANNER%= and renders a rack overview (HTML table) with devices (computer, router, switches, ...).
---++ Syntax Rules
Devices are defined within a Foswiki table. Following columns are supported:
| *Device* | *Rack* | *Starting Unit* | *Form Factor* | *Connected to:* | *Owner* | *Color/Image* | *Notes* |
| device name(s) (separated by =' / '= or =' # '=) | rack name | a starting unit (a number between 1 and =units=) | a form factor (units, e.g. 4U, 2, 1U, ...) | device(s) is/are connected to ... (comma separated list of other devices, ports ...); every 'connected to' item is displayed as a icon (see =connectedtoicon=, e.g. %M%) with the text as tooltip; if you use links the icons are also links; | the device owner(s) is/are displayed as tooltip of the device name | colors or a background image (a URL or shortcut, e.g. @sun - see attachments) for the table data cell | notes are displayed as a icon (=notesicon= e.g. %P%) with the note as tooltip; if you use a link the icon is also a link |
| *must* | *must*| *must* | *must* | *optional* | *optional* | *optional* | *optional* |
| *Examples* ||||||||
| Server1 | RackS21 | 10 | 2U | port31 | server admins | blue,white | not in use |
| Patchfield1 / Switch2 | RackS21 | 40 | 1U | switch3 / router4 | network admins / network admins | blue,white / green,white | 3 ports free / 8 ports free |
| SunServer2 | RackS21 | 15 | 4U | port12 | sun server admins | blue,white,@sun | |
You can use following =%<nop>EDITTABLE%= tag (EditTablePlugin must be installed) to simplify some things (%X% it must be one line):
<verbatim>
%EDITTABLE{format="|text,10,|text,10,|text,5,1|select,1,1U,2U,3U,4U,5U,6U,7U,8U,9U,10U|text,20,|text,20,|text,10,|textarea,3x20|"
header="|*Device*|*Rack*|*Starting Unit*|*Form Factor*|*Connected to:*|*Owner*|*Color/Image*|*Notes*|"}%
</verbatim>
This =%<nop>EDITTABLE%= tag is an example. Feel free to modify the attributes (=format= and =header=). Hint: Put a =%<nop>TABLE{initsort="3" initdirection="down"}%= tag before the =%<nop>EDITTABLE%= tag to sort the table like the rack (modify =initdirection= to ="up"= if your first unit is at the top of the rack (=dir="topdown"=)).
*Notes:*
* The device order in the table is not relevant (except there's a conflict) but the column order is relevant (because the table header will be ignored).
* If more than one device uses the same unit the conflict will be displayed with a icon (see =conflicticon= attribute, e.g. %S%). The tooltip of the icon contains the device names.
* If you have more than one device in the same unit you have to put them into a single table row and separate device names, 'connected to', owner, colors, notes with a =' / '= or a =' # '= (a whitespace before and after the separator is required).
---++ Attributes
Usage: =%<nop>RACKPLANNER{attribute1="value" attribute2="value" ... }%=
<br/>Example: =%<nop>RACKPLANNER{racks="rack1, rack2"}%=
| *Attribute* | *Description* | *Example/Default* |
| *Behavior:* |||
| autotopic | set it =on= and every rack name is automatically used as source topic for the device definition (=racks= attribute is required and the value is attached to the =topic= attribute value); useful if you define your racks and devices on topics with the same names as the racks | =autotopic="off"= |
| dir | sets the direction of the units: =topdown= - unit 1 is at the top of the rack; =bottomup= - unit 1 is at the bottom of the rack; =leftright= - units are shown horizontal with unit 1 at the left; =rightleft= - units are shown horizontal with unit 1 at the right | =dir="bottomup"= |
| clicktooltip | if enabled <nop>JavaScript tooltips are only shown with a mouse click to the table cell instead of 'mouse over' (related: enablejstooltips, clicktooltiptext) | =clicktooltip="off"= |
| enablejstooltips | enables/disables <nop>JavaScript tooltips | =enablejstooltips="1"= |
| racks | a comma separated list of rack names to show; if omitted all racks found on topics (see =topic= attribute) are shown | =racks="rack1,rack2"= |
| steps | unit steps to display (useful if you use only every =steps= unit of a rack) | =steps="1"= |
| topic | a comma separated list of source topics | =topic="%<nop>TOPIC%"= |
| units | units to show | =units="46"= |
| *Icons:* |||
| conflicticon | if a conflict exists this icon will be displayed | =conflicticon="%<nop>S%"= |
| connectedtoicon | if a 'connected to' entry exists this icon will be displayed with the entry as tooltip | =connectedtoicon="%<nop>M%"= |
| notesicon | if a 'notes' entry exists this icon will be displayed with the note as tooltip | =notesicon="%<nop>P%"= |
| ownericon | only used for !JavaScript tooltips | =ownericon="%<nop>ICON{persons}%"= |
| *Formatting:* |||
| clicktooltiptext | tooltip text if clicktooltip is enabled | =clicktooltiptext="click for information"= |
| columnwidth | column width | =columnwidth="50px"= |
| devicebgcolor | default device background color | =devicebgcolor="#f0f0f0"= |
| devicefgcolor | default device foreground color | =devicefgcolor="#000000"= |
| displayconnectedto | if enabled the 'connected to' text entry will be displayed in the table cell instead of the 'connected to' icon | =displayconnectedto="off"= |
| displaynotes | if enabled the 'notes' entry will be displayed in the table cell instead of the 'notes' icon | =displaynotes="off"= |
| displayowner | if enabled the 'owner' entry will be displayed in the table cell | =displayowner="off"= |
| displaystats | if enabled the statistics will be displayed | =displaystats="on"= |
| displayunitcolumn | if enabled the unit column will be displayed (related: =unitcolumnpos=, =unitcolumnformat=) | =displayunitcolumn="1"= |
| emptybgcolor | default empty unit background color | =emptybgcolor="#f0f0f0"= |
| emptyfgcolor | default empty unit foreground color | =emptyfgcolor="#000000"= |
| emptytext | text for empty units (replacements: =%U= - unit number; =%R= - rack name) | =emptytext="empty"= |
| fontsize | font size of the text (in px, pt, em, ... or xx-small, x-small, small, medium, large,x-large, xx-large, smaller, larger); don't forget to reduce the =iconsize= if you reduce the =fontsize= | =fontsize="small"= |
| iconsize | icon size | =iconsize="16"= |
| name | entry of the first cell (header of the unit row) | =name="U"= |
| rackstatformat | rack statistics format (replacements: =%EU= - empty units; =%LEB= - largest empty block; =%OU= - occupied units) | =rackstatformat="Empty: %EUU %<nop>BR%Largest Empty Block: %LEBU %<nop>BR%Occupied: %OUU"= |
| statformat | statistics format (replacements: =%R= - rack count; =%EU= - empty units; =%LEB= - largest empty block; =%OU= - occupied units; =%U= - # units) | =statformat="#Racks: %R, #Units: %U, Occupied: %OUU, Empty: %EUU, Largest Empty Block: %LEBU"= |
| textdir | defines text direction; allowed values: =topdown=, =leftright= (%X% only supported for =dir="leftright"= and =dir="rightleft"= yet) | =textdir="leftright"= |
| tooltipbgcolor | tooltip background color (default: color from definition table) | =tooltipbgcolor=""= |
| toolitpfgcolor | tooltip foreground color (default: color from definition table) | =tooltipfgcolor=""= |
| tooltipfixleft | tooltip position fix (skin dependent) | =tooltipfixleft=-163= |
| tooltipfixtop | tooltip position fix (skin dependent) | =tooltipfixtop=0= |
| tooltipformat | tooltip format (replacements: =%<nop>DEVICE%=: device name; =%<nop>FORMFACTOR%=: form factor; =%<nop>RACK%=: rack name; =%<nop>SUNIT%=: starting unit; =%<nop>EUNIT%=: ending unit; =%<nop>OWNER%=: onwer; =%<nop>NOTES%=: notes; =%<nop>OWNERICON%=: owner icon; =%<nop>NOTESICON%=: notes icon; =%<nop>CONNECTEDTOICON%=: 'connected to' icon; =%<nop>CLOSEBUTTON%=: a close button) | =tooltipformat="<b><span title="Device name"> %<nop>DEVICE%: </span></b> <span title="Form factor">%<nop>FORMFACTOR%</span> (<span title="Start-End units">%<nop>SUNIT%-%<nop>EUNIT%</span>, <span title="Rack name">%<nop>RACK%</span>)<div title="Owner">%<nop>OWNERICON% %<nop>OWNER% </div><div title="Connected to">%<nop>CONNECTEDTOICON% %<nop>CONNECTEDTO% </div><div title="Notes">%<nop>NOTESICON% %<nop>NOTES% </div><div style="font-size:xx-small;text-align:right;"><span style="background-color:red;" title="Close tooltip">%<nop>CLOSEBUTTON%</span></div>"= |
| unitcolumnbgcolor | background color of the unit column | =unitcolumnbgcolor="white"= |
| unitcolumnfgcolor | foreground color of the unit column | =unitcolumnfgcolor="black"= |
| unitcolumnformat | format of the unit column (replacement: =%U= - unit) | =unitcolumnformat="%U"= |
| unitcolumnpos | positions of the unit column: =left=, =right=, =both= (=left= and =right=), =all= (=both= and between racks) | =unitcolumnpos="left"= |
*Notes:*
* You can use TextFormattingRules for some attribute values: conflicticon, connectedtoicon, emptytext, name, notesicon
* Every attribute of =%<nop>RACKPLANNER%= can also be used as plugin setting. You only have to use capital letters.
---++ Example
%RACKPLANNER{units="46" racks="rack1,rack2" devicebgcolor="darkgray" devicefgcolor="white"}%
%EDITTABLE{format="|text,10,|text,10,|text,5,1|select,1,1U,2U,3U,4U,5U,6U,7U,8U,9U,10U|text,20,|text,20,|text,10,|textarea,3x20|" header="|*Device*|*Rack*|*Starting Unit*|*Form Factor*|*Connected to:*|*Owner*|*Color/Image*|*Notes*|"}%
|*Device*|*Rack*|*Starting Unit*|*Form Factor*|*Connected to:*|*Owner*|*Color/Image*|*Notes*|
| server01 | rack1 | 1 | 1U | | me | | some notes to server1 |
| server02 | rack1 | 5 | 4U | ConnectedToOtherTopic, ConnectedToAnotherTopic,And to a E100 | | @sun | some notes |
| server03 | rack1 | 4 | 1U | | | | conflict with server02 |
| server04 | rack2 | 40 | 5U | P123 | someone else | green,white | goes to .. |
| a very very very very long text | rack2 | 1 | 1U | | | green | [[MyNotes][with linked notes]] |
| server06 | rack1 | 5 | 1U | | | | |
| server07 | rack1 | 5 | 3U | | | | conflict with server02 and server06 |
| ServerName | rack2 | 30 | 2U | ConnectedToOtherTopic | | | |
---++ Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write ==%<nop><plugin>_<setting>%==, i.e. ==%<nop>EMPTYPLUGIN_SHORTDESCRIPTION%==
* One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
* Set SHORTDESCRIPTION = Render a rack overview (e.g. of 19'' computer racks) with HTML tables
* Debug plugin: (See output in =data/debug.txt=)
* Set DEBUG = 0
* Rack units (default: 46):
* Set UNITS = 46
* Device background/foreground colors:
* Set DEVICEBGCOLOR = #f0f0f0
* Set DEVICEFGCOLOR = #000000
* Empty unit text:
* # Set EMPTYTEXT = empty
* Font and icon sizes:
* Set FONTSIZE = small
* Set ICONSIZE = 12px
* Fix tooltip positions (skin dependent):
* # Set TOOLTIPFIXLEFT = -163
* # Set TOOLTIPFIXTOP = 0
* *Note:* Every attribute of =%<nop>RACKPLANNER%= can also be used as plugin setting. You only have to use capital letters.
---++ Plugin Installation Instructions
__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the Foswiki server.
* Download the ZIP file from the Plugin web (see below)
* Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
| *File:* | *Description:* |
| ==data/System/%TOPIC%.txt== | Plugin topic |
| ==data/System/VarRACKPLANNER.txt== | Documentation |
| ==lib/Foswiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
| ==lib/Foswiki/Plugins/%TOPIC%/RackPlanner.pm== | Plugin Perl library |
| ==pub/System/%TOPIC%/rackplannertooltips.js== | <nop>JavaScript module |
| ==pub/System/%TOPIC%/*.png | some base icons for devices |
* Configure the Plugin:
* Foswiki 1.0 and up: Run the [[%SCRIPTURL%/configure%SCRIPTSUFFIX%][configure]] script to enable the Plugin
* Change the Plugin settings as needed
* Test if the installation was successful:
* see Examples section
---++ Plugin Info
| Plugin Author: | TWiki:Main.DanielRohde |
| Copyright: | © 2006, TWiki:Main.DanielRohde |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | V1.006 (30 Aug 2007) |
| Change History: | <!-- versions below in reverse order --> |
| ?V1.006 (13 Des 2008) | Rebranded to Foswiki. Main.LarsEik, Tasks.Item8030 |
| V1.006 (30 Aug 2007) | fixed minor tooltip foreground/background color bug; added device icon shortcut feature; added some base device icons; |
| V1.005 (5 Jun 2007) | TWiki:Main.DanielRohde: fixed links in 'connected to' or 'owner' field bug; added new attribute (clicktooltip...); added documentation |
| V1.004 (20 Apr 2007) | TWiki:Main.DanielRohde: fixed replacement in =tooltipformat= bug; improved =tooltipformat=; improved HTML rendering performance; added and fixed documenation; |
| V1.003 (6 Mar 2007) | TWiki:Main.DanielRohde: fixed displayowner/displaynotes bug reported by TWiki:Main.PatrickTuite; added horizontal rendering feature requested by TWiki:Main.OlofStockhaus; added new attributes (tooltip..., columnwidth, textdir); fixed HTML validation bug; |
| V1.002 (26 Oct 2006): | TWiki:Main.DanielRohde: allowed multiple entries in a single unit; fixed rendering bug reported by TWiki:Main.SteveWray; fixed link color bug reported by TWiki:Main.SteveWray |
| V1.001 (7 Aug 2006): | TWiki:Main.DanielRohde: improved some features (added statistics); added attributes (rackstatformat, displayunitcolumn, unitcolumn*); renamed attribute statformat; fixed documentation; fixed tooltip bug; fixed conflict bug;|
| V1.000 (4 Aug 2006): | TWiki:Main.DanielRohde: Initial version |
| TWiki Dependency: | $TWiki::Plugins::VERSION 1.021 |
| CPAN Dependencies: | none |
| Other Dependencies: | none |
| Perl Version: | 5.005 |
| [[Foswiki:Extensions/Benchmark][Benchmarks]]: | %SYSTEMWEB%.GoodStyle 97%, %SYSTEMWEB%.FormattedSearch 99%, %TOPIC% 84% |
| Plugin Home: | http://foswiki.org/Extensions/%TOPIC% |
| Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |
| Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal |
__Related Topics:__ [[%SYSTEMWEB%.Plugins][Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences
-- TWiki:Main.DanielRohde - 31 Aug 2006