Commit 2c4cbe57c7233d06d59d5675c6ed700baccdca44

Authored by bshuttle
1 parent 6c548522

finish off the basic document fieldset-editing stuff.



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5898 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/documentcontentversion.inc.php
... ... @@ -100,10 +100,10 @@ class KTDocumentContentVersion extends KTEntity {
100 100 if (empty($this->iMimeTypeId)) {
101 101 $this->iMimeTypeId = 0;
102 102 }
103   - if (empty($this->iMajorVersion)) {
  103 + if (is_null($this->iMajorVersion)) {
104 104 $this->iMajorVersion = 0;
105 105 }
106   - if (empty($this->iMinorVersion)) {
  106 + if (is_null($this->iMinorVersion)) {
107 107 $this->iMinorVersion = 1;
108 108 }
109 109 return parent::create();
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -449,7 +449,7 @@ class KTDocumentCheckInAction extends KTDocumentAction {
449 449 )),
450 450 array('ktcore.widgets.reason', array(
451 451 'label' => _kt("Reason"),
452   - 'description' => _kt("Please specify why you are cancelling this document's checked-out status. Please bear in mind that you can use a maximum of <strong>250</strong> characters."),
  452 + 'description' => _kt("Please describe the changes you made to the document. Bear in mind that you can use a maximum of <strong>250</strong> characters."),
453 453 'name' => 'reason',
454 454 )),
455 455 array('ktcore.widgets.boolean',array(
... ...
plugins/ktcore/admin/fieldsets/basic.inc.php
... ... @@ -28,10 +28,11 @@ require_once(KT_LIB_DIR . &#39;/dispatcher.inc.php&#39;);
28 28 require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php');
29 29 require_once(KT_LIB_DIR . '/widgets/forms.inc.php');
30 30 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
  31 +require_once(KT_LIB_DIR . "/documentmanagement/MDTree.inc");
31 32  
32 33 class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
33 34 var $bAutomaticTransaction = true;
34   - var $bHaveConditional = null;
  35 + var $bHaveConditional = null;
35 36 var $sHelpPage = 'ktcore/admin/document fieldsets.html';
36 37  
37 38 function predispatch() {
... ... @@ -437,9 +438,9 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
437 438 }
438 439 foreach ($_REQUEST['metadata'] as $iMetaDataId) {
439 440 $oMetaData =& MetaData::get($iMetaDataId);
440   - if (PEAR::isError($oMetaData)) {
441   - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
442   - }
  441 + if (PEAR::isError($oMetaData)) {
  442 + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
  443 + }
443 444 $oMetaData->delete();
444 445 }
445 446 $this->successRedirectTo('managelookups', _kt('Lookups removed'));
... ... @@ -457,9 +458,9 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
457 458 }
458 459 foreach ($_REQUEST['metadata'] as $iMetaDataId) {
459 460 $oMetaData =& MetaData::get($iMetaDataId);
460   - if (PEAR::isError($oMetaData)) {
461   - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
462   - }
  461 + if (PEAR::isError($oMetaData)) {
  462 + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
  463 + }
463 464 $oMetaData->setDisabled(true);
464 465 $oMetaData->update();
465 466 }
... ... @@ -478,9 +479,9 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
478 479 }
479 480 foreach ($_REQUEST['metadata'] as $iMetaDataId) {
480 481 $oMetaData =& MetaData::get($iMetaDataId);
481   - if (PEAR::isError($oMetadata)) {
482   - $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
483   - }
  482 + if (PEAR::isError($oMetadata)) {
  483 + $this->errorRedirectTo('managelookups', _kt('Invalid lookup selected'));
  484 + }
484 485 $oMetaData->setDisabled(!$oMetaData->getDisabled());
485 486 $oMetaData->update();
486 487 }
... ... @@ -499,9 +500,9 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
499 500 }
500 501 foreach ($_REQUEST['metadata'] as $iMetaDataId) {
501 502 $oMetaData =& MetaData::get($iMetaDataId);
502   - if (PEAR::isError($oMetaData)) {
503   - $this->errorRedirectTo('managelookups', _kt('Invalid lookups selected'));
504   - }
  503 + if (PEAR::isError($oMetaData)) {
  504 + $this->errorRedirectTo('managelookups', _kt('Invalid lookups selected'));
  505 + }
505 506 $bStuck = (boolean)$oMetaData->getIsStuck();
506 507 $oMetaData->setIsStuck(!$bStuck);
507 508 $oMetaData->update();
... ... @@ -538,42 +539,19 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
538 539  
539 540 // {{{ TREE
540 541 // create and display the tree editing form.
541   - function do_editTree() {
  542 + function do_managetree() {
542 543 global $default;
543 544 // extract.
544 545  
545   - $iFieldsetId = KTUtil::arrayGet($_REQUEST, 'fFieldsetId', false);
546   - $iFieldId = KTUtil::arrayGet($_REQUEST, 'field_id', false);
547   -
548   - $oFieldset =& KTFieldset::get($iFieldsetId);
549   - if(PEAR::isError($oFieldset)) {
550   - $this->errorRedirectTo('main', _kt('Unable to find fieldset'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId));
551   - exit(0);
552   - }
  546 + $iFieldsetId = KTUtil::getId($this->oFieldset);
  547 + $iFieldId = KTUtil::getId($this->oField);
553 548  
554   - $oField =& DocumentField::get($iFieldId);
555   - if(PEAR::isError($oField)) {
556   - $this->errorRedirectTo('main', _kt('Unable to find field'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId));
557   - exit(0);
558   - }
  549 + $oFieldset =& $this->oFieldset;
  550 + $oField =& $this->oField;
559 551  
560   -
561   -
562   -
563   -
564   - $this->aBreadcrumbs[] = array(
565   - 'url' => $_SERVER['PHP_SELF'],
566   - 'query' => 'action=edit&fFieldsetId=' . $iFieldsetId,
567   - 'name' => $oFieldset->getName()
568   - );
569   - $this->aBreadcrumbs[] = array(
570   - 'url' => $_SERVER['PHP_SELF'],
571   - 'query' => 'action=editField&fFieldsetId=' . $iFieldsetId . '&fFieldId=' . $oField->getId(),
572   - 'name' => $oField->getName()
573   - );
574 552 $this->oPage->setBreadcrumbDetails(_kt('edit lookup tree'));
575 553  
576   - $field_id = KTUtil::arrayGet($_REQUEST, 'field_id');
  554 + $field_id = $iFieldId;
577 555 $current_node = KTUtil::arrayGet($_REQUEST, 'current_node', 0);
578 556 $subaction = KTUtil::arrayGet($_REQUEST, 'subaction');
579 557  
... ... @@ -593,15 +571,15 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
593 571 $fieldTree->buildForField($oField->getId());
594 572  
595 573 if ($subaction !== null) {
596   - $target = 'editTree';
  574 + $target = 'managetree';
597 575 $msg = _kt('Changes saved.');
598 576 if ($subaction === "addCategory") {
599 577 $new_category = KTUtil::arrayGet($_REQUEST, 'category_name');
600 578 if (empty($new_category)) {
601   - return $this->errorRedirectTo("editTree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId));
602   - } else {
603   - $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree);
604   - }
  579 + return $this->errorRedirectTo("managetree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId));
  580 + } else {
  581 + $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree);
  582 + }
605 583 $msg = _kt('Category added'). ': ' . $new_category;
606 584 }
607 585 if ($subaction === "deleteCategory") {
... ... @@ -634,29 +612,31 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
634 612 $free_metadata = MetaData::getList('document_field_id = '.$oField->getId().' AND (treeorg_parent = 0 OR treeorg_parent IS NULL) AND (disabled = 0)');
635 613  
636 614 // render edit template.
637   - $oTemplating =& KTTemplating::getSingleton();
638   - $oTemplate = $oTemplating->loadTemplate("ktcore/edit_lookuptrees");
  615 +
  616 + $oTemplate = $this->oValidator->validateTemplate("ktcore/metadata/admin/edit_lookuptree");
639 617 $renderedTree = $this->_evilTreeRenderer($fieldTree);
640 618  
641 619 $this->oPage->setTitle(_kt('Edit Lookup Tree'));
642 620  
643 621 //$this->oPage->requireJSResource('thirdparty/js/MochiKit/Base.js');
644   -
645   - if ($current_node == 0) { $category_name = 'Root'; }
646   - else {
647   - $oNode = MDTreeNode::get($current_node);
648   - $category_name = $oNode->getName();
649   - }
650   -
  622 +
  623 + if ($current_node == 0) { $category_name = 'Root'; }
  624 + else {
  625 + $oNode = MDTreeNode::get($current_node);
  626 + $category_name = $oNode->getName();
  627 + }
  628 +
651 629 $aTemplateData = array(
  630 + "context" => $this,
  631 + "args" => $this->meldPersistQuery("","managetree", true),
652 632 "field" => $oField,
653 633 "oFieldset" => $oFieldset,
654 634 "tree" => $fieldTree,
655 635 "renderedTree" => $renderedTree,
656 636 "currentNode" => $current_node,
657   - 'category_name' => $category_name,
  637 + 'category_name' => $category_name,
658 638 "freechildren" => $free_metadata,
659   - "context" => $this,
  639 +
660 640 );
661 641 return $oTemplate->render($aTemplateData);
662 642 }
... ... @@ -682,9 +662,9 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
682 662  
683 663 function subact_unlinkKeyword(&$constructedTree, $keyword) {
684 664 $oKW = MetaData::get($keyword);
685   - if (PEAR::isError($oKW)) {
686   - return true;
687   - }
  665 + if (PEAR::isError($oKW)) {
  666 + return true;
  667 + }
688 668 $constructedTree->reparentKeyword($oKW->getId(), 0);
689 669 return true;
690 670 }
... ... @@ -706,10 +686,10 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
706 686  
707 687 function _evilTreeRecursion($subnode, $treeToRender)
708 688 {
709   - // deliver us from evil....
710   - $iFieldId = $treeToRender->field_id;
711   - $oField = DocumentField::get($iFieldId);
712   - $iFieldsetId = $oField->getParentFieldsetId();
  689 + // deliver us from evil....
  690 + $iFieldId = $treeToRender->field_id;
  691 + $oField = DocumentField::get($iFieldId);
  692 + $iFieldsetId = $oField->getParentFieldsetId();
713 693  
714 694 $treeStr = "<ul>";
715 695 foreach ($treeToRender->contents[$subnode] as $subnode_id => $subnode_val)
... ... @@ -743,16 +723,10 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
743 723 $stack = array();
744 724 $exitstack = array();
745 725  
746   - // deliver us from evil....
747   - $iFieldId = $treeToRender->field_id;
748   - $oField = DocumentField::get($iFieldId);
749   - $iFieldsetId = $oField->getParentFieldsetId();
750   - $sBaseQS = sprintf('field_id=%d&fFieldsetId=%d&', $iFieldId, $iFieldsetId);
751   -
752 726 // since the root is virtual, we need to fake it here.
753 727 // the inner section is generised.
754 728 $treeStr .= '<ul class="kt_treenodes"><li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . _kt('Root') . '</a>';
755   - $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node=0') . '">' . _kt('edit') . '</a>)';
  729 + $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=0', 'managetree')) . '">' . _kt('attach keywords') . '</a>)';
756 730 $treeStr .= '<ul>';
757 731  
758 732 //$default->log->debug("EVILRENDER: " . print_r($treeToRender, true));
... ... @@ -787,64 +761,17 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
787 761 // BD: sorry. I hate you.
788 762  
789 763 function _evilActionHelper($iFieldsetId, $iFieldId, $bIsKeyword, $current_node) {
790   - $sBaseQS = sprintf('fFieldsetId=%d&field_id=%d&', $iFieldsetId, $iFieldId);
791   -
792 764 $actionStr = " (";
793 765 if ($bIsKeyword === true) {
794   - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&keyword_id='.$current_node.'&subaction=unlinkKeyword') . '">' . _kt('unlink') . '</a>';
795   - }
796   - else
797   - {
798   - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node=' . $current_node) .'">' . _kt('attach keywords') . '</a> ';
799   - $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node='.$current_node.'&subaction=deleteCategory') . '">' . _kt('delete') . '</a>';
  766 + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf(KTUtil::addQueryStringSelf($this->meldPersistQuery('keyword_id='.$current_node.'&subaction=unlinkKeyword', 'managetree'))) . '">' . _kt('unlink') . '</a>';
  767 + } else {
  768 + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node=' . $current_node, 'managetree')) .'">' . _kt('attach keywords') . '</a> ';
  769 + $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf($this->meldPersistQuery('current_node='.$current_node.'&subaction=deleteCategory', 'managetree')) . '">' . _kt('delete') . '</a>';
800 770 }
801 771 $actionStr .= ")";
802 772 return $actionStr;
803 773 }
804   -
805   -
806   - function do_viewOverview() {
807   - $fieldset_id = KTUtil::arrayGet($_REQUEST, "fieldset_id");
808   - $oTemplating =& KTTemplating::getSingleton();
809   - $oTemplate = $oTemplating->loadTemplate("ktcore/metadata/conditional/conditional_overview");
810 774  
811   -
812   - $oFieldset =& KTFieldset::get($fieldset_id);
813   - $aFields =& $oFieldset->getFields();
814   -
815   - $this->aBreadcrumbs[] = array(
816   - 'url' => $_SERVER['PHP_SELF'],
817   - 'query' => 'action=edit&fFieldsetId=' . $fieldset_id,
818   - 'name' => $oFieldset->getName()
819   - );
820   - $this->aBreadcrumbs[] = array(
821   - 'url' => $_SERVER['PHP_SELF'],
822   - 'query' => 'action=manageConditional&fFieldsetId=' . $_REQUEST['fieldset_id'],
823   - 'name' => _kt('Manage conditional field'),
824   - );
825   - $this->aBreadcrumbs[] = array(
826   - 'url' => $_SERVER['PHP_SELF'],
827   - 'query' => 'action=viewOverview&fieldset_id=' . $_REQUEST['fieldset_id'],
828   - 'name' => _kt('Overview'),
829   - );
830   -
831   - $aBehaviours = array();
832   - foreach ($aFields as $oField) {
833   - $aOpts = KTFieldBehaviour::getByField($oField);
834   - $aBehaviours = kt_array_merge($aBehaviours, $aOpts);
835   - }
836   -
837   - $aTemplateData = array(
838   - "context" => &$this,
839   - "fieldset_id" => $fieldset_id,
840   - "aFields" => $aFields,
841   - "behaviours" => $aBehaviours,
842   - "iMasterFieldId" => $oFieldset->getMasterFieldId(),
843   - );
844   - return $oTemplate->render($aTemplateData);
845   - }
846   -
847   -// }}}
848 775 }
849 776  
850 777 ?>
... ...
templates/kt3/fieldsets/generic.smarty
... ... @@ -15,23 +15,28 @@
15 15 <th>{i18n}File is a{/i18n}</th>
16 16 <td>{$context->_mimeHelper($document->getMimeTypeID())}</td>
17 17 </tr>
18   -
  18 +
19 19 <tr class="even">
  20 + <th>{i18n}Document Version{/i18n}</th>
  21 + <td>{$document->getMajorVersionNumber()}.{$document->getMinorVersionNumber()}</td>
  22 + </tr>
  23 +
  24 + <tr class="odd">
20 25 <th>{i18n}Created by{/i18n}</th>
21 26 <td>{$creator} ({$creation_date})</td>
22 27 </tr>
23 28  
24   - <tr class="odd">
  29 + <tr class="even">
25 30 <th>{i18n}Last update by{/i18n}</th>
26 31 <td>{$last_modified_by} ({$last_modified_date})</td>
27 32 </tr>
28 33  
29   - <tr class="even">
  34 + <tr class="odd">
30 35 <th>{i18n}Document Type{/i18n}</th>
31 36 <td>{$document_type}</td>
32 37 </tr>
33 38  
34   - <tr class="odd">
  39 + <tr class="even">
35 40 <th>{i18n}Workflow status{/i18n}</th>
36 41 <td>
37 42 {if $workflow_state}
... ... @@ -41,7 +46,7 @@
41 46 {/if}</td>
42 47 </tr>
43 48  
44   - <tr class="even">
  49 + <tr class="odd">
45 50 <th>{i18n}Document ID{/i18n}</th>
46 51 <td>{$document->getId()}</td>
47 52 </tr>
... ...
templates/kt3/fieldsets/generic_versioned.smarty
... ... @@ -31,7 +31,15 @@
31 31 <td class="previous {if ($oldval != $newval)}different{/if}">{$oldval}</td>
32 32 </tr>
33 33  
  34 +{capture assign="oldval"}{$comparison_document->getMajorVersionNumber()}.{$comparison_document->getMinorVersionNumber()}{/capture}
  35 +{capture assign="newval"}{$document->getMajorVersionNumber()}.{$document->getMinorVersionNumber()}{/capture}
34 36 <tr class="even">
  37 + <th>{i18n}Document Version{/i18n}</th>
  38 + <td class="current {if ($oldval != $newval)}different{/if}">{$newval}</td>
  39 + <td class="previous {if ($oldval != $newval)}different{/if}">{$oldval}</td>
  40 + </tr>
  41 +
  42 + <tr class="odd">
35 43 <th>{i18n}Created by{/i18n}</th>
36 44 <td colspan="2">{$creator} ({$creation_date}) <span class="descriptiveText">({i18n}this cannot not change between versions{/i18n})</td>
37 45 </tr>
... ... @@ -39,7 +47,7 @@
39 47  
40 48 {capture assign="oldval"}{$comparison_last_modified_by} ({$comparison_last_modified_date}){/capture}
41 49 {capture assign="newval"}{$last_modified_by} ({$last_modified_date}){/capture}
42   - <tr class="odd">
  50 + <tr class="even">
43 51 <th>{i18n}Last update by{/i18n}</th>
44 52 <td class="current {if ($oldval != $newval)}different{/if}">{$newval}</td>
45 53 <td class="previous {if ($oldval != $newval)}different{/if}">{$oldval}</td>
... ... @@ -47,7 +55,7 @@
47 55  
48 56 {capture assign="oldval"}{$comparison_document_type}{/capture}
49 57 {capture assign="newval"}{$document_type}{/capture}
50   - <tr class="even">
  58 + <tr class="odd">
51 59 <th>{i18n}Document Type{/i18n}</th>
52 60 <td class="current {if ($oldval != $newval)}different{/if}">{$newval}</td>
53 61 <td class="previous {if ($oldval != $newval)}different{/if}">{$oldval}</td>
... ... @@ -63,13 +71,13 @@
63 71 {else}
64 72 {i18n}No workflow{/i18n}
65 73 {/if}{/capture}
66   - <tr class="odd">
  74 + <tr class="even">
67 75 <th>{i18n}Workflow status{/i18n}</th>
68 76 <td class="current {if ($oldval != $newval)}different{/if}">{$newval}</td>
69 77 <td class="previous {if ($oldval != $newval)}different{/if}">{$oldval}</td>
70 78 </tr>
71 79  
72   - <tr class="even">
  80 + <tr class="odd">
73 81 <th>{i18n}Document ID{/i18n}</th>
74 82 <td colspan="2">{$document->getId()} <span class="descriptiveText">({i18n}this cannot not change between versions{/i18n})</span></td>
75 83 </tr>
... ...
templates/ktcore/metadata/admin/edit_lookuptree.smarty 0 → 100644
  1 +{$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')}
  2 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
  3 +{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")}
  4 +{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")}
  5 +
  6 +<h2>{i18n}Edit Lookup Tree{/i18n}: {$field->getName()}</h2>
  7 +
  8 +<p class="descriptiveText">{i18n}Many "lookup" fields make sense in a hierachy:
  9 +countries are part of continents and sub-continents, school classes are part of grades
  10 +and programs, Powerbooks are Apple Macs, while Thinkpads are made by Lenovo. This
  11 +page will allow you to arrange the lookups in the field in a hierachy. All changes
  12 +are immediately stored, so when you are done simply navigate back to the field menu.{/i18n}</p>
  13 +
  14 +
  15 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  16 +<fieldset>
  17 + <legend>{i18n arg_category="$category_name"}Add New Subcategory to <strong>#category#</strong>{/i18n}</legend>
  18 +
  19 + <p class="descriptiveText">{i18n}In order to organise the options into a "tree", you
  20 + need to add subcategories at each level. The "top" level is called the root, and
  21 + holds all the toplevel items. "Root" will not be shown to the final user, but
  22 + provides a single "parent" to the toplevel items.{/i18n}</p>
  23 +
  24 + <p class="descriptiveText">{i18n}As an example, if you are creating a tree of the
  25 + countries in the world, the actual countries would be <strong>keywords</strong>
  26 + (e.g. South Africa, England, Pakistan, India). The highest group of categories
  27 + would be continents &mdash; e.g. Africa, Europe, Asia, The Americas &mdash; followed by
  28 + subcategories that contain actual countries &mdash; e.g. Western Europe, Sub-saharan Africa,
  29 + Austalasia.{/i18n}</p>
  30 +
  31 + {foreach from=$args item=v key=k}
  32 + <input type="hidden" name="{$k}" value="{$v}" />
  33 + {/foreach}
  34 + <input type="hidden" name="subaction" value="addCategory" />
  35 + <input type="hidden" name="current_node" value="{$currentNode}" />
  36 +
  37 +<input type="text" name="category_name"/>
  38 +
  39 +<div class="form_actions">
  40 + <input type="submit" name="submit" value="{i18n}add new subcategory{/i18n}" />
  41 +</div>
  42 +</fieldset>
  43 +</form>
  44 +
  45 +{if ($currentNode != 0)}
  46 +{if (empty($freechildren))}
  47 +<p class="descriptiveText">{i18n}Keywords which are directly below the
  48 + <strong>Root</strong> are considered "free" &mdash; they are not attached to
  49 + a subcategory. Only free keywords can be associated with a subcategory. To
  50 + free a keyword, click on the "unlink" command next to it in the preview tree below.
  51 + Deleting a subcategory will automatically unlink all keywords below it (including
  52 + those in subcategories of the subcategory).
  53 + {/i18n}</p>
  54 +
  55 +<div class="ktInfo"><p>{i18n}No free keywords. Use the "unlink" action on a keyword to
  56 +make it available.{/i18n}</p></div>
  57 +{else}
  58 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  59 +<fieldset>
  60 + <legend>{i18n arg_category=$category_name}Attach keywords to <strong>#category#</strong>{/i18n}</legend>
  61 +
  62 + <p class="descriptiveText">{i18n}Keywords which are directly below the
  63 + <strong>Root</strong> are considered "free" &mdash; they are not attached to
  64 + a subcategory. Only free keywords can be associated with a subcategory. To
  65 + free a keyword, click on the "unlink" command next to it in the preview tree below.
  66 + {/i18n}</p>
  67 +
  68 +
  69 + {foreach from=$args item=v key=k}
  70 + <input type="hidden" name="{$k}" value="{$v}" />
  71 + {/foreach}
  72 + <input type="hidden" name="subaction" value="linkKeywords" />
  73 + <input type="hidden" name="current_node" value="{$currentNode}" />
  74 +
  75 +
  76 +
  77 +<select multiple="1" name="keywordsToAdd[]">
  78 + {foreach item=oKeyword from=$freechildren name=kc}
  79 + <option value="{$oKeyword->getId()}" {if $smarty.foreach.kc.total == 1} SELECTED="true"{/if}>{$oKeyword->getName()}</option>
  80 + {/foreach}
  81 +</select>
  82 +
  83 +<div class="form_actions">
  84 + <input type="submit" name="submit" value="{i18n}Add to category{/i18n}" />
  85 +</div>
  86 +</fieldset>
  87 +</form>
  88 +{/if}
  89 +{/if}
  90 +
  91 +
  92 +<h2>{i18n}Preview{/i18n}</h2>
  93 +<div><p class="descriptiveText">
  94 + {i18n}Use the +/- arrows to open or close the tree. Bold items are metadata keywords.
  95 + To edit a category (including adding or removing keywords) click on the "attach keywords" link next to it.{/i18n}
  96 + </p>
  97 +</div>
  98 +
  99 +{$renderedTree}
... ...