diff --git a/lib/documentmanagement/MetaData.inc b/lib/documentmanagement/MetaData.inc
index 0e3b2d8..d81ec54 100644
--- a/lib/documentmanagement/MetaData.inc
+++ b/lib/documentmanagement/MetaData.inc
@@ -7,36 +7,35 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*/
-require_once(KT_LIB_DIR . "/util/sanitize.inc");
class MetaData extends KTEntity {
@@ -80,8 +79,8 @@ class MetaData extends KTEntity {
}
function getID() { return $this->iId; }
- function getName() { return sanitizeForSQLtoHTML($this->sName); }
- function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); }
+ function getName() { return $this->sName; }
+ function setName($sNewValue) { $this->sName = $sNewValue; }
function getDocFieldId() { return $this->iDocFieldId; }
function setDocFieldId($iNewValue) { $this->iDocFieldId = $iNewValue; }
function getTreeParent() { return $this->iTreeParent; }
diff --git a/plugins/ktcore/admin/fieldsets/basic.inc.php b/plugins/ktcore/admin/fieldsets/basic.inc.php
index 5f9e64d..bdb882e 100644
--- a/plugins/ktcore/admin/fieldsets/basic.inc.php
+++ b/plugins/ktcore/admin/fieldsets/basic.inc.php
@@ -416,12 +416,41 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
function do_managelookups() {
$this->oPage->setBreadcrumbDetails(_kt('manage lookup values'));
- $oTemplate =& $this->oValidator->validateTemplate("ktcore/metadata/admin/manage_lookups");
+ // Add javascript to create the edit form
+ $sJavaScript = "\nfunction editLookup(id)\n
+ {\n
+ var div = document.getElementById(id);\n
+ var value = div.innerHTML;
+
+ \n
+ matches = value.match(/\"/g);\n
+ var newValue = value;\n
+ if(matches){\n
+ for(var i = 0; i < matches.length; i++){\n
+ newValue = newValue.replace('\"', '"');\n
+ }\n
+ }\n\n
+
+ var inner = '';\n
+ inner += '';\n
+ inner += '';\n
+ inner += '';\n
+ div.innerHTML = inner;\n
+ document.getElementById('lookup_'+id).focus();\n
+ }\n\n
+
+ function closeLookupEdit(id)
+ {\n
+ value = document.getElementById('original_'+id).value;\n
+ document.getElementById(id).innerHTML = value;\n
+ }\n\n";
+
+ $this->oPage->requireJSStandalone($sJavaScript);
$lookups =& MetaData::getByDocumentField($this->oField);
-
$args = $this->meldPersistQuery("","metadataMultiAction", true);
+ $oTemplate =& $this->oValidator->validateTemplate("ktcore/metadata/admin/manage_lookups");
$oTemplate->setData(array(
'context' => $this,
'field_name' => $this->oField->getName(),
@@ -486,6 +515,40 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
}
// }}}
+ /**
+ * Save the edited lookup values
+ *
+ */
+ function lookup_edit(){
+ $aLookupValues = $_REQUEST['lookup'];
+
+ if(empty($aLookupValues)){
+ $this->errorRedirectTo('managelookups', _kt('No lookups were selected for editing'));
+ exit;
+ }
+
+ foreach ($aLookupValues as $iMetaDataId => $sValue){
+ $oMetaData = MetaData::get($iMetaDataId);
+ if (PEAR::isError($oMetaData)) {
+ $this->addErrorMessage(_kt('Invalid lookup selected').': '.$sValue);
+ continue;
+ //$this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
+ }
+ if(empty($sValue)){
+ $this->addErrorMessage(_kt('Lookup cannot be empty').': '.$oMetaData->getName());
+ if(count($aLookupValues) == 1){
+ $this->redirectTo('managelookups');
+ }
+ continue;
+ }
+ $oMetaData->setName($sValue);
+ $oMetaData->update();
+ }
+
+ $this->successRedirectTo('managelookups', _kt('Lookup values saved'));
+ exit(0);
+ }
+
// {{{ lookup_enable
function lookup_toggleenabled() {
$oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fFieldsetId']);
diff --git a/templates/ktcore/metadata/admin/manage_lookups.smarty b/templates/ktcore/metadata/admin/manage_lookups.smarty
index 4c65fae..b6c095c 100644
--- a/templates/ktcore/metadata/admin/manage_lookups.smarty
+++ b/templates/ktcore/metadata/admin/manage_lookups.smarty
@@ -3,9 +3,9 @@