From 3346fb52e3aeea2c0b68bf52b4369fbb7cbfcbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toshio=20=E3=81=8F=E3=82=89=E3=81=A8=E3=81=BF?= Date: Wed, 21 Oct 2009 20:00:40 +0000 Subject: [PATCH] Initial import. --- .cvsignore | 1 + filterutil-separate-module.patch | 13 + filterutil-style-bugfix-zikula-trunk.patch | 348 +++++++++++++++++++++ import.log | 1 + sources | 1 + zikula-module-filterutil.spec | 56 ++++ 6 files changed, 420 insertions(+) create mode 100644 filterutil-separate-module.patch create mode 100644 filterutil-style-bugfix-zikula-trunk.patch create mode 100644 import.log create mode 100644 zikula-module-filterutil.spec diff --git a/.cvsignore b/.cvsignore index e69de29..fd6c3d3 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +filterutil-0.tar.bz2 diff --git a/filterutil-separate-module.patch b/filterutil-separate-module.patch new file mode 100644 index 0000000..1dcbe54 --- /dev/null +++ b/filterutil-separate-module.patch @@ -0,0 +1,13 @@ +Index: filterutil-0/FilterUtil.class.php +=================================================================== +--- filterutil-0.orig/FilterUtil.class.php ++++ filterutil-0/FilterUtil.class.php +@@ -13,7 +13,7 @@ + /** + * Define Class path + */ +-define('FILTERUTIL_CLASS_PATH', 'includes/pnobjlib/FilterUtil'); ++define('FILTERUTIL_CLASS_PATH', 'config/classes/FilterUtil'); + + Loader::loadClass('FilterUtil_Plugin', FILTERUTIL_CLASS_PATH); + Loader::loadClass('FilterUtil_PluginCommon', FILTERUTIL_CLASS_PATH); diff --git a/filterutil-style-bugfix-zikula-trunk.patch b/filterutil-style-bugfix-zikula-trunk.patch new file mode 100644 index 0000000..26309c4 --- /dev/null +++ b/filterutil-style-bugfix-zikula-trunk.patch @@ -0,0 +1,348 @@ +Index: FilterUtil/filter/filter.default.class.php +=================================================================== +--- FilterUtil/filter/filter.default.class.php (revision 15) ++++ FilterUtil/filter/filter.default.class.php (working copy) +@@ -40,7 +40,7 @@ + $this->activateOperators(array('eq', 'ne', 'lt', 'le', 'gt', 'ge', 'like', 'null', 'notnull')); + } + +- if ($config['default'] == true || count($this->fields) <= 0) { ++ if ((isset($config['default']) && $config['default'] == true) || count($this->fields) <= 0) { + $this->default = true; + } + } +@@ -55,8 +55,9 @@ + { + static $ops = array('eq', 'ne', 'lt', 'le', 'gt', 'ge', 'like', 'null', 'notnull'); + if (is_array($op)) { +- foreach($op as $v) ++ foreach ($op as $v) { + $this->activateOperators($v); ++ } + } elseif (!empty($op) && array_search($op, $this->ops) === false && array_search($op, $ops) !== false) { + $this->ops[] = $op; + } +@@ -65,15 +66,17 @@ + public function addFields($fields) + { + if (is_array($fields)) { +- foreach($fields as $fld) ++ foreach ($fields as $fld) { + $this->addFields($fld); ++ } + } elseif (!empty($fields) && $this->fieldExists($fields) + && array_search($fields, $this->fields) === false) { + $this->fields[] = $fields; + } + } + +- public function getFields() { ++ public function getFields() ++ { + return $this->fields; + } + +@@ -111,7 +114,7 @@ + } + switch ($op) { + case 'ne': +- return array('where' => $this->column[$field]." <> '" . $value . "'"); ++ return array('where' => $this->column[$field] . " != '" . $value . "'"); + break; + case 'lt': + return array('where' => $this->column[$field]." < '" . $value . "'"); +@@ -132,7 +135,7 @@ + return array('where' => $this->column[$field]." = '' OR ".$this->column[$field]." IS NULL"); + break; + case 'notnull': +- return array('where' => $this->column[$field]." <> '' AND ".$this->column[$field]." IS NOT NULL"); ++ return array('where' => $this->column[$field] . " != '' AND " . $this->column[$field] . " IS NOT NULL"); + break; + case 'eq': + return array('where' => $this->column[$field]." = '" . $value . "'"); +Index: FilterUtil/filter/filter.replaceName.class.php +=================================================================== +--- FilterUtil/filter/filter.replaceName.class.php (revision 15) ++++ FilterUtil/filter/filter.replaceName.class.php (working copy) +@@ -27,8 +27,9 @@ + public function __construct($config) + { + parent::__construct($config); +- if (isset($config['pair']) && is_array($config['pair'])) ++ if (isset($config['pair']) && is_array($config['pair'])) { + $this->addPair($config['pair']); ++ } + } + + /** +@@ -37,12 +38,14 @@ + * @param mixed $pair Replace Pair + * @access public + */ +- public function addPair($pair) { ++ public function addPair($pair) ++ { + foreach ($pair as $f => $r) { +- if (is_array($r)) ++ if (is_array($r)) { + $this->addPair($r); +- else ++ } else { + $this->pair[$f] = $r; ++ } + } + } + +Index: FilterUtil/filter/filter.category.class.php +=================================================================== +--- FilterUtil/filter/filter.category.class.php (revision 15) ++++ FilterUtil/filter/filter.category.class.php (working copy) +@@ -53,14 +53,16 @@ + public function addFields($fields) + { + if (is_array($fields)) { +- foreach($fields as $fld) ++ foreach ($fields as $fld) { + $this->addFields($fld); ++ } + } elseif (!empty($fields) && !$this->fieldExists($fields) && array_search($fields, $this->fields) === false) { + $this->fields[] = $fields; + } + } + +- public function getFields() { ++ public function getFields() ++ { + return $this->fields; + } + +@@ -73,8 +75,9 @@ + public function activateOperators($op) + { + if (is_array($op)) { +- foreach($op as $v) ++ foreach ($op as $v) { + $this->activateOperators($v); ++ } + } elseif (!empty($op) && array_search($op, $this->ops) === false && array_search($op, $this->availableOperators()) !== false) { + $this->ops[] = $op; + } +@@ -89,8 +92,9 @@ + public function getOperators() + { + $fields = $this->getFields(); +- if ($this->default == true) ++ if ($this->default == true) { + $fields[] = '-'; ++ } + $ops = array(); + foreach ($this->ops as $op) { + $ops[$op] = $fields; +@@ -104,7 +108,8 @@ + * @see CategoryUtil + * @param mixed $property Category Property + */ +- public function setProperty($property) { ++ public function setProperty($property) ++ { + $this->property = (array) $property; + } + +@@ -149,4 +154,4 @@ + } + return array('where' => $where); + } +-} +\ No newline at end of file ++} +Index: FilterUtil/filter/filter.date.class.php +=================================================================== +--- FilterUtil/filter/filter.date.class.php (revision 15) ++++ FilterUtil/filter/filter.date.class.php (working copy) +@@ -53,8 +53,9 @@ + public function activateOperators($op) + { + if (is_array($op)) { +- foreach($op as $v) ++ foreach ($op as $v) { + $this->activateOperators($v); ++ } + } elseif (!empty($op) && array_search($op, $this->ops) === false && array_search($op, $this->availableOperators()) !== false) { + $this->ops[] = $op; + } +@@ -63,15 +64,17 @@ + public function addFields($fields) + { + if (is_array($fields)) { +- foreach($fields as $fld) ++ foreach ($fields as $fld) { + $this->addFields($fld); ++ } + } elseif (!empty($fields) && $this->fieldExists($fields) + && array_search($fields, $this->fields) === false) { + $this->fields[] = $fields; + } + } + +- public function getFields() { ++ public function getFields() ++ { + return $this->fields; + } + +@@ -84,8 +87,9 @@ + public function getOperators() + { + $fields = $this->getFields(); +- if ($this->default == true) ++ if ($this->default == true) { + $fields[] = '-'; ++ } + $ops = array(); + foreach ($this->ops as $op) { + $ops[$op] = $fields; +@@ -142,7 +146,8 @@ + return $time; + } + +- private function makePeriod($date, $type) { ++ private function makePeriod($date, $type) ++ { + $datearray = getdate($date); + switch($type) { + case 'year': +@@ -154,8 +159,8 @@ + $to = strtotime('+1 month', $from); + break; + /**case 'week': +- $from = DateUtil::getDatetime("substr ($date, 0, strpos ($date, ' ')); +- $to = DateUtil::getDatetime("$from +1 year"); ++ $from = DateUtil::getDatetime(substr($date, 0, strpos($date, ' ')); ++ $to = DateUtil::getDatetime($from . ' +1 year'); + break;*/ + case 'day': + case 'tomorrow': +@@ -176,9 +181,11 @@ + return array($from, $to); + } + +- public function GetSQL($field, $op, $value) { +- if (array_search($op, $this->ops) === false || array_search($field, $this->fields) === false) ++ public function GetSQL($field, $op, $value) ++ { ++ if (array_search($op, $this->ops) === false || array_search($field, $this->fields) === false) { + return ''; ++ } + $type = 'point'; + if (preg_match('~^(year|month|week|day|hour|min):\s*(.*)$~i', $value, $res)) { + $type = strtolower($res[1]); +@@ -204,7 +211,7 @@ + list($from, $to) = $this->makePeriod($time, $type); + $where = $this->column[$field].' < \''.DateUtil::getDatetime($from).'\' AND '.$this->column[$field].' >= \''.DateUtil::getDatetime($to).'\''; + } else { +- $where = $this->column[$field].' <> \''.DateUtil::getDatetime($time).'\''; ++ $where = $this->column[$field] . ' != \'' . DateUtil::getDatetime($time) . '\''; + } + break; + case 'gt': +@@ -231,4 +238,4 @@ + + } + } +-?> +\ No newline at end of file ++?> +Index: FilterUtil/FilterUtil_Common.class.php +=================================================================== +--- FilterUtil/FilterUtil_Common.class.php (revision 15) ++++ FilterUtil/FilterUtil_Common.class.php (working copy) +@@ -89,7 +89,7 @@ + */ + protected function setTable($table) + { +- $pntable =& pnDBGetTables(); ++ $pntable = pnDBGetTables(); + + if (!isset($pntable[$table]) || !isset($pntable[$table . '_column'])) { + return false; +@@ -113,7 +113,7 @@ + */ + protected function setJoin(&$join) + { +- $this->join =& $join; ++ $this->join = $join; + $this->addJoinToColumn(); + } + +@@ -125,11 +125,11 @@ + */ + protected function addJoinToColumn() + { +- if (count($this->join) <= 0) ++ if (count($this->join) < 1) { + return; + +- $pntable =& pnDBGetTables(); +- $c =& $this->column; ++ $pntable = pnDBGetTables(); ++ $c = $this->column; + // reset column array... + $c = $pntable[$this->pntable.'_column']; + // now add alias "tbl" to all fields +@@ -140,7 +140,7 @@ + // add fields of all joins + $alias = 'a'; + foreach ($this->join as &$join) { +- $jc =& $pntable[$join['join_table'].'_column']; ++ $jc = $pntable[$join['join_table'].'_column']; + foreach ($join['join_field'] as $k => $f) { + $a = $join['object_field_name'][$k]; + if (isset($c[$a])) { +@@ -182,6 +182,6 @@ + { + $config['table'] = $this->pntable; + $config['module'] = $this->module; +- $config['join'] =& $this->join; ++ $config['join'] = $this->join; + } +-} +\ No newline at end of file ++} +Index: FilterUtil/FilterUtil_Plugin.class.php +=================================================================== +--- FilterUtil/FilterUtil_Plugin.class.php (revision 15) ++++ FilterUtil/FilterUtil_Plugin.class.php (working copy) +@@ -101,7 +101,7 @@ + $obj = new $class($config); + + $this->plg[] = $obj; +- $obj =& end($this->plg); ++ $obj = end($this->plg); + $obj->setID(key($this->plg)); + $this->registerPlugin(key($this->plg)); + +@@ -119,7 +119,7 @@ + */ + private function registerPlugin($k) + { +- $obj =& $this->plg[$k]; ++ $obj = $this->plg[$k]; + if ($obj instanceof FilterUtil_Build) { + $ops = $obj->getOperators(); + if (isset($ops) && is_array($ops)) { +@@ -187,7 +187,7 @@ + public function replace($field, $op, $value) + { + foreach ($this->replaces as $k) { +- $obj =& $this->plg[$k]; ++ $obj = $this->plg[$k]; + list($field, $op, $value) = $obj->replace($field, $op, $value); + } + +@@ -218,4 +218,4 @@ + return ''; + } + } +-} +\ No newline at end of file ++} diff --git a/import.log b/import.log new file mode 100644 index 0000000..f501f20 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +zikula-module-filterutil-0-0_2_20090915svn15_fc11:HEAD:zikula-module-filterutil-0-0.2.20090915svn15.fc11.src.rpm:1256154981 diff --git a/sources b/sources index e69de29..29b8918 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +f2023afb84f125fce2c767c9fdf398fd filterutil-0.tar.bz2 diff --git a/zikula-module-filterutil.spec b/zikula-module-filterutil.spec new file mode 100644 index 0000000..caf2b74 --- /dev/null +++ b/zikula-module-filterutil.spec @@ -0,0 +1,56 @@ +%global zikula_base %{_datadir}/zikula +%global zikula_modname filterutil + +Name: zikula-module-%{zikula_modname} +Version: 0 +Release: 0.2.20090915svn15%{?dist} +Summary: Pagesetter like filter rules for Zikula +Group: Applications/Publishing +License: GPLv2+ +URL: http://code.zikula.org/filterutil +# svn export -r 15 https://code.zikula.org/svn/filterutil/trunk filterutil-0 +# tar -cjvf filterutil-0.tar.bz2 filterutil-0 +Source0: filterutil-0.tar.bz2 +# Style and bugfix backport from zikula Core +# https://code.zikula.org/svn/core/development/main/includes/FilterUtil +Patch0: filterutil-style-bugfix-zikula-trunk.patch +Patch1: filterutil-separate-module.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +Requires: zikula + +%description +FilterUtil brings Pagesetter like filter rules to Zikula. This work is a +backport of the module included in zikula 2.0. + +%prep +%setup -q -n %{zikula_modname}-%{version} +%patch0 -p0 +%patch1 -p1 + +%build + +find . -type 'f' -exec chmod a-x \{\} \; + +%install +rm -rf %{buildroot} + +mkdir -p %{buildroot}/%{zikula_base}/config/classes/%{zikula_modname} +cp -pr . %{buildroot}/%{zikula_base}/config/classes/%{zikula_modname} +rm -rf %{buildroot}/%{zikula_base}/*.pdf + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc manual-developer.pdf manual-user.pdf +%{zikula_base}/config/classes/%{zikula_modname} + + +%changelog +* Thu Sep 17 2009 Toshio Kuratomi - 0-0.2.20090915svn15 +- Add fixes from itbegins for putting this in its own zikula directory + +* Tue Sep 15 2009 Toshio Kuratomi - 0-0.1.20090915svn15 +- Initial package attempt