function &form_step1()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('action' => 'process_step1', 'cancel_url' => KTUtil::addQueryStringSelf(''), 'fail_action' => 'main', 'label' => _kt('Workflow Details'), 'submit_label' => _kt('Next'), 'description' => _kt('This first step requires that you provide basic details about the workflow: its name, etc.'), 'context' => $this));
     $oForm->setWidgets(array(array('ktcore.widgets.string', array('label' => _kt('Workflow Name'), 'description' => _kt('Each workflow must have a unique name.'), 'required' => true, 'name' => 'workflow_name')), array('ktcore.widgets.text', array('label' => _kt('States'), 'description' => _kt('As documents progress through their lifecycle, they pass through a number of <strong>states</strong>.  These states describe a step in the process the document must follow.  Examples of states include "reviewed","submitted" or "pending".  Please enter a list of states, one per line.  State names must be unique.'), 'important_description' => _kt('Note that the first state you list is the one in which documents will start the workflow - this can be changed later on. '), 'required' => true, 'name' => 'states', 'rows' => 15)), array('ktcore.widgets.text', array('label' => _kt('Transitions'), 'description' => _kt('In order to move between states, users will cause "transitions" to occur.  These transitions represent processes followed, e.g. "review document", "distribute invoice" or "publish".  Please enter a list of transitions, one per line.  Transition names must be unique.  You\'ll assign transitions to states in the next step.'), 'required' => false, 'name' => 'transitions')), array('ktcore.widgets.hidden', array('required' => false, 'name' => 'fWizardKey', 'value' => KTUtil::randomString()))));
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'workflow_name', 'output' => 'workflow_name')), array('ktcore.validators.string', array('test' => 'fWizardKey', 'output' => 'fWizardKey')), array('ktcore.validators.string', array('test' => 'states', 'output' => 'states', 'max_length' => 9999)), array('ktcore.validators.string', array('test' => 'transitions', 'output' => 'transitions', 'max_length' => 9999))));
     return $oForm;
 }
Beispiel #2
0
 function form_password()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('context' => &$this, 'identifier' => 'ktcore.preferences.password', 'action' => 'updatePassword', 'fail_action' => 'setPassword', 'cancel_action' => 'main', 'label' => _kt('Change your password'), 'submit_label' => _kt('Set password'), 'extraargs' => $this->meldPersistQuery("", "", true)));
     // widgets
     $oForm->setWidgets(array(array('ktcore.widgets.password', array('label' => _kt('Password'), 'description' => _kt('Specify your new password.'), 'confirm_description' => _kt('Confirm the new password you specified above.'), 'confirm' => true, 'required' => true, 'name' => 'new_password', 'autocomplete' => false))));
     $KTConfig =& KTConfig::getSingleton();
     $minLength = (int) $KTConfig->get('user_prefs/passwordLength', 6);
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'new_password', 'min_length' => $minLength, 'min_length_warning' => sprintf(_kt("Your password is too short - passwords must be at least %d characters long."), $minLength), 'output' => 'password'))));
     return $oForm;
 }
 /**
  * Returns the Metadata Fieldsets for the given DocumentId
  * @return KTForm 
  *
  */
 function getTypeMetadataFieldsets($iDocumentTypeID)
 {
     //Creating the form
     $oForm = new KTForm();
     $oFReg =& KTFieldsetRegistry::getSingleton();
     $activesets = KTFieldset::getForDocumentType($iDocumentTypeID);
     foreach ($activesets as $oFieldset) {
         $widgets = kt_array_merge($widgets, $oFReg->widgetsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
         $validators = kt_array_merge($validators, $oFReg->validatorsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
     }
     $oForm->setWidgets($widgets);
     $oForm->setValidators($validators);
     return $oForm->renderWidgets();
 }
 function form_main()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('context' => &$this, 'identifier' => 'ktcore.folder.add', 'action' => 'addFolder', 'fail_action' => 'main', 'cancel_url' => KTBrowseUtil::getUrlForFolder($this->oFolder), 'label' => _kt('Add a folder'), 'submit_label' => _kt('Add Folder'), 'extraargs' => $this->meldPersistQuery("", "", true)));
     // widgets
     $oForm->setWidgets(array(array('ktcore.widgets.string', array('label' => _kt('Folder name'), 'description' => _kt('The name for the new folder.'), 'required' => true, 'name' => 'name'))));
     // Electronic Signature if enabled
     global $default;
     if ($default->enableESignatures) {
         $oForm->addWidget(array('ktcore.widgets.info', array('label' => _kt('This action requires authentication'), 'description' => _kt('Please provide your user credentials as confirmation of this action.'), 'name' => 'info')));
         $oForm->addWidget(array('ktcore.widgets.string', array('label' => _kt('Username'), 'name' => 'sign_username', 'required' => true)));
         $oForm->addWidget(array('ktcore.widgets.password', array('label' => _kt('Password'), 'name' => 'sign_password', 'required' => true)));
         $oForm->addWidget(array('ktcore.widgets.reason', array('label' => _kt('Reason'), 'description' => _kt('Please specify why you are checking out this document.  It will assist other users in understanding why you have locked this file.  Please bear in mind that you can use a maximum of <strong>250</strong> characters.'), 'name' => 'reason')));
     }
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'name', 'output' => 'name')), array('ktcore.validators.illegal_char', array('test' => 'name', 'output' => 'name'))));
     if ($default->enableESignatures) {
         $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oFolder->getId(), 'type' => 'folder', 'action' => 'ktcore.transactions.add_folder', 'test' => 'info', 'output' => 'info')));
     }
     return $oForm;
 }
 function do_main()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt('Document Storage Verification'), 'description' => _kt('This process performs a check to see if the documents in your repositories all are stored on the back-end storage (usually on disk). This process can take many minutes or hours depending on the size of your repository.'), 'submit_label' => _kt('verify document storage'), 'action' => 'verify'));
     return $oForm->render();
 }
