# HG changeset patch # User Dan # Date 1239826833 14400 # Node ID 95d0d8596c8728fd7fd986162550381650b2493f # Parent facff435cdaa3a573063779a864d21fd6f4e3224 File rollbacks should be all up to date now. diff -r facff435cdaa -r 95d0d8596c87 includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Wed Apr 15 14:23:48 2009 -0400 +++ b/includes/clientside/static/enano-lib-basic.js Wed Apr 15 16:20:33 2009 -0400 @@ -565,6 +565,7 @@ ajaxDelVote: 'ajax.js', ajaxProtect: 'ajax.js', ajaxClearLogs: 'ajax.js', + ajaxRollback: 'ajax.js', ajaxResetDelVotes: 'ajax.js', ajaxDeletePage: 'ajax.js', ajaxSetPassword: 'ajax.js', diff -r facff435cdaa -r 95d0d8596c87 includes/log.php --- a/includes/log.php Wed Apr 15 14:23:48 2009 -0400 +++ b/includes/log.php Wed Apr 15 16:20:33 2009 -0400 @@ -164,7 +164,7 @@ * @return array */ - public function get_data($offset, $page_size) + public function get_data($offset = 0, $page_size = 0) { global $db, $session, $paths, $session, $plugins; // Common objects $sql = $this->build_sql($offset, $page_size); @@ -270,11 +270,13 @@ /** * Formats a result row into pretty HTML. * @param array dataset from LogDisplay::get_data() + * @param bool If true (default), shows action buttons. + * @param bool If true (default), shows page title; good for integrated displays * @static * @return string */ - public static function render_row($row) + public static function render_row($row, $show_buttons = true, $show_pagetitle = true) { global $db, $session, $paths, $session, $plugins; // Common objects global $lang; @@ -285,52 +287,64 @@ $pagekey = sanitize_page_id($pagekey); // diff button - if ( $row['action'] == 'edit' && !empty($row['parent_revid']) ) + if ( $show_buttons ) { + if ( $row['action'] == 'edit' && !empty($row['parent_revid']) ) + { + $html .= '('; + if ( isPage($pagekey) ) + { + $html .= ''; + } + $html .= $lang->get('pagetools_rc_btn_diff'); + if ( isPage($pagekey) ) + { + $html .= ''; + } + if ( $row['parent_revid'] > 0 && isPage($pagekey) ) + { + $html .= ', ' . $lang->get('pagetools_rc_btn_undo') . ''; + } + $html .= ') '; + } + else if ( $row['action'] != 'edit' && ( isPage($pagekey) || $row['action'] == 'delete' ) ) + { + $html .= '('; + $html .= '' . $lang->get('pagetools_rc_btn_undo') . ''; + $html .= ') '; + } + + // hist button $html .= '('; if ( isPage($pagekey) ) { - $html .= ''; + $html .= ''; } - $html .= $lang->get('pagetools_rc_btn_diff'); + $html .= $lang->get('pagetools_rc_btn_hist'); if ( isPage($pagekey) ) { $html .= ''; } - if ( $row['parent_revid'] > 0 && isPage($pagekey) ) - { - $html .= ', ' . $lang->get('pagetools_rc_btn_undo') . ''; - } - $html .= ') '; + $html .= ') . . '; } - // hist button - $html .= '('; - if ( isPage($pagekey) ) + if ( $show_pagetitle ) { - $html .= ''; - } - $html .= $lang->get('pagetools_rc_btn_hist'); - if ( isPage($pagekey) ) - { - $html .= ''; + // new page? + if ( $row['action'] == 'edit' && empty($row['parent_revid']) ) + { + $html .= 'N '; + } + // minor edit? + if ( $row['action'] == 'edit' && $row['minor_edit'] ) + { + $html .= 'm '; + } + + // link to the page + $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"'; + $html .= '' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '; '; } - $html .= ') . . '; - - // new page? - if ( $row['action'] == 'edit' && empty($row['parent_revid']) ) - { - $html .= 'N '; - } - // minor edit? - if ( $row['action'] == 'edit' && $row['minor_edit'] ) - { - $html .= 'm '; - } - - // link to the page - $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"'; - $html .= '' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '; '; // date $today = time() - ( time() % 86400 ); @@ -395,15 +409,19 @@ case 'unprot': case 'semiprot': case 'delete': + case 'reupload': $stringmap = array( 'prot' => 'log_action_protect_full', 'unprot' => 'log_action_protect_none', 'semiprot' => 'log_action_protect_semi', - 'delete' => 'log_action_delete' + 'delete' => 'log_action_delete', + 'reupload' => 'log_action_reupload' ); if ( $row['edit_summary'] === '__REVERSION__' ) - $reason = '' . $lang->get('log_msg_reversion') . ''; + $reason = '' . $lang->get('log_msg_reversion') . ''; + else if ( $row['action'] == 'reupload' && $row['edit_summary'] === '__ROLLBACK__' ) + $reason = '' . $lang->get('log_msg_file_restored') . ''; else $reason = ( !empty($row['edit_summary']) ) ? htmlspecialchars($row['edit_summary']) : '' . $lang->get('log_msg_no_reason_provided') . ''; diff -r facff435cdaa -r 95d0d8596c87 includes/namespaces/file.php --- a/includes/namespaces/file.php Wed Apr 15 14:23:48 2009 -0400 +++ b/includes/namespaces/file.php Wed Apr 15 16:20:33 2009 -0400 @@ -38,6 +38,8 @@ global $db, $session, $paths, $template, $plugins; // Common objects global $lang; + require_once(ENANO_ROOT . '/includes/log.php'); + $local_page_id = $this->page_id; $local_namespace = $this->namespace; $html = ''; @@ -128,9 +130,15 @@ if ( !$q ) $db->_die(); + $log = new LogDisplay(); + $log->add_criterion('page', $paths->nslist['File'] . $this->page_id); + $log->add_criterion('action', 'reupload'); + $data = $log->get_data(); + $i = -1; + $html .= '

