Revisions: First pass an implementing a new UI/UX for reviewing the revisions of posts. See #23497 props adamsilverstein for the initial patch.
This implements a new revisions ui using Backbone and preserves all the old methods of "integration" so the change should be transparent to plugins using revisi ons with CPTs. This is the first pass and so there are a number of things still to be resolved, more details in the ticket. Feedback welcomed. git-svn-id: http://core.svn.wordpress.org/trunk@23506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -42,7 +42,7 @@ do_action( 'admin_init' );
|
||||
|
||||
$core_actions_get = array(
|
||||
'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache',
|
||||
'autocomplete-user', 'dashboard-widgets', 'logged-in',
|
||||
'autocomplete-user', 'dashboard-widgets', 'logged-in', 'revisions-data'
|
||||
);
|
||||
|
||||
$core_actions_post = array(
|
||||
@@ -56,7 +56,7 @@ $core_actions_post = array(
|
||||
'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',
|
||||
'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
|
||||
'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
|
||||
'send-attachment-to-editor', 'save-attachment-order', 'heartbeat',
|
||||
'send-attachment-to-editor', 'save-attachment-order', 'heartbeat'
|
||||
);
|
||||
|
||||
// Register core Ajax calls.
|
||||
|
||||
@@ -1351,15 +1351,26 @@ div.wp-menu-image {
|
||||
|
||||
/* Diff */
|
||||
table.diff .diff-deletedline {
|
||||
background-color: #fdd;
|
||||
background-color: #ffe5e6;
|
||||
color: #f2001f;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
table.diff .diff-deletedline del {
|
||||
background-color: #f99;
|
||||
}
|
||||
|
||||
table.diff .diff-deletedline-symbol {
|
||||
color: #f2001f;
|
||||
}
|
||||
|
||||
table.diff .diff-addedline {
|
||||
background-color: #dfd;
|
||||
background-color: #e9f6ea;
|
||||
color: #00a500;
|
||||
}
|
||||
|
||||
table.diff .diff-addedline-symbol {
|
||||
color: #00a500;
|
||||
}
|
||||
|
||||
table.diff .diff-addedline ins {
|
||||
|
||||
213
wp-admin/css/revisions.css
Normal file
213
wp-admin/css/revisions.css
Normal file
@@ -0,0 +1,213 @@
|
||||
/* Styles for the revision screen */
|
||||
|
||||
.revisiondiffcontainer {
|
||||
width: 96%;
|
||||
}
|
||||
|
||||
.revisiondiffcontainer input.button {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
#diffrestore, #diffnext, #diffcancel {
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#diffprevious, #difftitle, #difftitlefrom, #diff_from_current_revision {
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
#diffprevious, #diffnext {
|
||||
margin-top: 7px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
#diffheader, #diffsubheader {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#diffheader {
|
||||
border-bottom: 2px solid #999;
|
||||
width: 100%;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#diffsubheader {
|
||||
background-color: #eee;
|
||||
border-bottom: 2px solid #999;
|
||||
width: 100%;
|
||||
height:35px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
#diffslider {
|
||||
width: 70%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: center;
|
||||
height: 3.5em;
|
||||
|
||||
}
|
||||
|
||||
#revisioncount {
|
||||
width: 50%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 0;
|
||||
line-height: 1em;
|
||||
height: 1em;
|
||||
text-align: center;
|
||||
clear: none;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.revisiondiffcontainer {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#diffsliderwrap {
|
||||
width: 80%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#diffsliderwrap #sliderinner {
|
||||
position: relative;
|
||||
top: 47px;
|
||||
}
|
||||
|
||||
#removedandadded {
|
||||
width: 100%
|
||||
padding-bottom: 30px;
|
||||
padding-top: 3px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
#removed, #added {
|
||||
width: auto;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.diffsplit #added {
|
||||
float: right;
|
||||
width: 47%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.diffsplit #removedandadded {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#added {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#removed {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
#removed {
|
||||
color: #d2281f;
|
||||
}
|
||||
|
||||
#added {
|
||||
color: #00a100;
|
||||
}
|
||||
|
||||
#comparetworevisions {
|
||||
float: right;
|
||||
line-height: 35px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
#comparetworevisions input{
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
#difftitle img, #difftitlefrom img {
|
||||
vertical-align: middle;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#showsplitviewoption, #toggleshowautosavesoption {
|
||||
float: right;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
#revisionoptions {
|
||||
margin-top: 0px;
|
||||
line-height: 40px;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comparetwo #diffprevious, .comparetwo #diffnext {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comparetwo #diffslider {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.currentversion span#diff_left_current_revision {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
span#diff_left_current_revision, span#diff_from_current_revision {
|
||||
display: none;
|
||||
}
|
||||
|
||||
span#diff_left_count, span#diff_left_count_inner {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.currentversion span#diff_left_count,
|
||||
.currentversion span#diff_left_count_inner,
|
||||
.currentversion #difftitlefrom {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#difftitlefrom {
|
||||
float: left;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comparetwo #difftitlefrom, .comparetwo.currentversion span#diff_from_current_revision {
|
||||
display: inline;
|
||||
}
|
||||
.comparetwo.currentversion #difftitlefrom {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#modelsloading {
|
||||
float: right;
|
||||
line-height: 30px;
|
||||
display: none;
|
||||
clear: none;
|
||||
margin: 0;
|
||||
margin-top: -40px;
|
||||
}
|
||||
|
||||
#modelsloading .spinner {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.leftmodelloading #modelsloading,
|
||||
.rightmodelloading #modelsloading,
|
||||
.leftmodelloading #modelsloading .spinner,
|
||||
.rightmodelloading #modelsloading .spinner {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
0
wp-admin/css/revisions.min.css
vendored
Normal file
0
wp-admin/css/revisions.min.css
vendored
Normal file
@@ -3504,7 +3504,19 @@ table.diff {
|
||||
}
|
||||
|
||||
table.diff col.content {
|
||||
width: 50%;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
table.diff col.content.diffsplit {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
table.diff col.diffsplit.middle {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
table.diff col.ltype {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
table.diff tr {
|
||||
@@ -8808,3 +8820,17 @@ a.widget-control-edit {
|
||||
.locale-lt-lt .inline-edit-row fieldset label span.input-text-wrap {
|
||||
margin-left: 8em;
|
||||
}
|
||||
|
||||
#revisions-meta-mostrecent,
|
||||
#revisions-meta-stored,
|
||||
#revisions-meta-oldest,
|
||||
#revisions-meta-link {
|
||||
line-height: 30px;
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
padding-right: 10px;
|
||||
}
|
||||
#revisions-meta-mostrecent img,
|
||||
#revisions-meta-oldest img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,8 @@ if ( post_type_supports($post_type, 'author') ) {
|
||||
add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
|
||||
}
|
||||
|
||||
if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
|
||||
// TODO review this count() - why do we need to add it?
|
||||
if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && count ( wp_get_post_revisions( $post_ID ) ) > 1 )
|
||||
add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
|
||||
|
||||
do_action('add_meta_boxes', $post_type, $post);
|
||||
|
||||
@@ -1379,7 +1379,7 @@ function wp_ajax_inline_save_tax() {
|
||||
global $wp_list_table;
|
||||
|
||||
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
||||
|
||||
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
$taxonomy = sanitize_key( $post_data['taxonomy'] );
|
||||
@@ -2134,3 +2134,138 @@ function wp_ajax_nopriv_heartbeat() {
|
||||
wp_send_json($response);
|
||||
}
|
||||
|
||||
function wp_ajax_revisions_data() {
|
||||
check_ajax_referer( 'revisions-ajax-nonce', 'nonce' );
|
||||
|
||||
$compareto = isset( $_GET['compareto'] ) ? absint( $_GET['compareto'] ) : 0;
|
||||
$showautosaves = isset( $_GET['showautosaves'] ) ? $_GET['showautosaves'] : '';
|
||||
$show_split_view = isset( $_GET['show_split_view'] ) ? $_GET['show_split_view'] : '';
|
||||
$postid = isset( $_GET['postid'] ) ? absint( $_GET['postid'] ) : '';
|
||||
|
||||
$comparetwomode = ( '' == $postid ) ? false : true;
|
||||
//
|
||||
//TODO: currently code returns all possible comparisons for the indicated 'compareto' revision
|
||||
//however, the front end prevents users from pulling the right handle past the left or the left pass the right,
|
||||
//so only the possible diffs need be generated
|
||||
//
|
||||
$alltherevisions = array();
|
||||
|
||||
if ( '' == $postid )
|
||||
$postid = $compareto;
|
||||
|
||||
if ( ! current_user_can( 'read_post', $postid ) )
|
||||
continue;
|
||||
|
||||
if ( ! $revisions = wp_get_post_revisions( $postid ) )
|
||||
return;
|
||||
|
||||
//if we are comparing two revisions, the first 'revision' represented by the leftmost
|
||||
//slider position is the current revision, prepend a comparison to this revision
|
||||
if ( $comparetwomode )
|
||||
array_unshift( $revisions, get_post( $postid ) );
|
||||
|
||||
$count = 1;
|
||||
foreach ( $revisions as $revision ) :
|
||||
if ( 'true' != $showautosaves && wp_is_post_autosave( $revision ) )
|
||||
continue;
|
||||
|
||||
$revision_from_date_author = '';
|
||||
|
||||
|
||||
$left_revision = get_post( $compareto );
|
||||
$right_revision = get_post( $revision );
|
||||
|
||||
$author = get_the_author_meta( 'display_name', $revision->post_author );
|
||||
/* translators: revision date format, see http://php.net/date */
|
||||
$datef = _x( 'j F, Y @ G:i:s', 'revision date format');
|
||||
|
||||
$gravatar = get_avatar( $revision->post_author, 18 );
|
||||
|
||||
$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
|
||||
$revision_date_author = sprintf(
|
||||
'%s %s, %s %s (%s)',
|
||||
$gravatar,
|
||||
$author,
|
||||
human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ),
|
||||
__( ' ago ' ),
|
||||
$date
|
||||
);
|
||||
|
||||
if ( $comparetwomode ) {
|
||||
$compareto_gravatar = get_avatar( $left_revision->post_author, 18 );
|
||||
$compareto_author = get_the_author_meta( 'display_name', $left_revision->post_author );
|
||||
$compareto_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) );
|
||||
|
||||
$revision_from_date_author = sprintf(
|
||||
'%s %s, %s %s (%s)',
|
||||
$compareto_gravatar,
|
||||
$compareto_author,
|
||||
human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ),
|
||||
__( ' ago ' ),
|
||||
$compareto_date
|
||||
);
|
||||
}
|
||||
|
||||
$restoreaction = wp_nonce_url(
|
||||
add_query_arg(
|
||||
array( 'revision' => $revision->ID,
|
||||
'action' => 'restore' ),
|
||||
'/wp-admin/revision.php'
|
||||
),
|
||||
"restore-post_{$compareto}|{$revision->ID}"
|
||||
);
|
||||
|
||||
//
|
||||
//make sure the left revision is the most recent
|
||||
//
|
||||
if ( strtotime( $right_revision->post_modified_gmt ) < strtotime( $left_revision->post_modified_gmt ) ) {
|
||||
$temp = $left_revision;
|
||||
$left_revision = $right_revision;
|
||||
$right_revision = $temp;
|
||||
}
|
||||
|
||||
//
|
||||
//compare from left to right, passed from application
|
||||
//
|
||||
$content='';
|
||||
foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {
|
||||
$left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field, $left_revision, 'left' );
|
||||
$right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field, $right_revision, 'right' );
|
||||
|
||||
add_filter( "_wp_post_revision_field_$field", 'wp_kses_post' );
|
||||
|
||||
$args = array();
|
||||
|
||||
if ( 'true' == $show_split_view )
|
||||
$args = array( 'show_split_view' => 'true' );
|
||||
|
||||
$content .= wp_text_diff( $left_content, $right_content, $args );
|
||||
}
|
||||
|
||||
//if we are comparing two revisions
|
||||
//and we are on the matching revision
|
||||
//add an error revision indicating unable to compare to self
|
||||
if ( $comparetwomode && $compareto == $revision->ID )
|
||||
$alltherevisions[] = array (
|
||||
'ID' => $revision->ID,
|
||||
'revision_date_author' => $revision_date_author,
|
||||
'revisiondiff' => sprintf('<div id="selfcomparisonerror">%s</div>', __( 'Cannot compare revision to itself' ) ),
|
||||
'restoreaction' => urldecode( $restoreaction ),
|
||||
'revision_from_date_author' => ''
|
||||
);
|
||||
|
||||
//add to the return data only if there is a difference
|
||||
if ( '' != $content )
|
||||
$alltherevisions[] = array (
|
||||
'ID' => $revision->ID,
|
||||
'revision_date_author' => $revision_date_author,
|
||||
'revisiondiff' => $content,
|
||||
'restoreaction' => urldecode( $restoreaction ),
|
||||
'revision_from_date_author' => $revision_from_date_author
|
||||
);
|
||||
|
||||
endforeach;
|
||||
|
||||
echo json_encode( $alltherevisions );
|
||||
exit();
|
||||
}
|
||||
|
||||
530
wp-admin/js/revisions.js
Normal file
530
wp-admin/js/revisions.js
Normal file
@@ -0,0 +1,530 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function($) {
|
||||
wp.revisions = {
|
||||
|
||||
views : {},
|
||||
|
||||
Model : Backbone.Model.extend({
|
||||
defaults: {
|
||||
ID : 0,
|
||||
revision_date_author : '',
|
||||
revisiondiff : '',
|
||||
restoreaction: '',
|
||||
diff_max : 0,
|
||||
diff_count : 0,
|
||||
diff_revision_to : 0,
|
||||
revision_from_date_author : '',
|
||||
}
|
||||
}),
|
||||
|
||||
app: _.extend({}, Backbone.Events),
|
||||
|
||||
App : Backbone.Router.extend({
|
||||
_revisionDifflView : null,
|
||||
_revisions : null,
|
||||
_left_handle_revisions : null,
|
||||
_right_handle_revisions : null,
|
||||
_revisionsInteractions : null,
|
||||
_revisionsOptions : null,
|
||||
_left_diff : 0,
|
||||
_right_diff : 1,
|
||||
_autosaves : false,
|
||||
_showsplitview : true,
|
||||
_compareoneortwo : 1,
|
||||
left_model_loading : false, //keep track of model loads
|
||||
right_model_loading : false, //disallow slider interaction, also repeat loads, while loading
|
||||
|
||||
//TODO add ability to arrive on specific revision
|
||||
routes : {
|
||||
"viewrevision/:revision": "viewrevision",
|
||||
},
|
||||
|
||||
viewrevision : function( revision ) {
|
||||
//coming soon
|
||||
},
|
||||
|
||||
start_left_model_loading : function() {
|
||||
this.left_model_loading = true;
|
||||
$('.revisiondiffcontainer').addClass('leftmodelloading');
|
||||
},
|
||||
|
||||
stop_left_model_loading : function() {
|
||||
this.left_model_loading = false;
|
||||
$('.revisiondiffcontainer').removeClass('leftmodelloading');
|
||||
},
|
||||
|
||||
start_right_model_loading : function() {
|
||||
this.right_model_loading = true;
|
||||
$('.revisiondiffcontainer').addClass('rightmodelloading');
|
||||
},
|
||||
|
||||
stop_right_model_loading : function() {
|
||||
this.right_model_loading = false;
|
||||
$('.revisiondiffcontainer').removeClass('rightmodelloading');
|
||||
},
|
||||
|
||||
reloadmodel : function() {
|
||||
if ( 2 == this._compareoneortwo ) {
|
||||
this.reloadleftright();
|
||||
} else {
|
||||
this.reloadmodelsingle();
|
||||
}
|
||||
},
|
||||
|
||||
reloadmodelsingle : function() {
|
||||
var self = this;
|
||||
self._revisions.url = ajaxurl + '?action=revisions-data&compareto=' + wpRevisionsSettings.post_id +
|
||||
'&showautosaves=' + self.self_autosaves +
|
||||
'&showsplitview=' + REVAPP._showsplitview +
|
||||
'&nonce=' + wpRevisionsSettings.nonce;
|
||||
self.start_right_model_loading();
|
||||
this._revisions.fetch({ //reload revision data
|
||||
success : function() {
|
||||
self.stop_right_model_loading();
|
||||
var revisioncount = self._revisions.length;
|
||||
if ( self._right_diff > revisioncount ) //if right handle past rightmost, move
|
||||
self._right_diff = revisioncount;
|
||||
//TODO add a test for matchind left revision and push left, testing
|
||||
//also reset the slider values here
|
||||
|
||||
self._revisionView.render();
|
||||
$( '#slider' ).slider( 'option', 'max', revisioncount-1 ); //TODO test this
|
||||
},
|
||||
|
||||
error : function () {
|
||||
self.stop_right_model_loading();
|
||||
window.console && console.log( 'Error loading revision data' );
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
reloadleftright : function() {
|
||||
var self = this;
|
||||
self.start_left_model_loading();
|
||||
self.start_right_model_loading();
|
||||
|
||||
self._left_handle_revisions = new wp.revisions.Collection();
|
||||
self._right_handle_revisions = new wp.revisions.Collection();
|
||||
|
||||
if ( 0 == self._left_diff ) {
|
||||
self._right_handle_revisions.url =
|
||||
ajaxurl +
|
||||
'?action=revisions-data&compareto=' + wpRevisionsSettings.post_id +
|
||||
'&wpRevisionsSettings.post_id=' + wpRevisionsSettings.post_id +
|
||||
'&showautosaves=' + self._autosaves +
|
||||
'&showsplitview=' + self._showsplitview +
|
||||
'&nonce=' + wpRevisionsSettings.nonce;
|
||||
} else {
|
||||
self._right_handle_revisions.url =
|
||||
ajaxurl +
|
||||
'?action=revisions-data&compareto=' + self._revisions.at( self._left_diff - 1 ).get( 'ID' ) +
|
||||
'&wpRevisionsSettings.post_id=' + wpRevisionsSettings.post_id +
|
||||
'&showautosaves=' + self._autosaves +
|
||||
'&showsplitview=' + self._showsplitview +
|
||||
'&nonce=' + wpRevisionsSettings.nonce;
|
||||
}
|
||||
|
||||
self._left_handle_revisions.url =
|
||||
ajaxurl +
|
||||
'?action=revisions-data&compareto=' + self._revisions.at( self._right_diff - 1 ).get( 'ID' ) +
|
||||
'&wpRevisionsSettings.post_id=' + wpRevisionsSettings.post_id +
|
||||
'&showautosaves=' + self._autosaves +
|
||||
'&showsplitview=' + self._showsplitview +
|
||||
'&nonce=' + wpRevisionsSettings.nonce;
|
||||
|
||||
self._left_handle_revisions.fetch({
|
||||
|
||||
xhr: function() {
|
||||
var xhr = $.ajaxSettings.xhr();
|
||||
xhr.onprogress = self.handleProgress;
|
||||
return xhr;
|
||||
},
|
||||
|
||||
handleProgress: function(evt){
|
||||
var percentComplete = 0;
|
||||
if (evt.lengthComputable) {
|
||||
percentComplete = evt.loaded / evt.total;
|
||||
window.console && console.log( Math.round( percentComplete * 100) + "%" );
|
||||
}
|
||||
},
|
||||
|
||||
success : function(){
|
||||
self.stop_left_model_loading();
|
||||
},
|
||||
|
||||
error : function () {
|
||||
window.console && console.log( 'Error loading revision data' );
|
||||
self.stop_left_model_loading();
|
||||
}
|
||||
});
|
||||
|
||||
self._right_handle_revisions.fetch({
|
||||
|
||||
success : function(){
|
||||
self.stop_right_model_loading();
|
||||
},
|
||||
|
||||
error : function () {
|
||||
window.console && console.log( 'Error loading revision data' );
|
||||
self.stop_right_model_loading();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* initialize the revision appl;ication
|
||||
*/
|
||||
initialize : function( options ) {
|
||||
var self = this; //store the application instance
|
||||
if (this._revisions === null) {
|
||||
self._autosaves = '';
|
||||
self._revisions = new wp.revisions.Collection(); //set up collection
|
||||
self.start_right_model_loading();
|
||||
self._revisions.fetch({ //load revision data
|
||||
|
||||
success : function() {
|
||||
self.stop_right_model_loading();
|
||||
self.revisionDiffSetup();
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
revisionDiffSetup : function() {
|
||||
var self = this, slider;
|
||||
|
||||
this._revisionView = new wp.revisions.views.View({
|
||||
model : this._revisions
|
||||
});
|
||||
this._revisionView.render();
|
||||
|
||||
this._revisionsInteractions = new wp.revisions.views.Interact({
|
||||
model : this._revisions
|
||||
});
|
||||
this._revisionsInteractions.render();
|
||||
|
||||
this._revisionsOptions = new wp.revisions.views.Options({
|
||||
model : this._revisions
|
||||
});
|
||||
this._revisionsOptions.render();
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
wp.revisions.Collection = Backbone.Collection.extend({
|
||||
model : wp.revisions.Model,
|
||||
url : ajaxurl + '?action=revisions-data&compareto=' + wpRevisionsSettings.post_id + '&showautosaves=false&showsplitview=true&nonce=' + wpRevisionsSettings.nonce
|
||||
});
|
||||
|
||||
_.extend(wp.revisions.views, {
|
||||
//
|
||||
//primary revision diff view
|
||||
//
|
||||
View : Backbone.View.extend({
|
||||
el : $('#backbonerevisionsdiff')[0],
|
||||
tagName : 'revisionvview',
|
||||
className : 'revisionview-container',
|
||||
template : wp.template('revision'),
|
||||
revvapp : null,
|
||||
comparetwochecked : '',
|
||||
draggingleft : false,
|
||||
|
||||
initialize : function(){
|
||||
},
|
||||
|
||||
//
|
||||
//render the revisions
|
||||
//
|
||||
render : function() {
|
||||
var addhtml = '';
|
||||
//compare two revisions mode?
|
||||
if ( 2 == REVAPP._compareoneortwo ) {
|
||||
this.comparetwochecked = 'checked';
|
||||
if ( this.draggingleft ) {
|
||||
if ( this.model.at( REVAPP._left_diff ) ) {
|
||||
addhtml = this.template( _.extend(
|
||||
this.model.at( REVAPP._left_diff ).toJSON(),
|
||||
{ comparetwochecked : this.comparetwochecked } //keep the checkmark checked
|
||||
) );
|
||||
}
|
||||
} else { //dragging right handle
|
||||
var thediff = REVAPP._right_diff;
|
||||
if ( this.model.at( thediff ) ) {
|
||||
addhtml = this.template( _.extend(
|
||||
this.model.at( thediff ).toJSON(),
|
||||
{ comparetwochecked : this.comparetwochecked } //keep the checkmark checked
|
||||
) );
|
||||
}
|
||||
}
|
||||
} else { //end compare two revisions mode, eg only one slider handel
|
||||
this.comparetwochecked = '';
|
||||
if ( this.model.at( REVAPP._right_diff - 1 ) ) {
|
||||
addhtml = this.template( _.extend(
|
||||
this.model.at( REVAPP._right_diff-1 ).toJSON(),
|
||||
{ comparetwochecked : this.comparetwochecked } //keep the checkmark checked
|
||||
) );
|
||||
}
|
||||
}
|
||||
this.$el.html( addhtml );
|
||||
return this;
|
||||
},
|
||||
|
||||
//the compare two button is in this view, add the interaction here
|
||||
events : {
|
||||
'click #comparetwo' : 'clickcomparetwo'
|
||||
},
|
||||
|
||||
//
|
||||
//turn on/off the compare two mmode
|
||||
//
|
||||
clickcomparetwo : function(){
|
||||
self = this;
|
||||
if ( $( 'input#comparetwo' ).is( ':checked' ) ) {
|
||||
REVAPP._compareoneortwo = 2 ;
|
||||
REVAPP.reloadleftright();
|
||||
} else {
|
||||
REVAPP._compareoneortwo = 1 ;
|
||||
REVAPP._revisionView.draggingleft = false;
|
||||
REVAPP._left_diff = 0;
|
||||
REVAPP.reloadmodelsingle();
|
||||
}
|
||||
REVAPP._revisionsInteractions.render();
|
||||
}
|
||||
}),
|
||||
|
||||
//
|
||||
//options view for show autosaves and show split view options
|
||||
//
|
||||
Options : Backbone.View.extend({
|
||||
el : $('#backbonerevisionsoptions')[0],
|
||||
tagName : 'revisionoptionsview',
|
||||
className : 'revisionoptions-container',
|
||||
template : wp.template('revisionoptions'),
|
||||
|
||||
initialize : function() {
|
||||
},
|
||||
|
||||
//render the options view
|
||||
render : function() {
|
||||
var addhtml = this.template;
|
||||
this.$el.html( addhtml );
|
||||
return this;
|
||||
},
|
||||
|
||||
//add options interactions
|
||||
events : {
|
||||
'click #toggleshowautosaves' : 'toggleshowautosaves',
|
||||
'click #showsplitview' : 'showsplitview'
|
||||
},
|
||||
|
||||
//
|
||||
//toggle include autosaves
|
||||
//
|
||||
toggleshowautosaves : function() {
|
||||
var self = this;
|
||||
if ( $( '#toggleshowautosaves' ).is( ':checked' ) ) {
|
||||
REVAPP._autosaves = true ;
|
||||
} else {
|
||||
REVAPP._autosaves = false ;
|
||||
}
|
||||
//refresh the model data
|
||||
|
||||
REVAPP.reloadmodel();
|
||||
//TODO check for two handle mode
|
||||
|
||||
},
|
||||
|
||||
//
|
||||
//toggle showing the split diff view
|
||||
//
|
||||
showsplitview : function() {
|
||||
var self = this;
|
||||
|
||||
if ( $( 'input#showsplitview' ).is( ':checked' ) ) {
|
||||
REVAPP._showsplitview = 'true';
|
||||
$('.revisiondiffcontainer').addClass('diffsplit');
|
||||
} else {
|
||||
REVAPP._showsplitview = '';
|
||||
$('.revisiondiffcontainer').removeClass('diffsplit');
|
||||
}
|
||||
|
||||
REVAPP.reloadmodel();
|
||||
}
|
||||
}),
|
||||
|
||||
//
|
||||
//main interactions view
|
||||
//
|
||||
Interact : Backbone.View.extend({
|
||||
el : $('#backbonerevisionsinteract')[0],
|
||||
tagName : 'revisionvinteract',
|
||||
className : 'revisionvinteract-container',
|
||||
template : wp.template('revisionvinteract'),
|
||||
|
||||
initialize : function() {
|
||||
},
|
||||
|
||||
render : function() {
|
||||
var self = this;
|
||||
|
||||
var addhtml = this.template;
|
||||
this.$el.html( addhtml );
|
||||
$( '#diff_max, #diff_maxof' ).html( this.model.length );
|
||||
$( '#diff_count' ).html( REVAPP._right_diff );
|
||||
$( '#diff_left_count_inner' ).html( 0 == REVAPP._left_diff ? '' : 'revision' + REVAPP._left_diff );
|
||||
|
||||
var modelcount = REVAPP._revisions.length;
|
||||
|
||||
slider = $("#slider");
|
||||
if ( 1 == REVAPP._compareoneortwo ) {
|
||||
//set up the slider with a single handle
|
||||
slider.slider({
|
||||
value : REVAPP._right_diff-1,
|
||||
min : 0,
|
||||
max : modelcount-1,
|
||||
step : 1,
|
||||
|
||||
//slide interactions for one handles slider
|
||||
slide : function( event, ui ) {
|
||||
if ( REVAPP.right_model_loading ) //left model stoll loading, prevent sliding left handle
|
||||
return false;
|
||||
|
||||
REVAPP._right_diff =( ui.value+1 );
|
||||
$( '#diff_count' ).html( REVAPP._right_diff );
|
||||
REVAPP._revisionView.render();
|
||||
}
|
||||
});
|
||||
$( '.revisiondiffcontainer' ).removeClass( 'comparetwo' );
|
||||
} else { //comparing more than one, eg 2
|
||||
//set up the slider with two handles
|
||||
slider.slider({
|
||||
values : [ REVAPP._left_diff, REVAPP._right_diff + 1 ],
|
||||
min : 1,
|
||||
max : modelcount+1,
|
||||
step : 1,
|
||||
range: true,
|
||||
|
||||
//in two handled mode when user starts dragging, swap in precalculated diff for handle
|
||||
start : function (event, ui ) {
|
||||
var index = $( ui.handle ).index(); //0 (left) or 1 (right)
|
||||
|
||||
switch ( index ) {
|
||||
case 1: //left handle drag
|
||||
if ( REVAPP.left_model_loading ) //left model stoll loading, prevent sliding left handle
|
||||
return false;
|
||||
|
||||
if ( REVAPP._revisionView.model !== REVAPP._left_handle_revisions &&
|
||||
null != REVAPP._left_handle_revisions )
|
||||
REVAPP._revisionView.model = REVAPP._left_handle_revisions;
|
||||
|
||||
REVAPP._revisionView.draggingleft = true;
|
||||
break;
|
||||
|
||||
case 2: //right
|
||||
if ( REVAPP.right_model_loading ) //right model stoll loading, prevent sliding right handle
|
||||
return false;
|
||||
|
||||
//one extra spot at left end when comparing two
|
||||
if ( REVAPP._revisionView.model !== REVAPP._right_handle_revisions &&
|
||||
null != REVAPP._right_handle_revisions )
|
||||
REVAPP._revisionView.model = REVAPP._right_handle_revisions;
|
||||
|
||||
REVAPP._revisionView.draggingleft = false;
|
||||
REVAPP._right_diff = ui.values[1] - 1 ;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
//when sliding in two handled mode change appropriate value
|
||||
slide : function( event, ui ) {
|
||||
if ( ui.values[0] == ui.values[1] ) //prevent compare to self
|
||||
return false;
|
||||
|
||||
var index = $( ui.handle ).index(); //0 (left) or 1 (right)
|
||||
|
||||
switch ( index ) {
|
||||
case 1: //left
|
||||
if ( REVAPP.left_model_loading ) //left model stoll loading, prevent sliding left handle
|
||||
return false;
|
||||
|
||||
REVAPP._left_diff = ui.values[0] - 1; //one extra spot at left end when comparing two
|
||||
break;
|
||||
|
||||
case 2: //right
|
||||
if ( REVAPP.right_model_loading ) //right model stoll loading, prevent sliding right handle
|
||||
return false;
|
||||
|
||||
REVAPP._right_diff = ui.values[1] - 1 ;
|
||||
break;
|
||||
}
|
||||
|
||||
$( '#diff_count' ).html( REVAPP._right_diff );
|
||||
|
||||
if ( 0 == REVAPP._left_diff ) {
|
||||
$( '.revisiondiffcontainer' ).addClass( 'currentversion' );
|
||||
|
||||
} else {
|
||||
$( '.revisiondiffcontainer' ).removeClass( 'currentversion' );
|
||||
$( '#diff_left_count_inner' ).html( REVAPP._left_diff );
|
||||
}
|
||||
|
||||
REVAPP._revisionView.render(); //render the diff view
|
||||
},
|
||||
|
||||
//when the user stops sliding in 2 handle mode, recalculate diffs
|
||||
stop : function( event, ui ) {
|
||||
if ( 2 == REVAPP._compareoneortwo ) {
|
||||
//calculate and generate a diff for comparing to the left handle
|
||||
//and the right handle, swap out when dragging
|
||||
if ( ! (REVAPP.left_model_loading && REVAPP.right_model.loading ) ) {
|
||||
REVAPP.reloadleftright();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$( '.revisiondiffcontainer' ).addClass( 'comparetwo' );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
//next and previous buttons, only available in compare one mode
|
||||
events : {
|
||||
'click #next' : 'nextrevision',
|
||||
'click #previous' : 'previousrevision'
|
||||
},
|
||||
|
||||
//go to the next revision
|
||||
nextrevision : function() {
|
||||
if ( REVAPP._right_diff < this.model.length ) //unless at right boundry
|
||||
REVAPP._right_diff = REVAPP._right_diff + 1 ;
|
||||
|
||||
REVAPP._revisionView.render();
|
||||
|
||||
$( '#diff_count' ).html( REVAPP._right_diff );
|
||||
$( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' );
|
||||
},
|
||||
|
||||
//go the the previous revision
|
||||
previousrevision : function() {
|
||||
if ( REVAPP._right_diff > 1 ) //unless at left boundry
|
||||
REVAPP._right_diff = REVAPP._right_diff - 1 ;
|
||||
|
||||
REVAPP._revisionView.render();
|
||||
|
||||
$( '#diff_count' ).html( REVAPP._right_diff );
|
||||
$( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' );
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//instantiate Revision Application
|
||||
REVAPP = new wp.revisions.App();
|
||||
//TODO consider enable back button to step back thru states?
|
||||
Backbone.history.start();
|
||||
|
||||
}(jQuery));
|
||||
0
wp-admin/js/revisions.min.js
vendored
Normal file
0
wp-admin/js/revisions.min.js
vendored
Normal file
@@ -8,15 +8,9 @@
|
||||
|
||||
/** WordPress Administration Bootstrap */
|
||||
require_once('./admin.php');
|
||||
|
||||
wp_enqueue_script('list-revisions');
|
||||
|
||||
wp_reset_vars(array('revision', 'left', 'right', 'action'));
|
||||
wp_reset_vars( array( 'revision', 'action' ) );
|
||||
|
||||
$revision_id = absint($revision);
|
||||
$left = absint($left);
|
||||
$right = absint($right);
|
||||
|
||||
$redirect = 'edit.php';
|
||||
|
||||
switch ( $action ) :
|
||||
@@ -33,75 +27,13 @@ case 'restore' :
|
||||
$redirect = 'edit.php?post_type=' . $post->post_type;
|
||||
break;
|
||||
}
|
||||
|
||||
check_admin_referer( "restore-post_$post->ID|$revision->ID" );
|
||||
check_admin_referer( "restore-post_{$post->ID}|{$revision->ID}" );
|
||||
|
||||
wp_restore_post_revision( $revision->ID );
|
||||
$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
|
||||
break;
|
||||
case 'diff' :
|
||||
if ( !$left_revision = get_post( $left ) )
|
||||
break;
|
||||
if ( !$right_revision = get_post( $right ) )
|
||||
break;
|
||||
|
||||
if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )
|
||||
break;
|
||||
|
||||
// If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post
|
||||
if ( $left_revision->ID == $right_revision->ID ) {
|
||||
$redirect = get_edit_post_link( $left_revision->ID );
|
||||
include( './js/revisions-js.php' );
|
||||
break;
|
||||
}
|
||||
|
||||
// Don't allow reverse diffs?
|
||||
if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) {
|
||||
$redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $left_revision->ID == $right_revision->post_parent ) // right is a revision of left
|
||||
$post =& $left_revision;
|
||||
elseif ( $left_revision->post_parent == $right_revision->ID ) // left is a revision of right
|
||||
$post =& $right_revision;
|
||||
elseif ( $left_revision->post_parent == $right_revision->post_parent ) // both are revisions of common parent
|
||||
$post = get_post( $left_revision->post_parent );
|
||||
else
|
||||
break; // Don't diff two unrelated revisions
|
||||
|
||||
if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) { // Revisions disabled
|
||||
if (
|
||||
// we're not looking at an autosave
|
||||
( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) )
|
||||
||
|
||||
// we're not comparing an autosave to the current post
|
||||
( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID )
|
||||
) {
|
||||
$redirect = 'edit.php?post_type=' . $post->post_type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
// They're the same
|
||||
$left_revision->ID == $right_revision->ID
|
||||
||
|
||||
// Neither is a revision
|
||||
( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) )
|
||||
)
|
||||
break;
|
||||
|
||||
$post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
|
||||
$h2 = sprintf( __( 'Compare Revisions of “%1$s”' ), $post_title );
|
||||
$title = __( 'Revisions' );
|
||||
|
||||
$left = $left_revision->ID;
|
||||
$right = $right_revision->ID;
|
||||
|
||||
$redirect = false;
|
||||
break;
|
||||
case 'view' :
|
||||
case 'edit' :
|
||||
default :
|
||||
if ( !$revision = wp_get_post_revision( $revision_id ) )
|
||||
break;
|
||||
@@ -119,13 +51,9 @@ default :
|
||||
|
||||
$post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
|
||||
$revision_title = wp_post_revision_title( $revision, false );
|
||||
$h2 = sprintf( __( 'Revision for “%1$s” created on %2$s' ), $post_title, $revision_title );
|
||||
$h2 = sprintf( __( 'Compare Revisions of “%1$s”' ), $post_title );
|
||||
$title = __( 'Revisions' );
|
||||
|
||||
// Sets up the diff radio buttons
|
||||
$left = $revision->ID;
|
||||
$right = $post->ID;
|
||||
|
||||
$redirect = false;
|
||||
break;
|
||||
endswitch;
|
||||
@@ -145,79 +73,83 @@ if ( !empty($post->post_type) && 'post' != $post->post_type )
|
||||
else
|
||||
$parent_file = $submenu_file = 'edit.php';
|
||||
|
||||
wp_enqueue_style( 'revisions' );
|
||||
wp_enqueue_script( 'revisions' );
|
||||
|
||||
require_once( './admin-header.php' );
|
||||
|
||||
//TODO - Some of the translations below split things into multiple strings that are contextually related and this makes it pretty impossible for RTL translation.
|
||||
//TODO can we pass the context in a better way
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var wpRevisionsSettings = <?php echo json_encode( array( 'post_id' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ) ) ); ?>;
|
||||
</script>
|
||||
|
||||
<div id="backbonerevisionsoptions"></div>
|
||||
|
||||
<br class="clear"/>
|
||||
<div class="wrap">
|
||||
|
||||
<h2 class="long-header"><?php echo $h2; ?></h2>
|
||||
|
||||
<table class="form-table ie-fixed">
|
||||
<col class="th" />
|
||||
<?php if ( 'diff' == $action ) : ?>
|
||||
<tr id="revision">
|
||||
<th scope="row"></th>
|
||||
<th scope="col" class="th-full">
|
||||
<span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?></span>
|
||||
<span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?></span>
|
||||
</th>
|
||||
</tr>
|
||||
<?php endif;
|
||||
|
||||
// use get_post_to_edit filters?
|
||||
$identical = true;
|
||||
foreach ( _wp_post_revision_fields() as $field => $field_title ) :
|
||||
if ( 'diff' == $action ) {
|
||||
$left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field, $left_revision, 'left' );
|
||||
$right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field, $right_revision, 'right' );
|
||||
if ( !$content = wp_text_diff( $left_content, $right_content ) )
|
||||
continue; // There is no difference between left and right
|
||||
$identical = false;
|
||||
} else {
|
||||
add_filter( "_wp_post_revision_field_$field", 'htmlspecialchars' );
|
||||
$content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field, $revision, '' );
|
||||
}
|
||||
?>
|
||||
|
||||
<tr id="revision-field-<?php echo $field; ?>">
|
||||
<th scope="row"><?php echo esc_html( $field_title ); ?></th>
|
||||
<td><div class="pre"><?php echo $content; ?></div></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
|
||||
if ( 'diff' == $action && $identical ) :
|
||||
|
||||
?>
|
||||
|
||||
<tr><td colspan="2"><div class="updated"><p><?php _e( 'These revisions are identical.' ); ?></p></div></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<h3><?php echo $title; ?></h3>
|
||||
|
||||
<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
|
||||
<div class="revisiondiffcontainer diffsplit currentversion rightmodelloading">
|
||||
<div id="modelsloading" class="updated message"><span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?></div>
|
||||
<h2 class="long-header"><?php echo $h2; ?></h2>
|
||||
<div id="backbonerevisionsinteract"></div>
|
||||
<div id="backbonerevisionsdiff"></div>
|
||||
<hr />
|
||||
<?php
|
||||
|
||||
$args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left );
|
||||
if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') )
|
||||
$args['type'] = 'autosave';
|
||||
|
||||
wp_list_post_revisions( $post, $args );
|
||||
|
||||
$comparetworevisionslink = get_edit_post_link( $revision->ID );
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script id="tmpl-revision" type="text/html">
|
||||
<div id="diffsubheader">
|
||||
<span id="diff_from_current_revision"><?php _e( 'Current version' ); ?><?php _e( '- compared to -' ); ?></span>
|
||||
<div id="difftitlefrom">{{{ data.revision_from_date_author }}} <?php _e( '- compared to -' ); ?></div>
|
||||
<div id="difftitle">{{{ data.revision_date_author }}}</div>
|
||||
<div id="diffcancel"><input class="button" onClick="document.location='<?php echo get_edit_post_link( $post->ID ); ?>'" type="submit" id="cancel" value="<?php esc_attr_e( 'Cancel' )?>" /></div>
|
||||
<div id="diffrestore"><input class="button button-primary" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore' )?>" /></div>
|
||||
<div id="comparetworevisions"><input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> <?php esc_attr_e( 'Compare two revisions' )?></div>
|
||||
</div>
|
||||
<div id="removedandadded">
|
||||
<div id="removed"><?php _e( 'Removed -' ); ?></div>
|
||||
<div id="added"><?php _e( 'Added +' ); ?></div>
|
||||
</div
|
||||
<div>{{{ data.revisiondiff }}}</div>
|
||||
</script>
|
||||
|
||||
<script id="tmpl-revisionvinteract" type="text/html">
|
||||
<div id="diffheader">
|
||||
<div id="diffprevious"><input class="button" type="submit" id="previous" value="Previous" /></div>
|
||||
<div id="diffnext"><input class="button" type="submit" id="next" value="Next" /></div>
|
||||
<div id="diffslider">
|
||||
<div id="revisioncount">
|
||||
<?php _e( 'Comparing' ); ?>
|
||||
<span id="diff_left_count"> <?php _e( 'revision' ); ?></span> <span id="diff_left_count_inner"></span>
|
||||
<span id="diff_left_current_revision"><?php _e( 'current version' ); ?></span>
|
||||
<span id="diff_revision_from">{{{ data.diff_revision_from }}}</span>
|
||||
<?php _e( ' to revision' ); ?>
|
||||
<span id="diff_count">{{{ data.current_diff }}}</span>
|
||||
<?php _e( ' of ' ); ?>
|
||||
<span id="diff_max" ></span>
|
||||
</div>
|
||||
|
||||
<div id="slider"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<?php
|
||||
require_once( './admin-footer.php' );
|
||||
/*
|
||||
TODO Convert these into screen options
|
||||
<script id="tmpl-revisionoptions" type="text/html">
|
||||
<div id="revisionoptions">
|
||||
<div id="showsplitviewoption">
|
||||
<input type='checkbox' id="show_split_view" checked="checked" value="1" /> <?php _e( 'Show split diff view' ); ?>
|
||||
</div>
|
||||
<div id="toggleshowautosavesoption">
|
||||
<input type='checkbox' id="toggleshowautosaves" value="1" /> <?php _e( 'Show autosaves' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
*/
|
||||
require_once( './admin-footer.php' );
|
||||
Reference in New Issue
Block a user