function do_main()
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents'));
     $this->oPage->setBreadcrumbDetails(_kt('browse'));
     $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1));
     if (PEAR::isError($oFolder)) {
         $this->errorRedirectToMain(_kt('Invalid folder selected.'));
         exit(0);
     }
     // Setup the collection for restore display.
     $aBaseParams = array();
     $collection = new AdvancedCollection();
     $oCR =& KTColumnRegistry::getSingleton();
     $col = $oCR->getColumn('ktcore.columns.selection');
     $aColOptions = array();
     //$aColOptions['qs_params'] = kt_array_merge($aBaseParams, array('fFolderId'=>$oFolder->getId()));
     $aColOptions['show_folders'] = false;
     $aColOptions['show_documents'] = true;
     $aColOptions['rangename'] = '_d[]';
     $col->setOptions($aColOptions);
     $collection->addColumn($col);
     $col = $oCR->getColumn('ktcore.columns.title');
     //$col->setOptions(array('qs_params'=>kt_array_merge($aBaseParams, array('action' => 'new', 'fFolderId'=>$oFolder->getId()))));
     $col->setOptions(array('link_documents' => false));
     $collection->addColumn($col);
     //$qObj = new BrowseQuery($iFolderId);
     $qObj = new ArchivedBrowseQuery($oFolder->getId());
     $collection->setQueryObject($qObj);
     $aOptions = $collection->getEnvironOptions();
     $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId()))));
     $collection->setOptions($aOptions);
     $aURLParams = $aBaseParams;
     $aURLParams['action'] = 'restore';
     $aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams);
     $aTemplateData = array('context' => $this, 'folder' => $oFolder, 'breadcrumbs' => $aBreadcrumbs, 'collection' => $collection);
     $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/admin/archivebrowse');
     return $oTemplate->render($aTemplateData);
 }
示例#2
0
 function do_new()
 {
     $this->oPage->setBreadcrumbDetails(_kt("New Link"));
     $this->oPage->setTitle(_kt("New Link"));
     $oPermission =& KTPermission::getByName('ktcore.permissions.write');
     if (PEAR::isError($oPermission) || !KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument)) {
         $this->errorRedirectToMain(_kt('You do not have sufficient permissions to add a document link'), sprintf("fDocumentId=%d", $this->oDocument->getId()));
         exit(0);
     }
     $oParentDocument =& $this->oDocument;
     if (PEAR::isError($oParentDocument)) {
         $this->errorRedirectToMain(_kt('Invalid parent document selected.'));
         exit(0);
     }
     $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', $oParentDocument->getFolderID()));
     if (PEAR::isError($oFolder) || $oFolder == false) {
         $this->errorRedirectToMain(_kt('Invalid folder selected.'));
         exit(0);
     }
     $iFolderId = $oFolder->getId();
     // Setup the collection for move display.
     $collection = new AdvancedCollection();
     $aBaseParams = array('fDocumentId' => $oParentDocument->getId());
     $oCR =& KTColumnRegistry::getSingleton();
     $col = $oCR->getColumn('ktcore.columns.selection');
     $aColOptions = array();
     $aColOptions['qs_params'] = kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId()));
     $aColOptions['show_folders'] = false;
     $aColOptions['show_documents'] = true;
     $aColOptions['rangename'] = 'linkselection[]';
     $col->setOptions($aColOptions);
     $collection->addColumn($col);
     $col = $oCR->getColumn('ktdocumentlinks.columns.title');
     $col->setOptions(array('qs_params' => kt_array_merge($aBaseParams, array('action' => 'new', 'fFolderId' => $oFolder->getId()))));
     $collection->addColumn($col);
     $qObj = new BrowseQuery($iFolderId);
     $collection->setQueryObject($qObj);
     $aOptions = $collection->getEnvironOptions();
     //$aOptions['is_browse'] = true;
     $aResultUrl = $aBaseParams;
     $aResultUrl['fFolderId'] = $oFolder->getId();
     $aResultUrl['action'] = 'new';
     $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aResultUrl);
     $collection->setOptions($aOptions);
     $aURLParams = $aBaseParams;
     $aURLParams['action'] = 'new';
     $aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams);
     // Add an electronic signature
     global $default;
     if ($default->enableESignatures) {
         $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
         $heading = _kt('You are attempting to add a document link');
         $submit['type'] = 'button';
         $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.add_link', 'document', 'document_add_link_form', 'submit', {$oParentDocument->iId});";
     } else {
         $submit['type'] = 'submit';
         $submit['onclick'] = '';
     }
     $aTemplateData = array('context' => $this, 'folder' => $oFolder, 'parent' => $oParentDocument, 'breadcrumbs' => $aBreadcrumbs, 'collection' => $collection, 'link_types' => LinkType::getList("id > 0"), 'submit' => $submit);
     $oTemplate =& $this->oValidator->validateTemplate('ktstandard/action/link');
     return $oTemplate->render($aTemplateData);
 }
