/** * Answer the heading block for a version * * @param object SeguePluginVersion $version * @return string * @access private * @since 1/9/08 */ private function getHeadingBlock(SeguePluginVersion $version) { $harmoni = Harmoni::instance(); ob_start(); $headingText = _("Revision %1 <br/>%2 <br/>(%3)"); $heading = str_replace('%1', $version->getNumber(), $headingText); $heading = str_replace('%2', $version->getTimestamp()->ymdString() . " " . $version->getTimestamp()->asTime()->string12(), $heading); $heading = str_replace('%3', htmlspecialchars($version->getAgent()->getDisplayName()), $heading); print "\n\t\t\t\t<div style='float: left;'>"; print $heading; print "</div>"; print "\n\t\t\t\t<div style='float: right;'>"; if ($version->isCurrent()) { print "\n\t\t\t\t\t<input type='button' value='" . _("Current Version") . "'"; print " disabled='disabled'/>"; // print _("(Current Version)"); } else { print "\n\t\t\t\t\t<input type='button' value='" . _("Revert to this Version") . "'"; print " onclick=\""; print "if (confirm('" . _("Are you sure that you wish to revert to this version?") . "')) { "; print "var commentText = window.prompt('" . _("Why are you reverting to this revision?") . "'); "; print "var url = Harmoni.quickUrl('versioning', 'revert', "; print "{node_id:'" . $version->getPluginInstance()->getId() . "', "; print "version_id:'" . $version->getVersionId() . "', "; print "comment:encodeURIComponent(commentText)}); "; print "window.location = url; "; print "} else { return false; }"; print "\"/>"; } print "\n\t\t\t\t</div>"; if ($version->getComment()) { print "\n\t\t\t\t<div class='version_comment' style='clear: both;'>"; print '"' . htmlspecialchars($version->getComment()) . '"'; print "</div>"; } return ob_get_clean(); }
/** * get url of node that action is applied to * * @return string * @access public * @since 1/23/09 */ public function getTargetUrl() { $url = SiteDispatcher::quickURL('versioning', 'compare_versions', array('node' => $this->_node->getId(), 'late_rev' => $this->_version->getVersionId())); return $url; }