Beispiel #6
0
 function do_request($oDocument)
 {
     // Display form for sending a request through the the sys admin to unarchive the document
     // name, document, request, submit
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt('Request restoration of document'), 'submit_label' => _kt('Send request'), 'identifier' => '', 'cancel_url' => KTBrowseUtil::getUrlForFolder($oFolder), 'fail_action' => 'main', 'context' => $this));
     $oForm->addWidget(array('ktcore.widgets.text', array('label' => _kt('Reason'), 'name' => 'reason', 'required' => true)));
     $data = isset($_REQUEST['data']) ? $_REQUEST['data'] : array();
     $iFolderId = $oDocument->getFolderID();
     $oFolder = Folder::get($iFolderId);
     $sFolderUrl = KTBrowseUtil::getUrlForFolder($oFolder);
     if (!empty($data)) {
         $res = $oForm->validate();
         if (!empty($res['errors'])) {
             return $oForm->handleError('', $aError);
         }
         $aAdminGroups = Group::getAdministratorGroups();
         if (!PEAR::isError($aAdminGroups) && !empty($aAdminGroups)) {
             foreach ($aAdminGroups as $oGroup) {
                 $aGroupUsers = $oGroup->getMembers();
                 // ensure unique users
                 foreach ($aGroupUsers as $oUser) {
                     $aUsers[$oUser->getId()] = $oUser;
                 }
             }
             $sSubject = _kt('Request for an archived document to be restored');
             $sDetails = $data['reason'];
             // Send request
             foreach ($aUsers as $oU) {
                 if (!PEAR::isError($oU)) {
                     include_once KT_DIR . '/plugins/ktcore/KTAssist.php';
                     KTAssistNotification::newNotificationForDocument($oDocument, $oU, $this->oUser, $sSubject, $sDetails);
                 }
             }
             // Redirect to folder
             $this->addInfoMessage(_kt('The System Administrators have been notified of your request.'));
             redirect($sFolderUrl);
             exit;
         }
     }
     return $oForm->renderPage(_kt('Archived document request') . ': ' . $oDocument->getName());
 }
 function form_addgroup()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.groups.add', 'label' => _kt("Create a new group"), 'submit_label' => _kt("Create group"), 'action' => 'creategroup', 'fail_action' => 'addgroup', 'cancel_action' => 'main', 'context' => $this));
     $oForm->setWidgets(array(array('ktcore.widgets.string', array('name' => 'group_name', 'label' => _kt("Group Name"), 'description' => _kt('A short name for the group.  e.g. <strong>administrators</strong>.'), 'value' => null, 'required' => true)), array('ktcore.widgets.boolean', array('name' => 'sysadmin', 'label' => _kt("System Administrators"), 'description' => _kt('Should all the members of this group be given <strong>system</strong> administration privileges?'), 'value' => null))));
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'group_name', 'output' => 'group_name')), array('ktcore.validators.boolean', array('test' => 'sysadmin', 'output' => 'sysadmin'))));
     // if we have any units.
     $aUnits = Unit::getList();
     if (!PEAR::isError($aUnits) && !empty($aUnits)) {
         $oForm->addWidgets(array(array('ktcore.widgets.entityselection', array('name' => 'unit', 'label' => _kt('Unit'), 'description' => _kt('Which Unit is this group part of?'), 'vocab' => $aUnits, 'label_method' => 'getName', 'simple_select' => false, 'unselected_label' => _kt("No unit"))), array('ktcore.widgets.boolean', array('name' => 'unitadmin', 'label' => _kt("Unit Administrators"), 'description' => _kt('Should all the members of this group be given <strong>unit</strong> administration privileges?'), 'important_description' => _kt("Note that its not possible to set a group without a unit as having unit administration privileges."), 'value' => null))));
         $oForm->addValidators(array(array('ktcore.validators.entity', array('test' => 'unit', 'class' => 'Unit', 'output' => 'unit')), array('ktcore.validators.boolean', array('test' => 'unitadmin', 'output' => 'unitadmin'))));
     }
     return $oForm;
 }
