Changeset 397

Show
Ignore:
Timestamp:
2007-04-06 18:20:12 (2 years ago)
Author:
gaspard
Message:

r16@bison: gaspard | 2007-04-06 18:02:56 +0200
Still fixing for rails 1.2
Preparing for fulltext search

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rest/app/controllers/application.rb

    r394 r397  
    22# Likewise, all the methods added will be available for all controllers. 
    33class ApplicationController < ActionController::Base 
    4   helper_method :prefix, :node_path, :data_path, :node_url, :notes, :error_messages_for, :render_errors, :add_error 
     4  helper_method :prefix, :pretty_path, :data_path, :node_url, :notes, :error_messages_for, :render_errors, :add_error 
    55  helper_method :template_text_for_url, :template_url_for_asset, :save_erb_to_url, :lang, :visitor 
    66  helper 'main' 
    7   before_filter :set_env 
     7  before_filter :check_env 
    88  before_filter :authorize 
    99  after_filter  :set_encoding 
     
    2626  def render_404(exception) 
    2727    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 ? 
    2929      format.all  { render :nothing => true, :status => "404 Not Found" } 
    3030    end 
     
    245245  end 
    246246   
    247   # change current language, set @su warning color (tested in MainControllerTest) 
    248   def set_env 
     247  # Make sure everything is in sync, change current language, set @su warning color (tested in MainControllerTest) 
     248  def check_env 
    249249    # Set connection charset. MySQL 4.0 doesn't support this so it 
    250250    # will throw an error, MySQL 4.1 needs this 
     
    252252      ActiveRecord::Base.connection.execute 'SET NAMES UTF8' 
    253253    end 
     254     
     255    redirect_to not_found_path if params[:id] && params[:path] # make sure we do not mix 'pretty urls' with resources. 
     256     
    254257    new_lang = nil 
    255258    if params[:lang] 
     
    348351   
    349352  def data_path(obj) 
    350     node_path(obj, :format => obj.c_ext) 
     353    pretty_path(obj, :format => obj.c_ext) 
    351354  end 
    352355   
     
    373376   
    374377  # Overwritte 'resource' path to use our custom urls. 
    375   def node_path(obj, opts={}) 
     378  def pretty_path(obj, opts={}) 
    376379    opts = {:prefix => prefix}.merge(opts) 
    377380    path = node_url(obj, opts).split('/') 
    378381    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 
    380387  end 
    381388 
  • branches/rest/app/controllers/main_controller.rb

    r392 r397  
    3232      render_and_cache 
    3333    else 
    34       redirect_to node_path(@node) 
     34      redirect_to pretty_path(@node) 
    3535    end 
    3636  rescue ActiveRecord::RecordNotFound 
  • branches/rest/app/controllers/node_controller.rb

    r396 r397  
    1919=end 
    2020class 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
    2323   
    2424  def index 
    2525    @node = site.root_node 
     26    params[:mode] = 'index' 
    2627    respond_to do |format| 
    2728      format.html { render_and_cache } 
     
    2930    end 
    3031  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   
    3169   
    3270  def show 
     
    3775        # Get document data (inline if possible) 
    3876        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]) 
    4078        end 
    4179         
     
    73111  end 
    74112   
    75   # TODO: test 
    76113  def update 
    77114    attrs = params[:node] 
    78     @node = secure(Node) { Node.find(params[:id]) } 
    79115    if attrs[:inherit] 
    80116      @update = 'groups' 
     
    85121        attrs[:parent_id] = parent[:id] if parent 
    86122      end 
    87       if attrs[:name] 
    88         @node[:name] = attrs[:name] 
    89         attrs.delete(:name) 
    90       end 
     123      # 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 
    91127      @update = 'parent' 
    92128    else 
     
    95131    parse_dates(attrs) 
    96132    @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 
    98142  end 
    99143   
    100144  protected 
    101145    def find_node 
     146      puts params.inspect 
    102147      if path = params[:path] 
    103148        if path.last =~ /([a-zA-Z\-]+)([0-9]*)(_[a-z]+|)(\..+|)/ 
     
    115160        end 
    116161        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]) 
    118163        end 
    119164      elsif params[:id] 
  • branches/rest/app/helpers/application_helper.rb

    r396 r397  
    252252    title = (opts[:title] && opts[:title] != '') ? opts[:title] : node.v_title 
    253253    if opts[:id][0..0] == '0' 
    254       link_to title, node_path(node), :popup=>true 
    255     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) 
    257257    end 
    258258  rescue ActiveRecord::RecordNotFound 
     
    573573    end 
    574574    if opts[:link] 
    575       title = link_to(title, node_path(obj)) 
     575      title = link_to(title, pretty_path(obj)) 
    576576    end 
    577577    "<span id='v_title#{obj.v_id}'>#{title + check_lang(obj)}</span>" 
     
    866866    obj = opts[:node] || @node 
    867867    trad_list = [] 
    868     base_url = node_path(obj) 
     868    base_url = pretty_path(obj) 
    869869    (obj.traductions || []).map do |ed| 
    870870      trad_list << "<span>" + link_to( trans(ed[:lang]), base_url.merge(:lang=>ed[:lang])) + "</span>" 
     
    903903    nav = [] 
    904904    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>" 
    909909    res = "<ul class='path'>" 
    910910    "#{res}<li>#{nav.join(" / </li><li>")}</li></ul>" 
     
    927927      "<a href='/#{node_url(node)}'>#{text}</a>" 
    928928    else 
    929       link_to(text, node_path(node).merge(options[:url]) ) 
     929      link_to(text, pretty_path(node).merge(options[:url]) ) 
    930930    end 
    931931  end 
  • branches/rest/app/views/document/_add.rhtml

    r320 r397  
    11<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> 
    33</li> 
  • branches/rest/app/views/link/_li.rhtml

    r392 r397  
    11<tr id='link<%= li[:link_id] %>'> 
    22  <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> 
    44  <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> 
    55</tr> 
  • branches/rest/app/views/main/_branch_title.rhtml

    r392 r397  
    11<div class='s<%= branch.class.to_s.downcase %>' ><%= link_to branch.name, :prefix => prefix, :controller => 'main', :action=>'site_tree', :id=>branch[:id], :prefix=>prefix %> 
    22  <% 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  
    55  <%= link_to_function("#{doc.img_tag('pv')}","Zena.transfer('#{@gallery_counter}-#{doc.id}','gallery#{@gallery_counter}')") %> 
    66  <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> 
    88    <p class="summary"><%= zazen doc.v_summary %></p> 
    99    <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  
    44  <tr> 
    55    <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> 
    77  </tr> 
    88  <% end %> 
  • branches/rest/app/views/main/_menu.rhtml

    r392 r397  
    11<% @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)) %> 
    33    <% if @depth < 3 && menu.pages != [] -%> 
    44    <ul> 
  • branches/rest/app/views/node/_dates.rhtml

    r396 r397  
    11<div id='dates_errors' class='errors'></div> 
    22<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 } ) %> 
    44  <li><label for='node_event_at'><%= trans('event date') %></label><%= date_box('node', 'event_at') %></li> 
    55  <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  
    1313<li class='readers'><%= readers_for(@node) %></li> 
    1414<% 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 } ) %> 
    1616  <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> 
    1717  <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  
    11<div id='parent_errors' class='errors'></div> 
    22<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 } ) %> 
    44  <li><label><%= trans('parent') %></label><%= select_id('node', 'parent_id', :class=>@node.class.parent_class) %></li> 
    55  <li><label><%= trans('name') %></label><%= text_field('node', 'name', :size=>15) %></li> 
  • branches/rest/app/views/node/update.rjs

    r152 r397  
    22  page.replace_html "#{@update}_errors", :inline => @errors ? render_errors : error_messages_for('node') 
    33else   
    4   page.replace_html @update, :partial=>@update 
    5   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 
    66  page.visual_effect :highlight, @update 
    77  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 } ) %> 
    22<% Tag # annonce -%> 
    33<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  
    11<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)) %> 
    33</li> 
  • branches/rest/app/views/search/_form.rhtml

    r391 r397  
    11<div class="search"> 
    22  <%= 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');", 
    56            :complete => "Element.hide('result_loader'); Element.show('search_results');") %> 
    67  <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  
    1414<body <%= @su %>> 
    1515  <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> 
    2121  </div> 
    2222 
    23   <div id='menu'><%= show_menu      %></div> 
     23  <div id='menu'><%#= show_menu      %></div> 
    2424  <div id='logo'><a href='/'><img src='/img/logo.png' width='220' height='100' alt='logo'/></a></div> 
    2525  <%= flash_messages %> 
  • branches/rest/app/views/version/_li.rhtml

    r392 r397  
    11<li class="li_s<%= li.status %>"> 
    2 <%= link_to(li.title, node_path(li.node)) %> 
     2<%= link_to(li.title, pretty_path(li.node)) %> 
    33</li> 
  • branches/rest/config/routes.rb

    r396 r397  
    11ActionController::Routing::Routes.draw do |map| 
    22   
    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' 
    89   
    910  map.resource  :session  # singleton resource 
    1011  map.resources :user     # many objects 
    1112   
    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| 
    1315  map.resources :node do |node|                                      
    1416    node.resources :version,  
     
    1820                                :refuse  => :put } 
    1921  end 
     22 
     23  # FIXME monolingual 
     24  map.connect '*path',  :controller => 'node',    :action => 'not_found' 
    2025   
    21   # Install the default route as the lowest priority. 
    22   map.connect ':controller/:action/:id.:format' 
    23   map.connect ':controller/:action/:id' 
    2426  #map.login  'login' , :controller=>'login', :action=>'login' 
    2527  #map.logout 'logout', :controller=>'login', :action=>'logout' 
  • branches/rest/db/schema.rb

    r388 r397  
    77  create_table "bricks_info", :id => false, :force => true do |t| 
    88    t.column "version", :integer 
    9     t.column "brick", :string 
     9    t.column "brick",   :string 
    1010  end 
    1111 
    1212  create_table "cached_pages", :force => true do |t| 
    13     t.column "path", :text 
     13    t.column "path",         :text 
    1414    t.column "expire_after", :datetime 
    15     t.column "created_at", :datetime 
    16     t.column "node_id", :integer 
    17     t.column "site_id", :integer 
     15    t.column "created_at",   :datetime 
     16    t.column "node_id",      :integer 
     17    t.column "site_id",      :integer 
    1818  end 
    1919 
    2020  create_table "cached_pages_nodes", :id => false, :force => true do |t| 
    2121    t.column "cached_page_id", :integer 
    22     t.column "node_id", :integer 
     22    t.column "node_id",        :integer 
    2323  end 
    2424 
    2525  create_table "caches", :force => true do |t| 
    26     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 
     26    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 
    3333  end 
    3434 
    3535  create_table "comments", :force => true do |t| 
    36     t.column "created_at", :datetime 
    37     t.column "updated_at", :datetime 
    38     t.column "status", :integer 
     36    t.column "created_at",    :datetime 
     37    t.column "updated_at",    :datetime 
     38    t.column "status",        :integer 
    3939    t.column "discussion_id", :integer 
    40     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, :default => "", :null => false 
    44     t.column "author_name", :string, :limit => 300 
    45     t.column "site_id", :integer 
     40    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 
    4646  end 
    4747 
     
    5050    t.column "updated_at", :datetime 
    5151    t.column "version_id", :integer 
    52     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, :default => "", :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 
     52    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 
    6262  end 
    6363 
     
    6565    t.column "created_at", :datetime 
    6666    t.column "updated_at", :datetime 
    67     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 
     67    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 
    7272  end 
    7373 
    7474  create_table "document_contents", :force => true do |t| 
    75     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 
     75    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 
    8585  end 
    8686 
    8787  create_table "form_lines", :force => true do |t| 
    8888    t.column "seizure_id", :integer 
    89     t.column "key", :string 
    90     t.column "value", :string 
    91     t.column "site_id", :integer 
     89    t.column "key",        :string 
     90    t.column "value",      :string 
     91    t.column "site_id",    :integer 
    9292  end 
    9393 
    9494  create_table "form_seizures", :force => true do |t| 
    95     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 
     95    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 
    100100  end 
    101101 
     
    103103    t.column "created_at", :datetime 
    104104    t.column "updated_at", :datetime 
    105     t.column "name", :string, :limit => 20, :default => "", :null => false 
    106     t.column "site_id", :integer 
     105    t.column "name",       :string,  :limit => 20, :default => "", :null => false 
     106    t.column "site_id",    :integer 
    107107  end 
    108108 
    109109  create_table "groups_users", :id => false, :force => true do |t| 
    110110    t.column "group_id", :integer, :default => 0, :null => false 
    111     t.column "user_id", :integer, :default => 0, :null => false 
     111    t.column "user_id", :integer, :default => 0, :null => false 
    112112  end 
    113113 
    114114  create_table "links", :force => true do |t| 
    115     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 
     115    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 
    118118  end 
    119119 
    120120  create_table "nodes", :force => true do |t| 
    121     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 
     121    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 
    135135    t.column "publish_from", :datetime 
    136     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 
     136    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 
    146146  end 
    147147 
    148148  create_table "sites", :force => true do |t| 
    149     t.column "host", :string 
    150     t.column "root_id", :integer 
    151     t.column "su_id", :integer 
    152     t.column "anon_id", :integer 
     149    t.column "host",            :string 
     150    t.column "root_id",         :integer 
     151    t.column "su_id",           :integer 
     152    t.column "anon_id",         :integer 
    153153    t.column "public_group_id", :integer 
    154     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 
     154    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 
    163163  end 
    164164 
     
    166166    t.column "user_id", :integer 
    167167    t.column "site_id", :integer 
    168     t.column "status", :integer 
     168    t.column "status", :integer 
    169169  end 
    170170 
    171171  create_table "trans_phrases", :force => true do |t| 
    172     t.column "phrase", :string, :limit => 100, :default => "", :null => false 
     172    t.column "phrase", :string, :limit => 100, :default => "", :null => false 
    173173    t.column "site_id", :integer 
    174174  end 
     
    176176  create_table "trans_values", :force => true do |t| 
    177177    t.column "phrase_id", :integer 
    178     t.column "lang", :string, :limit => 10, :default => "", :null => false 
    179     t.column "value", :text, :default => "", :null => false 
    180     t.column "site_id", :integer 
     178    t.column "lang",      :string, :limit => 10, :default => "", :null => false 
     179    t.column "value",     :text,                                  :null => false 
     180    t.column "site_id",   :integer 
    181181  end 
    182182 
     
    184184    t.column "created_at", :datetime 
    185185    t.column "updated_at", :datetime 
    186     t.column "login", :string, :limit => 20 
    187     t.column "password", :string, :limit => 40 
    188     t.column "lang", :string, :limit => 10, :default => "", :null => false 
     186    t.column "login",      :string,  :limit => 20 
     187    t.column "password",   :string,  :limit => 40 
     188    t.column "lang",       :string,  :limit => 10, :default => "", :null => false 
    189189    t.column "contact_id", :integer 
    190     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 
     190    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 
    195195  end 
    196196 
    197197  create_table "versions", :force => true do |t| 
    198     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 
     198    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 
    204204    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)" 
    214217 
    215218  create_table "zips", :id => false, :force => true do |t| 
    216219    t.column "site_id", :integer 
    217     t.column "zip", :integer 
     220    t.column "zip",     :integer 
    218221  end 
    219222 
  • branches/rest/lib/tasks/bricks.rake

    r355 r397  
     1require "#{File.dirname(__FILE__)}/../../config/environment" # needed to load ActiveRecord::Migrator 
     2 
    13namespace :bricks do 
    24  desc "Run the bricks server" 
  • branches/rest/test/functional/application_controller_test.rb