From 55eddd7accf2c5f9b0f52b22a010c4c4b7c130d1 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Fri, 6 Feb 2009 19:18:00 -0600 Subject: mv packages to config dir to match web layout --- config/dyntables/pkg/dyntables.inc | 117 +++++++++++++++++++++ config/dyntables/pkg/dyntables.xml | 139 +++++++++++++++++++++++++ config/dyntables/pkg/dyntables_classdefs.inc | 146 +++++++++++++++++++++++++++ 3 files changed, 402 insertions(+) create mode 100644 config/dyntables/pkg/dyntables.inc create mode 100644 config/dyntables/pkg/dyntables.xml create mode 100644 config/dyntables/pkg/dyntables_classdefs.inc (limited to 'config/dyntables/pkg') diff --git a/config/dyntables/pkg/dyntables.inc b/config/dyntables/pkg/dyntables.inc new file mode 100644 index 00000000..97e8a422 --- /dev/null +++ b/config/dyntables/pkg/dyntables.inc @@ -0,0 +1,117 @@ + + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper . + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + +require_once("dyntables_classdefs.inc"); + +function syncPackageDyntables() { + +} + +function installPackageDyntables() { + /* move temp files */ + @rename('/usr/local/www/diag_dhcp_leases.php', '/usr/local/pkg/diag_dhcp_leases.php.org'); + @rename('/usr/local/pkg/dyntables.js', '/usr/local/www/javascript/dyntables.js'); + @rename('/usr/local/pkg/diag_dhcp_leases.php', '/usr/local/www/diag_dhcp_leases.php'); +} + +function deinstallPackageDyntables() { + /* move backup files */ + @unlink('/usr/local/www/diag_dhcp_leases.php'); + @unlink('/usr/local/www/javascript/dyntables.js'); + @rename('/usr/local/pkg/diag_dhcp_leases.php.org', '/usr/local/www/diag_dhcp_leases.php'); +} + +function checkForExtension($alertClass) { + if(! extension_loaded( 'json' )) { + if(! @dl( 'json.so' )) { + return openNoExtDialog($alertClass); + } + } +} + +/** + * openNoExtDialog() + * + * @param mixed $effectClass + * @return + */ +function openNoExtDialog($effectClass) { + $alertMessage = gettext("PHP extension json.so was not found or could not be loaded. Please check you PHP installation."); + $dialogScript = " + + "; + + return $dialogScript; +} + +/** +* getWindowJSScriptRefs() +* +* @return an array of <script /> elements +*/ +function getWindowJSScriptRefs(){ + $result = array('', + '', + ''); + + return $result; +} + +/** +* getWindowJSStyleRefs() +* +* @return an array of <style /> tags +*/ +function getWindowJSStyleRefs(){ + $result = array('', + '', + ''); + + return $result; +} + +?> \ No newline at end of file diff --git a/config/dyntables/pkg/dyntables.xml b/config/dyntables/pkg/dyntables.xml new file mode 100644 index 00000000..8a249966 --- /dev/null +++ b/config/dyntables/pkg/dyntables.xml @@ -0,0 +1,139 @@ + + + + + + + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper . + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + + This package adds dynamic reloading support of table data to + various pfSense web pages. Reloading table data is done using + Ajax. + + + This package is supposed to be run on RELENG based pfSense systems. + + Currently there are no FAQ items provided. + dyntables + 1.0 + System: Dynamic Tables + /usr/local/pkg/dyntables.inc + + + + + + ['installedpackages']['dyntables']['config'] + + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/dyntables/www/php/diag_dhcp_leases.php + + + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/dyntables/www/js/dyntables.js + + + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/dyntables/pkg/dyntables.inc + + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/dyntables/pkg/dyntables_classdefs.inc + + + + /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ + 0755 + http://www.pfsense.com/packages/config/dyntables/bin/json.so + + + + + syncPackageDyntables(); + + + installPackageDyntables(); + + + deinstallPackageDyntables(); + + diff --git a/config/dyntables/pkg/dyntables_classdefs.inc b/config/dyntables/pkg/dyntables_classdefs.inc new file mode 100644 index 00000000..696170d1 --- /dev/null +++ b/config/dyntables/pkg/dyntables_classdefs.inc @@ -0,0 +1,146 @@ + + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper . + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + +if (! class_exists("Object")) { + class Object { + function Object() { + $args = func_get_args(); + if (method_exists($this, '__destruct')) { + register_shutdown_function(array(&$this, '__destruct')); + } + call_user_func_array(array(&$this, '__construct'), $args); + } + + function __construct() { + } + } +} + +class Column extends Object { + var $defaultClass = "listhdrr"; + var $class = null; + var $name = null; + var $sortID = null; + + function __construct($name) { + // Perform object initialization here. + parent::__construct(); + $this->name = $name; + } + + function setClass($class) { + $this->class = $class; + } + + function getClass() { + return $this->class; + } + + function setSortID($id) { + $this->sortID = $id; + } + + function getSortID() { + return $this->sortID; + } + + function toHTML() { + global $_GET; + + $classString = $this->class != null ? $this->class : $this->defaultClass; + $allString = isset($_GET['all']) ? ", {$_GET['all']}" : ""; + return "{$this->name}"; + } +} + +class Table extends Object { + var $columns = null; + var $data = null; + + function __construct() { + // Perform object initialization here. + parent::__construct(); + $this->columns = array(); + $this->data = array(); + } + + function addColumn($column, $id = null, $class = null) { + $column = new Column($column); + + if ($id != null) { + $column->setSortID($id); + } + if ($class != null) { + $column->setClass($class); + } + + $this->columns[] = $column; + } + + function addDataSet($dataSet) { + if (is_array($dataSet)) { + if (count($dataSet) == count($this->columns)) { + $this->data[] = $dataSet; + } else { + trigger_error("Dataset does not match column size."); + } + } else { + trigger_error("Adding non arrays as datasets to a table is not supported."); + } + } + + function setData(&$data) { + $this->data = $data; + } + + function getData() { + return $this->data; + } + + function getColumnHTML() { + $htmlString = ""; + + foreach($this->columns as $column) { + $htmlString .= $column->toHtml(); + } + + return "{$htmlString}"; + } +} + +?> \ No newline at end of file -- cgit v1.2.3