diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 25c1c15c8..65e1bf2f5 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -8,8 +8,10 @@
alert("搜索条件不能为空");
return;
}
+
$("#search_user_form").submit();
}
+
@@ -21,8 +23,12 @@
|
-
- <%= text_field_tag 'name', params[:name], :size => 30 %>
+
+
+ <%= select "search_by", "id",
+ { l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
+ :size => 20 %>
+ <%= text_field_tag 'name', params[:name], :size => 30 %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index e718956f1..4311fd962 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -14,7 +14,7 @@
<% if @auth_sources.present? && @auth_sources.any?(&:searchable?) %>
<%= javascript_tag do %>
- observeAutocompleteField('user_login', '<%= escape_javascript autocomplete_for_new_user_auth_sources_path %>', {
+ ('user_login', '<%= escape_javascript autocomplete_for_new_user_auth_sources_path %>', {
select: function(event, ui) {
$('input#user_firstname').val(ui.item.firstname);
$('input#user_lastname').val(ui.item.lastname);
diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb
index fa252ada0..f5bbc3b8d 100644
--- a/app/views/users/search.html.erb
+++ b/app/views/users/search.html.erb
@@ -19,7 +19,11 @@
|
-
+
+
+ <%= select "search_by", "id",
+ { l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
+ :size => 20 %>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb
index e5c169804..4b7b0bf54 100644
--- a/app/views/welcome/contest.html.erb
+++ b/app/views/welcome/contest.html.erb
@@ -228,7 +228,7 @@
<% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%>
- -
+
-
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 464d3af4d..f1b09cf54 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -135,7 +135,7 @@
<% find_new_forum_topics(10).each do |topic| %>
- -
+
-
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 8d1fb19af..6e2d6f003 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -288,6 +288,7 @@ zh:
field_class_period: 学时
field_code: 学分
field_is_public: 公开
+ field_open_student: 学生列表公开
field_parent: 上级项目
field_is_in_roadmap: 在路线图中显示
field_login: 昵称
@@ -851,6 +852,10 @@ zh:
label_roadmap_due_in: "截止日期到 %{value}"
label_roadmap_overdue: "%{value} 延期"
label_roadmap_no_issues: 该版本没有问题
+ label_user_search_type: 搜索类型
+ label_search_by_login: 昵称
+ label_search_by_name: 名字
+ label_search_by_email: 邮箱
label_search: 搜索
label_result_plural: 结果
label_all_words: 所有单词
@@ -1796,6 +1801,7 @@ zh:
label_course_join_student: 加入课程
label_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)
label_course_public_info: (打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)
+ label_course_open_student_info: (打钩为“学生列表公开”,不打钩为不公开,若不公开,则课程外部人员看不到学生列表)
label_course_view_student: 查看其他课程
label_course_student: 学生
label_course_file: 资源库 #资料共享
@@ -1957,6 +1963,7 @@ zh:
label_memo_new_from_forum: 发布帖子
label_forum: 公共贴吧
label_forum_new: 新建贴吧
+ label_forum_set: 贴吧设置
label_tags_forum_description: 贴吧描述
label_tags_forum: 贴吧名称
label_project_module_forums: 公共贴吧
@@ -2184,4 +2191,4 @@ zh:
label_anonymous: 匿名
label_submit_comments: 提交评论
field_evaluation_num: 匿评分配数量
- label_my_score: 我的评分
\ No newline at end of file
+ label_my_score: 我的评分
diff --git a/config/routes.rb b/config/routes.rb
index 5a34319c4..6610ef219 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -164,6 +164,7 @@ RedmineApp::Application.routes.draw do
resources :forums do
collection do
match 'search_forum', :via => [:get, :post]
+
end
member do
post 'create_memo'
@@ -402,6 +403,7 @@ RedmineApp::Application.routes.draw do
end
end
+
resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
collection do
put 'close_completed'
@@ -620,7 +622,7 @@ RedmineApp::Application.routes.draw do
get 'test_connection', :as => 'try_connection'
end
collection do
- get 'autocomplete_for_new_user'
+ get 'autocomplete_for_new_user'
end
end
diff --git a/db/migrate/20141029065917_change_bids_description_type.rb b/db/migrate/20141029065917_change_bids_description_type.rb
index 2705f661e..f578e9180 100644
--- a/db/migrate/20141029065917_change_bids_description_type.rb
+++ b/db/migrate/20141029065917_change_bids_description_type.rb
@@ -1,5 +1,6 @@
-class ChangeBidsDescriptionType < ActiveRecord::Migration
- def change
- change_column :bids, :description, :text, default: nil
- end
-end
+#encoding=UTF-8
+class ChangeBidsDescriptionType < ActiveRecord::Migration
+ def change
+ change_column :bids, :description, :text, default: nil
+ end
+end
diff --git a/db/migrate/20141031065238_change_data_for_courses.rb b/db/migrate/20141031065238_change_data_for_courses.rb
new file mode 100644
index 000000000..d23e0343e
--- /dev/null
+++ b/db/migrate/20141031065238_change_data_for_courses.rb
@@ -0,0 +1,10 @@
+#encoding=UTF-8
+class ChangeDataForCourses < ActiveRecord::Migration
+ def up
+ sql = "UPDATE courses set school_id = 117 where id =58"
+ execute(sql)
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20141031122331_change_school_id_for_school.rb b/db/migrate/20141031122331_change_school_id_for_school.rb
new file mode 100644
index 000000000..e779b1a5b
--- /dev/null
+++ b/db/migrate/20141031122331_change_school_id_for_school.rb
@@ -0,0 +1,11 @@
+#encoding=UTF-8
+class ChangeSchoolIdForSchool < ActiveRecord::Migration
+ def up
+ sql = "update courses, user_extensions set courses.school_id = user_extensions.school_id
+ where courses.tea_id = user_extensions.user_id"
+ execute(sql)
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20141103015148_add_column_to_forums.rb b/db/migrate/20141103015148_add_column_to_forums.rb
new file mode 100644
index 000000000..5f8938eb9
--- /dev/null
+++ b/db/migrate/20141103015148_add_column_to_forums.rb
@@ -0,0 +1,6 @@
+class AddColumnToForums < ActiveRecord::Migration
+ def change
+ add_column :forums, :sticky, :integer
+ add_column :forums, :locked, :integer
+ end
+end
diff --git a/db/migrate/20141103032156_set_sticky_locked_for_forum.rb b/db/migrate/20141103032156_set_sticky_locked_for_forum.rb
new file mode 100644
index 000000000..743406d4b
--- /dev/null
+++ b/db/migrate/20141103032156_set_sticky_locked_for_forum.rb
@@ -0,0 +1,9 @@
+class SetStickyLockedForForum < ActiveRecord::Migration
+ def up
+ sql = "update forums set sticky=0, locked = 0 "
+ execute(sql)
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20141103065703_add_data_for_school_name.rb b/db/migrate/20141103065703_add_data_for_school_name.rb
new file mode 100644
index 000000000..924f2e5da
--- /dev/null
+++ b/db/migrate/20141103065703_add_data_for_school_name.rb
@@ -0,0 +1,29 @@
+#encoding=UTF-8
+class AddDataForSchoolName < ActiveRecord::Migration
+ def up
+ sql = " Insert into schools (name, province, logo_link, created_at, updated_at) values
+ ('香港大学','香港','/images/transparent.png', NOW(),NOW()),
+ ('香港大学','香港','/images/transparent.png',NOW(),NOW()),
+ ('香港中文大学','香港','/images/transparent.png',NOW(),NOW()),
+ ('香港科技大学','香港','/images/transparent.png',NOW(),NOW()),('香港理工大学','香港','/images/transparent.png',NOW(),NOW()),
+ ('香港城市大学','香港','/images/transparent.png',NOW(),NOW()),('香港浸会大学','香港','/images/transparent.png',NOW(),NOW()),
+ ('香港教育学院','香港','/images/transparent.png',NOW(),NOW()),('香港歌德学院','香港','/images/transparent.png',NOW(),NOW()),
+ ('香港岭南大学','香港','/images/transparent.png',NOW(),NOW()),('澳门大学','澳门','/images/transparent.png',NOW(),NOW()),
+ ('澳门理工学院','澳门','/images/transparent.png',NOW(),NOW()),('澳门科技大学','澳门','/images/transparent.png',NOW(),NOW()),
+ ('澳门保安部队高等学校','澳门','/images/transparent.png',NOW(),NOW()),('亚洲国际公开大学','澳门','/images/transparent.png',NOW(),NOW()),
+ ('澳门旅游学院','澳门','/images/transparent.png',NOW(),NOW()),('清华大学(新竹)','台湾','/images/transparent.png',NOW(),NOW()),
+ ('台湾大学','台湾','/images/transparent.png',NOW(),NOW()),('交通大学','台湾','/images/transparent.png',NOW(),NOW()),
+ ('中央大学','台湾','/images/transparent.png',NOW(),NOW()),('成功大学','台湾','/images/transparent.png',NOW(),NOW()),
+ ('中山大学','台湾','/images/transparent.png',NOW(),NOW()),('中原大学','台湾','/images/transparent.png',NOW(),NOW()),
+ ('政治大学','台湾','/images/transparent.png',NOW(),NOW()),('元智大学','台湾','/images/transparent.png',NOW(),NOW()),
+ ('天主教辅仁大学','台湾','/images/transparent.png',NOW(),NOW()),('台湾科技大学','台湾','/images/transparent.png',NOW(),NOW()),
+ ('台湾师范大学','台湾','/images/transparent.png',NOW(),NOW()),('台湾艺术大学','台湾','/images/transparent.png',NOW(),NOW())"
+ execute(sql)
+
+ end
+
+
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4aa945f18..c257fa97a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20141105012624) do
+ActiveRecord::Schema.define(:version => 20141103065703) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -95,21 +95,19 @@ ActiveRecord::Schema.define(:version => 20141105012624) do
create_table "bids", :force => true do |t|
t.string "name"
- t.string "budget", :null => false
+ t.string "budget", :null => false
t.integer "author_id"
t.date "deadline"
t.text "description"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
t.integer "commit"
t.integer "reward_type"
t.integer "homework_type"
t.integer "parent_id"
t.string "password"
t.integer "is_evaluation"
- t.integer "proportion", :default => 60
- t.integer "comment_status", :default => 0
- t.integer "evaluation_num", :default => 3
+ t.integer "proportion", :default => 60
end
create_table "boards", :force => true do |t|
@@ -459,6 +457,8 @@ ActiveRecord::Schema.define(:version => 20141105012624) do
t.integer "creator_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.integer "sticky"
+ t.integer "locked"
end
create_table "groups_users", :id => false, :force => true do |t|
@@ -480,13 +480,6 @@ ActiveRecord::Schema.define(:version => 20141105012624) do
t.integer "project_id", :default => 0
end
- create_table "homework_evaluations", :force => true do |t|
- t.string "user_id"
- t.string "homework_attach_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "homework_for_courses", :force => true do |t|
t.integer "course_id"
t.integer "bid_id"
diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb
index 06d945bbb..0ea1ec79e 100644
--- a/lib/redmine/menu_manager.rb
+++ b/lib/redmine/menu_manager.rb
@@ -170,7 +170,9 @@ module Redmine
end
def render_single_menu_node(item, caption, url, selected)
- link_to(h(caption), url, item.html_options(:selected => selected))
+ unless url.include?('code_review')
+ link_to(h(caption), url, item.html_options(:selected => selected))
+ end
end
def render_unattached_menu_item(menu_item, project)
@@ -198,17 +200,19 @@ module Redmine
end
def extract_node_details(node, project=nil)
- item = node
- url = case item.url
- when Hash
- project.nil? ? item.url : {item.param => project}.merge(item.url)
- when Symbol
- send(item.url)
- else
- item.url
- end
- caption = item.caption(project)
- return [caption, url, (current_menu_item == item.name)]
+
+ item = node
+ url = case item.url
+ when Hash
+ project.nil? ? item.url : {item.param => project}.merge(item.url)
+ when Symbol
+ send(item.url)
+ else
+ item.url
+ end
+ caption = item.caption(project)
+ return [caption, url, (current_menu_item == item.name)]
+
end
# Checks if a user is allowed to access the menu item by:
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 1dedc1b8c..e4c5d4089 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1,419 +1,419 @@
//= require_directory ./rateable
/* Redmine - project management software
- Copyright (C) 2006-2013 Jean-Philippe Lang */
+ Copyright (C) 2006-2013 Jean-Philippe Lang */
function cleanArray (actual){
- var newArray = new Array();
+ var newArray = new Array();
for (var i = 0; i< actual.length; i++){
- if (actual[i]){
- newArray.push(actual[i]);
- }
+ if (actual[i]){
+ newArray.push(actual[i]);
+ }
}
- return newArray;
+ return newArray;
}
function checkAll(id, checked) {
- if (checked) {
- $('#'+id).find('input[type=checkbox]').attr('checked', true);
- } else {
- $('#'+id).find('input[type=checkbox]').removeAttr('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);
+ 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);
+ $('#'+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');
- }
+ 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();
- }
- });
+ 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();
- }
- });
+ 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);
- }
+ 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();
+ 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();
+ 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");
- });
+ $('#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);
+ 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 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 = $('').attr('id', 'tr_'+fieldId).html(
- ' | ' +
- ' | ' +
- ' | '
- );
- filterTable.append(tr);
-
- select = tr.find('td.operator select');
- for (i=0;i').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(
- '' +
- ' 复选/multi-select'
+ var tr = $('').attr('id', 'tr_'+fieldId).html(
+ ' | ' +
+ ' | ' +
+ ' | '
);
- select = tr.find('td.values select');
- if (values.length > 1) { select.attr('multiple', true); }
- for (i=0;i');
- 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);
+ filterTable.append(tr);
+
+ select = tr.find('td.operator select');
+ for (i=0;i').val(operators[i]).text(operatorLabels[operators[i]]);
+ if (operators[i] == operator) { option.attr('selected', true); }
+ select.append(option);
}
- break;
- case "date":
- case "date_past":
- tr.find('td.values').append(
- '' +
- ' ' +
- ' '+labelDayPlural+''
- );
- $('#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(
- ''
- );
- $('#values_'+fieldId).val(values[0]);
- break;
- case "relation":
- tr.find('td.values').append(
- '' +
- ''
- );
- $('#values_'+fieldId).val(values[0]);
- select = tr.find('td.values select');
- for (i=0;i');
- option.val(filterValue[1]).text(filterValue[0]);
- if (values[0] == filterValue[1]) { 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(
+ '' +
+ ' 复选/multi-select'
+ );
+ select = tr.find('td.values select');
+ if (values.length > 1) { select.attr('multiple', true); }
+ for (i=0;i');
+ 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(
+ '' +
+ ' ' +
+ ' '+labelDayPlural+''
+ );
+ $('#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(
+ ''
+ );
+ $('#values_'+fieldId).val(values[0]);
+ break;
+ case "relation":
+ tr.find('td.values').append(
+ '' +
+ ''
+ );
+ $('#values_'+fieldId).val(values[0]);
+ select = tr.find('td.values select');
+ for (i=0;i');
+ 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(
+ '' +
+ ' '
+ );
+ $('#values_'+fieldId+'_1').val(values[0]);
+ $('#values_'+fieldId+'_2').val(values[1]);
+ break;
}
- case "integer":
- case "float":
- tr.find('td.values').append(
- '' +
- ' '
- );
- $('#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, []);
- }
+ 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();
- }
+ 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();
- }
- });
+ 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 "<":
+ enableValues(field, [0,1]);
+ break;
+ case "t+":
+ case ">t-":
+ case "0) {
- lis.eq(i-1).show();
- }
+ var lis = $(el).parents('div.tabs').first().find('ul').children();
+ var i = 0;
+ while (i0) {
+ 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;
- }
+ 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();
+ }
});
- 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();
- }
+ 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();
+ 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");
+ 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',
- data: $('#'+form).serialize(),
- success: function(data){
- $('#'+target).html(data);
- }
- });
+ $.ajax({
+ url: url,
+ type: 'post',
+ 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');
+ $('.'+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');
+ $('.'+id).each(function() {
+ $(this).show();
+ if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) {
+ expandScmEntry($(this).attr('id'));
+ }
+ });
+ $('#'+id).addClass('open');
}
function scmEntryClick(id, url) {
@@ -432,190 +432,190 @@ function scmEntryClick(id, url) {
}
el.addClass('loading');
$.ajax({
- url: url,
- success: function(data){
- el.after(data);
- el.addClass('open').addClass('loaded').removeClass('loading');
- }
+ 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;
+ 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()
- });
+ $.ajax({
+ url: url,
+ type: 'post',
+ data: $('#issue-form').serialize()
+ });
}
function updateBulkEditFrom(url) {
- $.ajax({
- url: url,
- type: 'post',
- data: $('#bulk_edit_form').serialize()
- });
+ $.ajax({
+ url: url,
+ type: 'post',
+ data: $('#bulk_edit_form').serialize()
+ });
}
function clearMessage(id) {
- $('#'+id).val("");
+ $('#'+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');
-
- });
-
+ $(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);
- });
+ $('#'+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();
- }
- };
+ 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);
+ $(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();
+ $('#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;
+ 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;
- }
+ $('form').submit(function(){
+ $('textarea').removeData('changed');
});
- if (warn) {return warnLeavingUnsavedMessage;}
- };
+ $('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) {
+ $('#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();
- });
+ 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();
+ $('.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);
+ $('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();
+ event.stopPropagation();
+ event.preventDefault();
}
function toggleAndSettingWordsVal(parent_widget, text_widget, value){
- text_widget.val(value)
- parent_widget.slideToggle(400)
+ 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$2$3<\/a>");
- // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2");
- $(this).html(tmpContent);
- });
+ $(scope).each(function(){
+ var tmpContent = $(this).html();
+ tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>");
+ // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2");
+ $(this).html(tmpContent);
+ });
}
$(document).ready(setupAjaxIndicator);
@@ -623,14 +623,14 @@ $(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit);
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'});
- }
+ $('.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);
| |