示例#1
0
	public function history() {
		global
			$wgOut, $wgTitle, $wgRequest;
			
		$wgOut->enableClientCache( false );

		$title = $wgTitle->getPrefixedText();

		if ( !$this->showClassicPageTitles )
			$title = $this->getTitle();

		$wgOut->setPageTitle( wfMsgSc( "history", $title ) );

		# Plain filter for the lifespan info about each record
		if ( isset( $_GET['show'] ) ) {
			$this->showRecordLifeSpan = isset( $_GET["show-record-life-span"] );
			$this->transaction = (int) $_GET["transaction"];
		}
		else {
			$this->showRecordLifeSpan = true;
			$this->transaction = 0;
		}
		
		# Up to which transaction to view the data
		if ( $this->transaction == 0 )
			$this->queryTransactionInformation = new QueryHistoryTransactionInformation();
		else
			$this->queryTransactionInformation = new QueryAtTransactionInformation( $this->transaction, $this->showRecordLifeSpan );
			
		$transactionId = $wgRequest->getInt( 'transaction' );

		$wgOut->addHTML( getOptionPanel(
			array(
				wfMsg( 'ow_history_transaction' ) => getSuggest( 'transaction', 'transaction', array(), $transactionId, getTransactionLabel( $transactionId ), array( 0, 2, 3 ) ),
				wfMsg( 'ow_history_show_life_span' ) => getCheckBox( 'show-record-life-span', $this->showRecordLifeSpan )
			),
			'history'
		) );

		$viewInformation = new ViewInformation();
		$viewInformation->filterLanguageId = $this->filterLanguageId;
		$viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan;
		$viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
		$viewInformation->setPropertyToColumnFilters( $this->propertyToColumnFilters );
		
		$this->viewInformation = $viewInformation;

		initializeOmegaWikiAttributes( $this->viewInformation );
		initializeObjectAttributeEditors( $viewInformation );
	}
	/**  
	 * FIXME - work in progress
	 *
	 */
	public function save() {
		initializeOmegaWikiAttributes( $this->viewInformation );
		initializeObjectAttributeEditors( $this->viewInformation );

		# Nice try sherlock, but we really need to get our DMID from elsewhere
		# $definedMeaningId = $this->getId(); 

		# Need 3 steps: copy defining expression, create new dm, then update

		$expression = $this->dupDefiningExpression();
		var_dump( $expression );
		# to make the expression really work, we may need to call
		# more here?
		$expression->createNewInDatabase();
		

		# shouldn't this stuff be protected?
		$expressionId = $expression->id;
		$languageId = $expression->languageId;
		
		$this->hackDC(); // XXX
		$text = $this->getDefiningExpression();
		$this->unhackDC(); // XXX


		# here we assume the DM is not there yet.. not entirely wise
		# in the long run.
		echo "id: $expressionId lang: $languageId";
		$newDefinedMeaningId = createNewDefinedMeaning( $expressionId, $languageId, $text );
		

		getDefinedMeaningEditor( $this->viewInformation )->save(
			$this->getIdStack( $newDefinedMeaningId ),
			$this->getRecord()
		);

		return $newDefinedMeaningId;
	}