Merge branch 'develop' into dev_hjq

Conflicts:
	db/schema.rb
	public/stylesheets/share.css
This commit is contained in:
ouyangxuhua 2016-01-13 09:58:14 +08:00
commit 7bcf995eaf
25 changed files with 313 additions and 229 deletions

View File

@ -10,7 +10,7 @@ class AvatarController < ApplicationController
unless request.content_type == 'application/octet-stream'
@source_type = params[:source_type]
@source_id = params[:source_id]
@temp_file = params[:avatar][:image]
@temp_file = params[:avatar][:image]
@image_file = @temp_file.original_filename
else
unless request.raw_post.nil?
@ -23,7 +23,7 @@ class AvatarController < ApplicationController
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
else
@image_file=params[:filename]
end
end
@temp_file = StringIO.new(@temp_file)
end
end

View File

@ -39,17 +39,17 @@ class CoursesController < ApplicationController
end
limit = 15
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id)
@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
# if course_org_ids.empty?
# @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
# @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
# else
# course_org_ids = "(" + course_org_ids.join(',') + ")"
# @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
# @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
# end
# @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
#@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
#@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations.where("name like ?",condition).page((params[:page].to_i || 1)).per(limit)
@org_count = @orgs_not_in_course.count
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids} and organizations.name like ?", condition).page((params[:page].to_i || 1)).per(limit)
@org_count = @orgs_not_in_course.empty? ? 0 : @orgs_not_in_course.count
end
@course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
@orgs_page = Paginator.new @org_count, limit,params[:page]
@hint_flag = params[:hint_flag]
#render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json

View File

@ -230,6 +230,7 @@ class FilesController < ApplicationController
@order = ""
@is_remote = false
if params[:project_id]
@page = params[:page] ? params[:page].to_i + 1 : 2
@container_type = 0
if params[:sort]
params[:sort].split(",").each do |sort_type|
@ -827,6 +828,6 @@ class FilesController < ApplicationController
end
def upload_files_menu
p 1
end
end

View File

@ -412,6 +412,7 @@ class IssuesController < ApplicationController
if params[:issue_id]
@issue_id = params[:issue_id]
end
@priorities = IssuePriority.active
respond_to do |format|
format.js
end

View File

@ -357,7 +357,7 @@ update
@changesets = g.commits(@project.gpid, :ref_name => @rev)
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_all_count = @project.gpid.nil? ? 0 : g.commits_total_count(@project.gpid).count
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
@changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories

View File

@ -59,6 +59,19 @@ module ApplicationHelper
end
end
# 判断组织左侧展开或者隐藏
def is_hide_org_left obj
if obj.nil?
return true
else
if obj.hide == 0
return true
else
return false
end
end
end
# Time 2015-03-24 16:38:05
# Author lizanle
# Description after save后需要进行资源记录的更新
@ -2771,8 +2784,7 @@ int main(int argc, char** argv){
#代码提交数量
def changesets_num project
g = Gitlab.client
project.gpid.nil? ? 0 : g.commits_total_count(project.gpid).count
# # commits_total_count(project.gpid)
project.gpid.nil? ? 0 : g.project(project.gpid).commit_count
# project.changesets.count
end
end

View File

@ -37,7 +37,10 @@
<ul class="mt10">
<%=labelled_form_for @new_course do |f| %>
<input name="copy_course" value="<%=@course.id %>" style="display: none"/>
<li class="ml45 mb10"> <a href="javascript:void(0)" class="upimg fl"> <img alt="上传图片" id="avatar_image" src="images/courses/pic_courses.jpg" height="60" width="60"> </a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
<li class="ml45 mb10">
<a href="javascript:void(0)" class="upimg fl">
<%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
</a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
<!--</span>-->
<div class="cl"></div>
</li>

View File

@ -12,13 +12,14 @@
</div>
<div class="cl"></div>
<div class="mt15 grey_c lh22">
<%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "term_btn fl" %>
<!--<a href="javascript:" class="term_btn fl" onclick="copyTerm();">
复制学期
</a>-->
<div class="disable_btn fl">
<!--<div class="disable_btn fl">
<span style="display: inline-block">复制学期</span>
<span style="display: inline-block">(开发中...)</span>
</div>
</div>-->
复制学期将为您创建一个新的课程学期,新学期将继承本学期的相关资源,具体您稍后可以选择。
</div>
<div class="cl"></div>

View File

@ -1,3 +1,6 @@
if(document.getElementById("popbox02")) {
hideModal("#popbox02");
}
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'copy_course') %>');
showModal('ajax-modal', '730px');
$('#ajax-modal').css('height','530px').css('width','730px');