' . $lang->get('onpage_filebox_heading_history') . '

'; $last_rollback_id = false; - while ( $r = $db->fetchrow() ) + while ( $r = $db->fetchrow($q) ) { $html .= '(' . $lang->get('onpage_filebox_btn_this_version') . ') '; if ( $session->get_permissions('history_rollback') && $last_rollback_id ) @@ -138,10 +146,8 @@ else if ( $session->get_permissions('history_rollback') && !$last_rollback_id ) $html .= ' (' . $lang->get('onpage_filebox_btn_current') . ') '; $last_rollback_id = $r['log_id']; - $mimetype = $r['mimetype']; - $datestring = enano_date('F d, Y h:i a', (int)$r['time_id']); - $html .= $datestring.': '.$r['mimetype'].', '; + $html .= $r['mimetype'].', '; $fs = $r['size']; $fs = (int)$fs; @@ -163,6 +169,8 @@ } $html .= $size; + if ( isset($data[++$i]) ) + $html .= ': ' . LogDisplay::render_row($data[$i], false, false); $html .= '
'; } diff -r facff435cdaa -r 95d0d8596c87 includes/pageprocess.php --- a/includes/pageprocess.php Wed Apr 15 14:23:48 2009 -0400 +++ b/includes/pageprocess.php Wed Apr 15 16:20:33 2009 -0400 @@ -637,7 +637,7 @@ { case 'rename': // Page was renamed, let the rename method handle this - return array_merge($this->rename($log_entry['edit_summary']), array('dateline' => $dateline, 'action' => $log_entry['action'])); + return array_merge($this->rename_page($log_entry['edit_summary']), array('dateline' => $dateline, 'action' => $log_entry['action'])); break; case 'prot': case 'unprot': diff -r facff435cdaa -r 95d0d8596c87 language/english/tools.json --- a/language/english/tools.json Wed Apr 15 14:23:48 2009 -0400 +++ b/language/english/tools.json Wed Apr 15 16:20:33 2009 -0400 @@ -157,6 +157,7 @@ action_protect_none: 'Unprotected page (%reason%)', action_protect_semi: 'Semiprotected page (%reason%)', action_protect_full: 'Protected page (%reason%)', + action_reupload: 'Uploaded new revision: %reason%', action_protect: 'Protect and unprotect', action_edit: 'Edit', @@ -167,6 +168,7 @@ msg_no_reason_provided: 'No reason provided', msg_reversion: 'Reversion of previous action', + msg_file_restored: 'Restored previous version', msg_no_results: 'No results', msg_no_filters: 'All site logs', diff -r facff435cdaa -r 95d0d8596c87 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Wed Apr 15 14:23:48 2009 -0400 +++ b/plugins/SpecialUserFuncs.php Wed Apr 15 16:20:33 2009 -0400 @@ -1882,7 +1882,7 @@ * @return string */ - function format_date($time) + public static function format_date($time) { global $lang; // Our formattting string to pass to enano_date()