function form_quicktransition()
 {
     $oForm = new KTForm();
     if ($this->oDocument->getIsCheckedOut()) {
         $this->addErrorMessage(_kt('The workflow cannot be changed while the document is checked out.'));
     } else {
         $oForm->setOptions(array('identifier' => 'ktcore.workflow.quicktransition', 'label' => _kt('Perform Quick Transition'), 'submit_label' => _kt('Perform Transition'), 'context' => $this, 'action' => 'performquicktransition', 'fail_action' => 'quicktransition', 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument)));
         // 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('Specify your reason for performing this action.'), 'important_description' => _kt('Please bear in mind that you can use a maximum of <strong>250</strong> characters.'), 'name' => 'reason'));
         $oForm->setWidgets($widgets);
         $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'reason', 'min_length' => 1, 'max_length' => 250, 'output' => 'reason'))));
         if ($default->enableESignatures) {
             $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oDocument->iId, 'type' => 'document', 'action' => 'ktcore.transactions.transition_workflow', 'test' => 'info', 'output' => 'info')));
         }
     }
     return $oForm;
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 function form_initialdata()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt("Add a document"), 'action' => 'processInitialData', 'actionparams' => 'postExpected=1&fFolderId=' . $this->oFolder->getId(), 'fail_action' => 'main', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("", "", true), 'submit_label' => _kt("Add"), 'file_upload' => true));
     $aTypes = array();
     foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
         if (!$oDocumentType->getDisabled()) {
             $aTypes[] = $oDocumentType;
         }
     }
     // Onchange gets the name of the file and inserts it as the document title.
     $sFileOnchange = "javascript:\n            var doc = document.getElementById('document_name');\n            if(doc.value == ''){\n                var arrPath=this.value.split('/');\n                if(arrPath.length == 1){\n                    var arrPath=this.value.split('\\\\');\n                }\n                var name=arrPath[arrPath.length-1];\n                var name=name.split('.');\n                var len = name.length;\n                if(len > 1){\n                    if(name[len-1].length <= 4){\n                        name.pop();\n                    }\n                }\n                var title=name.join('.');\n                doc.value=title;\n            }";
     $oForm->setWidgets(array(array('ktcore.widgets.file', array('label' => _kt('File'), 'description' => _kt('The contents of the document to be added to the document management system.'), 'name' => 'file', 'required' => true, 'onchange' => $sFileOnchange)), array('ktcore.widgets.string', array('label' => _kt('Document Title'), 'description' => sprintf(_kt('The document title is used as the main name of a document throughout %s.'), APP_NAME), 'name' => 'document_name', 'required' => true, 'id' => 'document_name')), array('ktcore.widgets.entityselection', array('label' => _kt('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' => 'document_type', 'required' => true, 'vocab' => $aTypes, 'initial_string' => _kt('- Please select a document type -'), 'id_method' => 'getId', 'label_method' => 'getName', 'simple_select' => false))));
     // 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.file', array('test' => 'file', 'output' => 'file')), array('ktcore.validators.fileillegalchar', array('test' => 'file', 'output' => 'file')), array('ktcore.validators.string', array('test' => 'document_name', 'output' => 'document_name')), array('ktcore.validators.entity', array('test' => 'document_type', 'output' => 'document_type', 'class' => 'DocumentType', 'ids' => true))));
     if ($default->enableESignatures) {
         $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oFolder->getId(), 'type' => 'folder', 'action' => 'ktcore.transactions.add_document', 'test' => 'info', 'output' => 'info')));
     }
     return $oForm;
 }