+ while( $x = wfFetchObject( $res ) ) {
+ $ret[$x->val_type] = $x ;
+ }
+ ksort ( $ret ) ;
+ return $ret ;
+ }
+
+ # Generates a form for a single revision
+ function getRevisionForm ( &$article , $revision , &$data , $focus = false ) {
+ # Fill data with blank values
+ foreach ( $this->topicList AS $x => $y ) {
+ if ( !isset ( $data[$x] ) ) {
+ $data[$x]->value = 0 ;
+ $data[$x]->comment = "" ;
+ }
+ }
+ ksort ( $data ) ;
+
+ # Generate form
+ $ret = "<form method='post'>" ;
+ $ret .= "<table border='1' cellspacing='0' cellpadding='2'" ;
+ if ( $focus ) $ret .= " style='background-color:#00BBFF'" ;
+ $ret .= ">\n" ;
+ $head = "Revision #" . $revision ;
+# if ( $focus ) $head = "<font color='red'>{$head}</font>" ;
+ $link = " " . $this->getVersionLink ( $article , $revision ) ;
+ $ret .= "<tr><th align='left' colspan='3'>" . $head . " ({$link})</th></tr>\n" ;
+ $line = 0 ;
+ foreach ( $data AS $x => $y ) {
+ $line = 1 - $line ;
+ $col = $line == 1 ? "#DDDDDD" : "#EEEEEE" ;
+ $idx = "_{$revision}[{$x}]" ;
+ $ret .= "<tr bgcolor='{$col}'>\n" ;
+ $ret .= "<th nowrap>" ;
+ $ret .= $this->topicList[$x]->val_comment ;
+ $ret .= "</th>\n" ;
+
+ $tlx = $this->topicList[$x] ;
+ $vote = "" ;
+ $max = $tlx->val_value ;
+ for ( $a = 0 ; $a <= $max ; $a++ ) {
+ if ( $a == 0 ) $vote .= wfMsg ( "val_noop" ) ;
+ $vote .= "<input type='radio' name='re_v{$idx}' value='{$a}'" ;
+ if ( $a == $y->value ) $vote .= " checked" ;
+ $vote .= "/>" ;
+ if ( $max == 2 && $a == 1 ) $vote .= wfMsg ( "val_no" ) . " " ;
+ else if ( $max == 2 && $a == 2 ) $vote .= wfMsg ( "val_yes" ) ;
+ else if ( $a != 0 ) $vote .= $a . " " ;
+ if ( $a == 0 ) $vote .= " " ;
+ }
+ $ret .= "<td nowrap valign='center'>{$vote}</td>\n" ;
+
+ $ret .= "<td width='100%' align='center'><input size='50' style='width:98%' maxlength='250' type='text' name='re_c{$idx}' value='{$y->comment}'/>" ;
+ $ret .= "</td></tr>\n" ;
+ }
+ $checked = $focus ? " checked" : "" ;
+ $ret .= "<tr><td colspan='3' valign='center'>\n" ;
+ $ret .= "<input type='checkbox' name='re_merge_{$revision}' value='1'{$checked}/>" . wfMsg( 'val_merge_old' ) . " \n" ;
+ $ret .= "<input type='checkbox' name='re_clear_{$revision}' value='1'{$checked}/>" . wfMsg( 'val_clear_old' ) . " \n" ;
+ $ret .= "<input type='submit' name='re_submit[{$revision}]' value='" . htmlspecialchars( wfMsg("ok") ) . "'/>\n" ;
+ if ( $focus ) $ret .= "<br/>\n<small>" . wfMsg ( "val_form_note" ) . "</small>" ;
+ $ret .= "</td></tr>\n" ;
+ $ret .= "</table>\n</form>\n\n" ;
+ return $ret ;
+ }
+
+ # Merges one dataset into another
+ function mergeInto ( &$source , &$dest ) {
+ $ret = false ;
+ foreach ( $source AS $x => $y ) {
+ $doit = false ;
+ if ( !isset ( $dest[$x] ) ) $doit = true ;
+ else if ( $dest[$x]->value == 0 ) $doit = true ;
+ if ( $doit ) {
+ $dest[$x] = $y ;
+ $ret = true ;
+ }