echo "<input type=text name=hostname size=20 maxlength=128 value=\"" . $row['hostname'] . "\">"; echo "</td></tr>"; echo "<tr><td align=right>"; echo $NATS->Lang->Item("description"); echo " :</td><td align=left>"; echo "<input type=text name=nodedesc size=30 maxlength=200 value=\"" . $row['nodedesc'] . "\">"; echo "</td></tr>"; echo "<tr><td align=right>"; echo $NATS->Lang->Item("node.icon"); echo " :</td><td align=left>"; echo "<select name=nodeicon>"; if ($row['nodeicon'] != "") { echo "<option value=\"" . $row['nodeicon'] . "\">" . $row['nodeicon'] . "</option>"; } echo "<option value=\"\">" . $NATS->Lang->Item("default") . "</option>"; $iconList = GetIcons(); foreach ($iconList as $icon) { echo "<option value=\"" . $icon . "\">" . $icon . "</option>"; } //echo "</select> [ <a href=node.edit.php?nodeid=".$_REQUEST['nodeid']."&show_icons=1>Show Icons</a> ]"; echo "</select> [ <a href=\"javascript:showIcons()\">" . $NATS->Lang->Item("show.hide.icons") . "</a> ]"; echo "</td></tr>"; echo "<tr><td colspan=2>"; echo "<div id=\"iconDiv\"></div>"; echo "</td></tr>"; echo "<tr><td align=right>"; echo $NATS->Lang->Item("master.node"); echo " :</td><td align=left>"; echo "<select name=masterid>\n"; if ($row['masterid'] == "") { $s = " selected";
function ShowIcons() { global $fnIcons, $fnIcon_DefNode, $fnIcon_DefGroup, $NATS; $c = 0; echo "<table border=0>"; $cc = 0; $iconFiles = GetIcons(); for ($a = 0; $a < count($iconFiles); $a++) { $icon = $iconFiles[$a]; if ($cc == 0) { echo "<tr>"; } echo "<td valign=top align=center><img src=icons/" . $icon . "><br>" . $icon . "<br>"; if ($icon == $fnIcons[$fnIcon_DefNode]) { echo "<i>" . $NATS->Lang->Item("node.default") . "</i> "; } if ($a == $fnIcons[$fnIcon_DefGroup]) { echo "<i>" . $NATS->Lang->Item("group.default") . "</i>"; } echo "</td>"; $cc++; if ($cc >= 5) { echo "</tr>"; $cc = 0; } } if ($cc > 0) { echo "</tr>"; } echo "</table>"; }
function ShowIcons() { global $fnIcons,$fnIcon_DefNode,$fnIcon_DefGroup; $c=0; echo "<table border=0>"; $cc=0; $iconFiles=GetIcons(); for ($a=0; $a<count($iconFiles); $a++) { $icon=$iconFiles[$a]; if ($cc==0) echo "<tr>"; echo "<td valign=top align=center><img src=icons/".$icon."><br>".$icon."<br>"; if ($icon==$fnIcons[$fnIcon_DefNode]) echo "<i>Node Default</i> "; if ($a==$fnIcons[$fnIcon_DefGroup]) echo "<i>Group Default</i>"; echo "</td>"; $cc++; if ($cc>=5) { echo "</tr>"; $cc=0; } } if ($cc>0) echo "</tr>"; echo "</table>"; }
<?php function GetIcons($p) { $result = array(); $fh = opendir($p); while ($files = readdir($fh)) { if (preg_match("/^[A-Za-z].*png\$/", $files)) { $result[] = $files; } } sort($result); return $result; } $icons = GetIcons(dirname(__FILE__) . "/128x128_white"); $outtxt = ""; foreach ($icons as $i) { $name = preg_replace("/\\.png\$/", "", $i); $outtxt .= sprintf("%-30s", "'" . $name . "' : ") . " { '*' : { 'white' : '*/white', 'ws' : '*/white', 'antimony' : '*/blue', 'boron' : '*/green', 'lithium' : '*/red', 'potassium' : '*/purple', 'sodium' : '*/orange', '*': { '*' : recolorNonTransparent('icon/knx-uf-iconset/128x128_white/" . $i . "') } } },\n"; } $outtxt = preg_replace("/,\n\$/", "", $outtxt); // Read Original File for Canvas implementation $fn = fopen(dirname(__FILE__) . "/../../lib/iconhandler.js", "r"); $fn_new = fopen(dirname(__FILE__) . "/../../lib/iconhandler.js.NEW", "w"); $show = true; while (!feof($fn)) { $line = fgets($fn); if (preg_match("/Dynamic Icons End/", $line)) { $show = true; } if ($show) {