diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-25 15:06:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-25 15:06:20 +0000 |
commit | 52547466f0f1ce8b41bf1539546aaa28457077a1 (patch) | |
tree | b2ffc5296536fb77afd07bc2a96ad934af5a79a6 /app | |
parent | 4967fa8733e220e2220fdd546df3b46ef5725ac9 (diff) | |
download | redmine-52547466f0f1ce8b41bf1539546aaa28457077a1.tar.gz redmine-52547466f0f1ce8b41bf1539546aaa28457077a1.zip |
Fixed: 10342 Creation of Schema in Oracle
Comment is a reserved keyword for Oracle. The five 'Comment' columns are renamed to 'Commments'.
Migration scripts were modified to let oracle users create the database. For the others, migration 41 will rename the columns (only if columns have the 'old' name).
Fixed also a few oracle specific issues.
Note: currently (in Rails 1.2.3), there's bug in Rails oracle adapter. See: http://dev.rubyonrails.org/ticket/7344
Attached patch is required for redMine to work properly.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@479 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/timelog_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/wiki_controller.rb | 6 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/models/changeset.rb | 4 | ||||
-rw-r--r-- | app/models/comment.rb | 2 | ||||
-rw-r--r-- | app/models/custom_value.rb | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 2 | ||||
-rw-r--r-- | app/models/time_entry.rb | 4 | ||||
-rw-r--r-- | app/models/user_preference.rb | 9 | ||||
-rw-r--r-- | app/views/news/show.rhtml | 6 | ||||
-rw-r--r-- | app/views/projects/activity.rhtml | 4 | ||||
-rw-r--r-- | app/views/projects/search.rhtml | 2 | ||||
-rw-r--r-- | app/views/projects/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/repositories/_revisions.rhtml | 4 | ||||
-rw-r--r-- | app/views/repositories/revision.rhtml | 2 | ||||
-rw-r--r-- | app/views/timelog/details.rhtml | 4 | ||||
-rw-r--r-- | app/views/timelog/edit.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/edit.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/history.rhtml | 4 | ||||
-rw-r--r-- | app/views/wiki/show.rhtml | 2 |
21 files changed, 41 insertions, 34 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 19f93de96..c94810aa8 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -503,7 +503,7 @@ class ProjectsController < ApplicationController end unless params[:show_wiki_edits] == "0" - select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comment, " + + select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comments, " + "#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title" joins = "LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{WikiContent.versioned_table_name}.page_id " + "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " @@ -624,7 +624,7 @@ class ProjectsController < ApplicationController # no more than 5 tokens to search for @tokens.slice! 5..-1 if @tokens.size > 5 # strings used in sql like statement - like_tokens = @tokens.collect {|w| "%#{w}%"} + like_tokens = @tokens.collect {|w| "%#{w.downcase}%"} operator = @all_words ? " AND " : " OR " limit = 10 @results = [] @@ -632,7 +632,7 @@ class ProjectsController < ApplicationController @results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news' @results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents' @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(title) like ? OR LOWER(text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki') - @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comment) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets') + @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comments) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets') @question = @tokens.join(" ") else @question = "" diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 5902390d4..c07a76060 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -59,7 +59,7 @@ private l(:field_activity), l(:field_issue), l(:field_hours), - l(:field_comment) + l(:field_comments) ] csv << headers.collect {|c| ic.iconv(c) } # csv lines @@ -69,7 +69,7 @@ private entry.activity.name, (entry.issue ? entry.issue.id : nil), entry.hours, - entry.comment + entry.comments ] csv << fields.collect {|c| ic.iconv(c.to_s) } end diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 5931a93ad..9e750b3a6 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -47,7 +47,7 @@ class WikiController < ApplicationController @content = @page.content_for_version(params[:version]) @content.text = "h1. #{@page.pretty_title}" if @content.text.blank? # don't keep previous comment - @content.comment = nil + @content.comments = nil if request.post? if @content.text == params[:content][:text] # don't save if text wasn't changed @@ -55,7 +55,7 @@ class WikiController < ApplicationController return end @content.text = params[:content][:text] - @content.comment = params[:content][:comment] + @content.comments = params[:content][:comments] @content.author = logged_in_user # if page is new @page.save will also save content, but not if page isn't a new record if (@page.new_record? ? @page.save : @content.save) @@ -69,7 +69,7 @@ class WikiController < ApplicationController @page = @wiki.find_page(params[:page]) # don't load text @versions = @page.content.versions.find :all, - :select => "id, author_id, comment, updated_on, version", + :select => "id, author_id, comments, updated_on, version", :order => 'version DESC' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2583116c8..ed068a758 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -113,6 +113,8 @@ module ApplicationHelper # textilize text according to system settings and RedCloth availability def textilizable(text, options = {}) + return "" if text.blank? + # different methods for formatting wiki links case options[:wiki_links] when :local diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 824fa12f5..2038266f9 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -34,7 +34,7 @@ class Changeset < ActiveRecord::Base end def scan_comment_for_issue_ids - return if comment.blank? + return if comments.blank? # keywords used to reference issues ref_keywords = Setting.commit_ref_keywords.downcase.split(",") # keywords used to fix issues @@ -48,7 +48,7 @@ class Changeset < ActiveRecord::Base # remove any associated issues self.issues.clear - comment.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match| + comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match| action = match[0] target_issue_ids = match[1].scan(/\d+/) target_issues = repository.project.issues.find_all_by_id(target_issue_ids) diff --git a/app/models/comment.rb b/app/models/comment.rb index 27e5c511e..88d5348da 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -19,5 +19,5 @@ class Comment < ActiveRecord::Base belongs_to :commented, :polymorphic => true, :counter_cache => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' - validates_presence_of :commented, :author, :comment + validates_presence_of :commented, :author, :comments end diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb index a1b2c9c40..e12c14376 100644 --- a/app/models/custom_value.rb +++ b/app/models/custom_value.rb @@ -22,7 +22,7 @@ class CustomValue < ActiveRecord::Base protected def validate errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty? - errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp) + errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp) errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0 errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length case custom_field.field_format diff --git a/app/models/repository.rb b/app/models/repository.rb index 5b7feb79f..02dfda6b7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -62,7 +62,7 @@ class Repository < ActiveRecord::Base :revision => revision.identifier, :committer => revision.author, :committed_on => revision.time, - :comment => revision.message) + :comments => revision.message) revision.paths.each do |change| Change.create(:changeset => changeset, diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index 984c2c3a0..c37f5dc86 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -10,7 +10,7 @@ class TimeEntry < ActiveRecord::Base validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on validates_numericality_of :hours, :allow_nil => true - validates_length_of :comment, :maximum => 255 + validates_length_of :comments, :maximum => 255 def before_validation self.project = issue.project if issue && project.nil? @@ -28,6 +28,6 @@ class TimeEntry < ActiveRecord::Base super self.tyear = spent_on ? spent_on.year : nil self.tmonth = spent_on ? spent_on.month : nil - self.tweek = spent_on ? spent_on.cweek : nil + self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil end end diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index d9601d516..1ed9e0fd9 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -26,11 +26,15 @@ class UserPreference < ActiveRecord::Base self.others ||= {} end + def before_save + self.others ||= {} + end + def [](attr_name) if attribute_present? attr_name super else - others[attr_name] + others ? others[attr_name] : nil end end @@ -38,7 +42,8 @@ class UserPreference < ActiveRecord::Base if attribute_present? attr_name super else - others.store attr_name, value + self.others ||= {} + self.others.store attr_name, value end end end diff --git a/app/views/news/show.rhtml b/app/views/news/show.rhtml index 024bd00fd..30e746aef 100644 --- a/app/views/news/show.rhtml +++ b/app/views/news/show.rhtml @@ -19,14 +19,14 @@ <div class="contextual"> <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> </div> - <%= simple_format(auto_link(h comment.comment))%> + <%= simple_format(auto_link(h comment.comments))%> <% end if @news.comments_count > 0 %> </div> <% if authorize_for 'news', 'add_comment' %> -<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comment" %></p> +<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p> <% form_tag({:action => 'add_comment', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> -<%= text_area 'comment', 'comment', :cols => 60, :rows => 6 %> +<%= text_area 'comment', 'comments', :cols => 60, :rows => 6 %> <p><%= submit_tag l(:button_add) %></p> <% end %> <% end %>
\ No newline at end of file diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index a0d419884..0ade2335d 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -39,10 +39,10 @@ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br /> <% elsif e.is_a? WikiContent.versioned_class %> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)<br /> - <% unless e.comment.blank? %><em><%=h e.comment %></em><% end %> + <% unless e.comments.blank? %><em><%=h e.comments %></em><% end %> <% elsif e.is_a? Changeset %> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> - <em><%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{truncate(e.comment, 500)}") unless e.comment.blank? %></em> + <em><%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{truncate(e.comments, 500)}") unless e.comments.blank? %></em> <% end %> </p></li> diff --git a/app/views/projects/search.rhtml b/app/views/projects/search.rhtml index 7f2998e7d..d13302b6c 100644 --- a/app/views/projects/search.rhtml +++ b/app/views/projects/search.rhtml @@ -41,7 +41,7 @@ <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i> <% elsif e.is_a? Changeset %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %><br /> - <%= highlight_tokens(e.comment, @tokens) %><br /> + <%= highlight_tokens(e.comments, @tokens) %><br /> <em><%= e.committer.blank? ? e.committer : "Anonymous" %>, <%= format_time(e.committed_on) %></em> <% end %> </p></li> diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index c8f109ea4..2afeb8253 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -7,7 +7,7 @@ <div class="splitcontentleft"> <%= textilizable @project.description %> <ul> - <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> + <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li> <% unless @project.parent.nil? %> <li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li> diff --git a/app/views/repositories/_revisions.rhtml b/app/views/repositories/_revisions.rhtml index a7dfbb66f..c297b5d03 100644 --- a/app/views/repositories/_revisions.rhtml +++ b/app/views/repositories/_revisions.rhtml @@ -3,7 +3,7 @@ <th>#</th> <th><%= l(:label_date) %></th> <th><%= l(:field_author) %></th> -<th><%= l(:field_comment) %></th> +<th><%= l(:field_comments) %></th> <th></th> </tr></thead> <tbody> @@ -12,7 +12,7 @@ <th align="center" style="width:5%"><%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %></th> <td align="center" style="width:15%"><%= format_time(changeset.committed_on) %></td> <td align="center" style="width:15%"><em><%=h changeset.committer %></em></td> -<td align="left"><%= textilizable(changeset.comment) %></td> +<td align="left"><%= textilizable(changeset.comments) %></td> <td align="center"><%= link_to l(:label_view_diff), :action => 'diff', :id => project, :path => path, :rev => changeset.revision if entry && entry.is_file? && changeset != changesets.last %></td> </tr> <% end %> diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index b443e8c64..4fa8bd204 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -8,7 +8,7 @@ <h2><%= l(:label_revision) %> <%= @changeset.revision %></h2> <p><em><%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %></em></p> -<%= textilizable @changeset.comment %> +<%= textilizable @changeset.comments %> <% if @changeset.issues.any? %> <h3><%= l(:label_related_issues) %></h3> diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml index f85eb0f5a..4ceca97be 100644 --- a/app/views/timelog/details.rhtml +++ b/app/views/timelog/details.rhtml @@ -16,7 +16,7 @@ <%= sort_header_tag('user_id', :caption => l(:label_member)) %>
<%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
<%= sort_header_tag('issue_id', :caption => l(:label_issue)) %>
-<th><%= l(:label_comment) %></th>
+<th><%= l(:label_comments) %></th>
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
<th></th>
</thead>
@@ -36,7 +36,7 @@ </div>
<% end %>
</td>
-<td><%=h entry.comment %></td>
+<td><%=h entry.comments %></td>
<td align="center"><strong><%= entry.hours %></strong></td>
<td align="center"><%= link_to_if_authorized(l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => entry}, :class => "icon icon-edit") if entry.user_id == @owner_id %></td>
</tr>
diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml index b826f7be7..13d76f1ef 100644 --- a/app/views/timelog/edit.rhtml +++ b/app/views/timelog/edit.rhtml @@ -7,7 +7,7 @@ <p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p>
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
-<p><%= f.text_field :comment, :size => 100 %></p>
+<p><%= f.text_field :comments, :size => 100 %></p>
<p><%= f.select :activity_id, (@activities.collect {|p| [p.name, p.id]}), :required => true %></p>
</div>
diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 0bc6322f9..af0b24df0 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -12,7 +12,7 @@ :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %> </div> <p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %></p> -<p><label><%= l(:field_comment) %></label><br /><%= f.text_field :comment, :size => 120 %></p> +<p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p> <p><%= submit_tag l(:button_save) %> <%= link_to_remote l(:label_preview), { :url => { :controller => 'wiki', :action => 'preview', :id => @project, :page => @page.title }, diff --git a/app/views/wiki/history.rhtml b/app/views/wiki/history.rhtml index dd9e590be..78dc70cc5 100644 --- a/app/views/wiki/history.rhtml +++ b/app/views/wiki/history.rhtml @@ -11,7 +11,7 @@ <th>#</th> <th><%= l(:field_updated_on) %></th> <th><%= l(:field_author) %></th> - <th><%= l(:field_comment) %></th> + <th><%= l(:field_comments) %></th> </tr></thead> <tbody> <% @versions.each do |ver| %> @@ -19,7 +19,7 @@ <th align="center"><%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %></th> <td align="center"><%= format_time(ver.updated_on) %></td> <td><em><%= ver.author ? ver.author.name : "anonyme" %></em></td> - <td><%=h ver.comment %></td> + <td><%=h ver.comments %></td> </tr> <% end %> </tbody> diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index e4e1bc38d..a65b1a61e 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -13,7 +13,7 @@ <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %> <br /> <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> - <%=h @content.comment %> + <%=h @content.comments %> </p> <hr /> <% end %> |