View File

@ -123,7 +123,7 @@
<div class="cl"></div>
</div>
<div id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments, :page=>2} %>
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -45,8 +45,17 @@
<% end %>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<% if project_attachments.count == 10%>
<% if params[:action] == 'search_project' %>
<!--<ul class="wlist">-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>-->
<!--</ul>-->
<%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%else%>
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
<%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%end%>
<% end%>

View File

@ -1,5 +1,5 @@
<% if @project %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/upload_project_files_on_navbar',:locals => {:container => @project}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_project_files',:locals => {:project => @project,:project_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");

View File

@ -1,6 +1,21 @@
<% if @issue_id %> //issue详情中回复
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
"no_label":true,
"at_id":<%= @issue.project_id%>,
"at_type":"Project",
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
"emotionsBasePath":'<%= Setting.host_name%>',
"height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%");

View File

@ -148,7 +148,7 @@
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="fl mr20 fontGrey3 w80">
<div class="fl mr20 fontGrey3">
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<div class="cl"></div>
@ -173,7 +173,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%=changesets_num project %>提交</p>
<p><%=time_from_now time %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

View File

@ -37,10 +37,10 @@
<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %>
<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %>
<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %>
<div class="homepageLeftMenuBlock" style="display:<%= org_activity_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_activity_field.id %>">
<div class="homepageLeftMenuBlock" style="display:<%= is_hide_org_left(org_activity_field) ? 'block':'none' %>;" id="org_subfield_<%= org_activity_field.id %>">
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
</div>
<div style="display:<%= org_project_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_project_field.id %>">
<div style="display:<%= is_hide_org_left(org_project_field) ? 'block':'none' %>;" id="org_subfield_<%= org_project_field.id %>">
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
@ -54,7 +54,7 @@
</ul>
</div>
</div>
<div style="display:<%= org_course_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_course_field.id %>">
<div style="display:<%= is_hide_org_left(org_course_field) ? 'block':'none' %>;" id="org_subfield_<%= org_course_field.id %>">
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>

View File

@ -148,7 +148,7 @@
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="fl mr20 fontGrey3 w80">
<div class="fl mr20 fontGrey3">
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<div class="cl"></div>
@ -173,7 +173,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%=changesets_num project %>提交</p>
<p><%=time_from_now time %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
@ -300,4 +300,4 @@
</div>
<script type="text/javascript">
$(description_show_hide(<%=user_activity_id %>));
</script>
</script>

View File

@ -1,10 +1,8 @@
<div class="boxContainer">
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>');">
<option value="1">课程</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
@ -20,13 +18,13 @@
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_project_input" value="<%= @search %>" name="search" placeholder="输入项目ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids %>')
</script>
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag add_exist_file_to_project_user_path(user),:remote=>true,:id=>'projects_list_form' %>
<%= form_tag add_exist_file_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>

View File

@ -5,7 +5,7 @@
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
</div>
<div class="fl">
<p class="homepageImageName mb5" style="max-width:88px;"><%= user %></p>
<p class="homepageImageName mb5" style="max-width:88px;font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;"><%= user %></p>
<span class="homepageImageSex"></span>
<div class="cl"></div>
<p class="mb8 c_dark f14">

View File

@ -150,7 +150,7 @@
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = homework_common.student_work_projects.where("is_leader = 1") %>
<div class="fl mr20 fontGrey3 w80">
<div class="fl mr20 fontGrey3">
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<div class="cl"></div>
@ -174,7 +174,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%=changesets_num project %>提交</p>
<p><%=time_from_now time %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

