Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-11-25 14:24:51 +08:00
commit 70f7c73699
23 changed files with 2588 additions and 1895 deletions

View File

@ -64,7 +64,7 @@ class AttachmentsController < ApplicationController
# modify by nwb # modify by nwb
# 下载添加权限设置 # 下载添加权限设置
candown = false candown = false
if @attachment.container.class.to_s != "HomeworkAttach" &&(@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
project = @attachment.container.project project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1) candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Project) elsif @attachment.container.is_a?(Project)
@ -89,6 +89,7 @@ class AttachmentsController < ApplicationController
elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses
candown = User.current.member_of_course?(@attachment.container.courses.first) || (course.is_public == 1 && @attachment.is_public == 1) candown = User.current.member_of_course?(@attachment.container.courses.first) || (course.is_public == 1 && @attachment.is_public == 1)
else else
candown = @attachment.is_public == 1 candown = @attachment.is_public == 1
end end
if candown || User.current.admin? || User.current.id == @attachment.author_id if candown || User.current.admin? || User.current.id == @attachment.author_id

View File

@ -376,7 +376,8 @@ class UsersController < ApplicationController
"show_changesets" => true "show_changesets" => true
} }
scope = User.logged.status(@status) scope = User.logged.status(@status)
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present? @search_by = params[:search_by] ? params[:search_by][:id] : 0
scope = scope.like(params[:name],@search_by) if params[:name].present?
@user_count = scope.count @user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page'] @user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'users_base' @user_base_tag = params[:id] ? 'base_users':'users_base'

View File

@ -60,7 +60,7 @@ module HomeworkAttachHelper
memberships = User.current.memberships.all(:conditions => cond) memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project) projects = memberships.map(&:project)
not_have_project = [] not_have_project = []
not_have_project << "NO PROJECT" not_have_project << Setting.please_chose
not_have_project << 0 not_have_project << 0
type = [] type = []
type << not_have_project type << not_have_project

View File

@ -364,10 +364,10 @@ class User < Principal
end end
end end
end end
unless user.nil? if user && !user.new_record?
last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s
user.update_column(:last_login_on, Time.now)
end end
user.update_column(:last_login_on, Time.now) if user && !user.new_record?
[user, last_login_on] [user, last_login_on]
rescue => text rescue => text
raise text raise text

View File

@ -20,7 +20,10 @@
} }
} }
</script> </script>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
</head>
<div id="login-form"> <div id="login-form">
<%= form_tag(signin_path) do %> <%= form_tag(signin_path) do %>
<%= back_url_hidden_field_tag %> <%= back_url_hidden_field_tag %>

View File

@ -58,16 +58,10 @@
<span style="float: right"> <span style="float: right">
<% if User.current.logged? && is_cur_course_student(@course) %> <% if User.current.logged? && is_cur_course_student(@course) %>
<% cur_user_homework = cur_user_homework_for_bid(bid) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %>
<% if cur_user_homework!= nil && cur_user_homework.empty? %> <% if cur_user_homework && cur_user_homework.empty? %>
<% if bid.comment_status == 0 || bid.comment_status == 2%>
<span class="span_wping"> <span class="span_wping">
<%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %>
</span> </span>
<% else %>
<span title="匿评阶段不可提交作业!" class="span_wping">
<a style="width:80px; margin:20px 0 0 350px;background:#8e8e8e;">提交作业</a>
</span>
<% end %>
<% else %> <% else %>
<span style="color: green; float: right"> <span style="color: green; float: right">
<%= l(:lable_has_commit_homework)%> <%= l(:lable_has_commit_homework)%>

View File

@ -18,9 +18,8 @@
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form', :locals => {:f => f} %> <%= render :partial => 'messages/form', :locals => {:f => f} %>
<p> <p>
<!--<input type="button" onclick="submitProjectBoard();" class = "ButtonColor m3p10" value="<%= l(:button_submit)%>">--> <input type="button" onclick="submitProjectBoard();" class = "whiteButton m3p10 h30" value="<%= l(:button_submit)%>">
<a herf="#" onclick="submitProjectBoard();" class="ButtonColor m3p10"><%= l(:button_submit)%></a> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'whiteButton m3p10' %></p>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'ButtonColor m3p10' %></p>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>
<% end %> <% end %>

