Commit 15c3d4c268a4e7cc73de7d7dff1286e4a863624d
Merge branch 'edge' of github.com:ktgit/knowledgetree into edge
Showing
28 changed files
with
2511 additions
and
2437 deletions
clienttools/.gitignore
0 → 100644
plugins/multiselect/InetWidgets.php
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * KnowledgeTree Community Edition | ||
| 6 | - * Document Management Made Simple | ||
| 7 | - * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | - * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | - * | ||
| 10 | - * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | - * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | - * Free Software Foundation. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | - * details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | - * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | - * | ||
| 25 | - * The interactive user interfaces in modified source and object code versions | ||
| 26 | - * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | - * Section 5 of the GNU General Public License version 3. | ||
| 28 | - * | ||
| 29 | - * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | - * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | - * copyright notice. | ||
| 35 | - * Contributor( s): ______________________________________ | ||
| 36 | - * | ||
| 37 | - */ | ||
| 38 | - | ||
| 39 | -require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php'); | ||
| 40 | -require_once(KT_LIB_DIR . '/widgets/basewidget.inc.php'); | ||
| 41 | -require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | ||
| 42 | -require_once(KT_LIB_DIR . '/browse/DocumentCollection.inc.php'); | ||
| 43 | - | ||
| 44 | -class InetMultiselectWidget extends KTBaseWidget | ||
| 45 | -{ | ||
| 46 | - var $sTemplate = "multiselect/selection"; | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * assign the class variables | ||
| 51 | - * @return | ||
| 52 | - * @param $sLabel Object | ||
| 53 | - * @param $sDescription Object | ||
| 54 | - * @param $sName Object | ||
| 55 | - * @param $value Object | ||
| 56 | - * @param $oPage Object | ||
| 57 | - * @param $bRequired Object[optional] | ||
| 58 | - * @param $sId Object[optional] | ||
| 59 | - * @param $aErrors Object[optional] | ||
| 60 | - * @param $aOptions Object[optional] | ||
| 61 | - * | ||
| 62 | - * iNET Process | ||
| 63 | - */ | ||
| 64 | - function InetMultiselectWidget($sLabel, $sDescription, $sName, $value, &$oPage, $bRequired = false, $sId = null, $aErrors = null, $aOptions = null) | ||
| 65 | - { | ||
| 66 | - $this->sLabel = $sLabel; | ||
| 67 | - $this->sDescription = $sDescription; | ||
| 68 | - $this->sName = $sName; | ||
| 69 | - $this->value = $value; | ||
| 70 | - $this->oPage =& $oPage; | ||
| 71 | - $this->bRequired = $bRequired; | ||
| 72 | - $this->sId = $sId; | ||
| 73 | - $this->aOptions = $aOptions; | ||
| 74 | - $this->aErrors = $aErrors; | ||
| 75 | - | ||
| 76 | - if (is_null($this->aOptions)) { $this->aOptions = array(); } | ||
| 77 | - // default to being a bit bigger. | ||
| 78 | - $this->aOptions['width'] = KTUtil::arrayGet($this->aOptions, 'width', '45'); | ||
| 79 | - if($this->aOptions['lookup_type'] == "multiwithcheckboxes") | ||
| 80 | - { | ||
| 81 | - $this->sTemplate = "multiselect/simple_selection"; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * returns the rendered templates | ||
| 89 | - * @return | ||
| 90 | - * | ||
| 91 | - * iNET Process | ||
| 92 | - */ | ||
| 93 | - function render() { | ||
| 94 | - // very simple, general purpose passthrough. Chances are this is sufficient, | ||
| 95 | - // just override the template being used. | ||
| 96 | - $bHasErrors = false; | ||
| 97 | - if (count($this->aErrors) != 0) { $bHasErrors = true; } | ||
| 98 | - | ||
| 99 | - $oTemplating =& KTTemplating::getSingleton(); | ||
| 100 | - $oTemplate = $oTemplating->loadTemplate($this->sTemplate); | ||
| 101 | - | ||
| 102 | - $aTemplateData = array( | ||
| 103 | - "context" => $this, | ||
| 104 | - "label" => $this->sLabel, | ||
| 105 | - "description" => $this->sDescription, | ||
| 106 | - "name" => $this->sName, | ||
| 107 | - "required" => $this->bRequired, | ||
| 108 | - "page" => $this->oPage, | ||
| 109 | - "has_id" => ($this->sId !== null), | ||
| 110 | - "id" => $this->sId, | ||
| 111 | - "has_value" => ($this->value !== null), | ||
| 112 | - "value" => $this->value, | ||
| 113 | - "has_errors" => $bHasErrors, | ||
| 114 | - "errors" => $this->aErrors, | ||
| 115 | - "options" => $this->aOptions, | ||
| 116 | - "vocab" => $this->aOptions['vocab'], | ||
| 117 | - ); | ||
| 118 | - return $oTemplate->render($aTemplateData); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - /** | ||
| 123 | - * returns the selected lookup value | ||
| 124 | - * @return | ||
| 125 | - * @param $lookup Object | ||
| 126 | - * | ||
| 127 | - * iNET Process | ||
| 128 | - */ | ||
| 129 | - function selected($lookup) { | ||
| 130 | - if ($this->bMulti) { | ||
| 131 | - return $this->_valuesearch[$lookup]; | ||
| 132 | - } else { | ||
| 133 | - return ($this->value == $lookup); | ||
| 134 | - } | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - /** | ||
| 138 | - * | ||
| 139 | - * @return array | ||
| 140 | - * @param $raw_data array | ||
| 141 | - * | ||
| 142 | - * iNET Process | ||
| 143 | - */ | ||
| 144 | - function process($raw_data) { | ||
| 145 | - return array($this->sBasename => $raw_data[$this->sBasename]); | ||
| 146 | - } | ||
| 147 | -} | ||
| 148 | - | 1 | +<?php |
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * KnowledgeTree Community Edition | ||
| 6 | + * Document Management Made Simple | ||
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | + * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | + * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | + * Free Software Foundation. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | + * details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | + * | ||
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | + * | ||
| 25 | + * The interactive user interfaces in modified source and object code versions | ||
| 26 | + * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | + * Section 5 of the GNU General Public License version 3. | ||
| 28 | + * | ||
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | + * copyright notice. | ||
| 35 | + * Contributor( s): ______________________________________ | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | +require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php'); | ||
| 40 | +require_once(KT_LIB_DIR . '/widgets/basewidget.inc.php'); | ||
| 41 | +require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | ||
| 42 | +require_once(KT_LIB_DIR . '/browse/DocumentCollection.inc.php'); | ||
| 43 | + | ||
| 44 | +class InetMultiselectWidget extends KTBaseWidget | ||
| 45 | +{ | ||
| 46 | + var $sTemplate = "multiselect/selection"; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * assign the class variables | ||
| 51 | + * @return | ||
| 52 | + * @param $sLabel Object | ||
| 53 | + * @param $sDescription Object | ||
| 54 | + * @param $sName Object | ||
| 55 | + * @param $value Object | ||
| 56 | + * @param $oPage Object | ||
| 57 | + * @param $bRequired Object[optional] | ||
| 58 | + * @param $sId Object[optional] | ||
| 59 | + * @param $aErrors Object[optional] | ||
| 60 | + * @param $aOptions Object[optional] | ||
| 61 | + * | ||
| 62 | + * iNET Process | ||
| 63 | + */ | ||
| 64 | + function InetMultiselectWidget($sLabel, $sDescription, $sName, $value, &$oPage, $bRequired = false, $sId = null, $aErrors = null, $aOptions = null) | ||
| 65 | + { | ||
| 66 | + $this->sLabel = $sLabel; | ||
| 67 | + $this->sDescription = $sDescription; | ||
| 68 | + $this->sName = $sName; | ||
| 69 | + $this->value = $value; | ||
| 70 | + $this->oPage =& $oPage; | ||
| 71 | + $this->bRequired = $bRequired; | ||
| 72 | + $this->sId = $sId; | ||
| 73 | + $this->aOptions = $aOptions; | ||
| 74 | + $this->aErrors = $aErrors; | ||
| 75 | + | ||
| 76 | + if (is_null($this->aOptions)) { $this->aOptions = array(); } | ||
| 77 | + // default to being a bit bigger. | ||
| 78 | + $this->aOptions['width'] = KTUtil::arrayGet($this->aOptions, 'width', '45'); | ||
| 79 | + if($this->aOptions['lookup_type'] == "multiwithcheckboxes") | ||
| 80 | + { | ||
| 81 | + $this->sTemplate = "multiselect/simple_selection"; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * returns the rendered templates | ||
| 89 | + * @return | ||
| 90 | + * | ||
| 91 | + * iNET Process | ||
| 92 | + */ | ||
| 93 | + function render() { | ||
| 94 | + // very simple, general purpose passthrough. Chances are this is sufficient, | ||
| 95 | + // just override the template being used. | ||
| 96 | + $bHasErrors = false; | ||
| 97 | + if (count($this->aErrors) != 0) { $bHasErrors = true; } | ||
| 98 | + | ||
| 99 | + $oTemplating =& KTTemplating::getSingleton(); | ||
| 100 | + $oTemplate = $oTemplating->loadTemplate($this->sTemplate); | ||
| 101 | + | ||
| 102 | + $aTemplateData = array( | ||
| 103 | + "context" => $this, | ||
| 104 | + "label" => $this->sLabel, | ||
| 105 | + "description" => $this->sDescription, | ||
| 106 | + "name" => $this->sName, | ||
| 107 | + "required" => $this->bRequired, | ||
| 108 | + "page" => $this->oPage, | ||
| 109 | + "has_id" => ($this->sId !== null), | ||
| 110 | + "id" => $this->sId, | ||
| 111 | + "has_value" => ($this->value !== null), | ||
| 112 | + "value" => $this->value, | ||
| 113 | + "has_errors" => $bHasErrors, | ||
| 114 | + "errors" => $this->aErrors, | ||
| 115 | + "options" => $this->aOptions, | ||
| 116 | + "vocab" => $this->aOptions['vocab'], | ||
| 117 | + ); | ||
| 118 | + return $oTemplate->render($aTemplateData); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * returns the selected lookup value | ||
| 124 | + * @return | ||
| 125 | + * @param $lookup Object | ||
| 126 | + * | ||
| 127 | + * iNET Process | ||
| 128 | + */ | ||
| 129 | + function selected($lookup) { | ||
| 130 | + if ($this->bMulti) { | ||
| 131 | + return $this->_valuesearch[$lookup]; | ||
| 132 | + } else { | ||
| 133 | + return ($this->value == $lookup); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * | ||
| 139 | + * @return array | ||
| 140 | + * @param $raw_data array | ||
| 141 | + * | ||
| 142 | + * iNET Process | ||
| 143 | + */ | ||
| 144 | + function process($raw_data) { | ||
| 145 | + return array($this->sBasename => $raw_data[$this->sBasename]); | ||
| 146 | + } | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | ?> | 149 | ?> |
| 150 | \ No newline at end of file | 150 | \ No newline at end of file |
plugins/multiselect/InetdocumentFieldsv2.php
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * KnowledgeTree Community Edition | ||
| 6 | - * Document Management Made Simple | ||
| 7 | - * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | - * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | - * | ||
| 10 | - * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | - * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | - * Free Software Foundation. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | - * details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | - * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | - * | ||
| 25 | - * The interactive user interfaces in modified source and object code versions | ||
| 26 | - * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | - * Section 5 of the GNU General Public License version 3. | ||
| 28 | - * | ||
| 29 | - * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | - * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | - * copyright notice. | ||
| 35 | - * Contributor( s): ______________________________________ | ||
| 36 | - * | ||
| 37 | - */ | ||
| 38 | - | ||
| 39 | -require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | ||
| 40 | -require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); | ||
| 41 | -require_once(KT_LIB_DIR . '/widgets/forms.inc.php'); | ||
| 42 | -require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); | ||
| 43 | - | ||
| 44 | -class InetDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 45 | - var $bAutomaticTransaction = true; | ||
| 46 | - var $bHaveConditional = null; | ||
| 47 | - var $sHelpPage = 'ktcore/admin/document fieldsets.html'; | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * | ||
| 51 | - * @return. | ||
| 52 | - * @param. | ||
| 53 | - * | ||
| 54 | - * iNET Process | ||
| 55 | - */ | ||
| 56 | - function predispatch() { | ||
| 57 | - $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management')); | ||
| 58 | - $this->persistParams(array('fFieldsetId')); | ||
| 59 | - | ||
| 60 | - $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); | ||
| 61 | - if (PEAR::isError($this->oFieldset)) { | ||
| 62 | - $this->oFieldset = null; | ||
| 63 | - unset($_REQUEST['fFieldset']); // prevent further attacks. | ||
| 64 | - } else { | ||
| 65 | - $this->aBreadcrumbs[] = array('url' => KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")), 'name' => $this->oFieldset->getName()); | ||
| 66 | - } | ||
| 67 | - $this->bHaveConditional = KTPluginUtil::pluginIsActive('ktextra.conditionalmetadata.plugin'); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - /** | ||
| 71 | - * create template | ||
| 72 | - * @Param. | ||
| 73 | - * @return template. | ||
| 74 | - * | ||
| 75 | - * iNET Process | ||
| 76 | - */ | ||
| 77 | - function do_main () { | ||
| 78 | - $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list'); | ||
| 79 | - | ||
| 80 | - $oTemplate->setData(array( | ||
| 81 | - 'context' => $this, | ||
| 82 | - 'fieldsets' => KTFieldset::getList("disabled != true AND namespace != 'tagcloud'"), | ||
| 83 | - )); | ||
| 84 | - return $oTemplate; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * form for creating new fieldset. | ||
| 89 | - * @Param. | ||
| 90 | - * @return form. | ||
| 91 | - * | ||
| 92 | - * iNET Process | ||
| 93 | - */ | ||
| 94 | - function form_create() { | ||
| 95 | - $oForm = new KTForm; | ||
| 96 | - $oForm->setOptions(array( | ||
| 97 | - 'identifier' => 'ktcore.fieldsets.create', | ||
| 98 | - 'label' => _kt("Create New Fieldset"), | ||
| 99 | - 'submit_label' => _kt('Create Fieldset'), | ||
| 100 | - 'cancel_action' => 'main', | ||
| 101 | - 'fail_action' => 'newfieldset', | ||
| 102 | - 'action' => 'create', | ||
| 103 | - 'context' => $this, | ||
| 104 | - )); | ||
| 105 | - | ||
| 106 | - | ||
| 107 | - // construct the widget set. | ||
| 108 | - // we use a slight variation here, because "type" is only present in certain circumstances. | ||
| 109 | - $widgets = array( | ||
| 110 | - array('ktcore.widgets.string',array( | ||
| 111 | - 'label' => _kt("Fieldset Name"), | ||
| 112 | - 'name' => 'name', | ||
| 113 | - 'required' => true, | ||
| 114 | - 'description' => _kt("Each fieldset needs a unique name."), | ||
| 115 | - )), | ||
| 116 | - array('ktcore.widgets.text',array( | ||
| 117 | - 'label' => _kt("Description"), | ||
| 118 | - 'name' => 'description', | ||
| 119 | - 'required' => true, | ||
| 120 | - 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | ||
| 121 | - )), | ||
| 122 | - ); | ||
| 123 | - if ($this->bHaveConditional) { | ||
| 124 | - | ||
| 125 | - // FIXME get this from some external source. | ||
| 126 | - $type_vocab = array( | ||
| 127 | - 'normal' => _kt("Normal"), | ||
| 128 | - 'conditional' => _kt("Conditional"), | ||
| 129 | - ); | ||
| 130 | - | ||
| 131 | - $widgets[] = array('ktcore.widgets.selection', array( | ||
| 132 | - 'label' => _kt("Fieldset Type"), | ||
| 133 | - 'use_simple' => false, | ||
| 134 | - 'description' => _kt("It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets."), | ||
| 135 | - 'important_description' => _kt('Note that it is not possible to convert between different types of fieldsets, so please choose carefully.'), | ||
| 136 | - 'name' => 'fieldset_type', | ||
| 137 | - 'required' => true, | ||
| 138 | - 'value' => 'normal', | ||
| 139 | - 'vocab' => $type_vocab, | ||
| 140 | - )); | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - $widgets[] = array('ktcore.widgets.boolean',array( | ||
| 144 | - 'label' => _kt("Generic"), | ||
| 145 | - 'name' => 'generic', | ||
| 146 | - 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | ||
| 147 | - )); | ||
| 148 | - | ||
| 149 | - $oForm->setWidgets($widgets); | ||
| 150 | - | ||
| 151 | - // similarly, we construct validators here. | ||
| 152 | - $validators = array( | ||
| 153 | - array('ktcore.validators.string', array( | ||
| 154 | - 'test' => 'name', | ||
| 155 | - 'output' => 'name', | ||
| 156 | - )), | ||
| 157 | - array('ktcore.validators.string', array( | ||
| 158 | - 'test' => 'description', | ||
| 159 | - 'output' => 'description', | ||
| 160 | - )), | ||
| 161 | - array('ktcore.validators.boolean', array( | ||
| 162 | - 'test' => 'generic', | ||
| 163 | - 'output' => 'generic', | ||
| 164 | - )), | ||
| 165 | - ); | ||
| 166 | - | ||
| 167 | - if ($this->bHaveConditional) { | ||
| 168 | - $validators[] = array('ktcore.validators.string', array( | ||
| 169 | - 'test' => 'fieldset_type', | ||
| 170 | - 'output' => 'fieldset_type', | ||
| 171 | - )); | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | - $oForm->setValidators($validators); | ||
| 175 | - | ||
| 176 | - return $oForm; | ||
| 177 | - } | ||
| 178 | - /** | ||
| 179 | - * Creates a new page | ||
| 180 | - * @return form | ||
| 181 | - * | ||
| 182 | - * iNET Process | ||
| 183 | - */ | ||
| 184 | - function do_newfieldset() { | ||
| 185 | - $this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset")); | ||
| 186 | - $oForm = $this->form_create(); | ||
| 187 | - | ||
| 188 | - return $oForm->render(); | ||
| 189 | - } | ||
| 190 | - /** | ||
| 191 | - * Creates a fieldsets | ||
| 192 | - * @return | ||
| 193 | - * | ||
| 194 | - * iNET Process | ||
| 195 | - */ | ||
| 196 | - function do_create() { | ||
| 197 | - $oForm = $this->form_create(); | ||
| 198 | - $res = $oForm->validate(); | ||
| 199 | - | ||
| 200 | - $data = $res['results']; | ||
| 201 | - $errors = $res['errors']; | ||
| 202 | - $extra_errors = array(); | ||
| 203 | - | ||
| 204 | - if (!empty($data['name'])) { | ||
| 205 | - $oFieldset = KTFieldset::getByName($data['name']); | ||
| 206 | - if (!PEAR::isError($oFieldset)) { | ||
| 207 | - // means we're looking at an existing name | ||
| 208 | - $extra_errors['name'] = _kt("There is already a fieldset with that name."); | ||
| 209 | - } | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - $is_conditional = false; | ||
| 213 | - // FIXME this is inelegant. get it from somewhere else. | ||
| 214 | - if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) { | ||
| 215 | - $is_conditional = true; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - | ||
| 219 | - if (!empty($errors) || !empty($extra_errors)) { | ||
| 220 | - return $oForm->handleError(null, $extra_errors); | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - // we also need a namespace. | ||
| 224 | - $temp_name = $data['name']; | ||
| 225 | - $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | ||
| 226 | - $oOldFieldset = KTFieldset::getByNamespace($namespace); | ||
| 227 | - | ||
| 228 | - while (!PEAR::isError($oOldFieldset)) { | ||
| 229 | - $temp_name .= '_'; | ||
| 230 | - $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | ||
| 231 | - $oOldFieldset = KTFieldset::getByNamespace($namespace); | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - // we now know its a non-conflicting one. | ||
| 235 | - // FIXME handle conditional fieldsets, which should be ... a different object. | ||
| 236 | - $oFieldset = KTFieldset::createFromArray(array( | ||
| 237 | - "name" => $data['name'], | ||
| 238 | - "description" => $data['description'], | ||
| 239 | - "namespace" => $namespace, | ||
| 240 | - "mandatory" => false, // FIXME deprecated | ||
| 241 | - "isConditional" => $is_conditional, // handle this | ||
| 242 | - "isGeneric" => $data['generic'], | ||
| 243 | - "isComplete" => false, | ||
| 244 | - "isComplex" => false, | ||
| 245 | - "isSystem" => false, | ||
| 246 | - )); | ||
| 247 | - if (PEAR::isError($oFieldset)) { | ||
| 248 | - return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage())); | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | - $this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId())); | ||
| 252 | - } | ||
| 253 | - /** | ||
| 254 | - * Gets tyoes for fieldsets | ||
| 255 | - * @return string | ||
| 256 | - * @param $oFieldset Object | ||
| 257 | - * | ||
| 258 | - * iNET Process | ||
| 259 | - */ | ||
| 260 | - function getTypesForFieldset($oFieldset) { | ||
| 261 | - global $default; | ||
| 262 | - if ($oFieldset->getIsGeneric()) { | ||
| 263 | - return _kt('All types use this generic fieldset.'); | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - $types = $oFieldset->getAssociatedTypes(); | ||
| 267 | - if (PEAR::isError($types)) { | ||
| 268 | - $default->log->debug('Fieldsets admin: Error retrieving list of associated document types.'); | ||
| 269 | - return _kt('Error retrieving list of types.'); | ||
| 270 | - } | ||
| 271 | - if (empty($types)) { | ||
| 272 | - return _kt('None'); | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - $aNames = array(); | ||
| 276 | - foreach ($types as $oType) { | ||
| 277 | - if (!PEAR::isError($oType)) { | ||
| 278 | - $aNames[] = $oType->getName(); | ||
| 279 | - }else{ | ||
| 280 | - $default->log->debug('Fieldsets admin: Document type gives error: '.$oType->getMessage()); | ||
| 281 | - } | ||
| 282 | - } | ||
| 283 | - | ||
| 284 | - $list = implode(', ', $aNames); | ||
| 285 | - $length = mb_strlen($list); | ||
| 286 | - | ||
| 287 | - if($length < 50){ | ||
| 288 | - return $list; | ||
| 289 | - } | ||
| 290 | - $default->log->debug('Fieldsets admin: wrapping the list of doc types from length '.$length); | ||
| 291 | - | ||
| 292 | - // Wrap the list to 50 characters per line | ||
| 293 | - $wrapList = ''; | ||
| 294 | - $cut = 0; | ||
| 295 | - while ($length > 50 && $cut !== false){ | ||
| 296 | - $cut = strpos($list, ' ', 50); | ||
| 297 | - $wrapList .= mb_strcut($list, 0, $cut); | ||
| 298 | - $wrapList .= '<br />'; | ||
| 299 | - $list = mb_strcut($list, $cut); | ||
| 300 | - $length = mb_strlen($list); | ||
| 301 | - } | ||
| 302 | - $wrapList .= $list; | ||
| 303 | - | ||
| 304 | - return $wrapList; | ||
| 305 | - } | ||
| 306 | - | ||
| 307 | - /** | ||
| 308 | - * Edits fields | ||
| 309 | - * @return template | ||
| 310 | - * | ||
| 311 | - * iNET Process | ||
| 312 | - */ | ||
| 313 | - function do_edit() { | ||
| 314 | - | ||
| 315 | - // here we engage in some major evil. | ||
| 316 | - // we check for the subevent var | ||
| 317 | - // and subdispatch if appropriate. | ||
| 318 | - // | ||
| 319 | - // saves a little code-duplication (actually, a lot of code-duplication) | ||
| 320 | - | ||
| 321 | - // FIXME this is essentially a stub for the fieldset-delegation code. | ||
| 322 | - if ($this->oFieldset->getIsConditional()) { | ||
| 323 | - | ||
| 324 | - require_once(KT_DIR.'/plugins/ktcore/admin/fieldsets/conditional.inc.php'); | ||
| 325 | - $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; | ||
| 326 | - } else { | ||
| 327 | - // multiselect change start | ||
| 328 | - if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) | ||
| 329 | - { | ||
| 330 | - require_once(KT_DIR.'/plugins/multiselect/inetbasic.inc.php'); | ||
| 331 | - $oSubDispatcher = new InetBasicFieldsetManagementDispatcher; | ||
| 332 | - } | ||
| 333 | - else | ||
| 334 | - { | ||
| 335 | - | ||
| 336 | - require_once(KT_DIR.'/plugins/ktcore/admin/fieldsets/basic.inc.php'); | ||
| 337 | - $oSubDispatcher = new BasicFieldsetManagementDispatcher; | ||
| 338 | - } | ||
| 339 | - // multiselect change end | ||
| 340 | - | ||
| 341 | - | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - $subevent_var = 'fieldset_action'; | ||
| 345 | - $subevent = KTUtil::arrayGet($_REQUEST, $subevent_var); | ||
| 346 | - if (!empty($subevent)) { | ||
| 347 | - // do nothing, since this will handle everything | ||
| 348 | - $this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")); | ||
| 349 | - $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); | ||
| 350 | - exit(0); | ||
| 351 | - } else { | ||
| 352 | - // what we want is the "additional info" section | ||
| 353 | - $additional = $oSubDispatcher->describe_fieldset($this->oFieldset); | ||
| 354 | - } | ||
| 355 | - | ||
| 356 | - $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit'); | ||
| 357 | - $oTemplate->setData(array( | ||
| 358 | - 'context' => $this, | ||
| 359 | - 'fieldset_name' => $this->oFieldset->getName(), | ||
| 360 | - 'additional' => $additional, | ||
| 361 | - )); | ||
| 362 | - return $oTemplate->render(); | ||
| 363 | - } | ||
| 364 | - /** | ||
| 365 | - * deletes field | ||
| 366 | - * @return | ||
| 367 | - * | ||
| 368 | - * iNET Process | ||
| 369 | - */ | ||
| 370 | - function do_delete() { | ||
| 371 | - $this->startTransaction(); | ||
| 372 | - | ||
| 373 | - // check if fieldset is associated with a document type - remove association | ||
| 374 | - $types = $this->oFieldset->getAssociatedTypes(); | ||
| 375 | - $sFieldSetId = $this->oFieldset->getId(); | ||
| 376 | - if(!PEAR::isError($types) AND !empty($types)){ | ||
| 377 | - foreach($types as $oType){ | ||
| 378 | - $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $sFieldSetId); | ||
| 379 | - } | ||
| 380 | - } | ||
| 381 | - | ||
| 382 | - $res = $this->oFieldset->delete('true'); | ||
| 383 | - $this->oValidator->notErrorFalse($res, array( | ||
| 384 | - 'redirect_to' => array('main', ''), | ||
| 385 | - 'message' => _kt('Could not delete fieldset'), | ||
| 386 | - )); | ||
| 387 | - $this->successRedirectToMain(_kt('Fieldset deleted')); | ||
| 388 | - } | ||
| 389 | - /** | ||
| 390 | - * Form for edit | ||
| 391 | - * @return form | ||
| 392 | - * | ||
| 393 | - * iNET Process | ||
| 394 | - */ | ||
| 395 | - function form_edit() { | ||
| 396 | - $oForm = new KTForm; | ||
| 397 | - $oForm->setOptions(array( | ||
| 398 | - 'identifier' => 'ktcore.fieldsets.edit', | ||
| 399 | - 'label' => _kt("Change Fieldset Details"), | ||
| 400 | - 'submit_label' => _kt('Update Fieldset'), | ||
| 401 | - 'cancel_action' => 'edit', | ||
| 402 | - 'fail_action' => 'editfieldset', | ||
| 403 | - 'action' => 'savefieldset', | ||
| 404 | - 'context' => $this, | ||
| 405 | - )); | ||
| 406 | - | ||
| 407 | - | ||
| 408 | - // construct the widget set. | ||
| 409 | - // we use a slight variation here, because "type" is only present in certain circumstances. | ||
| 410 | - $widgets = array( | ||
| 411 | - array('ktcore.widgets.string',array( | ||
| 412 | - 'label' => _kt("Fieldset Name"), | ||
| 413 | - 'name' => 'name', | ||
| 414 | - 'required' => true, | ||
| 415 | - 'description' => _kt("Each fieldset needs a unique name."), | ||
| 416 | - 'value' => sanitizeForHTML($this->oFieldset->getName()), | ||
| 417 | - )), | ||
| 418 | - array('ktcore.widgets.text',array( | ||
| 419 | - 'label' => _kt("Description"), | ||
| 420 | - 'name' => 'description', | ||
| 421 | - 'required' => true, | ||
| 422 | - 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | ||
| 423 | - 'value' => sanitizeForHTML($this->oFieldset->getDescription()), | ||
| 424 | - )), | ||
| 425 | - ); | ||
| 426 | - | ||
| 427 | - $widgets[] = array('ktcore.widgets.boolean',array( | ||
| 428 | - 'label' => _kt("Generic"), | ||
| 429 | - 'name' => 'generic', | ||
| 430 | - 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | ||
| 431 | - 'value' => $this->oFieldset->getIsGeneric(), | ||
| 432 | - )); | ||
| 433 | - | ||
| 434 | - $oForm->setWidgets($widgets); | ||
| 435 | - | ||
| 436 | - // similarly, we construct validators here. | ||
| 437 | - $validators = array( | ||
| 438 | - array('ktcore.validators.string', array( | ||
| 439 | - 'test' => 'name', | ||
| 440 | - 'output' => 'name', | ||
| 441 | - )), | ||
| 442 | - array('ktcore.validators.string', array( | ||
| 443 | - 'test' => 'description', | ||
| 444 | - 'output' => 'description', | ||
| 445 | - )), | ||
| 446 | - array('ktcore.validators.boolean', array( | ||
| 447 | - 'test' => 'generic', | ||
| 448 | - 'output' => 'generic', | ||
| 449 | - )), | ||
| 450 | - ); | ||
| 451 | - | ||
| 452 | - $oForm->setValidators($validators); | ||
| 453 | - | ||
| 454 | - return $oForm; | ||
| 455 | - } | ||
| 456 | - /** | ||
| 457 | - * Edits a fieldsets | ||
| 458 | - * @return form | ||
| 459 | - * | ||
| 460 | - * iNET Process | ||
| 461 | - */ | ||
| 462 | - function do_editfieldset() { | ||
| 463 | - $oForm = $this->form_edit(); | ||
| 464 | - $this->oPage->setBreadcrumbDetails(_kt('edit fieldset')); | ||
| 465 | - return $oForm->renderPage(_kt("Edit Fieldset")); | ||
| 466 | - } | ||
| 467 | - /** | ||
| 468 | - * saves a fieldset | ||
| 469 | - * @return | ||
| 470 | - * | ||
| 471 | - * iNET Process | ||
| 472 | - */ | ||
| 473 | - function do_savefieldset() { | ||
| 474 | - $oForm = $this->form_edit(); | ||
| 475 | - $res = $oForm->validate(); | ||
| 476 | - | ||
| 477 | - $data = $res['results']; | ||
| 478 | - $errors = $res['errors']; | ||
| 479 | - $extra_errors = array(); | ||
| 480 | - if ($data['name'] != $this->oFieldset->getName()) { | ||
| 481 | - $oOldFieldset = KTFieldset::getByName($data['name']); | ||
| 482 | - if (!PEAR::isError($oOldFieldset)) { | ||
| 483 | - $extra_errors['name'][] = _kt("A fieldset with that name already exists."); | ||
| 484 | - } | ||
| 485 | - } | ||
| 486 | - | ||
| 487 | - if (!empty($errors) || !empty($extra_errors)) { | ||
| 488 | - return $oForm->handleError(null, $extra_errors); | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - $this->startTransaction(); | ||
| 492 | - | ||
| 493 | - $this->oFieldset->setName($data['name']); | ||
| 494 | - $this->oFieldset->setDescription($data['description']); | ||
| 495 | - $bGeneric = $data['generic']; | ||
| 496 | - if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) { | ||
| 497 | - // delink it from all doctypes. | ||
| 498 | - $aTypes = $this->oFieldset->getAssociatedTypes(); | ||
| 499 | - foreach ($aTypes as $oType) { | ||
| 500 | - $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId()); | ||
| 501 | - if (PEAR::isError($res)) { | ||
| 502 | - $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); | ||
| 503 | - exit(0); | ||
| 504 | - } | ||
| 505 | - } | ||
| 506 | - } | ||
| 507 | - | ||
| 508 | - $this->oFieldset->setIsGeneric($data['generic']); | ||
| 509 | - | ||
| 510 | - $res = $this->oFieldset->update(); | ||
| 511 | - if (PEAR::isError($res)) { | ||
| 512 | - $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); | ||
| 513 | - exit(0); | ||
| 514 | - } | ||
| 515 | - | ||
| 516 | - return $this->successRedirectTo('edit', _kt("Fieldset details updated.")); | ||
| 517 | - } | ||
| 518 | -} | ||
| 519 | - | 1 | +<?php |
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * KnowledgeTree Community Edition | ||
| 6 | + * Document Management Made Simple | ||
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | + * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | + * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | + * Free Software Foundation. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | + * details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | + * | ||
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | + * | ||
| 25 | + * The interactive user interfaces in modified source and object code versions | ||
| 26 | + * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | + * Section 5 of the GNU General Public License version 3. | ||
| 28 | + * | ||
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | + * copyright notice. | ||
| 35 | + * Contributor( s): ______________________________________ | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | ||
| 40 | +require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); | ||
| 41 | +require_once(KT_LIB_DIR . '/widgets/forms.inc.php'); | ||
| 42 | +require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); | ||
| 43 | + | ||
| 44 | +class InetDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 45 | + var $bAutomaticTransaction = true; | ||
| 46 | + var $bHaveConditional = null; | ||
| 47 | + var $sHelpPage = 'ktcore/admin/document fieldsets.html'; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * | ||
| 51 | + * @return. | ||
| 52 | + * @param. | ||
| 53 | + * | ||
| 54 | + * iNET Process | ||
| 55 | + */ | ||
| 56 | + function predispatch() { | ||
| 57 | + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management')); | ||
| 58 | + $this->persistParams(array('fFieldsetId')); | ||
| 59 | + | ||
| 60 | + $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); | ||
| 61 | + if (PEAR::isError($this->oFieldset)) { | ||
| 62 | + $this->oFieldset = null; | ||
| 63 | + unset($_REQUEST['fFieldset']); // prevent further attacks. | ||
| 64 | + } else { | ||
| 65 | + $this->aBreadcrumbs[] = array('url' => KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")), 'name' => $this->oFieldset->getName()); | ||
| 66 | + } | ||
| 67 | + $this->bHaveConditional = KTPluginUtil::pluginIsActive('ktextra.conditionalmetadata.plugin'); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * create template | ||
| 72 | + * @Param. | ||
| 73 | + * @return template. | ||
| 74 | + * | ||
| 75 | + * iNET Process | ||
| 76 | + */ | ||
| 77 | + function do_main () { | ||
| 78 | + $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list'); | ||
| 79 | + | ||
| 80 | + $oTemplate->setData(array( | ||
| 81 | + 'context' => $this, | ||
| 82 | + 'fieldsets' => KTFieldset::getList("disabled != true AND namespace != 'tagcloud'"), | ||
| 83 | + )); | ||
| 84 | + return $oTemplate; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * form for creating new fieldset. | ||
| 89 | + * @Param. | ||
| 90 | + * @return form. | ||
| 91 | + * | ||
| 92 | + * iNET Process | ||
| 93 | + */ | ||
| 94 | + function form_create() { | ||
| 95 | + $oForm = new KTForm; | ||
| 96 | + $oForm->setOptions(array( | ||
| 97 | + 'identifier' => 'ktcore.fieldsets.create', | ||
| 98 | + 'label' => _kt("Create New Fieldset"), | ||
| 99 | + 'submit_label' => _kt('Create Fieldset'), | ||
| 100 | + 'cancel_action' => 'main', | ||
| 101 | + 'fail_action' => 'newfieldset', | ||
| 102 | + 'action' => 'create', | ||
| 103 | + 'context' => $this, | ||
| 104 | + )); | ||
| 105 | + | ||
| 106 | + | ||
| 107 | + // construct the widget set. | ||
| 108 | + // we use a slight variation here, because "type" is only present in certain circumstances. | ||
| 109 | + $widgets = array( | ||
| 110 | + array('ktcore.widgets.string',array( | ||
| 111 | + 'label' => _kt("Fieldset Name"), | ||
| 112 | + 'name' => 'name', | ||
| 113 | + 'required' => true, | ||
| 114 | + 'description' => _kt("Each fieldset needs a unique name."), | ||
| 115 | + )), | ||
| 116 | + array('ktcore.widgets.text',array( | ||
| 117 | + 'label' => _kt("Description"), | ||
| 118 | + 'name' => 'description', | ||
| 119 | + 'required' => true, | ||
| 120 | + 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | ||
| 121 | + )), | ||
| 122 | + ); | ||
| 123 | + if ($this->bHaveConditional) { | ||
| 124 | + | ||
| 125 | + // FIXME get this from some external source. | ||
| 126 | + $type_vocab = array( | ||
| 127 | + 'normal' => _kt("Normal"), | ||
| 128 | + 'conditional' => _kt("Conditional"), | ||
| 129 | + ); | ||
| 130 | + | ||
| 131 | + $widgets[] = array('ktcore.widgets.selection', array( | ||
| 132 | + 'label' => _kt("Fieldset Type"), | ||
| 133 | + 'use_simple' => false, | ||
| 134 | + 'description' => _kt("It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets."), | ||
| 135 | + 'important_description' => _kt('Note that it is not possible to convert between different types of fieldsets, so please choose carefully.'), | ||
| 136 | + 'name' => 'fieldset_type', | ||
| 137 | + 'required' => true, | ||
| 138 | + 'value' => 'normal', | ||
| 139 | + 'vocab' => $type_vocab, | ||
| 140 | + )); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + $widgets[] = array('ktcore.widgets.boolean',array( | ||
| 144 | + 'label' => _kt("Generic"), | ||
| 145 | + 'name' => 'generic', | ||
| 146 | + 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | ||
| 147 | + )); | ||
| 148 | + | ||
| 149 | + $oForm->setWidgets($widgets); | ||
| 150 | + | ||
| 151 | + // similarly, we construct validators here. | ||
| 152 | + $validators = array( | ||
| 153 | + array('ktcore.validators.string', array( | ||
| 154 | + 'test' => 'name', | ||
| 155 | + 'output' => 'name', | ||
| 156 | + )), | ||
| 157 | + array('ktcore.validators.string', array( | ||
| 158 | + 'test' => 'description', | ||
| 159 | + 'output' => 'description', | ||
| 160 | + )), | ||
| 161 | + array('ktcore.validators.boolean', array( | ||
| 162 | + 'test' => 'generic', | ||
| 163 | + 'output' => 'generic', | ||
| 164 | + )), | ||
| 165 | + ); | ||
| 166 | + | ||
| 167 | + if ($this->bHaveConditional) { | ||
| 168 | + $validators[] = array('ktcore.validators.string', array( | ||
| 169 | + 'test' => 'fieldset_type', | ||
| 170 | + 'output' => 'fieldset_type', | ||
| 171 | + )); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + $oForm->setValidators($validators); | ||
| 175 | + | ||
| 176 | + return $oForm; | ||
| 177 | + } | ||
| 178 | + /** | ||
| 179 | + * Creates a new page | ||
| 180 | + * @return form | ||
| 181 | + * | ||
| 182 | + * iNET Process | ||
| 183 | + */ | ||
| 184 | + function do_newfieldset() { | ||
| 185 | + $this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset")); | ||
| 186 | + $oForm = $this->form_create(); | ||
| 187 | + | ||
| 188 | + return $oForm->render(); | ||
| 189 | + } | ||
| 190 | + /** | ||
| 191 | + * Creates a fieldsets | ||
| 192 | + * @return | ||
| 193 | + * | ||
| 194 | + * iNET Process | ||
| 195 | + */ | ||
| 196 | + function do_create() { | ||
| 197 | + $oForm = $this->form_create(); | ||
| 198 | + $res = $oForm->validate(); | ||
| 199 | + | ||
| 200 | + $data = $res['results']; | ||
| 201 | + $errors = $res['errors']; | ||
| 202 | + $extra_errors = array(); | ||
| 203 | + | ||
| 204 | + if (!empty($data['name'])) { | ||
| 205 | + $oFieldset = KTFieldset::getByName($data['name']); | ||
| 206 | + if (!PEAR::isError($oFieldset)) { | ||
| 207 | + // means we're looking at an existing name | ||
| 208 | + $extra_errors['name'] = _kt("There is already a fieldset with that name."); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + $is_conditional = false; | ||
| 213 | + // FIXME this is inelegant. get it from somewhere else. | ||
| 214 | + if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) { | ||
| 215 | + $is_conditional = true; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + | ||
| 219 | + if (!empty($errors) || !empty($extra_errors)) { | ||
| 220 | + return $oForm->handleError(null, $extra_errors); | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + // we also need a namespace. | ||
| 224 | + $temp_name = $data['name']; | ||
| 225 | + $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | ||
| 226 | + $oOldFieldset = KTFieldset::getByNamespace($namespace); | ||
| 227 | + | ||
| 228 | + while (!PEAR::isError($oOldFieldset)) { | ||
| 229 | + $temp_name .= '_'; | ||
| 230 | + $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | ||
| 231 | + $oOldFieldset = KTFieldset::getByNamespace($namespace); | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + // we now know its a non-conflicting one. | ||
| 235 | + // FIXME handle conditional fieldsets, which should be ... a different object. | ||
| 236 | + $oFieldset = KTFieldset::createFromArray(array( | ||
| 237 | + "name" => $data['name'], | ||
| 238 | + "description" => $data['description'], | ||
| 239 | + "namespace" => $namespace, | ||
| 240 | + "mandatory" => false, // FIXME deprecated | ||
| 241 | + "isConditional" => $is_conditional, // handle this | ||
| 242 | + "isGeneric" => $data['generic'], | ||
| 243 | + "isComplete" => false, | ||
| 244 | + "isComplex" => false, | ||
| 245 | + "isSystem" => false, | ||
| 246 | + )); | ||
| 247 | + if (PEAR::isError($oFieldset)) { | ||
| 248 | + return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage())); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + $this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId())); | ||
| 252 | + } | ||
| 253 | + /** | ||
| 254 | + * Gets tyoes for fieldsets | ||
| 255 | + * @return string | ||
| 256 | + * @param $oFieldset Object | ||
| 257 | + * | ||
| 258 | + * iNET Process | ||
| 259 | + */ | ||
| 260 | + function getTypesForFieldset($oFieldset) { | ||
| 261 | + global $default; | ||
| 262 | + if ($oFieldset->getIsGeneric()) { | ||
| 263 | + return _kt('All types use this generic fieldset.'); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + $types = $oFieldset->getAssociatedTypes(); | ||
| 267 | + if (PEAR::isError($types)) { | ||
| 268 | + $default->log->debug('Fieldsets admin: Error retrieving list of associated document types.'); | ||
| 269 | + return _kt('Error retrieving list of types.'); | ||
| 270 | + } | ||
| 271 | + if (empty($types)) { | ||
| 272 | + return _kt('None'); | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + $aNames = array(); | ||
| 276 | + foreach ($types as $oType) { | ||
| 277 | + if (!PEAR::isError($oType)) { | ||
| 278 | + $aNames[] = $oType->getName(); | ||
| 279 | + }else{ | ||
| 280 | + $default->log->debug('Fieldsets admin: Document type gives error: '.$oType->getMessage()); | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + $list = implode(', ', $aNames); | ||
| 285 | + $length = mb_strlen($list); | ||
| 286 | + | ||
| 287 | + if($length < 50){ | ||
| 288 | + return $list; | ||
| 289 | + } | ||
| 290 | + $default->log->debug('Fieldsets admin: wrapping the list of doc types from length '.$length); | ||
| 291 | + | ||
| 292 | + // Wrap the list to 50 characters per line | ||
| 293 | + $wrapList = ''; | ||
| 294 | + $cut = 0; | ||
| 295 | + while ($length > 50 && $cut !== false){ | ||
| 296 | + $cut = strpos($list, ' ', 50); | ||
| 297 | + $wrapList .= mb_strcut($list, 0, $cut); | ||
| 298 | + $wrapList .= '<br />'; | ||
| 299 | + $list = mb_strcut($list, $cut); | ||
| 300 | + $length = mb_strlen($list); | ||
| 301 | + } | ||
| 302 | + $wrapList .= $list; | ||
| 303 | + | ||
| 304 | + return $wrapList; | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + /** | ||
| 308 | + * Edits fields | ||
| 309 | + * @return template | ||
| 310 | + * | ||
| 311 | + * iNET Process | ||
| 312 | + */ | ||
| 313 | + function do_edit() { | ||
| 314 | + | ||
| 315 | + // here we engage in some major evil. | ||
| 316 | + // we check for the subevent var | ||
| 317 | + // and subdispatch if appropriate. | ||
| 318 | + // | ||
| 319 | + // saves a little code-duplication (actually, a lot of code-duplication) | ||
| 320 | + | ||
| 321 | + // FIXME this is essentially a stub for the fieldset-delegation code. | ||
| 322 | + if ($this->oFieldset->getIsConditional()) { | ||
| 323 | + | ||
| 324 | + require_once(KT_DIR.'/plugins/ktcore/admin/fieldsets/conditional.inc.php'); | ||
| 325 | + $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; | ||
| 326 | + } else { | ||
| 327 | + // multiselect change start | ||
| 328 | + if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) | ||
| 329 | + { | ||
| 330 | + require_once(KT_DIR.'/plugins/multiselect/inetbasic.inc.php'); | ||
| 331 | + $oSubDispatcher = new InetBasicFieldsetManagementDispatcher; | ||
| 332 | + } | ||
| 333 | + else | ||
| 334 | + { | ||
| 335 | + | ||
| 336 | + require_once(KT_DIR.'/plugins/ktcore/admin/fieldsets/basic.inc.php'); | ||
| 337 | + $oSubDispatcher = new BasicFieldsetManagementDispatcher; | ||
| 338 | + } | ||
| 339 | + // multiselect change end | ||
| 340 | + | ||
| 341 | + | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + $subevent_var = 'fieldset_action'; | ||
| 345 | + $subevent = KTUtil::arrayGet($_REQUEST, $subevent_var); | ||
| 346 | + if (!empty($subevent)) { | ||
| 347 | + // do nothing, since this will handle everything | ||
| 348 | + $this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")); | ||
| 349 | + $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); | ||
| 350 | + exit(0); | ||
| 351 | + } else { | ||
| 352 | + // what we want is the "additional info" section | ||
| 353 | + $additional = $oSubDispatcher->describe_fieldset($this->oFieldset); | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit'); | ||
| 357 | + $oTemplate->setData(array( | ||
| 358 | + 'context' => $this, | ||
| 359 | + 'fieldset_name' => $this->oFieldset->getName(), | ||
| 360 | + 'additional' => $additional, | ||
| 361 | + )); | ||
| 362 | + return $oTemplate->render(); | ||
| 363 | + } | ||
| 364 | + /** | ||
| 365 | + * deletes field | ||
| 366 | + * @return | ||
| 367 | + * | ||
| 368 | + * iNET Process | ||
| 369 | + */ | ||
| 370 | + function do_delete() { | ||
| 371 | + $this->startTransaction(); | ||
| 372 | + | ||
| 373 | + // check if fieldset is associated with a document type - remove association | ||
| 374 | + $types = $this->oFieldset->getAssociatedTypes(); | ||
| 375 | + $sFieldSetId = $this->oFieldset->getId(); | ||
| 376 | + if(!PEAR::isError($types) AND !empty($types)){ | ||
| 377 | + foreach($types as $oType){ | ||
| 378 | + $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $sFieldSetId); | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + $res = $this->oFieldset->delete('true'); | ||
| 383 | + $this->oValidator->notErrorFalse($res, array( | ||
| 384 | + 'redirect_to' => array('main', ''), | ||
| 385 | + 'message' => _kt('Could not delete fieldset'), | ||
| 386 | + )); | ||
| 387 | + $this->successRedirectToMain(_kt('Fieldset deleted')); | ||
| 388 | + } | ||
| 389 | + /** | ||
| 390 | + * Form for edit | ||
| 391 | + * @return form | ||
| 392 | + * | ||
| 393 | + * iNET Process | ||
| 394 | + */ | ||
| 395 | + function form_edit() { | ||
| 396 | + $oForm = new KTForm; | ||
| 397 | + $oForm->setOptions(array( | ||
| 398 | + 'identifier' => 'ktcore.fieldsets.edit', | ||
| 399 | + 'label' => _kt("Change Fieldset Details"), | ||
| 400 | + 'submit_label' => _kt('Update Fieldset'), | ||
| 401 | + 'cancel_action' => 'edit', | ||
| 402 | + 'fail_action' => 'editfieldset', | ||
| 403 | + 'action' => 'savefieldset', | ||
| 404 | + 'context' => $this, | ||
| 405 | + )); | ||
| 406 | + | ||
| 407 | + | ||
| 408 | + // construct the widget set. | ||
| 409 | + // we use a slight variation here, because "type" is only present in certain circumstances. | ||
| 410 | + $widgets = array( | ||
| 411 | + array('ktcore.widgets.string',array( | ||
| 412 | + 'label' => _kt("Fieldset Name"), | ||
| 413 | + 'name' => 'name', | ||
| 414 | + 'required' => true, | ||
| 415 | + 'description' => _kt("Each fieldset needs a unique name."), | ||
| 416 | + 'value' => sanitizeForHTML($this->oFieldset->getName()), | ||
| 417 | + )), | ||
| 418 | + array('ktcore.widgets.text',array( | ||
| 419 | + 'label' => _kt("Description"), | ||
| 420 | + 'name' => 'description', | ||
| 421 | + 'required' => true, | ||
| 422 | + 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | ||
| 423 | + 'value' => sanitizeForHTML($this->oFieldset->getDescription()), | ||
| 424 | + )), | ||
| 425 | + ); | ||
| 426 | + | ||
| 427 | + $widgets[] = array('ktcore.widgets.boolean',array( | ||
| 428 | + 'label' => _kt("Generic"), | ||
| 429 | + 'name' => 'generic', | ||
| 430 | + 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | ||
| 431 | + 'value' => $this->oFieldset->getIsGeneric(), | ||
| 432 | + )); | ||
| 433 | + | ||
| 434 | + $oForm->setWidgets($widgets); | ||
| 435 | + | ||
| 436 | + // similarly, we construct validators here. | ||
| 437 | + $validators = array( | ||
| 438 | + array('ktcore.validators.string', array( | ||
| 439 | + 'test' => 'name', | ||
| 440 | + 'output' => 'name', | ||
| 441 | + )), | ||
| 442 | + array('ktcore.validators.string', array( | ||
| 443 | + 'test' => 'description', | ||
| 444 | + 'output' => 'description', | ||
| 445 | + )), | ||
| 446 | + array('ktcore.validators.boolean', array( | ||
| 447 | + 'test' => 'generic', | ||
| 448 | + 'output' => 'generic', | ||
| 449 | + )), | ||
| 450 | + ); | ||
| 451 | + | ||
| 452 | + $oForm->setValidators($validators); | ||
| 453 | + | ||
| 454 | + return $oForm; | ||
| 455 | + } | ||
| 456 | + /** | ||
| 457 | + * Edits a fieldsets | ||
| 458 | + * @return form | ||
| 459 | + * | ||
| 460 | + * iNET Process | ||
| 461 | + */ | ||
| 462 | + function do_editfieldset() { | ||
| 463 | + $oForm = $this->form_edit(); | ||
| 464 | + $this->oPage->setBreadcrumbDetails(_kt('edit fieldset')); | ||
| 465 | + return $oForm->renderPage(_kt("Edit Fieldset")); | ||
| 466 | + } | ||
| 467 | + /** | ||
| 468 | + * saves a fieldset | ||
| 469 | + * @return | ||
| 470 | + * | ||
| 471 | + * iNET Process | ||
| 472 | + */ | ||
| 473 | + function do_savefieldset() { | ||
| 474 | + $oForm = $this->form_edit(); | ||
| 475 | + $res = $oForm->validate(); | ||
| 476 | + | ||
| 477 | + $data = $res['results']; | ||
| 478 | + $errors = $res['errors']; | ||
| 479 | + $extra_errors = array(); | ||
| 480 | + if ($data['name'] != $this->oFieldset->getName()) { | ||
| 481 | + $oOldFieldset = KTFieldset::getByName($data['name']); | ||
| 482 | + if (!PEAR::isError($oOldFieldset)) { | ||
| 483 | + $extra_errors['name'][] = _kt("A fieldset with that name already exists."); | ||
| 484 | + } | ||
| 485 | + } | ||
| 486 | + | ||
| 487 | + if (!empty($errors) || !empty($extra_errors)) { | ||
| 488 | + return $oForm->handleError(null, $extra_errors); | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + $this->startTransaction(); | ||
| 492 | + | ||
| 493 | + $this->oFieldset->setName($data['name']); | ||
| 494 | + $this->oFieldset->setDescription($data['description']); | ||
| 495 | + $bGeneric = $data['generic']; | ||
| 496 | + if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) { | ||
| 497 | + // delink it from all doctypes. | ||
| 498 | + $aTypes = $this->oFieldset->getAssociatedTypes(); | ||
| 499 | + foreach ($aTypes as $oType) { | ||
| 500 | + $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId()); | ||
| 501 | + if (PEAR::isError($res)) { | ||
| 502 | + $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); | ||
| 503 | + exit(0); | ||
| 504 | + } | ||
| 505 | + } | ||
| 506 | + } | ||
| 507 | + | ||
| 508 | + $this->oFieldset->setIsGeneric($data['generic']); | ||
| 509 | + | ||
| 510 | + $res = $this->oFieldset->update(); | ||
| 511 | + if (PEAR::isError($res)) { | ||
| 512 | + $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); | ||
| 513 | + exit(0); | ||
| 514 | + } | ||
| 515 | + | ||
| 516 | + return $this->successRedirectTo('edit', _kt("Fieldset details updated.")); | ||
| 517 | + } | ||
| 518 | +} | ||
| 519 | + | ||
| 520 | ?> | 520 | ?> |
| 521 | \ No newline at end of file | 521 | \ No newline at end of file |
plugins/multiselect/MultiSelectPlugin.php
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * KnowledgeTree Community Edition | ||
| 6 | - * Document Management Made Simple | ||
| 7 | - * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | - * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | - * | ||
| 10 | - * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | - * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | - * Free Software Foundation. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | - * details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | - * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | - * | ||
| 25 | - * The interactive user interfaces in modified source and object code versions | ||
| 26 | - * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | - * Section 5 of the GNU General Public License version 3. | ||
| 28 | - * | ||
| 29 | - * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | - * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | - * copyright notice. | ||
| 35 | - * Contributor( s): ______________________________________ | ||
| 36 | - * | ||
| 37 | - */ | ||
| 38 | - | ||
| 39 | -require_once(KT_LIB_DIR . '/plugins/plugin.inc.php'); | ||
| 40 | -require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); | ||
| 41 | - | ||
| 42 | -class MultiSelectPlugin extends KTPlugin { | ||
| 43 | - var $sNamespace = "inet.multiselect.lookupvalue.plugin"; | ||
| 44 | - var $autoRegister = false; | ||
| 45 | - | ||
| 46 | - /** | ||
| 47 | - * returns plugin name | ||
| 48 | - * @param string. | ||
| 49 | - * @return string. | ||
| 50 | - * | ||
| 51 | - * iNET Process | ||
| 52 | - */ | ||
| 53 | - function MultiSelectPlugin($sFilename = null) { | ||
| 54 | - $res = parent::KTPlugin($sFilename); | ||
| 55 | - $this->sFriendlyName = _kt('Multi-select Plugin'); | ||
| 56 | - return $res; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * Register the action, location, call adminsetup function and sql function | ||
| 61 | - * iNET Process | ||
| 62 | - */ | ||
| 63 | - function setup() { | ||
| 64 | - $oTemplating =& KTTemplating::getSingleton(); | ||
| 65 | - $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates'); | ||
| 66 | - | ||
| 67 | - $dir = dirname(__FILE__); | ||
| 68 | - $this->applySQL(realpath($dir . '/sql/script.sql')); | ||
| 69 | - | ||
| 70 | - //For adding documents | ||
| 71 | - $this->registerAction('folderaction', 'MultiDocumentAddAction', 'inet.multiselect.actions.document.addDocument', 'addDocument.php'); | ||
| 72 | - | ||
| 73 | - //For bulk upload | ||
| 74 | - $this->registerAction('folderaction', 'InetBulkUploadFolderAction', 'inet.actions.folder.bulkUpload', 'BulkUpload.php'); | ||
| 75 | - /** | ||
| 76 | - * Change Starts | iNET Process | ||
| 77 | - * Code is Added 2009-03-04 :SL | ||
| 78 | - * Reason : To Register "import from folder location" action for multiselect | ||
| 79 | - */ | ||
| 80 | - $this->registerAction('folderaction', 'InetBulkImportFolderMultiSelectAction', 'inet.actions.folder.bulkImport.multiselect', 'BulkImport.php'); | ||
| 81 | - /** | ||
| 82 | - * Change Ends | iNET Process | ||
| 83 | - */ | ||
| 84 | - $this->setupAdmin(); | ||
| 85 | - } | ||
| 86 | - /** | ||
| 87 | - * applies queries to the database | ||
| 88 | - * @return | ||
| 89 | - * @param $filename Object | ||
| 90 | - */ | ||
| 91 | - function applySQL($filename) | ||
| 92 | - { | ||
| 93 | - global $default; | ||
| 94 | - DBUtil::setupAdminDatabase(); | ||
| 95 | - $db = $default->_admindb; | ||
| 96 | - | ||
| 97 | - $content = file_get_contents($filename); | ||
| 98 | - $aQueries = SQLFile::splitSQL($content); | ||
| 99 | - | ||
| 100 | - DBUtil::startTransaction(); | ||
| 101 | - foreach($aQueries as $sQuery) | ||
| 102 | - { | ||
| 103 | - $res = DBUtil::runQuery($sQuery, $db); | ||
| 104 | - if (PEAR::isError($res)) { | ||
| 105 | - continue; | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - DBUtil::commit(); | ||
| 109 | - } | ||
| 110 | - /** | ||
| 111 | - * Sets up an admin | ||
| 112 | - * @return | ||
| 113 | - */ | ||
| 114 | - function setupAdmin() | ||
| 115 | - { | ||
| 116 | - $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>"; | ||
| 117 | - $js .= "<script src='plugins/multiselect/js/hideadminlink.js' type='text/javascript'></script>"; | ||
| 118 | - $this->registerAdminPage('ratpfieldset', 'InetDocumentFieldDispatcher', 'documents', | ||
| 119 | - $js._kt('Document Fieldsets'), | ||
| 120 | - _kt('Manage the different types of information with multiselect functionality that can be associated with classes of documents.'), | ||
| 121 | - 'InetdocumentFieldsv2.php', null); | ||
| 122 | - } | ||
| 123 | -} | ||
| 124 | -$oPluginRegistry =& KTPluginRegistry::getSingleton(); | ||
| 125 | -$oPluginRegistry->registerPlugin('MultiSelectPlugin', 'inet.multiselect.lookupvalue.plugin', __FILE__); | 1 | +<?php |
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * KnowledgeTree Community Edition | ||
| 6 | + * Document Management Made Simple | ||
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | + * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | + * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | + * Free Software Foundation. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | + * details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | + * | ||
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | + * | ||
| 25 | + * The interactive user interfaces in modified source and object code versions | ||
| 26 | + * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | + * Section 5 of the GNU General Public License version 3. | ||
| 28 | + * | ||
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | + * copyright notice. | ||
| 35 | + * Contributor( s): ______________________________________ | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | +require_once(KT_LIB_DIR . '/plugins/plugin.inc.php'); | ||
| 40 | +require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); | ||
| 41 | + | ||
| 42 | +class MultiSelectPlugin extends KTPlugin { | ||
| 43 | + var $sNamespace = "inet.multiselect.lookupvalue.plugin"; | ||
| 44 | + var $autoRegister = false; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * returns plugin name | ||
| 48 | + * @param string. | ||
| 49 | + * @return string. | ||
| 50 | + * | ||
| 51 | + * iNET Process | ||
| 52 | + */ | ||
| 53 | + function MultiSelectPlugin($sFilename = null) { | ||
| 54 | + $res = parent::KTPlugin($sFilename); | ||
| 55 | + $this->sFriendlyName = _kt('Multi-select Plugin'); | ||
| 56 | + return $res; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * Register the action, location, call adminsetup function and sql function | ||
| 61 | + * iNET Process | ||
| 62 | + */ | ||
| 63 | + function setup() { | ||
| 64 | + $oTemplating =& KTTemplating::getSingleton(); | ||
| 65 | + $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates'); | ||
| 66 | + | ||
| 67 | + $dir = dirname(__FILE__); | ||
| 68 | + $this->applySQL(realpath($dir . '/sql/script.sql')); | ||
| 69 | + | ||
| 70 | + //For adding documents | ||
| 71 | + $this->registerAction('folderaction', 'MultiDocumentAddAction', 'inet.multiselect.actions.document.addDocument', 'addDocument.php'); | ||
| 72 | + | ||
| 73 | + //For bulk upload | ||
| 74 | + $this->registerAction('folderaction', 'InetBulkUploadFolderAction', 'inet.actions.folder.bulkUpload', 'BulkUpload.php'); | ||
| 75 | + /** | ||
| 76 | + * Change Starts | iNET Process | ||
| 77 | + * Code is Added 2009-03-04 :SL | ||
| 78 | + * Reason : To Register "import from folder location" action for multiselect | ||
| 79 | + */ | ||
| 80 | + $this->registerAction('folderaction', 'InetBulkImportFolderMultiSelectAction', 'inet.actions.folder.bulkImport.multiselect', 'BulkImport.php'); | ||
| 81 | + /** | ||
| 82 | + * Change Ends | iNET Process | ||
| 83 | + */ | ||
| 84 | + $this->setupAdmin(); | ||
| 85 | + } | ||
| 86 | + /** | ||
| 87 | + * applies queries to the database | ||
| 88 | + * @return | ||
| 89 | + * @param $filename Object | ||
| 90 | + */ | ||
| 91 | + function applySQL($filename) | ||
| 92 | + { | ||
| 93 | + global $default; | ||
| 94 | + DBUtil::setupAdminDatabase(); | ||
| 95 | + $db = $default->_admindb; | ||
| 96 | + | ||
| 97 | + $content = file_get_contents($filename); | ||
| 98 | + $aQueries = SQLFile::splitSQL($content); | ||
| 99 | + | ||
| 100 | + DBUtil::startTransaction(); | ||
| 101 | + foreach($aQueries as $sQuery) | ||
| 102 | + { | ||
| 103 | + $res = DBUtil::runQuery($sQuery, $db); | ||
| 104 | + if (PEAR::isError($res)) { | ||
| 105 | + continue; | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + DBUtil::commit(); | ||
| 109 | + } | ||
| 110 | + /** | ||
| 111 | + * Sets up an admin | ||
| 112 | + * @return | ||
| 113 | + */ | ||
| 114 | + function setupAdmin() | ||
| 115 | + { | ||
| 116 | + $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>"; | ||
| 117 | + $js .= "<script src='plugins/multiselect/js/hideadminlink.js' type='text/javascript'></script>"; | ||
| 118 | + $this->registerAdminPage('ratpfieldset', 'InetDocumentFieldDispatcher', 'documents', | ||
| 119 | + $js._kt('Document Fieldsets'), | ||
| 120 | + _kt('Manage the different types of information with multiselect functionality that can be associated with classes of documents.'), | ||
| 121 | + 'InetdocumentFieldsv2.php', null); | ||
| 122 | + } | ||
| 123 | +} | ||
| 124 | +$oPluginRegistry =& KTPluginRegistry::getSingleton(); | ||
| 125 | +$oPluginRegistry->registerPlugin('MultiSelectPlugin', 'inet.multiselect.lookupvalue.plugin', __FILE__); | ||
| 126 | ?> | 126 | ?> |
| 127 | \ No newline at end of file | 127 | \ No newline at end of file |
plugins/multiselect/inetbasic.inc.php
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * KnowledgeTree Community Edition | ||
| 6 | - * Document Management Made Simple | ||
| 7 | - * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | - * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | - * | ||
| 10 | - * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | - * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | - * Free Software Foundation. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | - * details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | - * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | - * | ||
| 25 | - * The interactive user interfaces in modified source and object code versions | ||
| 26 | - * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | - * Section 5 of the GNU General Public License version 3. | ||
| 28 | - * | ||
| 29 | - * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | - * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | - * copyright notice. | ||
| 35 | - * Contributor( s): ______________________________________ | ||
| 36 | - * | ||
| 37 | - */ | ||
| 38 | - | ||
| 39 | -require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | ||
| 40 | -require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); | ||
| 41 | -require_once(KT_LIB_DIR . '/widgets/forms.inc.php'); | ||
| 42 | -require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); | ||
| 43 | -require_once(KT_LIB_DIR . "/documentmanagement/MDTree.inc"); | ||
| 44 | - | ||
| 45 | -class InetBasicFieldsetManagementDispatcher extends KTAdminDispatcher { | ||
| 46 | - var $bAutomaticTransaction = true; | ||
| 47 | - var $bHaveConditional = null; | ||
| 48 | - var $sHelpPage = 'ktcore/admin/document fieldsets.html'; | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * @param. | ||
| 52 | - * @return. | ||
| 53 | - * | ||
| 54 | - * iNET Process | ||
| 55 | - */ | ||
| 56 | - function predispatch() { | ||
| 57 | - $this->persistParams(array('fFieldId')); | ||
| 58 | - $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); | ||
| 59 | - if (PEAR::isError($this->oFieldset)) { | ||
| 60 | - $this->oFieldset = null; | ||
| 61 | - unset($_REQUEST['fFieldsetId']); // prevent further attacks. | ||
| 62 | - } | ||
| 63 | - $this->oField = DocumentField::get(KTUtil::arrayGet($_REQUEST, 'fFieldId')); | ||
| 64 | - if (PEAR::isError($this->oField)) { | ||
| 65 | - $this->oField = null; | ||
| 66 | - unset($_REQUEST['fFieldId']); // prevent further attacks. | ||
| 67 | - } else { | ||
| 68 | - $this->aBreadcrumbs[] = array('url' => KTUtil::addQueryStringSelf($this->meldPersistQuery("","managefield")), 'name' => $this->oField->getName()); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - /** | ||
| 73 | - * API: this provides information about the fieldset, including which actions are available. | ||
| 74 | - * | ||
| 75 | - * @param $oFieldset object. | ||
| 76 | - * @return template. | ||
| 77 | - * | ||
| 78 | - * iNET Process | ||
| 79 | - */ | ||
| 80 | - function describe_fieldset($oFieldset) { | ||
| 81 | - $this->persistParams(array('fFieldsetId','action')); | ||
| 82 | - $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/basic_overview'); | ||
| 83 | - $oTemplate->setData(array( | ||
| 84 | - 'context' => $this, | ||
| 85 | - 'fields' => $oFieldset->getFields(), | ||
| 86 | - )); | ||
| 87 | - return $oTemplate->render(); | ||
| 88 | - } | ||
| 89 | - /** | ||
| 90 | - * Nothing doing | ||
| 91 | - * iNET Process | ||
| 92 | - */ | ||
| 93 | - function do_main () { | ||
| 94 | - return _kt("Something very unexpected happened."); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - /** | ||
| 98 | - * returns array of field type. | ||
| 99 | - * | ||
| 100 | - * @param. | ||
| 101 | - * @return array. | ||
| 102 | - * | ||
| 103 | - * iNET Process | ||
| 104 | - */ | ||
| 105 | - function getFieldTypeVocab() { | ||
| 106 | - $types = array( | ||
| 107 | - 'normal' => _kt("Normal (String)"), | ||
| 108 | - 'lookup' => _kt("Lookup"), | ||
| 109 | - 'tree' => _kt("Tree"), | ||
| 110 | - 'Multiselect' => _kt("Multiselect"), | ||
| 111 | - ); | ||
| 112 | - return $types; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - /** | ||
| 117 | - * multiselect change starts | ||
| 118 | - * @return array | ||
| 119 | - * | ||
| 120 | - * iNET Process | ||
| 121 | - */ | ||
| 122 | - function getLookupFieldTypeVocab() { | ||
| 123 | - $types = array( | ||
| 124 | - | ||
| 125 | - 'multiwithlist' => _kt("Multiselect with a list"), | ||
| 126 | - 'multiwithcheckboxes' => _kt("Multiselect with checkboxes"), | ||
| 127 | - ); | ||
| 128 | - return $types; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - /** | ||
| 132 | - * returns lookup type | ||
| 133 | - * @return string | ||
| 134 | - * | ||
| 135 | - * iNET Process | ||
| 136 | - */ | ||
| 137 | - function getDefaultLookupType() { | ||
| 138 | - return 'multiwithlist'; | ||
| 139 | - | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | - /** | ||
| 143 | - * multiselect change end | ||
| 144 | - * @return | ||
| 145 | - * | ||
| 146 | - * iNET Process | ||
| 147 | - */ | ||
| 148 | - function getDefaultType() { | ||
| 149 | - return 'normal'; | ||
| 150 | - } | ||
| 151 | - /** | ||
| 152 | - * For for displaying new field | ||
| 153 | - * @return | ||
| 154 | - * | ||
| 155 | - * iNET Process | ||
| 156 | - */ | ||
| 157 | - function form_newfield() { | ||
| 158 | - $this->oPage->setBreadcrumbDetails(_kt('add field')); | ||
| 159 | - | ||
| 160 | - $oForm = new KTForm; | ||
| 161 | - $oForm->setOptions(array( | ||
| 162 | - 'identifier' => 'ktcore.fieldsets.basic.field.create', | ||
| 163 | - 'label' => _kt("Add New Field"), | ||
| 164 | - 'submit_label' => _kt('Add Field'), | ||
| 165 | - 'cancel_url' => $this->sParentUrl, | ||
| 166 | - 'fail_action' => 'newfield', | ||
| 167 | - 'action' => 'createfield', | ||
| 168 | - 'context' => $this, | ||
| 169 | - )); | ||
| 170 | - | ||
| 171 | - $type_vocab = $this->getFieldTypeVocab(); | ||
| 172 | - | ||
| 173 | - $oForm->setWidgets(array( | ||
| 174 | - array('ktcore.widgets.string',array( | ||
| 175 | - 'label' => _kt("Field Name"), | ||
| 176 | - 'name' => 'name', | ||
| 177 | - 'required' => true, | ||
| 178 | - 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 179 | - )), | ||
| 180 | - array('ktcore.widgets.text',array( | ||
| 181 | - 'label' => _kt("Description"), | ||
| 182 | - 'name' => 'description', | ||
| 183 | - 'required' => true, | ||
| 184 | - 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 185 | - )), | ||
| 186 | - array('ktcore.widgets.selection', array( | ||
| 187 | - 'label' => _kt('Field Type'), | ||
| 188 | - 'name' => 'field_type', | ||
| 189 | - 'vocab' => $this->getFieldTypeVocab(), | ||
| 190 | - 'description' => _kt("Different types of fields may be available, depending on the system."), | ||
| 191 | - 'required' => true, | ||
| 192 | - 'value' => $this->getDefaultType(), | ||
| 193 | - )), | ||
| 194 | - array('ktcore.widgets.boolean',array( | ||
| 195 | - 'label' => _kt("Required"), | ||
| 196 | - 'name' => 'required', | ||
| 197 | - 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 198 | - )), | ||
| 199 | - | ||
| 200 | - )); | ||
| 201 | - | ||
| 202 | - $oForm->setValidators(array( | ||
| 203 | - array('ktcore.validators.string', array( | ||
| 204 | - 'test' => 'name', | ||
| 205 | - 'output' => 'name', | ||
| 206 | - )), | ||
| 207 | - array('ktcore.validators.string', array( | ||
| 208 | - 'test' => 'description', | ||
| 209 | - 'output' => 'description', | ||
| 210 | - )), | ||
| 211 | - array('ktcore.validators.boolean', array( | ||
| 212 | - 'test' => 'required', | ||
| 213 | - 'output' => 'required', | ||
| 214 | - )), | ||
| 215 | - array('ktcore.validators.string', array( | ||
| 216 | - 'test' => 'field_type', | ||
| 217 | - 'output' => 'field_type', | ||
| 218 | - )), | ||
| 219 | - )); | ||
| 220 | - | ||
| 221 | - return $oForm; | ||
| 222 | - } | ||
| 223 | - /** | ||
| 224 | - * Renders the page for new field | ||
| 225 | - * @return | ||
| 226 | - * | ||
| 227 | - * iNET Process | ||
| 228 | - */ | ||
| 229 | - function do_newfield() { | ||
| 230 | - $oForm = $this->form_newfield(); | ||
| 231 | - | ||
| 232 | - return $oForm->render(); | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | - /** | ||
| 236 | - * Creats a new field->multiselect | ||
| 237 | - * @return | ||
| 238 | - * | ||
| 239 | - * | ||
| 240 | - * iNET Process | ||
| 241 | - */ | ||
| 242 | - function do_createfield() { | ||
| 243 | - $oForm = $this->form_newfield(); | ||
| 244 | - $res = $oForm->validate(); | ||
| 245 | - | ||
| 246 | - $data = $res['results']; | ||
| 247 | - $errors = $res['errors']; | ||
| 248 | - $extra_errors = array(); | ||
| 249 | - | ||
| 250 | - $oField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']); | ||
| 251 | - if (!PEAR::isError($oField)) { | ||
| 252 | - $extra_errors['name'] = _kt("A field with that name already exists in this fieldset."); | ||
| 253 | - } | ||
| 254 | - | ||
| 255 | - if (!empty($errors) || !empty($extra_errors)) { | ||
| 256 | - return $oForm->handleError(null, $extra_errors); | ||
| 257 | - } | ||
| 258 | - | ||
| 259 | - $lookup = false; | ||
| 260 | - $tree = false; | ||
| 261 | - // multiselect change start | ||
| 262 | - $inetlookup = false; | ||
| 263 | - $inetlookupvalue = ''; | ||
| 264 | - // multiselect change end | ||
| 265 | - | ||
| 266 | - if ($data['field_type'] == 'lookup') { | ||
| 267 | - $lookup = true; | ||
| 268 | - } else if ($data['field_type'] == 'tree') { | ||
| 269 | - $lookup = true; | ||
| 270 | - $tree = true; | ||
| 271 | - } | ||
| 272 | - // multiselect change start | ||
| 273 | - else if($data['field_type'] == 'Multiselect') | ||
| 274 | - { | ||
| 275 | - $inetlookup = true; | ||
| 276 | - $inetlookupvalue = $this->getDefaultLookupType(); | ||
| 277 | - } | ||
| 278 | - // multiselect change end | ||
| 279 | - | ||
| 280 | - $oField = DocumentField::createFromArray(array( | ||
| 281 | - 'Name' => $data['name'], | ||
| 282 | - 'Description' => $data['description'], | ||
| 283 | - 'DataType' => 'STRING', | ||
| 284 | - 'IsGeneric' => false, | ||
| 285 | - 'HasLookup' => $lookup, | ||
| 286 | - 'HasLookupTree' => $tree, | ||
| 287 | - 'ParentFieldset' => $this->oFieldset->getId(), | ||
| 288 | - 'IsMandatory' => $data['required'], | ||
| 289 | - // multiselect change start | ||
| 290 | - 'HasInetLookup' => $inetlookup, | ||
| 291 | - 'InetLookupType' => $inetlookupvalue, | ||
| 292 | - // multiselect change end | ||
| 293 | - )); | ||
| 294 | - | ||
| 295 | - if (PEAR::isError($oField)) { | ||
| 296 | - return $oForm->handleError(sprintf(_kt("Unable to create field: %s"), $oField->getMessage())); | ||
| 297 | - } | ||
| 298 | - | ||
| 299 | - $this->successRedirectTo('managefield', _kt("Field created."), sprintf('fFieldId=%d', $oField->getId())); | ||
| 300 | - } | ||
| 301 | - /** | ||
| 302 | - * Form for editing a field | ||
| 303 | - * @return form | ||
| 304 | - * @param $oField Object | ||
| 305 | - * | ||
| 306 | - * iNET Process | ||
| 307 | - */ | ||
| 308 | - function form_editfield($oField) { | ||
| 309 | - $oForm = new KTForm; | ||
| 310 | - $oForm->setOptions(array( | ||
| 311 | - 'identifier' => 'ktcore.fieldsets.basic.field.edit', | ||
| 312 | - 'label' => _kt("Edit Field"), | ||
| 313 | - 'submit_label' => _kt('Update Field'), | ||
| 314 | - 'cancel_url' => $this->sParentUrl, | ||
| 315 | - 'fail_action' => 'managefield', | ||
| 316 | - 'action' => 'updatefield', | ||
| 317 | - 'context' => $this, | ||
| 318 | - )); | ||
| 319 | - | ||
| 320 | - $field_type = $oField->getType(); | ||
| 321 | - if($field_type == "Multiselect") | ||
| 322 | - { | ||
| 323 | - $oForm->setWidgets(array( | ||
| 324 | - array('ktcore.widgets.string',array( | ||
| 325 | - 'label' => _kt("Field Name"), | ||
| 326 | - 'name' => 'name', | ||
| 327 | - 'value' => sanitizeForHTML($oField->getName()), | ||
| 328 | - 'required' => true, | ||
| 329 | - 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 330 | - )), | ||
| 331 | - array('ktcore.widgets.text',array( | ||
| 332 | - 'label' => _kt("Description"), | ||
| 333 | - 'name' => 'description', | ||
| 334 | - 'value' => sanitizeForHTML($oField->getDescription()), | ||
| 335 | - 'required' => true, | ||
| 336 | - 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 337 | - )), | ||
| 338 | - array('ktcore.widgets.boolean',array( | ||
| 339 | - 'label' => _kt("Required"), | ||
| 340 | - 'value' => $oField->getIsMandatory(), | ||
| 341 | - 'name' => 'required', | ||
| 342 | - 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 343 | - )), | ||
| 344 | - array('ktcore.widgets.selection', array( | ||
| 345 | - 'label' => _kt('Type of field'), | ||
| 346 | - 'name' => 'inetlookup_type', | ||
| 347 | - 'vocab' => $this->getLookupFieldTypeVocab(), | ||
| 348 | - 'description' => _kt("Permits to create a multiselect or single select choices."), | ||
| 349 | - 'required' => true, | ||
| 350 | - 'value' => $oField->getInetLookupType(), | ||
| 351 | - 'simple_select' => false, | ||
| 352 | - )), | ||
| 353 | - )); | ||
| 354 | - | ||
| 355 | - $oForm->setValidators(array( | ||
| 356 | - array('ktcore.validators.string', array( | ||
| 357 | - 'test' => 'name', | ||
| 358 | - 'output' => 'name', | ||
| 359 | - )), | ||
| 360 | - array('ktcore.validators.string', array( | ||
| 361 | - 'test' => 'description', | ||
| 362 | - 'output' => 'description', | ||
| 363 | - )), | ||
| 364 | - array('ktcore.validators.boolean', array( | ||
| 365 | - 'test' => 'required', | ||
| 366 | - 'output' => 'required', | ||
| 367 | - )), | ||
| 368 | - array('ktcore.validators.string', array( | ||
| 369 | - 'test' => 'inetlookup_type', | ||
| 370 | - 'output' => 'inetlookup_type', | ||
| 371 | - )), | ||
| 372 | - )); | ||
| 373 | - } | ||
| 374 | - else | ||
| 375 | - { | ||
| 376 | - | ||
| 377 | - $oForm->setWidgets(array( | ||
| 378 | - array('ktcore.widgets.string',array( | ||
| 379 | - 'label' => _kt("Field Name"), | ||
| 380 | - 'name' => 'name', | ||
| 381 | - 'value' => sanitizeForHTML($oField->getName()), | ||
| 382 | - 'required' => true, | ||
| 383 | - 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 384 | - )), | ||
| 385 | - array('ktcore.widgets.text',array( | ||
| 386 | - 'label' => _kt("Description"), | ||
| 387 | - 'name' => 'description', | ||
| 388 | - 'value' => sanitizeForHTML($oField->getDescription()), | ||
| 389 | - 'required' => true, | ||
| 390 | - 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 391 | - )), | ||
| 392 | - array('ktcore.widgets.boolean',array( | ||
| 393 | - 'label' => _kt("Required"), | ||
| 394 | - 'value' => $oField->getIsMandatory(), | ||
| 395 | - 'name' => 'required', | ||
| 396 | - 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 397 | - )), | ||
| 398 | - | ||
| 399 | - )); | ||
| 400 | - | ||
| 401 | - $oForm->setValidators(array( | ||
| 402 | - array('ktcore.validators.string', array( | ||
| 403 | - 'test' => 'name', | ||
| 404 | - 'output' => 'name', | ||
| 405 | - )), | ||
| 406 | - array('ktcore.validators.string', array( | ||
| 407 | - 'test' => 'description', | ||
| 408 | - 'output' => 'description', | ||
| 409 | - )), | ||
| 410 | - array('ktcore.validators.boolean', array( | ||
| 411 | - 'test' => 'required', | ||
| 412 | - 'output' => 'required', | ||
| 413 | - )), | ||
| 414 | - )); | ||
| 415 | - } | ||
| 416 | - return $oForm; | ||
| 417 | - } | ||
| 418 | - /** | ||
| 419 | - * Manages a field | ||
| 420 | - * @return template | ||
| 421 | - * | ||
| 422 | - * | ||
| 423 | - * iNET Process | ||
| 424 | - */ | ||
| 425 | - function do_managefield() { | ||
| 426 | - $oTemplate = $this->oValidator->validateTemplate('manage_field'); | ||
| 427 | - | ||
| 428 | - $oTemplate->setData(array( | ||
| 429 | - 'context' => $this, | ||
| 430 | - 'field_name' => $this->oField->getName(), | ||
| 431 | - 'field_id' => $this->oField->getId(), | ||
| 432 | - 'form' => $this->form_editfield($this->oField), | ||
| 433 | - 'field' => $this->oField, | ||
| 434 | - )); | ||
| 435 | - return $oTemplate->render(); | ||
| 436 | - } | ||
| 437 | - /** | ||
| 438 | - * Updates a field | ||
| 439 | - * @return. | ||
| 440 | - * | ||
| 441 | - * | ||
| 442 | - * iNET Process | ||
| 443 | - */ | ||
| 444 | - function do_updatefield() { | ||
| 445 | - $oForm = $this->form_editfield($this->oField); | ||
| 446 | - $res = $oForm->validate(); | ||
| 447 | - $data = $res['results']; | ||
| 448 | - $errors = $res['errors']; | ||
| 449 | - $extra_errors = array(); | ||
| 450 | - | ||
| 451 | - // check that the field name either hasn't changed, or doesn't exist. | ||
| 452 | - if ($data['name'] != $this->oField->getName()) { | ||
| 453 | - $oOldField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']); | ||
| 454 | - if (!PEAR::isError($oOldField)) { | ||
| 455 | - $extra_errors['name'] = _kt("That name is already in use in this fieldset. Please specify a unique name."); | ||
| 456 | - } | ||
| 457 | - } | ||
| 458 | - | ||
| 459 | - if (!empty($errors) || !empty($extra_errors)) { | ||
| 460 | - return $oForm->handleError(null, $extra_errors); | ||
| 461 | - } | ||
| 462 | - | ||
| 463 | - $this->oField->setName($data['name']); | ||
| 464 | - $this->oField->setDescription($data['description']); | ||
| 465 | - $this->oField->setIsMandatory($data['required']); | ||
| 466 | - | ||
| 467 | - // multiselect change start | ||
| 468 | - if(isset($data['inetlookup_type']) && $this->oField->getHasInetLookup()) | ||
| 469 | - { | ||
| 470 | - $this->oField->setInetLookupType($data['inetlookup_type']); | ||
| 471 | - } | ||
| 472 | - // multiselect change end | ||
| 473 | - | ||
| 474 | - $res = $this->oField->update(); | ||
| 475 | - if (PEAR::isError($res)) { | ||
| 476 | - return $oForm->handleError(sprintf(_kt("Failed to update field: %s"), $res->getMessage())); | ||
| 477 | - } | ||
| 478 | - | ||
| 479 | - $this->successRedirectTo('managefield',_kt("Field updated.")); | ||
| 480 | - } | ||
| 481 | - /** | ||
| 482 | - * Add lookup | ||
| 483 | - * @return form | ||
| 484 | - * | ||
| 485 | - * iNET Process | ||
| 486 | - */ | ||
| 487 | - function form_addlookups() { | ||
| 488 | - $oForm = new KTForm; | ||
| 489 | - $oForm->setOptions(array( | ||
| 490 | - 'identifier' => 'ktcore.fieldsets.basic.field.addlookup', | ||
| 491 | - 'label' => _kt("Add Lookup Values"), | ||
| 492 | - 'submit_label' => _kt('Add Lookups'), | ||
| 493 | - 'cancel_action' => 'managefield', | ||
| 494 | - 'fail_action' => 'addlookupvalues', | ||
| 495 | - 'action' => 'createlookupvalues', | ||
| 496 | - 'context' => $this, | ||
| 497 | - )); | ||
| 498 | - | ||
| 499 | - $oForm->setWidgets(array( | ||
| 500 | - array('ktcore.widgets.text',array( | ||
| 501 | - 'label' => _kt("Lookup Values"), | ||
| 502 | - 'name' => 'lookups', | ||
| 503 | - 'required' => true, | ||
| 504 | - 'description' => _kt("Lookup values are what a user can select from a dropdown. These pre-created lookup values are useful, since they help you keep the metadata in the system organised."), | ||
| 505 | - 'important_description' => _kt("Please enter the lookup values you wish to add, one per line."), | ||
| 506 | - )), | ||
| 507 | - )); | ||
| 508 | - | ||
| 509 | - $oForm->setValidators(array( | ||
| 510 | - array('ktcore.validators.string', array( | ||
| 511 | - 'test' => 'lookups', | ||
| 512 | - 'output' => 'lookups', | ||
| 513 | - 'max_length' => 9999, | ||
| 514 | - )), | ||
| 515 | - )); | ||
| 516 | - | ||
| 517 | - return $oForm; | ||
| 518 | - } | ||
| 519 | - | ||
| 520 | - /** | ||
| 521 | - * Add lookup values | ||
| 522 | - * @return | ||
| 523 | - * | ||
| 524 | - * iNET Process | ||
| 525 | - */ | ||
| 526 | - function do_addlookupvalues() { | ||
| 527 | - $this->oPage->setBreadcrumbDetails(_kt('add lookup values')); | ||
| 528 | - | ||
| 529 | - $oForm = $this->form_addlookups(); | ||
| 530 | - return $oForm->render(); | ||
| 531 | - } | ||
| 532 | - /** | ||
| 533 | - * Create lookup values | ||
| 534 | - * @return | ||
| 535 | - */ | ||
| 536 | - function do_createlookupvalues() { | ||
| 537 | - $oForm = $this->form_addlookups(); | ||
| 538 | - $res = $oForm->validate(); | ||
| 539 | - $data = $res['results']; | ||
| 540 | - $errors = $res['errors']; | ||
| 541 | - $extra_errors = array(); | ||
| 542 | - | ||
| 543 | - | ||
| 544 | - $failed = array(); | ||
| 545 | - $lookups = array(); | ||
| 546 | - | ||
| 547 | - $raw_lookups = $data['lookups']; | ||
| 548 | - $lookup_candidates = explode("\n", $raw_lookups); | ||
| 549 | - foreach ($lookup_candidates as $candidate) { | ||
| 550 | - $name = trim($candidate); | ||
| 551 | - | ||
| 552 | - if (empty($name)) { | ||
| 553 | - continue; | ||
| 554 | - } | ||
| 555 | - | ||
| 556 | - // check for existing or to-be-created lookups. | ||
| 557 | - if ($lookups[$name]) { | ||
| 558 | - $failed[$name] = $name; | ||
| 559 | - continue; | ||
| 560 | - } | ||
| 561 | - | ||
| 562 | - if ($failed[$name]) { | ||
| 563 | - continue; // already blown up, fix it. | ||
| 564 | - } | ||
| 565 | - | ||
| 566 | - $oOldLookup = MetaData::getByValueAndDocumentField($name, $this->oField); | ||
| 567 | - if (!PEAR::isError($oOldLookup)) { | ||
| 568 | - $failed[$name] = $name; | ||
| 569 | - continue; | ||
| 570 | - } | ||
| 571 | - | ||
| 572 | - $lookups[$name] = $name; | ||
| 573 | - } | ||
| 574 | - if (!empty($failed)) { | ||
| 575 | - $extra_errors['lookups'][] = sprintf(_kt("The following lookups you specified already exist, or are specified twice: %s"), implode(', ', $failed)); | ||
| 576 | - } else if (empty($lookups)) { | ||
| 577 | - $extra_errors['lookups'][] = _kt("You must have at least 1 new lookup value."); | ||
| 578 | - } | ||
| 579 | - | ||
| 580 | - if (!empty($errors) || !empty($extra_errors)) { | ||
| 581 | - return $oForm->handleError(null, $extra_errors); | ||
| 582 | - } | ||
| 583 | - | ||
| 584 | - $data['lookups'] = $lookups; | ||
| 585 | - | ||
| 586 | - foreach ($lookups as $value) { | ||
| 587 | - $oLookup = MetaData::createFromArray(array( | ||
| 588 | - 'DocFieldId' => $this->oField->getId(), | ||
| 589 | - 'sName' => $value, | ||
| 590 | - 'iTreeParent' => null, | ||
| 591 | - 'bDisabled' => false, | ||
| 592 | - 'bIsStuck' => false, | ||
| 593 | - )); | ||
| 594 | - if (PEAR::isError($oLookup)) { | ||
| 595 | - return $oForm->handleError(sprintf(_kt("Failed to create lookup: %s"), $oLookup->getMessage())); | ||
| 596 | - } | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - $this->successRedirectTo('managefield', sprintf(_kt("%d lookups added."), count($lookups))); | ||
| 600 | - } | ||
| 601 | - /** | ||
| 602 | - * Manages lookups | ||
| 603 | - * @return template | ||
| 604 | - * | ||
| 605 | - * iNET Process | ||
| 606 | - */ | ||
| 607 | - function do_managelookups() { | ||
| 608 | - $this->oPage->setBreadcrumbDetails(_kt('manage lookup values')); | ||
| 609 | - | ||
| 610 | - // Add javascript to create the edit form | ||
| 611 | - $sJavaScript = "\nfunction editLookup(id)\n | ||
| 612 | - {\n | ||
| 613 | - var div = document.getElementById(id);\n | ||
| 614 | - var value = div.innerHTML; | ||
| 615 | - | ||
| 616 | - <!-- Replace all double quotes with " -->\n | ||
| 617 | - matches = value.match(/\"/g);\n | ||
| 618 | - var newValue = value;\n | ||
| 619 | - if(matches){\n | ||
| 620 | - for(var i = 0; i < matches.length; i++){\n | ||
| 621 | - newValue = newValue.replace('\"', '"');\n | ||
| 622 | - }\n | ||
| 623 | - }\n\n | ||
| 624 | - | ||
| 625 | - var inner = '<input type=\"text\" name=\"lookup['+id+']\" id=\"lookup_'+id+'\" value=\"'+newValue+'\" />';\n | ||
| 626 | - inner += '<input type=\"hidden\" id=\"original_'+id+'\" value=\"'+newValue+'\" />';\n | ||
| 627 | - inner += '<input type=\"submit\" name=\"submit[edit]\" value=\""._kt('Save')."\" />';\n | ||
| 628 | - inner += '<input type=\"button\" onclick=\"javascript: closeLookupEdit('+id+');\" name=\"cancel\" value=\""._kt('Cancel')."\" />';\n | ||
| 629 | - div.innerHTML = inner;\n | ||
| 630 | - document.getElementById('lookup_'+id).focus();\n | ||
| 631 | - }\n\n | ||
| 632 | - | ||
| 633 | - function closeLookupEdit(id) | ||
| 634 | - {\n | ||
| 635 | - value = document.getElementById('original_'+id).value;\n | ||
| 636 | - document.getElementById(id).innerHTML = value;\n | ||
| 637 | - }\n\n"; | ||
| 638 | - | ||
| 639 | - $this->oPage->requireJSStandalone($sJavaScript); | ||
| 640 | - | ||
| 641 | - $lookups =& MetaData::getByDocumentField($this->oField); | ||
| 642 | - $args = $this->meldPersistQuery("","metadataMultiAction", true); | ||
| 643 | - | ||
| 644 | - $oTemplate =& $this->oValidator->validateTemplate("ktcore/metadata/admin/manage_lookups"); | ||
| 645 | - $oTemplate->setData(array( | ||
| 646 | - 'context' => $this, | ||
| 647 | - 'field_name' => $this->oField->getName(), | ||
| 648 | - 'lookups' => $lookups, | ||
| 649 | - 'args' => $args, | ||
| 650 | - )); | ||
| 651 | - return $oTemplate->render(); | ||
| 652 | - } | ||
| 653 | - | ||
| 654 | - // {{{ do_metadataMultiAction | ||
| 655 | - /** | ||
| 656 | - * call metadata multiaction methods | ||
| 657 | - * @param. | ||
| 658 | - * @return. | ||
| 659 | - * | ||
| 660 | - * iNET Process | ||
| 661 | - */ | ||
| 662 | - function do_metadataMultiAction() { | ||
| 663 | - $subaction = array_keys(KTUtil::arrayGet($_REQUEST, 'submit', array())); | ||
| 664 | - $this->oValidator->notEmpty($subaction, array("message" => _kt("No action specified"))); | ||
| 665 | - $subaction = $subaction[0]; | ||
| 666 | - $method = null; | ||
| 667 | - if (method_exists($this, 'lookup_' . $subaction)) { | ||
| 668 | - $method = 'lookup_' . $subaction; | ||
| 669 | - } | ||
| 670 | - $this->oValidator->notEmpty($method, array("message" => _kt("Unknown action specified"))); | ||
| 671 | - return $this->$method(); | ||
| 672 | - } | ||
| 673 | - // }}} | ||
| 674 | - | ||
| 675 | - // {{{ lookup_remove | ||
| 676 | - /** | ||
| 677 | - * remove lookup value. | ||
| 678 | - * @param | ||
| 679 | - * @return | ||
| 680 | - * | ||
| 681 | - * iNET Process | ||
| 682 | - */ | ||
| 683 | - function lookup_remove() { | ||
| 684 | - $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 685 | - $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 686 | - $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 687 | - if (empty($aMetadata)) { | ||
| 688 | - $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 689 | - } | ||
| 690 | - foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 691 | - $oMetaData =& MetaData::get($iMetaDataId); | ||
| 692 | - if (PEAR::isError($oMetaData)) { | ||
| 693 | - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 694 | - } | ||
| 695 | - $oMetaData->delete(); | ||
| 696 | - } | ||
| 697 | - $this->successRedirectTo('managelookups', _kt('Lookups removed')); | ||
| 698 | - exit(0); | ||
| 699 | - } | ||
| 700 | - // }}} | ||
| 701 | - | ||
| 702 | - // {{{ lookup_disable | ||
| 703 | - /** | ||
| 704 | - * disable lookup value. | ||
| 705 | - * @param | ||
| 706 | - * @return | ||
| 707 | - * | ||
| 708 | - * iNET Process | ||
| 709 | - */ | ||
| 710 | - function lookup_disable() { | ||
| 711 | - $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 712 | - $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 713 | - $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 714 | - if (empty($aMetadata)) { | ||
| 715 | - $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 716 | - } | ||
| 717 | - foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 718 | - $oMetaData =& MetaData::get($iMetaDataId); | ||
| 719 | - if (PEAR::isError($oMetaData)) { | ||
| 720 | - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 721 | - } | ||
| 722 | - $oMetaData->setDisabled(true); | ||
| 723 | - $oMetaData->update(); | ||
| 724 | - } | ||
| 725 | - $this->successRedirectTo('managelookups', _kt('Lookups disabled')); | ||
| 726 | - exit(0); | ||
| 727 | - } | ||
| 728 | - // }}} | ||
| 729 | - | ||
| 730 | - /** | ||
| 731 | - * Save the edited lookup values | ||
| 732 | - * | ||
| 733 | - * @param. | ||
| 734 | - * @return. | ||
| 735 | - * | ||
| 736 | - *iNET Process | ||
| 737 | - */ | ||
| 738 | - function lookup_edit(){ | ||
| 739 | - $aLookupValues = $_REQUEST['lookup']; | ||
| 740 | - | ||
| 741 | - if(empty($aLookupValues)){ | ||
| 742 | - $this->errorRedirectTo('managelookups', _kt('No lookups were selected for editing')); | ||
| 743 | - exit; | ||
| 744 | - } | ||
| 745 | - | ||
| 746 | - foreach ($aLookupValues as $iMetaDataId => $sValue){ | ||
| 747 | - $oMetaData = MetaData::get($iMetaDataId); | ||
| 748 | - if (PEAR::isError($oMetaData)) { | ||
| 749 | - $this->addErrorMessage(_kt('Invalid lookup selected').': '.$sValue); | ||
| 750 | - continue; | ||
| 751 | - | ||
| 752 | - } | ||
| 753 | - if(empty($sValue)){ | ||
| 754 | - $this->addErrorMessage(_kt('Lookup cannot be empty').': '.$oMetaData->getName()); | ||
| 755 | - if(count($aLookupValues) == 1){ | ||
| 756 | - $this->redirectTo('managelookups'); | ||
| 757 | - } | ||
| 758 | - continue; | ||
| 759 | - } | ||
| 760 | - $oMetaData->setName($sValue); | ||
| 761 | - $oMetaData->update(); | ||
| 762 | - } | ||
| 763 | - | ||
| 764 | - $this->successRedirectTo('managelookups', _kt('Lookup values saved')); | ||
| 765 | - exit(0); | ||
| 766 | - } | ||
| 767 | - | ||
| 768 | - // {{{ lookup_enable | ||
| 769 | - /** | ||
| 770 | - * enable lookup value | ||
| 771 | - * @param | ||
| 772 | - * @return | ||
| 773 | - * | ||
| 774 | - * iNET Process | ||
| 775 | - */ | ||
| 776 | - function lookup_toggleenabled() { | ||
| 777 | - $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 778 | - $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 779 | - $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 780 | - if (empty($aMetadata)) { | ||
| 781 | - $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 782 | - } | ||
| 783 | - foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 784 | - $oMetaData =& MetaData::get($iMetaDataId); | ||
| 785 | - if (PEAR::isError($oMetadata)) { | ||
| 786 | - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 787 | - } | ||
| 788 | - $oMetaData->setDisabled(!$oMetaData->getDisabled()); | ||
| 789 | - $oMetaData->update(); | ||
| 790 | - } | ||
| 791 | - $this->successRedirectTo('managelookups', _kt('Status Toggled')); | ||
| 792 | - exit(0); | ||
| 793 | - } | ||
| 794 | - // }}} | ||
| 795 | - | ||
| 796 | - // {{{ lookup_togglestickiness | ||
| 797 | - /** | ||
| 798 | - * toggle stickiness of lookup values | ||
| 799 | - * @param | ||
| 800 | - * @return | ||
| 801 | - * | ||
| 802 | - * iNET Process | ||
| 803 | - */ | ||
| 804 | - function lookup_togglestickiness() { | ||
| 805 | - $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 806 | - $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 807 | - $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 808 | - if (empty($aMetadata)) { | ||
| 809 | - $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 810 | - } | ||
| 811 | - foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 812 | - $oMetaData =& MetaData::get($iMetaDataId); | ||
| 813 | - if (PEAR::isError($oMetaData)) { | ||
| 814 | - $this->errorRedirectTo('managelookups', _kt('Invalid lookups selected')); | ||
| 815 | - } | ||
| 816 | - $bStuck = (boolean)$oMetaData->getIsStuck(); | ||
| 817 | - $oMetaData->setIsStuck(!$bStuck); | ||
| 818 | - $oMetaData->update(); | ||
| 819 | - } | ||
| 820 | - $this->successRedirectTo('managelookups', _kt('Lookup stickiness toggled')); | ||
| 821 | - exit(0); | ||
| 822 | - } | ||
| 823 | - // }}} | ||
| 824 | - | ||
| 825 | -// {{{ TREE | ||
| 826 | - // create and display the tree editing form. | ||
| 827 | - /** | ||
| 828 | - * create and display the tree editing form. | ||
| 829 | - * @param. | ||
| 830 | - * @return template | ||
| 831 | - * | ||
| 832 | - * iNET Process | ||
| 833 | - */ | ||
| 834 | - function do_managetree() { | ||
| 835 | - global $default; | ||
| 836 | - // extract. | ||
| 837 | - $iFieldsetId = KTUtil::getId($this->oFieldset); | ||
| 838 | - $iFieldId = KTUtil::getId($this->oField); | ||
| 839 | - | ||
| 840 | - $oFieldset =& $this->oFieldset; | ||
| 841 | - $oField =& $this->oField; | ||
| 842 | - | ||
| 843 | - $this->oPage->setBreadcrumbDetails(_kt('edit lookup tree')); | ||
| 844 | - | ||
| 845 | - $field_id = $iFieldId; | ||
| 846 | - $current_node = KTUtil::arrayGet($_REQUEST, 'current_node', 0); | ||
| 847 | - $subaction = KTUtil::arrayGet($_REQUEST, 'subaction'); | ||
| 848 | - | ||
| 849 | - // validate | ||
| 850 | - if (empty($field_id)) { return $this->errorRedirectToMain(_kt("Must select a field to edit.")); } | ||
| 851 | - $oField =& DocumentField::get($field_id); | ||
| 852 | - if (PEAR::isError($oField)) { return $this->errorRedirectToMain(_kt("Invalid field.")); } | ||
| 853 | - | ||
| 854 | - $aErrorOptions = array( | ||
| 855 | - 'redirect_to' => array('editTree', sprintf('field_id=%d', $field_id)), | ||
| 856 | - ); | ||
| 857 | - | ||
| 858 | - // under here we do the subaction rendering. | ||
| 859 | - // we do this so we don't have to do _very_ strange things with multiple actions. | ||
| 860 | - | ||
| 861 | - $fieldTree =& new MDTree(); | ||
| 862 | - $fieldTree->buildForField($oField->getId()); | ||
| 863 | - | ||
| 864 | - if ($subaction !== null) { | ||
| 865 | - $target = 'managetree'; | ||
| 866 | - $msg = _kt('Changes saved.'); | ||
| 867 | - if ($subaction === "addCategory") { | ||
| 868 | - $new_category = KTUtil::arrayGet($_REQUEST, 'category_name'); | ||
| 869 | - if (empty($new_category)) { | ||
| 870 | - return $this->errorRedirectTo("managetree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId)); | ||
| 871 | - } else { | ||
| 872 | - $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree); | ||
| 873 | - } | ||
| 874 | - $msg = _kt('Category added'). ': ' . $new_category; | ||
| 875 | - } | ||
| 876 | - if ($subaction === "deleteCategory") { | ||
| 877 | - $this->subact_deleteCategory($fieldTree, $current_node); | ||
| 878 | - $current_node = 0; // clear out, and don't try and render the newly deleted category. | ||
| 879 | - $msg = _kt('Category removed.'); | ||
| 880 | - } | ||
| 881 | - if ($subaction === "linkKeywords") { | ||
| 882 | - $keywords = KTUtil::arrayGet($_REQUEST, 'keywordsToAdd'); | ||
| 883 | - $aErrorOptions['message'] = _kt("No keywords selected"); | ||
| 884 | - $this->oValidator->notEmpty($keywords, $aErrorOptions); | ||
| 885 | - $this->subact_linkKeywords($fieldTree, $current_node, $keywords); | ||
| 886 | - $current_node = 0; // clear out, and don't try and render the newly deleted category. | ||
| 887 | - $msg = _kt('Keywords added to category.'); | ||
| 888 | - } | ||
| 889 | - if ($subaction === "unlinkKeyword") { | ||
| 890 | - $keyword = KTUtil::arrayGet($_REQUEST, 'keyword_id'); | ||
| 891 | - $this->subact_unlinkKeyword($fieldTree, $keyword); | ||
| 892 | - $msg = _kt('Keyword moved to base of tree.'); | ||
| 893 | - } | ||
| 894 | - // now redirect | ||
| 895 | - $query = sprintf('field_id=%d&fFieldsetId=%d', $field_id, $iFieldsetId); | ||
| 896 | - return $this->successRedirectTo($target, $msg, $query); | ||
| 897 | - } | ||
| 898 | - if ($fieldTree->root === null) { | ||
| 899 | - return $this->errorRedirectToMain(_kt("Error building tree. Is this a valid tree-lookup field?")); | ||
| 900 | - } | ||
| 901 | - | ||
| 902 | - // FIXME extract this from MDTree (helper method?) | ||
| 903 | - $free_metadata = MetaData::getList('document_field_id = '.$oField->getId().' AND (treeorg_parent = 0 OR treeorg_parent IS NULL) AND (disabled = 0)'); | ||
| 904 | - | ||
| 905 | - // render edit template. | ||
| 906 | - | ||
| 907 | - $oTemplate = $this->oValidator->validateTemplate("ktcore/metadata/admin/edit_lookuptree"); | ||
| 908 | - $renderedTree = $this->_evilTreeRenderer($fieldTree); | ||
| 909 | - | ||
| 910 | - $this->oPage->setTitle(_kt('Edit Lookup Tree')); | ||
| 911 | - | ||
| 912 | - if ($current_node == 0) { $category_name = 'Root'; } | ||
| 913 | - else { | ||
| 914 | - $oNode = MDTreeNode::get($current_node); | ||
| 915 | - $category_name = $oNode->getName(); | ||
| 916 | - } | ||
| 917 | - | ||
| 918 | - $aTemplateData = array( | ||
| 919 | - "context" => $this, | ||
| 920 | - "args" => $this->meldPersistQuery("","managetree", true), | ||
| 921 | - "field" => $oField, | ||
| 922 | - "oFieldset" => $oFieldset, | ||
| 923 | - "tree" => $fieldTree, | ||
| 924 | - "renderedTree" => $renderedTree, | ||
| 925 | - "currentNode" => $current_node, | ||
| 926 | - 'category_name' => $category_name, | ||
| 927 | - "freechildren" => $free_metadata, | ||
| 928 | - | ||
| 929 | - ); | ||
| 930 | - return $oTemplate->render($aTemplateData); | ||
| 931 | - } | ||
| 932 | - /** | ||
| 933 | - * Adds a category | ||
| 934 | - * @return | ||
| 935 | - * @param $field_id Object | ||
| 936 | - * @param $current_node Object | ||
| 937 | - * @param $new_category Object | ||
| 938 | - * @param $constructedTree Object | ||
| 939 | - * | ||
| 940 | - * iNET Process | ||
| 941 | - */ | ||
| 942 | - function subact_addCategory($field_id, $current_node, $new_category, &$constructedTree) { | ||
| 943 | - $newCategory = MDTreeNode::createFromArray(array ( | ||
| 944 | - "iFieldId" => $field_id, | ||
| 945 | - "sName" => $new_category, | ||
| 946 | - "iParentNode" => $current_node, | ||
| 947 | - )); | ||
| 948 | - if (PEAR::isError($newCategory)) | ||
| 949 | - { | ||
| 950 | - return false; | ||
| 951 | - } | ||
| 952 | - $constructedTree->addNode($newCategory); | ||
| 953 | - return true; | ||
| 954 | - } | ||
| 955 | - /** | ||
| 956 | - * Deletes a catagory | ||
| 957 | - * @return | ||
| 958 | - * @param $constructedTree Object | ||
| 959 | - * @param $current_node Object | ||
| 960 | - */ | ||
| 961 | - function subact_deleteCategory(&$constructedTree, $current_node) { | ||
| 962 | - $constructedTree->deleteNode($current_node); | ||
| 963 | - return true; | ||
| 964 | - } | ||
| 965 | - | ||
| 966 | - /** | ||
| 967 | - * | ||
| 968 | - * @param $constructedTree object | ||
| 969 | - * @param $keywords | ||
| 970 | - * @return true. | ||
| 971 | - * | ||
| 972 | - * iNET Process | ||
| 973 | - */ | ||
| 974 | - function subact_unlinkKeyword(&$constructedTree, $keyword) { | ||
| 975 | - $oKW = MetaData::get($keyword); | ||
| 976 | - if (PEAR::isError($oKW)) { | ||
| 977 | - return true; | ||
| 978 | - } | ||
| 979 | - $constructedTree->reparentKeyword($oKW->getId(), 0); | ||
| 980 | - return true; | ||
| 981 | - } | ||
| 982 | - | ||
| 983 | - /** | ||
| 984 | - * | ||
| 985 | - * @param $constructedTree object | ||
| 986 | - * @param $current_node node id | ||
| 987 | - * @param $keywords array | ||
| 988 | - * @return true. | ||
| 989 | - * | ||
| 990 | - * iNET Process | ||
| 991 | - */ | ||
| 992 | - function subact_linkKeywords(&$constructedTree, $current_node, $keywords) { | ||
| 993 | - foreach ($keywords as $md_id) | ||
| 994 | - { | ||
| 995 | - $constructedTree->reparentKeyword($md_id, $current_node); | ||
| 996 | - } | ||
| 997 | - return true; | ||
| 998 | - } | ||
| 999 | - | ||
| 1000 | - /* ----------------------- EVIL HACK -------------------------- | ||
| 1001 | - * | ||
| 1002 | - * This whole thing needs to replaced, as soon as I work out how | ||
| 1003 | - * to non-sucking Smarty recursion. | ||
| 1004 | - */ | ||
| 1005 | - | ||
| 1006 | - /** | ||
| 1007 | - * render to subnode of tree | ||
| 1008 | - * | ||
| 1009 | - * @param $subnode node | ||
| 1010 | - * @param $treeToRender object | ||
| 1011 | - * @Return string | ||
| 1012 | - * | ||
| 1013 | - * iNET Process | ||
| 1014 | - */ | ||
| 1015 | - function _evilTreeRecursion($subnode, $treeToRender) | ||
| 1016 | - { | ||
| 1017 | - // deliver us from evil.... | ||
| 1018 | - $iFieldId = $treeToRender->field_id; | ||
| 1019 | - $oField = DocumentField::get($iFieldId); | ||
| 1020 | - $iFieldsetId = $oField->getParentFieldsetId(); | ||
| 1021 | - | ||
| 1022 | - $treeStr = "<ul>"; | ||
| 1023 | - foreach ($treeToRender->contents[$subnode] as $subnode_id => $subnode_val) | ||
| 1024 | - { | ||
| 1025 | - if ($subnode_id !== "leaves") { | ||
| 1026 | - $treeStr .= '<li class="treenode active"><a class="pathnode inactive" onclick="toggleElementClass(\'active\', this.parentNode); toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subnode_val]->getName() . '</a>'; | ||
| 1027 | - $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subnode_val); | ||
| 1028 | - $treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender); | ||
| 1029 | - $treeStr .= '</li>'; | ||
| 1030 | - } | ||
| 1031 | - else | ||
| 1032 | - { | ||
| 1033 | - foreach ($subnode_val as $leaf) | ||
| 1034 | - { | ||
| 1035 | - $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName(); | ||
| 1036 | - $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf); | ||
| 1037 | - $treeStr .= '</li>'; } | ||
| 1038 | - } | ||
| 1039 | - } | ||
| 1040 | - $treeStr .= '</ul>'; | ||
| 1041 | - return $treeStr; | ||
| 1042 | - | ||
| 1043 | - } | ||
| 1044 | - | ||
| 1045 | - // I can't seem to do recursion in smarty, and recursive templates seems a bad solution. | ||
| 1046 | - // Come up with a better way to do this (? NBM) | ||
| 1047 | - | ||
| 1048 | - /** | ||
| 1049 | - * render tree | ||
| 1050 | - * | ||
| 1051 | - * @param $treeToRender object | ||
| 1052 | - * @return tree string | ||
| 1053 | - * | ||
| 1054 | - * iNET Process | ||
| 1055 | - */ | ||
| 1056 | - function _evilTreeRenderer($treeToRender) { | ||
| 1057 | - //global $default; | ||
| 1058 | - | ||
| 1059 | - $treeStr = "<!-- this is rendered with an unholy hack. sorry. -->"; | ||
| 1060 | - $stack = array(); | ||
| 1061 | - $exitstack = array(); | ||
| 1062 | - | ||
| 1063 | - // since the root is virtual, we need to fake it here. | ||
| 1064 | - // the inner section is generised. | ||
| 1065 | - $treeStr .= '<ul class="kt_treenodes"><li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . _kt('Root') . '</a>'; | ||
| 1066 | - $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=0', 'managetree')) . '">' . _kt('attach keywords') . '</a>)'; | ||
| 1067 | - $treeStr .= '<ul>'; | ||
| 1068 | - | ||
| 1069 | - | ||
| 1070 | - foreach ($treeToRender->getRoot() as $node_id => $subtree_nodes) | ||
| 1071 | - { | ||
| 1072 | - | ||
| 1073 | - // leaves are handled differently. | ||
| 1074 | - if ($node_id !== "leaves") { | ||
| 1075 | - | ||
| 1076 | - $treeStr .= '<li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subtree_nodes]->getName() . '</a>'; | ||
| 1077 | - $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subtree_nodes); | ||
| 1078 | - $treeStr .= $this->_evilTreeRecursion($subtree_nodes, $treeToRender); | ||
| 1079 | - $treeStr .= '</li>'; | ||
| 1080 | - } | ||
| 1081 | - else | ||
| 1082 | - { | ||
| 1083 | - foreach ($subtree_nodes as $leaf) | ||
| 1084 | - { | ||
| 1085 | - $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName(); | ||
| 1086 | - $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf); | ||
| 1087 | - $treeStr .= '</li>'; | ||
| 1088 | - } | ||
| 1089 | - } | ||
| 1090 | - } | ||
| 1091 | - $treeStr .= '</ul></li>'; | ||
| 1092 | - $treeStr .= '</ul>'; | ||
| 1093 | - | ||
| 1094 | - return $treeStr; | ||
| 1095 | - } | ||
| 1096 | - | ||
| 1097 | - // BS: don't hate me. | ||
| 1098 | - // BD: sorry. I hate you. | ||
| 1099 | - /** | ||
| 1100 | - * KT function | ||
| 1101 | - * | ||
| 1102 | - * @param $iFieldsetId ID | ||
| 1103 | - * @param $iFieldId ID | ||
| 1104 | - * @param $bIsKeyword boolean | ||
| 1105 | - * @param $current_node node ID | ||
| 1106 | - * @return string. | ||
| 1107 | - * | ||
| 1108 | - * iNET Process | ||
| 1109 | - */ | ||
| 1110 | - function _evilActionHelper($iFieldsetId, $iFieldId, $bIsKeyword, $current_node) { | ||
| 1111 | - $actionStr = " ("; | ||
| 1112 | - if ($bIsKeyword === true) { | ||
| 1113 | - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf(KTUtil::addQueryStringSelf($this->meldPersistQuery('keyword_id='.$current_node.'&subaction=unlinkKeyword', 'managetree'))) . '">' . _kt('unlink') . '</a>'; | ||
| 1114 | - } else { | ||
| 1115 | - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=' . $current_node, 'managetree')) .'">' . _kt('attach keywords') . '</a> '; | ||
| 1116 | - $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node='.$current_node.'&subaction=deleteCategory', 'managetree')) . '">' . _kt('delete') . '</a>'; | ||
| 1117 | - } | ||
| 1118 | - $actionStr .= ")"; | ||
| 1119 | - return $actionStr; | ||
| 1120 | - } | ||
| 1121 | - /** | ||
| 1122 | - * Deletes a field | ||
| 1123 | - * @return | ||
| 1124 | - * | ||
| 1125 | - * iNET Process | ||
| 1126 | - */ | ||
| 1127 | - function do_deletefield() { | ||
| 1128 | - $res = $this->oField->delete(); | ||
| 1129 | - if (PEAR::isError($res)) { | ||
| 1130 | - $this->errorRedirectToParent(sprintf(_kt("Unable to delete field: %s"), $res->getMessage())); | ||
| 1131 | - } | ||
| 1132 | - | ||
| 1133 | - $this->successRedirectToParent(_kt("Field deleted.")); | ||
| 1134 | - } | ||
| 1135 | - | ||
| 1136 | - /** | ||
| 1137 | - * Move field up in the order | ||
| 1138 | - * | ||
| 1139 | - * iNET Process | ||
| 1140 | - */ | ||
| 1141 | - function do_orderUp() { | ||
| 1142 | - $iId = $this->oField->getID(); | ||
| 1143 | - $iFieldsetId = $this->oField->getParentFieldsetId(); | ||
| 1144 | - | ||
| 1145 | - $res = $this->oField->movePosition($iFieldsetId, $iId, 'up'); | ||
| 1146 | - if ($res === false) { | ||
| 1147 | - $this->errorRedirectToParent(_kt("Unable to move field up")); | ||
| 1148 | - } | ||
| 1149 | - | ||
| 1150 | - $this->successRedirectToParent(_kt("Field moved up.")); | ||
| 1151 | - } | ||
| 1152 | - | ||
| 1153 | - /** | ||
| 1154 | - * Move field down in the order | ||
| 1155 | - * | ||
| 1156 | - * iNET Process | ||
| 1157 | - */ | ||
| 1158 | - function do_orderDown() { | ||
| 1159 | - $iId = $this->oField->getID(); | ||
| 1160 | - $iFieldsetId = $this->oField->getParentFieldsetId(); | ||
| 1161 | - | ||
| 1162 | - $res = $this->oField->movePosition($iFieldsetId, $iId, 'down'); | ||
| 1163 | - if ($res === false) { | ||
| 1164 | - $this->errorRedirectToParent(_kt("Unable to move field down")); | ||
| 1165 | - } | ||
| 1166 | - | ||
| 1167 | - $this->successRedirectToParent(_kt("Field moved down.")); | ||
| 1168 | - } | ||
| 1169 | -} | ||
| 1170 | - | ||
| 1171 | -?> | 1 | +<?php |
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * KnowledgeTree Community Edition | ||
| 6 | + * Document Management Made Simple | ||
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | + * Portions copyright The Jam Warehouse Software (Pty) Limited | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify it under | ||
| 11 | + * the terms of the GNU General Public License version 3 as published by the | ||
| 12 | + * Free Software Foundation. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | + * details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | + * | ||
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | + * | ||
| 25 | + * The interactive user interfaces in modified source and object code versions | ||
| 26 | + * of this program must display Appropriate Legal Notices, as required under | ||
| 27 | + * Section 5 of the GNU General Public License version 3. | ||
| 28 | + * | ||
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | + * copyright notice. | ||
| 35 | + * Contributor( s): ______________________________________ | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + | ||
| 39 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | ||
| 40 | +require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); | ||
| 41 | +require_once(KT_LIB_DIR . '/widgets/forms.inc.php'); | ||
| 42 | +require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); | ||
| 43 | +require_once(KT_LIB_DIR . "/documentmanagement/MDTree.inc"); | ||
| 44 | + | ||
| 45 | +class InetBasicFieldsetManagementDispatcher extends KTAdminDispatcher { | ||
| 46 | + var $bAutomaticTransaction = true; | ||
| 47 | + var $bHaveConditional = null; | ||
| 48 | + var $sHelpPage = 'ktcore/admin/document fieldsets.html'; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * @param. | ||
| 52 | + * @return. | ||
| 53 | + * | ||
| 54 | + * iNET Process | ||
| 55 | + */ | ||
| 56 | + function predispatch() { | ||
| 57 | + $this->persistParams(array('fFieldId')); | ||
| 58 | + $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); | ||
| 59 | + if (PEAR::isError($this->oFieldset)) { | ||
| 60 | + $this->oFieldset = null; | ||
| 61 | + unset($_REQUEST['fFieldsetId']); // prevent further attacks. | ||
| 62 | + } | ||
| 63 | + $this->oField = DocumentField::get(KTUtil::arrayGet($_REQUEST, 'fFieldId')); | ||
| 64 | + if (PEAR::isError($this->oField)) { | ||
| 65 | + $this->oField = null; | ||
| 66 | + unset($_REQUEST['fFieldId']); // prevent further attacks. | ||
| 67 | + } else { | ||
| 68 | + $this->aBreadcrumbs[] = array('url' => KTUtil::addQueryStringSelf($this->meldPersistQuery("","managefield")), 'name' => $this->oField->getName()); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * API: this provides information about the fieldset, including which actions are available. | ||
| 74 | + * | ||
| 75 | + * @param $oFieldset object. | ||
| 76 | + * @return template. | ||
| 77 | + * | ||
| 78 | + * iNET Process | ||
| 79 | + */ | ||
| 80 | + function describe_fieldset($oFieldset) { | ||
| 81 | + $this->persistParams(array('fFieldsetId','action')); | ||
| 82 | + $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/basic_overview'); | ||
| 83 | + $oTemplate->setData(array( | ||
| 84 | + 'context' => $this, | ||
| 85 | + 'fields' => $oFieldset->getFields(), | ||
| 86 | + )); | ||
| 87 | + return $oTemplate->render(); | ||
| 88 | + } | ||
| 89 | + /** | ||
| 90 | + * Nothing doing | ||
| 91 | + * iNET Process | ||
| 92 | + */ | ||
| 93 | + function do_main () { | ||
| 94 | + return _kt("Something very unexpected happened."); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * returns array of field type. | ||
| 99 | + * | ||
| 100 | + * @param. | ||
| 101 | + * @return array. | ||
| 102 | + * | ||
| 103 | + * iNET Process | ||
| 104 | + */ | ||
| 105 | + function getFieldTypeVocab() { | ||
| 106 | + $types = array( | ||
| 107 | + 'normal' => _kt("Normal (String)"), | ||
| 108 | + 'lookup' => _kt("Lookup"), | ||
| 109 | + 'tree' => _kt("Tree"), | ||
| 110 | + 'Multiselect' => _kt("Multiselect"), | ||
| 111 | + ); | ||
| 112 | + return $types; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * multiselect change starts | ||
| 118 | + * @return array | ||
| 119 | + * | ||
| 120 | + * iNET Process | ||
| 121 | + */ | ||
| 122 | + function getLookupFieldTypeVocab() { | ||
| 123 | + $types = array( | ||
| 124 | + | ||
| 125 | + 'multiwithlist' => _kt("Multiselect with a list"), | ||
| 126 | + 'multiwithcheckboxes' => _kt("Multiselect with checkboxes"), | ||
| 127 | + ); | ||
| 128 | + return $types; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * returns lookup type | ||
| 133 | + * @return string | ||
| 134 | + * | ||
| 135 | + * iNET Process | ||
| 136 | + */ | ||
| 137 | + function getDefaultLookupType() { | ||
| 138 | + return 'multiwithlist'; | ||
| 139 | + | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * multiselect change end | ||
| 144 | + * @return | ||
| 145 | + * | ||
| 146 | + * iNET Process | ||
| 147 | + */ | ||
| 148 | + function getDefaultType() { | ||
| 149 | + return 'normal'; | ||
| 150 | + } | ||
| 151 | + /** | ||
| 152 | + * For for displaying new field | ||
| 153 | + * @return | ||
| 154 | + * | ||
| 155 | + * iNET Process | ||
| 156 | + */ | ||
| 157 | + function form_newfield() { | ||
| 158 | + $this->oPage->setBreadcrumbDetails(_kt('add field')); | ||
| 159 | + | ||
| 160 | + $oForm = new KTForm; | ||
| 161 | + $oForm->setOptions(array( | ||
| 162 | + 'identifier' => 'ktcore.fieldsets.basic.field.create', | ||
| 163 | + 'label' => _kt("Add New Field"), | ||
| 164 | + 'submit_label' => _kt('Add Field'), | ||
| 165 | + 'cancel_url' => $this->sParentUrl, | ||
| 166 | + 'fail_action' => 'newfield', | ||
| 167 | + 'action' => 'createfield', | ||
| 168 | + 'context' => $this, | ||
| 169 | + )); | ||
| 170 | + | ||
| 171 | + $type_vocab = $this->getFieldTypeVocab(); | ||
| 172 | + | ||
| 173 | + $oForm->setWidgets(array( | ||
| 174 | + array('ktcore.widgets.string',array( | ||
| 175 | + 'label' => _kt("Field Name"), | ||
| 176 | + 'name' => 'name', | ||
| 177 | + 'required' => true, | ||
| 178 | + 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 179 | + )), | ||
| 180 | + array('ktcore.widgets.text',array( | ||
| 181 | + 'label' => _kt("Description"), | ||
| 182 | + 'name' => 'description', | ||
| 183 | + 'required' => true, | ||
| 184 | + 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 185 | + )), | ||
| 186 | + array('ktcore.widgets.selection', array( | ||
| 187 | + 'label' => _kt('Field Type'), | ||
| 188 | + 'name' => 'field_type', | ||
| 189 | + 'vocab' => $this->getFieldTypeVocab(), | ||
| 190 | + 'description' => _kt("Different types of fields may be available, depending on the system."), | ||
| 191 | + 'required' => true, | ||
| 192 | + 'value' => $this->getDefaultType(), | ||
| 193 | + )), | ||
| 194 | + array('ktcore.widgets.boolean',array( | ||
| 195 | + 'label' => _kt("Required"), | ||
| 196 | + 'name' => 'required', | ||
| 197 | + 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 198 | + )), | ||
| 199 | + | ||
| 200 | + )); | ||
| 201 | + | ||
| 202 | + $oForm->setValidators(array( | ||
| 203 | + array('ktcore.validators.string', array( | ||
| 204 | + 'test' => 'name', | ||
| 205 | + 'output' => 'name', | ||
| 206 | + )), | ||
| 207 | + array('ktcore.validators.string', array( | ||
| 208 | + 'test' => 'description', | ||
| 209 | + 'output' => 'description', | ||
| 210 | + )), | ||
| 211 | + array('ktcore.validators.boolean', array( | ||
| 212 | + 'test' => 'required', | ||
| 213 | + 'output' => 'required', | ||
| 214 | + )), | ||
| 215 | + array('ktcore.validators.string', array( | ||
| 216 | + 'test' => 'field_type', | ||
| 217 | + 'output' => 'field_type', | ||
| 218 | + )), | ||
| 219 | + )); | ||
| 220 | + | ||
| 221 | + return $oForm; | ||
| 222 | + } | ||
| 223 | + /** | ||
| 224 | + * Renders the page for new field | ||
| 225 | + * @return | ||
| 226 | + * | ||
| 227 | + * iNET Process | ||
| 228 | + */ | ||
| 229 | + function do_newfield() { | ||
| 230 | + $oForm = $this->form_newfield(); | ||
| 231 | + | ||
| 232 | + return $oForm->render(); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * Creats a new field->multiselect | ||
| 237 | + * @return | ||
| 238 | + * | ||
| 239 | + * | ||
| 240 | + * iNET Process | ||
| 241 | + */ | ||
| 242 | + function do_createfield() { | ||
| 243 | + $oForm = $this->form_newfield(); | ||
| 244 | + $res = $oForm->validate(); | ||
| 245 | + | ||
| 246 | + $data = $res['results']; | ||
| 247 | + $errors = $res['errors']; | ||
| 248 | + $extra_errors = array(); | ||
| 249 | + | ||
| 250 | + $oField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']); | ||
| 251 | + if (!PEAR::isError($oField)) { | ||
| 252 | + $extra_errors['name'] = _kt("A field with that name already exists in this fieldset."); | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + if (!empty($errors) || !empty($extra_errors)) { | ||
| 256 | + return $oForm->handleError(null, $extra_errors); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + $lookup = false; | ||
| 260 | + $tree = false; | ||
| 261 | + // multiselect change start | ||
| 262 | + $inetlookup = false; | ||
| 263 | + $inetlookupvalue = ''; | ||
| 264 | + // multiselect change end | ||
| 265 | + | ||
| 266 | + if ($data['field_type'] == 'lookup') { | ||
| 267 | + $lookup = true; | ||
| 268 | + } else if ($data['field_type'] == 'tree') { | ||
| 269 | + $lookup = true; | ||
| 270 | + $tree = true; | ||
| 271 | + } | ||
| 272 | + // multiselect change start | ||
| 273 | + else if($data['field_type'] == 'Multiselect') | ||
| 274 | + { | ||
| 275 | + $inetlookup = true; | ||
| 276 | + $inetlookupvalue = $this->getDefaultLookupType(); | ||
| 277 | + } | ||
| 278 | + // multiselect change end | ||
| 279 | + | ||
| 280 | + $oField = DocumentField::createFromArray(array( | ||
| 281 | + 'Name' => $data['name'], | ||
| 282 | + 'Description' => $data['description'], | ||
| 283 | + 'DataType' => 'STRING', | ||
| 284 | + 'IsGeneric' => false, | ||
| 285 | + 'HasLookup' => $lookup, | ||
| 286 | + 'HasLookupTree' => $tree, | ||
| 287 | + 'ParentFieldset' => $this->oFieldset->getId(), | ||
| 288 | + 'IsMandatory' => $data['required'], | ||
| 289 | + // multiselect change start | ||
| 290 | + 'HasInetLookup' => $inetlookup, | ||
| 291 | + 'InetLookupType' => $inetlookupvalue, | ||
| 292 | + // multiselect change end | ||
| 293 | + )); | ||
| 294 | + | ||
| 295 | + if (PEAR::isError($oField)) { | ||
| 296 | + return $oForm->handleError(sprintf(_kt("Unable to create field: %s"), $oField->getMessage())); | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + $this->successRedirectTo('managefield', _kt("Field created."), sprintf('fFieldId=%d', $oField->getId())); | ||
| 300 | + } | ||
| 301 | + /** | ||
| 302 | + * Form for editing a field | ||
| 303 | + * @return form | ||
| 304 | + * @param $oField Object | ||
| 305 | + * | ||
| 306 | + * iNET Process | ||
| 307 | + */ | ||
| 308 | + function form_editfield($oField) { | ||
| 309 | + $oForm = new KTForm; | ||
| 310 | + $oForm->setOptions(array( | ||
| 311 | + 'identifier' => 'ktcore.fieldsets.basic.field.edit', | ||
| 312 | + 'label' => _kt("Edit Field"), | ||
| 313 | + 'submit_label' => _kt('Update Field'), | ||
| 314 | + 'cancel_url' => $this->sParentUrl, | ||
| 315 | + 'fail_action' => 'managefield', | ||
| 316 | + 'action' => 'updatefield', | ||
| 317 | + 'context' => $this, | ||
| 318 | + )); | ||
| 319 | + | ||
| 320 | + $field_type = $oField->getType(); | ||
| 321 | + if($field_type == "Multiselect") | ||
| 322 | + { | ||
| 323 | + $oForm->setWidgets(array( | ||
| 324 | + array('ktcore.widgets.string',array( | ||
| 325 | + 'label' => _kt("Field Name"), | ||
| 326 | + 'name' => 'name', | ||
| 327 | + 'value' => sanitizeForHTML($oField->getName()), | ||
| 328 | + 'required' => true, | ||
| 329 | + 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 330 | + )), | ||
| 331 | + array('ktcore.widgets.text',array( | ||
| 332 | + 'label' => _kt("Description"), | ||
| 333 | + 'name' => 'description', | ||
| 334 | + 'value' => sanitizeForHTML($oField->getDescription()), | ||
| 335 | + 'required' => true, | ||
| 336 | + 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 337 | + )), | ||
| 338 | + array('ktcore.widgets.boolean',array( | ||
| 339 | + 'label' => _kt("Required"), | ||
| 340 | + 'value' => $oField->getIsMandatory(), | ||
| 341 | + 'name' => 'required', | ||
| 342 | + 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 343 | + )), | ||
| 344 | + array('ktcore.widgets.selection', array( | ||
| 345 | + 'label' => _kt('Type of field'), | ||
| 346 | + 'name' => 'inetlookup_type', | ||
| 347 | + 'vocab' => $this->getLookupFieldTypeVocab(), | ||
| 348 | + 'description' => _kt("Permits to create a multiselect or single select choices."), | ||
| 349 | + 'required' => true, | ||
| 350 | + 'value' => $oField->getInetLookupType(), | ||
| 351 | + 'simple_select' => false, | ||
| 352 | + )), | ||
| 353 | + )); | ||
| 354 | + | ||
| 355 | + $oForm->setValidators(array( | ||
| 356 | + array('ktcore.validators.string', array( | ||
| 357 | + 'test' => 'name', | ||
| 358 | + 'output' => 'name', | ||
| 359 | + )), | ||
| 360 | + array('ktcore.validators.string', array( | ||
| 361 | + 'test' => 'description', | ||
| 362 | + 'output' => 'description', | ||
| 363 | + )), | ||
| 364 | + array('ktcore.validators.boolean', array( | ||
| 365 | + 'test' => 'required', | ||
| 366 | + 'output' => 'required', | ||
| 367 | + )), | ||
| 368 | + array('ktcore.validators.string', array( | ||
| 369 | + 'test' => 'inetlookup_type', | ||
| 370 | + 'output' => 'inetlookup_type', | ||
| 371 | + )), | ||
| 372 | + )); | ||
| 373 | + } | ||
| 374 | + else | ||
| 375 | + { | ||
| 376 | + | ||
| 377 | + $oForm->setWidgets(array( | ||
| 378 | + array('ktcore.widgets.string',array( | ||
| 379 | + 'label' => _kt("Field Name"), | ||
| 380 | + 'name' => 'name', | ||
| 381 | + 'value' => sanitizeForHTML($oField->getName()), | ||
| 382 | + 'required' => true, | ||
| 383 | + 'description' => _kt("Within a given fieldset, each field needs a unique name."), | ||
| 384 | + )), | ||
| 385 | + array('ktcore.widgets.text',array( | ||
| 386 | + 'label' => _kt("Description"), | ||
| 387 | + 'name' => 'description', | ||
| 388 | + 'value' => sanitizeForHTML($oField->getDescription()), | ||
| 389 | + 'required' => true, | ||
| 390 | + 'description' => _kt("A good description can be the difference between useful metadata and poor metadata. At the same time, overly long descriptions are far less valuable than concise ones."), | ||
| 391 | + )), | ||
| 392 | + array('ktcore.widgets.boolean',array( | ||
| 393 | + 'label' => _kt("Required"), | ||
| 394 | + 'value' => $oField->getIsMandatory(), | ||
| 395 | + 'name' => 'required', | ||
| 396 | + 'description' => _kt("Required fields must be filled in, or the adding process will be rejected."), | ||
| 397 | + )), | ||
| 398 | + | ||
| 399 | + )); | ||
| 400 | + | ||
| 401 | + $oForm->setValidators(array( | ||
| 402 | + array('ktcore.validators.string', array( | ||
| 403 | + 'test' => 'name', | ||
| 404 | + 'output' => 'name', | ||
| 405 | + )), | ||
| 406 | + array('ktcore.validators.string', array( | ||
| 407 | + 'test' => 'description', | ||
| 408 | + 'output' => 'description', | ||
| 409 | + )), | ||
| 410 | + array('ktcore.validators.boolean', array( | ||
| 411 | + 'test' => 'required', | ||
| 412 | + 'output' => 'required', | ||
| 413 | + )), | ||
| 414 | + )); | ||
| 415 | + } | ||
| 416 | + return $oForm; | ||
| 417 | + } | ||
| 418 | + /** | ||
| 419 | + * Manages a field | ||
| 420 | + * @return template | ||
| 421 | + * | ||
| 422 | + * | ||
| 423 | + * iNET Process | ||
| 424 | + */ | ||
| 425 | + function do_managefield() { | ||
| 426 | + $oTemplate = $this->oValidator->validateTemplate('manage_field'); | ||
| 427 | + | ||
| 428 | + $oTemplate->setData(array( | ||
| 429 | + 'context' => $this, | ||
| 430 | + 'field_name' => $this->oField->getName(), | ||
| 431 | + 'field_id' => $this->oField->getId(), | ||
| 432 | + 'form' => $this->form_editfield($this->oField), | ||
| 433 | + 'field' => $this->oField, | ||
| 434 | + )); | ||
| 435 | + return $oTemplate->render(); | ||
| 436 | + } | ||
| 437 | + /** | ||
| 438 | + * Updates a field | ||
| 439 | + * @return. | ||
| 440 | + * | ||
| 441 | + * | ||
| 442 | + * iNET Process | ||
| 443 | + */ | ||
| 444 | + function do_updatefield() { | ||
| 445 | + $oForm = $this->form_editfield($this->oField); | ||
| 446 | + $res = $oForm->validate(); | ||
| 447 | + $data = $res['results']; | ||
| 448 | + $errors = $res['errors']; | ||
| 449 | + $extra_errors = array(); | ||
| 450 | + | ||
| 451 | + // check that the field name either hasn't changed, or doesn't exist. | ||
| 452 | + if ($data['name'] != $this->oField->getName()) { | ||
| 453 | + $oOldField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']); | ||
| 454 | + if (!PEAR::isError($oOldField)) { | ||
| 455 | + $extra_errors['name'] = _kt("That name is already in use in this fieldset. Please specify a unique name."); | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + if (!empty($errors) || !empty($extra_errors)) { | ||
| 460 | + return $oForm->handleError(null, $extra_errors); | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + $this->oField->setName($data['name']); | ||
| 464 | + $this->oField->setDescription($data['description']); | ||
| 465 | + $this->oField->setIsMandatory($data['required']); | ||
| 466 | + | ||
| 467 | + // multiselect change start | ||
| 468 | + if(isset($data['inetlookup_type']) && $this->oField->getHasInetLookup()) | ||
| 469 | + { | ||
| 470 | + $this->oField->setInetLookupType($data['inetlookup_type']); | ||
| 471 | + } | ||
| 472 | + // multiselect change end | ||
| 473 | + | ||
| 474 | + $res = $this->oField->update(); | ||
| 475 | + if (PEAR::isError($res)) { | ||
| 476 | + return $oForm->handleError(sprintf(_kt("Failed to update field: %s"), $res->getMessage())); | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + $this->successRedirectTo('managefield',_kt("Field updated.")); | ||
| 480 | + } | ||
| 481 | + /** | ||
| 482 | + * Add lookup | ||
| 483 | + * @return form | ||
| 484 | + * | ||
| 485 | + * iNET Process | ||
| 486 | + */ | ||
| 487 | + function form_addlookups() { | ||
| 488 | + $oForm = new KTForm; | ||
| 489 | + $oForm->setOptions(array( | ||
| 490 | + 'identifier' => 'ktcore.fieldsets.basic.field.addlookup', | ||
| 491 | + 'label' => _kt("Add Lookup Values"), | ||
| 492 | + 'submit_label' => _kt('Add Lookups'), | ||
| 493 | + 'cancel_action' => 'managefield', | ||
| 494 | + 'fail_action' => 'addlookupvalues', | ||
| 495 | + 'action' => 'createlookupvalues', | ||
| 496 | + 'context' => $this, | ||
| 497 | + )); | ||
| 498 | + | ||
| 499 | + $oForm->setWidgets(array( | ||
| 500 | + array('ktcore.widgets.text',array( | ||
| 501 | + 'label' => _kt("Lookup Values"), | ||
| 502 | + 'name' => 'lookups', | ||
| 503 | + 'required' => true, | ||
| 504 | + 'description' => _kt("Lookup values are what a user can select from a dropdown. These pre-created lookup values are useful, since they help you keep the metadata in the system organised."), | ||
| 505 | + 'important_description' => _kt("Please enter the lookup values you wish to add, one per line."), | ||
| 506 | + )), | ||
| 507 | + )); | ||
| 508 | + | ||
| 509 | + $oForm->setValidators(array( | ||
| 510 | + array('ktcore.validators.string', array( | ||
| 511 | + 'test' => 'lookups', | ||
| 512 | + 'output' => 'lookups', | ||
| 513 | + 'max_length' => 9999, | ||
| 514 | + )), | ||
| 515 | + )); | ||
| 516 | + | ||
| 517 | + return $oForm; | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + /** | ||
| 521 | + * Add lookup values | ||
| 522 | + * @return | ||
| 523 | + * | ||
| 524 | + * iNET Process | ||
| 525 | + */ | ||
| 526 | + function do_addlookupvalues() { | ||
| 527 | + $this->oPage->setBreadcrumbDetails(_kt('add lookup values')); | ||
| 528 | + | ||
| 529 | + $oForm = $this->form_addlookups(); | ||
| 530 | + return $oForm->render(); | ||
| 531 | + } | ||
| 532 | + /** | ||
| 533 | + * Create lookup values | ||
| 534 | + * @return | ||
| 535 | + */ | ||
| 536 | + function do_createlookupvalues() { | ||
| 537 | + $oForm = $this->form_addlookups(); | ||
| 538 | + $res = $oForm->validate(); | ||
| 539 | + $data = $res['results']; | ||
| 540 | + $errors = $res['errors']; | ||
| 541 | + $extra_errors = array(); | ||
| 542 | + | ||
| 543 | + | ||
| 544 | + $failed = array(); | ||
| 545 | + $lookups = array(); | ||
| 546 | + | ||
| 547 | + $raw_lookups = $data['lookups']; | ||
| 548 | + $lookup_candidates = explode("\n", $raw_lookups); | ||
| 549 | + foreach ($lookup_candidates as $candidate) { | ||
| 550 | + $name = trim($candidate); | ||
| 551 | + | ||
| 552 | + if (empty($name)) { | ||
| 553 | + continue; | ||
| 554 | + } | ||
| 555 | + | ||
| 556 | + // check for existing or to-be-created lookups. | ||
| 557 | + if ($lookups[$name]) { | ||
| 558 | + $failed[$name] = $name; | ||
| 559 | + continue; | ||
| 560 | + } | ||
| 561 | + | ||
| 562 | + if ($failed[$name]) { | ||
| 563 | + continue; // already blown up, fix it. | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + $oOldLookup = MetaData::getByValueAndDocumentField($name, $this->oField); | ||
| 567 | + if (!PEAR::isError($oOldLookup)) { | ||
| 568 | + $failed[$name] = $name; | ||
| 569 | + continue; | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + $lookups[$name] = $name; | ||
| 573 | + } | ||
| 574 | + if (!empty($failed)) { | ||
| 575 | + $extra_errors['lookups'][] = sprintf(_kt("The following lookups you specified already exist, or are specified twice: %s"), implode(', ', $failed)); | ||
| 576 | + } else if (empty($lookups)) { | ||
| 577 | + $extra_errors['lookups'][] = _kt("You must have at least 1 new lookup value."); | ||
| 578 | + } | ||
| 579 | + | ||
| 580 | + if (!empty($errors) || !empty($extra_errors)) { | ||
| 581 | + return $oForm->handleError(null, $extra_errors); | ||
| 582 | + } | ||
| 583 | + | ||
| 584 | + $data['lookups'] = $lookups; | ||
| 585 | + | ||
| 586 | + foreach ($lookups as $value) { | ||
| 587 | + $oLookup = MetaData::createFromArray(array( | ||
| 588 | + 'DocFieldId' => $this->oField->getId(), | ||
| 589 | + 'sName' => $value, | ||
| 590 | + 'iTreeParent' => null, | ||
| 591 | + 'bDisabled' => false, | ||
| 592 | + 'bIsStuck' => false, | ||
| 593 | + )); | ||
| 594 | + if (PEAR::isError($oLookup)) { | ||
| 595 | + return $oForm->handleError(sprintf(_kt("Failed to create lookup: %s"), $oLookup->getMessage())); | ||
| 596 | + } | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + $this->successRedirectTo('managefield', sprintf(_kt("%d lookups added."), count($lookups))); | ||
| 600 | + } | ||
| 601 | + /** | ||
| 602 | + * Manages lookups | ||
| 603 | + * @return template | ||
| 604 | + * | ||
| 605 | + * iNET Process | ||
| 606 | + */ | ||
| 607 | + function do_managelookups() { | ||
| 608 | + $this->oPage->setBreadcrumbDetails(_kt('manage lookup values')); | ||
| 609 | + | ||
| 610 | + // Add javascript to create the edit form | ||
| 611 | + $sJavaScript = "\nfunction editLookup(id)\n | ||
| 612 | + {\n | ||
| 613 | + var div = document.getElementById(id);\n | ||
| 614 | + var value = div.innerHTML; | ||
| 615 | + | ||
| 616 | + <!-- Replace all double quotes with " -->\n | ||
| 617 | + matches = value.match(/\"/g);\n | ||
| 618 | + var newValue = value;\n | ||
| 619 | + if(matches){\n | ||
| 620 | + for(var i = 0; i < matches.length; i++){\n | ||
| 621 | + newValue = newValue.replace('\"', '"');\n | ||
| 622 | + }\n | ||
| 623 | + }\n\n | ||
| 624 | + | ||
| 625 | + var inner = '<input type=\"text\" name=\"lookup['+id+']\" id=\"lookup_'+id+'\" value=\"'+newValue+'\" />';\n | ||
| 626 | + inner += '<input type=\"hidden\" id=\"original_'+id+'\" value=\"'+newValue+'\" />';\n | ||
| 627 | + inner += '<input type=\"submit\" name=\"submit[edit]\" value=\""._kt('Save')."\" />';\n | ||
| 628 | + inner += '<input type=\"button\" onclick=\"javascript: closeLookupEdit('+id+');\" name=\"cancel\" value=\""._kt('Cancel')."\" />';\n | ||
| 629 | + div.innerHTML = inner;\n | ||
| 630 | + document.getElementById('lookup_'+id).focus();\n | ||
| 631 | + }\n\n | ||
| 632 | + | ||
| 633 | + function closeLookupEdit(id) | ||
| 634 | + {\n | ||
| 635 | + value = document.getElementById('original_'+id).value;\n | ||
| 636 | + document.getElementById(id).innerHTML = value;\n | ||
| 637 | + }\n\n"; | ||
| 638 | + | ||
| 639 | + $this->oPage->requireJSStandalone($sJavaScript); | ||
| 640 | + | ||
| 641 | + $lookups =& MetaData::getByDocumentField($this->oField); | ||
| 642 | + $args = $this->meldPersistQuery("","metadataMultiAction", true); | ||
| 643 | + | ||
| 644 | + $oTemplate =& $this->oValidator->validateTemplate("ktcore/metadata/admin/manage_lookups"); | ||
| 645 | + $oTemplate->setData(array( | ||
| 646 | + 'context' => $this, | ||
| 647 | + 'field_name' => $this->oField->getName(), | ||
| 648 | + 'lookups' => $lookups, | ||
| 649 | + 'args' => $args, | ||
| 650 | + )); | ||
| 651 | + return $oTemplate->render(); | ||
| 652 | + } | ||
| 653 | + | ||
| 654 | + // {{{ do_metadataMultiAction | ||
| 655 | + /** | ||
| 656 | + * call metadata multiaction methods | ||
| 657 | + * @param. | ||
| 658 | + * @return. | ||
| 659 | + * | ||
| 660 | + * iNET Process | ||
| 661 | + */ | ||
| 662 | + function do_metadataMultiAction() { | ||
| 663 | + $subaction = array_keys(KTUtil::arrayGet($_REQUEST, 'submit', array())); | ||
| 664 | + $this->oValidator->notEmpty($subaction, array("message" => _kt("No action specified"))); | ||
| 665 | + $subaction = $subaction[0]; | ||
| 666 | + $method = null; | ||
| 667 | + if (method_exists($this, 'lookup_' . $subaction)) { | ||
| 668 | + $method = 'lookup_' . $subaction; | ||
| 669 | + } | ||
| 670 | + $this->oValidator->notEmpty($method, array("message" => _kt("Unknown action specified"))); | ||
| 671 | + return $this->$method(); | ||
| 672 | + } | ||
| 673 | + // }}} | ||
| 674 | + | ||
| 675 | + // {{{ lookup_remove | ||
| 676 | + /** | ||
| 677 | + * remove lookup value. | ||
| 678 | + * @param | ||
| 679 | + * @return | ||
| 680 | + * | ||
| 681 | + * iNET Process | ||
| 682 | + */ | ||
| 683 | + function lookup_remove() { | ||
| 684 | + $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 685 | + $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 686 | + $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 687 | + if (empty($aMetadata)) { | ||
| 688 | + $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 689 | + } | ||
| 690 | + foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 691 | + $oMetaData =& MetaData::get($iMetaDataId); | ||
| 692 | + if (PEAR::isError($oMetaData)) { | ||
| 693 | + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 694 | + } | ||
| 695 | + $oMetaData->delete(); | ||
| 696 | + } | ||
| 697 | + $this->successRedirectTo('managelookups', _kt('Lookups removed')); | ||
| 698 | + exit(0); | ||
| 699 | + } | ||
| 700 | + // }}} | ||
| 701 | + | ||
| 702 | + // {{{ lookup_disable | ||
| 703 | + /** | ||
| 704 | + * disable lookup value. | ||
| 705 | + * @param | ||
| 706 | + * @return | ||
| 707 | + * | ||
| 708 | + * iNET Process | ||
| 709 | + */ | ||
| 710 | + function lookup_disable() { | ||
| 711 | + $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 712 | + $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 713 | + $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 714 | + if (empty($aMetadata)) { | ||
| 715 | + $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 716 | + } | ||
| 717 | + foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 718 | + $oMetaData =& MetaData::get($iMetaDataId); | ||
| 719 | + if (PEAR::isError($oMetaData)) { | ||
| 720 | + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 721 | + } | ||
| 722 | + $oMetaData->setDisabled(true); | ||
| 723 | + $oMetaData->update(); | ||
| 724 | + } | ||
| 725 | + $this->successRedirectTo('managelookups', _kt('Lookups disabled')); | ||
| 726 | + exit(0); | ||
| 727 | + } | ||
| 728 | + // }}} | ||
| 729 | + | ||
| 730 | + /** | ||
| 731 | + * Save the edited lookup values | ||
| 732 | + * | ||
| 733 | + * @param. | ||
| 734 | + * @return. | ||
| 735 | + * | ||
| 736 | + *iNET Process | ||
| 737 | + */ | ||
| 738 | + function lookup_edit(){ | ||
| 739 | + $aLookupValues = $_REQUEST['lookup']; | ||
| 740 | + | ||
| 741 | + if(empty($aLookupValues)){ | ||
| 742 | + $this->errorRedirectTo('managelookups', _kt('No lookups were selected for editing')); | ||
| 743 | + exit; | ||
| 744 | + } | ||
| 745 | + | ||
| 746 | + foreach ($aLookupValues as $iMetaDataId => $sValue){ | ||
| 747 | + $oMetaData = MetaData::get($iMetaDataId); | ||
| 748 | + if (PEAR::isError($oMetaData)) { | ||
| 749 | + $this->addErrorMessage(_kt('Invalid lookup selected').': '.$sValue); | ||
| 750 | + continue; | ||
| 751 | + | ||
| 752 | + } | ||
| 753 | + if(empty($sValue)){ | ||
| 754 | + $this->addErrorMessage(_kt('Lookup cannot be empty').': '.$oMetaData->getName()); | ||
| 755 | + if(count($aLookupValues) == 1){ | ||
| 756 | + $this->redirectTo('managelookups'); | ||
| 757 | + } | ||
| 758 | + continue; | ||
| 759 | + } | ||
| 760 | + $oMetaData->setName($sValue); | ||
| 761 | + $oMetaData->update(); | ||
| 762 | + } | ||
| 763 | + | ||
| 764 | + $this->successRedirectTo('managelookups', _kt('Lookup values saved')); | ||
| 765 | + exit(0); | ||
| 766 | + } | ||
| 767 | + | ||
| 768 | + // {{{ lookup_enable | ||
| 769 | + /** | ||
| 770 | + * enable lookup value | ||
| 771 | + * @param | ||
| 772 | + * @return | ||
| 773 | + * | ||
| 774 | + * iNET Process | ||
| 775 | + */ | ||
| 776 | + function lookup_toggleenabled() { | ||
| 777 | + $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 778 | + $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 779 | + $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 780 | + if (empty($aMetadata)) { | ||
| 781 | + $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 782 | + } | ||
| 783 | + foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 784 | + $oMetaData =& MetaData::get($iMetaDataId); | ||
| 785 | + if (PEAR::isError($oMetadata)) { | ||
| 786 | + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected')); | ||
| 787 | + } | ||
| 788 | + $oMetaData->setDisabled(!$oMetaData->getDisabled()); | ||
| 789 | + $oMetaData->update(); | ||
| 790 | + } | ||
| 791 | + $this->successRedirectTo('managelookups', _kt('Status Toggled')); | ||
| 792 | + exit(0); | ||
| 793 | + } | ||
| 794 | + // }}} | ||
| 795 | + | ||
| 796 | + // {{{ lookup_togglestickiness | ||
| 797 | + /** | ||
| 798 | + * toggle stickiness of lookup values | ||
| 799 | + * @param | ||
| 800 | + * @return | ||
| 801 | + * | ||
| 802 | + * iNET Process | ||
| 803 | + */ | ||
| 804 | + function lookup_togglestickiness() { | ||
| 805 | + $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']); | ||
| 806 | + $oField =& DocumentField::get($_REQUEST['fFieldId']); | ||
| 807 | + $aMetadata = KTUtil::arrayGet($_REQUEST, 'metadata'); | ||
| 808 | + if (empty($aMetadata)) { | ||
| 809 | + $this->errorRedirectTo('managelookups', _kt('No lookups selected')); | ||
| 810 | + } | ||
| 811 | + foreach ($_REQUEST['metadata'] as $iMetaDataId) { | ||
| 812 | + $oMetaData =& MetaData::get($iMetaDataId); | ||
| 813 | + if (PEAR::isError($oMetaData)) { | ||
| 814 | + $this->errorRedirectTo('managelookups', _kt('Invalid lookups selected')); | ||
| 815 | + } | ||
| 816 | + $bStuck = (boolean)$oMetaData->getIsStuck(); | ||
| 817 | + $oMetaData->setIsStuck(!$bStuck); | ||
| 818 | + $oMetaData->update(); | ||
| 819 | + } | ||
| 820 | + $this->successRedirectTo('managelookups', _kt('Lookup stickiness toggled')); | ||
| 821 | + exit(0); | ||
| 822 | + } | ||
| 823 | + // }}} | ||
| 824 | + | ||
| 825 | +// {{{ TREE | ||
| 826 | + // create and display the tree editing form. | ||
| 827 | + /** | ||
| 828 | + * create and display the tree editing form. | ||
| 829 | + * @param. | ||
| 830 | + * @return template | ||
| 831 | + * | ||
| 832 | + * iNET Process | ||
| 833 | + */ | ||
| 834 | + function do_managetree() { | ||
| 835 | + global $default; | ||
| 836 | + // extract. | ||
| 837 | + $iFieldsetId = KTUtil::getId($this->oFieldset); | ||
| 838 | + $iFieldId = KTUtil::getId($this->oField); | ||
| 839 | + | ||
| 840 | + $oFieldset =& $this->oFieldset; | ||
| 841 | + $oField =& $this->oField; | ||
| 842 | + | ||
| 843 | + $this->oPage->setBreadcrumbDetails(_kt('edit lookup tree')); | ||
| 844 | + | ||
| 845 | + $field_id = $iFieldId; | ||
| 846 | + $current_node = KTUtil::arrayGet($_REQUEST, 'current_node', 0); | ||
| 847 | + $subaction = KTUtil::arrayGet($_REQUEST, 'subaction'); | ||
| 848 | + | ||
| 849 | + // validate | ||
| 850 | + if (empty($field_id)) { return $this->errorRedirectToMain(_kt("Must select a field to edit.")); } | ||
| 851 | + $oField =& DocumentField::get($field_id); | ||
| 852 | + if (PEAR::isError($oField)) { return $this->errorRedirectToMain(_kt("Invalid field.")); } | ||
| 853 | + | ||
| 854 | + $aErrorOptions = array( | ||
| 855 | + 'redirect_to' => array('editTree', sprintf('field_id=%d', $field_id)), | ||
| 856 | + ); | ||
| 857 | + | ||
| 858 | + // under here we do the subaction rendering. | ||
| 859 | + // we do this so we don't have to do _very_ strange things with multiple actions. | ||
| 860 | + | ||
| 861 | + $fieldTree =& new MDTree(); | ||
| 862 | + $fieldTree->buildForField($oField->getId()); | ||
| 863 | + | ||
| 864 | + if ($subaction !== null) { | ||
| 865 | + $target = 'managetree'; | ||
| 866 | + $msg = _kt('Changes saved.'); | ||
| 867 | + if ($subaction === "addCategory") { | ||
| 868 | + $new_category = KTUtil::arrayGet($_REQUEST, 'category_name'); | ||
| 869 | + if (empty($new_category)) { | ||
| 870 | + return $this->errorRedirectTo("managetree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId)); | ||
| 871 | + } else { | ||
| 872 | + $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree); | ||
| 873 | + } | ||
| 874 | + $msg = _kt('Category added'). ': ' . $new_category; | ||
| 875 | + } | ||
| 876 | + if ($subaction === "deleteCategory") { | ||
| 877 | + $this->subact_deleteCategory($fieldTree, $current_node); | ||
| 878 | + $current_node = 0; // clear out, and don't try and render the newly deleted category. | ||
| 879 | + $msg = _kt('Category removed.'); | ||
| 880 | + } | ||
| 881 | + if ($subaction === "linkKeywords") { | ||
| 882 | + $keywords = KTUtil::arrayGet($_REQUEST, 'keywordsToAdd'); | ||
| 883 | + $aErrorOptions['message'] = _kt("No keywords selected"); | ||
| 884 | + $this->oValidator->notEmpty($keywords, $aErrorOptions); | ||
| 885 | + $this->subact_linkKeywords($fieldTree, $current_node, $keywords); | ||
| 886 | + $current_node = 0; // clear out, and don't try and render the newly deleted category. | ||
| 887 | + $msg = _kt('Keywords added to category.'); | ||
| 888 | + } | ||
| 889 | + if ($subaction === "unlinkKeyword") { | ||
| 890 | + $keyword = KTUtil::arrayGet($_REQUEST, 'keyword_id'); | ||
| 891 | + $this->subact_unlinkKeyword($fieldTree, $keyword); | ||
| 892 | + $msg = _kt('Keyword moved to base of tree.'); | ||
| 893 | + } | ||
| 894 | + // now redirect | ||
| 895 | + $query = sprintf('field_id=%d&fFieldsetId=%d', $field_id, $iFieldsetId); | ||
| 896 | + return $this->successRedirectTo($target, $msg, $query); | ||
| 897 | + } | ||
| 898 | + if ($fieldTree->root === null) { | ||
| 899 | + return $this->errorRedirectToMain(_kt("Error building tree. Is this a valid tree-lookup field?")); | ||
| 900 | + } | ||
| 901 | + | ||
| 902 | + // FIXME extract this from MDTree (helper method?) | ||
| 903 | + $free_metadata = MetaData::getList('document_field_id = '.$oField->getId().' AND (treeorg_parent = 0 OR treeorg_parent IS NULL) AND (disabled = 0)'); | ||
| 904 | + | ||
| 905 | + // render edit template. | ||
| 906 | + | ||
| 907 | + $oTemplate = $this->oValidator->validateTemplate("ktcore/metadata/admin/edit_lookuptree"); | ||
| 908 | + $renderedTree = $this->_evilTreeRenderer($fieldTree); | ||
| 909 | + | ||
| 910 | + $this->oPage->setTitle(_kt('Edit Lookup Tree')); | ||
| 911 | + | ||
| 912 | + if ($current_node == 0) { $category_name = 'Root'; } | ||
| 913 | + else { | ||
| 914 | + $oNode = MDTreeNode::get($current_node); | ||
| 915 | + $category_name = $oNode->getName(); | ||
| 916 | + } | ||
| 917 | + | ||
| 918 | + $aTemplateData = array( | ||
| 919 | + "context" => $this, | ||
| 920 | + "args" => $this->meldPersistQuery("","managetree", true), | ||
| 921 | + "field" => $oField, | ||
| 922 | + "oFieldset" => $oFieldset, | ||
| 923 | + "tree" => $fieldTree, | ||
| 924 | + "renderedTree" => $renderedTree, | ||
| 925 | + "currentNode" => $current_node, | ||
| 926 | + 'category_name' => $category_name, | ||
| 927 | + "freechildren" => $free_metadata, | ||
| 928 | + | ||
| 929 | + ); | ||
| 930 | + return $oTemplate->render($aTemplateData); | ||
| 931 | + } | ||
| 932 | + /** | ||
| 933 | + * Adds a category | ||
| 934 | + * @return | ||
| 935 | + * @param $field_id Object | ||
| 936 | + * @param $current_node Object | ||
| 937 | + * @param $new_category Object | ||
| 938 | + * @param $constructedTree Object | ||
| 939 | + * | ||
| 940 | + * iNET Process | ||
| 941 | + */ | ||
| 942 | + function subact_addCategory($field_id, $current_node, $new_category, &$constructedTree) { | ||
| 943 | + $newCategory = MDTreeNode::createFromArray(array ( | ||
| 944 | + "iFieldId" => $field_id, | ||
| 945 | + "sName" => $new_category, | ||
| 946 | + "iParentNode" => $current_node, | ||
| 947 | + )); | ||
| 948 | + if (PEAR::isError($newCategory)) | ||
| 949 | + { | ||
| 950 | + return false; | ||
| 951 | + } | ||
| 952 | + $constructedTree->addNode($newCategory); | ||
| 953 | + return true; | ||
| 954 | + } | ||
| 955 | + /** | ||
| 956 | + * Deletes a catagory | ||
| 957 | + * @return | ||
| 958 | + * @param $constructedTree Object | ||
| 959 | + * @param $current_node Object | ||
| 960 | + */ | ||
| 961 | + function subact_deleteCategory(&$constructedTree, $current_node) { | ||
| 962 | + $constructedTree->deleteNode($current_node); | ||
| 963 | + return true; | ||
| 964 | + } | ||
| 965 | + | ||
| 966 | + /** | ||
| 967 | + * | ||
| 968 | + * @param $constructedTree object | ||
| 969 | + * @param $keywords | ||
| 970 | + * @return true. | ||
| 971 | + * | ||
| 972 | + * iNET Process | ||
| 973 | + */ | ||
| 974 | + function subact_unlinkKeyword(&$constructedTree, $keyword) { | ||
| 975 | + $oKW = MetaData::get($keyword); | ||
| 976 | + if (PEAR::isError($oKW)) { | ||
| 977 | + return true; | ||
| 978 | + } | ||
| 979 | + $constructedTree->reparentKeyword($oKW->getId(), 0); | ||
| 980 | + return true; | ||
| 981 | + } | ||
| 982 | + | ||
| 983 | + /** | ||
| 984 | + * | ||
| 985 | + * @param $constructedTree object | ||
| 986 | + * @param $current_node node id | ||
| 987 | + * @param $keywords array | ||
| 988 | + * @return true. | ||
| 989 | + * | ||
| 990 | + * iNET Process | ||
| 991 | + */ | ||
| 992 | + function subact_linkKeywords(&$constructedTree, $current_node, $keywords) { | ||
| 993 | + foreach ($keywords as $md_id) | ||
| 994 | + { | ||
| 995 | + $constructedTree->reparentKeyword($md_id, $current_node); | ||
| 996 | + } | ||
| 997 | + return true; | ||
| 998 | + } | ||
| 999 | + | ||
| 1000 | + /* ----------------------- EVIL HACK -------------------------- | ||
| 1001 | + * | ||
| 1002 | + * This whole thing needs to replaced, as soon as I work out how | ||
| 1003 | + * to non-sucking Smarty recursion. | ||
| 1004 | + */ | ||
| 1005 | + | ||
| 1006 | + /** | ||
| 1007 | + * render to subnode of tree | ||
| 1008 | + * | ||
| 1009 | + * @param $subnode node | ||
| 1010 | + * @param $treeToRender object | ||
| 1011 | + * @Return string | ||
| 1012 | + * | ||
| 1013 | + * iNET Process | ||
| 1014 | + */ | ||
| 1015 | + function _evilTreeRecursion($subnode, $treeToRender) | ||
| 1016 | + { | ||
| 1017 | + // deliver us from evil.... | ||
| 1018 | + $iFieldId = $treeToRender->field_id; | ||
| 1019 | + $oField = DocumentField::get($iFieldId); | ||
| 1020 | + $iFieldsetId = $oField->getParentFieldsetId(); | ||
| 1021 | + | ||
| 1022 | + $treeStr = "<ul>"; | ||
| 1023 | + foreach ($treeToRender->contents[$subnode] as $subnode_id => $subnode_val) | ||
| 1024 | + { | ||
| 1025 | + if ($subnode_id !== "leaves") { | ||
| 1026 | + $treeStr .= '<li class="treenode active"><a class="pathnode inactive" onclick="toggleElementClass(\'active\', this.parentNode); toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subnode_val]->getName() . '</a>'; | ||
| 1027 | + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subnode_val); | ||
| 1028 | + $treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender); | ||
| 1029 | + $treeStr .= '</li>'; | ||
| 1030 | + } | ||
| 1031 | + else | ||
| 1032 | + { | ||
| 1033 | + foreach ($subnode_val as $leaf) | ||
| 1034 | + { | ||
| 1035 | + $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName(); | ||
| 1036 | + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf); | ||
| 1037 | + $treeStr .= '</li>'; } | ||
| 1038 | + } | ||
| 1039 | + } | ||
| 1040 | + $treeStr .= '</ul>'; | ||
| 1041 | + return $treeStr; | ||
| 1042 | + | ||
| 1043 | + } | ||
| 1044 | + | ||
| 1045 | + // I can't seem to do recursion in smarty, and recursive templates seems a bad solution. | ||
| 1046 | + // Come up with a better way to do this (? NBM) | ||
| 1047 | + | ||
| 1048 | + /** | ||
| 1049 | + * render tree | ||
| 1050 | + * | ||
| 1051 | + * @param $treeToRender object | ||
| 1052 | + * @return tree string | ||
| 1053 | + * | ||
| 1054 | + * iNET Process | ||
| 1055 | + */ | ||
| 1056 | + function _evilTreeRenderer($treeToRender) { | ||
| 1057 | + //global $default; | ||
| 1058 | + | ||
| 1059 | + $treeStr = "<!-- this is rendered with an unholy hack. sorry. -->"; | ||
| 1060 | + $stack = array(); | ||
| 1061 | + $exitstack = array(); | ||
| 1062 | + | ||
| 1063 | + // since the root is virtual, we need to fake it here. | ||
| 1064 | + // the inner section is generised. | ||
| 1065 | + $treeStr .= '<ul class="kt_treenodes"><li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . _kt('Root') . '</a>'; | ||
| 1066 | + $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=0', 'managetree')) . '">' . _kt('attach keywords') . '</a>)'; | ||
| 1067 | + $treeStr .= '<ul>'; | ||
| 1068 | + | ||
| 1069 | + | ||
| 1070 | + foreach ($treeToRender->getRoot() as $node_id => $subtree_nodes) | ||
| 1071 | + { | ||
| 1072 | + | ||
| 1073 | + // leaves are handled differently. | ||
| 1074 | + if ($node_id !== "leaves") { | ||
| 1075 | + | ||
| 1076 | + $treeStr .= '<li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subtree_nodes]->getName() . '</a>'; | ||
| 1077 | + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subtree_nodes); | ||
| 1078 | + $treeStr .= $this->_evilTreeRecursion($subtree_nodes, $treeToRender); | ||
| 1079 | + $treeStr .= '</li>'; | ||
| 1080 | + } | ||
| 1081 | + else | ||
| 1082 | + { | ||
| 1083 | + foreach ($subtree_nodes as $leaf) | ||
| 1084 | + { | ||
| 1085 | + $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName(); | ||
| 1086 | + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf); | ||
| 1087 | + $treeStr .= '</li>'; | ||
| 1088 | + } | ||
| 1089 | + } | ||
| 1090 | + } | ||
| 1091 | + $treeStr .= '</ul></li>'; | ||
| 1092 | + $treeStr .= '</ul>'; | ||
| 1093 | + | ||
| 1094 | + return $treeStr; | ||
| 1095 | + } | ||
| 1096 | + | ||
| 1097 | + // BS: don't hate me. | ||
| 1098 | + // BD: sorry. I hate you. | ||
| 1099 | + /** | ||
| 1100 | + * KT function | ||
| 1101 | + * | ||
| 1102 | + * @param $iFieldsetId ID | ||
| 1103 | + * @param $iFieldId ID | ||
| 1104 | + * @param $bIsKeyword boolean | ||
| 1105 | + * @param $current_node node ID | ||
| 1106 | + * @return string. | ||
| 1107 | + * | ||
| 1108 | + * iNET Process | ||
| 1109 | + */ | ||
| 1110 | + function _evilActionHelper($iFieldsetId, $iFieldId, $bIsKeyword, $current_node) { | ||
| 1111 | + $actionStr = " ("; | ||
| 1112 | + if ($bIsKeyword === true) { | ||
| 1113 | + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf(KTUtil::addQueryStringSelf($this->meldPersistQuery('keyword_id='.$current_node.'&subaction=unlinkKeyword', 'managetree'))) . '">' . _kt('unlink') . '</a>'; | ||
| 1114 | + } else { | ||
| 1115 | + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=' . $current_node, 'managetree')) .'">' . _kt('attach keywords') . '</a> '; | ||
| 1116 | + $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node='.$current_node.'&subaction=deleteCategory', 'managetree')) . '">' . _kt('delete') . '</a>'; | ||
| 1117 | + } | ||
| 1118 | + $actionStr .= ")"; | ||
| 1119 | + return $actionStr; | ||
| 1120 | + } | ||
| 1121 | + /** | ||
| 1122 | + * Deletes a field | ||
| 1123 | + * @return | ||
| 1124 | + * | ||
| 1125 | + * iNET Process | ||
| 1126 | + */ | ||
| 1127 | + function do_deletefield() { | ||
| 1128 | + $res = $this->oField->delete(); | ||
| 1129 | + if (PEAR::isError($res)) { | ||
| 1130 | + $this->errorRedirectToParent(sprintf(_kt("Unable to delete field: %s"), $res->getMessage())); | ||
| 1131 | + } | ||
| 1132 | + | ||
| 1133 | + $this->successRedirectToParent(_kt("Field deleted.")); | ||
| 1134 | + } | ||
| 1135 | + | ||
| 1136 | + /** | ||
| 1137 | + * Move field up in the order | ||
| 1138 | + * | ||
| 1139 | + * iNET Process | ||
| 1140 | + */ | ||
| 1141 | + function do_orderUp() { | ||
| 1142 | + $iId = $this->oField->getID(); | ||
| 1143 | + $iFieldsetId = $this->oField->getParentFieldsetId(); | ||
| 1144 | + | ||
| 1145 | + $res = $this->oField->movePosition($iFieldsetId, $iId, 'up'); | ||
| 1146 | + if ($res === false) { | ||
| 1147 | + $this->errorRedirectToParent(_kt("Unable to move field up")); | ||
| 1148 | + } | ||
| 1149 | + | ||
| 1150 | + $this->successRedirectToParent(_kt("Field moved up.")); | ||
| 1151 | + } | ||
| 1152 | + | ||
| 1153 | + /** | ||
| 1154 | + * Move field down in the order | ||
| 1155 | + * | ||
| 1156 | + * iNET Process | ||
| 1157 | + */ | ||
| 1158 | + function do_orderDown() { | ||
| 1159 | + $iId = $this->oField->getID(); | ||
| 1160 | + $iFieldsetId = $this->oField->getParentFieldsetId(); | ||
| 1161 | + | ||
| 1162 | + $res = $this->oField->movePosition($iFieldsetId, $iId, 'down'); | ||
| 1163 | + if ($res === false) { | ||
| 1164 | + $this->errorRedirectToParent(_kt("Unable to move field down")); | ||
| 1165 | + } | ||
| 1166 | + | ||
| 1167 | + $this->successRedirectToParent(_kt("Field moved down.")); | ||
| 1168 | + } | ||
| 1169 | +} | ||
| 1170 | + | ||
| 1171 | +?> |
plugins/multiselect/js/hideadminlink.js
| 1 | -//To hide the link for existing document fieldset | ||
| 2 | -JQ(document).ready(function(){ | ||
| 3 | - var elems = JQ("dl.panel_menu").find("a"); | ||
| 4 | - for (i = 0; i < elems.length; i++) { | ||
| 5 | - if(elems[i].href.search("kt_path_info=documents/fieldmanagement2") > -1) | ||
| 6 | - { | ||
| 7 | - JQ(elems[i]).parent("dt").hide(); | ||
| 8 | - } | ||
| 9 | - } | ||
| 10 | - | ||
| 11 | - var elemsDesc = JQ("dl.panel_menu").find("dd"); | ||
| 12 | - for (i = 0; i < elemsDesc.length; i++) { | ||
| 13 | - if(elemsDesc[i].innerHTML.search("Manage the different types of information that can be associated with classes of documents.") > -1) | ||
| 14 | - { | ||
| 15 | - JQ(elemsDesc[i]).hide(); | ||
| 16 | - } | ||
| 17 | - } | ||
| 18 | -}); | 1 | +//To hide the link for existing document fieldset |
| 2 | +JQ(document).ready(function(){ | ||
| 3 | + var elems = JQ("dl.panel_menu").find("a"); | ||
| 4 | + for (i = 0; i < elems.length; i++) { | ||
| 5 | + if(elems[i].href.search("kt_path_info=documents/fieldmanagement2") > -1) | ||
| 6 | + { | ||
| 7 | + JQ(elems[i]).parent("dt").hide(); | ||
| 8 | + } | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + var elemsDesc = JQ("dl.panel_menu").find("dd"); | ||
| 12 | + for (i = 0; i < elemsDesc.length; i++) { | ||
| 13 | + if(elemsDesc[i].innerHTML.search("Manage the different types of information that can be associated with classes of documents.") > -1) | ||
| 14 | + { | ||
| 15 | + JQ(elemsDesc[i]).hide(); | ||
| 16 | + } | ||
| 17 | + } | ||
| 18 | +}); |
plugins/multiselect/js/hidelink.js
| 1 | -//To hide the link for existing bulk upload link | ||
| 2 | -JQ(document).ready(function(){ | ||
| 3 | - var elems = JQ("ul.actionlist").find("a"); | ||
| 4 | - for (i = 0; i < elems.length; i++) { | ||
| 5 | - if(elems[i].href.search("kt_path_info=ktcore.actions.folder.bulkUpload") > -1 || elems[i].href.search("kt_path_info=inetfoldermetadata.actions.folder.bulkUpload") > -1) | ||
| 6 | - { | ||
| 7 | - JQ(elems[i]).parent("li").hide(); | ||
| 8 | - } | ||
| 9 | - } | ||
| 10 | -}); | ||
| 11 | -// added by SL:2009-03-04 | ||
| 12 | -JQ(document).ready(function(){ | ||
| 13 | - var elems = JQ("ul.actionlist").find("a"); | ||
| 14 | - for (i = 0; i < elems.length; i++) { | ||
| 15 | - if(elems[i].href.search("kt_path_info=ktcore.actions.folder.bulkImport") > -1 || elems[i].href.search("kt_path_info=inetfoldermetadata.actions.folder.bulkUpload") > -1) | ||
| 16 | - { | ||
| 17 | - JQ(elems[i]).parent("li").hide(); | ||
| 18 | - } | ||
| 19 | - } | 1 | +//To hide the link for existing bulk upload link |
| 2 | +JQ(document).ready(function(){ | ||
| 3 | + var elems = JQ("ul.actionlist").find("a"); | ||
| 4 | + for (i = 0; i < elems.length; i++) { | ||
| 5 | + if(elems[i].href.search("kt_path_info=ktcore.actions.folder.bulkUpload") > -1 || elems[i].href.search("kt_path_info=inetfoldermetadata.actions.folder.bulkUpload") > -1) | ||
| 6 | + { | ||
| 7 | + JQ(elems[i]).parent("li").hide(); | ||
| 8 | + } | ||
| 9 | + } | ||
| 10 | +}); | ||
| 11 | +// added by SL:2009-03-04 | ||
| 12 | +JQ(document).ready(function(){ | ||
| 13 | + var elems = JQ("ul.actionlist").find("a"); | ||
| 14 | + for (i = 0; i < elems.length; i++) { | ||
| 15 | + if(elems[i].href.search("kt_path_info=ktcore.actions.folder.bulkImport") > -1 || elems[i].href.search("kt_path_info=inetfoldermetadata.actions.folder.bulkUpload") > -1) | ||
| 16 | + { | ||
| 17 | + JQ(elems[i]).parent("li").hide(); | ||
| 18 | + } | ||
| 19 | + } | ||
| 20 | }); | 20 | }); |
| 21 | \ No newline at end of file | 21 | \ No newline at end of file |
plugins/multiselect/sql/script.sql
| 1 | -ALTER TABLE `document_fields` | ||
| 2 | - ADD `has_inetlookup` tinyint(1) default NULL; | ||
| 3 | - | ||
| 4 | -ALTER TABLE `document_fields` | 1 | +ALTER TABLE `document_fields` |
| 2 | + ADD `has_inetlookup` tinyint(1) default NULL; | ||
| 3 | + | ||
| 4 | +ALTER TABLE `document_fields` | ||
| 5 | ADD `inetlookup_type` varchar(255) default NULL; | 5 | ADD `inetlookup_type` varchar(255) default NULL; |
| 6 | \ No newline at end of file | 6 | \ No newline at end of file |
plugins/multiselect/templates/multiselect/selection.smarty
| 1 | -<div class="field {if ($has_errors)}error{/if}"> | ||
| 2 | - <label for="{$name}">{$label}{if ($required === true)}<span class="required">({i18n}Required{/i18n})</span>{/if}</label> | ||
| 3 | - <p class="descriptiveText">{$description}</p> | ||
| 4 | - {if empty($vocab)} | ||
| 5 | - <div class="ktInfoMessage"><span>{$context->sEmptyMessage}</span></div> | ||
| 6 | - {else} | ||
| 7 | - <select name="{$name}{* multiselect change start *}{if $options.multi}[]{/if}{* multiselect change end *}" | ||
| 8 | - {if $has_id}id="{$id}"{/if} | ||
| 9 | - {if $options.multi}multiple="true"{/if} | ||
| 10 | - > | ||
| 11 | - {if $options.initial_string} | ||
| 12 | - <option value="">{$options.initial_string}</option> | ||
| 13 | - {/if} | ||
| 14 | - {foreach item=lookup key=lookup_key from=$vocab} | ||
| 15 | - {* multiselect change start *} | ||
| 16 | - {if $options.multi} | ||
| 17 | - {capture assign=selected}{""}{/capture} | ||
| 18 | - {foreach item=value1 key=key from=$value} | ||
| 19 | - {if $value1 == $lookup_key} | ||
| 20 | - {capture assign=selected}selected='selected'{/capture} | ||
| 21 | - {/if} | ||
| 22 | - {/foreach} | ||
| 23 | - <option value="{$lookup_key|sanitize}" {$selected} >{$lookup|sanitize}</option> | ||
| 24 | - {else}{* multiselect change end *} | ||
| 25 | - <option value="{$lookup_key|sanitize}" {if ($value == $lookup_key)}selected="selected"{/if}>{$lookup|sanitize}</option> | ||
| 26 | - {* multiselect change start *}{/if}{* multiselect change end *} | ||
| 27 | - {/foreach} | ||
| 28 | - </select> | ||
| 29 | -{/if} | 1 | +<div class="field {if ($has_errors)}error{/if}"> |
| 2 | + <label for="{$name}">{$label}{if ($required === true)}<span class="required">({i18n}Required{/i18n})</span>{/if}</label> | ||
| 3 | + <p class="descriptiveText">{$description}</p> | ||
| 4 | + {if empty($vocab)} | ||
| 5 | + <div class="ktInfoMessage"><span>{$context->sEmptyMessage}</span></div> | ||
| 6 | + {else} | ||
| 7 | + <select name="{$name}{* multiselect change start *}{if $options.multi}[]{/if}{* multiselect change end *}" | ||
| 8 | + {if $has_id}id="{$id}"{/if} | ||
| 9 | + {if $options.multi}multiple="true"{/if} | ||
| 10 | + > | ||
| 11 | + {if $options.initial_string} | ||
| 12 | + <option value="">{$options.initial_string}</option> | ||
| 13 | + {/if} | ||
| 14 | + {foreach item=lookup key=lookup_key from=$vocab} | ||
| 15 | + {* multiselect change start *} | ||
| 16 | + {if $options.multi} | ||
| 17 | + {capture assign=selected}{""}{/capture} | ||
| 18 | + {foreach item=value1 key=key from=$value} | ||
| 19 | + {if $value1 == $lookup_key} | ||
| 20 | + {capture assign=selected}selected='selected'{/capture} | ||
| 21 | + {/if} | ||
| 22 | + {/foreach} | ||
| 23 | + <option value="{$lookup_key|sanitize}" {$selected} >{$lookup|sanitize}</option> | ||
| 24 | + {else}{* multiselect change end *} | ||
| 25 | + <option value="{$lookup_key|sanitize}" {if ($value == $lookup_key)}selected="selected"{/if}>{$lookup|sanitize}</option> | ||
| 26 | + {* multiselect change start *}{/if}{* multiselect change end *} | ||
| 27 | + {/foreach} | ||
| 28 | + </select> | ||
| 29 | +{/if} | ||
| 30 | </div> | 30 | </div> |
| 31 | \ No newline at end of file | 31 | \ No newline at end of file |
plugins/multiselect/templates/multiselect/simple_selection.smarty
| 1 | -<div class="field {if ($has_errors)}error{/if}"> | ||
| 2 | - <label for="{$name}">{$label}{if ($required === true)}<span class="required">({i18n}Required{/i18n})</span>{/if}</label> | ||
| 3 | - <p class="descriptiveText">{$description}</p> | ||
| 4 | - {if empty($vocab)} | ||
| 5 | - <div class="ktInfoMessage"><span>{$context->sEmptyMessage}</span></div> | ||
| 6 | - {else} | ||
| 7 | - | ||
| 8 | - {* radio or checkboxes *} | ||
| 9 | - {if $options.multi} | ||
| 10 | - {foreach item=lookup key=lookup_key from=$vocab} | ||
| 11 | - <input type="checkbox" name="{$name}[]" value="{$lookup_key}" {if $context->selected($lookup_key)}checked="true"{/if}>{$lookup} <br /> | ||
| 12 | - {/foreach} | ||
| 13 | - {else} | ||
| 14 | - {if $options.initial_string} | ||
| 15 | - <input type="radio" name="{$name}" {if $context->selected('')}checked="true"{/if}>{$options.initial_string} <br /> | ||
| 16 | - {/if} | ||
| 17 | - {foreach item=lookup key=lookup_key from=$vocab} | ||
| 18 | - <input type="radio" name="{$name}" value="{$lookup_key}" {if $context->selected($lookup_key)}checked="true"{/if}>{$lookup} <br /> | ||
| 19 | - {/foreach} | ||
| 20 | - {/if} | ||
| 21 | - | ||
| 22 | - {/if} | 1 | +<div class="field {if ($has_errors)}error{/if}"> |
| 2 | + <label for="{$name}">{$label}{if ($required === true)}<span class="required">({i18n}Required{/i18n})</span>{/if}</label> | ||
| 3 | + <p class="descriptiveText">{$description}</p> | ||
| 4 | + {if empty($vocab)} | ||
| 5 | + <div class="ktInfoMessage"><span>{$context->sEmptyMessage}</span></div> | ||
| 6 | + {else} | ||
| 7 | + | ||
| 8 | + {* radio or checkboxes *} | ||
| 9 | + {if $options.multi} | ||
| 10 | + {foreach item=lookup key=lookup_key from=$vocab} | ||
| 11 | + <input type="checkbox" name="{$name}[]" value="{$lookup_key}" {if $context->selected($lookup_key)}checked="true"{/if}>{$lookup} <br /> | ||
| 12 | + {/foreach} | ||
| 13 | + {else} | ||
| 14 | + {if $options.initial_string} | ||
| 15 | + <input type="radio" name="{$name}" {if $context->selected('')}checked="true"{/if}>{$options.initial_string} <br /> | ||
| 16 | + {/if} | ||
| 17 | + {foreach item=lookup key=lookup_key from=$vocab} | ||
| 18 | + <input type="radio" name="{$name}" value="{$lookup_key}" {if $context->selected($lookup_key)}checked="true"{/if}>{$lookup} <br /> | ||
| 19 | + {/foreach} | ||
| 20 | + {/if} | ||
| 21 | + | ||
| 22 | + {/if} | ||
| 23 | </div> | 23 | </div> |
| 24 | \ No newline at end of file | 24 | \ No newline at end of file |
setup/wizard/installUtil.php
| @@ -493,7 +493,7 @@ class InstallUtil { | @@ -493,7 +493,7 @@ class InstallUtil { | ||
| 493 | foreach ($broke as $r) { | 493 | foreach ($broke as $r) { |
| 494 | $match = preg_match('/bin/', $r); | 494 | $match = preg_match('/bin/', $r); |
| 495 | if($match) { | 495 | if($match) { |
| 496 | - return preg_replace('/php:/', '', $r); | 496 | + return preg_replace('/soffice:/', '', $r); |
| 497 | } | 497 | } |
| 498 | } | 498 | } |
| 499 | } | 499 | } |
setup/wizard/resources/jquery-tooltip/changelog.txt
| 1 | -1.3 | ||
| 2 | ---- | ||
| 3 | - | ||
| 4 | -* Added fade option (duration in ms) for fading in/out tooltips; IE <= 6 is excluded when bgiframe plugin is included | ||
| 5 | -* Fixed imagemaps in IE, added back example | ||
| 6 | -* Added positionLeft-option - positions the tooltip to the left of the cursor | ||
| 7 | -* Remove deprecated $.fn.Tooltip in favor of $.fn.tooltip | ||
| 8 | - | ||
| 9 | -1.2 | ||
| 10 | ---- | ||
| 11 | - | ||
| 12 | -* Improved bodyHandler option to accept HTML strings, DOM elements and jQuery objects as the return value | ||
| 13 | -* Fixed bug in Safari 3 where to tooltip is initially visible, by first appending to DOM then hiding it | ||
| 14 | -* Improvement for viewport-border-positioning: Add the classes "viewport-right" and "viewport-bottom" when the element is moved at the viewport border. | ||
| 15 | -* Moved and enhanced documentation to docs.jquery.com | ||
| 16 | -* Added examples for bodyHandler: footnote-tooltip and thumbnail | ||
| 17 | -* Added id option, defaults to "tooltip", override to use a different id in your stylesheet | ||
| 18 | -* Moved demo tooltip style to screen.css | ||
| 19 | -* Moved demo files to demo folder and dependencies to lib folder | ||
| 20 | -* Dropped image map example - completely incompatible with IE; image maps aren't supported anymore | ||
| 21 | - | ||
| 22 | -1.1 | ||
| 23 | ---- | ||
| 24 | - | ||
| 25 | -* Use bgiframe-plugin if available | ||
| 26 | -* Use dimensions-plugin to calculate viewport | ||
| 27 | -* Expose global blocked-property via $.Tooltip.blocked to programmatically disable all tooltips | ||
| 28 | -* Fixed image maps in IE by setting the alt-attribute to an empty string | ||
| 29 | -* Removed event-option (only hover-tooltips now) | ||
| 30 | -* Simplified event-handling (using hover instead of mouseover und mouseout) | ||
| 31 | -* Added another "pretty" example | ||
| 32 | -* Added top and left options to specify tooltip offset | ||
| 33 | -* Reworked example page: New layout, code examples | ||
| 34 | - | ||
| 35 | -1.0 | ||
| 36 | ---- | ||
| 37 | - | 1 | +1.3 |
| 2 | +--- | ||
| 3 | + | ||
| 4 | +* Added fade option (duration in ms) for fading in/out tooltips; IE <= 6 is excluded when bgiframe plugin is included | ||
| 5 | +* Fixed imagemaps in IE, added back example | ||
| 6 | +* Added positionLeft-option - positions the tooltip to the left of the cursor | ||
| 7 | +* Remove deprecated $.fn.Tooltip in favor of $.fn.tooltip | ||
| 8 | + | ||
| 9 | +1.2 | ||
| 10 | +--- | ||
| 11 | + | ||
| 12 | +* Improved bodyHandler option to accept HTML strings, DOM elements and jQuery objects as the return value | ||
| 13 | +* Fixed bug in Safari 3 where to tooltip is initially visible, by first appending to DOM then hiding it | ||
| 14 | +* Improvement for viewport-border-positioning: Add the classes "viewport-right" and "viewport-bottom" when the element is moved at the viewport border. | ||
| 15 | +* Moved and enhanced documentation to docs.jquery.com | ||
| 16 | +* Added examples for bodyHandler: footnote-tooltip and thumbnail | ||
| 17 | +* Added id option, defaults to "tooltip", override to use a different id in your stylesheet | ||
| 18 | +* Moved demo tooltip style to screen.css | ||
| 19 | +* Moved demo files to demo folder and dependencies to lib folder | ||
| 20 | +* Dropped image map example - completely incompatible with IE; image maps aren't supported anymore | ||
| 21 | + | ||
| 22 | +1.1 | ||
| 23 | +--- | ||
| 24 | + | ||
| 25 | +* Use bgiframe-plugin if available | ||
| 26 | +* Use dimensions-plugin to calculate viewport | ||
| 27 | +* Expose global blocked-property via $.Tooltip.blocked to programmatically disable all tooltips | ||
| 28 | +* Fixed image maps in IE by setting the alt-attribute to an empty string | ||
| 29 | +* Removed event-option (only hover-tooltips now) | ||
| 30 | +* Simplified event-handling (using hover instead of mouseover und mouseout) | ||
| 31 | +* Added another "pretty" example | ||
| 32 | +* Added top and left options to specify tooltip offset | ||
| 33 | +* Reworked example page: New layout, code examples | ||
| 34 | + | ||
| 35 | +1.0 | ||
| 36 | +--- | ||
| 37 | + | ||
| 38 | * first release considered stable | 38 | * first release considered stable |
| 39 | \ No newline at end of file | 39 | \ No newline at end of file |
setup/wizard/resources/jquery-tooltip/demo/chili-1.7.pack.js
| 1 | -eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('8={3b:"1.6",2o:"1B.1Y,1B.23,1B.2e",2i:"",2H:1a,12:"",2C:1a,Z:"",2a:\'<H V="$0">$$</H>\',R:"&#F;",1j:"&#F;&#F;&#F;&#F;",1f:"&#F;<1W/>",3c:5(){9 $(y).39("1k")[0]},I:{},N:{}};(5($){$(5(){5 1J(l,a){5 2I(A,h){4 3=(1v h.3=="1h")?h.3:h.3.1w;k.1m({A:A,3:"("+3+")",u:1+(3.c(/\\\\./g,"%").c(/\\[.*?\\]/g,"%").3a(/\\((?!\\?)/g)||[]).u,z:(h.z)?h.z:8.2a})}5 2z(){4 1E=0;4 1x=x 2A;Q(4 i=0;i<k.u;i++){4 3=k[i].3;3=3.c(/\\\\\\\\|\\\\(\\d+)/g,5(m,1F){9!1F?m:"\\\\"+(1E+1+1t(1F))});1x.1m(3);1E+=k[i].u}4 1w=1x.3d("|");9 x 1u(1w,(a.3g)?"2j":"g")}5 1S(o){9 o.c(/&/g,"&3h;").c(/</g,"&3e;")}5 1R(o){9 o.c(/ +/g,5(1X){9 1X.c(/ /g,R)})}5 G(o){o=1S(o);7(R){o=1R(o)}9 o}5 2m(2E){4 i=0;4 j=1;4 h;19(h=k[i++]){4 1b=D;7(1b[j]){4 1U=/(\\\\\\$)|(?:\\$\\$)|(?:\\$(\\d+))/g;4 z=h.z.c(1U,5(m,1V,K){4 3f=\'\';7(1V){9"$"}v 7(!K){9 G(1b[j])}v 7(K=="0"){9 h.A}v{9 G(1b[j+1t(K,10)])}});4 1A=D[D.u-2];4 2h=D[D.u-1];4 2G=2h.2v(11,1A);11=1A+2E.u;14+=G(2G)+z;9 z}v{j+=h.u}}}4 R=8.R;4 k=x 2A;Q(4 A 2r a.k){2I(A,a.k[A])}4 14="";4 11=0;l.c(2z(),2m);4 2y=l.2v(11,l.u);14+=G(2y);9 14}5 2B(X){7(!8.N[X]){4 Y=\'<Y 32="1p" 33="p/2u"\'+\' 30="\'+X+\'">\';8.N[X]=1H;7($.31.34){4 W=J.1L(Y);4 $W=$(W);$("2d").1O($W)}v{$("2d").1O(Y)}}}5 1q(e,a){4 l=e&&e.1g&&e.1g[0]&&e.1g[0].37;7(!l)l="";l=l.c(/\\r\\n?/g,"\\n");4 C=1J(l,a);7(8.1j){C=C.c(/\\t/g,8.1j)}7(8.1f){C=C.c(/\\n/g,8.1f)}$(e).38(C)}5 1o(q,13){4 1l={12:8.12,2x:q+".1d",Z:8.Z,2w:q+".2u"};4 B;7(13&&1v 13=="2l")B=$.35(1l,13);v B=1l;9{a:B.12+B.2x,1p:B.Z+B.2w}}7($.2q)$.2q({36:"2l.15"});4 2n=x 1u("\\\\b"+8.2i+"\\\\b","2j");4 1e=[];$(8.2o).2D(5(){4 e=y;4 1n=$(e).3i("V");7(!1n){9}4 q=$.3u(1n.c(2n,""));7(\'\'!=q){1e.1m(e);4 f=1o(q,e.15);7(8.2H||e.15){7(!8.N[f.a]){1D{8.N[f.a]=1H;$.3v(f.a,5(M){M.f=f.a;8.I[f.a]=M;7(8.2C){2B(f.1p)}$("."+q).2D(5(){4 f=1o(q,y.15);7(M.f==f.a){1q(y,M)}})})}1I(3s){3t("a 3w Q: "+q+\'@\'+3z)}}}v{4 a=8.I[f.a];7(a){1q(e,a)}}}});7(J.1i&&J.1i.29){5 22(p){7(\'\'==p){9""}1z{4 16=(x 3A()).2k()}19(p.3x(16)>-1);p=p.c(/\\<1W[^>]*?\\>/3y,16);4 e=J.1L(\'<1k>\');e.3l=p;p=e.3m.c(x 1u(16,"g"),\'\\r\\n\');9 p}4 T="";4 18=1G;$(1e).3j().G("1k").U("2c",5(){18=y}).U("1M",5(){7(18==y)T=J.1i.29().3k});$("3n").U("3q",5(){7(\'\'!=T){2p.3r.3o(\'3p\',22(T));2V.2R=1a}}).U("2c",5(){T=""}).U("1M",5(){18=1G})}})})(1Z);8.I["1Y.1d"]={k:{2M:{3:/\\/\\*[^*]*\\*+(?:[^\\/][^*]*\\*+)*\\//},25:{3:/\\<!--(?:.|\\n)*?--\\>/},2f:{3:/\\/\\/.*/},2P:{3:/2L|2T|2J|2O|2N|2X|2K|2Z|2U|2S|2W|2Y|2Q|51|c-50/},53:{3:/\\/[^\\/\\\\\\n]*(?:\\\\.[^\\/\\\\\\n]*)*\\/[52]*/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},4X:{3:/\\b(D|1N|1K|1I|2t|2s|4W|1z|v|1a|Q|5|7|2r|4Z|x|1G|9|1Q|y|1H|1D|1v|4|4Y|19|59)\\b/},1y:{3:/\\b(58|2k|2p|5b|5a|55|J|54|57|1t|56|4L|4K|4N|4M|4H|4G|4J)\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/},4I:{3:/(\\$|1Z)/}}};8.I["23.1d"]={k:{25:{3:/\\<!--(?:.|\\n)*?--\\>/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/}}};8.I["2e.1d"]={k:{4S:{3:/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//},2f:{3:/(?:\\/\\/.*)|(?:[^\\\\]\\#.*)/},4V:{3:/\\\'[^\\\'\\\\]*(?:\\\\.[^\\\'\\\\]*)*\\\'/},4U:{3:/\\"[^\\"\\\\]*(?:\\\\.[^\\"\\\\]*)*\\"/},4P:{3:/\\b(?:[4O][2b][1s][1s]|[4R][4Q][2b][1P]|[5c][5v][1s][5u][1P])\\b/},5x:{3:/\\b[+-]?(\\d*\\.?\\d+|\\d+\\.?\\d*)([1r][+-]?\\d+)?\\b/},5y:{3:/\\b(?:5z|5w(?:5A|5E(?:5F(?:17|1c)|5G(?:17|1c))|17|1T|5B|5C|5D(?:17|1T|1c)|1c)|P(?:5h(?:5k|5j)|5e(?:5d|5g(?:5f|5l)|5r|E(?:5t|5s)|5n(?:5m|5p)|L(?:3X|3W)|O(?:S|3Y(?:3T|3S|3V))|3U|S(?:44|47|46)|41))|40)\\b/},1y:{3:/(?:\\$43|\\$42|\\$3R|\\$3G|\\$3F|\\$3I|\\$3H|\\$3C|\\$3B|\\$3D)\\b/},28:{3:/\\b(?:3O|3N|3P|3K|3J|3M|3L|48|4v|1N|1K|1I|4u|V|4x|4w|2t|4r|2s|4q|1z|4t|v|4s|4D|4C|4F|4E|4z|4y|4B|4A|4p|4d|2F|2F|4g|Q|4f|5|1y|7|4a|4m|4l|4o|4i|4k|x|4j|4h|4n|4b|4c|49|4e|3Q|3E|9|45|1Q|y|3Z|1D|5o|5q|4|19|5i)\\b/},2g:{3:/\\$(\\w+)/,z:\'<H V="28">$</H><H V="2g">$1</H>\'},1C:{3:/(?:\\<\\?[24][4T][24])|(?:\\<\\?)|(?:\\?\\>)/}}}',62,353,'|||exp|var|function||if|ChiliBook|return|recipe||replace||el|path||step|||steps|ingredients|||str|text|recipeName||||length|else||new|this|replacement|stepName|settings|dish|arguments||160|filter|span|recipes|document|||recipeLoaded|required|||for|replaceSpace||insidePRE|bind|class|domLink|stylesheetPath|link|stylesheetFolder||lastIndex|recipeFolder|options|perfect|chili|newline|ERROR|downPRE|while|false|aux|WARNING|js|codes|replaceNewLine|childNodes|string|selection|replaceTab|pre|settingsDef|push|elClass|getPath|stylesheet|makeDish|eE|Ll|parseInt|RegExp|typeof|source|exps|global|do|offset|code|tag|try|prevLength|aNum|null|true|catch|cook|case|createElement|mouseup|break|append|Ee|switch|replaceSpaces|escapeHTML|NOTICE|pattern|escaped|br|spaces|mix|jQuery|avalue|entity|preformatted|xml|Pp|htcom|aname|numbers|keyword|createRange|defaultReplacement|Uu|mousedown|head|php|com|variable|input|elementClass|gi|valueOf|object|chef|selectClass|elementPath|window|metaobjects|in|default|continue|css|substring|stylesheetFile|recipeFile|lastUnmatched|knowHow|Array|checkCSS|stylesheetLoading|each|matched|extends|unmatched|recipeLoading|prepareStep|unblockUI|ajaxSubmit|silverlight|jscom|unblock|block|plugin|clearFields|returnValue|fieldValue|blockUI|formSerialize|event|resetForm|ajaxForm|clearForm|fieldSerialize|href|browser|rel|type|msie|extend|selector|data|html|next|match|version|getPRE|join|lt|bit|ignoreCase|amp|attr|parents|htmlText|innerHTML|innerText|body|setData|Text|copy|clipboardData|recipeNotAvailable|alert|trim|getJSON|unavailable|indexOf|ig|recipePath|Date|_SESSION|_SERVER|php_errormsg|require_once|_GET|_FILES|_REQUEST|_POST|__METHOD__|__LINE__|and|abstract|__FILE__|__CLASS__|__FUNCTION__|require|_ENV|END|CONT|PREFIX|START|OCALSTATEDIR|IBDIR|UTPUT_HANDLER_|throw|__COMPILER_HALT_OFFSET__|VERSION|_COOKIE|GLOBALS|API|static|YSCONFDIR|HLIB_SUFFIX|array|protected|implements|print|private|exit|public|foreach|final|or|isset|old_function|list|include_once|include|php_user_filter|interface|exception|die|declare|elseif|echo|cfunction|as|const|clone|endswitch|endif|eval|endwhile|enddeclare|empty|endforeach|endfor|isNaN|NaN|jquery|Infinity|clearTimeout|setTimeout|clearInterval|setInterval|Nn|value|Rr|Tt|mlcom|Hh|string2|string1|delete|keywords|void|instanceof|content|taconite|gim|regexp|escape|constructor|parseFloat|unescape|toString|with|prototype|element|Ff|BINDIR|HP_|PATH|CONFIG_FILE_|EAR_|xor|INSTALL_DIR|EXTENSION_DIR|SCAN_DIR|MAX|INT_|unset|SIZE|use|DATADIR|XTENSION_DIR|OL|Ss|Aa|E_|number|const1|DEFAULT_INCLUDE_PATH|ALL|PARSE|STRICT|USER_|CO|MPILE_|RE_'.split('|'),0,{})) | 1 | +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('8={3b:"1.6",2o:"1B.1Y,1B.23,1B.2e",2i:"",2H:1a,12:"",2C:1a,Z:"",2a:\'<H V="$0">$$</H>\',R:"&#F;",1j:"&#F;&#F;&#F;&#F;",1f:"&#F;<1W/>",3c:5(){9 $(y).39("1k")[0]},I:{},N:{}};(5($){$(5(){5 1J(l,a){5 2I(A,h){4 3=(1v h.3=="1h")?h.3:h.3.1w;k.1m({A:A,3:"("+3+")",u:1+(3.c(/\\\\./g,"%").c(/\\[.*?\\]/g,"%").3a(/\\((?!\\?)/g)||[]).u,z:(h.z)?h.z:8.2a})}5 2z(){4 1E=0;4 1x=x 2A;Q(4 i=0;i<k.u;i++){4 3=k[i].3;3=3.c(/\\\\\\\\|\\\\(\\d+)/g,5(m,1F){9!1F?m:"\\\\"+(1E+1+1t(1F))});1x.1m(3);1E+=k[i].u}4 1w=1x.3d("|");9 x 1u(1w,(a.3g)?"2j":"g")}5 1S(o){9 o.c(/&/g,"&3h;").c(/</g,"&3e;")}5 1R(o){9 o.c(/ +/g,5(1X){9 1X.c(/ /g,R)})}5 G(o){o=1S(o);7(R){o=1R(o)}9 o}5 2m(2E){4 i=0;4 j=1;4 h;19(h=k[i++]){4 1b=D;7(1b[j]){4 1U=/(\\\\\\$)|(?:\\$\\$)|(?:\\$(\\d+))/g;4 z=h.z.c(1U,5(m,1V,K){4 3f=\'\';7(1V){9"$"}v 7(!K){9 G(1b[j])}v 7(K=="0"){9 h.A}v{9 G(1b[j+1t(K,10)])}});4 1A=D[D.u-2];4 2h=D[D.u-1];4 2G=2h.2v(11,1A);11=1A+2E.u;14+=G(2G)+z;9 z}v{j+=h.u}}}4 R=8.R;4 k=x 2A;Q(4 A 2r a.k){2I(A,a.k[A])}4 14="";4 11=0;l.c(2z(),2m);4 2y=l.2v(11,l.u);14+=G(2y);9 14}5 2B(X){7(!8.N[X]){4 Y=\'<Y 32="1p" 33="p/2u"\'+\' 30="\'+X+\'">\';8.N[X]=1H;7($.31.34){4 W=J.1L(Y);4 $W=$(W);$("2d").1O($W)}v{$("2d").1O(Y)}}}5 1q(e,a){4 l=e&&e.1g&&e.1g[0]&&e.1g[0].37;7(!l)l="";l=l.c(/\\r\\n?/g,"\\n");4 C=1J(l,a);7(8.1j){C=C.c(/\\t/g,8.1j)}7(8.1f){C=C.c(/\\n/g,8.1f)}$(e).38(C)}5 1o(q,13){4 1l={12:8.12,2x:q+".1d",Z:8.Z,2w:q+".2u"};4 B;7(13&&1v 13=="2l")B=$.35(1l,13);v B=1l;9{a:B.12+B.2x,1p:B.Z+B.2w}}7($.2q)$.2q({36:"2l.15"});4 2n=x 1u("\\\\b"+8.2i+"\\\\b","2j");4 1e=[];$(8.2o).2D(5(){4 e=y;4 1n=$(e).3i("V");7(!1n){9}4 q=$.3u(1n.c(2n,""));7(\'\'!=q){1e.1m(e);4 f=1o(q,e.15);7(8.2H||e.15){7(!8.N[f.a]){1D{8.N[f.a]=1H;$.3v(f.a,5(M){M.f=f.a;8.I[f.a]=M;7(8.2C){2B(f.1p)}$("."+q).2D(5(){4 f=1o(q,y.15);7(M.f==f.a){1q(y,M)}})})}1I(3s){3t("a 3w Q: "+q+\'@\'+3z)}}}v{4 a=8.I[f.a];7(a){1q(e,a)}}}});7(J.1i&&J.1i.29){5 22(p){7(\'\'==p){9""}1z{4 16=(x 3A()).2k()}19(p.3x(16)>-1);p=p.c(/\\<1W[^>]*?\\>/3y,16);4 e=J.1L(\'<1k>\');e.3l=p;p=e.3m.c(x 1u(16,"g"),\'\\r\\n\');9 p}4 T="";4 18=1G;$(1e).3j().G("1k").U("2c",5(){18=y}).U("1M",5(){7(18==y)T=J.1i.29().3k});$("3n").U("3q",5(){7(\'\'!=T){2p.3r.3o(\'3p\',22(T));2V.2R=1a}}).U("2c",5(){T=""}).U("1M",5(){18=1G})}})})(1Z);8.I["1Y.1d"]={k:{2M:{3:/\\/\\*[^*]*\\*+(?:[^\\/][^*]*\\*+)*\\//},25:{3:/\\<!--(?:.|\\n)*?--\\>/},2f:{3:/\\/\\/.*/},2P:{3:/2L|2T|2J|2O|2N|2X|2K|2Z|2U|2S|2W|2Y|2Q|51|c-50/},53:{3:/\\/[^\\/\\\\\\n]*(?:\\\\.[^\\/\\\\\\n]*)*\\/[52]*/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},4X:{3:/\\b(D|1N|1K|1I|2t|2s|4W|1z|v|1a|Q|5|7|2r|4Z|x|1G|9|1Q|y|1H|1D|1v|4|4Y|19|59)\\b/},1y:{3:/\\b(58|2k|2p|5b|5a|55|J|54|57|1t|56|4L|4K|4N|4M|4H|4G|4J)\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/},4I:{3:/(\\$|1Z)/}}};8.I["23.1d"]={k:{25:{3:/\\<!--(?:.|\\n)*?--\\>/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/}}};8.I["2e.1d"]={k:{4S:{3:/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//},2f:{3:/(?:\\/\\/.*)|(?:[^\\\\]\\#.*)/},4V:{3:/\\\'[^\\\'\\\\]*(?:\\\\.[^\\\'\\\\]*)*\\\'/},4U:{3:/\\"[^\\"\\\\]*(?:\\\\.[^\\"\\\\]*)*\\"/},4P:{3:/\\b(?:[4O][2b][1s][1s]|[4R][4Q][2b][1P]|[5c][5v][1s][5u][1P])\\b/},5x:{3:/\\b[+-]?(\\d*\\.?\\d+|\\d+\\.?\\d*)([1r][+-]?\\d+)?\\b/},5y:{3:/\\b(?:5z|5w(?:5A|5E(?:5F(?:17|1c)|5G(?:17|1c))|17|1T|5B|5C|5D(?:17|1T|1c)|1c)|P(?:5h(?:5k|5j)|5e(?:5d|5g(?:5f|5l)|5r|E(?:5t|5s)|5n(?:5m|5p)|L(?:3X|3W)|O(?:S|3Y(?:3T|3S|3V))|3U|S(?:44|47|46)|41))|40)\\b/},1y:{3:/(?:\\$43|\\$42|\\$3R|\\$3G|\\$3F|\\$3I|\\$3H|\\$3C|\\$3B|\\$3D)\\b/},28:{3:/\\b(?:3O|3N|3P|3K|3J|3M|3L|48|4v|1N|1K|1I|4u|V|4x|4w|2t|4r|2s|4q|1z|4t|v|4s|4D|4C|4F|4E|4z|4y|4B|4A|4p|4d|2F|2F|4g|Q|4f|5|1y|7|4a|4m|4l|4o|4i|4k|x|4j|4h|4n|4b|4c|49|4e|3Q|3E|9|45|1Q|y|3Z|1D|5o|5q|4|19|5i)\\b/},2g:{3:/\\$(\\w+)/,z:\'<H V="28">$</H><H V="2g">$1</H>\'},1C:{3:/(?:\\<\\?[24][4T][24])|(?:\\<\\?)|(?:\\?\\>)/}}}',62,353,'|||exp|var|function||if|ChiliBook|return|recipe||replace||el|path||step|||steps|ingredients|||str|text|recipeName||||length|else||new|this|replacement|stepName|settings|dish|arguments||160|filter|span|recipes|document|||recipeLoaded|required|||for|replaceSpace||insidePRE|bind|class|domLink|stylesheetPath|link|stylesheetFolder||lastIndex|recipeFolder|options|perfect|chili|newline|ERROR|downPRE|while|false|aux|WARNING|js|codes|replaceNewLine|childNodes|string|selection|replaceTab|pre|settingsDef|push|elClass|getPath|stylesheet|makeDish|eE|Ll|parseInt|RegExp|typeof|source|exps|global|do|offset|code|tag|try|prevLength|aNum|null|true|catch|cook|case|createElement|mouseup|break|append|Ee|switch|replaceSpaces|escapeHTML|NOTICE|pattern|escaped|br|spaces|mix|jQuery|avalue|entity|preformatted|xml|Pp|htcom|aname|numbers|keyword|createRange|defaultReplacement|Uu|mousedown|head|php|com|variable|input|elementClass|gi|valueOf|object|chef|selectClass|elementPath|window|metaobjects|in|default|continue|css|substring|stylesheetFile|recipeFile|lastUnmatched|knowHow|Array|checkCSS|stylesheetLoading|each|matched|extends|unmatched|recipeLoading|prepareStep|unblockUI|ajaxSubmit|silverlight|jscom|unblock|block|plugin|clearFields|returnValue|fieldValue|blockUI|formSerialize|event|resetForm|ajaxForm|clearForm|fieldSerialize|href|browser|rel|type|msie|extend|selector|data|html|next|match|version|getPRE|join|lt|bit|ignoreCase|amp|attr|parents|htmlText|innerHTML|innerText|body|setData|Text|copy|clipboardData|recipeNotAvailable|alert|trim|getJSON|unavailable|indexOf|ig|recipePath|Date|_SESSION|_SERVER|php_errormsg|require_once|_GET|_FILES|_REQUEST|_POST|__METHOD__|__LINE__|and|abstract|__FILE__|__CLASS__|__FUNCTION__|require|_ENV|END|CONT|PREFIX|START|OCALSTATEDIR|IBDIR|UTPUT_HANDLER_|throw|__COMPILER_HALT_OFFSET__|VERSION|_COOKIE|GLOBALS|API|static|YSCONFDIR|HLIB_SUFFIX|array|protected|implements|print|private|exit|public|foreach|final|or|isset|old_function|list|include_once|include|php_user_filter|interface|exception|die|declare|elseif|echo|cfunction|as|const|clone|endswitch|endif|eval|endwhile|enddeclare|empty|endforeach|endfor|isNaN|NaN|jquery|Infinity|clearTimeout|setTimeout|clearInterval|setInterval|Nn|value|Rr|Tt|mlcom|Hh|string2|string1|delete|keywords|void|instanceof|content|taconite|gim|regexp|escape|constructor|parseFloat|unescape|toString|with|prototype|element|Ff|BINDIR|HP_|PATH|CONFIG_FILE_|EAR_|xor|INSTALL_DIR|EXTENSION_DIR|SCAN_DIR|MAX|INT_|unset|SIZE|use|DATADIR|XTENSION_DIR|OL|Ss|Aa|E_|number|const1|DEFAULT_INCLUDE_PATH|ALL|PARSE|STRICT|USER_|CO|MPILE_|RE_'.split('|'),0,{})) |
setup/wizard/resources/jquery-tooltip/demo/formtip.html
| @@ -3,16 +3,16 @@ | @@ -3,16 +3,16 @@ | ||
| 3 | <head> | 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| 5 | <title>jQuery Tooltip Plugin Demo</title> | 5 | <title>jQuery Tooltip Plugin Demo</title> |
| 6 | - | ||
| 7 | -<link rel="stylesheet" href="../jquery.formtip.css" /> | ||
| 8 | -<link rel="stylesheet" href="screen.css" /> | ||
| 9 | -<script src="../lib/jquery.js" type="text/javascript"></script> | ||
| 10 | -<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script> | ||
| 11 | -<script src="../lib/jquery.dimensions.js" type="text/javascript"></script> | ||
| 12 | -<script src="../lib/jquery.delegate.js" type="text/javascript"></script> | ||
| 13 | -<script src="../jquery.formtip.js" type="text/javascript"></script> | ||
| 14 | - | ||
| 15 | -<script src="chili-1.7.pack.js" type="text/javascript"></script> | 6 | + |
| 7 | +<link rel="stylesheet" href="../jquery.formtip.css" /> | ||
| 8 | +<link rel="stylesheet" href="screen.css" /> | ||
| 9 | +<script src="../lib/jquery.js" type="text/javascript"></script> | ||
| 10 | +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script> | ||
| 11 | +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script> | ||
| 12 | +<script src="../lib/jquery.delegate.js" type="text/javascript"></script> | ||
| 13 | +<script src="../jquery.formtip.js" type="text/javascript"></script> | ||
| 14 | + | ||
| 15 | +<script src="chili-1.7.pack.js" type="text/javascript"></script> | ||
| 16 | 16 | ||
| 17 | <script type="text/javascript"> | 17 | <script type="text/javascript"> |
| 18 | $(function() { | 18 | $(function() { |
| @@ -22,8 +22,8 @@ $(function() { | @@ -22,8 +22,8 @@ $(function() { | ||
| 22 | return element.parent(); | 22 | return element.parent(); |
| 23 | }, | 23 | }, |
| 24 | left: -5 | 24 | left: -5 |
| 25 | - }); | ||
| 26 | -}); | 25 | + }); |
| 26 | +}); | ||
| 27 | </script> | 27 | </script> |
| 28 | 28 | ||
| 29 | <style type="text/css"> | 29 | <style type="text/css"> |
| @@ -36,11 +36,11 @@ form.test div { | @@ -36,11 +36,11 @@ form.test div { | ||
| 36 | form.test p { | 36 | form.test p { |
| 37 | border: 1px solid #999; | 37 | border: 1px solid #999; |
| 38 | } | 38 | } |
| 39 | -</style> | ||
| 40 | - | 39 | +</style> |
| 40 | + | ||
| 41 | </head> | 41 | </head> |
| 42 | -<body> | ||
| 43 | -<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1> | 42 | +<body> |
| 43 | +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1> | ||
| 44 | <div id="main"> | 44 | <div id="main"> |
| 45 | <form> | 45 | <form> |
| 46 | <fieldset id="set1"> | 46 | <fieldset id="set1"> |
| @@ -51,9 +51,9 @@ form.test p { | @@ -51,9 +51,9 @@ form.test p { | ||
| 51 | <br/> | 51 | <br/> |
| 52 | <input title="Note that the tooltip disappears when clicking the input elementthe input elementthe input element" type="text" value="Test" name="action" id="text1"/> | 52 | <input title="Note that the tooltip disappears when clicking the input elementthe input elementthe input element" type="text" value="Test" name="action" id="text1"/> |
| 53 | 53 | ||
| 54 | - <h3>Code</h3> | ||
| 55 | - <pre><code class="mix">$('#set1 *').tooltip();</code></pre> | ||
| 56 | - <input title="Another tooltip element I" type="text" value="Test"/> | 54 | + <h3>Code</h3> |
| 55 | + <pre><code class="mix">$('#set1 *').tooltip();</code></pre> | ||
| 56 | + <input title="Another tooltip element I" type="text" value="Test"/> | ||
| 57 | </fieldset> | 57 | </fieldset> |
| 58 | </form> | 58 | </form> |
| 59 | 59 | ||
| @@ -73,14 +73,14 @@ form.test p { | @@ -73,14 +73,14 @@ form.test p { | ||
| 73 | <br/> | 73 | <br/> |
| 74 | <input title="Another tooltip element VI" type="text" value="Test"/> | 74 | <input title="Another tooltip element VI" type="text" value="Test"/> |
| 75 | </div> | 75 | </div> |
| 76 | - </form> | ||
| 77 | - | 76 | + </form> |
| 77 | + | ||
| 78 | </div> | 78 | </div> |
| 79 | <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> | 79 | <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| 80 | </script> | 80 | </script> |
| 81 | <script type="text/javascript"> | 81 | <script type="text/javascript"> |
| 82 | _uacct = "UA-2623402-1"; | 82 | _uacct = "UA-2623402-1"; |
| 83 | urchinTracker(); | 83 | urchinTracker(); |
| 84 | -</script> | 84 | +</script> |
| 85 | </body> | 85 | </body> |
| 86 | </html> | 86 | </html> |
| 87 | \ No newline at end of file | 87 | \ No newline at end of file |
setup/wizard/resources/jquery-tooltip/demo/index.html
| @@ -3,41 +3,41 @@ | @@ -3,41 +3,41 @@ | ||
| 3 | <head> | 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| 5 | <title>jQuery Tooltip Plugin Demo</title> | 5 | <title>jQuery Tooltip Plugin Demo</title> |
| 6 | - | ||
| 7 | -<link rel="stylesheet" href="../jquery.tooltip.css" /> | ||
| 8 | -<link rel="stylesheet" href="screen.css" /> | ||
| 9 | -<script src="../lib/jquery.js" type="text/javascript"></script> | ||
| 10 | -<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script> | ||
| 11 | -<script src="../lib/jquery.dimensions.js" type="text/javascript"></script> | ||
| 12 | -<script src="../jquery.tooltip.js" type="text/javascript"></script> | ||
| 13 | - | ||
| 14 | -<script src="chili-1.7.pack.js" type="text/javascript"></script> | 6 | + |
| 7 | +<link rel="stylesheet" href="../jquery.tooltip.css" /> | ||
| 8 | +<link rel="stylesheet" href="screen.css" /> | ||
| 9 | +<script src="../lib/jquery.js" type="text/javascript"></script> | ||
| 10 | +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script> | ||
| 11 | +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script> | ||
| 12 | +<script src="../jquery.tooltip.js" type="text/javascript"></script> | ||
| 13 | + | ||
| 14 | +<script src="chili-1.7.pack.js" type="text/javascript"></script> | ||
| 15 | 15 | ||
| 16 | <script type="text/javascript"> | 16 | <script type="text/javascript"> |
| 17 | $(function() { | 17 | $(function() { |
| 18 | -$('#set1 *').tooltip(); | ||
| 19 | - | ||
| 20 | -$("#foottip a").tooltip({ | ||
| 21 | - bodyHandler: function() { | ||
| 22 | - return $($(this).attr("href")).html(); | ||
| 23 | - }, | ||
| 24 | - showURL: false | ||
| 25 | -}); | 18 | +$('#set1 *').tooltip(); |
| 19 | + | ||
| 20 | +$("#foottip a").tooltip({ | ||
| 21 | + bodyHandler: function() { | ||
| 22 | + return $($(this).attr("href")).html(); | ||
| 23 | + }, | ||
| 24 | + showURL: false | ||
| 25 | +}); | ||
| 26 | 26 | ||
| 27 | $('#tonus').tooltip({ | 27 | $('#tonus').tooltip({ |
| 28 | delay: 0, | 28 | delay: 0, |
| 29 | - showURL: false, | ||
| 30 | - bodyHandler: function() { | ||
| 31 | - return $("<img/>").attr("src", this.src); | 29 | + showURL: false, |
| 30 | + bodyHandler: function() { | ||
| 31 | + return $("<img/>").attr("src", this.src); | ||
| 32 | } | 32 | } |
| 33 | -}); | ||
| 34 | - | ||
| 35 | -$('#yahoo a').tooltip({ | ||
| 36 | - track: true, | ||
| 37 | - delay: 0, | ||
| 38 | - showURL: false, | 33 | +}); |
| 34 | + | ||
| 35 | +$('#yahoo a').tooltip({ | ||
| 36 | + track: true, | ||
| 37 | + delay: 0, | ||
| 38 | + showURL: false, | ||
| 39 | showBody: " - ", | 39 | showBody: " - ", |
| 40 | - fade: 250 | 40 | + fade: 250 |
| 41 | }); | 41 | }); |
| 42 | 42 | ||
| 43 | $("select").tooltip({ | 43 | $("select").tooltip({ |
| @@ -45,44 +45,44 @@ $("select").tooltip({ | @@ -45,44 +45,44 @@ $("select").tooltip({ | ||
| 45 | }); | 45 | }); |
| 46 | 46 | ||
| 47 | $("map > area").tooltip({ positionLeft: true }); | 47 | $("map > area").tooltip({ positionLeft: true }); |
| 48 | - | ||
| 49 | -$("#fancy, #fancy2").tooltip({ | ||
| 50 | - track: true, | ||
| 51 | - delay: 0, | ||
| 52 | - showURL: false, | ||
| 53 | - fixPNG: true, | ||
| 54 | - showBody: " - ", | ||
| 55 | - extraClass: "pretty fancy", | ||
| 56 | - top: -15, | ||
| 57 | - left: 5 | 48 | + |
| 49 | +$("#fancy, #fancy2").tooltip({ | ||
| 50 | + track: true, | ||
| 51 | + delay: 0, | ||
| 52 | + showURL: false, | ||
| 53 | + fixPNG: true, | ||
| 54 | + showBody: " - ", | ||
| 55 | + extraClass: "pretty fancy", | ||
| 56 | + top: -15, | ||
| 57 | + left: 5 | ||
| 58 | }); | 58 | }); |
| 59 | 59 | ||
| 60 | -$('#pretty').tooltip({ | ||
| 61 | - track: true, | ||
| 62 | - delay: 0, | ||
| 63 | - showURL: false, | ||
| 64 | - showBody: " - ", | ||
| 65 | - extraClass: "pretty", | 60 | +$('#pretty').tooltip({ |
| 61 | + track: true, | ||
| 62 | + delay: 0, | ||
| 63 | + showURL: false, | ||
| 64 | + showBody: " - ", | ||
| 65 | + extraClass: "pretty", | ||
| 66 | fixPNG: true, | 66 | fixPNG: true, |
| 67 | left: -120 | 67 | left: -120 |
| 68 | }); | 68 | }); |
| 69 | - | ||
| 70 | -$('#right a').tooltip({ | ||
| 71 | - track: true, | ||
| 72 | - delay: 0, | 69 | + |
| 70 | +$('#right a').tooltip({ | ||
| 71 | + track: true, | ||
| 72 | + delay: 0, | ||
| 73 | showURL: false, | 73 | showURL: false, |
| 74 | - extraClass: "right" | ||
| 75 | -}); | ||
| 76 | -$('#right2 a').tooltip({ showURL: false, positionLeft: true }); | ||
| 77 | - | ||
| 78 | -$("#block").click($.tooltip.block); | ||
| 79 | - | ||
| 80 | -}); | ||
| 81 | -</script> | ||
| 82 | - | 74 | + extraClass: "right" |
| 75 | +}); | ||
| 76 | +$('#right2 a').tooltip({ showURL: false, positionLeft: true }); | ||
| 77 | + | ||
| 78 | +$("#block").click($.tooltip.block); | ||
| 79 | + | ||
| 80 | +}); | ||
| 81 | +</script> | ||
| 82 | + | ||
| 83 | </head> | 83 | </head> |
| 84 | -<body> | ||
| 85 | -<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1> | 84 | +<body> |
| 85 | +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1> | ||
| 86 | <div id="main"> | 86 | <div id="main"> |
| 87 | <fieldset id="set1"> | 87 | <fieldset id="set1"> |
| 88 | <legend>Three elements with tooltips, default settings</legend> | 88 | <legend>Three elements with tooltips, default settings</legend> |
| @@ -90,103 +90,103 @@ $("#block").click($.tooltip.block); | @@ -90,103 +90,103 @@ $("#block").click($.tooltip.block); | ||
| 90 | <br/> | 90 | <br/> |
| 91 | <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label> | 91 | <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label> |
| 92 | <br/> | 92 | <br/> |
| 93 | - <input title="Note that the tooltip disappears when clicking the input element" type="text" value="Test" name="action" id="text1"/> | ||
| 94 | - | ||
| 95 | - <h3>Code</h3> | 93 | + <input title="Note that the tooltip disappears when clicking the input element" type="text" value="Test" name="action" id="text1"/> |
| 94 | + | ||
| 95 | + <h3>Code</h3> | ||
| 96 | <pre><code class="mix">$('#set1 *').tooltip();</code></pre> | 96 | <pre><code class="mix">$('#set1 *').tooltip();</code></pre> |
| 97 | - </fieldset> | ||
| 98 | - | ||
| 99 | - <fieldset id="foottip"> | ||
| 100 | - <legend>Using bodyHandler to display footnotes in the tooltip</legend> | ||
| 101 | - Some text referring to a <a href="#footnote">footnote</a>. | ||
| 102 | - <br/> | ||
| 103 | - <br/> | ||
| 104 | - <br/> | ||
| 105 | - <br/> | ||
| 106 | - <br/> | ||
| 107 | - <div id="footnote"><em>And here</em> is the actual footnote, complete with nested <strong>HTML</strong>.</div> | ||
| 108 | - | ||
| 109 | - <h3>Code</h3> | ||
| 110 | - <pre><code class="mix">$("#foottip a").tooltip({ | ||
| 111 | - bodyHandler: function() { | ||
| 112 | - return $($(this).attr("href")).html(); | ||
| 113 | - }, | ||
| 114 | - showURL: false | ||
| 115 | -});</code></pre> | ||
| 116 | - </fieldset> | 97 | + </fieldset> |
| 98 | + | ||
| 99 | + <fieldset id="foottip"> | ||
| 100 | + <legend>Using bodyHandler to display footnotes in the tooltip</legend> | ||
| 101 | + Some text referring to a <a href="#footnote">footnote</a>. | ||
| 102 | + <br/> | ||
| 103 | + <br/> | ||
| 104 | + <br/> | ||
| 105 | + <br/> | ||
| 106 | + <br/> | ||
| 107 | + <div id="footnote"><em>And here</em> is the actual footnote, complete with nested <strong>HTML</strong>.</div> | ||
| 108 | + | ||
| 109 | + <h3>Code</h3> | ||
| 110 | + <pre><code class="mix">$("#foottip a").tooltip({ | ||
| 111 | + bodyHandler: function() { | ||
| 112 | + return $($(this).attr("href")).html(); | ||
| 113 | + }, | ||
| 114 | + showURL: false | ||
| 115 | +});</code></pre> | ||
| 116 | + </fieldset> | ||
| 117 | 117 | ||
| 118 | - <fieldset> | 118 | + <fieldset> |
| 119 | <legend>An image with a tooltip</legend> | 119 | <legend>An image with a tooltip</legend> |
| 120 | - <img id="tonus" src="image.png" height="80" title="No delay. The src value is displayed below the title" /> | ||
| 121 | - <h3>Code</h3> | 120 | + <img id="tonus" src="image.png" height="80" title="No delay. The src value is displayed below the title" /> |
| 121 | + <h3>Code</h3> | ||
| 122 | <pre><code class="mix">$('#tonus').tooltip({ | 122 | <pre><code class="mix">$('#tonus').tooltip({ |
| 123 | delay: 0, | 123 | delay: 0, |
| 124 | showURL: false, | 124 | showURL: false, |
| 125 | bodyHandler: function() { | 125 | bodyHandler: function() { |
| 126 | return $("<img/>").attr("src", this.src); | 126 | return $("<img/>").attr("src", this.src); |
| 127 | } | 127 | } |
| 128 | -});</code></pre> | ||
| 129 | - </fieldset> | ||
| 130 | - | ||
| 131 | - <fieldset> | ||
| 132 | - <legend>Blocking tooltips</legend> | ||
| 133 | - <button id="block">Click this button to block/unblock all tooltips</button> | ||
| 134 | - <pre><code class="mix">$("#block").click($.tooltip.block);</code></pre> | 128 | +});</code></pre> |
| 135 | </fieldset> | 129 | </fieldset> |
| 136 | - | ||
| 137 | - <fieldset> | 130 | + |
| 131 | + <fieldset> | ||
| 132 | + <legend>Blocking tooltips</legend> | ||
| 133 | + <button id="block">Click this button to block/unblock all tooltips</button> | ||
| 134 | + <pre><code class="mix">$("#block").click($.tooltip.block);</code></pre> | ||
| 135 | + </fieldset> | ||
| 136 | + | ||
| 137 | + <fieldset> | ||
| 138 | <legend>The next four links have no delay with tracking and fading, with extra content:</legend> | 138 | <legend>The next four links have no delay with tracking and fading, with extra content:</legend> |
| 139 | <div id="yahoo"> | 139 | <div id="yahoo"> |
| 140 | <a title="Yahoo doo - more content" href="http://yahoo.com">Link to yahoo</a> | 140 | <a title="Yahoo doo - more content" href="http://yahoo.com">Link to yahoo</a> |
| 141 | <a title="Yahoo doo2 - wohooo" href="http://yahoo.com">Link to yahoo1</a> | 141 | <a title="Yahoo doo2 - wohooo" href="http://yahoo.com">Link to yahoo1</a> |
| 142 | <a title="Yahoo doo3" href="http://yahoo.com">Link to yahoo2</a> | 142 | <a title="Yahoo doo3" href="http://yahoo.com">Link to yahoo2</a> |
| 143 | <a title="Yahoo doo4 - buga!" href="http://yahoo.com">Link to yahoo3</a> | 143 | <a title="Yahoo doo4 - buga!" href="http://yahoo.com">Link to yahoo3</a> |
| 144 | - </div> | ||
| 145 | - <select><option>bgiframe test</option></select> | ||
| 146 | - <h3>Code</h3> | 144 | + </div> |
| 145 | + <select><option>bgiframe test</option></select> | ||
| 146 | + <h3>Code</h3> | ||
| 147 | <pre><code class="mix">$('#yahoo a').tooltip({ | 147 | <pre><code class="mix">$('#yahoo a').tooltip({ |
| 148 | track: true, | 148 | track: true, |
| 149 | delay: 0, | 149 | delay: 0, |
| 150 | showURL: false, | 150 | showURL: false, |
| 151 | showBody: " - ", | 151 | showBody: " - ", |
| 152 | fade: 250 | 152 | fade: 250 |
| 153 | -});</code></pre> | ||
| 154 | - </fieldset> | ||
| 155 | - | ||
| 156 | - <fieldset> | ||
| 157 | - <legend>Tooltips with extra classes. Useful for different tooltip styles on a single page.</legend> | ||
| 158 | - <em>Note how the one on the right gets a different background image when at the right viewport border.</em> | ||
| 159 | - <br/> | ||
| 160 | - <span id="fancy" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span> | ||
| 161 | - <span id="fancy2" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span> | ||
| 162 | - <p><span id="pretty" title="I am pretty! - I am a very pretty tooltip, I need lot's of attention from buggers like you! Yes!">And now, for the fancy stuff, a tooltip with an extra class for nice shadows, and some extra content</span></p> | ||
| 163 | - <br/> | ||
| 164 | - <br/> | ||
| 165 | - <br/> | ||
| 166 | - <select><option>bgiframe test</option></select> | ||
| 167 | - <h3>Code</h3> | ||
| 168 | - <pre><code class="mix">$("#fancy, #fancy2").tooltip({ | ||
| 169 | - track: true, | ||
| 170 | - delay: 0, | ||
| 171 | - showURL: false, | ||
| 172 | - opacity: 1, | ||
| 173 | - fixPNG: true, | ||
| 174 | - showBody: " - ", | ||
| 175 | - extraClass: "pretty fancy", | ||
| 176 | - top: -15, | ||
| 177 | - left: 5 | ||
| 178 | -}); | ||
| 179 | - | ||
| 180 | -$('#pretty').tooltip({ | ||
| 181 | - track: true, | ||
| 182 | - delay: 0, | ||
| 183 | - showURL: false, | ||
| 184 | - showBody: " - ", | ||
| 185 | - extraClass: "pretty", | ||
| 186 | - fixPNG: true, | ||
| 187 | - opacity: 0.95, | ||
| 188 | - left: -120 | ||
| 189 | -});</code></pre> | 153 | +});</code></pre> |
| 154 | + </fieldset> | ||
| 155 | + | ||
| 156 | + <fieldset> | ||
| 157 | + <legend>Tooltips with extra classes. Useful for different tooltip styles on a single page.</legend> | ||
| 158 | + <em>Note how the one on the right gets a different background image when at the right viewport border.</em> | ||
| 159 | + <br/> | ||
| 160 | + <span id="fancy" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span> | ||
| 161 | + <span id="fancy2" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span> | ||
| 162 | + <p><span id="pretty" title="I am pretty! - I am a very pretty tooltip, I need lot's of attention from buggers like you! Yes!">And now, for the fancy stuff, a tooltip with an extra class for nice shadows, and some extra content</span></p> | ||
| 163 | + <br/> | ||
| 164 | + <br/> | ||
| 165 | + <br/> | ||
| 166 | + <select><option>bgiframe test</option></select> | ||
| 167 | + <h3>Code</h3> | ||
| 168 | + <pre><code class="mix">$("#fancy, #fancy2").tooltip({ | ||
| 169 | + track: true, | ||
| 170 | + delay: 0, | ||
| 171 | + showURL: false, | ||
| 172 | + opacity: 1, | ||
| 173 | + fixPNG: true, | ||
| 174 | + showBody: " - ", | ||
| 175 | + extraClass: "pretty fancy", | ||
| 176 | + top: -15, | ||
| 177 | + left: 5 | ||
| 178 | +}); | ||
| 179 | + | ||
| 180 | +$('#pretty').tooltip({ | ||
| 181 | + track: true, | ||
| 182 | + delay: 0, | ||
| 183 | + showURL: false, | ||
| 184 | + showBody: " - ", | ||
| 185 | + extraClass: "pretty", | ||
| 186 | + fixPNG: true, | ||
| 187 | + opacity: 0.95, | ||
| 188 | + left: -120 | ||
| 189 | +});</code></pre> | ||
| 190 | </fieldset> | 190 | </fieldset> |
| 191 | 191 | ||
| 192 | <fieldset> | 192 | <fieldset> |
| @@ -237,8 +237,8 @@ $('#pretty').tooltip({ | @@ -237,8 +237,8 @@ $('#pretty').tooltip({ | ||
| 237 | <h3>Code</h3> | 237 | <h3>Code</h3> |
| 238 | <pre><code class="mix">$("map *").tooltip({ positionLeft: true });</code></pre> | 238 | <pre><code class="mix">$("map *").tooltip({ positionLeft: true });</code></pre> |
| 239 | </fieldset> | 239 | </fieldset> |
| 240 | - | ||
| 241 | - <fieldset> | 240 | + |
| 241 | + <fieldset> | ||
| 242 | <legend>Testing repositioning at viewport borders</legend> | 242 | <legend>Testing repositioning at viewport borders</legend> |
| 243 | <p id="right"> | 243 | <p id="right"> |
| 244 | Tooltip with fixed width<br/> | 244 | Tooltip with fixed width<br/> |
| @@ -249,22 +249,22 @@ $('#pretty').tooltip({ | @@ -249,22 +249,22 @@ $('#pretty').tooltip({ | ||
| 249 | Tooltip width auto width<br/> | 249 | Tooltip width auto width<br/> |
| 250 | <a title="Short title" href="http://goggle">Google me!</a><br/> | 250 | <a title="Short title" href="http://goggle">Google me!</a><br/> |
| 251 | <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a> | 251 | <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a> |
| 252 | - </p> | ||
| 253 | - <h3>Code</h3> | ||
| 254 | - <pre><code class="mix">$('#right a').tooltip({ | ||
| 255 | - track: true, | ||
| 256 | - delay: 0, | ||
| 257 | - showURL: false, | ||
| 258 | - extraClass: "right" | ||
| 259 | -}); | ||
| 260 | -$('#right2 a').tooltip({ showURL: false, positionLeft: true });</code></pre> | ||
| 261 | - </fieldset> | 252 | + </p> |
| 253 | + <h3>Code</h3> | ||
| 254 | + <pre><code class="mix">$('#right a').tooltip({ | ||
| 255 | + track: true, | ||
| 256 | + delay: 0, | ||
| 257 | + showURL: false, | ||
| 258 | + extraClass: "right" | ||
| 259 | +}); | ||
| 260 | +$('#right2 a').tooltip({ showURL: false, positionLeft: true });</code></pre> | ||
| 261 | + </fieldset> | ||
| 262 | </div> | 262 | </div> |
| 263 | <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> | 263 | <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| 264 | </script> | 264 | </script> |
| 265 | <script type="text/javascript"> | 265 | <script type="text/javascript"> |
| 266 | _uacct = "UA-2623402-1"; | 266 | _uacct = "UA-2623402-1"; |
| 267 | urchinTracker(); | 267 | urchinTracker(); |
| 268 | -</script> | 268 | +</script> |
| 269 | </body> | 269 | </body> |
| 270 | </html> | 270 | </html> |
| 271 | \ No newline at end of file | 271 | \ No newline at end of file |
setup/wizard/resources/jquery-tooltip/demo/screen.css
| 1 | -html, body, div, span, applet, object, iframe, | ||
| 2 | -h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
| 3 | -a, abbr, acronym, address, big, cite, code, | ||
| 4 | -del, dfn, em, font, img, ins, kbd, q, s, samp, | ||
| 5 | -small, strike, strong, sub, sup, tt, var, | ||
| 6 | -dl, dt, dd, ol, ul, li, | ||
| 7 | -fieldset, form, label, legend, | ||
| 8 | -table, caption, tbody, tfoot, thead, tr, th, td { | ||
| 9 | - margin: 0; | ||
| 10 | - padding: 0; | ||
| 11 | - border: 0; | ||
| 12 | - outline: 0; | ||
| 13 | - font-weight: inherit; | ||
| 14 | - font-style: inherit; | ||
| 15 | - font-size: 100%; | ||
| 16 | - font-family: inherit; | ||
| 17 | - vertical-align: baseline; | ||
| 18 | -} | ||
| 19 | -fieldset { | ||
| 20 | - border: 1px solid black; padding: 8px; margin: 8px 0; | ||
| 21 | -} | ||
| 22 | -/* remember to define focus styles! */ | ||
| 23 | -:focus { | ||
| 24 | - outline: 0; | ||
| 25 | -} | ||
| 26 | -body { | ||
| 27 | - line-height: 1; | ||
| 28 | - color: black; | ||
| 29 | - background: white; | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif } | ||
| 33 | -body { margin: 0; padding: 0; font-size: small; color: #333 } | ||
| 34 | -h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 } | ||
| 35 | -h1 { font-size: large } | ||
| 36 | -#main { padding: 1em; } | ||
| 37 | -#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc; | ||
| 38 | - background: url(bg.gif) repeat-x; text-align: center } | ||
| 39 | -#banner a { color: white; } | ||
| 40 | -legend { font-weight: bold; } | ||
| 41 | - | ||
| 42 | -button { padding: 0 6px; margin: 0; } | ||
| 43 | - | ||
| 44 | -pre, code { white-space: pre; font-family: "Courier New"; } | ||
| 45 | -pre { margin: 8px 0; } | ||
| 46 | -h3 { | ||
| 47 | - font-size: 110%; | ||
| 48 | - font-weight: bold; | ||
| 49 | - margin: .2em 0 .5em 0; | ||
| 50 | -} | ||
| 51 | -p { margin: 1em 0; } | ||
| 52 | -strong { font-weight: bolder; } | ||
| 53 | -em { font-style: italic; } | ||
| 54 | - | ||
| 55 | -.jscom, .mix htcom { color: #4040c2; } | ||
| 56 | -.com { color: green; } | ||
| 57 | -.regexp { color: maroon; } | ||
| 58 | -.string { color: teal; } | ||
| 59 | -.keywords { color: blue; } | ||
| 60 | -.global { color: #008; } | ||
| 61 | -.numbers { color: #880; } | ||
| 62 | -.comm { color: green; } | ||
| 63 | -.tag { color: blue; } | ||
| 64 | -.entity { color: blue; } | ||
| 65 | -.string { color: teal; } | ||
| 66 | -.aname { color: maroon; } | ||
| 67 | -.avalue { color: maroon; } | ||
| 68 | -.jquery { color: #00a; } | ||
| 69 | -.plugin { color: red; } | ||
| 70 | - | ||
| 71 | -#tooltip.pretty { | ||
| 72 | - font-family: Arial; | ||
| 73 | - border: none; | ||
| 74 | - width: 210px; | ||
| 75 | - padding:20px; | ||
| 76 | - height: 135px; | ||
| 77 | - opacity: 0.8; | ||
| 78 | - background: url('shadow.png'); | ||
| 79 | -} | ||
| 80 | -#tooltip.pretty h3 { | ||
| 81 | - margin-bottom: 0.75em; | ||
| 82 | - font-size: 12pt; | ||
| 83 | - width: 220px; | ||
| 84 | - text-align: center; | ||
| 85 | -} | ||
| 86 | -#tooltip.pretty div { width: 220px; text-align: left; } | ||
| 87 | - | ||
| 88 | -#tooltip.fancy { | ||
| 89 | - background: url('shadow2.png'); | ||
| 90 | - padding-top: 5em; | ||
| 91 | - height: 100px; | ||
| 92 | -} | ||
| 93 | -#tooltip.fancy.viewport-right { | ||
| 94 | - background: url('shadow2-reverse.png'); | ||
| 95 | -} | ||
| 96 | - | ||
| 97 | -#extended { margin: 2em 0; } | ||
| 98 | -#extended label { text-decoration: underline; } | ||
| 99 | -#yahoo { width: 7em; } | ||
| 100 | -#right, #right2 { text-align: right; } | ||
| 101 | -#tooltip.right { width: 250px; } | 1 | +html, body, div, span, applet, object, iframe, |
| 2 | +h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
| 3 | +a, abbr, acronym, address, big, cite, code, | ||
| 4 | +del, dfn, em, font, img, ins, kbd, q, s, samp, | ||
| 5 | +small, strike, strong, sub, sup, tt, var, | ||
| 6 | +dl, dt, dd, ol, ul, li, | ||
| 7 | +fieldset, form, label, legend, | ||
| 8 | +table, caption, tbody, tfoot, thead, tr, th, td { | ||
| 9 | + margin: 0; | ||
| 10 | + padding: 0; | ||
| 11 | + border: 0; | ||
| 12 | + outline: 0; | ||
| 13 | + font-weight: inherit; | ||
| 14 | + font-style: inherit; | ||
| 15 | + font-size: 100%; | ||
| 16 | + font-family: inherit; | ||
| 17 | + vertical-align: baseline; | ||
| 18 | +} | ||
| 19 | +fieldset { | ||
| 20 | + border: 1px solid black; padding: 8px; margin: 8px 0; | ||
| 21 | +} | ||
| 22 | +/* remember to define focus styles! */ | ||
| 23 | +:focus { | ||
| 24 | + outline: 0; | ||
| 25 | +} | ||
| 26 | +body { | ||
| 27 | + line-height: 1; | ||
| 28 | + color: black; | ||
| 29 | + background: white; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif } | ||
| 33 | +body { margin: 0; padding: 0; font-size: small; color: #333 } | ||
| 34 | +h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 } | ||
| 35 | +h1 { font-size: large } | ||
| 36 | +#main { padding: 1em; } | ||
| 37 | +#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc; | ||
| 38 | + background: url(bg.gif) repeat-x; text-align: center } | ||
| 39 | +#banner a { color: white; } | ||
| 40 | +legend { font-weight: bold; } | ||
| 41 | + | ||
| 42 | +button { padding: 0 6px; margin: 0; } | ||
| 43 | + | ||
| 44 | +pre, code { white-space: pre; font-family: "Courier New"; } | ||
| 45 | +pre { margin: 8px 0; } | ||
| 46 | +h3 { | ||
| 47 | + font-size: 110%; | ||
| 48 | + font-weight: bold; | ||
| 49 | + margin: .2em 0 .5em 0; | ||
| 50 | +} | ||
| 51 | +p { margin: 1em 0; } | ||
| 52 | +strong { font-weight: bolder; } | ||
| 53 | +em { font-style: italic; } | ||
| 54 | + | ||
| 55 | +.jscom, .mix htcom { color: #4040c2; } | ||
| 56 | +.com { color: green; } | ||
| 57 | +.regexp { color: maroon; } | ||
| 58 | +.string { color: teal; } | ||
| 59 | +.keywords { color: blue; } | ||
| 60 | +.global { color: #008; } | ||
| 61 | +.numbers { color: #880; } | ||
| 62 | +.comm { color: green; } | ||
| 63 | +.tag { color: blue; } | ||
| 64 | +.entity { color: blue; } | ||
| 65 | +.string { color: teal; } | ||
| 66 | +.aname { color: maroon; } | ||
| 67 | +.avalue { color: maroon; } | ||
| 68 | +.jquery { color: #00a; } | ||
| 69 | +.plugin { color: red; } | ||
| 70 | + | ||
| 71 | +#tooltip.pretty { | ||
| 72 | + font-family: Arial; | ||
| 73 | + border: none; | ||
| 74 | + width: 210px; | ||
| 75 | + padding:20px; | ||
| 76 | + height: 135px; | ||
| 77 | + opacity: 0.8; | ||
| 78 | + background: url('shadow.png'); | ||
| 79 | +} | ||
| 80 | +#tooltip.pretty h3 { | ||
| 81 | + margin-bottom: 0.75em; | ||
| 82 | + font-size: 12pt; | ||
| 83 | + width: 220px; | ||
| 84 | + text-align: center; | ||
| 85 | +} | ||
| 86 | +#tooltip.pretty div { width: 220px; text-align: left; } | ||
| 87 | + | ||
| 88 | +#tooltip.fancy { | ||
| 89 | + background: url('shadow2.png'); | ||
| 90 | + padding-top: 5em; | ||
| 91 | + height: 100px; | ||
| 92 | +} | ||
| 93 | +#tooltip.fancy.viewport-right { | ||
| 94 | + background: url('shadow2-reverse.png'); | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +#extended { margin: 2em 0; } | ||
| 98 | +#extended label { text-decoration: underline; } | ||
| 99 | +#yahoo { width: 7em; } | ||
| 100 | +#right, #right2 { text-align: right; } | ||
| 101 | +#tooltip.right { width: 250px; } | ||
| 102 | #fancy2 { float: right; } | 102 | #fancy2 { float: right; } |
| 103 | \ No newline at end of file | 103 | \ No newline at end of file |
setup/wizard/resources/jquery-tooltip/jquery.tooltip.css
| 1 | -#tooltip { | ||
| 2 | - position: absolute; | ||
| 3 | - z-index: 3000; | ||
| 4 | - border: 1px solid #111; | ||
| 5 | - background-color: #eee; | 1 | +#tooltip { |
| 2 | + position: absolute; | ||
| 3 | + z-index: 3000; | ||
| 4 | + border: 1px solid #111; | ||
| 5 | + background-color: #eee; | ||
| 6 | padding: 5px; | 6 | padding: 5px; |
| 7 | opacity: 0.85; | 7 | opacity: 0.85; |
| 8 | -} | ||
| 9 | -#tooltip h3, #tooltip div { margin: 0; } | 8 | +} |
| 9 | +#tooltip h3, #tooltip div { margin: 0; } |
setup/wizard/resources/jquery-tooltip/todo
| 1 | -1.3 | ||
| 2 | ---- | ||
| 3 | - | ||
| 4 | -* leverage advanced background-styling, eg. see http://www.google.com/intl/en_ALL/mapfiles/iw2.png | ||
| 5 | -* add ability to display remote tooltip for other elements, eg. an invalid input | ||
| 6 | -* Add stop-queue stuff for fadein/out without nasty queues | ||
| 7 | -* add delay on hide | ||
| 8 | -* add stick on hover of tooltip (with track:false) | ||
| 9 | -* offer hoverIntent support | 1 | +1.3 |
| 2 | +--- | ||
| 3 | + | ||
| 4 | +* leverage advanced background-styling, eg. see http://www.google.com/intl/en_ALL/mapfiles/iw2.png | ||
| 5 | +* add ability to display remote tooltip for other elements, eg. an invalid input | ||
| 6 | +* Add stop-queue stuff for fadein/out without nasty queues | ||
| 7 | +* add delay on hide | ||
| 8 | +* add stick on hover of tooltip (with track:false) | ||
| 9 | +* offer hoverIntent support |
setup/wizard/resources/wizard.css
| @@ -479,8 +479,10 @@ td.dir_description { | @@ -479,8 +479,10 @@ td.dir_description { | ||
| 479 | 479 | ||
| 480 | .big_ok { | 480 | .big_ok { |
| 481 | background: url("graphics/big-ok.png") no-repeat; | 481 | background: url("graphics/big-ok.png") no-repeat; |
| 482 | - width:16px; | 482 | + padding:4px; |
| 483 | + /*width:16px; | ||
| 483 | height:16px; | 484 | height:16px; |
| 485 | + padding-bottom:1px;*/ | ||
| 484 | } | 486 | } |
| 485 | 487 | ||
| 486 | .license_agreement { | 488 | .license_agreement { |
| @@ -517,4 +519,13 @@ td.dir_description { | @@ -517,4 +519,13 @@ td.dir_description { | ||
| 517 | left:75px; | 519 | left:75px; |
| 518 | position:relative; | 520 | position:relative; |
| 519 | width:600px | 521 | width:600px |
| 522 | +} | ||
| 523 | + | ||
| 524 | +.text_message { | ||
| 525 | + | ||
| 526 | +} | ||
| 527 | + | ||
| 528 | +.description_click { | ||
| 529 | + line-height:150%; | ||
| 530 | + font-size:90%; | ||
| 520 | } | 531 | } |
| 521 | \ No newline at end of file | 532 | \ No newline at end of file |
setup/wizard/resources/wizard.js
| @@ -9,15 +9,15 @@ wizard.prototype.doFormCheck = function() { | @@ -9,15 +9,15 @@ wizard.prototype.doFormCheck = function() { | ||
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // Toggle Advance Database options | 11 | // Toggle Advance Database options |
| 12 | -wizard.prototype.toggleClass = function(el) { | 12 | +wizard.prototype.toggleClass = function(el, option) { |
| 13 | var el = document.getElementsByClassName(el); //adv_options|php_details|php_ext_details|php_con_details | 13 | var el = document.getElementsByClassName(el); //adv_options|php_details|php_ext_details|php_con_details |
| 14 | - if (el == 'adv_options') { | ||
| 15 | - | ||
| 16 | - } | ||
| 17 | - if(el[0].style.display == 'none') | 14 | + if(el[0].style.display == 'none') { |
| 18 | el[0].style.display = 'block'; | 15 | el[0].style.display = 'block'; |
| 19 | - else | 16 | + document.getElementById(option).innerHTML = "Hide Details"; |
| 17 | + } else { | ||
| 20 | el[0].style.display = 'none'; | 18 | el[0].style.display = 'none'; |
| 19 | + document.getElementById(option).innerHTML = "Show Details"; | ||
| 20 | + } | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | // Toggle display of an element | 23 | // Toggle display of an element |
setup/wizard/steps/configuration.php
| @@ -133,7 +133,7 @@ class configuration extends Step | @@ -133,7 +133,7 @@ class configuration extends Step | ||
| 133 | } | 133 | } |
| 134 | return 'error'; | 134 | return 'error'; |
| 135 | } else if($this->previous()) { | 135 | } else if($this->previous()) { |
| 136 | - $this->setDetails(); | 136 | +// $this->setDetails(); |
| 137 | return 'previous'; | 137 | return 'previous'; |
| 138 | } else if($this->confirm()) { | 138 | } else if($this->confirm()) { |
| 139 | if($this->doRun()) { | 139 | if($this->doRun()) { |
| @@ -141,10 +141,11 @@ class configuration extends Step | @@ -141,10 +141,11 @@ class configuration extends Step | ||
| 141 | } | 141 | } |
| 142 | return 'error'; | 142 | return 'error'; |
| 143 | } else if($this->edit()) { | 143 | } else if($this->edit()) { |
| 144 | - $this->setDetails(); | 144 | + //$this->setDetails(); |
| 145 | if($this->doRun()) { | 145 | if($this->doRun()) { |
| 146 | 146 | ||
| 147 | } | 147 | } |
| 148 | +// die; | ||
| 148 | return 'landing'; | 149 | return 'landing'; |
| 149 | } | 150 | } |
| 150 | 151 |
setup/wizard/steps/services.php
| @@ -46,7 +46,7 @@ class services extends Step | @@ -46,7 +46,7 @@ class services extends Step | ||
| 46 | * List of errors encountered | 46 | * List of errors encountered |
| 47 | * | 47 | * |
| 48 | * @author KnowledgeTree Team | 48 | * @author KnowledgeTree Team |
| 49 | - * @access public | 49 | + * @access protected |
| 50 | * @var array | 50 | * @var array |
| 51 | */ | 51 | */ |
| 52 | protected $error = array(); | 52 | protected $error = array(); |
| @@ -55,21 +55,66 @@ class services extends Step | @@ -55,21 +55,66 @@ class services extends Step | ||
| 55 | * Flag if step needs to be installed | 55 | * Flag if step needs to be installed |
| 56 | * | 56 | * |
| 57 | * @author KnowledgeTree Team | 57 | * @author KnowledgeTree Team |
| 58 | - * @access public | 58 | + * @access protected |
| 59 | * @var array | 59 | * @var array |
| 60 | */ | 60 | */ |
| 61 | protected $runInstall = true; | 61 | protected $runInstall = true; |
| 62 | 62 | ||
| 63 | + /** | ||
| 64 | + * List of services to be installed | ||
| 65 | + * | ||
| 66 | + * @author KnowledgeTree Team | ||
| 67 | + * @access private | ||
| 68 | + * @var array | ||
| 69 | + */ | ||
| 63 | private $services = array('Lucene', 'Scheduler', 'OpenOffice'); | 70 | private $services = array('Lucene', 'Scheduler', 'OpenOffice'); |
| 64 | 71 | ||
| 72 | + /** | ||
| 73 | + * Path to java executable | ||
| 74 | + * | ||
| 75 | + * @author KnowledgeTree Team | ||
| 76 | + * @access protected | ||
| 77 | + * @var string | ||
| 78 | + */ | ||
| 65 | protected $java; | 79 | protected $java; |
| 66 | 80 | ||
| 81 | + /** | ||
| 82 | + * Path to php executable | ||
| 83 | + * | ||
| 84 | + * @author KnowledgeTree Team | ||
| 85 | + * @access protected | ||
| 86 | + * @var string | ||
| 87 | + */ | ||
| 67 | protected $php; | 88 | protected $php; |
| 68 | 89 | ||
| 90 | + /** | ||
| 91 | + * Path to open office executable | ||
| 92 | + * | ||
| 93 | + * @author KnowledgeTree Team | ||
| 94 | + * @access protected | ||
| 95 | + * @var string | ||
| 96 | + */ | ||
| 97 | + protected $soffice; | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * Reference to utility object | ||
| 101 | + * | ||
| 102 | + * @author KnowledgeTree Team | ||
| 103 | + * @access protected | ||
| 104 | + * @var string | ||
| 105 | + */ | ||
| 69 | protected $util; | 106 | protected $util; |
| 70 | - | 107 | + |
| 108 | + /** | ||
| 109 | + * Minumum Java Version | ||
| 110 | + * | ||
| 111 | + * @author KnowledgeTree Team | ||
| 112 | + * @access protected | ||
| 113 | + * @var string | ||
| 114 | + */ | ||
| 71 | private $javaVersion = '1.5'; | 115 | private $javaVersion = '1.5'; |
| 72 | // private $javaVersion = '1.7'; | 116 | // private $javaVersion = '1.7'; |
| 117 | + | ||
| 73 | /** | 118 | /** |
| 74 | * Java Installed | 119 | * Java Installed |
| 75 | * | 120 | * |
| @@ -276,12 +321,13 @@ class services extends Step | @@ -276,12 +321,13 @@ class services extends Step | ||
| 276 | if(empty($errors) && $passedJava && $passedPhp && $passedOpenOffice) { // Install Service if there is no errors | 321 | if(empty($errors) && $passedJava && $passedPhp && $passedOpenOffice) { // Install Service if there is no errors |
| 277 | $this->installServices(); | 322 | $this->installServices(); |
| 278 | } elseif ($passedPhp) { // Install Scheduler | 323 | } elseif ($passedPhp) { // Install Scheduler |
| 279 | - //$this->installService('Scheduler'); | 324 | + $this->installService('Scheduler'); |
| 280 | } elseif ($passedJava) { // Install Lucene | 325 | } elseif ($passedJava) { // Install Lucene |
| 281 | - //$this->installService('Lucene'); | 326 | + $this->installService('Lucene'); |
| 282 | } elseif ($passedOpenOffice) { //Install OpenOffice | 327 | } elseif ($passedOpenOffice) { //Install OpenOffice |
| 283 | $this->installService('OpenOffice'); | 328 | $this->installService('OpenOffice'); |
| 284 | } else { // All Services not installed | 329 | } else { // All Services not installed |
| 330 | + // TODO: What todo now? | ||
| 285 | } | 331 | } |
| 286 | } | 332 | } |
| 287 | $this->checkServiceStatus(); | 333 | $this->checkServiceStatus(); |
| @@ -291,7 +337,16 @@ class services extends Step | @@ -291,7 +337,16 @@ class services extends Step | ||
| 291 | return true; | 337 | return true; |
| 292 | } | 338 | } |
| 293 | 339 | ||
| 294 | - function checkServiceStatus() { | 340 | + /** |
| 341 | + * A final check to see if services are still running, | ||
| 342 | + * incase they switched on and turned off. | ||
| 343 | + * | ||
| 344 | + * @author KnowledgeTree Team | ||
| 345 | + * @param none | ||
| 346 | + * @access private | ||
| 347 | + * @return void | ||
| 348 | + */ | ||
| 349 | + private function checkServiceStatus() { | ||
| 295 | $serverDetails = $this->getServices(); | 350 | $serverDetails = $this->getServices(); |
| 296 | foreach ($serverDetails as $serviceName) { | 351 | foreach ($serverDetails as $serviceName) { |
| 297 | $className = OS.$serviceName; | 352 | $className = OS.$serviceName; |
| @@ -312,14 +367,23 @@ class services extends Step | @@ -312,14 +367,23 @@ class services extends Step | ||
| 312 | } | 367 | } |
| 313 | } | 368 | } |
| 314 | 369 | ||
| 315 | - function alreadyInstalled() { | 370 | + /** |
| 371 | + * Checks if all services have been started already, | ||
| 372 | + * incase the user lands on service page multiple times | ||
| 373 | + * | ||
| 374 | + * @author KnowledgeTree Team | ||
| 375 | + * @param none | ||
| 376 | + * @access public | ||
| 377 | + * @return boolean | ||
| 378 | + */ | ||
| 379 | + public function alreadyInstalled() { | ||
| 316 | $installed = true; | 380 | $installed = true; |
| 317 | $serverDetails = $this->getServices(); | 381 | $serverDetails = $this->getServices(); |
| 318 | foreach ($serverDetails as $serviceName) { | 382 | foreach ($serverDetails as $serviceName) { |
| 319 | $className = OS.$serviceName; | 383 | $className = OS.$serviceName; |
| 320 | $service = new $className(); | 384 | $service = new $className(); |
| 321 | $status = $this->serviceStatus($service); | 385 | $status = $this->serviceStatus($service); |
| 322 | - if($status != 'STARTED') { | 386 | + if(!$status) { |
| 323 | return false; | 387 | return false; |
| 324 | } | 388 | } |
| 325 | } | 389 | } |
| @@ -361,6 +425,14 @@ class services extends Step | @@ -361,6 +425,14 @@ class services extends Step | ||
| 361 | } | 425 | } |
| 362 | } | 426 | } |
| 363 | 427 | ||
| 428 | + /** | ||
| 429 | + * Attempt detection without logging errors | ||
| 430 | + * | ||
| 431 | + * @author KnowledgeTree Team | ||
| 432 | + * @param none | ||
| 433 | + * @access private | ||
| 434 | + * @return boolean | ||
| 435 | + */ | ||
| 364 | private function useDetected() { | 436 | private function useDetected() { |
| 365 | return $this->detSettings(true); | 437 | return $this->detSettings(true); |
| 366 | } | 438 | } |
setup/wizard/templates/complete.tpl
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | <div> | 17 | <div> |
| 18 | <h3><?php echo "<span class='{$paths_check}'> </span>"; ?>Paths and Permissions</h3> | 18 | <h3><?php echo "<span class='{$paths_check}'> </span>"; ?>Paths and Permissions</h3> |
| 19 | <?php if($silent) { ?> | 19 | <?php if($silent) { ?> |
| 20 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('paths_check');}">Show Details</div> | 20 | + <div id="option8" class="onclick" onclick="javascript:{w.toggleClass('paths_check', 'option8');}">Show Details</div> |
| 21 | <div class="paths_check" style="display:none"> | 21 | <div class="paths_check" style="display:none"> |
| 22 | <?php } ?> | 22 | <?php } ?> |
| 23 | <table> | 23 | <table> |
| @@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
| 38 | <!-- Database connectivity --> | 38 | <!-- Database connectivity --> |
| 39 | <h3><?php echo "<span class='{$database_check}'> </span>"; ?>Database connectivity</h3> | 39 | <h3><?php echo "<span class='{$database_check}'> </span>"; ?>Database connectivity</h3> |
| 40 | <?php if($silent) { ?> | 40 | <?php if($silent) { ?> |
| 41 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('database_check');}">Show Details</div> | 41 | + <div id="option9" class="onclick" onclick="javascript:{w.toggleClass('database_check', 'option9');}">Show Details</div> |
| 42 | <div class="database_check" style="display:none"> | 42 | <div class="database_check" style="display:none"> |
| 43 | <?php } ?> | 43 | <?php } ?> |
| 44 | <table> | 44 | <table> |
| @@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
| 53 | <?php } ?> | 53 | <?php } ?> |
| 54 | <h3><?php echo "<span class='{$privileges_check}'> </span>"; ?>Privileges</h3> | 54 | <h3><?php echo "<span class='{$privileges_check}'> </span>"; ?>Privileges</h3> |
| 55 | <?php if($silent) { ?> | 55 | <?php if($silent) { ?> |
| 56 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('privileges_check');}">Show Details</div> | 56 | + <div id="option1" class="onclick" onclick="javascript:{w.toggleClass('privileges_check', 'option1');}">Show Details</div> |
| 57 | <div class="privileges_check" style="display:none"> | 57 | <div class="privileges_check" style="display:none"> |
| 58 | <?php } ?> | 58 | <?php } ?> |
| 59 | <table style="width:755px;"> | 59 | <table style="width:755px;"> |
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | <div> | 69 | <div> |
| 70 | <h3><?php echo "<span class='{$services_check}'> </span>"; ?>Services</h3> | 70 | <h3><?php echo "<span class='{$services_check}'> </span>"; ?>Services</h3> |
| 71 | <?php if($silent) { ?> | 71 | <?php if($silent) { ?> |
| 72 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('services_check');}">Show Details</div> | 72 | + <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('services_check', 'option2');}">Show Details</div> |
| 73 | <div class="services_check" style="display:none"> | 73 | <div class="services_check" style="display:none"> |
| 74 | <?php } ?> | 74 | <?php } ?> |
| 75 | <table style="width:755px;"> | 75 | <table style="width:755px;"> |
setup/wizard/templates/configuration.tpl
| @@ -74,9 +74,9 @@ | @@ -74,9 +74,9 @@ | ||
| 74 | </tr> | 74 | </tr> |
| 75 | </table> | 75 | </table> |
| 76 | 76 | ||
| 77 | - <h3><?php echo "<span class='{$paths_perms}'> </span>"; ?>Directory Paths and Permissions</h3> | 77 | + <h3><?php echo "<span class='{$paths_perms}'> </span>"; ?>Paths and Permissions</h3> |
| 78 | <?php if($silent) { ?> | 78 | <?php if($silent) { ?> |
| 79 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('paths_perms');}">Show Details</div> | 79 | + <div id="option7" class="onclick" onclick="javascript:{w.toggleClass('paths_perms', 'option7');}">Show Details</div> |
| 80 | <div class="paths_perms" style="display:none"> | 80 | <div class="paths_perms" style="display:none"> |
| 81 | <?php } ?> | 81 | <?php } ?> |
| 82 | <p class="description"> | 82 | <p class="description"> |
setup/wizard/templates/configuration_confirm.tpl
| @@ -45,12 +45,12 @@ | @@ -45,12 +45,12 @@ | ||
| 45 | <td><?php echo $server['root_url']['value']; ?></td> | 45 | <td><?php echo $server['root_url']['value']; ?></td> |
| 46 | </tr> | 46 | </tr> |
| 47 | <tr> | 47 | <tr> |
| 48 | - <td>File System Root: </td> | 48 | + <td>Web Root: </td> |
| 49 | <td> <div id="tooltips" title="Absolute path to KnowledgeTree Source directory"> </div> </td> | 49 | <td> <div id="tooltips" title="Absolute path to KnowledgeTree Source directory"> </div> </td> |
| 50 | <td><?php echo $server['file_system_root']['value']; ?></td> | 50 | <td><?php echo $server['file_system_root']['value']; ?></td> |
| 51 | </tr> | 51 | </tr> |
| 52 | <tr> | 52 | <tr> |
| 53 | - <td>SSL Enabled: </td> | 53 | + <td>Do you have SSL Enabled?: </td> |
| 54 | <td> <div id="tooltips" title="Whether or not you have SSL installed"> </div> </td> | 54 | <td> <div id="tooltips" title="Whether or not you have SSL installed"> </div> </td> |
| 55 | <td><?php echo $server['ssl_enabled']['value']; ?></td> | 55 | <td><?php echo $server['ssl_enabled']['value']; ?></td> |
| 56 | </tr> | 56 | </tr> |
setup/wizard/templates/database.tpl
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | </tr> | 43 | </tr> |
| 44 | </table> | 44 | </table> |
| 45 | 45 | ||
| 46 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('adv_options');}"> Advanced Options</div> | 46 | + <div id="option3" class="onclick" onclick="javascript:{w.toggleClass('adv_options', 'option3');}"> Advanced Options</div> |
| 47 | <div id="database" class="adv_options" style="display:none;"> | 47 | <div id="database" class="adv_options" style="display:none;"> |
| 48 | <div class="description"> | 48 | <div class="description"> |
| 49 | These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings. | 49 | These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings. |
| @@ -65,26 +65,6 @@ | @@ -65,26 +65,6 @@ | ||
| 65 | <td> <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='45' class="textinput"/> </td> | 65 | <td> <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='45' class="textinput"/> </td> |
| 66 | </tr> | 66 | </tr> |
| 67 | </table> | 67 | </table> |
| 68 | -<!-- <div class="db_adv_options">--> | ||
| 69 | -<!-- <div class="adv_option">--> | ||
| 70 | -<!-- <label for='dhost'>Host: </label>--> | ||
| 71 | -<!-- <br>--> | ||
| 72 | -<!-- <span class="description">The address of the server where the database is located, if different to the current server.</span>--> | ||
| 73 | -<!-- <input type="text" value="<?php //echo $dhost?>" id="dhost" name="dhost" size='45' class="textinput"/>--> | ||
| 74 | -<!-- </div>--> | ||
| 75 | -<!-- <div class="adv_option">--> | ||
| 76 | -<!-- <label for='dport'>Port: </label>--> | ||
| 77 | -<!-- <br>--> | ||
| 78 | -<!-- <span class="description">The port on which your database server is listening, if it is a non-standard port please enter the number here.</span>--> | ||
| 79 | -<!-- <input type="text" value="<?php //echo $dport?>" id="dport" name="dport" size='10' class="textinput"/>--> | ||
| 80 | -<!-- </div>--> | ||
| 81 | -<!-- <div class="adv_option">--> | ||
| 82 | -<!-- <label for='dport'>Socket: </label>--> | ||
| 83 | -<!-- <br>--> | ||
| 84 | -<!-- <span class="description">The path to the database binary. If it is not on your system path then please enter it here.</span>--> | ||
| 85 | -<!-- <input type="text" value="<?php //echo $dbbinary?>" id="dbbinary" name="dbbinary" size='45' class="textinput"/>--> | ||
| 86 | -<!-- </div>--> | ||
| 87 | -<!-- </div>--> | ||
| 88 | </div> | 68 | </div> |
| 89 | </div> | 69 | </div> |
| 90 | <input type="submit" name="Previous" value="Previous" class="button_previous" /> | 70 | <input type="submit" name="Previous" value="Previous" class="button_previous" /> |
setup/wizard/templates/dependencies.tpl
| @@ -8,9 +8,9 @@ | @@ -8,9 +8,9 @@ | ||
| 8 | <?php | 8 | <?php |
| 9 | if(!$errors && $warnings) { | 9 | if(!$errors && $warnings) { |
| 10 | ?> | 10 | ?> |
| 11 | - <span class='big_ok'> </span> | ||
| 12 | - Congratulations! Your system is ready to run KnowledgeTree. Click Next to continue. | ||
| 13 | - <br/> | 11 | + <span class='big_ok'> </span> |
| 12 | + <span class='description'>Congratulations! Your system is ready to run KnowledgeTree. Click Next to continue.</span> | ||
| 13 | + <br/><br/> | ||
| 14 | <?php | 14 | <?php |
| 15 | } | 15 | } |
| 16 | ?> | 16 | ?> |
| @@ -26,13 +26,13 @@ | @@ -26,13 +26,13 @@ | ||
| 26 | <?php | 26 | <?php |
| 27 | if($errors || $warnings) { | 27 | if($errors || $warnings) { |
| 28 | ?> | 28 | ?> |
| 29 | - <a href="http://wiki.knowledgetree.com/Web_Based_Installer#PHP_Dependencies" target="_blank">Click here for help on overcoming dependency issues</a> | 29 | + <a href="http://wiki.knowledgetree.com/Web_Based_Installer#PHP_Dependencies" target="_blank" class="description_click">Click here for help on overcoming dependency issues</span></a> |
| 30 | <?php } ?> | 30 | <?php } ?> |
| 31 | <!--Content--> | 31 | <!--Content--> |
| 32 | <div id="step_content_dependencies" class="step"> | 32 | <div id="step_content_dependencies" class="step"> |
| 33 | <h3><?php echo "<span class='{$php}'> </span>"; ?>PHP Version Check</h3> | 33 | <h3><?php echo "<span class='{$php}'> </span>"; ?>PHP Version Check</h3> |
| 34 | <?php if($silent) { ?> | 34 | <?php if($silent) { ?> |
| 35 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_details');}">Show Details</div> | 35 | + <div id="option1" class="onclick" onclick="javascript:{w.toggleClass('php_details', 'option1');}">Show Details</div> |
| 36 | <div class="php_details" style="display:none"> | 36 | <div class="php_details" style="display:none"> |
| 37 | <?php } ?> | 37 | <?php } ?> |
| 38 | <p class="description"> | 38 | <p class="description"> |
| @@ -49,11 +49,11 @@ | @@ -49,11 +49,11 @@ | ||
| 49 | <h3><?php echo "<span class='{$php_ext}'> </span>"; ?>PHP Extensions</h3> | 49 | <h3><?php echo "<span class='{$php_ext}'> </span>"; ?>PHP Extensions</h3> |
| 50 | <?php | 50 | <?php |
| 51 | if($silent) { ?> | 51 | if($silent) { ?> |
| 52 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_ext_details');}">Show Details</div> | 52 | + <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('php_ext_details', 'option2');}">Show Details</div> |
| 53 | <div class="php_ext_details" style="display:none"> | 53 | <div class="php_ext_details" style="display:none"> |
| 54 | <?php } ?> | 54 | <?php } ?> |
| 55 | <p class="description"> | 55 | <p class="description"> |
| 56 | - The extensions shown in red below are required for KnowledgeTree to run optimally. Items shown in yellow are optional, but recommended. | 56 | + The extensions shown in red below are required for KnowledgeTree to run optimally. Items shown in orange are optional, but recommended. |
| 57 | </p> | 57 | </p> |
| 58 | <table class="description"> | 58 | <table class="description"> |
| 59 | <?php | 59 | <?php |
| @@ -95,11 +95,11 @@ | @@ -95,11 +95,11 @@ | ||
| 95 | <h3><?php echo "<span class='{$php_con}'> </span>"; ?>PHP Configuration</h3> | 95 | <h3><?php echo "<span class='{$php_con}'> </span>"; ?>PHP Configuration</h3> |
| 96 | <?php | 96 | <?php |
| 97 | if($silent) { ?> | 97 | if($silent) { ?> |
| 98 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_con_details');}">Show Details</div> | 98 | + <div id="option3" class="onclick" onclick="javascript:{w.toggleClass('php_con_details', 'option3');}">Show Details</div> |
| 99 | <div class="php_con_details" style="display:none"> | 99 | <div class="php_con_details" style="display:none"> |
| 100 | <?php } ?> | 100 | <?php } ?> |
| 101 | <p class="description"> | 101 | <p class="description"> |
| 102 | - The configurations shown in red below are required for KnowledgeTree to run optimally. Items shown in yellow are optional, but recommended. | 102 | + The configurations shown in red below are required for KnowledgeTree to run optimally. Items shown in orange are optional, but recommended. |
| 103 | </p> | 103 | </p> |
| 104 | <table class="description"> | 104 | <table class="description"> |
| 105 | <tr> | 105 | <tr> |
setup/wizard/templates/services.tpl
| @@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
| 58 | <?php } ?> | 58 | <?php } ?> |
| 59 | <h3><?php echo "<span class='{$javaCheck}'> </span>"; ?>Java Check</h3> | 59 | <h3><?php echo "<span class='{$javaCheck}'> </span>"; ?>Java Check</h3> |
| 60 | <?php if($silent) { ?> | 60 | <?php if($silent) { ?> |
| 61 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_details');}">Show Details</div> | 61 | + <div id="option4" class="onclick" onclick="javascript:{w.toggleClass('java_details', 'option4');}">Show Details</div> |
| 62 | <div class="java_details" style="display:none"> | 62 | <div class="java_details" style="display:none"> |
| 63 | <?php } ?> | 63 | <?php } ?> |
| 64 | <!-- <p class="description">--> | 64 | <!-- <p class="description">--> |
| @@ -94,7 +94,7 @@ | @@ -94,7 +94,7 @@ | ||
| 94 | <?php if (!$disableExtension) { ?> | 94 | <?php if (!$disableExtension) { ?> |
| 95 | <h3><?php echo "<span class='{$javaExtCheck}'> </span>"; ?>Java Extensions</h3> | 95 | <h3><?php echo "<span class='{$javaExtCheck}'> </span>"; ?>Java Extensions</h3> |
| 96 | <?php if($silent) { ?> | 96 | <?php if($silent) { ?> |
| 97 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_ext_details');}">Show Details</div> | 97 | + <div id="option5" class="onclick" onclick="javascript:{w.toggleClass('java_ext_details', 'option5');}">Show Details</div> |
| 98 | <div class="java_ext_details" style="display:none"> | 98 | <div class="java_ext_details" style="display:none"> |
| 99 | <?php } ?> | 99 | <?php } ?> |
| 100 | <!-- <p class="description">--> | 100 | <!-- <p class="description">--> |
| @@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
| 123 | <?php } ?> | 123 | <?php } ?> |
| 124 | <h3><?php echo "<span class='{$serviceCheck}'> </span>"; ?>Services Check</h3> | 124 | <h3><?php echo "<span class='{$serviceCheck}'> </span>"; ?>Services Check</h3> |
| 125 | <?php if($silent) { ?> | 125 | <?php if($silent) { ?> |
| 126 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div> | 126 | + <div id="option6" class="onclick" onclick="javascript:{w.toggleClass('service_details', 'option6');}">Show Details</div> |
| 127 | <div class="service_details" style="display:none"> | 127 | <div class="service_details" style="display:none"> |
| 128 | <?php } ?> | 128 | <?php } ?> |
| 129 | <!-- <p class="description">--> | 129 | <!-- <p class="description">--> |