@@ -2,7 +2,8 | |||||
2 | <h2><%=l(:label_issue_plural)%></h2> |
|
2 | <h2><%=l(:label_issue_plural)%></h2> | |
3 | <% set_html_title l(:label_issue_plural) %> |
|
3 | <% set_html_title l(:label_issue_plural) %> | |
4 |
|
4 | |||
5 |
<% form_tag({ :controller => 'queries', :action => 'new' |
|
5 | <% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %> | |
|
6 | <%= hidden_field_tag('project_id', @project.id) if @project %> | |||
6 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> |
|
7 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> | |
7 | <div class="contextual"> |
|
8 | <div class="contextual"> | |
8 | <%= link_to_remote l(:button_apply), |
|
9 | <%= link_to_remote l(:button_apply), |
@@ -190,6 +190,9 namespace :redmine do | |||||
190 | end |
|
190 | end | |
191 |
|
191 | |||
192 | def self.migrate |
|
192 | def self.migrate | |
|
193 | establish_connection({:adapter => trac_adapter, | |||
|
194 | :database => trac_db_path}) | |||
|
195 | ||||
193 | # Quick database test before clearing Redmine data |
|
196 | # Quick database test before clearing Redmine data | |
194 | TracComponent.count |
|
197 | TracComponent.count | |
195 |
|
198 | |||
@@ -370,7 +373,7 namespace :redmine do | |||||
370 | def self.limit_for(klass, attribute) |
|
373 | def self.limit_for(klass, attribute) | |
371 | klass.columns_hash[attribute.to_s].limit |
|
374 | klass.columns_hash[attribute.to_s].limit | |
372 | end |
|
375 | end | |
373 |
|
376 | |||
374 | def self.encoding(charset) |
|
377 | def self.encoding(charset) | |
375 | @ic = Iconv.new('UTF-8', charset) |
|
378 | @ic = Iconv.new('UTF-8', charset) | |
376 | rescue Iconv::InvalidEncoding |
|
379 | rescue Iconv::InvalidEncoding | |
@@ -388,11 +391,17 namespace :redmine do | |||||
388 | puts e |
|
391 | puts e | |
389 | return false |
|
392 | return false | |
390 | end |
|
393 | end | |
391 |
|
394 | |||
392 | def self.trac_directory |
|
395 | def self.trac_directory | |
393 | @trac_directory |
|
396 | @trac_directory | |
394 | end |
|
397 | end | |
|
398 | ||||
|
399 | def self.set_trac_adapter(adapter) | |||
|
400 | return false unless %w(sqlite sqlite3).include?(adapter) | |||
|
401 | @trac_adapter = adapter | |||
|
402 | end | |||
395 |
|
403 | |||
|
404 | def self.trac_adapter; @trac_adapter end | |||
396 | def self.trac_db_path; "#{trac_directory}/db/trac.db" end |
|
405 | def self.trac_db_path; "#{trac_directory}/db/trac.db" end | |
397 | def self.trac_attachments_directory; "#{trac_directory}/attachments" end |
|
406 | def self.trac_attachments_directory; "#{trac_directory}/attachments" end | |
398 |
|
407 | |||
@@ -404,6 +413,8 namespace :redmine do | |||||
404 | :description => identifier.humanize |
|
413 | :description => identifier.humanize | |
405 | project.identifier = identifier |
|
414 | project.identifier = identifier | |
406 | puts "Unable to create a project with identifier '#{identifier}'!" unless project.save |
|
415 | puts "Unable to create a project with identifier '#{identifier}'!" unless project.save | |
|
416 | # enable issues and wiki for the created project | |||
|
417 | project.enabled_module_names = ['issue_tracking', 'wiki'] | |||
407 | end |
|
418 | end | |
408 | @target_project = project.new_record? ? nil : project |
|
419 | @target_project = project.new_record? ? nil : project | |
409 | end |
|
420 | end | |
@@ -441,12 +452,11 namespace :redmine do | |||||
441 | end |
|
452 | end | |
442 |
|
453 | |||
443 | prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory} |
|
454 | prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory} | |
|
455 | prompt('Trac database adapter (sqlite, sqlite3)', :default => 'sqlite') {|adapter| TracMigrate.set_trac_adapter adapter} | |||
444 | prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding} |
|
456 | prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding} | |
445 | prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier} |
|
457 | prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier} | |
446 | puts |
|
458 | puts | |
447 |
|
459 | |||
448 | TracMigrate.establish_connection({:adapter => 'sqlite', |
|
|||
449 | :database => "#{TracMigrate.trac_db_path}"}) |
|
|||
450 | TracMigrate.migrate |
|
460 | TracMigrate.migrate | |
451 | end |
|
461 | end | |
452 | end |
|
462 | end |
General Comments 0
You need to be logged in to leave comments.
Login now