This commit is contained in:
z9hang 2014-10-21 10:40:14 +08:00
commit 60368341ed
17 changed files with 170 additions and 117 deletions

View File

@ -21,12 +21,15 @@ class CoursesController < ApplicationController
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
before_filter :require_login, :only => [:join, :unjoin]
before_filter :allow_join, :only => [:join]
#before_filter :allow_join, :only => [:join]
def join
if User.current.logged?
course = Course.find(params[:object_id])
unless User.current.member_of_course? course
course = Course.find_by_id params[:object_id]
if course
@state = 4
else
unless (allow_join && User.current.member_of_course?(course))
if params[:course_password] == course.password
members = []
members << Member.new(:role_ids => [10], :user_id => User.current.id)
@ -39,11 +42,11 @@ class CoursesController < ApplicationController
else
@state = 3
end
end
else
@state = 4
@state = 5
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Course.find(params[:object_id]), :object_id => params[:object_id]} }
end
rescue Exception => e

View File

@ -113,7 +113,7 @@ class FilesController < ApplicationController
end
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc "
sort += "#{Attachment.table_name}.#{attribute} asc "
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end

View File

@ -113,7 +113,7 @@ class RepositoriesController < ApplicationController
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword]
@repository_tag=params[:repository][:upassword] || params[:repository][:password]
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name

View File

@ -31,8 +31,8 @@ a:hover{ }
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
</div>
</div>

View File

@ -31,8 +31,8 @@ a:hover{ }
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
</div>
</div>

View File

@ -1,60 +1,75 @@
<!-- added by fq -->
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
/*margin-top: -10px;*/
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
/*margin-top: -10px;*/
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>快速进入课程通道</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
<h3 class="title">加入公开课程或私有课程</h3>
<%= form_tag({:controller => 'courses',
#popbox{width:488px;height:308px;}
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
.C_top p{ color:#a9aaaa; line-height:22px;}
.C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
.C_form ul li input{ margin-left:30px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;}
.C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn:hover{ background:#ff821d;}
</style>
<script type="text/javascript">
function submit_form(obj)
{
hideModal(obj);
$("#new-watcher-form").submit();
}
</script>
</head>
<body>
<div id="popbox">
<div class="C" >
<div class="C_top">
<h2>快速进入课程通道</h2>
<p>只要持有课程ID和密码就课快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦</p>
</div>
<div class="C_form">
<%= form_tag({:controller => 'courses',
:action => 'join'},
:remote => true,
:method => :post,
:id => 'new-watcher-form') do %>
<div>
<span>课程ID</span>
<%= text_field_tag 'object_id', nil, :style=>'width:80%'%>
<span style="padding-left: 55px;color: red;">(课程ID是课程的网址中出现的序号)</span>
</div>
<div>
<span>密码&nbsp;&nbsp;&nbsp;</span>
<%= text_field_tag 'course_password', nil, :style=>'width:80%'%>
<ul>
<li>
<span class="tips">课&nbsp;程&nbsp;ID</span>
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
</li>
<li class="mB5">课程ID是所在课程网址中显示的序号</li>
<li>
<span class="tips">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</span>
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
</li>
<li>
<a href="#" class="btn" onclick="submit_form(this);"><%= l(:label_new_join) %></a>
<a href="#" onclick="hideModal(this);"><%= l(:button_cancel)%></a>
</li>
</ul>
<% end%>
</div>
</div><!---- C end---->
</div>
</body>
</html>
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
<%= submit_tag l(:label_new_join), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);", :type => 'button' %>
</p>
<% end %>

View File

@ -12,7 +12,7 @@
alert("您已经加入了课程");
<% elsif @state == 4 %>
alert("您已经的课程不存在");
<% elsif @state == 4 %>
<% elsif @state == 5 %>
alert("您还未登录");
<% else %>
alert("未知错误,请稍后再试");

View File

@ -1,3 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
showModal('ajax-modal', '400px');
showModal('ajax-modal', '510px');
$('#ajax-modal').addClass('new-watcher');
$('#ajax-modal').css('height','330px');

View File

@ -1,6 +1,7 @@
<h3><%=l(:label_attachment_new)%></h3>
<% attachmenttypes = course.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;">上传出现错误,请您检查您的网络环境,并刷新页面重新上传。</div>
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>
<div class="box">
<p>

View File

@ -17,7 +17,7 @@
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children",:class => "tableth") %>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype",:class => "tableth") %>
<%= content_tag('th', l(:attachment_sufix_browse), id: 'vzebra-contenttype', class: 'tableth', style: 'color: black')%>
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense",:class => "tableth") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action",:class => "tableth") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children",:class => "tableth") %>

View File

@ -19,8 +19,11 @@
</div>
<div>
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<p style="max-width:680px">
<%= f.text_area :description, :required => true, :id => 'editor01' %>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01',{height:300});</script>
</p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
<p style="color: #ff0000">(<%= l(:label_forums_max_length) %>)</p>
</div>
<div class="actions" style=" padding-top: 10px; float:right">

View File

@ -4,10 +4,10 @@
<table class="list" style="table-layout: fixed;">
<thead>
<tr>
<th><%= l(:field_identifier) %></th>
<th><%= l(:field_repository_is_default) %></th>
<th><%= l(:label_scm) %></th>
<th><%= l(:label_repository_path) %></th>
<th style="width: 20%"><%= l(:field_identifier) %></th>
<th style="width: 10%"><%= l(:field_repository_is_default) %></th>
<th style="width: 15%"><%= l(:label_scm) %></th>
<th style="width: 20%"><%= l(:label_repository_path) %></th>
<th></th>
</tr>
</thead>
@ -37,7 +37,7 @@
<% end %>
<% elsif repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<!-- <%= link_to(l(:button_edit), edit_repository_path(repository),
<!-- <%#= link_to(l(:button_edit), edit_repository_path(repository),
:class => 'icon icon-edit') %> -->
<%= link_to(l(:label_user_plural), committers_repository_path(repository),
:class => 'icon icon-user') %>

View File

@ -11,20 +11,31 @@
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p style="display: none"><%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?,
<p style="display: none">
<%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}"%>
<% unless @repository.identifier_frozen? %>
<em class="info" ><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
<em class="info" >
<%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!--Modified by tanxianbo-->
<p><%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url'), :id => "url_text_field" %>
<em class='info'><%= "#{l(:label_exist_repository_path)}" %></em>
<p>
<%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url'), :id => "url_text_field" %>
<em class='info'>
<%= "#{l(:label_exist_repository_path)}" %>
</em>
</p>
<p><%= f.text_field :login, :size => 30 %></p>
<p><%= f.password_field :password, :size => 30, :name => 'ignore', :value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)),
<p>
<%= f.text_field :login, :size => 30 %>
</p>
<p>
<%= f.password_field :password, :size => 30, :name => 'ignore',
:value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)),
:onfocus => "this.value=''; this.name='repository[password]';",
:onchange => "this.name='repository[password]';" %></p>
:onchange => "this.name='repository[password]';" %>
</p>
</div>
<!--Ended by tanxianbo-->
<p>

