Changeset 397
- Timestamp:
- 2007-04-06 18:20:12 (2 years ago)
- Files:
-
- branches/rest/app/controllers/application.rb (modified) (6 diffs)
- branches/rest/app/controllers/main_controller.rb (modified) (1 diff)
- branches/rest/app/controllers/node_controller.rb (modified) (7 diffs)
- branches/rest/app/controllers/search_controller.rb (deleted)
- branches/rest/app/helpers/application_helper.rb (modified) (5 diffs)
- branches/rest/app/helpers/search_helper.rb (deleted)
- branches/rest/app/views/document/_add.rhtml (modified) (1 diff)
- branches/rest/app/views/link/_li.rhtml (modified) (1 diff)
- branches/rest/app/views/main/_branch_title.rhtml (modified) (1 diff)
- branches/rest/app/views/main/_gallery.rhtml (modified) (1 diff)
- branches/rest/app/views/main/_list_nodes.rhtml (modified) (1 diff)
- branches/rest/app/views/main/_menu.rhtml (modified) (1 diff)
- branches/rest/app/views/node/_dates.rhtml (modified) (1 diff)
- branches/rest/app/views/node/_groups.rhtml (modified) (1 diff)
- branches/rest/app/views/node/_parent.rhtml (modified) (1 diff)
- branches/rest/app/views/node/_results.rhtml (added)
- branches/rest/app/views/node/_tags.rhtml (deleted)
- branches/rest/app/views/node/_title.rhtml (deleted)
- branches/rest/app/views/node/drive.rhtml (deleted)
- branches/rest/app/views/node/edit.rhtml (added)
- branches/rest/app/views/node/not_found.rhtml (deleted)
- branches/rest/app/views/node/update.rjs (modified) (1 diff)
- branches/rest/app/views/page/_form.rhtml (modified) (1 diff)
- branches/rest/app/views/page/_li.rhtml (modified) (1 diff)
- branches/rest/app/views/search/_form.rhtml (modified) (1 diff)
- branches/rest/app/views/search/_results.rhtml (deleted)
- branches/rest/app/views/templates/fixed/default/any__not_found.rhtml (modified) (1 diff)
- branches/rest/app/views/version/_li.rhtml (modified) (1 diff)
- branches/rest/config/routes.rb (modified) (2 diffs)
- branches/rest/db/migrate/000_zena/009_fulltext.rb (added)
- branches/rest/db/schema.rb (modified) (7 diffs)
- branches/rest/lib/tasks/bricks.rake (modified) (1 diff)
- branches/rest/test/functional/application_controller_test.rb (modified) (1 diff)
- branches/rest/test/unit/h_application_test.rb (modified) (2 diffs)
- branches/rest/vendor/plugins/ar_mysql_full_text (added)
- branches/rest/vendor/plugins/ar_mysql_full_text/README (added)
- branches/rest/vendor/plugins/ar_mysql_full_text/init.rb (added)
- branches/rest/vendor/plugins/ar_mysql_full_text/lib (added)
- branches/rest/vendor/plugins/ar_mysql_full_text/lib/ar_mysql_full_text.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/rest/app/controllers/application.rb
r394 r397 2 2 # Likewise, all the methods added will be available for all controllers. 3 3 class ApplicationController < ActionController::Base 4 helper_method :prefix, : node_path, :data_path, :node_url, :notes, :error_messages_for, :render_errors, :add_error4 helper_method :prefix, :pretty_path, :data_path, :node_url, :notes, :error_messages_for, :render_errors, :add_error 5 5 helper_method :template_text_for_url, :template_url_for_asset, :save_erb_to_url, :lang, :visitor 6 6 helper 'main' 7 before_filter : set_env7 before_filter :check_env 8 8 before_filter :authorize 9 9 after_filter :set_encoding … … 26 26 def render_404(exception) 27 27 respond_to do |format| 28 format.html { redirect_to :controller => ' main', :action => 'not_found' } # FIXME: can we keep some info on the '404' status ?28 format.html { redirect_to :controller => 'node', :action => 'not_found' } # FIXME: can we keep some info on the '404' status ? 29 29 format.all { render :nothing => true, :status => "404 Not Found" } 30 30 end … … 245 245 end 246 246 247 # change current language, set @su warning color (tested in MainControllerTest)248 def set_env247 # Make sure everything is in sync, change current language, set @su warning color (tested in MainControllerTest) 248 def check_env 249 249 # Set connection charset. MySQL 4.0 doesn't support this so it 250 250 # will throw an error, MySQL 4.1 needs this … … 252 252 ActiveRecord::Base.connection.execute 'SET NAMES UTF8' 253 253 end 254 255 redirect_to not_found_path if params[:id] && params[:path] # make sure we do not mix 'pretty urls' with resources. 256 254 257 new_lang = nil 255 258 if params[:lang] … … 348 351 349 352 def data_path(obj) 350 node_path(obj, :format => obj.c_ext)353 pretty_path(obj, :format => obj.c_ext) 351 354 end 352 355 … … 373 376 374 377 # Overwritte 'resource' path to use our custom urls. 375 def node_path(obj, opts={})378 def pretty_path(obj, opts={}) 376 379 opts = {:prefix => prefix}.merge(opts) 377 380 path = node_url(obj, opts).split('/') 378 381 path = path[1..-1] if opts[:prefix] 379 {:controller => 'node', :action=>'show', :path=>path, :prefix=>opts[:prefix]} 382 if path == [] 383 { :controller => 'node', :action => 'index', :prefix => opts[:prefix] } 384 else 385 { :controller => 'node', :action => 'show', :path => path, :prefix => opts[:prefix] } 386 end 380 387 end 381 388 branches/rest/app/controllers/main_controller.rb
r392 r397 32 32 render_and_cache 33 33 else 34 redirect_to node_path(@node)34 redirect_to pretty_path(@node) 35 35 end 36 36 rescue ActiveRecord::RecordNotFound branches/rest/app/controllers/node_controller.rb
r396 r397 19 19 =end 20 20 class NodeController < ApplicationController 21 before_filter :find_node, :except => [:index ]22 layout :popup_layout, :only => [: drive]21 before_filter :find_node, :except => [:index, :not_found, :search] 22 layout :popup_layout, :only => [:edit ] 23 23 24 24 def index 25 25 @node = site.root_node 26 params[:mode] = 'index' 26 27 respond_to do |format| 27 28 format.html { render_and_cache } … … 29 30 end 30 31 end 32 33 def not_found 34 @node = site.root_node 35 params[:mode] = 'not_found' 36 respond_to do |format| 37 format.html { render_and_cache } 38 format.all { render :nothing => true } 39 end 40 end 41 42 def search 43 if params[:q] && params[:q] != '' 44 match = Node.send(:sanitize_sql, ["MATCH (title,text,summary) AGAINST (?)", params[q]]) 45 query = { 46 :select => "SELECT DISTINCT nodes.*, #{match} AS score", 47 :join => "INNER JOIN versions ON versions.node_id = nodes.id", 48 :conditions => match, 49 :order => "score DESC" } 50 elsif params[:id] 51 query = { 52 :conditions => ["parent_id = ? AND kpath LIKE 'NP%'",params[:id]], 53 :order => 'name ASC' } 54 else 55 # error 56 raise Exception.new('bad arguments for search ("query" field missing)') 57 end 58 secure(Node) do 59 @node_pages, @nodes = paginate :nodes, query.merge(:per_page => 10) 60 @nodes # important: this is the 'secure' yield return, it is used to secure found nodes 61 end 62 respond_to do |format| 63 # FIXME: html should render in a full page 64 format.html { render :partial => 'results' } 65 format.js # this one renders the partial 66 end 67 end 68 31 69 32 70 def show … … 37 75 # Get document data (inline if possible) 38 76 if params[:format] != @node.c_ext 39 return redirect_to( node_path(@node), :mode => params[:mode])77 return redirect_to(pretty_path(@node), :mode => params[:mode]) 40 78 end 41 79 … … 73 111 end 74 112 75 # TODO: test76 113 def update 77 114 attrs = params[:node] 78 @node = secure(Node) { Node.find(params[:id]) }79 115 if attrs[:inherit] 80 116 @update = 'groups' … … 85 121 attrs[:parent_id] = parent[:id] if parent 86 122 end 87 if attrs[:name]88 @node[:name] = attrs[:name]89 attrs.delete(:name)90 end123 # why is this here ? if attrs[:name] 124 # why is this here ? @node[:name] = attrs[:name] 125 # why is this here ? attrs.delete(:name) 126 # why is this here ? end 91 127 @update = 'parent' 92 128 else … … 95 131 parse_dates(attrs) 96 132 @node.update_attributes(attrs) 97 @node.save 133 if @node.save 134 flash.now[:notice] = trans('node updated') 135 else 136 flash.now[:error] = trans('could not update') 137 end 138 respond_to do |format| 139 format.js { @flash = flash } 140 format.html { redirect_to pretty_path(@node) } 141 end 98 142 end 99 143 100 144 protected 101 145 def find_node 146 puts params.inspect 102 147 if path = params[:path] 103 148 if path.last =~ /([a-zA-Z\-]+)([0-9]*)(_[a-z]+|)(\..+|)/ … … 115 160 end 116 161 if params[:format] == '' || (params[:format] == 'html' && ( (zip != '' && @node.custom_base) || basepath != @node.basepath(true))) 117 redirect_to node_path(@node, :mode => params[:mode])162 redirect_to pretty_path(@node, :mode => params[:mode]) 118 163 end 119 164 elsif params[:id] branches/rest/app/helpers/application_helper.rb
r396 r397 252 252 title = (opts[:title] && opts[:title] != '') ? opts[:title] : node.v_title 253 253 if opts[:id][0..0] == '0' 254 link_to title, node_path(node), :popup=>true255 else 256 link_to title, node_path(node)254 link_to title, pretty_path(node), :popup=>true 255 else 256 link_to title, pretty_path(node) 257 257 end 258 258 rescue ActiveRecord::RecordNotFound … … 573 573 end 574 574 if opts[:link] 575 title = link_to(title, node_path(obj))575 title = link_to(title, pretty_path(obj)) 576 576 end 577 577 "<span id='v_title#{obj.v_id}'>#{title + check_lang(obj)}</span>" … … 866 866 obj = opts[:node] || @node 867 867 trad_list = [] 868 base_url = node_path(obj)868 base_url = pretty_path(obj) 869 869 (obj.traductions || []).map do |ed| 870 870 trad_list << "<span>" + link_to( trans(ed[:lang]), base_url.merge(:lang=>ed[:lang])) + "</span>" … … 903 903 nav = [] 904 904 node.ancestors.each do |obj| 905 nav << link_to(obj.name, node_path(obj))906 end 907 908 nav << "<a href='#{url_for( node_path(node))}' class='current'>#{node.name}</a>"905 nav << link_to(obj.name, pretty_path(obj)) 906 end 907 908 nav << "<a href='#{url_for(pretty_path(node))}' class='current'>#{node.name}</a>" 909 909 res = "<ul class='path'>" 910 910 "#{res}<li>#{nav.join(" / </li><li>")}</li></ul>" … … 927 927 "<a href='/#{node_url(node)}'>#{text}</a>" 928 928 else 929 link_to(text, node_path(node).merge(options[:url]) )929 link_to(text, pretty_path(node).merge(options[:url]) ) 930 930 end 931 931 end branches/rest/app/views/document/_add.rhtml
r320 r397 1 1 <li id='add_document' style='display:block;' class='btn_add'> 2 <a href='#' onclick='uploader=window.open("<%= url_for :controller=>'document', :action=>'new', :parent_id=>@node%>", "uploader", "location=1,width=400,height=300");return false;'><%= transb('btn_add_doc')%></a>2 <a href='#' onclick='uploader=window.open("<%= new_node_url(:parent_id=>@node) %>", "uploader", "location=1,width=400,height=300");return false;'><%= transb('btn_add_doc')%></a> 3 3 </li> branches/rest/app/views/link/_li.rhtml
r392 r397 1 1 <tr id='link<%= li[:link_id] %>'> 2 2 <td class="box"><%= trans("img_#{li[:role]}" ) %></td> 3 <td class="path" colspan='2'><%= link_to( li.rootpath, node_path(li), :popup=>true ) %></td>3 <td class="path" colspan='2'><%= link_to( li.rootpath, pretty_path(li), :popup=>true ) %></td> 4 4 <td class="actions"> <%= link_to_remote(transb('btn_tiny_del'), :url=>{:controller=>'link', :action=>'remove', :id=>li[:link_id], :node_id=>@node[:id]}, :post=>true)%> </td> 5 5 </tr> branches/rest/app/views/main/_branch_title.rhtml
r392 r397 1 1 <div class='s<%= branch.class.to_s.downcase %>' ><%= link_to branch.name, :prefix => prefix, :controller => 'main', :action=>'site_tree', :id=>branch[:id], :prefix=>prefix %> 2 2 <% if session[:user] %><span class='readers'><%= node_actions(:actions=>:drive, :node => branch, :text=>readers_for(branch)) %></span><% end %> 3 <span class='class'><%= link_to(branch.class.to_s.downcase, node_path(branch)) %></span></div>3 <span class='class'><%= link_to(branch.class.to_s.downcase, pretty_path(branch)) %></span></div> branches/rest/app/views/main/_gallery.rhtml
r392 r397 5 5 <%= link_to_function("#{doc.img_tag('pv')}","Zena.transfer('#{@gallery_counter}-#{doc.id}','gallery#{@gallery_counter}')") %> 6 6 <div style='display:none;' id='<%= "#{@gallery_counter}-#{doc.id}" %>'> 7 <p><%= link_to(doc.v_title, node_path(doc) ) %></p>7 <p><%= link_to(doc.v_title, pretty_path(doc) ) %></p> 8 8 <p class="summary"><%= zazen doc.v_summary %></p> 9 9 <a href="#" onclick="new Effect.BlindUp('<%= "gallery#{@gallery_counter}" %>'); return false;"><%= doc.img_tag('std') %></a> branches/rest/app/views/main/_list_nodes.rhtml
r392 r397 4 4 <tr> 5 5 <td class='docpv'><%= link_to img_tag(doc, :mode=>'mini'), data_path(doc) %><p><%= fsize(doc.c_size) %></p></td> 6 <td class='docinfo'><h4><%= link_to(doc.v_title, node_path(doc)) %></h4><p><%= doc.v_summary %></p></td>6 <td class='docinfo'><h4><%= link_to(doc.v_title, pretty_path(doc)) %></h4><p><%= doc.v_summary %></p></td> 7 7 </tr> 8 8 <% end %> branches/rest/app/views/main/_menu.rhtml
r392 r397 1 1 <% @depth ||=0; @depth += 1 -%> 2 <li><%= link_to(menu.name.limit(17), node_path(menu)) %>2 <li><%= link_to(menu.name.limit(17), pretty_path(menu)) %> 3 3 <% if @depth < 3 && menu.pages != [] -%> 4 4 <ul> branches/rest/app/views/node/_dates.rhtml
r396 r397 1 1 <div id='dates_errors' class='errors'></div> 2 2 <ul> 3 <%= form_remote_tag(: with=>'dates', :url=>{:controller=>'node', :action=>'update', :id=>@node[:id], :rnd=>rnd}) %>3 <%= form_remote_tag(:url => node_path(@node[:zip]), :html => { :method => :put, :rnd => rnd } ) %> 4 4 <li><label for='node_event_at'><%= trans('event date') %></label><%= date_box('node', 'event_at') %></li> 5 5 <li><label for='node_log_at'><%= trans('log date') %></label><%= date_box('node', 'log_at') %></li> branches/rest/app/views/node/_groups.rhtml
r396 r397 13 13 <li class='readers'><%= readers_for(@node) %></li> 14 14 <% if inherit_modes %> 15 <%= form_remote_tag(: with=>'groups', :url=>{:controller=>'node', :action=>'update', :id=>@node[:id], :rnd=>rnd}) %>15 <%= form_remote_tag(:url => node_path(@node[:zip]), :html => { :method => :put, :rnd => rnd } ) %> 16 16 <li><label><%= trans('mode') %></label><%= select('node', 'inherit', inherit_modes, {}, {:onchange=>"Zena.update_rwp(this.value,'#{groups_list.index(@node.ref[:rgroup_id])}','#{groups_list.index(@node.ref[:wgroup_id])}','#{groups_list.index(@node.ref[:pgroup_id])}', '#{form_skins.index(@node.ref[:skin])}'); return false;"}) %></li> 17 17 <li><label><%= trans('publishers') %></label><%= select('node', 'pgroup_id', form_groups, { :include_blank => true }, {:disabled=>(@node[:inherit] != 0)}) %></li> branches/rest/app/views/node/_parent.rhtml
r396 r397 1 1 <div id='parent_errors' class='errors'></div> 2 2 <ul> 3 <%= form_remote_tag(:url => node_path(@node ).merge( :rnd => rnd)) %>3 <%= form_remote_tag(:url => node_path(@node[:zip]), :html => { :method => :put, :rnd => rnd } ) %> 4 4 <li><label><%= trans('parent') %></label><%= select_id('node', 'parent_id', :class=>@node.class.parent_class) %></li> 5 5 <li><label><%= trans('name') %></label><%= text_field('node', 'name', :size=>15) %></li> branches/rest/app/views/node/update.rjs
r152 r397 2 2 page.replace_html "#{@update}_errors", :inline => @errors ? render_errors : error_messages_for('node') 3 3 else 4 page.replace_html @update, :partial =>@update5 page.replace _html 'messages', :inline=>"<div id='notice'>#{trans('node updated')}</div>"4 page.replace_html @update, :partial => @update 5 page.replace 'messages', :inline => flash_messages 6 6 page.visual_effect :highlight, @update 7 7 page.visual_effect :fade, 'notice', :duration => 3 branches/rest/app/views/page/_form.rhtml
r391 r397 1 <%= form_remote_tag(: with=>"add_page_form", :url=>{:controller=>'page', :action=>"create", :rnd=>rnd}) %>1 <%= form_remote_tag(:url => node_path, :html => { :rnd=>rnd } ) %> 2 2 <% Tag # annonce -%> 3 3 <p class="btn_x"><%= link_to_function transb('btn_x'), "new Element.toggle('add_page', 'add_page_form');" %></p> branches/rest/app/views/page/_li.rhtml
r392 r397 1 1 <li class="li_s<%= li.v_status %>"> 2 <%= link_to(li.v_title + check_lang( li ), node_path(li)) %>2 <%= link_to(li.v_title + check_lang( li ), pretty_path(li)) %> 3 3 </li> branches/rest/app/views/search/_form.rhtml
r391 r397 1 1 <div class="search"> 2 2 <%= form_remote_tag(:update=>'search_results', 3 :url=>{:controller=>'search', :action=>'find', :id=>@node, :edit=>@edit}, 4 :loading => "$('search_results').innerHTML='';Element.show('result_loader');", 3 :url => search_node_path, 4 :html => {:edit=>@edit, :id => @node[:zip]}, 5 :loading => "$('search_results').innerHTML='';Element.show('result_loader');", 5 6 :complete => "Element.hide('result_loader'); Element.show('search_results');") %> 6 7 <div class='wrapper'><input type='text' accesskey='s' id='search_field' style="color:#aaa;" name='search' onfocus='this.style.color="black";this.value="";' value='search'/></div> branches/rest/app/views/templates/fixed/default/any__not_found.rhtml
r326 r397 14 14 <body <%= @su %>> 15 15 <div class="navbar"> 16 <div id='lang'><% = lang_links %></div>17 <div id='path'><% = show_path %></div>18 <div id='login'><% = login_link %></div>19 <div id='visitor'><% = visitor_link %></div>20 <div id='search'><% = search_box %></div>16 <div id='lang'><%#= lang_links %></div> 17 <div id='path'><%#= show_path %></div> 18 <div id='login'><%#= login_link %></div> 19 <div id='visitor'><%#= visitor_link %></div> 20 <div id='search'><%#= search_box %></div> 21 21 </div> 22 22 23 <div id='menu'><% = show_menu %></div>23 <div id='menu'><%#= show_menu %></div> 24 24 <div id='logo'><a href='/'><img src='/img/logo.png' width='220' height='100' alt='logo'/></a></div> 25 25 <%= flash_messages %> branches/rest/app/views/version/_li.rhtml
r392 r397 1 1 <li class="li_s<%= li.status %>"> 2 <%= link_to(li.title, node_path(li.node)) %>2 <%= link_to(li.title, pretty_path(li.node)) %> 3 3 </li> branches/rest/config/routes.rb
r396 r397 1 1 ActionController::Routing::Routes.draw do |map| 2 2 3 map.home ':prefix', :controller=>'node', :action => 'index', :prefix => /\w{0,2}/ 4 map.user_home 'home', :controller => 'user', :action => 'home' 5 map.login 'login', :controller => 'session', :action => 'create', :requirements => { :method => :post } 6 map.login 'login', :controller => 'session', :action => 'new' 7 map.logout 'logout', :controller => 'session', :action => 'destroy' 3 map.home ':prefix', :controller => 'node', :action => 'index', :prefix => /\w{0,2}/ 4 map.not_found '404.html', :controller => 'node', :action => 'not_found' 5 map.user_home 'home', :controller => 'user', :action => 'home' 6 map.login 'login', :controller => 'session', :action => 'create', :requirements => { :method => :post } 7 map.login 'login', :controller => 'session', :action => 'new' 8 map.logout 'logout', :controller => 'session', :action => 'destroy' 8 9 9 10 map.resource :session # singleton resource 10 11 map.resources :user # many objects 11 12 12 map.connect ':prefix/*path', :controller=>'node', :action=>'show', :prefix=>/\w{0,2}/ 13 map.connect ':prefix/*path', :controller => 'node', :action => 'show', :prefix=>/\w{0,2}/, :requirements => { :method => :get } 14 # map.resources :node, :collection => { :search => :get } do |node| 13 15 map.resources :node do |node| 14 16 node.resources :version, … … 18 20 :refuse => :put } 19 21 end 22 23 # FIXME monolingual 24 map.connect '*path', :controller => 'node', :action => 'not_found' 20 25 21 # Install the default route as the lowest priority.22 map.connect ':controller/:action/:id.:format'23 map.connect ':controller/:action/:id'24 26 #map.login 'login' , :controller=>'login', :action=>'login' 25 27 #map.logout 'logout', :controller=>'login', :action=>'logout' branches/rest/db/schema.rb
r388 r397 7 7 create_table "bricks_info", :id => false, :force => true do |t| 8 8 t.column "version", :integer 9 t.column "brick", :string9 t.column "brick", :string 10 10 end 11 11 12 12 create_table "cached_pages", :force => true do |t| 13 t.column "path", :text13 t.column "path", :text 14 14 t.column "expire_after", :datetime 15 t.column "created_at", :datetime16 t.column "node_id", :integer17 t.column "site_id", :integer15 t.column "created_at", :datetime 16 t.column "node_id", :integer 17 t.column "site_id", :integer 18 18 end 19 19 20 20 create_table "cached_pages_nodes", :id => false, :force => true do |t| 21 21 t.column "cached_page_id", :integer 22 t.column "node_id", :integer22 t.column "node_id", :integer 23 23 end 24 24 25 25 create_table "caches", :force => true do |t| 26 t.column "updated_at", :datetime27 t.column "visitor_id", :integer28 t.column "visitor_groups", :string, :limit => 20029 t.column "kpath", :string,:limit => 20030 t.column "context", :string,:limit => 20031 t.column "content", :text32 t.column "site_id", :integer26 t.column "updated_at", :datetime 27 t.column "visitor_id", :integer 28 t.column "visitor_groups", :string, :limit => 200 29 t.column "kpath", :string, :limit => 200 30 t.column "context", :string, :limit => 200 31 t.column "content", :text 32 t.column "site_id", :integer 33 33 end 34 34 35 35 create_table "comments", :force => true do |t| 36 t.column "created_at", :datetime37 t.column "updated_at", :datetime38 t.column "status", :integer36 t.column "created_at", :datetime 37 t.column "updated_at", :datetime 38 t.column "status", :integer 39 39 t.column "discussion_id", :integer 40 t.column "reply_to", :integer41 t.column "user_id", :integer42 t.column "title", :string,:limit => 250, :default => "", :null => false43 t.column "text", :text, :default => "",:null => false44 t.column "author_name", :string,:limit => 30045 t.column "site_id", :integer40 t.column "reply_to", :integer 41 t.column "user_id", :integer 42 t.column "title", :string, :limit => 250, :default => "", :null => false 43 t.column "text", :text, :null => false 44 t.column "author_name", :string, :limit => 300 45 t.column "site_id", :integer 46 46 end 47 47 … … 50 50 t.column "updated_at", :datetime 51 51 t.column "version_id", :integer 52 t.column "first_name", :string, :limit => 60, :default => "", :null => false53 t.column "name", :string,:limit => 60, :default => "", :null => false54 t.column "address", :text, :default => "",:null => false55 t.column "zip", :string,:limit => 20, :default => "", :null => false56 t.column "city", :string,:limit => 60, :default => "", :null => false57 t.column "telephone", :string,:limit => 60, :default => "", :null => false58 t.column "mobile", :string,:limit => 60, :default => "", :null => false59 t.column "email", :string,:limit => 60, :default => "", :null => false60 t.column "birthday", :date61 t.column "site_id", :integer52 t.column "first_name", :string, :limit => 60, :default => "", :null => false 53 t.column "name", :string, :limit => 60, :default => "", :null => false 54 t.column "address", :text, :null => false 55 t.column "zip", :string, :limit => 20, :default => "", :null => false 56 t.column "city", :string, :limit => 60, :default => "", :null => false 57 t.column "telephone", :string, :limit => 60, :default => "", :null => false 58 t.column "mobile", :string, :limit => 60, :default => "", :null => false 59 t.column "email", :string, :limit => 60, :default => "", :null => false 60 t.column "birthday", :date 61 t.column "site_id", :integer 62 62 end 63 63 … … 65 65 t.column "created_at", :datetime 66 66 t.column "updated_at", :datetime 67 t.column "node_id", :integer68 t.column "inside", :boolean,:default => false69 t.column "open", :boolean,:default => true70 t.column "lang", :string, :limit => 10, :default => "",:null => false71 t.column "site_id", :integer67 t.column "node_id", :integer 68 t.column "inside", :boolean, :default => false 69 t.column "open", :boolean, :default => true 70 t.column "lang", :string, :limit => 10, :default => "", :null => false 71 t.column "site_id", :integer 72 72 end 73 73 74 74 create_table "document_contents", :force => true do |t| 75 t.column "type", :string,:limit => 3276 t.column "version_id", :integer77 t.column "name", :string,:limit => 200, :default => "", :null => false78 t.column "content_type", :string, :limit => 2079 t.column "ext", :string,:limit => 2080 t.column "size", :integer81 t.column "format", :string,:limit => 2082 t.column "width", :integer83 t.column "height", :integer84 t.column "site_id", :integer75 t.column "type", :string, :limit => 32 76 t.column "version_id", :integer 77 t.column "name", :string, :limit => 200, :default => "", :null => false 78 t.column "content_type", :string, :limit => 20 79 t.column "ext", :string, :limit => 20 80 t.column "size", :integer 81 t.column "format", :string, :limit => 20 82 t.column "width", :integer 83 t.column "height", :integer 84 t.column "site_id", :integer 85 85 end 86 86 87 87 create_table "form_lines", :force => true do |t| 88 88 t.column "seizure_id", :integer 89 t.column "key", :string90 t.column "value", :string91 t.column "site_id", :integer89 t.column "key", :string 90 t.column "value", :string 91 t.column "site_id", :integer 92 92 end 93 93 94 94 create_table "form_seizures", :force => true do |t| 95 t.column "user_id", :integer,:default => 0, :null => false96 t.column "created_at", :datetime 97 t.column "updated_at", :datetime 98 t.column "form_id", :integer99 t.column "site_id", :integer95 t.column "user_id", :integer, :default => 0, :null => false 96 t.column "created_at", :datetime 97 t.column "updated_at", :datetime 98 t.column "form_id", :integer 99 t.column "site_id", :integer 100 100 end 101 101 … … 103 103 t.column "created_at", :datetime 104 104 t.column "updated_at", :datetime 105 t.column "name", :string,:limit => 20, :default => "", :null => false106 t.column "site_id", :integer105 t.column "name", :string, :limit => 20, :default => "", :null => false 106 t.column "site_id", :integer 107 107 end 108 108 109 109 create_table "groups_users", :id => false, :force => true do |t| 110 110 t.column "group_id", :integer, :default => 0, :null => false 111 t.column "user_id", :integer, :default => 0, :null => false111 t.column "user_id", :integer, :default => 0, :null => false 112 112 end 113 113 114 114 create_table "links", :force => true do |t| 115 t.column "source_id", :integer, :default => 0, :null => false116 t.column "target_id", :integer, :default => 0, :null => false117 t.column "role", :string,:limit => 20115 t.column "source_id", :integer, :default => 0, :null => false 116 t.column "target_id", :integer, :default => 0, :null => false 117 t.column "role", :string, :limit => 20 118 118 end 119 119 120 120 create_table "nodes", :force => true do |t| 121 t.column "type", :string,:limit => 32122 t.column "event_at", :datetime123 t.column "kpath", :string,:limit => 16124 t.column "created_at", :datetime125 t.column "updated_at", :datetime126 t.column "user_id", :integer, :default => 0,:null => false127 t.column "project_id", :integer128 t.column "parent_id", :integer129 t.column "name", :string,:limit => 200130 t.column "skin", :string131 t.column "inherit", :integer132 t.column "rgroup_id", :integer133 t.column "wgroup_id", :integer134 t.column "pgroup_id", :integer121 t.column "type", :string, :limit => 32 122 t.column "event_at", :datetime 123 t.column "kpath", :string, :limit => 16 124 t.column "created_at", :datetime 125 t.column "updated_at", :datetime 126 t.column "user_id", :integer, :default => 0, :null => false 127 t.column "project_id", :integer 128 t.column "parent_id", :integer 129 t.column "name", :string, :limit => 200 130 t.column "skin", :string 131 t.column "inherit", :integer 132 t.column "rgroup_id", :integer 133 t.column "wgroup_id", :integer 134 t.column "pgroup_id", :integer 135 135 t.column "publish_from", :datetime 136 t.column "max_status", :integer,:default => 30137 t.column "log_at", :datetime138 t.column "ref_lang", :string, :limit => 10, :default => "",:null => false139 t.column "alias", :string,:limit => 400140 t.column "fullpath", :text141 t.column "custom_base", :boolean,:default => false142 t.column "basepath", :text143 t.column "site_id", :integer144 t.column "zip", :integer145 t.column "dgroup_id", :integer136 t.column "max_status", :integer, :default => 30 137 t.column "log_at", :datetime 138 t.column "ref_lang", :string, :limit => 10, :default => "", :null => false 139 t.column "alias", :string, :limit => 400 140 t.column "fullpath", :text 141 t.column "custom_base", :boolean, :default => false 142 t.column "basepath", :text 143 t.column "site_id", :integer 144 t.column "zip", :integer 145 t.column "dgroup_id", :integer 146 146 end 147 147 148 148 create_table "sites", :force => true do |t| 149 t.column "host", :string150 t.column "root_id", :integer151 t.column "su_id", :integer152 t.column "anon_id", :integer149 t.column "host", :string 150 t.column "root_id", :integer 151 t.column "su_id", :integer 152 t.column "anon_id", :integer 153 153 t.column "public_group_id", :integer 154 t.column "admin_group_id", :integer155 t.column "site_group_id", :integer156 t.column "trans_group_id", :integer157 t.column "name", :string158 t.column "authorize", :boolean159 t.column "monolingual", :boolean160 t.column "allow_private", :boolean161 t.column "languages", :string162 t.column "default_lang", :string154 t.column "admin_group_id", :integer 155 t.column "site_group_id", :integer 156 t.column "trans_group_id", :integer 157 t.column "name", :string 158 t.column "authorize", :boolean 159 t.column "monolingual", :boolean 160 t.column "allow_private", :boolean 161 t.column "languages", :string 162 t.column "default_lang", :string 163 163 end 164 164 … … 166 166 t.column "user_id", :integer 167 167 t.column "site_id", :integer 168 t.column "status", :integer168 t.column "status", :integer 169 169 end 170 170 171 171 create_table "trans_phrases", :force => true do |t| 172 t.column "phrase", :string,:limit => 100, :default => "", :null => false172 t.column "phrase", :string, :limit => 100, :default => "", :null => false 173 173 t.column "site_id", :integer 174 174 end … … 176 176 create_table "trans_values", :force => true do |t| 177 177 t.column "phrase_id", :integer 178 t.column "lang", :string,:limit => 10, :default => "", :null => false179 t.column "value", :text, :default => "",:null => false180 t.column "site_id", :integer178 t.column "lang", :string, :limit => 10, :default => "", :null => false 179 t.column "value", :text, :null => false 180 t.column "site_id", :integer 181 181 end 182 182 … … 184 184 t.column "created_at", :datetime 185 185 t.column "updated_at", :datetime 186 t.column "login", :string,:limit => 20187 t.column "password", :string,:limit => 40188 t.column "lang", :string,:limit => 10, :default => "", :null => false186 t.column "login", :string, :limit => 20 187 t.column "password", :string, :limit => 40 188 t.column "lang", :string, :limit => 10, :default => "", :null => false 189 189 t.column "contact_id", :integer 190 t.column "first_name", :string, :limit => 60191 t.column "name", :string,:limit => 60192 t.column "email", :string,:limit => 60193 t.column "time_zone", :string194 t.column "status", :integer190 t.column "first_name", :string, :limit => 60 191 t.column "name", :string, :limit => 60 192 t.column "email", :string, :limit => 60 193 t.column "time_zone", :string 194 t.column "status", :integer 195 195 end 196 196 197 197 create_table "versions", :force => true do |t| 198 t.column "type", :string,:limit => 32199 t.column "created_at", :datetime200 t.column "updated_at", :datetime201 t.column "node_id", :integer, :default => 0,:null => false202 t.column "user_id", :integer, :default => 0,:null => false203 t.column "lang", :string, :limit => 10,:default => "", :null => false198 t.column "type", :string, :limit => 32 199 t.column "created_at", :datetime 200 t.column "updated_at", :datetime 201 t.column "node_id", :integer, :default => 0, :null => false 202 t.column "user_id", :integer, :default => 0, :null => false 203 t.column "lang", :string, :limit => 10, :default => "", :null => false 204 204 t.column "publish_from", :datetime 205 t.column "comment", :text, :default => "", :null => false 206 t.column "title", :string, :limit => 200, :default => "", :null => false 207 t.column "summary", :text, :default => "", :null => false 208 t.column "text", :text, :default => "", :null => false 209 t.column "status", :integer, :default => 30 210 t.column "number", :integer, :default => 1 211 t.column "content_id", :integer 212 t.column "site_id", :integer 213 end 205 t.column "comment", :text, :null => false 206 t.column "title", :string, :limit => 200, :default => "", :null => false 207 t.column "summary", :text, :null => false 208 t.column "text", :text, :null => false 209 t.column "status", :integer, :default => 30 210 t.column "number", :integer, :default => 1 211 t.column "content_id", :integer 212 t.column "site_id", :integer 213 end 214 215 execute "ALTER TABLE versions ENGINE = MyISAM" 216 execute "CREATE FULLTEXT INDEX index_versions_on_title ON versions (title,text,summary)" 214 217 215 218 create_table "zips", :id => false, :force => true do |t| 216 219 t.column "site_id", :integer 217 t.column "zip", :integer220 t.column "zip", :integer 218 221 end 219 222 branches/rest/lib/tasks/bricks.rake
r355 r397 1 require "#{File.dirname(__FILE__)}/../../config/environment" # needed to load ActiveRecord::Migrator 2 1 3 namespace :bricks do 2 4 desc "Run the bricks server" branches/rest/test/functional/application_controller_test.rb
