From a1285394e281cf69ef939b92da5a59d3cc34e26b Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 24 Nov 2009 10:23:34 +0100 Subject: code restructuring and various bugfixes --- edit_columns.rb | 104 +++++++++++++++++++++++++++----------------------------- 1 file changed, 51 insertions(+), 53 deletions(-) (limited to 'edit_columns.rb') diff --git a/edit_columns.rb b/edit_columns.rb index c331c8d..c6cd967 100755 --- a/edit_columns.rb +++ b/edit_columns.rb @@ -86,73 +86,71 @@ TABLE # ADD/REMOVE COLUMN $html << table.edit_column_htmlform($cgi["editcolumn"],revno) -$html << "
" h = VCS.history urevs = h.undorevisions rrevs = h.redorevisions -hidden = "" if $cgi.include?("add_remove_column_month") +disabled, title, undorevision, hidden = {},{},{},{} +hidden["common"] = "" if $cgi.include?("add_remove_column_month") +["Undo","Redo"].each{|button| + disabled[button] = "disabled='disabled'" +} if urevs.max - urhist = urevs + # enable undo + disabled["Undo"] = "" + undorevision["Undo"] = urevs.max.rev() -1 + coltitle,action = urevs.max.comment.scan(/^Column (.*) (added|deleted|edited)$/).flatten case action when "added" - title = "Delete column #{coltitle}" + title["Undo"] = "Delete column #{coltitle}" when "deleted" - title = "Add column #{coltitle}" + title["Undo"] = "Add column #{coltitle}" when "edited" - title = "Column #{coltitle} edit" - end - $html << "" - unless urevs.size == 1 - $html << < -
-
- - - #{hidden} -
- - -UNDO - end - $html << < -
-
- -REDO - if rrevs.min - $html << < - - #{hidden} -REDO + title["Undo"] = "Column #{coltitle} edit" end - $html << < - - -REDO - urhist += rrevs - - $html << < -
-
- -
- - -READY - - $html << "
" - $html << (urhist).to_html(urevs.max.rev,"") + curundorev = urevs.max.rev if rrevs.min +end +if rrevs.min + # enable redo + disabled["Redo"] = "" + undorevision["Redo"] = rrevs.min.rev() + hidden["Redo"] = "" end -$html << "
" #undo + $html << < + + +UNDOREDOREADY + ["Undo","Redo"].each{|button| + $html << < +TD + } + $html << < +
+
+ +
+ + +
+
+
+
+ + + #{hidden["common"]} + #{hidden[button]} +
+
+
+ +READY +$html << (urevs + rrevs).to_html(curundorev,"") $html << "" -- cgit v1.2.3