コード例 #1
0
ファイル: browse.php プロジェクト: 5haman/knowledgetree
 function do_selectLookup()
 {
     $field = KTUtil::arrayGet($_REQUEST, 'fField', null);
     $oField = DocumentField::get($field);
     if (PEAR::isError($oField) || $oField == false || !$oField->getHasLookup()) {
         $this->errorRedirectToMain('No Field selected.');
         exit(0);
     }
     $_REQUEST['fBrowseMode'] = 'lookup_value';
     $aValues = MetaData::getByDocumentField($oField);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_value');
     $aTemplateData = array('context' => $this, 'oField' => $oField, 'values' => $aValues);
     return $oTemplate->render($aTemplateData);
 }
コード例 #2
0
ファイル: basic.inc.php プロジェクト: jpbauer/knowledgetree
 function do_managelookups()
 {
     $this->oPage->setBreadcrumbDetails(_kt('manage lookup values'));
     // Add javascript to create the edit form
     $sJavaScript = "\nfunction editLookup(id)\n\n            {\n\n                var div = document.getElementById(id);\n\n                var value = div.innerHTML;\n\n                <!-- Replace all double quotes with &#34; -->\n\n                matches = value.match(/\"/g);\n\n                var newValue = value;\n\n                if(matches){\n\n                    for(var i = 0; i < matches.length; i++){\n\n                        newValue = newValue.replace('\"', '&#34;');\n\n                    }\n\n                }\n\n\n\n                var inner = '<input type=\"text\" name=\"lookup['+id+']\" id=\"lookup_'+id+'\" value=\"'+newValue+'\" />';\n\n                inner += '<input type=\"hidden\" id=\"original_'+id+'\" value=\"'+newValue+'\" />';\n\n                inner += '<input type=\"submit\" name=\"submit[edit]\" value=\"" . _kt('Save') . "\" />';\n\n                inner += '<input type=\"button\" onclick=\"javascript: closeLookupEdit('+id+');\" name=\"cancel\" value=\"" . _kt('Cancel') . "\" />';\n\n                div.innerHTML = inner;\n\n                document.getElementById('lookup_'+id).focus();\n\n            }\n\n\n\n            function closeLookupEdit(id)\n            {\n\n                value = document.getElementById('original_'+id).value;\n\n                document.getElementById(id).innerHTML = value;\n\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(), 'lookups' => $lookups, 'args' => $args));
     return $oTemplate->render();
 }