View File

@ -1,11 +1,4 @@
//var popupHeight = $(".resourceSharePopup").outerHeight(true);
//$(".resourceSharePopup").css("marginTop",-popupHeight/2);
//
//$("#upload_box").css('left','').css('top','');
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_for_project_popup" ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
//$("#upload_box").css('display','block');
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");

View File

@ -6,6 +6,9 @@
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px");
<% end %>
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");

View File

@ -1,9 +1,9 @@
class ChangeAttachmentHistory < ActiveRecord::Migration
def up
attachments = Attachment.where("container_type =?", "Version")
attachments.each do |am|
am.update_attribute(:container_type, "Project") unless am.nil?
end
# attachments = Attachment.where("container_type =?", "Version")
# attachments.each do |am|
# am.update_attribute(:container_type, "Project") unless am.nil?
# end
end
def down

View File

@ -5,6 +5,8 @@ module Trustie
module Gitlab
module ManageMember
attr :g
include Helper
def self.included(base)
base.class_eval {
before_create :add_gitlab_member

View File

@ -2,210 +2,217 @@
Copyright (C) 2006-2013 Jean-Philippe Lang
Modified by Jianfeng Tao, to upload one avatar for user*/
function addFile(inputEl, file, eagerUpload) {
var fileSpan = $('#avatar_file');
//fileSpan.append(
// $('<input>', { type: 'text', 'class': 'filename readonly', name: 'avatar[filename]', readonly: 'readonly'} ).val(file.name),
// $('<a>&nbsp</a>').attr({ href: "#", 'class': 'remove-upload' }).click(removeFile).toggle(!eagerUpload)
//).appendTo('#avatar_fields');
(function(){
if(eagerUpload) {
ajaxUpload(file, fileSpan, inputEl);
function addFile(inputEl, file, eagerUpload) {
var fileSpan = $('#avatar_file');
//fileSpan.append(
// $('<input>', { type: 'text', 'class': 'filename readonly', name: 'avatar[filename]', readonly: 'readonly'} ).val(file.name),
// $('<a>&nbsp</a>').attr({ href: "#", 'class': 'remove-upload' }).click(removeFile).toggle(!eagerUpload)
//).appendTo('#avatar_fields');
if(eagerUpload) {
ajaxUpload(file, fileSpan, inputEl);
}
return 1;
}
return 1;
}
function ajaxUpload(file, fileSpan, inputEl) {
function ajaxUpload(file, fileSpan, inputEl) {
function onLoadstart(e) {
fileSpan.removeClass('ajax-waiting');
fileSpan.addClass('ajax-loading');
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
}
function onLoadstart(e) {
fileSpan.removeClass('ajax-waiting');
fileSpan.addClass('ajax-loading');
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
}
function onProgress(e) {
if(e.lengthComputable) {
this.progressbar( 'value', e.loaded * 100 / e.total );
}
}
function onProgress(e) {
if(e.lengthComputable) {
this.progressbar( 'value', e.loaded * 100 / e.total );
function actualUpload(file, fileSpan, inputEl) {
ajaxUpload.uploading++;
uploadBlob(file, $(inputEl).data('upload-path'),$(inputEl).data('source-type'), $(inputEl).data('source-id'),{
loadstartEventHandler: onLoadstart.bind(progressSpan),
progressEventHandler: onProgress.bind(progressSpan)
})
.done(function(result) {
progressSpan.progressbar( 'value', 100 );
progressSpan.progressbar( 'destroy');
fileSpan.find('input.description, a').css('display', 'inline-block');
})
.fail(function(result) {
progressSpan.text(result.statusText);
}).always(function() {
ajaxUpload.uploading--;
fileSpan.removeClass('ajax-loading');
var form = fileSpan.parents('form');
// if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
// $('input:submit', form).removeAttr('disabled');
// }
// form.dequeue('upload');
});
}
var progressSpan = $('#upload_progressbar');
progressSpan.progressbar();
fileSpan.addClass('ajax-waiting');
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
actualUpload(file, fileSpan, inputEl);
else
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, fileSpan, inputEl));
}
}
function actualUpload(file, fileSpan, inputEl) {
ajaxUpload.uploading = 0;
ajaxUpload.uploading++;
function removeFile() {
$(this).parent('span').remove();
return false;
}
uploadBlob(file, $(inputEl).data('upload-path'),$(inputEl).data('source-type'), $(inputEl).data('source-id'),{
loadstartEventHandler: onLoadstart.bind(progressSpan),
progressEventHandler: onProgress.bind(progressSpan)
})
.done(function(result) {
progressSpan.progressbar( 'value', 100 );
progressSpan.progressbar( 'destroy');
fileSpan.find('input.description, a').css('display', 'inline-block');
})
.fail(function(result) {
progressSpan.text(result.statusText);
}).always(function() {
ajaxUpload.uploading--;
fileSpan.removeClass('ajax-loading');
var form = fileSpan.parents('form');
function uploadBlob(blob, uploadUrl, source_type,source_id, options) {
// if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
// $('input:submit', form).removeAttr('disabled');
// }
// form.dequeue('upload');
});
}
var actualOptions = $.extend({
loadstartEventHandler: $.noop,
progressEventHandler: $.noop
}, options);
uploadUrl = uploadUrl + '?source_type=' + source_type + '&source_id=' + source_id;
if (blob instanceof window.File) {
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
}
var progressSpan = $('#upload_progressbar');
progressSpan.progressbar();
fileSpan.addClass('ajax-waiting');
return $.ajax(uploadUrl, {
type: 'POST',
contentType: 'application/octet-stream',
beforeSend: function(jqXhr) {
jqXhr.setRequestHeader('Accept', 'application/js');
},
xhr: function() {
var xhr = $.ajaxSettings.xhr();
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
xhr.upload.onprogress = actualOptions.progressEventHandler;
return xhr;
},
data: blob,
cache: false,
processData: false
});
}
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
actualUpload(file, fileSpan, inputEl);
else
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, fileSpan, inputEl));
}
ajaxUpload.uploading = 0;
function removeFile() {
$(this).parent('span').remove();
return false;
}
function uploadBlob(blob, uploadUrl, source_type,source_id, options) {
var actualOptions = $.extend({
loadstartEventHandler: $.noop,
progressEventHandler: $.noop
}, options);
uploadUrl = uploadUrl + '?source_type=' + source_type + '&source_id=' + source_id;
if (blob instanceof window.File) {
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
}
return $.ajax(uploadUrl, {
type: 'POST',
contentType: 'application/octet-stream',
beforeSend: function(jqXhr) {
jqXhr.setRequestHeader('Accept', 'application/js');
},
xhr: function() {
var xhr = $.ajaxSettings.xhr();
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
xhr.upload.onprogress = actualOptions.progressEventHandler;
return xhr;
},
data: blob,
cache: false,
processData: false
});
}
function addInputAvatar(inputEl) {
window.addInputAvatar = function(inputEl) {
// var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) {
// upload files using ajax
uploadAndAttachFiles(inputEl.files, inputEl);
// $(inputEl).remove();
} else {
// browser not supporting the file API, upload on form submission
var avatarId;
var aFilename = inputEl.value.split(/\/|\\/);
avatarId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
if (avatarId) {
$(inputEl).attr({ name: 'avatar[file]', style: 'display:none;' }).appendTo('#avatar_image');
if (inputEl.files) {
// upload files using ajax
uploadAndAttachFiles(inputEl.files, inputEl);
// $(inputEl).remove();
} else {
// browser not supporting the file API, upload on form submission
var avatarId;
var aFilename = inputEl.value.split(/\/|\\/);
avatarId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
if (avatarId) {
$(inputEl).attr({ name: 'avatar[file]', style: 'display:none;' }).appendTo('#avatar_image');
}
}
//clearedFileInput.insertAfter('#avatars_fields');
}
}
//clearedFileInput.insertAfter('#avatars_fields');
}
function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
var sizeExceeded = false;
$.each(files, function() {
if (this.size && maxFileSize && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
});
if (sizeExceeded) {
window.alert(maxFileSizeExceeded);
} else {
uploadAndTypeFiles(files,inputEl);
//$.each(files, function() {addFile(inputEl, this, true);});
}
}
function uploadAndTypeFiles(files, inputEl) {
var enableType = $(inputEl).data('file-type');
var typeSupportrdMessage = $(inputEl).data('type-support-message');
if (enableType == null || enableType.trim() == "")
{
$.each(files, function() {addFile(inputEl, this, true);});
return;
var sizeExceeded = false;
$.each(files, function() {
if (this.size && maxFileSize && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
});
if (sizeExceeded) {
window.alert(maxFileSizeExceeded);
} else {
uploadAndTypeFiles(files,inputEl);
//$.each(files, function() {addFile(inputEl, this, true);});
}
}
var typeSupported = false;
$.each(files, function() {
var a = this.name.split('.');
var type = a[a.length-1];
var rs = enableType.indexOf(type);
if(rs >= 0) {typeSupported = true }
});
if (typeSupported) {
$.each(files, function() {addFile(inputEl, this, true);});
} else {
window.alert(typeSupportrdMessage + enableType);
function uploadAndTypeFiles(files, inputEl) {
var enableType = $(inputEl).data('file-type');
var typeSupportrdMessage = $(inputEl).data('type-support-message');
if (enableType == null || enableType.trim() == "")
{
$.each(files, function() {addFile(inputEl, this, true);});
return;
}
var typeSupported = false;
$.each(files, function() {
var a = this.name.split('.');
var type = a[a.length-1];
var rs = enableType.indexOf(type);
if(rs >= 0) {typeSupported = true }
});
if (typeSupported) {
$.each(files, function() {addFile(inputEl, this, true);});
} else {
window.alert(typeSupportrdMessage + enableType);
}
}
}
function handleFileDropEvent(e) {
$(this).removeClass('fileover');
blockEventPropagation(e);
if ($.inArray('Files', e.dataTransfer.types) > -1) {
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
}
}
function dragOverHandler(e) {
$(this).addClass('fileover');
blockEventPropagation(e);
}
function handleFileDropEvent(e) {
$(this).removeClass('fileover');
blockEventPropagation(e);
function dragOutHandler(e) {
$(this).removeClass('fileover');
blockEventPropagation(e);
}
if ($.inArray('Files', e.dataTransfer.types) > -1) {
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
}
}
function setupFileDrop() {
$('#avatar_image').on('click', function(){
console.log("click");
});
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
function dragOverHandler(e) {
$(this).addClass('fileover');
blockEventPropagation(e);
}
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
function dragOutHandler(e) {
$(this).removeClass('fileover');
blockEventPropagation(e);
}
$('form div.box').has('input:file').each(function() {
$(this).on({
dragover: dragOverHandler,
dragleave: dragOutHandler,
drop: handleFileDropEvent
});
});
}
}
function setupFileDrop() {
console.log("setupFileDrop");
$('#avatar_image').on('click', function(){
console.log("click");
});
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
$('form div.box').has('input:file').each(function() {
$(this).on({
dragover: dragOverHandler,
dragleave: dragOutHandler,
drop: handleFileDropEvent
});
});
}
}
$(document).ready(setupFileDrop);
})();
$(document).ready(setupFileDrop);