示例#3
0
    function do_addUnit2()
    {
        $this->oPage->setBreadcrumbDetails(_kt('Add a new unit'));
        $this->oPage->setTitle(_kt("Add a new unit"));
        $aOptions = array('redirect_to' => array('addUnit'), 'message' => _kt('No name given'));
        $sName = $this->oValidator->validateString($_REQUEST['unit_name'], $aOptions);
        $aOptions['message'] = _kt('A unit with that name already exists.');
        $sName = $this->oValidator->validateDuplicateName('Unit', $sName, $aOptions);
        $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', 1);
        $_REQUEST['fFolderId'] = $iFolderId;
        $oFolder = $this->oValidator->validateFolder($_REQUEST['fFolderId']);
        // Setup the collection for move display.
        $collection = new AdvancedCollection();
        $oCR =& KTColumnRegistry::getSingleton();
        $col = $oCR->getColumn('ktcore.columns.title');
        $col->setOptions(array('qs_params' => array('fFolderId' => $oFolder->getId())));
        $collection->addColumn($col);
        $qObj = new FolderBrowseQuery($oFolder->getId());
        $collection->setQueryObject($qObj);
        $collection->empty_message = _kt('No folders available in this location.');
        $aOptions = $collection->getEnvironOptions();
        $collection->setOptions($aOptions);
        $oWF =& KTWidgetFactory::getSingleton();
        $oWidget = $oWF->get('ktcore.widgets.collection', array('label' => _kt('Target Folder'), 'description' => _kt('<p>The folder given below is where the unit folder will be created. Use the folder collection and path below to browse to the folder you wish to create the unit folder into.</p><p>The unit administrators have additional rights within that portion of the document management system.
</p>'), 'required' => true, 'name' => 'browse', 'folder_id' => $oFolder->getId(), 'collection' => $collection));
        $add_fields = array();
        $add_fields[] = new KTStaticTextWidget(_kt('Unit Name'), _kt('A short name for the unit.  e.g. <strong>Accounting</strong>.'), 'unit_name', $sName, $this->oPage, true);
        $add_fields[] = $oWidget;
        $oTemplating =& KTTemplating::getSingleton();
        $oTemplate = $oTemplating->loadTemplate("ktcore/principals/addunit2");
        $aTemplateData = array("context" => $this, "add_fields" => $add_fields, "unit_name" => $sName, "folder" => $oFolder, "name" => $sName);
        return $oTemplate->render($aTemplateData);
    }
示例#4
0
 function configure($aOptions)
 {
     if (!isset($aOptions['value'])) {
         $aOptions['value'] = KTUtil::arrayGet($aOptions, 'folder_id', 1);
     }
     $this->value = $aOptions['value'];
     $collection = new AdvancedCollection();
     $oCR =& KTColumnRegistry::getSingleton();
     $col = $oCR->getColumn('ktcore.columns.title');
     $col->setOptions(array('qs_params' => array('fMoveCode' => $sMoveCode, 'fFolderId' => $this->value, 'action' => 'startMove')));
     $collection->addColumn($col);
     $qObj = new FolderBrowseQuery(KTUtil::arrayGet($aOptions, 'value'));
     $collection->setQueryObject($qObj);
     $aO = $collection->getEnvironOptions();
     $collection->setOptions($aO);
     $aOptions['collection'] = $collection;
     $aOptions['broken_name'] = $false;
     return parent::configure($aOptions);
 }
示例#5
0
 function form_collectinfo()
 {
     $cancelUrl = $this->getReturnUrl();
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.actions.bulk.copy.form', 'label' => _kt('Copy Items'), 'submit_label' => _kt('Copy'), 'action' => 'performaction', 'fail_action' => 'collectinfo', 'cancel_url' => $cancelUrl, 'context' => $this));
     // Setup the collection for move display.
     require_once KT_LIB_DIR . '/browse/DocumentCollection.inc.php';
     $collection = new AdvancedCollection();
     $oCR =& KTColumnRegistry::getSingleton();
     $col = $oCR->getColumn('ktcore.columns.title');
     //$col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode,
     //                                          'fFolderId'=>$oFolder->getId(),
     //                                          'action'=>'startMove')));
     $collection->addColumn($col);
     $qObj = new FolderBrowseQuery($this->oFolder->iId);
     $exclude = array();
     foreach ($this->oEntityList->aFolderIds as $folderid) {
         $exclude[] = $folderid + 0;
     }
     $qObj->exclude_folders = $exclude;
     $collection->setQueryObject($qObj);
     $aOptions = $collection->getEnvironOptions();
     $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], array('fFolderId' => $this->oFolder->iId, 'action' => 'collectinfo'));
     $collection->setOptions($aOptions);
     $oWF =& KTWidgetFactory::getSingleton();
     $oWidget = $oWF->get('ktcore.widgets.collection', array('label' => _kt('Target Folder'), 'description' => _kt('Use the folder collection and path below to browse to the folder you wish to copy the documents into.'), 'required' => true, 'name' => 'fFolderId', 'broken_name' => true, 'folder_id' => $this->oFolder->iId, 'collection' => $collection));
     $oForm->addInitializedWidget($oWidget);
     // 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('name' => 'reason', 'label' => _kt('Reason'), 'description' => _kt('The reason for copying these documents and folders, for historical purposes.'), 'value' => null, 'required' => true)));
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'reason', 'output' => 'reason'))));
     if ($default->enableESignatures) {
         $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oFolder->getID(), 'type' => 'bulk', 'action' => 'ktcore.transactions.bulk_copy', 'test' => 'info', 'output' => 'info')));
     }
     return $oForm;
 }