Commit 5e36d55b authored by s50407s's avatar s50407s

parent 4f520896
......@@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
"<a href=\"/\">#{name}</a>".html_safe
end
#cache
@site[:themes] = {}
@site[:themes] = {'default' => {}}
Dir.foreach(Themes_Dir) do |file|
theme_config_file = File.join Themes_Dir, file, "theme.yml"
if File.file? theme_config_file
......
......@@ -64,10 +64,12 @@ class UsersController < ApplicationController
# PUT /users/1.xml
def update
@user = User.find(params[:id])
if !params[:user][:theme].blank? && @site[:themes].has_key?(params[:theme])
cookies[:user][:theme] = params[:theme]
end
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
format.html { redirect_to(:back, :notice => 'User was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
......@@ -117,6 +119,7 @@ class UsersController < ApplicationController
end
end
def theme
p params[:theme], @site[:themes].has_key?(params[:theme])
if params[:theme].blank?
cookies[:theme] = nil
@correct_user.update_attribute(:theme, nil)
......
......@@ -10,6 +10,16 @@ class User < ActiveRecord::Base
has_many :topics
has_many :posts, :through => :topics
before_save proc{!locked}
class <<self #TODO
alias old_find find
def find(*args)
if args[0] == 0
Guest
else
old_find(*args)
end
end
end
def to_s
"<a href=\"/users/#{id}\">#{name}</a>".html_safe
end
......@@ -46,5 +56,27 @@ class User < ActiveRecord::Base
t.integer :credit7, :default => 0, :null => false
t.integer :credit8, :default => 0, :null => false
=end
Guest = User.find 0
Guest = User.new do |user|
user.id = 0
user.name = 'guest'
user.nickname = ''
user.password = ''
user.email = ''
#usergroup = 0
#admingroup = 0
user.regip = '127.0.0.1'
user.lastloginip = '127.0.0.1'
user.readnum = 0
user.viewnum = 0
user.onlinetime = 0
user.credit = 0
user.credit1 = 0
user.credit2 = 0
user.credit3 = 0
user.credit4 = 0
user.credit5 = 0
user.credit6 = 0
user.credit7 = 0
user.credit8 = 0
end
end
......@@ -51,8 +51,6 @@
<span class="headactions"><a href="index.php?showoldetails=yes#online" class="nobdr"><img src="images/default/collapsed_yes.gif" alt="" /></a></span>
<h3>
<strong><%=t 'stat.onlineuser' %></strong>
- <%=t 'stat.total' %> <em>0</em>
- <%=t 'stat.max' %> <em>0</em> <%=t 'stat.at' %> <em><%=l Time.now, :format => :long %> </em>.
<%= render 'layouts/onlineuserbar' %>
</h3>
</div>
\ No newline at end of file
<div id="onlineuser">
<strong><%=t 'stat.onlineuser' %></strong>
- <%=t 'stat.total' %> <em>0</em>
- <%=t 'stat.max' %> <em>0</em> <%=t 'stat.at' %> <em><%=l Time.now, :format => :long %> </em>.
</div>
\ No newline at end of file
<label>
<input name="textfield" type="text" value="請輸入搜索內容 " />
<input name="textfield" type="text" value="请输入搜索内容" />
</label>
<input type="submit" name="Submit" value="搜索" />
<input type="submit" name="Submit2" value="高級搜索" />
\ No newline at end of file
<input type="submit" name="Submit" value="搜索" />
<input type="submit" name="Submit2" value="高级搜索" />
\ No newline at end of file
<!--<script type="text/javascript">
function setstyle(styleid) {
str = unescape('styleid%3D57');
str = str.replace(/(^|&)styleid=\d+/ig, '');
str = (str != '' ? str + '&' : '') + 'styleid=' + styleid;
location.href = 'index.php?' + str;
}
</script>
<ul id="style_switch"><li><a href="###" onclick="setstyle(50)" title="緋紅" style="background: ;">緋紅</a></li><li><a href="###" onclick="setstyle(48)" title="金黃" style="background: ;">金黃</a></li><li><a href="###" onclick="setstyle(39)" title="翠绿" style="background: ;">翠绿</a></li><li><a href="###" onclick="setstyle(40)" title="炫紫" style="background: ;">炫紫</a></li><li><a href="###" onclick="setstyle(54)" title="酷黑" style="background: ;">酷黑</a></li><li><a href="###" onclick="setstyle(51)" title="銀白" style="background: ;">銀白</a></li><li><a href="###" onclick="setstyle(52)" title="深藍" style="background: ;">深藍</a></li><li><a href="###" onclick="setstyle(55)" title="亮橙" style="background: ;">亮橙</a></li><li><a href="###" onclick="setstyle(56)" title="清蓝" style="background: ;">清蓝</a></li><li class="current"><a href="###" onclick="setstyle(57)" title="夜露" style="background: ;">夜露</a></li><li><a href="###" onclick="setstyle(61)" title="圣诞" style="background: ;">圣诞</a></li><li><a href="###" onclick="setstyle(74)" title="黑色回忆" style="background: #373A3C;">黑色回忆</a></li></ul>
-->
<% unless @site.themes.empty? %>
<div id ="themebar">
<ul>
<li><%= link_to 'default', theme_path %></li>
<% @site.themes.each_pair do |name, theme| %>
<li><%= link_to name, theme_path, :theme => name %></li>
<li><%= link_to name, theme_path(name), :title => name %></li>
<% end %>
</ul>
</div>
......
......@@ -31,7 +31,9 @@
<div id="menu">
<%= render "layouts/navibar" %>
</div>
<div id="style_switch">
<%= render 'layouts/themebar' %>
</div>
</div>
</div>
......
<div id="userbar">
<% if logged? %>
<cite><a href="space.php?uid=359" class="noborder"><%= @correct_user %> </a></cite>
<span class="pipe">|</span>
<% if logged? %>
<cite><a href="space.php?uid=359" class="noborder"><%= @correct_user %> </a></cite>
<span class="pipe">|</span>
<%= link_to t('user.my'), @correct_user %>
<%= link_to t('user.space'), @correct_user %>
<%= link_to t('user.notice'), @correct_user %>
<span id="myprompt_check"></span>
<%= link_to t('user.pm'), @correct_user %>
<%= link_to t('user.my'), @correct_user %>
<%= link_to t('user.space'), @correct_user %>
<%= link_to t('user.notice'), @correct_user %>
<span id="myprompt_check"></span>
<%= link_to t('user.pm'), @correct_user %>
<span class="pipe">|</span>
<%= link_to t('user.logout'), logout_path %>
<% else %>
<%= link_to t('user.login'), login_path %>
<%= link_to t('user.register'), new_user_path %>
<% end %>
<span class="pipe">|</span>
<%= link_to t('user.logout'), logout_path %>
<% else %>
<%= link_to t('user.login'), login_path %>
<%= link_to t('user.register'), new_user_path %>
<% end %>
</div>
\ No newline at end of file
<div style="height:30px;"></div>
<div id="body" >
<div class=" box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="fuzhu"></div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<table width="100%" height="27px"border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px">幻想乡综合讨论区</td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table>
</div>
<% @boards.each do |board| %>
<div id=b2_2>
<table width="100%" height="93px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="171px">
<div id=b2_2_d1>
<div id=b2_2_d1_avatar><%= board.logo %></div>
</div>
</td>
<td width:"686px">
<div id=b2_2_d2>
<div id=b2_2_d2_inf1><div style="float:left;"><%= board %></div><div style="float:right;"><img src="css/new.png" /></div></div>
<div id=b2_2_d2_inf2><%= board.introduction %></div>
<div id=b2_2_d2_inf3><div style="float:left; margin-top:5px;"> <%=t 'board.topic' %>: <%= board.topics.count %> <%=t 'board.post' %><%= board.posts.count %></div> <div style="margin-left:10px; float:left; margin-top:2px;"><img src="css/post.png" /></div></div>
</div>
</td>
<td width="283px">
<div width="283px"style=" margin-bottom:10px; height:90px;border-left-style:solid; border-color:#CCCCCC; border-width:1px;" >
<div id=b2_2_d3_1></div>
<div id=b2_2_d3_2></div>
</div>
</td>
</tr>
</table>
</div>
<% end %>
</div>
<div class="box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="fuzhu"></div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all" >
<table width="100%" height="27px"border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px">友情链接</td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table></div>
<div id=footer2>
<div id=ft_1>
<table id="ft_1_t" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="590px">
<div id="ft_1_t_d1">
<div id="ft_1_t_d2"> </div>
</div>
</td>
<td width="590px"></td>
</tr>
</table>
</div>
<div id=ft_2>
</div>
<div id=ft_3></div>
</div>
<div></div>
</div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<table width="100%" height="27px"border="0" cellspacing="0" cellpadding="0" >
<tr>
<%= render 'layouts/onlineuserbar' %>
</tr>
</table></div>
</div>
\ No newline at end of file
<div id="f_fz">
</div>
<div id="footer" class="box ui-widget-content ui-corner-all ui-helper-clearfix">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="f_t">
<tr>
<td height="25px" width="590px" style="padding-left:5px">
Powered by 東方幻想鄉0.1
</td>
<td width="590px" height="25px" align="right" style="padding-right:5px">
東方幻想鄉(黑ICP備09028990)| 聯繫我們 | 網站統計| 無圖版| wap
</td>
</tr>
<tr>
<td height="25px" style="padding-left:5px">
2011-2012 rz Inc.
</td>
<td height="25px" align="right" style="padding-right:5px">
GMT+8,2012-2-17 15:14
</td>
</tr>
</table>
</div>
\ No newline at end of file
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<link type="text/css" href="css/ui-lightness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
<link type="text/css" href="css/style.css" rel="stylesheet" />
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.11.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
<style type="text/css">
.toggler { width: 400px; height:113px; position: relative; float:left;}
#button { padding: .5em 1em; text-decoration: none; }
#effect { width: 400px; height: 113px; position: relative;}
#effect h3 { margin: 0; padding: 0.4em; text-align: center; }
.ui-effects-transfer { border: 2px dotted gray; }
*
{
margin:0;
padding:0;
}
body
{
font-size:10pt;
background-color:#999999
}
#header
{
width:1230px;
height:280px;
margin:0 auto;
}
#h2{
margin-left:auto;
margin-right:auto;
width:1200px;
height:14px;
border-width:1px;
border-style:solid;
border-color:#CCCCCC;
}
#h3{
margin-left:auto;
margin-right:auto;
width:1200px;
height:113px;
overflow:hidden;
background-color:#000000;
border-left-style:solid;border-left-width:1px;border-left-color:#CCCCCC;
border-right-style:solid;border-right-width:1px;border-right-color:#CCCCCC;
}
#h4{
margin-top:5px;
margin-left:auto;
margin-right:auto;
width:1200px;
height:31px;
border-width:1px;
border-style:solid;
}
#h5{
margin-top:0px;
margin-left:auto;
margin-right:auto;
width:1200px;
height:55px;
border-width:1px;
border-style:solid;
border-color:#CCCCCC;
}
#h6{
margin-top:5px;
margin-left:auto;
margin-right:auto;
width:1200px;
height:33px;
border-width:1px;
border-style:solid;
border-color:#F6B03C;
}
#zx{
margin-top:30px;
margin-left:100p;
margin-right:100px;
margin-bottom:15px;
width:1040px;
height:10px;
border-width:1px;
border-style:dashed;
position:absolute;
left: 231px;
top: 198px;
}
#body
{
margin-top:5px;
margin-left:auto;
margin-right:auto;
width:1200px;
height:532px;
}
#b2
{
margin-top:10px;
margin-left:auto;
margin-right:auto;
width:1180px;
height220px;
border-width:1px;
border-style:dashed;
}
#b3
{
margin-top:10px;
margin-left:auto;
margin-right:auto;
width:1180px;
height:206px;
border-width:1px;
border-style:solid;
}
#b4
{
margin-top:10px;
margin-left:auto;
margin-right:auto;
width:1180px;
height:34px;
border-width:1px;
border-style:solid;
}
#footer
{
padding-top:15px;
margin-top:10px;
margin-left:auto;
margin-right:auto;
width:1180px;
height:50px;
border-width:1px;
border-style:dashed;
}
#tb1
{
height:31px;
width:100%;
}
#tb2
{
margin-top:0;
margin-bottom:auto;
height:55px;
width:100%;
}
#tb3
{
height:33px;
width:100%;
}
#td1{
padding-left:5px;
}
#dtx
{
margin-top:auto;
margin-left:auto;
margin-right:auto;
margin-bottom:auto;
width:50px;
height:50px;
border-width:1px;
border-style:dashed;
border-color:#CCCCCC;
left: 112px;
top: 180px;
}
#b2_1
{
margin-left:auto;
margin-right:auto;
width:1180px;
height:27px;
border-width:1px;
border-style:solid;
}
#b2_2
{
margin-left:auto;
margin-right:auto;
width:1165px;
height:93px;
border-width:1px;
border-bottom-style:solid;
border-color:#CCCCCC;
}
#b2_3
{
margin-top:3px;
margin-left:auto;
margin-right:auto;
width:1165px;
height:93px;
border-width:1px;
border-bottom-style:solid;
border-color:#CCCCCC;
}
#b2_2_d1
{
width:200px;
height:93px;
border-width:1px;
border-style:hidden;
}
#b2_2_d1_avatar
{
width:171px;
height:68px;
border-width:1px;
border-style:solid;
border-color:#CCCCCC;
margin-top:15px;
margin-left:19px;
margin-bottom:9px;
}
#b2_2_d2
{
padding-bottom:10px;
width:680px;
height:82px;
}
#b2_2_d2_inf1
{
margin-top:0px;
width:100%;
height:22px;
border-color:#CCCCCC;
border-bottom-style:dashed;
border-bottom-width:1px;
}
#b2_2_d2_inf2
{
margin-top:0px;
width:100%;
height:40px;
border-color:#CCCCCC;
border-bottom-style:dashed;
border-bottom-width:1px;
}
#b2_2_d2_inf3
{
margin-top:0px;
width:100%;
height:22px;
}
#b2_2_d3_1
{
width:100%;
height:30px;
}
#b2_2_d3_2
{
width:100%;
height:30px;
}
#footer1
{
width:100%;
height:30px;
border-width:1px;
border-style:dashed;
}
#footer2
{
width:100%;
height:170px;
}
#ft_1
{
width:100%;
height:52px;
}
#ft_2
{
width:100%;
height:80px;
border-width:1px;
border-top-style:solid;
border-color:#CCCCCC;
}
#ft_3
{
width:100%;
height:30px;
border-width:1px;
border-top-style:solid;
border-color:#CCCCCC;
}
#ft_1_t
{
width:100%;
height:52px;
}
#ft_1_t_d1
{
width:500px;
height:38px;
}
#ft_1_t_d2
{
width:125px;
height:30px;
border-width:1px;
border-style:solid;
border-color:#CCCCCC;
}
#f_t
{
height:50px;
border-width:1px;
border-style:dashed;
}
#fuzhu
{
height:10px;
}
#f_fz
{
height:10px;
}
</style>
<script>
$(function() {
// run the currently selected effect
function runEffect() {
// get effect type from
var selectedEffect = $( "#effectTypes" ).val();
// most effect types need no options passed by default
var options = {};
// some effects have required parameters
if ( selectedEffect === "scale" ) {
options = { percent: 0 };
} else if ( selectedEffect === "transfer" ) {
options = { to: "#button", className: "ui-effects-transfer" };
} else if ( selectedEffect === "size" ) {
options = { to: { width: 200, height: 60 } };
}
// run the effect
$( "#effect" ).effect( selectedEffect, options, 500, callback );
};
// callback function to bring a hidden box back
function callback() {
setTimeout(function() {
$( "#effect" ).removeAttr( "style" ).hide().fadeIn();
}, 10000 );
};
// set effect from select menu value
$( "#effect" ).mouseover(function() {
runEffect();
return true;
});
});
</script>
\ No newline at end of file
<div id="header">
<div id="h2" class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<style type="text/css">
#userbar{margin-left: 900px;}
</style>
<%= render 'layouts/userbar' %>
</div>
<div id="h3" style="background-image:url(css/banner.jpg);background-repeat:no-repeat; background-position:right;">
<div id="logo" style=" color:#FFFFFF; width:800px; height:113px; float:left;">
LOGO
</div>
<div class="toggler" >
<div id="effect"><img src="css/banner2.jpg" /></div>
</div>
</div>
<div class=" box ui-widget-content ui-corner-all ui-helper-clearfix" >
<div id="h4" class="ui-dialog-titlebar ui-widget-header ui-corner-all"><table border="0" cellspacing="0" cellpadding="0" id="tb1">
<tr>
<%= render "layouts/navibar" %>
<div style="float: right;"><%= render "layouts/searchbar" %></div>
</tr>
</table></div>
<div id="h5" >
<table border="0" cellspacing="0" cellpadding="0" id="tb2">
<tr>
<td rowspan="2" width="80">
<div id="dtx"><%= @correct_user.avatar :small %></div>
</td>
<td width="700" height="28"style="padding-left:5px">欢迎回来 <%= @correct_user %></td>
<td width="400" align="right" style="padding-right:10px" >欢迎新会员 <%= User.last %></td>
</tr>
<tr>
<td width="700" style="padding-left:5px">公告:</td>
<td width ="400"align="right" style="padding-right:10px">天气</td>
</tr>
</table>
</div>
<div id="h6">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tb3">
<tr>
<td width="600"style="padding-left:15px"><%= render 'layouts/actionbar' %></td>
<td width="600"align="right" style="padding-right:20px">
<select name="effects" id="effectTypes" style="visibility:hidden"><option value="fade">Drop</option></select>
<div style="float: right;"><%= render 'layouts/themebar' %></div>
</td>
</tr>
</table>
</div>
</div>
</div
\ No newline at end of file
......@@ -8,7 +8,7 @@ Reliz::Application.routes.draw do
root :to => 'boards#index'
resources :users
match 'theme' => 'users#theme'
get 'theme/:theme' => 'users#theme', :as => :theme
get 'login' => 'users#login'
post 'login' => 'users#login_do'
get 'logout' => 'users#logout'
......
......@@ -95529,3 +95529,17 @@ Started GET "/images/default/loading.gif" for 127.0.0.1 at 2011-04-01 08:41:18 +
User Load (133.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Redirected to http://www.touhou.cc/bbs/images/default/loading.gif?
Completed 302 Found in 627ms
Started GET "/" for 127.0.0.1 at 2011-04-03 17:48:49 +0800
Processing by BoardsController#index as HTML
Completed in 1ms
Errno::ENOENT (No such file or directory - app/views/themes):
app/controllers/application_controller.rb:55:in `open'
app/controllers/application_controller.rb:55:in `foreach'
app/controllers/application_controller.rb:55:in `load_settings'
Rendered E:/Program Files (x86)/HomePre/Ruby/192p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered E:/Program Files (x86)/HomePre/Ruby/192p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (3.0ms)
Rendered E:/Program Files (x86)/HomePre/Ruby/192p0/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (36.0ms)
4784
\ No newline at end of file
1200
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment