function execute( $par ) {
		global $wgOut, $wgRequest;

		require_once( "forms.php" );
		require_once( "type.php" );
		require_once( "OmegaWikiAttributes.php" );
		require_once( "ViewInformation.php" );

		initializeOmegaWikiAttributes( new ViewInformation() );
		$wgOut->setPageTitle( wfMsg( 'ow_needs_xlation_title' ) );

		$destinationLanguageId = array_key_exists( 'to-lang', $_GET ) ? $_GET['to-lang']:'';
		$collectionId = array_key_exists( 'collection', $_GET ) ? $_GET['collection'] : '';
		$sourceLanguageId = array_key_exists( 'from-lang', $_GET ) ? $_GET['from-lang'] : '';
                                                                
		$wgOut->addHTML( getOptionPanel(
			array(
				wfMsg( 'ow_needs_xlation_dest_lang' ) => getSuggest( 'to-lang', 'language', array(), $destinationLanguageId, languageIdAsText( $destinationLanguageId ) ),
				wfMsg( 'ow_needs_xlation_source_lang' ) => getSuggest( 'from-lang', 'language', array(), $sourceLanguageId, languageIdAsText( $sourceLanguageId ) ),
				wfMsg( 'ow_Collection_colon' ) => getSuggest( 'collection', 'collection', array(), $collectionId, collectionIdAsText( $collectionId ) )
			)
		) );

		if ( $destinationLanguageId == '' )
			$wgOut->addHTML( '<p>' . wfMsg( 'ow_needs_xlation_no_dest_lang' ) . '</p>' );
		else
			$this->showExpressionsNeedingTranslation( $sourceLanguageId, $destinationLanguageId, $collectionId );
	}
Exemplo n.º 2
0
function convertToHTML( $value, $type ) {
	global $wgDefinedMeaning;
	switch( $type ) {
		case "boolean": return booleanAsHTML( $value );
		case "spelling": return spellingAsLink( $value );
		case "collection": return collectionAsLink( $value );
		case "$wgDefinedMeaning": return definedMeaningAsLink( $value );
		case "defining-expression": return definingExpressionAsLink( $value );
		case "relation-type": return definedMeaningAsLink( $value );
		case "attribute": return definedMeaningAsLink( $value );
		case "language": return languageIdAsText( $value );
		case "short-text":
		case "text": return htmlspecialchars( $value );
		default: return htmlspecialchars( $value );
	}
}
Exemplo n.º 3
0
 function search($searchText)
 {
     global $wgOut, $wgRequest, $wgFilterLanguageId, $wgSearchWithinWordsDefaultValue, $wgSearchWithinExternalIdentifiersDefaultValue, $wgShowSearchWithinExternalIdentifiersOption, $wgShowSearchWithinWordsOption;
     $collectionId = $wgRequest->getInt("collection");
     $languageId = $wgRequest->getInt("language");
     $withinWords = $wgRequest->getBool("within-words");
     $withinExternalIdentifiers = $wgRequest->getBool("within-external-identifiers");
     if (!$withinWords && !$withinExternalIdentifiers) {
         $withinWords = $wgSearchWithinWordsDefaultValue;
         $withinExternalIdentifiers = $wgSearchWithinExternalIdentifiersDefaultValue;
     }
     $languageName = languageIdAsText($languageId);
     $options = array();
     $options[wfMsg('datasearch_search_text')] = getTextBox('search-text', $searchText);
     if ($wgFilterLanguageId == 0) {
         $options[wfMsg('datasearch_language')] = getSuggest('language', "language", array(), $languageId, $languageName);
     } else {
         $languageId = $wgFilterLanguageId;
     }
     $options[wfMsg('ow_Collection_colon')] = getSuggest('collection', 'collection', array(), $collectionId, collectionIdAsText($collectionId));
     if ($wgShowSearchWithinWordsOption) {
         $options[wfMsg('datasearch_within_words')] = getCheckBox('within-words', $withinWords);
     } else {
         $withinWords = $wgSearchWithinWordsDefaultValue;
     }
     if ($wgShowSearchWithinExternalIdentifiersOption) {
         $options[wfMsg('datasearch_within_ext_ids')] = getCheckBox('within-external-identifiers', $withinExternalIdentifiers);
     } else {
         $withinExternalIdentifiers = $wgSearchWithinExternalIdentifiersDefaultValue;
     }
     $wgOut->addHTML(getOptionPanel($options));
     if ($withinWords) {
         if ($languageId != 0 && $languageName != "") {
             $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_words_lang', $languageName, $searchText) . '</h1>');
         } else {
             $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_words', $searchText) . '</h1>');
         }
         $resultCount = $this->searchWordsCount($searchText, $collectionId, $languageId);
         $wgOut->addHTML('<p>' . wfMsgExt('datasearch_showing_only', 'parsemag', 100, $resultCount) . '</p>');
         $wgOut->addHTML($this->searchWords($searchText, $collectionId, $languageId));
     }
     if ($withinExternalIdentifiers) {
         $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_ext_ids', $searchText) . '</i></h1>');
         $wgOut->addHTML('<p>' . wfMsgExt('datasearch_showing_only', 'parsemag', 100) . '</p>');
         $wgOut->addHTML($this->searchExternalIdentifiers($searchText, $collectionId));
     }
 }
Exemplo n.º 4
0
	public function getViewHTML( IdStack $idPath, $value ) {
		global $wgRequest;
		$dc = wdGetDataSetContext();
		$output = "";

		// We must find the spelling and the list of possible languages from $idPath
		$expressionId = $idPath->getKeyStack()->peek( 0 )->expressionId;
		$spelling = getExpression( $expressionId, $dc )->spelling;
		$title = Title::makeTitle( NS_EXPRESSION, $spelling );
		$expressionsArray = getExpressions( $spelling, $dc ) ;

		$languageIdList = array() ;
		foreach ( $expressionsArray as $expression ) {
			if ( $expression->languageId != $value ) {
				// only add languages that are not the current language
				$languageIdList[] = $expression->languageId ;
			}
		}

		if ( count($languageIdList) > 0 ) {
			// there are other languages as alternative, prepare the dropdown
			$output .= Html::openElement('span', array('class' => 'wd-dropdown') ) ;
		}

		// displays the name of the current language
		// this is the only thing that is displayed if there are no other language available
		$output .= languageIdAsText( $value ) ;

		if ( count($languageIdList) > 0 ) {
			// there might be duplicates
			$languageIdList = array_unique ( $languageIdList ) ;

			// Now the names
			$languageNameList = array();
			foreach ( $languageIdList as $languageId ) {
				$languageNameList[$languageId] = languageIdAsText($languageId) ;
			}
			asort($languageNameList);

			// build the list <ul>
			$output .= ' ▿' ;

			// now the <li> definining the menu
			// display: none is also in the .css, but defined here to prevent the list to show
			// when the .css is not yet loaded.
			$output .= Html::openElement('ul', array('class' => 'wd-dropdownlist', 'style' => 'display: none;' ));
			foreach ( $languageNameList as $languageId => $languageName ) {
				$output .= Html::openElement('li');

				$urlOptions = array( 'explang' => $languageId );
				if ( $wgRequest->getVal("action") == "edit" ) {
					$urlOptions['action'] = "edit" ;
				}
				$aHref = $title->getLocalURL( $urlOptions ) ;
				$output .= Html::rawElement('a', array('href' => $aHref), $languageName );
				$output .= Html::closeElement('li');
			}
			$output .= Html::closeElement('ul');
			$output .= Html::closeElement('span');
		}

		return $output;
	}