<script>
    function g(o){return document.getElementById(o);}
    function HoverLi(n){
//如果有N个标签,就将i<=N;
        for(var i=1;i<=2;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="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">*&nbsp;</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">https：//-->
            <!--<input type="text" name="organization[domain]" value="<%= @organization.domain%>" class="orgUrlInput" />-->
            <!--.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;">申请</a>-->
            <!--<p id="apply_hint"></p></div>-->
          <!--&lt;!&ndash;class="c_green f12" 您的申请已提交，系统会以消息的形式通知您结果 &ndash;&gt;-->
        <!--</div>-->
        <!--<div class="cl"></div>-->
        <div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </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>