/*# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK #####*/ var panelHeaderClass = "ui-widget ui-state-active ui-corner-top"; var panelContentClass = "ui-widget ui-widget-content ui-corner-bottom"; var tableBorder = "ui-widget-content ui-corner-bottom ui-corner-top"; function toggleme() { $(this).next().toggle("fast"); } function hoverInPanel() { $(this).removeClass("ui-state-active"); $(this).addClass("ui-state-hover"); } function hoverOutPanel() { $(this).addClass("ui-state-active"); $(this).removeClass("ui-state-hover"); } function hoverInHeader() { $(this).addClass("ui-state-hover"); } function hoverOutHeader() { $(this).removeClass("ui-state-hover"); } function addTableHeaderbyList(table, header) { $(table).append(""); $.each(header, function(index, h) { $(table + ' tr:last').append(''); $(table + ' th:last').append(h); $(table + ' th:last').hover(hoverInHeader, hoverOutHeader); }); } function addTableHeaderbyObj(table, header) { $(table).append(""); for(h in header) { $(table + ' tr:last').append(''); $(table + ' th:last').append(h); $(table + ' th:last').hover(hoverInHeader, hoverOutHeader); } } function addTableRowByHeader(table, fields, row, cellf) { $(table).append(""); $.each(fields, function(index, field) { $(table + " tr:last").append(''); $(table + " td:last").html(cellf(field, row)); }); } function addTableRowByObj(table, row, cellf) { $(table).append(""); $.each(row, function(index, val) { $(table + " tr:last").append(""); $(table + " td:last").html(cellf(val, row)); }); } /* * create a simple pannel widget * parent (string): parent selector * name (string): name used for the panel, this will create two div named name_PanelHead,name_Panelcontent * header (string): name of header * content (function): a callback function to display contente of the panel */ function createPanelwidget(parent, name, header, content) { $(parent).append($('
')); $("#" + name + "Panelhead").click(toggleme); $("#" + name + "Panelhead").hover(hoverInPanel, hoverOutPanel); $("#" + name + "Panelhead").append(header); $(parent).append($('
')); $("#" + name + "_Panelcontent").append(content); } /* * create a jquery tabed widget * param; * parent (string): parent element selector in form of '#name' * name (string ): name of the widget * tabs_descriptions: array of object { name:"tabs-1", f_content: function for display tab content} * f_content= function(name){} where name is the tab name */ function createTabswidget(parent, name, tabs_descriptions) { $(parent).append('
'); $("#" + name).append("