View File

@ -9,7 +9,9 @@
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%> <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%>
<%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %> <%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %>
<% else %> <% else %>
<span class="font_lighter"><%= l(:label_coursejoin_tip) %></span> <span class="font_lighter">
<%= l(:label_coursejoin_tip) %>
</span>
<% end %> <% end %>
</div> </div>
<div id="bid-show"> <div id="bid-show">

View File

@ -31,11 +31,6 @@
$('#insite').attr("class", "re_schbtn b_dblue"); $('#insite').attr("class", "re_schbtn b_dblue");
} }
} }
function buttoncss()
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script> </script>
@ -44,8 +39,8 @@
<div class="re_top"> <div class="re_top">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onclick => "presscss('incourse')"%>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onclick => "presscss('insite')" %>
<% end %> <% end %>
<% if is_course_teacher(User.current,@course) %> <% if is_course_teacher(User.current,@course) %>
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a> <a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a>

View File

@ -49,8 +49,8 @@
<% else %> <% else %>
<!-- 是学生 --> <!-- 是学生 -->
<% if is_my_homework %> <% if is_my_homework %>
<!-- 我的作品,显示为编辑和删除 --> <!-- 我的作品,在未开启匿评和未使用匿评,显示为编辑和删除 -->
<% if @bid.comment_status == 0 %> <% if @bid.comment_status == 0 || @bid.open_anonymous_evaluation == 0 %>
<li class="wmine" style="padding-top: 4px;"> <li class="wmine" style="padding-top: 4px;">
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %> <%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || User.current.admin? %> <% if homework.user == User.current || User.current.admin? %>
@ -68,10 +68,14 @@
<a style="color:#8e8e8e;"><%= l(:button_edit) %></a> <a style="color:#8e8e8e;"><%= l(:button_edit) %></a>
<% if homework.user == User.current || User.current.admin? %> <% if homework.user == User.current || User.current.admin? %>
<!-- 作业创建者显示删除作业 --> <!-- 作业创建者显示删除作业 -->
<a style="color:#8e8e8e;"><%=l(:label_bid_respond_delete)%></a> <a style="color:#8e8e8e;">
<%=l(:label_bid_respond_delete)%>
</a>
<% else %> <% else %>
<!-- 作业参与者显示退出作业 --> <!-- 作业参与者显示退出作业 -->
<a style="color:#8e8e8e;"><%=l(:label_logout) %></a> <a style="color:#8e8e8e;">
<%=l(:label_logout) %>
</a>
<% end %> <% end %>
</li> </li>
<% end %> <% end %>
@ -88,7 +92,9 @@
<% elsif @bid.comment_status == 2%> <% elsif @bid.comment_status == 2%>
<!-- 处于匿评已关闭阶段,不容许评分 --> <!-- 处于匿评已关闭阶段,不容许评分 -->
<li class="wping" title="关闭匿评后不可继续评分"> <li class="wping" title="关闭匿评后不可继续评分">
<a style="background:#8e8e8e;"><%= l(:label_anonymous_comments) %></a> <a style="background:#8e8e8e;">
<%= l(:label_anonymous_comments) %>
</a>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">&nbsp;&nbsp;迟交!</span> <span class="c_red">&nbsp;&nbsp;迟交!</span>
<% end %> <% end %>

View File

@ -35,16 +35,9 @@
</span> </span>
</li> </li>
<li class="c_red" style="margin:25px 0 0 20px;"> 您还没交作业,请创建作业!</li> <li class="c_red" style="margin:25px 0 0 20px;"> 您还没交作业,请创建作业!</li>
<% if @bid.comment_status == 0 || @bid.open_anonymous_evaluation == 0%>
<!-- 老师布置的作业在创建和开启匿评这段时间才允许创建作品 -->
<li class="wping"> <li class="wping">
<%= link_to "提交作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %> <%= link_to "提交作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %>
</li> </li>
<% else %>
<li class="wping" title="匿评阶段不可提交作业!">
<a style="width:80px; margin:20px 0 0 350px;background:#8e8e8e;">提交作业</a>
</li>
<% end %>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
<% end %> <% end %>