View File

@ -12,10 +12,16 @@
#end%>
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %>
<span><%= image_tag("/images/sidebar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<span>
<%= image_tag("/images/sidebar/tags.png") %>
</span>
<span class="font_title_tag">
<%= l(:label_tag) %>:
</span>
<% if User.current.logged? %>
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span>
<span>
<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %>
</span>
<% end %>
<div id="tags_show_issue">
@ -36,7 +42,9 @@
<% elsif object_flag == '6' %>
<span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);',
:class => "tags_icona",
:onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
</span>
&nbsp;&nbsp;
@ -47,14 +55,17 @@
<%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
</div>
<% else %>
<span><%= image_tag("/images/sidebar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<span>
<%= image_tag("/images/sidebar/tags.png") %>
</span>
<span class="font_title_tag">
<%= l(:label_tag) %>:
</span>
<% if User.current.logged? %>
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %></span>
<span>
<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %>
</span>
<% end %>
<div id="tags_show">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>

View File

@ -1,20 +1,18 @@
<% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
$('#name-issue').val("");
<% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%>").hide();
//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#put-tag-form #name').val("");
$('#tags_name').val("");
//$('#put-tag-form').hide();
<% end %>

View File

@ -69,6 +69,10 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
})
.fail(function(result) {
progressSpan.text(result.statusText);
if($("#network_issue"))
{
$("#network_issue").show();
}
}).always(function() {
ajaxUpload.uploading--;
fileSpan.removeClass('ajax-loading');

View File

@ -467,6 +467,12 @@ a.attachments_list_color {
font-size: 10pt;
}
.new-watcher{
-webkit-border-radius: 5px;
border-radius: 5px;
box-shadow: 0px 0px 8px #194a81;
}
/************************** 贴吧动态 结束 ****************************/
/************************** 学校课程 开始 ****************************/
.course{