2015-04-07 12:48:47 +08:00
|
|
|
|
//验证搜索时输入字
|
2015-04-16 04:12:26 +08:00
|
|
|
|
function regexName(content) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
var name = $.trim($("#name").val());
|
|
|
|
|
if (name.length == 0) {
|
2015-04-16 04:12:26 +08:00
|
|
|
|
$("#project_name_span").text(content);
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#project_name_span").css('color', '#ff0000');
|
|
|
|
|
$("#project_name_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#project_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function submitSerch(content) {
|
|
|
|
|
if (regexName(content)) {
|
|
|
|
|
$("#project_search_form").submit();
|
|
|
|
|
}
|
2015-04-16 04:12:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
// 项目描述超过展开
|
2015-04-14 10:46:31 +08:00
|
|
|
|
//$(function(){
|
|
|
|
|
// $(".subNav").click(function(){
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
//})
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function expand_tools_expand(content) {
|
|
|
|
|
if (content == "invit") {
|
2015-04-16 14:25:02 +08:00
|
|
|
|
$("#expand_tools_expand_invit").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
|
|
|
|
|
$("#expand_tools_expand_invit").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
|
|
|
|
|
$("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
|
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-05-07 17:38:08 +08:00
|
|
|
|
// $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
|
|
|
|
|
// $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
|
|
|
|
|
// $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
|
|
|
|
|
$("#navContent").toggle(500);
|
2015-04-16 14:25:02 +08:00
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
|
2015-04-14 10:46:31 +08:00
|
|
|
|
// 修改数字控制速度, slideUp(500)控制卷起速度
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
|
|
|
|
|
// 描述显示更多信息
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function show_more_msg() {
|
|
|
|
|
$("#course_description").toggleClass("course_description_none");
|
|
|
|
|
var information = $("#expend_more_information");
|
|
|
|
|
var arrow = $("#arrow");
|
|
|
|
|
var val = information.attr("value");
|
2015-04-20 14:45:46 +08:00
|
|
|
|
if (val == "show_more") {
|
2015-04-16 04:53:09 +08:00
|
|
|
|
$("#expend_more_information").text("收起描述信息");
|
2015-04-20 14:45:46 +08:00
|
|
|
|
information.attr("value", "hide_more");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
arrow.attr("src", "/images/jiantouup.jpg")
|
2015-04-16 04:53:09 +08:00
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-04-16 04:53:09 +08:00
|
|
|
|
$("#expend_more_information").text("展开更多信息");
|
2015-04-20 14:45:46 +08:00
|
|
|
|
information.attr("value", "show_more");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
arrow.attr("src", "/images/jiantou.jpg")
|
2015-04-16 04:53:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-07 16:10:07 +08:00
|
|
|
|
function show_more_reply(contentid, id2, id3) {
|
|
|
|
|
$(contentid).toggleClass("course_description_none");
|
|
|
|
|
var information = $(id2);
|
|
|
|
|
var arrow = $(id3);
|
|
|
|
|
var val = information.attr("value");
|
|
|
|
|
if (val == "show_more") {
|
2015-05-07 17:38:08 +08:00
|
|
|
|
$(id2).text("[收起]");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
information.attr("value", "hide_more");
|
2015-05-21 16:35:53 +08:00
|
|
|
|
information.attr("style", "color:#3ca5c6");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
arrow.attr("src", "/images/jiantouup.jpg")
|
|
|
|
|
}
|
|
|
|
|
else {
|
2015-05-07 17:38:08 +08:00
|
|
|
|
$(id2).text("[展开]");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
information.attr("value", "show_more");
|
|
|
|
|
arrow.attr("src", "/images/jiantou.jpg")
|
2015-05-21 16:35:53 +08:00
|
|
|
|
information.attr("style", "color:#0781b4;");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-22 13:57:07 +08:00
|
|
|
|
function show_more_reply1(contentid, id2, id3) {
|
|
|
|
|
$(contentid).toggleClass("course_description_none");
|
|
|
|
|
var information = $(id2);
|
|
|
|
|
var arrow = $(id3);
|
|
|
|
|
var val = information.attr("value");
|
|
|
|
|
if (val == "show_more") {
|
|
|
|
|
$(id2).text("[收起]");
|
|
|
|
|
information.attr("value", "hide_more");
|
|
|
|
|
information.attr("style", "color:#3ca5c6");
|
|
|
|
|
arrow.attr("src", "/images/jiantouup.jpg")
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$(id2).text("[展开]");
|
|
|
|
|
information.attr("value", "show_more");
|
|
|
|
|
arrow.attr("src", "/images/jiantou.jpg")
|
|
|
|
|
information.attr("style", "color:#0781b4;");
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-27 17:15:21 +08:00
|
|
|
|
//项目版本库git帮助文档显示
|
2015-09-29 10:42:17 +08:00
|
|
|
|
//function showhelpAndScrollTo(id) {
|
|
|
|
|
// $('#' + id).toggle();
|
|
|
|
|
// if(cookieget("repositories_visiable") == "true")
|
|
|
|
|
// {
|
|
|
|
|
// cookiesave("repositories_visiable", false,'','','');
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// cookiesave("repositories_visiable", true,'','','');
|
|
|
|
|
// }
|
|
|
|
|
// var information = $("#showgithelp");
|
|
|
|
|
// var val = information.attr("value");
|
|
|
|
|
// if(val=="show_help")
|
|
|
|
|
// {
|
|
|
|
|
// $("#showgithelp").text("收起Git操作指南");
|
|
|
|
|
// information.attr("value", "hide_help");
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// $("#showgithelp").text("展开Git操作指南");
|
|
|
|
|
// information.attr("value", "show_help");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2015-05-08 09:48:43 +08:00
|
|
|
|
function showhelpAndScrollToMessage(id, id1, count) {
|
2015-05-07 16:10:07 +08:00
|
|
|
|
$('#' + id).toggle();
|
|
|
|
|
if(cookieget("repositories_visiable") == "true")
|
|
|
|
|
{
|
|
|
|
|
cookiesave("repositories_visiable", false,'','','');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cookiesave("repositories_visiable", true,'','','');
|
|
|
|
|
}
|
|
|
|
|
var information = $(id1);
|
|
|
|
|
var val = information.attr("value");
|
|
|
|
|
if(val=="show_help")
|
|
|
|
|
{
|
2015-05-08 09:48:43 +08:00
|
|
|
|
$(id1).text("收起回复(" + count + ")" );
|
2015-05-07 16:10:07 +08:00
|
|
|
|
information.attr("value", "hide_help");
|
2015-05-21 16:35:53 +08:00
|
|
|
|
information.attr("style", "color:#3ca5c6");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-05-08 09:48:43 +08:00
|
|
|
|
$(id1).text("展开回复(" + count + ")");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
information.attr("value", "show_help");
|
2015-05-21 16:35:53 +08:00
|
|
|
|
information.attr("style", "color:#0781b4;");
|
2015-05-07 16:10:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-06 17:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
2015-05-05 17:08:46 +08:00
|
|
|
|
$(function(){
|
2015-05-06 17:41:18 +08:00
|
|
|
|
var information = $("#showgithelp");
|
|
|
|
|
var val = information.attr("value");
|
2015-05-05 17:08:46 +08:00
|
|
|
|
if(cookieget("repositories_visiable") == "true")
|
|
|
|
|
{
|
|
|
|
|
$('#repos_git_more').hide();
|
|
|
|
|
}
|
2015-05-06 17:41:18 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$('#repos_git_more').show();
|
|
|
|
|
$("#showgithelp").text("收起Git操作指南");
|
|
|
|
|
information.attr("value", "hide_help");
|
|
|
|
|
}
|
2015-05-05 17:08:46 +08:00
|
|
|
|
});
|
|
|
|
|
|
2015-04-27 16:58:16 +08:00
|
|
|
|
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
//////////////////////////////////////////////////////////////项目讨论区
|
2015-05-14 15:11:20 +08:00
|
|
|
|
function regexSubject(id) {
|
2015-05-14 15:42:20 +08:00
|
|
|
|
|
2015-05-14 15:11:20 +08:00
|
|
|
|
var subjectid = "#message_subject" + id ;
|
|
|
|
|
var content = $.trim($(subjectid).val());
|
|
|
|
|
var message = "#subject_span" + id;
|
2015-04-16 20:11:33 +08:00
|
|
|
|
if (content.length == 0) {
|
2015-05-14 15:11:20 +08:00
|
|
|
|
$(message).text("主题不能为空");
|
|
|
|
|
$(message).css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-05-14 15:11:20 +08:00
|
|
|
|
$(message).text("填写正确");
|
|
|
|
|
$(message).css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-20 17:38:40 +08:00
|
|
|
|
function regexContent(){
|
|
|
|
|
}
|
|
|
|
|
function regexContentxx(id) {
|
|
|
|
|
|
2015-05-14 15:11:20 +08:00
|
|
|
|
var contentid = "#message_content" + id;
|
|
|
|
|
var message = "#message_content_span"+ id;
|
2015-05-20 17:38:40 +08:00
|
|
|
|
var ps=document.getElementById('message_content' + id).previousElementSibling.children[1].children[0];
|
|
|
|
|
alert(ps);
|
|
|
|
|
document.getElementById('message_content' + id).value = ps.value;
|
2015-05-14 15:11:20 +08:00
|
|
|
|
var content = $.trim($(contentid).val());
|
2015-05-19 14:26:42 +08:00
|
|
|
|
alert(content);
|
2015-04-16 20:11:33 +08:00
|
|
|
|
if (content.length == 0) {
|
2015-05-14 15:42:20 +08:00
|
|
|
|
|
2015-05-14 15:11:20 +08:00
|
|
|
|
$(message).text("描述不能为空");
|
|
|
|
|
$(message).css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-05-14 15:11:20 +08:00
|
|
|
|
|
|
|
|
|
$(message).text("填写正确");
|
|
|
|
|
$(message).css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-20 14:54:04 +08:00
|
|
|
|
// 项目讨论区编辑和提交
|
2015-05-14 15:11:20 +08:00
|
|
|
|
function submitProjectsBoard(id) {
|
|
|
|
|
var formid = "#message-form" + id;
|
2015-05-14 15:42:20 +08:00
|
|
|
|
|
2015-05-14 15:11:20 +08:00
|
|
|
|
if (regexSubject(id) && regexContent(id)) {
|
2015-05-19 14:26:42 +08:00
|
|
|
|
|
2015-05-20 17:38:40 +08:00
|
|
|
|
$(formid).submit();
|
2015-04-16 20:11:33 +08:00
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
// 提交新闻
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function regexTitle() {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
var name = $("#news_title").val();
|
2015-04-16 20:11:33 +08:00
|
|
|
|
if (name.length == 0) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#title_notice_span").text("标题不能为空");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#title_notice_span").css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#title_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else if (name.length <= 60) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#title_notice_span").text("填写正确");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#title_notice_span").css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#title_notice_span").text("标题超过60个字符");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#title_notice_span").css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#title_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function regexDescription() {
|
2015-05-27 14:45:36 +08:00
|
|
|
|
project_news_description_editor.sync();
|
2015-04-07 12:48:47 +08:00
|
|
|
|
var name = $("#news_description").val();
|
2015-04-16 20:11:33 +08:00
|
|
|
|
if (name.length == 0) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#description_notice_span").text("描述不能为空");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#description_notice_span").css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#description_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-21 13:20:09 +08:00
|
|
|
|
/*else if (name.length > 10000)
|
2015-08-31 17:49:48 +08:00
|
|
|
|
{
|
|
|
|
|
$("#description_notice_span").text("描述超过10000个字符");
|
|
|
|
|
$("#description_notice_span").css('color', '#ff0000');
|
|
|
|
|
$("#description_notice_span").focus();
|
|
|
|
|
return false;
|
2015-12-21 13:20:09 +08:00
|
|
|
|
}*/
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#description_notice_span").text("填写正确");
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#description_notice_span").css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function submitNews() {
|
|
|
|
|
if (regexTitle() && regexDescription()) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#news-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function submitFocus(obj) {
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$(obj).focus();
|
|
|
|
|
}
|
2015-04-09 08:43:51 +08:00
|
|
|
|
|
2015-06-13 15:17:59 +08:00
|
|
|
|
function submitComment()
|
|
|
|
|
{
|
|
|
|
|
$("#add_comment_form").submit();
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-09 08:43:51 +08:00
|
|
|
|
//当项目描述长度小于112px时,不显示更多按钮
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$(function () {
|
2015-04-09 19:18:04 +08:00
|
|
|
|
// alert($("#course_description_content").height());
|
2015-12-30 16:27:56 +08:00
|
|
|
|
if ($("#course_description_content").height() > 400) {
|
2015-04-09 08:43:51 +08:00
|
|
|
|
$("#lg-foot").show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//配置项目信息
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function course_setting(id) {
|
2015-04-09 08:43:51 +08:00
|
|
|
|
//alert(id);
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$('#tb_' + id).removeClass().addClass("hwork_hovertab");
|
|
|
|
|
$('#tbc_0' + id).removeClass().addClass("dis");
|
|
|
|
|
$('#tb_' + (3 - id)).removeClass().addClass("hwork_normaltab");
|
|
|
|
|
$('#tbc_0' + (3 - id)).removeClass().addClass("undis");
|
2015-04-09 19:18:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-20 14:54:04 +08:00
|
|
|
|
//项目类型(朋友圈、开发组、科研组)
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function show_window() {
|
|
|
|
|
$('#light').css('display', 'block');
|
|
|
|
|
$('#fade').css('display', 'block');
|
2015-04-09 19:18:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function close_window(type) {
|
|
|
|
|
$('#light').css('display', 'none');
|
|
|
|
|
$('#fade').css('display', 'none');
|
2015-04-09 19:18:04 +08:00
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$("#" + type).attr("checked", "checked");
|
2015-04-09 19:18:04 +08:00
|
|
|
|
}
|
2015-04-11 14:19:52 +08:00
|
|
|
|
//弹框l
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
2015-04-11 16:17:36 +08:00
|
|
|
|
//项目配置
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function project_setting(n) {
|
|
|
|
|
for (var i = 1; i < 9; i++) {
|
|
|
|
|
if (i == n) {
|
|
|
|
|
$("#pro_st_tb_" + i).removeClass().addClass("pro_st_hovertab");
|
|
|
|
|
$("#pro_st_tbc_0" + i).removeClass().addClass("pro_st_dis");
|
2015-04-11 16:17:36 +08:00
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
else {
|
|
|
|
|
$("#pro_st_tb_" + i).removeClass().addClass("pro_st_normaltab");
|
|
|
|
|
$("#pro_st_tbc_0" + i).removeClass().addClass("pro_st_undis");
|
2015-04-11 16:17:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-13 21:08:26 +08:00
|
|
|
|
}
|
2015-04-20 14:54:04 +08:00
|
|
|
|
|
|
|
|
|
//配置-验证项目名称
|
2015-04-27 16:58:16 +08:00
|
|
|
|
function regex_project_name() {
|
2015-04-20 14:54:04 +08:00
|
|
|
|
var name = $.trim($("#project_name").val());
|
2015-04-27 16:58:16 +08:00
|
|
|
|
if (name.length == 0) {
|
2015-04-20 14:54:04 +08:00
|
|
|
|
$("#project_name_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-27 16:58:16 +08:00
|
|
|
|
else {
|
2015-04-20 14:54:04 +08:00
|
|
|
|
$("#project_name_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//配置-信息提交
|
2015-04-27 16:58:16 +08:00
|
|
|
|
function submit_edit_project(id) {
|
|
|
|
|
if (regex_project_name()) {
|
|
|
|
|
$("#edit_project_" + id).submit();
|
2015-04-20 14:54:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-14 19:34:01 +08:00
|
|
|
|
//配置--成员---申请列表--拒绝
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function refusal_applied_member() {
|
2015-04-14 19:34:01 +08:00
|
|
|
|
$('#new_membership').append("<input name = 'refusal_button' style='display: none;'>");
|
|
|
|
|
$('#new_membership').submit();
|
2015-04-14 23:58:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新闻描述显示更多信息
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function news_show_more_des(id) {
|
2015-04-14 23:58:27 +08:00
|
|
|
|
$('#news_description_' + id).toggleClass("news_description_none");
|
2015-04-15 16:34:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 20:11:33 +08:00
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
$("#issue_project_id").css("width", "100%");
|
|
|
|
|
$("#issue_project_id").css("overflow ", "hidden");
|
2015-04-15 16:34:34 +08:00
|
|
|
|
// $(".jstEditor").css("margin-left ","80px");
|
|
|
|
|
//issue_project_id
|
|
|
|
|
});
|
2015-04-16 04:12:26 +08:00
|
|
|
|
|
2015-04-27 16:58:16 +08:00
|
|
|
|
function showAndScrollTo(id, focus) {
|
2015-09-25 17:22:31 +08:00
|
|
|
|
|
2015-04-27 16:58:16 +08:00
|
|
|
|
$('#' + id).show();
|
|
|
|
|
if (focus !== null) {
|
2015-09-25 17:22:31 +08:00
|
|
|
|
$('#' + focus).focus();
|
|
|
|
|
issue_journal_kind_reply.focus();
|
2015-04-27 16:58:16 +08:00
|
|
|
|
}
|
|
|
|
|
$('html, body').animate({scrollTop: $('#' + id).offset().top}, 400);
|
2015-04-16 17:56:19 +08:00
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
|
2015-09-23 14:27:47 +08:00
|
|
|
|
function quote_issue_journal(){
|
2015-09-25 11:45:57 +08:00
|
|
|
|
alert("test");
|
|
|
|
|
issue_journal_kind_reply.focus();
|
|
|
|
|
issue_journal_kind_reply.cmd.range.setStart(issue_journal_kind_reply.cmd.range.startOffset)
|
2015-09-23 14:27:47 +08:00
|
|
|
|
}
|
2015-04-16 20:11:33 +08:00
|
|
|
|
|
|
|
|
|
/*缺陷完成度决定缺陷状态*/
|
|
|
|
|
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");
|
|
|
|
|
}
|
2015-04-16 17:56:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Can't use Rails' remote select because we need the form data
|
|
|
|
|
// 根据缺陷状态值改变完成度状态
|
2015-04-16 20:11:33 +08:00
|
|
|
|
function updateIssueFrom(url) {
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
type: 'post',
|
|
|
|
|
data: $('#issue-form').serialize()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// firefox pre标签换行
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
var userAgent = navigator.userAgent.toLowerCase();
|
|
|
|
|
var browser = {
|
|
|
|
|
version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1],
|
|
|
|
|
safari: /webkit/.test(userAgent),
|
|
|
|
|
opera: /opera/.test(userAgent),
|
|
|
|
|
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
|
|
|
|
|
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
|
|
|
|
|
};
|
|
|
|
|
if (browser.mozilla || browser.opera) {
|
|
|
|
|
$("pre").addClass("break_word_firefox");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("pre").addClass("break_word");
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-29 14:29:03 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//论坛提交
|
|
|
|
|
function submitProjectBoard()
|
|
|
|
|
{
|
|
|
|
|
if(regexSubject()&®exContent())
|
|
|
|
|
{
|
|
|
|
|
$("#message-form").submit();
|
|
|
|
|
}
|
2015-05-18 11:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//cookie记忆html区块 显示/隐藏 的代码 start
|
|
|
|
|
$(function(){
|
|
|
|
|
var personalized_expand_key = "personalized_expand";
|
|
|
|
|
function personalized_init(){
|
|
|
|
|
var personalized_map = cookieget(personalized_expand_key);
|
|
|
|
|
if(personalized_map!=false){
|
|
|
|
|
personalized_map = JSON.parse(personalized_map);
|
|
|
|
|
$("*[nhtype='toggle4cookie']").each(function(){
|
|
|
|
|
var personalized_id=$(this).data('id');
|
|
|
|
|
var val = personalized_map[personalized_id];
|
|
|
|
|
if(val!=undefined && val!=$(this).data('val')){
|
|
|
|
|
personalized_click($(this),0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function personalized_click(obj,timeout){
|
|
|
|
|
var target = $(obj.data('target'));
|
|
|
|
|
var oldval = obj.data('val');
|
|
|
|
|
var val='';
|
|
|
|
|
if(oldval=='expand'){val='retract';}else{val='expand';}
|
|
|
|
|
obj.data('val',val);
|
|
|
|
|
var personalized_map = cookieget(personalized_expand_key);
|
|
|
|
|
if(personalized_map == false){
|
|
|
|
|
personalized_map={};
|
|
|
|
|
}else{
|
|
|
|
|
personalized_map = JSON.parse(personalized_map);
|
|
|
|
|
}
|
|
|
|
|
var personalized_id=obj.data('id');
|
|
|
|
|
personalized_map[personalized_id]=val;
|
|
|
|
|
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
|
|
|
|
|
target.toggle(timeout);
|
|
|
|
|
}
|
2015-08-29 18:21:01 +08:00
|
|
|
|
$("*[nhtype='toggle4cookie']").on('click',function(){
|
2015-05-18 11:16:41 +08:00
|
|
|
|
personalized_click($(this),500);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
personalized_init();
|
|
|
|
|
});
|
2015-05-22 16:30:22 +08:00
|
|
|
|
//cookie记忆html区块 显示/隐藏 的代码 end
|
|
|
|
|
|
|
|
|
|
// 新建项目的时候判断是否与我已有的项目重复
|
|
|
|
|
function judgeprojectname(){
|
|
|
|
|
$('#new_project').validate({
|
|
|
|
|
errorPlacement: function(error, element){
|
|
|
|
|
alert('error')
|
|
|
|
|
},
|
|
|
|
|
success: function(label){
|
|
|
|
|
alert('ok')
|
|
|
|
|
},
|
|
|
|
|
onkeyup: false,
|
|
|
|
|
rules : {
|
|
|
|
|
name:{required : true,
|
|
|
|
|
remote : {
|
|
|
|
|
url : 'projects/judge_same_projectname',
|
|
|
|
|
type:'get',
|
|
|
|
|
dataType:'text',
|
|
|
|
|
data:{
|
|
|
|
|
name : function(){ return $.trim( $("#name").val() ); }
|
|
|
|
|
},
|
|
|
|
|
dataFilter:function( data ){
|
|
|
|
|
if( data=='true')return false; else return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
messages : {
|
|
|
|
|
name:{required : "请填写项目名称!",remote:'您已新建过同名项目,请修改项目名称!'}
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-06-13 15:17:59 +08:00
|
|
|
|
}
|
2015-07-29 16:54:10 +08:00
|
|
|
|
|
|
|
|
|
//用户反馈
|
|
|
|
|
function submitProjectFeedback() {
|
|
|
|
|
$("#project_feedback_form").submit();
|
2015-09-23 17:36:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-26 17:18:59 +08:00
|
|
|
|
// 点击按钮复制功能
|
|
|
|
|
function jsCopy(){
|
|
|
|
|
var e=document.getElementById("copy_rep_content");
|
|
|
|
|
e.select();
|
|
|
|
|
document.execCommand("Copy");
|
2015-10-28 09:23:12 +08:00
|
|
|
|
}
|
2015-11-05 14:31:43 +08:00
|
|
|
|
function jsCopy2(id){
|
|
|
|
|
//alert("copy_rep_content2_" + id);
|
|
|
|
|
var e=document.getElementById("copy_rep_content2_" + id);
|
2015-11-02 20:01:19 +08:00
|
|
|
|
e.select();
|
|
|
|
|
document.execCommand("Copy");
|
|
|
|
|
}
|
2015-10-28 09:23:12 +08:00
|
|
|
|
|
|
|
|
|
function zip(){
|
|
|
|
|
alert("该功能正在紧张的开发中,我们会争取在最短时间内上线,如若对您工作造成不便敬请谅解!")
|
2015-11-17 17:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//取消关联
|
|
|
|
|
function cancel_relation(orgId,projectId){
|
2015-11-18 11:12:40 +08:00
|
|
|
|
if(confirm("确定取消关联吗?") == false) return;
|
2015-11-17 17:34:50 +08:00
|
|
|
|
$.ajax({
|
|
|
|
|
url:'/org_projects/'+orgId+"?project_id="+projectId,
|
|
|
|
|
type:'DELETE',
|
|
|
|
|
success:function(data) {
|
|
|
|
|
$.ajax({
|
2015-11-18 16:52:03 +08:00
|
|
|
|
url: ' /projects/'+projectId+'/search_public_orgs_not_in_project?hint_flag=true',
|
2015-11-17 17:34:50 +08:00
|
|
|
|
type:'get'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-12-15 18:43:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function issueEditShow(){
|
|
|
|
|
$("#issue_detail").hide();
|
|
|
|
|
$("#issue_edit").show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function issueDetailShow(){
|
|
|
|
|
$("#issue_edit").hide();
|
|
|
|
|
$("#issue_detail").show();
|
2015-12-29 11:04:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//项目讨论区提交
|
|
|
|
|
function regexTopicSubject() {
|
|
|
|
|
var name = $("#message_subject").val();
|
|
|
|
|
if(name.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("标题不能为空");
|
|
|
|
|
$("#subjectmsg").css('color','#ff0000');
|
|
|
|
|
$("#message_subject").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length <= 255)
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("填写正确");
|
|
|
|
|
$("#subjectmsg").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("标题超过255个字符");
|
|
|
|
|
$("#subjectmsg").css('color','#ff0000');
|
|
|
|
|
$("#message_subject").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regexTopicDescription()
|
|
|
|
|
{
|
|
|
|
|
var name = message_content_editor.html();
|
|
|
|
|
if(message_content_editor.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
$("#message_content_span").text("描述不能为空");
|
|
|
|
|
$("#message_content_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length >=6000){
|
|
|
|
|
$("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)");
|
|
|
|
|
$("#message_content_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#message_content_span").text("填写正确");
|
|
|
|
|
$("#message_content_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function submit_topic_project()
|
|
|
|
|
{
|
|
|
|
|
if(regexTopicSubject() && regexTopicDescription())
|
|
|
|
|
{
|
|
|
|
|
message_content_editor.sync();
|
|
|
|
|
$("#message-form-project").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reset_topic(){
|
|
|
|
|
|
|
|
|
|
}
|
2016-01-05 11:00:26 +08:00
|
|
|
|
|
|
|
|
|
//查找TAG资源
|
|
|
|
|
var clickFunction = null; //单击事件函数
|
|
|
|
|
var isdb = false; //是否双击
|
|
|
|
|
function search_tag_attachment(url,tag_name,q,course_id,sort)
|
|
|
|
|
{
|
|
|
|
|
//alert("111");
|
|
|
|
|
//clearTimeout(clickFunction);
|
|
|
|
|
clickFunction = setTimeout(function() {
|
|
|
|
|
search_func()
|
|
|
|
|
}, 500);
|
|
|
|
|
function search_func(){
|
|
|
|
|
if(isdb!= false ) return;
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
tag_name: tag_name,
|
|
|
|
|
q: q,
|
|
|
|
|
course_id:course_id
|
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|