Пример #1
0
    /**
     * Generates the module content
     *
     * @return void
     */
    protected function getModuleContent()
    {
        //// TEMPORARY
        // TODO add a "discover/update Solr connections button to the global section"
        $content = '
			<input type="hidden" id="solraction" name="solraction" value="" />
			';
        $content .= '<fieldset><legend>Site Actions</legend>';
        $content .= $this->renderIndexQueueInitializationSelector();
        $content .= '
				<input type="submit" value="Initialize Index Queue" name="s_initializeIndexQueue" onclick="document.forms[0].solraction.value=\'initializeIndexQueue\';" /> ';
        $content .= t3lib_BEfunc::wrapInHelp('', '', '', array('title' => 'Index Queue Initialization', 'description' => 'Initializing the Index Queue is the most complete way to force reindexing, or to build the Index Queue for
							 the first time. The Index Queue Worker scheduler task will then index the items listed in the Index Queue.
							 Initializing the Index Queue without selecting specific indexing configurations will behave like selecting all.'));
        $content .= '
				<br /><br /><hr /><br />
				<input type="submit" value="Clean up Site Index" name="s_cleanupSiteCores" onclick="document.forms[0].solraction.value=\'cleanupSiteCores\';" />';
        $content .= '
				<br /><br />
				<input type="submit" value="Empty Site Index" name="s_deleteSiteDocuments" onclick="Check = confirm(\'This will commit documents which may be pending, delete documents belonging to the currently selected site and commit again afterwards. Are you sure you want to delete the site\\\'s documents?\'); if (Check == true) document.forms[0].solraction.value=\'deleteSiteDocuments\';" />
			';
        $content .= '
				<br /><br />
				<input type="submit" value="Reload Index Configuration" name="s_reloadCore" onclick="document.forms[0].solraction.value=\'reloadSiteCores\';" />';
        $content .= '
			<br /><br /><hr /><br />
			<p>
				Delete document(s) from site index<br /><br />
			</p>
			<label for="delete_uid" style="display:block;width:60px;float:left">Item uid</label>
			<input id="delete_uid" type="text" name="delete_uid" value="" /> (also accepts comma separated lists of uids)<br /><br />
			<label for="delete_type" style="display:block;width:60px;float:left;">Item type</label>
			<input id="delete_type" type="text" name="delete_type" value="" /> (table name)<br /><br />
			<input type="submit" value="Delete Document(s)"name="s_deleteDocument" onclick="document.forms[0].solraction.value=\'deleteDocument\';" /><br /><br />
			';
        $content .= '</fieldset>';
        $content .= '
			<fieldset>
				<legend>Global Actions (affecting all sites and indexes)</legend>
				<input type="submit" value="Empty Index" name="s_emptyIndex" onclick="Check = confirm(\'This will commit documents which may be pending, clear the index and commit again afterwards. Are you sure you want to empty the index?\'); if (Check == true) document.forms[0].solraction.value=\'emptyIndex\';" /><br /><br />
			</fieldset>';
        $content .= '
			<hr class="double" />
			API Key: ' . Tx_Solr_Api::getApiKey();
        // TODO add a checkbox to the delete documents fields to also remove from Index Queue
        switch ($_POST['solraction']) {
            case 'initializeIndexQueue':
                $this->initializeIndexQueue();
                break;
            case 'cleanupSiteCores':
                $this->cleanupSiteIndex();
                break;
            case 'deleteSiteDocuments':
                $this->deleteSiteDocuments();
                break;
            case 'reloadSiteCores':
                $this->reloadSiteCores();
                break;
            case 'emptyIndex':
                $this->emptyIndex();
                break;
            case 'deleteDocument':
                $this->deleteDocument();
                break;
            default:
        }
        $this->content .= $this->doc->section('Apache Solr for TYPO3', $content, FALSE, TRUE);
    }
 /**
  * Index action, shows an overview of the state of the Solr index
  *
  * @return void
  */
 public function indexAction()
 {
     $this->checkConnections();
     $this->view->assign('site', $this->request->getArgument('site'));
     $this->view->assign('apiKey', \Tx_Solr_Api::getApiKey());
 }