[Logilogi-svn] SF.net SVN: logilogi:[1662] trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2010-01-09 10:18:25
|
Revision: 1662
http://logilogi.svn.sourceforge.net/logilogi/?rev=1662&view=rev
Author: wybow
Date: 2010-01-09 10:18:19 +0000 (Sat, 09 Jan 2010)
Log Message:
-----------
Now ready for DBR
Modified Paths:
--------------
trunk/app/controllers/application_controller.rb
trunk/app/models/global_config.rb
trunk/app/views/layouts/_dbr_footer.html.erb
trunk/app/views/layouts/_dbr_header.html.erb
trunk/app/views/layouts/_header.html.erb
trunk/app/views/layouts/_lirmm_header.html.erb
trunk/db/migrate/20100108110804_global_config_header_footer.rb
trunk/db/schema.rb
trunk/test/unit/global_config_test.rb
Added Paths:
-----------
trunk/app/views/layouts/_de_footer.html.erb
trunk/app/views/layouts/_de_header.html.erb
trunk/db/migrate/20100108214701_global_config_available_subdomains.rb
Modified: trunk/app/controllers/application_controller.rb
===================================================================
--- trunk/app/controllers/application_controller.rb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/controllers/application_controller.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -248,8 +248,12 @@
end
def permatize(url)
- return url.sub("://" + GlobalConfig.language_code, "://" +
- GlobalConfig.language_code + ".manta")
+ if GlobalConfig.use_language_subdomains?
+ return url.sub("://" + GlobalConfig.site_subdomain, "://" +
+ GlobalConfig.site_subdomain + ".manta")
+ else
+ return url.sub("://", "://" + ".manta")
+ end
end
def tag_ll_url(tag)
@@ -582,16 +586,18 @@
def redirect_if_wrong_subdomain
if GlobalConfig.use_language_subdomains?
- sub_domain = request.subdomains.first.to_s
- if sub_domain == 'www' or sub_domain.empty?
+ subdomain = request.subdomains.first.to_s
+ if subdomain == 'www' or subdomain.empty?
# detect browser language
language = ::BrowserLanguageCode.detect(request.env['HTTP_ACCEPT_LANGUAGE'])
- if !GlobalConfig.available_language_codes.include?(language)
+ if GlobalConfig.available_subdomains.include?(language)
+ subdomain = language
+ else
# set current site if it does not exist
- language = GlobalConfig.language_code
+ subdomain = GlobalConfig.site_subdomain
end
# redirecting
- domain = language + '.' + GlobalConfig.domain.downcase
+ domain = subdomain + '.' + GlobalConfig.domain.downcase
host = (request.port == request.standard_port ? "#{domain}" : "#{domain}:#{request.port}")
redirect_to url_for(params.merge(:host => host))
return false
Modified: trunk/app/models/global_config.rb
===================================================================
--- trunk/app/models/global_config.rb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/models/global_config.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -61,7 +61,7 @@
FUN
end
- attr_accessor :available_language_codes
+ attr_accessor :available_subdomains
###### Filters
@@ -310,6 +310,14 @@
return self.progress == Const::GlobalConfig::DONE
end
+ def site_subdomain
+ if InitialGlobalConfig::DIFFERENT_SITE_SUBDOMAIN
+ return InitialGlobalConfig::DIFFERENT_SITE_SUBDOMAIN
+ else
+ return self.language_code
+ end
+ end
+
### Composites
def site_url(options = {})
@@ -317,12 +325,10 @@
end
def site_host(options = {})
- if self.use_language_subdomains?
- if options[:language]
- return options[:language] + '.' + self.domain
- else
- return self.language_code + '.' + self.domain
- end
+ if options[:subdomain]
+ return options[:subdomain] + '.' + self.domain
+ elsif self.use_language_subdomains?
+ return self.site_subdomain + '.' + self.domain
else
return self.domain
end
@@ -332,20 +338,20 @@
protected
- # Loads the available_language_codes
+ # Loads the available_subdomains
#
def after_initialize
if !self.new_record?
- @available_language_codes = Array.from_s(self.available_language_codes_string)
+ @available_subdomains = Array.from_s(self.available_subdomains_string)
end
return true
end
- # Sets the available_language_codes_string and the
+ # Sets the available_subdomains_string and the
# default_language_prefs_string
#
def prepare_for_saving
- self.available_language_codes_string = @available_language_codes.to_s
+ self.available_subdomains_string = @available_subdomains.to_s
return true
end
end
Modified: trunk/app/views/layouts/_dbr_footer.html.erb
===================================================================
--- trunk/app/views/layouts/_dbr_footer.html.erb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/views/layouts/_dbr_footer.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -1,9 +1,6 @@
-<div class="spacer"></div>
-<div id="footer">
- <div id="footer_bar">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
- <td width="25"><img src="grafiken/dbr_klein_25x37.gif" alt="" width="25" height="37" border="0"></td>
+ <td width="25"><img src="/images/dbr/dbr_klein_25x37.gif" alt="" width="25" height="37" border="0"></td>
<td width="735">
<table width="735" border="0" cellspacing="0" cellpadding="0" height="37">
<tr height="13">
@@ -18,27 +15,12 @@
<td bgcolor="#cccccc" width="250" height="1"></td>
</tr>
<tr height="23">
- <td valign="bottom" width="339" height="23"><a href="http://www.derblauereiter.de/impress.html"><img id="impressum1_76x16" src="grafiken/gifs1/impressum1_76x16.gif" alt="" name="impressum1_76x16" width="76" height="16" border="0"></a><img src="grafiken/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/agb.html"><img id="agb1_26x16" src="grafiken/gifs1/agb1_26x16.gif" alt="bla" border="0" ></a><img src="grafiken/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/media.html"><img id="mediadaten1_85x16" src="grafiken/gifs1/mediadaten1_85x16.gif" alt="" name="mediadaten1_85x16" width="85" height="16" border="0"></a><img src="grafiken/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/kontakt.html"><img id="kontakt1_61x16" src="grafiken/gifs1/kontakt1_61x16.gif" alt="" name="kontakt1_61x16" width="61" height="16" border="0"></a></td>
+ <td valign="bottom" width="339" height="23"><a href="http://www.derblauereiter.de/impress.html"><img id="impressum1_76x16" src="/images/dbr/gifs1/impressum1_76x16.gif" alt="" name="impressum1_76x16" width="76" height="16" border="0"></a><img src="/images/dbr/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/agb.html"><img id="agb1_26x16" src="/images/dbr/gifs1/agb1_26x16.gif" alt="bla" border="0" ></a><img src="/images/dbr/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/media.html"><img id="mediadaten1_85x16" src="/images/dbr/gifs1/mediadaten1_85x16.gif" alt="" name="mediadaten1_85x16" width="85" height="16" border="0"></a><img src="/images/dbr/abstand_16x16.gif" alt="" width="16" height="16" border="0"><a href="http://www.derblauereiter.de/kontakt.html"><img id="kontakt1_61x16" src="/images/dbr/gifs1/kontakt1_61x16.gif" alt="" name="kontakt1_61x16" width="61" height="16" border="0"></a></td>
<td valign="bottom" width="146" height="23"></td>
- <td valign="bottom" width="250" height="23"><a href="http://www.derblauereiter.de/omegaverlag/index.html"><img src="grafiken/gifs1/copyright_250x16.gif" alt="" width="250" height="16" border="0"></a></td>
+ <td valign="bottom" width="250" height="23"><a href="http://www.derblauereiter.de/omegaverlag/index.html"><img src="/images/dbr/gifs1/copyright_250x16.gif" alt="" width="250" height="16" border="0"></a></td>
</tr>
</table>
</td>
</tr>
</table>
-
- </div>
- <div class="about_bar">
- <div class="panel_content_padding">
- <%= _('Best viewed with') %> <a href="http://www.mozilla.com/firefox/"><%= _('Firefox') %></a> | <a href="http://foundation.logilogi.org/2008/5/6/logilogi-manta-in-public-beta"><%= _('About LogiLogi') %></a> | <a href="mailto:fou...@lo..."><%= _('Contact us') %></a>
- </div>
- </div>
- <div class="copyright">
- <div class="panel_content_padding">
- © 2007-2009 <a href="http://foundation.logilogi.org"><%= _('The LogiLogi Foundation') %></a>.
- <a href="http://en.logilogi.org/Development/Logi_Logi=Wybo_Wiersma_32">LogiLogi is Free Software</a> and licensed under the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">Affero GPL v3</a> <%= _('which means that the source code is') + ' ' + link_to('available for download', source_cache_url) %>.<br />
- <%= _('All content is available under the') %> <a href="http://creativecommons.org/licenses/by-sa/3.0/"><%= _('Creative Commons Attribution-Share Alike License') %></a>
- </div>
- </div>
-</div><!-- /footer -->
Modified: trunk/app/views/layouts/_dbr_header.html.erb
===================================================================
--- trunk/app/views/layouts/_dbr_header.html.erb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/views/layouts/_dbr_header.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -1,4 +1,3 @@
-<div id="header_bar">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr height="130">
<td height="130">
@@ -44,27 +43,3 @@
<td bgcolor="#cccccc" height="1"></td>
</tr>
</table>
-</div>
-<div id="header">
- <div id="sessions">
- <% if current_user.anonymous? %>
- <%= link_to "Login to your account", new_user_session_url %> |
- <%= link_to "Signup for a new account", new_user_url %>
- <% else %>
- Welcome <%= truncate(current_user.name, :length => 15) %> |
- <%= link_to "User page", user_ll_url(current_user) %> |
- <%= link_to "Preferences", edit_user_url(current_user) %> |
- <%= link_to "Logout", user_session_path, :method => :delete %>
- <% end %>
- </div>
- <div id="primarytabs">
- <ul>
- <li id="primarytabs_main"><%= link_to _('main'), root_url %></li>
- <li id="primarytabs_logis"><%= link_to _('topics & logis'), browse_logis_url(:ll_link_string => nil) %></li>
- <li id="primarytabs_changes"><%= link_to _('changes'), changes_url %></li>
- <li id="primarytabs_groups"><%= link_to _('groups'), peer_groups_url %></li>
- <li id="primarytabs_users"><%= link_to _('users'), users_url %></li>
- </ul>
- </div>
- <div class="spacer"></div>
-</div>
Added: trunk/app/views/layouts/_de_footer.html.erb
===================================================================
--- trunk/app/views/layouts/_de_footer.html.erb (rev 0)
+++ trunk/app/views/layouts/_de_footer.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -0,0 +1,20 @@
+<div class="spacer"></div>
+<div id="footer">
+ <% if GlobalConfig.site_subdomain == "dbr" %>
+ <div id="footer_bar">
+ <%= render :partial => 'layouts/dbr_footer' %>
+ </div>
+ <% end %>
+ <div class="about_bar">
+ <div class="panel_content_padding">
+ <%= _('Best viewed with') %> <a href="http://www.mozilla.com/firefox/"><%= _('Firefox') %></a> | <a href="http://foundation.logilogi.org/2008/5/6/logilogi-manta-in-public-beta"><%= _('About LogiLogi') %></a> | <a href="mailto:fou...@lo..."><%= _('Contact us') %></a>
+ </div>
+ </div>
+ <div class="copyright">
+ <div class="panel_content_padding">
+ © 2007-2009 <a href="http://foundation.logilogi.org"><%= _('The LogiLogi Foundation') %></a>.
+ <a href="http://en.logilogi.org/Development/Logi_Logi=Wybo_Wiersma_32">LogiLogi is Free Software</a> and licensed under the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">Affero GPL v3</a> <%= _('which means that the source code is') + ' ' + link_to('available for download', source_cache_url) %>.<br />
+ <%= _('All content is available under the') %> <a href="http://creativecommons.org/licenses/by-sa/3.0/"><%= _('Creative Commons Attribution-Share Alike License') %></a>
+ </div>
+ </div>
+</div><!-- /footer -->
Added: trunk/app/views/layouts/_de_header.html.erb
===================================================================
--- trunk/app/views/layouts/_de_header.html.erb (rev 0)
+++ trunk/app/views/layouts/_de_header.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -0,0 +1,45 @@
+<% if GlobalConfig.site_subdomain != "dbr" %>
+ <div id="network_bar">
+ <div class="panel_content_padding">
+ <%= _('Part of the LogiLogi Network') %>:
+ <a href="http://foundation.logilogi.org">The LogiLogi Foundation</a>
+ - <b>LogiLogi.org</b>
+ <% GlobalConfig.available_subdomains.each do |subdomain| %>
+ <% if subdomain == GlobalConfig.site_subdomain %>
+ <b>[<%= subdomain.camelcase %>]</b>
+ <% else %>
+ <%= site_link(:text => '[' + subdomain.camelcase + ']', :subdomain => subdomain) %>
+ <% end %>
+ <% end %>
+ <a href="http://www.logilogi.org/pub/doc/app/">(docs, </a>
+ <a href="http://sourceforge.net/projects/logilogi">development, </a>
+ <a href="https://lists.sourceforge.net/lists/listinfo/logilogi-list">mailing-list)</a>
+ </div>
+ </div>
+<% end %>
+<div id="header_bar">
+ <%= render :partial => 'layouts/dbr_header' %>
+</div>
+<div id="header">
+ <div id="sessions">
+ <% if current_user.anonymous? %>
+ <%= link_to "Login to your account", new_user_session_url %> |
+ <%= link_to "Signup for a new account", new_user_url %>
+ <% else %>
+ Welcome <%= truncate(current_user.name, :length => 15) %> |
+ <%= link_to "User page", user_ll_url(current_user) %> |
+ <%= link_to "Preferences", edit_user_url(current_user) %> |
+ <%= link_to "Logout", user_session_path, :method => :delete %>
+ <% end %>
+ </div>
+ <div id="primarytabs">
+ <ul>
+ <li id="primarytabs_main"><%= link_to _('main'), root_url %></li>
+ <li id="primarytabs_logis"><%= link_to _('topics & logis'), browse_logis_url(:ll_link_string => nil) %></li>
+ <li id="primarytabs_changes"><%= link_to _('changes'), changes_url %></li>
+ <li id="primarytabs_groups"><%= link_to _('groups'), peer_groups_url %></li>
+ <li id="primarytabs_users"><%= link_to _('users'), users_url %></li>
+ </ul>
+ </div>
+ <div class="spacer"></div>
+</div>
Modified: trunk/app/views/layouts/_header.html.erb
===================================================================
--- trunk/app/views/layouts/_header.html.erb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/views/layouts/_header.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -3,11 +3,11 @@
<%= _('Part of the LogiLogi Network') %>:
<a href="http://foundation.logilogi.org">The LogiLogi Foundation</a>
- <b>LogiLogi.org</b>
- <% GlobalConfig.available_language_codes.each do |l_code| %>
- <% if l_code == GlobalConfig.language_code %>
- <b>[<%= l_code.camelcase %>]</b>
+ <% GlobalConfig.available_subdomains.each do |subdomain| %>
+ <% if subdomain == GlobalConfig.site_subdomain %>
+ <b>[<%= subdomain.camelcase %>]</b>
<% else %>
- <%= site_link(:text => '[' + l_code.camelcase + ']', :language => l_code) %>
+ <%= site_link(:text => '[' + subdomain.camelcase + ']', :subdomain => subdomain) %>
<% end %>
<% end %>
<a href="http://www.logilogi.org/pub/doc/app/">(docs, </a>
Modified: trunk/app/views/layouts/_lirmm_header.html.erb
===================================================================
--- trunk/app/views/layouts/_lirmm_header.html.erb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/app/views/layouts/_lirmm_header.html.erb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -3,8 +3,8 @@
<%= _('Powered by LogiLogi') %>:
<a href="http://foundation.logilogi.org">The LogiLogi Foundation</a>
- <b>LogiLogi.org</b>
- <% GlobalConfig.available_language_codes.each do |l_code| %>
- <%= site_link(:text => '[' + l_code.camelcase + ']', :language => l_code) %>
+ <% GlobalConfig.available_subdomains.each do |l_code| %>
+ <%= site_link(:text => '[' + l_code.camelcase + ']', :subdomain => l_code) %>
<% end %>
<a href="http://www.logilogi.org/pub/doc/app/">(docs, </a>
<a href="http://sourceforge.net/projects/logilogi">development, </a>
Modified: trunk/db/migrate/20100108110804_global_config_header_footer.rb
===================================================================
--- trunk/db/migrate/20100108110804_global_config_header_footer.rb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/db/migrate/20100108110804_global_config_header_footer.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -16,6 +16,7 @@
def self.update
g_c = GlobalConfig.find(:first)
# change as needed
+ g_c.header_partial = 'layouts/header'
g_c.footer_partial = 'layouts/footer'
g_c.save
end
Added: trunk/db/migrate/20100108214701_global_config_available_subdomains.rb
===================================================================
--- trunk/db/migrate/20100108214701_global_config_available_subdomains.rb (rev 0)
+++ trunk/db/migrate/20100108214701_global_config_available_subdomains.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -0,0 +1,11 @@
+class GlobalConfigAvailableSubdomains < ActiveRecord::Migration
+ def self.up
+ rename_column :global_configs, :available_language_codes_string,
+ :available_subdomains_string
+ end
+
+ def self.down
+ rename_column :global_configs, :available_subdomains_string,
+ :available_language_codes_string
+ end
+end
Modified: trunk/db/schema.rb
===================================================================
--- trunk/db/schema.rb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/db/schema.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100108110804) do
+ActiveRecord::Schema.define(:version => 20100108214701) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -63,45 +63,45 @@
end
create_table "global_configs", :force => true do |t|
- t.integer "progress", :default => 0, :null => false
- t.string "domain", :null => false
- t.integer "domain_levels", :null => false
- t.boolean "use_language_subdomains", :null => false
- t.integer "my_openid_affiliate_id", :null => false
- t.string "title_line", :null => false
- t.string "header_keywords", :null => false
- t.string "header_description", :null => false
- t.string "available_language_codes_string", :null => false
- t.integer "minimum_diff_size", :null => false
- t.integer "maximum_logi_size", :null => false
- t.integer "maximum_logi_version_size", :null => false
- t.integer "half_life", :null => false
+ t.integer "progress", :default => 0, :null => false
+ t.string "domain", :null => false
+ t.integer "domain_levels", :null => false
+ t.boolean "use_language_subdomains", :null => false
+ t.integer "my_openid_affiliate_id", :null => false
+ t.string "title_line", :null => false
+ t.string "header_keywords", :null => false
+ t.string "header_description", :null => false
+ t.string "available_subdomains_string", :null => false
+ t.integer "minimum_diff_size", :null => false
+ t.integer "maximum_logi_size", :null => false
+ t.integer "maximum_logi_version_size", :null => false
+ t.integer "half_life", :null => false
t.float "daily_fraction"
t.float "float"
- t.integer "powerless_age", :null => false
- t.float "anonymous_power", :null => false
- t.float "member_power", :null => false
- t.float "admin_power", :null => false
+ t.integer "powerless_age", :null => false
+ t.float "anonymous_power", :null => false
+ t.float "member_power", :null => false
+ t.float "admin_power", :null => false
t.integer "anonymous_user_id"
t.integer "admin_user_id"
t.integer "system_user_group_id"
t.integer "public_user_group_id"
t.integer "public_peer_group_id"
- t.string "main_page_tag_string", :null => false
- t.string "user_tag_string", :null => false
- t.string "user_group_tag_string", :null => false
- t.string "peer_group_tag_string", :null => false
- t.string "replace_tag_string", :null => false
- t.string "sandbox_tag_string", :null => false
- t.string "untagged_tag_string", :null => false
- t.boolean "use_log_log", :default => false, :null => false
+ t.string "main_page_tag_string", :null => false
+ t.string "user_tag_string", :null => false
+ t.string "user_group_tag_string", :null => false
+ t.string "peer_group_tag_string", :null => false
+ t.string "replace_tag_string", :null => false
+ t.string "sandbox_tag_string", :null => false
+ t.string "untagged_tag_string", :null => false
+ t.boolean "use_log_log", :default => false, :null => false
t.string "log_log_site"
t.string "log_log_api_key"
- t.string "language_code", :limit => 5, :null => false
- t.string "protocol", :limit => 8, :null => false
- t.string "header_partial", :null => false
+ t.string "language_code", :limit => 5, :null => false
+ t.string "protocol", :limit => 8, :null => false
+ t.string "header_partial", :null => false
t.string "custom_css"
- t.string "footer_partial", :null => false
+ t.string "footer_partial", :null => false
end
create_table "invitations", :force => true do |t|
Modified: trunk/test/unit/global_config_test.rb
===================================================================
--- trunk/test/unit/global_config_test.rb 2010-01-08 20:38:26 UTC (rev 1661)
+++ trunk/test/unit/global_config_test.rb 2010-01-09 10:18:19 UTC (rev 1662)
@@ -25,7 +25,7 @@
assert GlobalConfig.title_line
assert GlobalConfig.header_keywords
assert GlobalConfig.header_description
- assert GlobalConfig.available_language_codes_string
+ assert GlobalConfig.available_subdomains_string
assert GlobalConfig.minimum_diff_size
assert GlobalConfig.maximum_logi_size
assert GlobalConfig.maximum_logi_version_size
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|