View File

@ -27,7 +27,10 @@
<p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p> <p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
<% if @issue.safe_attribute? 'watcher_user_ids' -%> <% if @issue.safe_attribute? 'watcher_user_ids' -%>
<p id="watchers_form"><label><%= l(:label_issue_watchers) %></label> <p id="watchers_form">
<label>
<%= l(:label_issue_watchers) %>
</label>
<span id="watchers_inputs"> <span id="watchers_inputs">
<%= watchers_checkboxes(@issue, @available_watchers) %> <%= watchers_checkboxes(@issue, @available_watchers) %>
</span> </span>
@ -40,10 +43,10 @@
</p> </p>
<% end %> <% end %>
</div> </div>
<a href="#" class="ButtonColor m3p10" onclick="$('#issue-form').submit();">
<%= submit_tag l(:button_create), :class => "ButtonAddTags"%> <%= l(:button_create)%>
<%= submit_tag l(:button_create_and_continue), :class => 'ButtonAddTags' %> </a>
<%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form','preview',{:class => "ButtonColor"}%> <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form','preview',{:class => "ButtonColor m3p10"}%>
<%= javascript_tag "$('#issue_subject').focus();" %> <%= javascript_tag "$('#issue_subject').focus();" %>
<% end %> <% end %>

View File

@ -30,7 +30,6 @@
$.ajax({ $.ajax({
url: '<%= update_score_user_path(:format => 'js') %>', url: '<%= update_score_user_path(:format => 'js') %>',
type: 'get', type: 'get',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: 'id=<%= @user.id %>', data: 'id=<%= @user.id %>',
remote: true remote: true
}) ; }) ;

View File

@ -15,7 +15,9 @@
} do |f| %> } do |f| %>
<%= render :partial => 'form', <%= render :partial => 'form',
:locals => {:f => f, :replying => !@message.parent.nil?} %> :locals => {:f => f, :replying => !@message.parent.nil?} %>
<%= submit_tag l(:button_save) %> <a href="#" onclick="$('#message-form').submit();" class="ButtonColor m3p10">
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board, :id => @message}, 'message-form') %> <%= l(:button_save) %>
</a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "ButtonColor m3p10" %>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>

View File

