Пример #1
0
 /**
  * Display a revision notice as subtitle.
  * 
  * @since 0.1
  * 
  * @param EPRevision $rev
  */
 protected function displayRevisionNotice(EPRevision $rev)
 {
     $lang = $this->getLanguage();
     $current = false;
     // TODO
     $td = $lang->timeanddate($rev->getField('time'), true);
     $tddate = $lang->date($rev->getField('time'), true);
     $tdtime = $lang->time($rev->getField('time'), true);
     $userToolLinks = Linker::userLink($rev->getUser()->getId(), $rev->getUser()->getName()) . Linker::userToolLinks($rev->getUser()->getId(), $rev->getUser()->getName());
     $infomsg = $current && !wfMessage('revision-info-current')->isDisabled() ? 'revision-info-current' : 'revision-info';
     $this->getOutput()->setSubtitle("<div id=\"mw-{$infomsg}\">" . wfMessage($infomsg, $td)->rawParams($userToolLinks)->params($rev->getId(), $tddate, $tdtime, $rev->getUser())->parse() . "</div>");
 }
Пример #2
0
 /**
  * (non-PHPdoc)
  * @see FormlessAction::onView()
  */
 public function onView()
 {
     $this->getOutput()->setPageTitle($this->getPageTitle());
     $c = $this->getItemClass();
     // Yeah, this is needed in PHP 5.3 >_>
     $object = $c::get($this->getTitle()->getText());
     if ($object === false) {
         $this->getOutput()->addWikiMsg('ep-' . strtolower($this->getName()) . '-norevs');
         $lastRev = EPRevision::selectRow(null, array('type' => EPPageObject::getTypeForNS($this->getTitle()->getNamespace()), 'object_identifier' => $this->getTitle()->getText(), 'deleted' => true), array('SORT BY' => EPRevision::getPrefixedField('time'), 'ORDER' => 'DESC'));
         if ($lastRev !== false) {
             // TODO: show available info about deletion
             $this->getOutput()->addWikiMsg('ep-' . strtolower($this->getName()) . '-deleted');
         }
     } else {
         $this->displayRevisions($object);
     }
     return '';
 }
Пример #3
0
 /**
  * Returns the the object stored in the revision with the provided id,
  * or false if there is no matching object.
  *
  * @since 0.1
  *
  * @param integer $revId
  * @param integer|null $objectId
  *
  * @return EPRevisionedObject|false
  */
 public static function getObjectFromRevId($revId, $objectId = null)
 {
     $conditions = array('id' => $revId);
     if (!is_null($objectId)) {
         $conditions['object_id'] = $objectId;
     }
     $rev = EPRevision::selectRow(array('type', 'data'), $conditions);
     if ($rev === false) {
         return false;
     } else {
         return $rev->getDataObject();
     }
 }
Пример #4
0
 /**
  * Store the current version of the object in the revisions table.
  *
  * @since 0.1
  *
  * @param EPRevisionedObject $object
  *
  * @return boolean Success indicator
  */
 protected function storeRevision(EPRevisionedObject $object)
 {
     if ($this->storeRevisions && $this->revAction !== false) {
         return EPRevision::newFromObject($object, $this->revAction)->save();
     }
     return true;
 }
Пример #5
0
 /**
  * This function should be overridden to return the name of the index fi-
  * eld.  If the pager supports multiple orders, it may return an array of
  * 'querykey' => 'indexfield' pairs, so that a request with &count=querykey
  * will use indexfield to sort.  In this case, the first returned key is
  * the default.
  *
  * Needless to say, it's really not a good idea to use a non-unique index
  * for this!  That won't page right.
  *
  * @return string|Array
  */
 function getIndexField()
 {
     return EPRevision::getPrefixedField('id');
 }