This commit is contained in:
z9hang 2014-08-08 15:09:48 +08:00
commit 87f6f81279
18 changed files with 1923 additions and 1842 deletions

View File

@ -103,6 +103,13 @@ class AccountController < ApplicationController
def register
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
@cache_identityy = params[:identity]||"" #身份
@cache_no = params[:no]||"" #学号
@cache_technical_title = params[:technical_title]||"" #教师职称
@cache_province = params[:province]||"" #省份
@cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@ -112,8 +119,8 @@ class AccountController < ApplicationController
@user = User.new
@user.safe_attributes = user_params
if params[:identity] == "2" # 2 企业
@user.firstname = params[:enterprise_name]
@user.lastname = l(:field_enterprise)
#@user.firstname = params[:enterprise_name]
#@user.lastname = l(:field_enterprise)
end
@user.admin = false
@user.register
@ -133,6 +140,15 @@ class AccountController < ApplicationController
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
end
if(@cache_identityy == "")
flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty')
return
end
if(@cache_city == "")
flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty')
return
end
case Setting.self_registration
when '1'
register_by_email_activation(@user)

View File

@ -84,7 +84,7 @@ class MemosController < ApplicationController
@reply_pages = Paginator.new @reply_count, pre_count, page
@replies = @memo.children.
includes(:author, :attachments).
reorder("#{Memo.table_name}.created_at ASC").
reorder("#{Memo.table_name}.created_at DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all

View File

@ -21,8 +21,8 @@ class Repository < ActiveRecord::Base
include Redmine::Ciphering
include Redmine::SafeAttributes
# Maximum length for repository identifiers
IDENTIFIER_MAX_LENGTH = 255
# Maximum length for repository ideflashntifiers
IDENTIFIER_MAX_LENGTH = 254
belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
@ -42,7 +42,7 @@ class Repository < ActiveRecord::Base
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-zA-Z0-9_\-]+$/, :allow_blank => true
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create

View File

@ -174,6 +174,7 @@ class User < Principal
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
validates_length_of :firstname, :maximum => 30
validates_length_of :lastname, :maximum => 30
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true
validates_confirmation_of :password, :allow_nil => true

View File

@ -193,7 +193,40 @@
</script>
<script type="text/javascript" language="javascript">
window.onload = function(){
var identity = "<%= @cache_identityy %>";
var no = "<%= @cache_no %>";
var technical_title = "<%= @cache_technical_title %>";
var province = "<%= @cache_province %>";
var city = "<%= @cache_city %>";
var enterprise_name = "<%= @cache_enterprise_name %>";
//还原身份
if(identity!=null&&identity!=""){
$('#userIdentity').children("option[value='"+identity+"']").attr("selected","selected");
showtechnical_title(identity, document.getElementById('userTechnical_title'));
if(identity=="0"){
//还原教师职称
$('#userTechnical_title').children("option[value='"+technical_title+"']").attr("selected","selected");
}else if(identity=="1"){
//还原学号
$("input[id='no']").attr("value",no);
}
}
//还原地区
if(province!=null&&province!=""){
$("#userProvince").children("option[value='"+province+"']").attr("selected","selected");
showcity(province, document.getElementById('userCity'));
$("select[id='userCity']").children("option[value='"+city+"']").attr("selected","selected");
}
//还原企业名
if(enterprise_name!=null&&enterprise_name!=""){
$("input[id='enterprise_name']").attr("value",enterprise_name);
}
}
function showtechnical_title(identity, technical_titleField) {
var technical_titleOptions = null;
switch (identity) {
case '0' :
@ -202,7 +235,7 @@
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var technical_titleOptions = new Array(
technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
@ -234,15 +267,20 @@
break;
}
technical_titleField.options.length = 0;
if(technical_titleOptions == null){
return;
}
for (var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i] = new Option(technical_titleOptions[i], technical_titleOptions[i]);
/*
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
*/
}
}
</script>

View File

@ -12,8 +12,16 @@
<% end %>
<% end %>
</span>
<script type='text/javascript'>
function CompatibleSend()
{
var obj=document.getElementById("_file");
var file= $(obj).clone();
file.click();
}
</script>
<span class="add_attachment">
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()" %>
<%= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',

View File

@ -1,4 +1,4 @@
<% if @events_by_day.size >0 %>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<div class="content-title-top-avtive">
<!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<p class="subtitle">

View File

@ -50,15 +50,18 @@
var _v= obj;
if(_v==100)
{
//alert(3);
//var select=$("select[id='issue_status_id']");
$("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected");
}
else if(_v==0)
{
//alert(1);
//alert(1);
$("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected");
}
else if(_v!=100&&_v!=0)
{
// alert(2);
$("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
}
}
</script>

View File

