function do_main() { $this->oPage->setBreadcrumbDetails(_kt("rename")); $this->oPage->setTitle(_kt('Rename folder')); $oTemplate =& $this->oValidator->validateTemplate('ktcore/folder/rename'); $fields = array(); $fields[] = new KTStringWidget(_kt('New folder name'), _kt('The name to which the current folder should be renamed.'), 'foldername', $this->oFolder->getName(), $this->oPage, true); global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to rename a folder'); $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$this->oFolder->getId()});"; $input['type'] = 'button'; } else { $input['onclick'] = ''; $input['type'] = 'submit'; } $oTemplate->setData(array('context' => &$this, 'fields' => $fields, 'input' => $input, 'folderName' => $this->oFolder->getName())); return $oTemplate->render(); }
function do_change_enabled() { $this->startTransaction(); $iLicenses = 0; $bRequireLicenses = false; if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { $path = KTPluginUtil::getPluginPath('ktdms.wintools'); require_once $path . 'baobabkeyutil.inc.php'; $iLicenses = BaobabKeyUtil::getLicenseCount(); $bRequireLicenses = true; } // admin and anonymous are automatically ignored here. $iEnabledUsers = User::getNumberEnabledUsers(); if ($_REQUEST['update_value'] == 'enable') { foreach (KTUtil::arrayGet($_REQUEST, 'edit_user', array()) as $sUserId => $v) { // check that we haven't hit max user limit if ($bRequireLicenses && $iEnabledUsers >= $iLicenses) { // if so, add to error messages, but commit transaction (break this loop) $_SESSION['KTErrorMessage'][] = _kt('You may only have ') . $iLicenses . _kt(' users enabled at one time.'); break; } // else enable user $oUser = User::get((int) $sUserId); if (PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } $oUser->enable(); $res = $oUser->update(); if (PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } $iEnabledUsers++; } } if ($_REQUEST['update_value'] == 'disable') { //echo 'got into disable'; //exit; foreach (KTUtil::arrayGet($_REQUEST, 'edit_user', array()) as $sUserId => $v) { $oUser = User::get((int) $sUserId); if (PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } $oUser->disable(); $res = $oUser->update(); if (PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } $iEnabledUsers--; } } if ($_REQUEST['update_value'] == 'delete') { //echo 'Delete called'; foreach (KTUtil::arrayGet($_REQUEST, 'edit_user', array()) as $sUserId => $v) { $oUser = User::get((int) $sUserId); if (PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } $oUser->delete(); $res = $oUser->update(); if (PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } $iEnabledUsers--; } } $this->commitTransaction(); $this->successRedirectToMain(_kt('Users updated')); }
function do_main() { $this->oPage->setBreadcrumbDetails(_kt('workflow')); $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/documentWorkflow'); $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); $oWorkflow = KTWorkflowUtil::getWorkflowForDocument($oDocument); $oWorkflowState = KTWorkflowUtil::getWorkflowStateForDocument($oDocument); $oUser =& User::get($_SESSION['userID']); // If the document is checked out - set transitions and workflows to empty and set checkedout to true $bIsCheckedOut = $this->oDocument->getIsCheckedOut(); if ($bIsCheckedOut) { $aTransitions = array(); $aWorkflows = array(); $transition_fields = array(); $bHasPerm = FALSE; } else { $aTransitions = KTWorkflowUtil::getTransitionsForDocumentUser($oDocument, $oUser); $aWorkflows = KTWorkflow::getList('start_state_id IS NOT NULL AND enabled = 1 '); $bHasPerm = false; if (KTPermissionUtil::userHasPermissionOnItem($oUser, 'ktcore.permissions.workflow', $oDocument)) { $bHasPerm = true; } $fieldErrors = null; $transition_fields = array(); if ($aTransitions) { $aVocab = array(); foreach ($aTransitions as $oTransition) { if (is_null($oTransition) || PEAR::isError($oTransition)) { continue; } $aVocab[$oTransition->getId()] = $oTransition->showDescription(); } $fieldOptions = array('vocab' => $aVocab); $transition_fields[] = new KTLookupWidget(_kt('Transition to perform'), _kt('The transition listed will cause the document to change from its current state to the listed destination state.'), 'fTransitionId', null, $this->oPage, true, null, $fieldErrors, $fieldOptions); $transition_fields[] = new KTTextWidget(_kt('Reason for transition'), _kt('Describe why this document qualifies to be changed from its current state to the destination state of the transition chosen.'), 'fComments', '', $this->oPage, true, null, null, array('cols' => 80, 'rows' => 4)); } } // Add an electronic signature global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to modify the document workflow'); $submit['type'] = 'button'; $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.modify_workflow', 'document', 'start_workflow_form', 'submit', {$this->oDocument->iId});"; $heading2 = _kt('You are attempting to transition the document workflow'); $submit2['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading2}', 'ktcore.transactions.transition_workflow', 'document', 'transition_wf_form', 'submit', {$this->oDocument->iId});"; } else { $submit['type'] = 'submit'; $submit['onclick'] = ''; $submit2['onclick'] = ''; } $aTemplateData = array('oDocument' => $oDocument, 'oWorkflow' => $oWorkflow, 'oState' => $oWorkflowState, 'aTransitions' => $aTransitions, 'aWorkflows' => $aWorkflows, 'transition_fields' => $transition_fields, 'bHasPerm' => $bHasPerm, 'bIsCheckedOut' => $bIsCheckedOut, 'submit' => $submit, 'submit2' => $submit2); return $oTemplate->render($aTemplateData); }
function render() { global $default; $oConfig = KTConfig::getSingleton(); if (empty($this->contents)) { $this->contents = ""; } if (is_string($this->contents) && trim($this->contents) === "") { $this->addError(_kt("This page did not produce any content")); $this->contents = ""; } if (!is_string($this->contents)) { $this->contents = $this->contents->render(); } // if we have no portlets, make the ui a tad nicer. if (empty($this->portlets)) { $this->show_portlets = false; } if (empty($this->title)) { if (!empty($this->breadcrumbDetails)) { $this->title = $this->breadcrumbDetails; } else { if (!empty($this->breadcrumbs)) { $this->title = array_slice($this->breadcrumbs, -1); $this->title = $this->title[0]['label']; } else { if (!empty($this->breadcrumbSection)) { $this->title = $this->breadcrumbSection['label']; } else { $this->title = $this->componentLabel; } } } } $this->userMenu = array(); $sBaseUrl = KTUtil::kt_url(); if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) { if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) { $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl . '/presentation/logout.php'); } else { if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to modify Preferences'); $this->userMenu['preferences']['url'] = '#'; $this->userMenu['preferences']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_preferences', 'system', '{$sBaseUrl}/preferences.php', 'redirect');"; } else { $this->userMenu['preferences']['url'] = $sBaseUrl . '/preferences.php'; } // $this->userMenu['preferences'] = array('label' => _kt('Preferences'), 'url' => $sBaseUrl.'/preferences.php'); $this->userMenu['preferences']['label'] = _kt('Preferences'); $this->userMenu['aboutkt'] = array('label' => _kt('About'), 'url' => $sBaseUrl . '/about.php'); $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl . '/presentation/logout.php'); } } else { $this->userMenu['login'] = array('label' => _kt('Login'), 'url' => $sBaseUrl . '/login.php'); } // FIXME we need a more complete solution to navigation restriction if (!is_null($this->menu['administration']) && !is_null($this->user)) { if (!Permission::userIsSystemAdministrator($this->user->getId())) { unset($this->menu['administration']); } } $sContentType = 'Content-type: ' . $this->contentType; if (!empty($this->charset)) { $sContentType .= '; charset=' . $this->charset; } header($sContentType); $savedSearches = SearchHelper::getSavedSearches($_SESSION['userID']); $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate($this->template); $aTemplateData = array("page" => $this, "systemversion" => $default->systemVersion, "versionname" => $default->versionName, 'smallVersion' => substr($default->versionName, -17), 'savedSearches' => $savedSearches); if ($oConfig->get("ui/automaticRefresh", false)) { $aTemplateData['refreshTimeout'] = (int) $oConfig->get("session/sessionTimeout") + 3; } // unlike the rest of KT, we use echo here. echo $oTemplate->render($aTemplateData); }
function do_external() { $this->oPage->setBreadcrumbDetails(_kt("New External Link")); $this->oPage->setTitle(_kt("New External 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; $iParentId = $oParentDocument->getId(); // Add an electronic signature global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to add an external document link'); $submit['type'] = 'button'; $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.add_external_link', 'document', 'document_add_ext_link_form', 'submit', {$oParentDocument->iId});"; } else { $submit['type'] = 'submit'; $submit['onclick'] = ''; } $aTemplateData = array('context' => $this, 'iDocId' => $iParentId, 'link_types' => LinkType::getList("id > 0"), 'submit' => $submit); $oTemplate =& $this->oValidator->validateTemplate('ktstandard/action/link_external'); return $oTemplate->render($aTemplateData); }
function do_main() { $this->oPage->setBreadcrumbDetails(_kt("Rename")); $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/rename'); $fields = array(); $fields[] = new KTStaticTextWidget(_kt('Current file name'), _kt('The current file name is shown below:'), 'oldfilename', $this->oDocument->getFileName(), $this->oPage, false); $fields[] = new KTStringWidget(_kt('New file name'), _kt('The name to which the current file should be renamed.'), 'filename', $this->oDocument->getFileName(), $this->oPage, true); // Add an electronic signature global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to rename the document'); $submit['type'] = 'button'; $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.rename', 'document', 'document_rename_form', 'submit', {$this->oDocument->iId});"; } else { $submit['type'] = 'submit'; $submit['onclick'] = ''; } $oTemplate->setData(array('context' => &$this, 'fields' => $fields, 'submit' => $submit)); return $oTemplate->render(); }
// site map definition require_once KT_DIR . '/config/siteMap.inc'; require_once KT_LIB_DIR . '/session/Session.inc'; require_once KT_LIB_DIR . '/session/control.inc'; require_once KT_LIB_DIR . '/plugins/pluginutil.inc.php'; if ($checkup !== true) { // Replace function later /* ** Get the page being loaded and load the plugins specific to the page ** */ $sScriptName = $GLOBALS['_SERVER']['SCRIPT_NAME']; $sScript = basename($sScriptName); $pos = strpos($sScript, '.'); $sType = substr($sScript, 0, $pos); KTPluginUtil::loadPlugins($sType); } if ($checkup !== true) { if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { $path = KTPluginUtil::getPluginPath('ktdms.wintools'); require_once $path . 'baobabkeyutil.inc.php'; $name = BaobabKeyUtil::getName(); if ($name) { $default->versionName = sprintf('%s %s', $default->versionName, $name); } } else { $default->versionName = $default->versionName . ' ' . _kt('(Community Edition)'); } } if (!extension_loaded('mbstring')) { require_once KT_LIB_DIR . '/mbstring.inc.php'; } require_once KT_LIB_DIR . '/templating/kt3template.inc.php'; $GLOBALS['main'] = new KTPage();
function do_edit() { $this->oPage->setBreadcrumbDetails(_kt('Viewing Permissions')); $iFolderId = $this->oFolder->getId(); $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId()); $aOptions = array('redirect_to' => array('main', 'fFolderId=' . $iFolderId)); if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) { $this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions); } // copy permissions if they were inherited $oInherited = KTPermissionUtil::findRootObjectForPermissionObject($oPO); if ($oInherited->getId() !== $iFolderId) { $override = KTUtil::arrayGet($_REQUEST, 'override', false); if (empty($override)) { $this->errorRedirectToMain(_kt('This folder does not override its permissions'), sprintf('fFolderId=%d', $iFolderId)); } $this->startTransaction(); $this->_copyPermissions(); $this->commitTransaction(); $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId()); } // permissions in JS format $aPermissionsToJSON = array(); $aPermList = KTPermission::getList(); foreach ($aPermList as $oP) { $aPermissionsToJSON[] = array('id' => $oP->getId(), 'name' => $oP->getHumanName()); } $oJSON = new Services_JSON(); $sJSONPermissions = $oJSON->encode($aPermissionsToJSON); // dynamic conditions $aDynamicConditions = KTPermissionDynamicCondition::getByPermissionObject($oPO); // templating $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/folder/permissions'); $bCanInherit = $iFolderId != 1; global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to modify permissions'); $input['type'] = 'button'; $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});"; } else { $input['type'] = 'submit'; $input['onclick'] = ''; } $perms = $aPermList; $docperms = KTPermission::getDocumentRelevantList(); $aTemplateData = array('iFolderId' => $iFolderId, 'roles' => Role::getList(), 'groups' => Group::getList(), 'conditions' => KTSavedSearch::getConditions(), 'dynamic_conditions' => $aDynamicConditions, 'context' => &$this, 'foldername' => $this->oFolder->getName(), 'jsonpermissions' => $sJSONPermissions, 'edit' => true, 'permissions' => $perms, 'document_permissions' => $docperms, 'can_inherit' => $bCanInherit, 'input' => $input); return $oTemplate->render($aTemplateData); }
function do_main() { $this->oPage->setBreadcrumbDetails(_kt("bulk upload")); $oTemplate =& $this->oValidator->validateTemplate('ktcore/folder/bulkUpload'); $add_fields = array(); $add_fields[] = new KTFileUploadWidget(_kt('Archive file'), _kt('The archive file containing the documents you wish to add to the document management system.'), 'file', "", $this->oPage, true, "file"); $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(); } } $fieldOptions = array("vocab" => $aVocab); $add_fields[] = new KTLookupWidget(_kt('Document Type'), _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); $fieldsets = array(); $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton(); $activesets = KTFieldset::getGenericFieldsets(); foreach ($activesets as $oFieldset) { $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); array_push($fieldsets, new $displayClass($oFieldset)); } // 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'] = ''; } $oTemplate->setData(array('context' => &$this, 'submit' => $submit, 'add_fields' => $add_fields, 'generic_fieldsets' => $fieldsets)); return $oTemplate->render(); }
$sub_url = trim($sub_url); $sub_url = trim($sub_url, '/'); if (empty($sub_url)) { $oDispatcher = new AdminSplashDispatcher(); } else { $oRegistry =& KTAdminNavigationRegistry::getSingleton(); if ($oRegistry->isRegistered($sub_url)) { $oDispatcher = $oRegistry->getDispatcher($sub_url); $aParts = explode('/', $sub_url); $oRegistry =& KTAdminNavigationRegistry::getSingleton(); $aCategory = $oRegistry->getCategory($aParts[0]); $oDispatcher->aBreadcrumbs = array(); $oDispatcher->aBreadcrumbs[] = array('action' => 'administration', 'name' => _kt('Administration')); $oDispatcher->aBreadcrumbs[] = array('name' => $aCategory['title'], 'url' => KTUtil::ktLink('admin.php', $aParts[0])); } else { // FIXME (minor) redirect to no-suburl? $oDispatcher = new AdminSplashDispatcher(); $oDispatcher->category = $sub_url; } } // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes global $main; global $default; if ($default->enableAdminSignatures && $_SESSION['electronic_signature_time'] < time()) { $sBaseUrl = KTUtil::kt_url(); $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to access Administration'); $main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/browse.php', 'close');"); } $oDispatcher->dispatch(); // we _may_ be redirected at this point (see KTAdminNavigation)
function do_editRoleGroups() { $iFolderId = $this->oFolder->getId(); $role_allocation_id = KTUtil::arrayGet($_REQUEST, 'alloc_id'); if ($iFolderId == 1 && is_null($role_allocation_id)) { $oRoleAllocation = $this->rootoverride($_REQUEST['role_id']); } else { $oRoleAllocation = RoleAllocation::get($role_allocation_id); } if (PEAR::isError($oRoleAllocation) || $oRoleAllocation === false) { $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d', $iFolderId)); } $oRole = Role::get($oRoleAllocation->getRoleId()); $this->oPage->setBreadcrumbDetails(_kt('Manage Groups for Role')); $this->oPage->setTitle(sprintf(_kt('Manage Groups for Role "%s"'), $oRole->getName())); $initJS = 'var optGroup = new OptionTransfer("groupSelect","chosenGroups"); ' . 'function startTrans() { var f = getElement("grouproleform"); ' . ' optGroup.saveNewRightOptions("groupFinal"); ' . ' optGroup.init(f); }; ' . ' addLoadEvent(startTrans); '; $this->oPage->requireJSStandalone($initJS); $aInitialUsers = $oRoleAllocation->getGroups(); $aAllUsers = Group::getList(); // FIXME this is massively non-performant for large userbases.. $aRoleUsers = array(); $aFreeUsers = array(); foreach ($aInitialUsers as $oGroup) { $aRoleUsers[$oGroup->getId()] = $oGroup; } foreach ($aAllUsers as $oGroup) { if (!array_key_exists($oGroup->getId(), $aRoleUsers)) { $aFreeUsers[$oGroup->getId()] = $oGroup; } } // Include the electronic signature on the permissions action global $default; if ($default->enableESignatures) { $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); $heading = _kt('You are attempting to modify roles'); $input['type'] = 'button'; $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', 'grouproleform', 'submit', {$iFolderId});"; } else { $input['type'] = 'submit'; $input['onclick'] = ''; } $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate("ktcore/folder/roles_managegroups"); $aTemplateData = array("context" => $this, "edit_rolealloc" => $oRoleAllocation, 'unused_groups' => $aFreeUsers, 'role_groups' => $aRoleUsers, 'rolename' => $oRole->getName(), 'input' => $input); return $oTemplate->render($aTemplateData); }
public function renderThumbnail($documentId) { // Set up the template $oKTTemplating =& KTTemplating::getSingleton(); $oTemplate =& $oKTTemplating->loadTemplate('thumbnail_viewlet'); if (is_null($oTemplate)) { return ''; } // Check that the thumbnail exists on disk global $default; $varDir = $default->varDirectory; $thumbnailCheck = $varDir . '/thumbnails/' . $documentId . '.jpg'; // Use correct slashes for windows if (strpos(PHP_OS, 'WIN') !== false) { $thumbnailCheck = str_replace('/', '\\', $thumbnailCheck); } // if the thumbnail doesn't exist try to create it if (!file_exists($thumbnailCheck)) { $thumbnailer = new thumbnailGenerator(); $thumbnailer->setDocument($this->oDocument); $thumbnailer->processDocument(); // if it still doesn't exist, return an empty string if (!file_exists($thumbnailCheck)) { return ''; } } // check for existence and status of the instant view plugin $url = ''; if (KTPluginUtil::pluginIsActive('instaview.processor.plugin')) { require_once KTPluginUtil::getPluginPath('instaview.processor.plugin') . 'instaViewLinkAction.php'; $ivLinkAction = new instaViewLinkAction(); $url = $ivLinkAction->getViewLink($documentId, 'document'); } // Get the url to the thumbnail and render it // Ensure url has correct slashes $sHostPath = KTUtil::kt_url(); $plugin_path = KTPluginUtil::getPluginPath('thumbnails.generator.processor.plugin'); $thumbnailUrl = $plugin_path . 'thumbnail_view.php?documentId=' . $documentId; $thumbnailUrl = str_replace('\\', '/', $thumbnailUrl); $thumbnailUrl = str_replace(KT_DIR, $sHostPath, $thumbnailUrl); $oTemplate->setData(array('thumbnail' => $thumbnailUrl, 'url' => $url)); return $oTemplate->render(); }
/** * 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 getKTEdition() { $edition = 'Community|-'; if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { $path = KTPluginUtil::getPluginPath('ktdms.wintools'); require_once $path . 'baobabkeyutil.inc.php'; $edition = BaobabKeyUtil::getName(); // this could be done with regular expressions... // Remove the brackets around the name $edition = substr($edition, 1); $edition = substr($edition, 0, strlen($edition) - 1); // Remove the "users" $pos = strpos($edition, 'users'); $edition = $pos === false ? $edition . '|-' : substr($edition, 0, $pos - 1); // Replace the , with | $edition = str_replace(', ', '|', $edition); } return $edition; }