View File

@ -66,16 +66,22 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml15{ margin-left:15px;}
.ml16{ margin-left: 16px;}
.ml20{ margin-left:20px;}
.ml30{margin-left:30px !important;}
.ml35{margin-left: 35px;}
.ml40{ margin-left:40px;}
.ml45{ margin-left:45px;}
.ml48{ margin-left:48px;}
.ml53{margin-left:53px;}
.ml55{ margin-left:55px;}
.ml58{margin-left:58px;}
.ml30{ margin-left:30px;}
.ml38{ margin-left:38px;}
.ml60{ margin-left:60px;}
.ml160 {margin-left:160px;}
.ml80{ margin-left:80px;}
.ml85{margin-left:85px;}
.ml90{ margin-left:90px;}
.ml95{margin-left:95px;}
.ml100{ margin-left:100px;}
.ml110{ margin-left:110px;}
.ml125 { margin-left:125px;}
@ -161,6 +167,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.h70{ height:70px;}
.h150{ height:150px;}
.p10 {padding-left:10px; padding-right:10px;}
.mw400 {max-width: 400px;}
/* Font & background Color */
a.b_grey{ background: #F5F5F5;}
@ -295,6 +302,7 @@ a:hover.bgreen_n_btn{background:#08a384;}
.blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;}
.orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;}
.bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;}
.grey_border{border:1px solid #dddddd !important; }
/* commonpic */
.pic_date{ display:block; background:url(../images/new_project/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;}
.pic_add{ display:block; background:url(../images/new_project/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;}
@ -497,7 +505,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageFollowCancel {background:url(../images/homepage_icon.png) -178px -8px no-repeat; width:20px; height:20px; position:absolute; right:9px; top:9px;}
.homepageEditProfile {width:16px; height:16px; border-radius:2px; background-color:#888888; position:absolute; right:5px; bottom:5px; font-size:12px; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5;}
.homepageEditProfileIcon {background:url(../images/homepage_icon.png) -14px -37px no-repeat; width:16px; height:16px; display:block;}
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:25px; float:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:25px; float:left;}
.homepageImageSex {top:116px; left:5px; width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
.homepageImageSex2 {top:116px; left:5px; width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -150px no-repeat; float:left;}
.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:10px; margin-bottom:12px; width:208px;}
@ -665,6 +673,9 @@ a.loginChooseTab {color:#484848; height:30px; display:block;}
.referenceTypeActive {background-color:#269ac9; color:#ffffff !important;}
a.referenceTypeBlock {color:#888888; display:inline-block; padding:0px 20px;}
/*复制课程弹窗*/
.copyCoursePopup {width:750px !important; height:auto !important; border:3px solid #269ac9 !important; padding-left:16px !important; padding-right:16px !important; padding-bottom:16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
/*底部*/
#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;}
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
@ -959,12 +970,37 @@ span.at a{color:#269ac9;text-decoration: none;}
.sectionContent li:hover {background-color:#cccccc;}
.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
/*新课程、项目资源库*/
.reCon{ margin:5px; width:710px;}
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}
.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;}
.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;}
.blueBtn:hover {background-color:#298fbd;}
/*文本描述展开高度*/
.maxh360 {max-height: 810px;}
.lh18 { line-height: 18px;}
/*151228样式更新*/
.menuSetting {background:url(../images/hwork_icon.png) -5px -132px no-repeat; display:inline-block; width:20px; height:20px;}
.boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);}
a.greyBtn{ display:inline-block; background:#f2f3f3; padding:0px 5px; height:20px; border:1px solid #d3d3d3; color:#888888; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.greyBtn{border:1px solid #888888; }
a.blueBtn{ display:inline-block; background:#269ac9; padding:0px 5px; height:20px; border:1px solid #269ac9; color:#ffffff; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a.blueBtn:hover {background-color:#298fbd;}
a.cancelBtn{ display:inline-block; background:#c1c1c1; padding:0px 5px; height:20px; border:1px solid #d3d3d3; color:#ffffff; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a.cancelBtn:hover {background:#888888;}
a.userFollow{ display:inline-block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -9px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.userFollow{border:1px solid #888888; }
a.userCancel{ display:inline-block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -177px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.userCancel{border:1px solid #888888; }
.pAbsolute {position:absolute; z-index:999;}
.userAvatarWrap {width:50px; height:50px; position:relative; border:1px solid #cbcbcb; padding: 2px;}
.userAvatarWrap:hover {border:1px solid #269ac9;}
.mr27 {margin-right:27px;}
.userCard {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px; top:-176px; left:-95px; position:absolute; z-index:999; display:none;}
.userCard font {display:block; border-width:8px; position:absolute; bottom:-16px; left:110px; border-style:solid dashed dashed dashed; border-color:#FFF transparent transparent transparent; font-size:0; line-height:0;}
.userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;}
.userCardM {width:201px; height:20px; border:1px solid #dddddd; resize:none;}
.resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;}