Beispiel #8
0
 /**
  * Returns the main Bulk Upload Form
  * @return KTForm 
  *
  */
 function getBulkImportForm()
 {
     $this->oPage->setBreadcrumbDetails(_kt("bulk import"));
     //Adding the required Bulk Upload javascript includes
     $aJavascript[] = 'resources/js/taillog.js';
     $aJavascript[] = 'resources/js/conditional_usage.js';
     $aJavascript[] = 'resources/js/kt_bulkupload.js';
     //Loading the widget js libraries to support dynamic "Ajax Loaded" widget rendering
     //FIXME: The widgets can support this via dynamic call to place libs in the head if they aren't loaded
     //       jQuery can do this but need time to implement/test.
     $aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
     $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
     $aJavascript[] = 'resources/js/kt_tinymce_init.js';
     $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/jquery.tinymce.js';
     $this->oPage->requireJSResources($aJavascript);
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.folder.bulkUpload', 'label' => _kt('Import from Server Location'), 'submit_label' => _kt('Import'), 'action' => 'import', 'fail_action' => 'main', 'encoding' => 'multipart/form-data', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("", "", true), 'description' => _kt('The bulk import facility allows for a number of documents to be added to the document management system easily. Provide a path on the server, and all documents and folders within that path will be added to the document management system.')));
     $oWF =& KTWidgetFactory::getSingleton();
     $widgets = array();
     $validators = array();
     // Adding the File Upload Widget
     //Legacy kt3 widgets don't conform to ktcore type widgets by virtue of the 'name' attribute.
     //$widgets[] = new KTFileUploadWidget(_kt('Archive file'), , 'file', "", $this->oPage, true, "file");
     $widgets[] = $oWF->get('ktcore.widgets.string', array('label' => _kt('Path'), 'required' => true, 'name' => 'path', 'id' => 'path', 'value' => '', 'description' => _kt('The path containing the documents to be added to the document management system.')));
     $aVocab = array('' => _kt('- Please select a document type -'));
     foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
         if (!$oDocumentType->getDisabled()) {
             $aVocab[$oDocumentType->getId()] = $oDocumentType->getName();
         }
     }
     //Adding document type lookup widget
     $widgets[] = $oWF->get('ktcore.widgets.selection', array('label' => _kt('Document Type'), 'id' => 'add-document-type', 'description' => _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'name' => 'fDocumentTypeId', 'required' => true, 'vocab' => $aVocab, 'id_method' => 'getId', 'label_method' => 'getName', 'simple_select' => false));
     //Adding the quick "add" button for when no meta data needs to be added.
     //FIXME: This widget should only display if there are any "required" fields for the given document type
     //       Default/general document field type must also be taken into consideration
     $widgets[] = $oWF->get('ktcore.widgets.button', array('value' => _kt('Add'), 'id' => 'quick_add', 'description' => _kt('If you do not need to modify any the metadata for this document (see below), then you can simply click "Add" here to finish the process and add the document.'), 'name' => 'btn_quick_submit'));
     $oFReg =& KTFieldsetRegistry::getSingleton();
     $activesets = KTFieldset::getGenericFieldsets();
     foreach ($activesets as $oFieldset) {
         $widgets = kt_array_merge($widgets, $oFReg->widgetsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
         $validators = kt_array_merge($validators, $oFReg->validatorsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
     }
     //Adding the type_metadata_fields layer to be updated via ajax for non generic metadata fieldsets
     $widgets[] = $oWF->get('ktcore.widgets.layer', array('value' => '', 'id' => 'type_metadata_fields'));
     $oForm->setWidgets($widgets);
     $oForm->setValidators($validators);
     // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
     global $default;
     $iFolderId = $this->oFolder->getId();
     if ($default->enableESignatures) {
         $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
         $heading = _kt('You are attempting to perform a bulk upload');
         $submit['type'] = 'button';
         $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});";
     } else {
         $submit['type'] = 'submit';
         $submit['onclick'] = '';
     }
     return $oForm;
 }
 function form_collectinfo()
 {
     $cancelUrl = $this->getReturnUrl();
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.actions.bulk.checkout.form', 'label' => _kt('Checkout Items'), 'submit_label' => _kt('Checkout'), 'action' => 'performaction', 'fail_action' => 'collectinfo', 'cancel_url' => $cancelUrl, 'context' => $this));
     // Electronic Signature if enabled
     global $default;
     if ($default->enableESignatures) {
         $widgets[] = array('ktcore.widgets.info', array('label' => _kt('This action requires authentication'), 'description' => _kt('Please provide your user credentials as confirmation of this action.'), 'name' => 'info'));
         $widgets[] = array('ktcore.widgets.string', array('label' => _kt('Username'), 'name' => 'sign_username', 'required' => true));
         $widgets[] = array('ktcore.widgets.password', array('label' => _kt('Password'), 'name' => 'sign_password', 'required' => true));
     }
     $widgets[] = array('ktcore.widgets.reason', array('name' => 'reason', 'label' => _kt('Reason'), 'description' => _kt('Please specify why you are checking out these documents. It will assist other users in understanding why you have locked these files.'), 'value' => null, 'required' => true));
     $widgets[] = array('ktcore.widgets.boolean', array('label' => _kt('Download Files'), 'description' => _kt('Indicate whether you would like to download these file as part of the checkout.'), 'name' => 'download_file', 'value' => true));
     $oForm->setWidgets($widgets);
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'reason', 'max_length' => 250, 'output' => 'reason')), array('ktcore.validators.boolean', array('test' => 'download_file', 'output' => 'download_file'))));
     if ($default->enableESignatures) {
         $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oFolder->getID(), 'type' => 'bulk', 'action' => 'ktcore.transactions.bulk_check_out', 'test' => 'info', 'output' => 'info')));
     }
     return $oForm;
 }
 function form_main()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt('Convert Document to PDF'), 'action' => 'selectType', 'fail_action' => 'main', 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), 'submit_label' => _kt('Convert Document'), 'context' => &$this));
     $oForm->setWidgets(array(array('ktcore.widgets.selection', array('label' => _kt("Type of conversion"), 'description' => _kt('The following are the types of conversions you can perform on this document.'), 'name' => 'convert_type', 'vocab' => array('Download as PDF'), 'simple_select' => true, 'required' => true))));
     return $oForm;
 }
