Esempio n. 1
0
 function do_main()
 {
     //registerTypes registers the mime types and populates the needed tables.
     $indexer = Indexer::get();
     $indexer->registerTypes();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('Extractor Information', '/plugins/search2/reporting/templates');
     $oTemplate =& $oTemplating->loadTemplate('extractorinfo');
     $aExtractorInfo = KTMime::getMimeExtractorInformation();
     if (empty($aExtractorInfo)) {
         $oTemplate->setData(array('context' => $this, 'extractor_info' => $aExtractorInfo));
         return $oTemplate;
     }
     foreach ($aExtractorInfo as $key => $info) {
         $extractorClass = $info['name'];
         $extractor = $indexer->getExtractor($extractorClass);
         $info['mimeTypes'] = array();
         $aMimeTypes = $this->getSupportedMimeTypesDB($extractorClass);
         //$extractor->getSupportedMimeTypes();
         foreach ($aMimeTypes as $mimeType) {
             $sMimeInfo = KTMime::getFriendlyNameAndExtension($mimeType);
             $info['mimeTypes'][$mimeType] = array('description' => $sMimeInfo[0]['friendly_name'], 'extensions' => array($sMimeInfo[0]['filetypes']));
             $extensions = array();
             foreach ($sMimeInfo as $item) {
                 $extensions[] = $item['filetypes'];
             }
             $info['mimeTypes'][$mimeType]['extensions'] = implode(', ', $extensions);
         }
         $aExtractorInfo[$key] = $info;
     }
     $oTemplate->setData(array('context' => $this, 'extractor_info' => $aExtractorInfo));
     return $oTemplate;
 }
Esempio n. 2
0
 function do_main()
 {
     //registerTypes registers the mime types and populates the needed tables.
     $indexer = Indexer::get();
     $indexer->registerTypes();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate =& $oTemplating->loadTemplate('ktcore/search2/reporting/managemimetypes');
     $aMimeTypes = KTMime::getAllMimeTypesInformation();
     $indexer = Indexer::get();
     $numExtensions = 0;
     $numIndexedExtensions = 0;
     foreach ($aMimeTypes as $key => $mimeType) {
         $extractorClass = $mimeType['extractor'];
         $numExtensions++;
         if (empty($extractorClass)) {
             continue;
         }
         $extractor = $indexer->getExtractor($extractorClass);
         $aMimeTypes[$key]['extractor'] = $extractor->getDisplayName();
         $numIndexedExtensions++;
     }
     $indexedPercentage = 0;
     if ($numExtensions > 0) {
         $indexedPercentage = number_format($numIndexedExtensions * 100 / $numExtensions, 2, '.', ',');
     }
     $oTemplate->setData(array('context' => $this, 'mime_types' => $aMimeTypes, 'numExtensions' => $numExtensions, 'numIndexedExtensions' => $numIndexedExtensions, 'indexedPercentage' => $indexedPercentage));
     return $oTemplate;
 }
Esempio n. 3
0
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_migration');
     $config = KTConfig::getSingleton();
     $batchDocuments = $config->get('indexer/batchMigrateDocuments');
     $migratedDocuments = KTUtil::getSystemSetting('migratedDocuments', 0);
     $migratingDocuments = $this->migratingDocuments;
     $migrationStart = KTUtil::getSystemSetting('migrationStarted');
     if (is_null($migrationStart)) {
         $migrationStartString = _kt('Not started');
         $migrationPeriod = _kt('N/A');
         $estimatedTime = _kt('Unknown');
         $estimatedPeriod = $estimatedTime;
     } else {
         $migrationStartString = date('Y-m-d H:i:s', $migrationStart);
         $migrationTime = KTUtil::getSystemSetting('migrationTime', 0);
         $migrationPeriod = KTUtil::computePeriod($migrationTime, '');
         // Cannot divide by zero so make it 1
         $divMigratedDocuments = $migratedDocuments > 0 ? $migratedDocuments : 1;
         $timePerDocument = $migrationTime / $divMigratedDocuments;
         $estimatedPeriod = $timePerDocument * $migratingDocuments;
         $estimatedTime = date('Y-m-d H:i:s', $migrationStart + $estimatedPeriod);
         $estimatedPeriod = KTUtil::computePeriod($estimatedPeriod, '');
     }
     $aTemplateData = array('context' => $this, 'batchDocuments' => $batchDocuments, 'batchPeriod' => 'Periodically', 'migrationStart' => $migrationStartString, 'migrationPeriod' => $migrationPeriod, 'migratedDocuments' => $migratedDocuments, 'migratingDocuments' => $migratingDocuments, 'estimatedTime' => $estimatedTime, 'estimatedPeriod' => $estimatedPeriod);
     return $oTemplate->render($aTemplateData);
 }
 function setup()
 {
     $this->registerDashlet('BrowseableFolderDashlet', 'nbm.browseable.dashlet', 'BrowseableDashlet.php');
     require_once KT_LIB_DIR . "/templating/templating.inc.php";
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('browseabledashlet', '/plugins/browseabledashlet/templates');
 }
