186 lines
9.7 KiB
Plaintext
186 lines
9.7 KiB
Plaintext
<script>
|
||
function g(o){return document.getElementById(o);}
|
||
function HoverLi(n){
|
||
//如果有N个标签,就将i<=N;
|
||
for(var i=1;i<=3;i++){
|
||
g('orgSetting_'+i).className='orgSettingOp';
|
||
g('orgContent_'+i).className='undis';}
|
||
g('orgContent_'+n).className='dis ml15 mr15';
|
||
g('orgSetting_'+n).className='orgSettingOp orgOpActive';}
|
||
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
|
||
//]]>
|
||
$checkName = true;
|
||
function check_uniq(id){
|
||
if($("#organization_name").val().trim() == ""){
|
||
$("#check_name_hint").html('<span class="c_red">名字不能为空<span>').show();
|
||
return false ;
|
||
}
|
||
$.get(
|
||
'<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id
|
||
)
|
||
}
|
||
function update_org(id){
|
||
check_uniq(id);
|
||
if( $checkName){
|
||
$("#edit_organization_"+id).submit();
|
||
}
|
||
}
|
||
|
||
</script>
|
||
<div class="homepageRightBanner">
|
||
<div class="NewsBannerName">配置</div>
|
||
</div>
|
||
<div class="resources mt10">
|
||
<ul class="mb10">
|
||
<li class="orgSettingOp orgOpActive" id="orgSetting_1" onclick="HoverLi(1);">信息</li>
|
||
<li class="orgSettingOp" id="orgSetting_2" onclick="HoverLi(2);">成员</li>
|
||
<li class="orgSettingOp" id="orgSetting_3" onclick="HoverLi(3);">栏目</li>
|
||
<li class="orgBorder"></li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<div class="ml15 mr15" id="orgContent_1">
|
||
<!--<div class="orgLogo mb10"><a href="javascript:void(0);"><img src="images/0" width="55" height="55" alt="组织logo" class="mr10 logoBorder fl ml10" /></a>-->
|
||
<!--<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>
|
||
<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="<%= @organization.domain%>" class="orgUrlInput" />
|
||
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
|
||
<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:38px;" >公开 : </span>
|
||
<input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
|
||
</div>
|
||
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
|
||
<% end %>
|
||
</div>
|
||
<div class="undis ml15 mr15" id="orgContent_2">
|
||
<div class="orgMemberList">
|
||
<ul class="orgListRow">
|
||
<li class="orgListUser fb">用户</li>
|
||
<li class="orgListRole fb">角色</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<div id="org_member_list">
|
||
<%= render :partial=>"org_member_list",:locals=> {:members=>@organization.org_members} %>
|
||
</div>
|
||
</div>
|
||
<div class="fr orgMemContainer">
|
||
<div class="orgMemberAdd">
|
||
<p class="fontBlue fb mb5">添加成员</p>
|
||
<%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%>
|
||
<input type="text" id="not_org_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、昵称搜索" class="orgAddSearch mb20" />
|
||
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
|
||
<div id="principals_for_new_member">
|
||
<%= find_user_not_in_current_org_by_name(@project) %>
|
||
</div>
|
||
<div class="cl"></div>
|
||
<ul class="orgAddRole">
|
||
<li class="fontGrey3 fb mb10">角色</li>
|
||
<li>
|
||
<input type="radio" id="orgMng" name="orgRole" value="11" />
|
||
<label for="orgMng">管理人员</label>
|
||
</li>
|
||
<li>
|
||
<input type="radio" id="orgMeb" name="orgRole" checked value="12" />
|
||
<label for="orgMeb">组织成员</label>
|
||
</li>
|
||
</ul><a href="javascript:void(0);" onclick="submit_add_org_members();" class="saveBtn db fl mt10">新增成员</a>
|
||
<% end %>
|
||
</div>
|
||
</div>
|
||
<div class="cl"></div>
|
||
</div>
|
||
<div class="undis ml15 mr15" id="orgContent_3">
|
||
<div class="orgMemberList" id="org_subfield_list">
|
||
<%= render :partial => 'organizations/subfield_list', :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||
:subfields => @organization.org_subfields.where("field_type != 'default'") } %>
|
||
</div>
|
||
<div class="fr orgMemContainer">
|
||
<div class="fr">
|
||
<p class="fontBlue fb mb5">新增栏目</p>
|
||
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
|
||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
|
||
<div class="mb5">
|
||
<p class="fontGrey3"><span class="fb">域名目录</span>(用户自定义url,可选)</p>
|
||
<% if @organization.domain %>
|
||
<span class="fl"><%= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
|
||
<% else %>
|
||
<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
|
||
<% end %>
|
||
<div class="cl"></div>
|
||
</div>
|
||
<ul class="orgAddRole">
|
||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||
<li class="fl mr15">
|
||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||
<label for="orgMng">帖子</label>
|
||
</li>
|
||
<li class="fl">
|
||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||
<label for="orgMeb">资源</label>
|
||
</li>
|
||
<li class="cl"></li>
|
||
</ul>
|
||
<div class="cl"></div>
|
||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||
<% end %>
|
||
</div>
|
||
</div>
|
||
<div class="cl"></div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function add_org_subfield(){
|
||
if ($("#subfield_name").val().trim() != "")
|
||
$("#add_subfield_form").submit();
|
||
}
|
||
var $is_exist = false;
|
||
function apply_subdomain(id, domain){
|
||
var reg = new RegExp("^[a-zA-Z0-9_]{1,}$");
|
||
if (reg.exec(domain)){
|
||
$.ajax({
|
||
url: "<%= check_uniq_domain_organizations_path %>",
|
||
type: 'get',
|
||
data:{
|
||
org_domain:domain
|
||
},
|
||
success:function(){
|
||
if(!$is_exist){
|
||
$.ajax({
|
||
url:"<%= apply_subdomain_organization_path %>",
|
||
type:'post',
|
||
data:{
|
||
id:id,
|
||
domain:domain
|
||
},
|
||
success:function(){
|
||
$("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果");
|
||
}
|
||
});
|
||
}
|
||
else{
|
||
$("#apply_hint").text("您申请的子域名已存在,请重新输入");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
else{
|
||
$("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入");
|
||
}
|
||
}
|
||
</script> |