Beispiel #11
0
 function form_editnotifications($oState)
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('context' => $this, 'label' => _kt("Edit State Notifications."), 'identifier' => 'ktcore.workflow.notifications', 'submit_label' => _kt("Update Notifications"), 'cancel_action' => 'managenotifications', 'action' => 'savenotifications', 'fail_action' => 'editnotifications'));
     $preval = KTWorkflowUtil::getInformedForState($oState);
     $oForm->setWidgets(array(array('ktcore.widgets.descriptorselection', array('label' => _kt("Users to inform"), 'description' => _kt("Select which users, groups and roles to be notified."), 'name' => 'users', 'src' => KTUtil::addQueryStringSelf($this->meldPersistQuery(array('json_action' => 'notificationusers'), "json")), 'value' => $this->descriptorToJSON($preval)))));
     $oForm->setValidators(array(array('ktcore.validators.array', array('test' => 'users', 'output' => 'users'))));
     return $oForm;
 }
Beispiel #12
0
 function form_metadata($sess_key)
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.document.add', 'label' => _kt('Specify Metadata'), 'submit_label' => _kt('Save Document'), 'action' => 'finalise', 'fail_action' => 'metadata', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("", "", true)));
     $oFReg =& KTFieldsetRegistry::getSingleton();
     $doctypeid = $_SESSION['_add_data'][$sess_key]['document_type'];
     $widgets = array();
     $validators = array();
     $fieldsets = $this->getFieldsetsForType($doctypeid);
     foreach ($fieldsets as $oFieldset) {
         $widgets = kt_array_merge($widgets, $oFReg->widgetsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
         $validators = kt_array_merge($validators, $oFReg->validatorsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
     }
     $oForm->setWidgets($widgets);
     $oForm->setValidators($validators);
     return $oForm;
 }
Beispiel #13
0
 function form_complete()
 {
     $sReturnAction = KTUtil::arrayGet($_REQUEST, 'fReturnAction');
     $sReturnData = KTUtil::arrayGet($_REQUEST, 'fReturnData');
     $sAction = 'main';
     switch ($sReturnAction) {
         case 'browse':
             $sReturnData = empty($sReturnData) ? $_REQUEST['fFolderId'] : $sReturnData;
             $sTargetUrl = KTBrowseUtil::getUrlForFolder(Folder::get($sReturnData));
             break;
         case 'simpleSearch':
             // do we use this?
             $sTargetUrl = KTBrowseUtil::getSimpleSearchBaseUrl();
             $extraargs = array('fSearchableText' => $sReturnData);
             break;
         case 'booleanSearch':
             // do we use this?
             $sTargetUrl = KTBrowseUtil::getBooleanSearchBaseUrl();
             $sAction = 'performSearch';
             $extraargs = array('boolean_search_id' => $sReturnData);
             break;
         case 'search2':
             $sTargetUrl = KTBrowseUtil::getSearchResultURL();
             $sAction = 'refresh';
             break;
         default:
             $sTargetUrl = $sReturnAction;
             $sAction = '';
     }
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.actions.bulk.complete.form', 'submit_label' => _kt('Return'), 'targeturl' => $sTargetUrl, 'context' => $this, 'action' => $sAction, 'extraargs' => $extraargs, 'noframe' => true));
     return $oForm;
 }
 function form_main()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt('Make Immutable'), 'action' => 'immutable', 'fail_action' => 'main', 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), 'submit_label' => _kt('Make Immutable'), 'context' => &$this));
     // Electronic Signature if enabled
     global $default;
     if ($default->enableESignatures) {
         $widgets[] = array('ktcore.widgets.info', array('label' => _kt('This action requires authentication'), 'description' => _kt('Please provide your user credentials as confirmation of this action.'), 'name' => 'info'));
         $widgets[] = array('ktcore.widgets.string', array('label' => _kt('Username'), 'name' => 'sign_username', 'required' => true));
         $widgets[] = array('ktcore.widgets.password', array('label' => _kt('Password'), 'name' => 'sign_password', 'required' => true));
     }
     $widgets[] = array('ktcore.widgets.reason', array('label' => _kt('Reason'), 'description' => _kt('Please specify why you are making this document immutable.  Please bear in mind that you can use a maximum of <strong>250</strong> characters.'), 'name' => 'reason'));
     $oForm->setWidgets($widgets);
     $validators[] = array('ktcore.validators.string', array('test' => 'reason', 'min_length' => 1, 'max_length' => 250, 'output' => 'reason'));
     if ($default->enableESignatures) {
         $validators[] = array('electonic.signatures.validators.authenticate', array('object_id' => $this->oDocument->iId, 'type' => 'document', 'action' => 'ktcore.transactions.immutable', 'test' => 'info', 'output' => 'info'));
     }
     $oForm->setValidators($validators);
     return $oForm;
 }
