cont: "",
tr: null,
+ hide: false,
sel: false,
tr_get: function () {
enabled: false,
item: null,
+ room_show: true,
+ table_show: -1,
+
cur: -1,
disable: function () {
},
row_select: function(mi) {
- for (idx in this.item) {
- if (this.item[idx] == mi) {
- this.item[idx].sel_set(!this.item[idx].sel_get());
+ for (i = 0 ; i < this.item.length ; i++) {
+ if (this.item[i] == mi) {
+ this.item[i].sel_set(!this.item[i].sel_get());
}
else {
- this.item[idx].sel_set(false);
+ this.item[i].sel_set(false);
}
}
// mi.tr.className = "selected";
+ },
+
+ room_show_update: function(obj) {
+ this.tab_update(obj.checked, this.table_show);
+ },
+
+ //
+ table_show_update: function(obj) {
+ this.tab_update(this.room_show, obj.options[obj.selectedIndex].value );
+ },
+
+ tab_update: function(room_new, table_new)
+ {
+ // remove all and add all valid
+ for (i = 0 ; i < this.item.length ; i++) {
+ if (this.item[i].hide)
+ continue;
+ this.table.removeChild(this.item[i].tr_get());
+ this.item[i].hide = true;
+ }
+
+ for (i = 0 ; i < this.item.length ; i++) {
+ var app = false;
+
+ if (room_new && table_new == -1) {
+ app = true;
+ }
+ else if (room_new && table_new != -1) {
+ if (this.item[i].table == table_new || this.item[i].table == -1) {
+ app = true;
+ }
+ }
+ else if (!room_new && table_new == -1) {
+ if (this.item[i].table != -1) {
+ app = true;
+ }
+ }
+ else if (!room_new && table_new != -1) {
+ if (this.item[i].table == table_new) {
+ app = true;
+ }
+ }
+ if (app) {
+ this.table.appendChild(this.item[i].tr_get());
+ this.item[i].hide = false;
+ }
+ }
+ this.room_show = room_new;
+ this.table_show = table_new;
}
}
+// function AddBefore(rowId){
+// var target = document.getElementById(rowId);
+// var newElement = document.createElement('tr');
+// target.parentNode.insertBefore(newElement, target);
+// return newElement;
+// }
+
+// function AddAfter(rowId){
+// var target = document.getElementById(rowId);
+// var newElement = document.createElement('tr');
+
+// target.parentNode.insertBefore(newElement, target.nextSibling );
+// return newElement;
+// }
+
function moderate(enable)
{
return (g_moder.activate(enable));
+div.moder_tabanc {
+ height: 400px;
+ background-color: #ffaaaa;
+ overflow: auto;
+ vertical-align: text-bottom;
+}
+
+div.moder_tabanc table {
+ width: 100%;
+ border: 1px solid red;
+ border-collapse: collapse;
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+div.moder_tabanc td {
+ border: 1px solid green;
+ vertical-align: text-bottom;
+}
+
+div.moder_cmdanc td {
+ border: 1px solid green;
+ vertical-align: text-bottom;
+}
+
+
tr.normal {
background-color: white;
cursor: pointer;
<script type="text/javascript"><!--
window.is_loaded = false;
-function showroom_update(obj)
+function room_show_update(obj)
{
- // if (typeof(window.anc) != 'undefined') {
- // window.anc.showroom_update();
- //}
+ if (typeof(window.anc) != 'undefined') {
+ window.anc.room_show_update(obj);
+ }
}
-function onlytable_update(obj)
+function table_show_update(obj)
{
+ if (typeof(window.anc) != 'undefined') {
+ window.anc.table_show_update(obj);
+ }
}
window.onload = function() {
<link rel="stylesheet" type="text/css" href="moderation.css">
</head>
<body>
+ <div><?php /* phpinfo(); */ ?></div>
<div id="mainbody">
<div class="moder_tabanc">
<table id="moder_tab"></table>
</div>
- <div>
+ <div class="moder_cmdanc">
<table>
- <tr><td>mostra room <input type="checkbox" name="showroom" onclick="showroom_update(this);"></td>
- <td>tavolo: <select name="onlytable" onchange="onlytable_update(this);">
- <option selected>tutti</option>
+ <tr><td> mostra room <input type="checkbox" name="room_show" CHECKED onclick="room_show_update(this);"></td>
+ <td> tavolo: <select name="table_show" onchange="table_show_update(this);">
+ <option selected value="-1">tutti</option>
<?php
for ($i = 0 ; $i < TABLES_N ; $i++) {
- printf("<option>%d</option>", $i);
+ printf('<option value="%d">%d</option>', $i, $i);
}
?>
</select>