Commit e35b1b82701e68fd11693e569f032575ce765a1f
1 parent
0f17d0a0
Be able to create system fieldsets, and also use nameToLocalNamespace so
that users don't have to figure out what a namespace is to create a fieldset. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3986 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
20 additions
and
6 deletions
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/documentFields.php
| @@ -62,17 +62,31 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher { | @@ -62,17 +62,31 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher { | ||
| 62 | 62 | ||
| 63 | // {{{ do_new | 63 | // {{{ do_new |
| 64 | function do_new() { | 64 | function do_new() { |
| 65 | + $bIsGeneric = false; | ||
| 66 | + $bIsSystem = false; | ||
| 67 | + | ||
| 65 | if (KTUtil::arrayGet($_REQUEST, 'generic')) { | 68 | if (KTUtil::arrayGet($_REQUEST, 'generic')) { |
| 66 | - $generic = true; | ||
| 67 | - } else { | ||
| 68 | - $generic = false; | 69 | + $bIsGeneric = true; |
| 70 | + } | ||
| 71 | + | ||
| 72 | + if (KTUtil::arrayGet($_REQUEST, 'system')) { | ||
| 73 | + $bIsSystem = true; | ||
| 74 | + // Can't be a system fieldset and a generic fieldset... | ||
| 75 | + $bIsGeneric = false; | ||
| 76 | + } | ||
| 77 | + $sName = KTUtil::arrayGet($_REQUEST, 'name'); | ||
| 78 | + $sName = $this->oValidator->notEmpty($sName); | ||
| 79 | + $sNamespace = KTUtil::arrayGet($_REQUEST, 'namespace'); | ||
| 80 | + if (empty($sNamespace)) { | ||
| 81 | + $sNamespace = KTUtil::nameToLocalNamespace('fieldsets', $sName); | ||
| 69 | } | 82 | } |
| 70 | $res = KTFieldset::createFromArray(array( | 83 | $res = KTFieldset::createFromArray(array( |
| 71 | - 'name' => $_REQUEST['name'], | ||
| 72 | - 'namespace' => $_REQUEST['namespace'], | 84 | + 'name' => $sName, |
| 85 | + 'namespace' => $sNamespace, | ||
| 73 | 'mandatory' => false, | 86 | 'mandatory' => false, |
| 74 | 'isconditional' => false, | 87 | 'isconditional' => false, |
| 75 | - 'isgeneric' => $generic, | 88 | + 'isgeneric' => $bIsGeneric, |
| 89 | + 'issystem' => $bIsSystem, | ||
| 76 | )); | 90 | )); |
| 77 | if (PEAR::isError($res) || ($res === false)) { | 91 | if (PEAR::isError($res) || ($res === false)) { |
| 78 | $this->errorRedirectToMain('Could not create fieldset'); | 92 | $this->errorRedirectToMain('Could not create fieldset'); |