Beispiel #15
0
 function form_addlookups()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.fieldsets.basic.field.addlookup', 'label' => _kt("Add Lookup Values"), 'submit_label' => _kt('Add Lookups'), 'cancel_action' => 'managefield', 'fail_action' => 'addlookupvalues', 'action' => 'createlookupvalues', 'context' => $this));
     $oForm->setWidgets(array(array('ktcore.widgets.text', array('label' => _kt("Lookup Values"), 'name' => 'lookups', 'required' => true, '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."), 'important_description' => _kt("Please enter the lookup values you wish to add, one per line.")))));
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'lookups', 'output' => 'lookups', 'max_length' => 9999))));
     return $oForm;
 }
Beispiel #16
0
 function form_changetype()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt("Change Document Type"), 'description' => _kt("Changing the document type will allow different metadata to be associated with it."), 'identifier' => 'ktcore.doc.edit.typechange', 'submit_label' => _kt("Update Document"), 'context' => $this, 'cancel_action' => 'main', 'action' => 'trytype'));
     $type = DocumentType::get($this->oDocument->getDocumentTypeId());
     $current_type_name = $type->getName();
     $oFolder = Folder::get($this->oDocument->getFolderID());
     $oForm->setWidgets(array(array('ktcore.widgets.entityselection', array('label' => _kt("New Document Type"), 'description' => _kt("Please select the new type for this document."), 'important_description' => sprintf(_kt("The document is currently of type \"%s\"."), $current_type_name), 'value' => $type->getId(), 'label_method' => 'getName', 'vocab' => DocumentType::getListForUserAndFolder($this->oUser, $oFolder), 'simple_select' => false, 'required' => true, 'name' => 'type'))));
     $oForm->setValidators(array(array('ktcore.validators.entity', array('test' => 'type', 'output' => 'type', 'class' => 'DocumentType'))));
     return $oForm;
 }
 function form_edit()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.fieldsets.edit', 'label' => _kt("Change Fieldset Details"), 'submit_label' => _kt('Update Fieldset'), 'cancel_action' => 'edit', 'fail_action' => 'editfieldset', 'action' => 'savefieldset', 'context' => $this));
     // construct the widget set.
     // we use a slight variation here, because "type" is only present in certain circumstances.
     $widgets = array(array('ktcore.widgets.string', array('label' => _kt("Fieldset Name"), 'name' => 'name', 'required' => true, 'description' => _kt("Each fieldset needs a unique name."), 'value' => sanitizeForHTML($this->oFieldset->getName()))), array('ktcore.widgets.text', array('label' => _kt("Description"), 'name' => 'description', 'required' => true, 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), 'value' => sanitizeForHTML($this->oFieldset->getDescription()))));
     $widgets[] = array('ktcore.widgets.boolean', array('label' => _kt("Generic"), 'name' => 'generic', '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."), 'value' => $this->oFieldset->getIsGeneric()));
     $oForm->setWidgets($widgets);
     // similarly, we construct validators here.
     $validators = array(array('ktcore.validators.string', array('test' => 'name', 'output' => 'name')), array('ktcore.validators.string', array('test' => 'description', 'output' => 'description')), array('ktcore.validators.boolean', array('test' => 'generic', 'output' => 'generic')));
     $oForm->setValidators($validators);
     return $oForm;
 }
 function form_owner()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt('Change Document Ownership'), 'description' => _kt('Changing document ownership allows you to keep the "owner" role relevant, even when the original user no longer is an appropriate choice.'), 'action' => 'reown', 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), 'fail_action' => 'main', 'identifier' => 'ktcore.actions.document.owner', 'context' => $this));
     $oForm->setWidgets(array(array('ktcore.widgets.entityselection', array('label' => _kt('New Owner'), 'description' => _kt('The owner of a document is usually the person with ultimate responsibility for its contents.  It is initially set to the person who created the document, but can be changed to any other user.'), 'important_description' => _kt('Please note that changing the owner may affect access to this document.'), 'label_method' => 'getName', 'vocab' => User::getList('id > 0'), 'value' => $this->oDocument->getOwnerID(), 'name' => 'user_id'))));
     $oForm->setValidators(array(array('ktcore.validators.entity', array('test' => 'user_id', 'class' => 'User', 'output' => 'user'))));
     return $oForm;
 }
 function form_setmasterfield()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt("Select Master Field"), 'action' => 'setmasterfield', 'cancel_url' => $this->sParentUrl, 'fail_action' => 'manageordering', 'submit_label' => _kt("Set Master Field"), 'context' => $this));
     if (!is_null($this->oFieldset->getMasterFieldId())) {
         $change_warning = _kt("Changing the master field set will remove all existing field\nordering!");
     }
     $oForm->setWidgets(array(array('ktcore.widgets.entityselection', array('name' => 'master_field', 'label' => _kt("Master Field"), 'description' => _kt('In order to have a chain of conditions, one initial field must be shown to the user. This is called the master field.'), 'important_description' => $change_warning, 'value' => $this->oFieldset->getMasterFieldId(), 'vocab' => $this->oFieldset->getFields(), 'label_method' => 'getName', 'use_simple' => false, 'required' => true))));
     $oForm->setValidators(array(array('ktcore.validators.entity', array('class' => 'DocumentField', 'test' => 'master_field', 'output' => 'master_field'))));
     return $oForm;
 }