Esempio n. 5
0
 function do_main()
 {
     header('Content-Type: application/javascript; charset=UTF-8');
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/javascript_i18n");
     return $oTemplate->render();
 }
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics');
     $aTemplateData = array('context' => $this, 'stats' => $this->stats);
     return $oTemplate->render($aTemplateData);
 }
 function setup()
 {
     $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php');
     $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php');
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates');
 }
Esempio n. 8
0
 function do_main()
 {
     $this->oPage->setBreadcrumbDetails(_kt("transactions"));
     $this->oPage->setTitle(_kt('Folder transactions'));
     $folder_data = array();
     $folder_data["folder_id"] = $this->oFolder->getId();
     $this->oPage->setSecondaryTitle($this->oFolder->getName());
     $aTransactions = array();
     // FIXME do we really need to use a raw db-access here?  probably...
     $sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " . "FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " . "LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " . "WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
     $aParams = array($this->oFolder->getId());
     $res = DBUtil::getResultArray(array($sQuery, $aParams));
     if (PEAR::isError($res)) {
         var_dump($res);
         // FIXME be graceful on failure.
         exit(0);
     }
     // FIXME roll up view transactions
     $aTransactions = $res;
     // Set the namespaces where not in the transactions lookup
     foreach ($aTransactions as $key => $transaction) {
         if (empty($transaction['transaction_name'])) {
             $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
         }
     }
     // render pass.
     $this->oPage->title = _kt("Folder History");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/view_folder_history");
     $aTemplateData = array("context" => $this, "folder_id" => $folder_id, "folder" => $this->oFolder, "transactions" => $aTransactions);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 9
0
 function do_main()
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Role Management'));
     $this->oPage->setTitle(_kt('Role Management'));
     $edit_fields = array();
     $role_id = KTUtil::arrayGet($_REQUEST, 'role_id', null);
     if (is_null($role_id)) {
         $oRole = null;
         // handle broken case of role == -1
     } else {
         $oRole = Role::get($role_id);
     }
     if (PEAR::isError($oRole) || $oRole == false) {
         $for_edit = false;
     } else {
         $for_edit = true;
         $edit_fields[] = new KTStringWidget(_kt('Name'), _kt('A short, human-readable name for the role.'), 'name', $oRole->getName(), $this->oPage, true);
     }
     $aRoles =& Role::getList('id > 0');
     $add_fields = array();
     $add_fields[] = new KTStringWidget(_kt('Name'), _kt('A short, human-readable name for the role.'), 'name', null, $this->oPage, true);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/principals/roleadmin');
     $oTemplate->setData(array("context" => $this, "add_fields" => $add_fields, "for_edit" => $for_edit, 'edit_role' => $oRole, 'edit_fields' => $edit_fields, 'roles' => $aRoles));
     return $oTemplate;
 }