@ -44,8 +44,8 @@
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=true%>
<li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
<ul class="course_sub_menu">
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li><%= link_to course.name.truncate(10, omission: '...'), {:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %></li>
@ -56,7 +56,7 @@
<% end -%>
<% end %>
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
@ -68,7 +68,7 @@
<% end %>
</ul>
</li>
<li><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>

View File

@ -9,8 +9,8 @@
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young-->
<p style="display: none"><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +format_time(Time.now).to_s}" %>
<p style="display: none" ><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% unless @project.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
<% end %></p>

View File

@ -1,7 +1,7 @@
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
<% if @project.repositories.any? %>
<table class="list">
<table class="list" style="table-layout: fixed;">
<thead>
<tr>
<th><%= l(:field_identifier) %></th>
@ -14,16 +14,16 @@
<tbody>
<% @project.repositories.sort.each do |repository| %>
<tr class="<%= cycle 'odd', 'even' %>">
<td>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= repository.identifier %>">
<%= link_to repository.identifier,
{:controller => 'repositories', :action => 'show',:id => @project, :repository_id => repository.identifier_param} if repository.identifier.present? %>
</td>
<td align="center"><%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<td align="center"><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>
<td>http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %><%=h repository.url.slice(project_path_cut, repository.url.length) %></td><!--Modified by tanxianbo-->
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %><%=h repository.url.slice(project_path_cut, repository.url.length) %>">http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %><%=h repository.url.slice(project_path_cut, repository.url.length) %></td><!--Modified by tanxianbo-->
<%else %>
<td><%=h repository.url %></td>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h repository.url %></td>
<% end %>
<td class="buttons" style="text-align:left">

View File

@ -12,7 +12,7 @@
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p style="display: none"><%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?,
value:"#{User.current.id.to_s + '_' +format_time(Time.now).to_s}"%>
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}"%>
<% unless @repository.identifier_frozen? %>
<em class="info" ><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>

View File

@ -5,7 +5,12 @@ background-color:gray;
border:none
}
</style>
<script type="text/javascript">
window.onload = function() {
document.getElementById("googleinputcache").remove();
document.getElementById("repository_identifier").setAttribute("type","text");
}
</script>
<%= error_messages_for 'repository' %>
<div class="box tabular">
@ -22,7 +27,10 @@ border:none
<% end %>
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p><%= f.text_field :identifier, :required=>true, :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name)%>
<p>
<input id="googleinputcache" size="30" type="text">
<%= f.text_field :identifier,:required=>true,:type=>"hidden", :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name)%>
<% unless @repository.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_repository_identifier_info).html_safe %></em>

View File

@ -1,5 +1,10 @@
<%= wiki_page_breadcrumb(@page) %>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
var label=$("#wiki_page_redirect_existing_links").prev().prev();
label.css("margin-left","-165px");
});
</script>
<h3><%= h @original_title %></h3>
<%= error_messages_for 'page' %>
@ -9,7 +14,7 @@
:html => { :method => :post } do |f| %>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 100 %></p>
<p><%= f.check_box :redirect_existing_links %></p>
<p><%= f.check_box :redirect_existing_links %></p>
<p><%= f.select :parent_id,
content_tag('option', '', :value => '') +
wiki_page_options_for_select(

View File

@ -1158,6 +1158,7 @@ en:
#huang
label_file_new: Download
label_user_edit: "Edit information"
label_my_course: "My Course"
label_user_info: "User information" #huang 添加
label_user_watcher: "Following" # huang添加的 # modified by bai
label_user_fans: "Followed by" # modified by bai

View File

@ -315,7 +315,7 @@ zh:
field_auth_source: 认证模式
field_hide_mail: 隐藏我的邮件地址
field_comments: 注释
field_url: URL
field_url: 路径
field_start_page: 起始页
field_subproject: 子项目
field_hours: 小时
@ -630,7 +630,7 @@ zh:
#by huang # modified by bai
label_college: 高校进入
label_enter_college: 进入高校
label_enterprise: 企业进入
#label_enterprise: 企业进入
lable_enter_enterprise: 进入企业
label_term: 开课学期
label_spring: 春季学期
@ -979,7 +979,7 @@ zh:
label_change_properties: 修改属性
label_general: 一般
label_more: 更多>>
label_scm: SCM
label_scm: 管理系统
label_plugins: 插件
label_ldap_authentication: LDAP 认证
label_downloads_abbr: D/L
@ -1552,6 +1552,7 @@ zh:
label_have_respond: 进行了反馈
label_welcome: 欢迎
label_join: 加入Trustie
label_repository_path: 库路径
label_board_description: 七嘴八舌,汇聚众人智慧,为您排忧解难!
label_create_course_description: 课程小社区,创建新课程,让我们共同分享多到想不到的公共资源!
label_welcome_page_to: 参与了 %{project_count} 个项目!