@ -55,6 +55,18 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function submit_my_account_form()
{
var lastname = document.getElementById('user_lastname').value;
var firstname = document.getElementById('user_firstname').value;
if(lastname != "" && firstname != "")
{
$("#my_account_form").submit();
}
else {
parent.alert("姓氏和名字不能为空");
}
}
function get_options(value) { function get_options(value) {
var prefix = ""; var prefix = "";
if(location.href.indexOf('ros')>=0) if(location.href.indexOf('ros')>=0)
@ -385,7 +397,7 @@
<%= render :partial => 'users/user_extensions' %></div> <%= render :partial => 'users/user_extensions' %></div>
</fieldset> </fieldset>
<!-- end --> <!-- end -->
<%= submit_tag l(:button_save) %> <input type="button" class="enterprise" value="<%=l(:button_save) %>" onclick="submit_my_account_form();" >
</fieldset> </fieldset>
<% end %> <% end %>
<% html_title(l(:label_my_account)) -%> <% html_title(l(:label_my_account)) -%>

View File

@ -1,9 +1,3 @@
<script type="text/javascript">
function formSubmit()
{
document.getElementById("tag_for_save").submit()
}
</script>
<div id="tags"> <div id="tags">
<%#begin <%#begin
1 代表是user类型 1 代表是user类型
@ -83,7 +77,9 @@
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<!--<%#= f.submit l(:button_project_tags_add),:class => "ButtonColor m3p10" %>--> <!--<%#= f.submit l(:button_project_tags_add),:class => "ButtonColor m3p10" %>-->
<a href="#" onclick='$("form").submit()' class="ButtonColor m3p10" ><%= l(:button_project_tags_add)%></a> <a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" >
<%= l(:button_project_tags_add)%>
</a>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();',:class=>'ButtonColor m3p10'%> <%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();',:class=>'ButtonColor m3p10'%>
<% end %> <% end %>
</div> </div>

View File

@ -20,8 +20,8 @@
</td> </td>
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<label for="user_browse_label"><%= l(:label_user_search_type) %></label> <!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%= select "search_by", "id", <%#= select "search_by", "id",
{ l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" }, { l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
:size => 20 %> :size => 20 %>
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>

View File

@ -256,6 +256,8 @@ course_domain:
default: course.trustie.net default: course.trustie.net
repository_domain: repository_domain:
default: repository.trustie.net default: repository.trustie.net
please_chose:
default: 请选择
plugin_redmine_ckeditor: plugin_redmine_ckeditor:
serialized: true serialized: true
default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess

View File

@ -2,8 +2,6 @@
/* Redmine - project management software /* Redmine - project management software
Copyright (C) 2006-2013 Jean-Philippe Lang */ Copyright (C) 2006-2013 Jean-Philippe Lang */
function cleanArray (actual){ function cleanArray (actual){
var newArray = new Array(); var newArray = new Array();
for (var i = 0; i< actual.length; i++){ for (var i = 0; i< actual.length; i++){
@ -391,7 +389,6 @@ function submitPreview(url, form, target) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'post', type: 'post',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: $('#'+form).serialize(), data: $('#'+form).serialize(),
success: function(data){ success: function(data){
$('#'+target).html(data); $('#'+target).html(data);
@ -624,14 +621,6 @@ function transpotUrl (scope) {
$(document).ready(setupAjaxIndicator); $(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad); $(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit); $(document).ready(addFormObserversForDoubleSubmit);
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
}
});
}
)
function img_thumbnails() { function img_thumbnails() {
$('.thumbnails a').colorbox({rel:'nofollow'}); $('.thumbnails a').colorbox({rel:'nofollow'});

View File

@ -0,0 +1,696 @@
//= require_directory ./rateable
/* Redmine - project management software
Copyright (C) 2006-2013 Jean-Philippe Lang */
function cleanArray (actual){
var newArray = new Array();
for (var i = 0; i< actual.length; i++){
if (actual[i]){
newArray.push(actual[i]);
}
}
return newArray;
}
function checkAll(id, checked) {
if (checked) {
$('#'+id).find('input[type=checkbox]').attr('checked', true);
} else {
$('#'+id).find('input[type=checkbox]').removeAttr('checked');
}
}
function toggleCheckboxesBySelector(selector) {
var all_checked = true;
$(selector).each(function(index) {
if (!$(this).is(':checked')) { all_checked = false; }
});
$(selector).attr('checked', !all_checked);
}
function showAndScrollTo(id, focus) {
$('#'+id).show();
if (focus !== null) {
$('#'+focus).focus();
}
$('html, body').animate({scrollTop: $('#'+id).offset().top}, 400);
}
function toggleRowGroup(el) {
var tr = $(el).parents('tr').first();
var n = tr.next();
tr.toggleClass('open');
while (n.length && !n.hasClass('group')) {
n.toggle();
n = n.next('tr');
}
}
function collapseAllRowGroups(el) {
var tbody = $(el).parents('tbody').first();
tbody.children('tr').each(function(index) {
if ($(this).hasClass('group')) {
$(this).removeClass('open');
} else {
$(this).hide();
}
});
}
function expandAllRowGroups(el) {
var tbody = $(el).parents('tbody').first();
tbody.children('tr').each(function(index) {
if ($(this).hasClass('group')) {
$(this).addClass('open');
} else {
$(this).show();
}
});
}
function toggleAllRowGroups(el) {
var tr = $(el).parents('tr').first();
if (tr.hasClass('open')) {
collapseAllRowGroups(el);
} else {
expandAllRowGroups(el);
}
}
function toggleFieldset(el) {
var fieldset = $(el).parents('fieldset').first();
fieldset.toggleClass('collapsed');
fieldset.children('div').toggle();
}
function hideFieldset(el) {
var fieldset = $(el).parents('fieldset').first();
fieldset.toggleClass('collapsed');
fieldset.children('div').hide();
}
function initFilters(){
$('#add_filter_select').change(function(){
addFilter($(this).val(), '', []);
});
$('#filters-table td.field input[type=checkbox]').each(function(){
toggleFilter($(this).val());
});
$('#filters-table td.field input[type=checkbox]').live('click',function(){
toggleFilter($(this).val());
});
$('#filters-table .toggle-multiselect').live('click',function(){
toggleMultiSelect($(this).siblings('select'));
});
$('#filters-table input[type=text]').live('keypress', function(e){
if (e.keyCode == 13) submit_query_form("query_form");
});
}
function addFilter(field, operator, values) {
var fieldId = field.replace('.', '_');
var tr = $('#tr_'+fieldId);
if (tr.length > 0) {
tr.show();
} else {
buildFilterRow(field, operator, values);
}
$('#cb_'+fieldId).attr('checked', true);
toggleFilter(field);
$('#add_filter_select').val('').children('option').each(function(){
if ($(this).attr('value') == field) {
$(this).attr('disabled', true);
}
});
}
function buildFilterRow(field, operator, values) {
var fieldId = field.replace('.', '_');
var filterTable = $("#filters-table");
var filterOptions = availableFilters[field];
var operators = operatorByType[filterOptions['type']];
var filterValues = filterOptions['values'];
var i, select;
var tr = $('<tr class="filter">').attr('id', 'tr_'+fieldId).html(
'<td class="field"><input checked="checked" id="cb_'+fieldId+'" name="f[]" value="'+field+'" type="checkbox"><label for="cb_'+fieldId+'"> '+filterOptions['name']+'</label></td>' +
'<td class="operator"><select id="operators_'+fieldId+'" name="op['+field+']"></td>' +
'<td class="values"></td>'
);
filterTable.append(tr);
select = tr.find('td.operator select');
for (i=0;i<operators.length;i++){
var option = $('<option>').val(operators[i]).text(operatorLabels[operators[i]]);
if (operators[i] == operator) { option.attr('selected', true); }
select.append(option);
}
select.change(function(){ toggleOperator(field); });
switch (filterOptions['type']){
case "list":
case "list_optional":
case "list_status":
case "list_subprojects":
tr.find('td.values').append(
'<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' +
' <span class="toggle-multiselect"><a>复选/multi-select</a></span></span>'
);
select = tr.find('td.values select');
if (values.length > 1) { select.attr('multiple', true); }
for (i=0;i<filterValues.length;i++){
var filterValue = filterValues[i];
var option = $('<option>');
if ($.isArray(filterValue)) {
option.val(filterValue[1]).text(filterValue[0]);
if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
} else {
option.val(filterValue).text(filterValue);
if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}
}
select.append(option);
}
break;
case "date":
case "date_past":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="3" class="value" /> '+labelDayPlural+'</span>'
);
$('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions);
$('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions);
$('#values_'+fieldId).val(values[0]);
break;
case "string":
case "text":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="30" class="value" /></span>'
);
$('#values_'+fieldId).val(values[0]);
break;
case "relation":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="6" class="value" /></span>' +
'<span style="display:none;"><select class="value" name="v['+field+'][]" id="values_'+fieldId+'_1"></select></span>'
);
$('#values_'+fieldId).val(values[0]);
select = tr.find('td.values select');
for (i=0;i<allProjects.length;i++){
var filterValue = allProjects[i];
var option = $('<option>');
option.val(filterValue[1]).text(filterValue[0]);
if (values[0] == filterValue[1]) { option.attr('selected', true); }
select.append(option);
}
case "integer":
case "float":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="6" class="value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="6" class="value" /></span>'
);
$('#values_'+fieldId+'_1').val(values[0]);
$('#values_'+fieldId+'_2').val(values[1]);
break;
}
}
function toggleFilter(field) {
var fieldId = field.replace('.', '_');
if ($('#cb_' + fieldId).is(':checked')) {
$("#operators_" + fieldId).show().removeAttr('disabled');
toggleOperator(field);
} else {
$("#operators_" + fieldId).hide().attr('disabled', true);
enableValues(field, []);
}
}
function enableValues(field, indexes) {
var fieldId = field.replace('.', '_');
$('#tr_'+fieldId+' td.values .value').each(function(index) {
if ($.inArray(index, indexes) >= 0) {
$(this).removeAttr('disabled');
$(this).parents('span').first().show();
} else {
$(this).val('');
$(this).attr('disabled', true);
$(this).parents('span').first().hide();
}
if ($(this).hasClass('group')) {
$(this).addClass('open');
} else {
$(this).show();
}
});
}
function toggleOperator(field) {
var fieldId = field.replace('.', '_');
var operator = $("#operators_" + fieldId);
switch (operator.val()) {
case "!*":
case "*":
case "t":
case "ld":
case "w":
case "lw":
case "l2w":
case "m":
case "lm":
case "y":
case "o":
case "c":
enableValues(field, []);
break;
case "><":
enableValues(field, [0,1]);
break;
case "<t+":
case ">t+":
case "><t+":
case "t+":
case ">t-":
case "<t-":
case "><t-":
case "t-":
enableValues(field, [2]);
break;
case "=p":
case "=!p":
case "!p":
enableValues(field, [1]);
break;
default:
enableValues(field, [0]);
break;
}
}
function toggleMultiSelect(el) {
if (el.attr('multiple')) {
el.removeAttr('multiple');
} else {
el.attr('multiple', true);
}
}
function submit_query_form(id) {
selectAllOptions("selected_columns");
$('#'+id).submit();
}
function showTab(name) {
$('div#content .tab-content').hide();
$('div.tabs a').removeClass('selected');
$('#tab-content-' + name).show();
$('#tab-' + name).addClass('selected');
return false;
}
function moveTabRight(el) {
var lis = $(el).parents('div.tabs').first().find('ul').children();
var tabsWidth = 0;
var i = 0;
lis.each(function(){
if ($(this).is(':visible')) {
tabsWidth += $(this).width() + 6;
}
});
if (tabsWidth < $(el).parents('div.tabs').first().width() - 60) { return; }
while (i<lis.length && !lis.eq(i).is(':visible')) { i++; }
lis.eq(i).hide();
}
function moveTabLeft(el) {
var lis = $(el).parents('div.tabs').first().find('ul').children();
var i = 0;
while (i<lis.length && !lis.eq(i).is(':visible')) { i++; }
if (i>0) {
lis.eq(i-1).show();
}
}
function displayTabsButtons() {
var lis;
var tabsWidth = 0;
var el;
$('div.tabs').each(function() {
el = $(this);
lis = el.find('ul').children();
lis.each(function(){
if ($(this).is(':visible')) {
tabsWidth += $(this).width() + 6;
}
});
if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) {
el.find('div.tabs-buttons').hide();
} else {
el.find('div.tabs-buttons').show();
}
});
}
function setPredecessorFieldsVisibility() {
var relationType = $('#relation_relation_type');
if (relationType.val() == "precedes" || relationType.val() == "follows") {
$('#predecessor_fields').show();
} else {
$('#predecessor_fields').hide();
}
}
function showModal(id, width) {
var el = $('#'+id).first();
if (el.length === 0 || el.is(':visible')) {return;}
var title = el.find('h3.title').text();
el.dialog({
width: width,
modal: true,
resizable: false,
dialogClass: 'modal',
title: title
});
el.find("input[type=text], input[type=submit]").first().focus();
}
function hideModal(el) {
var modal;
if (el) {
modal = $(el).parents('.ui-dialog-content');
} else {
modal = $('#ajax-modal');
}
modal.dialog("close");
}
function submitPreview(url, form, target) {
$.ajax({
url: url,
type: 'post',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: $('#'+form).serialize(),
success: function(data){
$('#'+target).html(data);
}
});
}
function collapseScmEntry(id) {
$('.'+id).each(function() {
if ($(this).hasClass('open')) {
collapseScmEntry($(this).attr('id'));
}
$(this).hide();
});
$('#'+id).removeClass('open');
}
function expandScmEntry(id) {
$('.'+id).each(function() {
$(this).show();
if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) {
expandScmEntry($(this).attr('id'));
}
});
$('#'+id).addClass('open');
}
function scmEntryClick(id, url) {
el = $('#'+id);
if (el.hasClass('open')) {
collapseScmEntry(id);
el.addClass('collapsed');
return false;
} else if (el.hasClass('loaded')) {
expandScmEntry(id);
el.removeClass('collapsed');
return false;
}
if (el.hasClass('loading')) {
return false;
}
el.addClass('loading');
$.ajax({
url: url,
success: function(data){
el.after(data);
el.addClass('open').addClass('loaded').removeClass('loading');
}
});
return true;
}
function randomKey(size) {
var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
var key = '';
for (i = 0; i < size; i++) {
key += chars[Math.floor(Math.random() * chars.length)];
}
return key;
}
// Can't use Rails' remote select because we need the form data
function updateIssueFrom(url) {
$.ajax({
url: url,
type: 'post',
data: $('#issue-form').serialize()
});
}
function updateBulkEditFrom(url) {
$.ajax({
url: url,
type: 'post',
data: $('#bulk_edit_form').serialize()
});
}
function clearMessage(id) {
$('#'+id).val("");
}
function observeAutocompleteField(fieldId, url, options) {
$(document).ready(function() {
$('#'+fieldId).autocomplete($.extend({
source: url,
select: function(e,ui){self.location="/issues/"+ui.item.value;},
minLength: 2,
search: function(){$('#'+fieldId).addClass('ajax-loading');},
response: function(){$('#'+fieldId).removeClass('ajax-loading');
}
}, options));
$('#'+fieldId).addClass('autocomplete');
});
}
function observeSearchfield(fieldId, targetId, url) {
$('#'+fieldId).each(function() {
var $this = $(this);
$this.addClass('autocomplete');
$this.attr('data-value-was', $this.val());
var check = function() {
var val = $this.val();
if ($this.attr('data-value-was') != val){
$this.attr('data-value-was', val);
$.ajax({
url: url,
type: 'get',
data: {q: $this.val()},
success: function(data){ if(targetId) $('#'+targetId).html(data); },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
});
}
};
var reset = function() {
if (timer) {
clearInterval(timer);
timer = setInterval(check, 300);
}
};
var timer = setInterval(check, 300);
$this.bind('keyup click mousemove', reset);
});
}
function observeProjectModules() {
var f = function() {
/* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */
if ($('#project_enabled_module_names_issue_tracking').attr('checked')) {
$('#project_trackers').show();
}else{
$('#project_trackers').hide();
}
};
$(window).load(f);
$('#project_enabled_module_names_issue_tracking').change(f);
}
function initMyPageSortable(list, url) {
$('#list-'+list).sortable({
connectWith: '.block-receiver',
tolerance: 'pointer',
update: function(){
$.ajax({
url: url,
type: 'post',
data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})}
});
}
});
$("#list-top, #list-left, #list-right").disableSelection();
}
var warnLeavingUnsavedMessage;
function warnLeavingUnsaved(message) {
warnLeavingUnsavedMessage = message;
$('form').submit(function(){
$('textarea').removeData('changed');
});
$('textarea').change(function(){
$(this).data('changed', 'changed');
});
window.onbeforeunload = function(){
var warn = false;
$('textarea').blur().each(function(){
if ($(this).data('changed')) {
warn = true;
}
});
if (warn) {return warnLeavingUnsavedMessage;}
};
}
function setupAjaxIndicator() {
$('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
$('#ajax-indicator').show();
}
});
$('#ajax-indicator').bind('ajaxStop', function() {
$('#ajax-indicator').hide();
});
}
function hideOnLoad() {
$('.hol').hide();
}
function addFormObserversForDoubleSubmit() {
$('form[method=post]').each(function() {
if (!$(this).hasClass('multiple-submit')) {
$(this).submit(function(form_submission) {
if ($(form_submission.target).attr('data-submitted')) {
form_submission.preventDefault();
} else {
$(form_submission.target).attr('data-submitted', true);
}
});
}
});
}
function blockEventPropagation(event) {
event.stopPropagation();
event.preventDefault();
}
function toggleAndSettingWordsVal(parent_widget, text_widget, value){
text_widget.val(value)
parent_widget.slideToggle(400)
}
function transpotUrl (scope) {
$(scope).each(function(){
var tmpContent = $(this).html();
tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,]+)/gi,"$1<a href='$2$3' target='_blank'>$2$3<\/a>");
// tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,]+)/gi,"$1<a href='http:\/\/$2' style='color:blue' target='_blank'>$2</a>");
$(this).html(tmpContent);
});
}
$(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit);
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
}
});
}
)
function img_thumbnails() {
$('.thumbnails a').colorbox({rel:'nofollow'});
$('.attachments').find('a').each(function(index, element) {
var href_value = $(element).attr('href');
if (/\.(jpg|png|gif|bmp)$/.test(href_value)) {
$(element).colorbox({rel:'nofollow'});
}
});
}
$(document).ready(img_thumbnails);
function TimeClose(dateText, inst) {
if(inst.id=="issue_start_date"){
time=dateText;
}
}
var time=new Date();
function TimeBeforeShow(input){
if(input.id=="issue_due_date"){
//var minDate = $(input).datepicker('option', 'minDate');
var tempdata=$("#issue_start_date").attr("value");
$(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/")));
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
}
}
function SetMinValue(){
/// var tempdata=$("#issue_start_date").attr("value");
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
//alert(tempdata);
//$("#issue_due_date").datepicker({
// minDate: new Date(2014,08,23)
//var datepickerOptions=
//{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
//alert( $('.issue_due_date').length);
//$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23));
//$("#issue_due_date").datepicker(datepickerOptions);
//$("##{issue_due_date}").datepicker(datepickerOptions);
//$("#issue_due_date").datepicker(
// {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}
//)
//});
}
function PrecentChange(obj){
var _v= obj;
if(_v==100)
{
//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);
$("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");
}
}

View File

@ -2895,3 +2895,25 @@ div.repos_explain{
{ {
width: 190px; width: 190px;
} }
input[class~='ButtonClolr'],.ButtonColor{
color: #fffbff !important;
padding: 5px;
width: auto;
height: 24px ;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 15px;
text-align: center;
background: #15bccf !important;
border: 0px solid #15bccf ;
display:inline-block
}
input[class~='m3p10'], .m3p10 {
margin: 0;
padding: 3px 10px !important;
height: 20px;
display: inline-block;
color: #ffffff;
}

View File

@ -55,7 +55,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-hei
.c_grey{ color:#999; font-weight:normal;} .c_grey{ color:#999; font-weight:normal;}
.dis ul li.wname02 a{ width:200px; font-size:14px; color:#595959; padding:20px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} .dis ul li.wname02 a{ width:200px; font-size:14px; color:#595959; padding:20px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.dis ul li.wmine{ margin:12px 0 0 10px;} .dis ul li.wmine{ margin:12px 0 0 10px;}
.dis ul li.wmine a{ color:#3d7ec2; text-align:center; width:50px; font-weight: bold;} .dis ul li.wmine a{ color:#3d7ec2; text-align:center; width:50px; font-weight: bold;line-height: 1.9;}
.wzan{ margin:15px 0 0 25px; width:32px; height:44px;} .wzan{ margin:15px 0 0 25px; width:32px; height:44px;}
.wzan a{ display: block;text-align: center;} .wzan a{ display: block;text-align: center;}
a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;} a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;}

View File

@ -474,20 +474,6 @@ body {
position: relative; position: relative;
top: 1px; top: 1px;
} }
input[class~='ButtonClolr'],.ButtonColor{
color: #fffbff !important;
padding: 5px;
width: auto;
height: 24px ;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 15px;
text-align: center;
background: #15bccf !important;
border: 0px solid #15bccf ;
display:inline-block
}
input[class~='whiteButton'], .whiteButton { input[class~='whiteButton'], .whiteButton {
-moz-box-shadow: inset 0px 1px 0px 0px #ffffff; -moz-box-shadow: inset 0px 1px 0px 0px #ffffff;
@ -537,14 +523,6 @@ input[class~='whiteButton']:active, .whiteButton:active {
color: #ffffff; color: #ffffff;
} }
input[class~='m3p10'], .m3p10 {
margin: 0;
padding: 3px 10px !important;
height: 20px;
display: inline-block;
color: #ffffff;
}
input[class~='h30'], .h30 { input[class~='h30'], .h30 {
height: 30px; height: 30px;
} }