Esempio n. 10
0
 function do_verifyAndUpdate()
 {
     header('Content-Type: text/xml');
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/conditional_ajax_verifyAndUpdate");
     $aTemplateData = array();
     return $oTemplate->render($aTemplateData);
 }
 function setup()
 {
     $this->registerDashlet('MyDropDocumentsDashlet', 'klive.mydropdocuments.dashlet', 'MyDropDocumentsDashlet.php');
     $this->registerPage('MyDropDocuments', 'MyDropDocumentsPage', 'MyDropDocumentsPage.php');
     require_once KT_LIB_DIR . "/templating/templating.inc.php";
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('MyDropDocumentsDashlet', '/plugins/MyDropDocumentsPlugin/templates');
 }
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/indexing_status');
     $url = KTUtil::kt_url();
     $aTemplateData = array('context' => $this, 'indexerName' => $this->indexerName, 'indexerDiagnosis' => $this->indexerDiagnosis, 'extractorDiagnosis' => $this->extractorDiagnosis, 'rootUrl' => $url);
     return $oTemplate->render($aTemplateData);
 }
 function render()
 {
     global $main;
     $main->requireJSResource("resources/js/reorder.js");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/reorderdisplay");
     $aTemplateData = array("context" => $this, "items" => $this->aItems);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 14
0
 function do_main()
 {
     $aPlugins = KTPluginEntity::getAvailable();
     $aEnabledPluginIds = KTPluginEntity::getEnabledPlugins();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate =& $oTemplating->loadTemplate('ktcore/plugins/list');
     $oTemplate->setData(array('context' => $this, 'plugins' => $aPlugins, 'enabled_plugins' => $aEnabledPluginIds));
     return $oTemplate;
 }
Esempio n. 15
0
 /**
  * Dispatch function
  */
 function do_main()
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Indexer Statistics'));
     $indexer = Indexer::get();
     $stats = $indexer->getIndexStatistics();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics');
     $aTemplateData = array('context' => $this, 'stats' => $stats);
     return $oTemplate->render($aTemplateData);
 }
 function render()
 {
     global $main;
     $main->requireJSResource("plugins/MyDropDocumentsPlugin/js/update.js");
     $oPlugin =& $this->oPlugin;
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('MyDropDocumentsPlugin/dashlet');
     $aTemplateData = array('context' => $this, 'url' => $oPlugin->getPagePath('MyDropDocuments'));
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 17
0
 /**
  * Dispatch function
  */
 function do_main()
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Indexer Statistics'));
     $stats = KTUtil::getSystemSetting('indexerStats');
     $this->stats = unserialize($stats);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics');
     $aTemplateData = array('context' => $this, 'stats' => $this->stats);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 18
0
 /**
  * Render function for template
  *
  * @return unknown
  */
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('TagCloud/dashlet');
     $aTags = $this->get_tag_weightings($aTags);
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.tagcloud.plugin');
     $url = $oPlugin->getPagePath('TagCloudRedirection');
     $aTemplateData = array('tags' => $aTags, 'url' => $url);
     return $oTemplate->render($aTemplateData);
 }
 function do_main()
 {
     //get document object
     $oDocument = $this->oDocument;
     // get document id
     $iDId = $oDocument->getID();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssdocumentaction');
     $aTemplateData = array('context' => $this, 'link' => KTrss::getRssLink($iDId, 'document'), 'linkIcon' => KTrss::getImageLink($iDId, 'document'));
     return $oTemplate->render($aTemplateData);
 }
 function do_main()
 {
     //get folder object
     $oFolder = $this->oFolder;
     // get folder id
     $iFId = $oFolder->getID();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssfolderaction');
     $aTemplateData = array('context' => $this, 'link' => KTrss::getRssLink($iFId, 'folder'), 'linkIcon' => KTrss::getImageLink($iFId, 'folder'), 'folderName' => $this->oFolder->getName());
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 21
0
 function getReplacementItemData($oHelpReplacement, $sTitle = null)
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Help Administration'));
     $sTitle = is_null($sTitle) ? $oHelpReplacement->getTitle() : $sTitle;
     $this->oPage->setTitle(_kt('Editing: ') . $sTitle);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/manage_help_item");
     $aTemplateData = array("context" => &$this, "help" => $oHelpReplacement);
     $this->aBreadcrumbs[] = array('name' => _kt('Edit help item'));
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 22
0
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/external_resources');
     $sUrl = KTUtil::kt_url();
     foreach ($this->resources as $k => $v) {
         $this->resources[$k]['status'] = str_replace(array("\n", _kt('Administrator Guide')), array('<br>', sprintf("<a target='_blank' href=\"http://www.knowledgetree.com/go/ktAdminManual\">%s</a>", _kt('Administrator Guide'))), $v['status']);
     }
     $aTemplateData = array('context' => $this, 'resources' => $this->resources, 'url' => $sUrl);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 23
0
 function setup()
 {
     // automatically register the plugin
     $this->registerAction('folderaction', 'RSSFolderLinkAction', 'ktcore.rss.plugin.folder.link', $sFilename = null);
     $this->registerAction('documentaction', 'RSSDocumentLinkAction', 'ktcore.rss.plugin.document.link', $sFilename = null);
     $this->registerDashlet('RSSDashlet', 'ktcore.rss.feed.dashlet', 'RSSDashlet.php');
     $this->registerDashlet('RSSDedicatedDashlet', 'ktcore.dedicated.rss.feed.dashlet', 'RSSDedicatedDashlet.php');
     $this->registerPage('managerssfeeds', 'ManageRSSFeedsDispatcher');
     require_once KT_LIB_DIR . "/templating/templating.inc.php";
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('RSS Plugin', '/plugins/rssplugin/templates');
 }
Esempio n. 24
0
 /**
  * Dispatch function
  */
 function do_main()
 {
     // Load Templating Engine
     $oTemplating =& KTTemplating::getSingleton();
     // Set Template to use
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/indexing_status');
     // Do a runtime Service Resource Check
     $checker = new ResourceChecker();
     $checker->check();
     // Get Results
     $serviceErrors = KTUtil::getSystemSetting('externalResourceIssues');
     $serviceErrors = unserialize($serviceErrors);
     // Array to Hold Items not working
     $this->serviceErrors = array();
     // A reference array to use with extractors that depend on the service
     $errorReference = array();
     if (count($serviceErrors) > 0) {
         // Add Service Errors
         foreach ($serviceErrors as $error) {
             $this->serviceErrors[$error['name']] = array('name' => $error['name'], 'status' => $error['status'], 'help' => IndexingHelp::getHelp($error['name']));
             // Create Reference to the array
             $errorReference[$error['status']] =& $this->serviceErrors[$error['name']];
         }
     }
     // ---------------------------
     // Do a run time check for extractors not working
     Indexer::updateIndexStats();
     // Get Results
     $extractorDiagnosis = KTUtil::getSystemSetting('extractorDiagnostics');
     if (!empty($extractorDiagnosis)) {
         $extractorDiagnosis = unserialize($extractorDiagnosis);
     }
     // Create an Array to store errors
     $this->extractorErrors = array();
     if (count($extractorDiagnosis > 0)) {
         foreach ($extractorDiagnosis as $extractor => $props) {
             // Check if Extractor fault is due to a service not running
             if (array_key_exists($props['diagnosis'], $errorReference)) {
                 // One service may affect multiple extractors
                 $errorReference[$props['diagnosis']]['alsoaffects'] = array(array('extractor' => $props['name'], 'affectedtypes' => IndexingHelp::affectedTypes($extractor)));
             } else {
                 // Else list as normal extractor error
                 $this->extractorErrors[$extractor] = array('name' => $props['name'], 'status' => $props['diagnosis'], 'help' => IndexingHelp::getHelp($extractor), 'affectedtypes' => IndexingHelp::affectedTypes($extractor));
             }
         }
     }
     // Create URL to Send to Template
     $url = KTUtil::kt_url();
     // Prepare Template Data
     $aTemplateData = array('context' => $this, 'serviceErrors' => $this->serviceErrors, 'extractorErrors' => $this->extractorErrors, 'url' => $url);
     // Send to template and render
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 25
0
 function setup()
 {
     // Register the interceptor
     $this->registerInterceptor('PasswordResetInterceptor', 'password.reset.login.interceptor', __FILE__);
     // Interceptor has to be added to the DB to be found
     $aOptions = array('sName' => 'Password Reset Interceptor', 'sInterceptorNamespace' => 'password.reset.login.interceptor', 'sConfig' => '');
     KTInterceptorInstance::createFromArray($aOptions);
     // Add templates directory to list
     $dir = dirname(__FILE__);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('passwordResetPlugin', $dir . '/templates');
 }
Esempio n. 26
0
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('browseabledashlet/dashlet');
     $aFolders = KTBrowseUtil::getBrowseableFolders($this->oUser);
     if (PEAR::isError($aFolders)) {
         // just hide it.
         $aFolders = array();
     }
     $aTemplateData = array('folders' => $aFolders);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 27
0
 function render()
 {
     global $main;
     $main->requireJSResource("plugins/rssplugin/js/update.js");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('RSSPlugin/dedicated_dashlet');
     $iUId = $this->oUser->getId();
     $oKTConfig =& KTConfig::getSingleton();
     $sUrl = $oKTConfig->get('urls/dedicatedrssurl', '');
     // Prepare template data
     $aTemplateData = array('context' => $this, 'url' => $sUrl, 'user' => $iUId);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 28
0
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/search2/search_portlet");
     $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', 1);
     $iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
     if (!$iFolderId && !$iDocumentId) {
         return null;
     }
     $savedSearches = SearchHelper::getSavedSearches($_SESSION['userID']);
     $aTemplateData = array('context' => $this, 'folder_id' => $iFolderId, 'document_id' => $iDocumentId, 'savedSearches' => $savedSearches);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 29
0
 function render()
 {
     // very simple, general purpose passthrough.  Chances are this is sufficient,
     // just override the template being used.
     $bHasErrors = false;
     if (count($this->aErrors) != 0) {
         $bHasErrors = true;
     }
     //var_dump($this->aErrors);
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate($this->sTemplate);
     $aTemplateData = array("context" => $this, "label" => $this->sLabel, "description" => $this->sDescription, "name" => $this->sName, "required" => $this->bRequired, "page" => $this->oPage, "has_id" => $this->sId !== null, "id" => $this->sId, "has_value" => $this->value !== null, "value" => $this->value, "has_errors" => $bHasErrors, "errors" => $this->aErrors, "options" => $this->aOptions);
     return $oTemplate->render($aTemplateData);
 }
 function getTypeMetadataFieldsets($iDocumentTypeID)
 {
     $fieldsets = array();
     $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton();
     $activesets = KTFieldset::getForDocumentType($iDocumentTypeID);
     foreach ($activesets as $oFieldset) {
         $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace());
         array_push($fieldsets, new $displayClass($oFieldset));
     }
     $aTemplateData = array('fieldsets' => $fieldsets);
     $oTemplating = KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/metadata/editable_metadata_fieldsets");
     return $oTemplate->render($aTemplateData);
 }