修复:文章附件和资源栏目下载权限一致
This commit is contained in:
parent
4a9967674a
commit
5088770214
|
@ -2169,7 +2169,7 @@ module ApplicationHelper
|
|||
candown= User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
|
||||
elsif attachment.container.is_a?(OrgSubfield)
|
||||
org = attachment.container.organization
|
||||
candown = User.current.member_of_org?(org) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
|
||||
candown = User.current.member_of_org?(org) || ((attachment.is_public == 1 || attachment.get_status_by_attach(User.current.id) == 2) && org.allow_guest_download == true)
|
||||
elsif attachment.container.is_a?(OrgDocumentComment)
|
||||
org = attachment.container.organization
|
||||
candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="break_word">
|
||||
<span class="fl">
|
||||
<span title="<%= attachment.filename %>" id="attachment_<%=attachment.id %>">
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true -%>
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true %>
|
||||
</span>
|
||||
</span>
|
||||
<span class="postAttSize">(
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
<div class="homepagePostTitle break_word">
|
||||
<%# 如果有历史版本则提供历史版本下载 %>
|
||||
<% if file.attachment_histories.count == 0 %>
|
||||
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
||||
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
||||
<% else %>
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
|
||||
:title => file.filename+"\n"+file.description.to_s,
|
||||
|
|
|
@ -47,52 +47,52 @@
|
|||
<!--<a href="javascript:void(0);" class="logoEnter fl linkGrey4">上传图片</a>-->
|
||||
<%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %>
|
||||
<%= labelled_form_for @organization do |f|%>
|
||||
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<div class="orgRow mb10"><span class="c_red">* </span>组织名称:<input type="text" name="organization[name]" id="organization_name" maxlength="100" onblur="check_uniq(<%=@organization.id %>);" onfocus="$('#check_name_hint').hide()" class="orgNameInput" value="<%= @organization.name%>" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<div class="orgRow mb10"><span class="c_red">* </span>组织名称:<input type="text" name="organization[name]" id="organization_name" maxlength="100" onblur="check_uniq(<%=@organization.id %>);" onfocus="$('#check_name_hint').hide()" class="orgNameInput" value="<%= @organization.name%>" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div style="margin-left: 80px " id="check_name_hint"></div>
|
||||
<div class="orgRow mb10"><span class="ml10">组织描述:</span><textarea type="text" name="organization[description]" class="orgDes" id="org_desc" placeholder="最多3000个汉字(或6000个英文字符)"><%= @organization.description%></textarea>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div style="margin-left: 80px " id="check_desc_hint"></div>
|
||||
<div class="orgRow mb10"><span class="ml10">组织URL:</span>
|
||||
<div class="w607 fr">http://
|
||||
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" onfocus="observe_input_to_lowercase($(this));" />
|
||||
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
|
||||
<% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
|
||||
<% if domain.present? and record.present? and record.content == domain.subname %>
|
||||
<span>(已批准)</span>
|
||||
<% elsif record %>
|
||||
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
|
||||
<% end %>
|
||||
<p class="c_green f12" id="apply_hint" ></p></div>
|
||||
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="orgRow mb10 mt5">
|
||||
<span style="margin-left:10px;" >显示模式 : </span>
|
||||
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
|
||||
<label for="show_mode_ordinary">简洁模式</label>
|
||||
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
|
||||
<label for="show_mode_special">门户模式</label>
|
||||
</div>
|
||||
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开 : </span>
|
||||
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
||||
</div>
|
||||
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持 : </span>
|
||||
<input id="allow_download" type="checkbox" style="margin-top:5px;" <%= @organization.is_public? ? "":"DISABLED" %> name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
|
||||
<span>允许游客下载</span>
|
||||
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
|
||||
</div>
|
||||
<!--<%# if User.current.admin? %>-->
|
||||
<!--<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜 : </span>-->
|
||||
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
|
||||
<!--</div>-->
|
||||
<!--<%# end %>-->
|
||||
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
|
||||
<div class="orgRow mb10"><span class="ml10">组织描述:</span><textarea type="text" name="organization[description]" class="orgDes" id="org_desc" placeholder="最多3000个汉字(或6000个英文字符)"><%= @organization.description%></textarea>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div style="margin-left: 80px " id="check_desc_hint"></div>
|
||||
<div class="orgRow mb10"><span class="ml10">组织URL:</span>
|
||||
<div class="w607 fr">http://
|
||||
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" onfocus="observe_input_to_lowercase($(this));" />
|
||||
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
|
||||
<% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
|
||||
<% if domain.present? and record.present? and record.content == domain.subname %>
|
||||
<span>(已批准)</span>
|
||||
<% elsif record %>
|
||||
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
|
||||
<% end %>
|
||||
<p class="c_green f12" id="apply_hint" ></p></div>
|
||||
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="orgRow mb10 mt5">
|
||||
<span style="margin-left:10px;" >显示模式 : </span>
|
||||
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
|
||||
<label for="show_mode_ordinary">简洁模式</label>
|
||||
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
|
||||
<label for="show_mode_special">门户模式</label>
|
||||
</div>
|
||||
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开 : </span>
|
||||
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
||||
</div>
|
||||
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持 : </span>
|
||||
<input id="allow_download" type="checkbox" style="margin-top:5px;" <%= @organization.is_public? ? "":"DISABLED" %> name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
|
||||
<span>允许游客下载</span>
|
||||
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
|
||||
</div>
|
||||
<!--<%# if User.current.admin? %>-->
|
||||
<!--<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜 : </span>-->
|
||||
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
|
||||
<!--</div>-->
|
||||
<!--<%# end %>-->
|
||||
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="undis ml15 mr15" id="orgContent_2">
|
||||
|
|
Loading…
Reference in New Issue