diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 0def8b5f8..a51093ad9 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -1,5 +1,10 @@
+# encoding: utf-8
class OrganizationsController < ApplicationController
+ # before_filter :find_organization, :except => [:show,:new,:index,:create]
layout 'base_org'
+ def index
+
+ end
def new
@organization = Organization.new
render :layout => 'new_base'
@@ -10,18 +15,56 @@ class OrganizationsController < ApplicationController
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.creator_id = User.current.id
- member = OrgMember.new(:user_id => User.current.id, :role => 'Manager')
+ member = OrgMember.new(:user_id => User.current.id)
+
@organization.org_members << member
if @organization.save
+ OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
redirect_to organization_path(@organization)
end
end
def show
-
+ @organization = Organization.find(params[:id])
+ @activities = OrgActivity.where('(org_act_id = ? and org_act_type = ?)', @organization.id, 'CreateOrganization ')
+ @activities = paginateHelper @activities, 10
end
def update
+ @organization = Organization.find(params[:id])
+ @organization.name = params[:organization][:name]
+ @organization.description = params[:organization][:description]
+ @organization.domain = params[:organization][:domain]
+ @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
+ #@organization.name = params[:organization][:name]
+ @organization.save
+ respond_to do |format|
+ format.html { redirect_to setting_organization_path(@organization)}
+ end
+ end
+
+ def check_uniq
+ @check = false;
+ @config_page = params[:config_page]
+ sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
+ if sameName == true
+ @check = true
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def find_organization
+ @organization = Organization.find(params[:id])
+ end
+
+ def setting
+ @organization = Organization.find(params[:id])
+ end
+
+
+ def clear_org_avatar_temp
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 84364b4f6..dbf246141 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -48,6 +48,15 @@ module ApplicationHelper
end
end
end
+ # 获取组织成员中文名字
+ def get_org_member_role_name member
+ case member.roles[0].name
+ when 'orgManager'
+ '组织管理员'
+ when 'orgMember'
+ '组织成员'
+ end
+ end
# Time 2015-03-24 16:38:05
# Author lizanle
diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb
index 24cc9a80e..e10d4026d 100644
--- a/app/helpers/organizations_helper.rb
+++ b/app/helpers/organizations_helper.rb
@@ -1,2 +1,19 @@
+# encoding: utf-8
module OrganizationsHelper
+ include ApplicationHelper
+
+
+ def find_user_not_in_current_org_by_name org
+ if params[:q] && params[:q].lstrip.rstrip != ""
+ scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
+ else
+ scope = []
+ end
+ principals = paginateHelper scope,10
+ s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
+ links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
+ link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true
+ }
+ s + content_tag('ul', links,:class => 'wlist', :id => "org_member_pagination_links" )
+ end
end
diff --git a/app/models/org_member.rb b/app/models/org_member.rb
index c4be034fe..091c20f22 100644
--- a/app/models/org_member.rb
+++ b/app/models/org_member.rb
@@ -1,4 +1,7 @@
class OrgMember < ActiveRecord::Base
attr_accessible :organization_id, :role, :user_id
belongs_to :organization
+ has_many :roles ,:through => :org_member_roles,:foreign_key => 'role_id'
+ has_many :org_member_roles,:dependent => :destroy
+
end
diff --git a/app/models/org_member_role.rb b/app/models/org_member_role.rb
new file mode 100644
index 000000000..0ce4f8141
--- /dev/null
+++ b/app/models/org_member_role.rb
@@ -0,0 +1,5 @@
+class OrgMemberRole < ActiveRecord::Base
+ # attr_accessible :title, :body
+ belongs_to :org_member
+ belongs_to :role
+end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index 39b5900d9..567df954c 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -1,5 +1,13 @@
class Organization < ActiveRecord::Base
attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public
has_many :org_members, :dependent => :destroy
- has_many :projects
+ has_many :org_projects ,:dependent => :destroy
+ has_many :projects,:through => :org_projects
+ has_many :org_document_comments, :dependent => :destroy
+ validates_uniqueness_of :name
+ after_create :save_as_org_activity
+
+ def save_as_org_activity
+ OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization')
+ end
end
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 0f0746f78..fc9c7cac4 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -87,6 +87,16 @@ class Principal < ActiveRecord::Base
end
}
+ scope :not_member_of_org, lambda {|org|
+ orgs = [org] unless org.is_a?(Array)
+ if orgs.empty?
+ where("1=0")
+ else
+ ids = orgs.map(&:id)
+ where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{OrgMember.table_name} WHERE organization_id IN (?))", ids)
+ end
+ }
+
scope :sorted, lambda { order(*Principal.fields_for_order_statement)}
scope :applied_members, lambda {|project|
diff --git a/app/models/project.rb b/app/models/project.rb
index fd1012fa0..0b0420920 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -69,6 +69,7 @@ class Project < ActiveRecord::Base
has_many :applied_projects, :dependent => :destroy
has_many :invite_lists, :dependent => :destroy
has_one :dts
+ has_many :organizations,:through => :org_projects
# end
#ADDED BY NIE
@@ -96,7 +97,8 @@ class Project < ActiveRecord::Base
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
- belongs_to :organization
+ has_many :org_projects,:dependent => :destroy
+ has_many :organization,:through => :org_projects
# has_many :journals
diff --git a/app/models/role.rb b/app/models/role.rb
index 8bf5ebc05..f6a24a27f 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -55,6 +55,8 @@ class Role < ActiveRecord::Base
has_many :member_roles, :dependent => :destroy
has_many :members, :through => :member_roles
+ has_many :org_member_roles, :dependent => :destroy
+ has_many :org_members,:through => :org_member_roles
acts_as_list
serialize :permissions, ::Role::PermissionsAttributeCoder
diff --git a/app/models/user.rb b/app/models/user.rb
index edc29c015..4c6449863 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -94,6 +94,7 @@ class User < Principal
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
has_one :blog, :class_name => 'Blog', :foreign_key => "author_id"
+ has_many :org_document_comments, :dependent =>:destroy
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
index a3829ea3b..d84bd5e8c 100644
--- a/app/views/layouts/base_org.html.erb
+++ b/app/views/layouts/base_org.html.erb
@@ -12,8 +12,8 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
- <%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository' %>
- <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
+ <%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
+ <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
@@ -35,11 +35,24 @@
-
- <%= image_tag(url_to_avatar(@organization), :width=>"60", :height=>"60", :alt=>"组织logo") %>
+
+
+
+
+ <%= image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_user_tx') %>
+ <% if User.current.logged?%>
+ <% if User.current.id == @organization.creator_id%>
+
+ <% end %>
+ <% end%>
组织id:<%= @organization.id %>
-
配置
+
配置
+
@@ -59,94 +72,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- <%= render_flash_messages %>
- <%= yield %>
- <%= call_hook :view_layouts_base_content %>
-
-
diff --git a/app/views/org_member/create.js.erb b/app/views/org_member/create.js.erb
new file mode 100644
index 000000000..d3e8c144e
--- /dev/null
+++ b/app/views/org_member/create.js.erb
@@ -0,0 +1,2 @@
+$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
+$("#principals_for_new_member").html('')
\ No newline at end of file
diff --git a/app/views/org_member/destroy.js.erb b/app/views/org_member/destroy.js.erb
new file mode 100644
index 000000000..8bd949fde
--- /dev/null
+++ b/app/views/org_member/destroy.js.erb
@@ -0,0 +1 @@
+$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
\ No newline at end of file
diff --git a/app/views/org_member/org_member_autocomplete.js.erb b/app/views/org_member/org_member_autocomplete.js.erb
new file mode 100644
index 000000000..b1672038a
--- /dev/null
+++ b/app/views/org_member/org_member_autocomplete.js.erb
@@ -0,0 +1,23 @@
+<% if @org%>
+ var checked = $("#not_org_members input:checked").size();
+ if(checked > 0)
+ {
+ alert('翻页或搜索后将丢失当前选择的用户数据!');
+ }
+ <% if @flag == "true"%>
+ $('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
+ <% else%>
+ $('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
+ <% end%>
+
+<%end%>
+var collection=$("#principals_for_new_member").children("#principals").children("label");
+collection.css("text-overflow","ellipsis");
+collection.css("white-space","nowrap");
+collection.css("width","200px");
+collection.css("overflow","hidden");
+for(i=0;i"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
\ No newline at end of file
diff --git a/app/views/organizations/_new_org_avatar_form.html.erb b/app/views/organizations/_new_org_avatar_form.html.erb
new file mode 100644
index 000000000..8b80641e8
--- /dev/null
+++ b/app/views/organizations/_new_org_avatar_form.html.erb
@@ -0,0 +1,33 @@
+
+
+
+
+<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
+
+<%= file_field_tag 'avatar[image]',
+ :id => 'upload_org_logo',
+ :class => 'undis upload_file',
+ :size => "1",
+ :multiple => true,
+ :data => {
+ :max_file_size => Setting.upload_avatar_max_size,
+ :max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :file_type => Redmine::Configuration['pic_types'].to_s,
+ :type_support_message => l(:error_pic_type),
+ :upload_path => upload_avatar_path(:format => 'js'),
+ :description_placeholder => nil ,# l(:label_optional_description)
+ :source_type => source.class.to_s,
+ :source_id => source.id.to_s
+ } %>
+
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %>
+<% end %>
+
diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb
new file mode 100644
index 000000000..23a31fab3
--- /dev/null
+++ b/app/views/organizations/_org_member_list.html.erb
@@ -0,0 +1,44 @@
+<% members.each do |member|%>
+
+ - <%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %>
+ -
+ <%= get_org_member_role_name member %>
+ <%= form_for(member, {:as => :org_member, :remote => true, :url => org_member_path(member),
+ :method => :put,
+ :html => {:id => "org-member-#{member.id}-roles-form", :style=>'display:none'}}
+ ) do |f| %>
+ <% Role.givable.where("id in (11,12)").each do |role| %>
+
+ <%= radio_button_tag 'org_member[role_ids][]', role.id, member.roles.include?(role) %>
+
+ <% if User.current.language == "zh" %>
+ <% if role.id == 11 %>
+
+ <% elsif role.id == 12 %>
+
+ <% end %>
+ <% else %>
+
+ <% end %>
+
+
+ <% end %>
+ <%= hidden_field_tag 'membership[role_ids][]', '' %>
+
+ <% end %>
+
+ -
+
+ <% if ( (User.current.id == member.organization.creator_id || member.roles[0].name == "orgManager" ) && member.user_id != member.organization.creator_id )%>
+ 编辑 | <%= link_to '删除', org_member_path(member.id),:method=>'delete', :remote => true %><% end %>
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/organizations/check_uniq.js.erb b/app/views/organizations/check_uniq.js.erb
new file mode 100644
index 000000000..2d295c4d1
--- /dev/null
+++ b/app/views/organizations/check_uniq.js.erb
@@ -0,0 +1,18 @@
+<%if @check == false %>
+ $checkName = false
+ <% if @config_page%>
+ $("#check_name_hint").html('名字不能重复').show();
+ <% else%>
+ $("#organization_name_notice").html('名字不能重复').show();
+
+ <%end%>
+
+<% else %>
+ $checkName = true;
+ <% if @config_page%>
+ $("#check_name_hint").html('名字可以使用').show();
+ <% else%>
+
+ $("#organization_name_notice").html('名字可以使用').show();
+ <%end%>
+<%end%>
\ No newline at end of file
diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb
index de8983f02..2496ac133 100644
--- a/app/views/organizations/new.html.erb
+++ b/app/views/organizations/new.html.erb
@@ -12,8 +12,8 @@
-
- 项目名称不能为空
+
+
@@ -55,20 +55,35 @@
var name = $.trim($("#organization_name").val());
if(name.length == 0)
{
- $("#organization_name_notice").show();
+ $("#organization_name_notice").html('名字不能为空').show();
return false;
}
else
{
- $("#organization_name_notice").hide();
+ $("#organization_name_notice").html('').hide();
return true;
}
}
+ var $checkName = false;
+
+ function check_uniq(dom){
+ if($("#organization_name").val().trim() == ""){
+ $("#organization_name_notice").html('名字不能为空').show();
+ return;
+ }
+ $.get(
+ '<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()
+ )
+ }
+
//提交新建项目
function submit_new_organization()
{
- if(regex_organization_name())
+ $.get(
+ '<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()
+ )
+ if(regex_organization_name() && $checkName)
{
$("#new_organization").submit();
}
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
new file mode 100644
index 000000000..61e6b1534
--- /dev/null
+++ b/app/views/organizations/setting.html.erb
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+ <%#= 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} %>
+
+
+
+
+
+
+
组织URL:
+
https://
+
+ .trustie.net
申请
+
+
+
+
+
公开 :
+ class="ml3" />
+
+
保存
+ <% end %>
+
+
+
+
+
+ <%= render :partial=>"org_member_list",:locals=> {:members=>@organization.org_members} %>
+
+
+
+
+
添加成员
+ <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%>
+
+ <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
+
+ <%= find_user_not_in_current_org_by_name(@project) %>
+
+
新增成员
+ <% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb
index 9d38aedc1..2f25ae8a3 100644
--- a/app/views/organizations/show.html.erb
+++ b/app/views/organizations/show.html.erb
@@ -1,4 +1,37 @@
<%= javascript_include_tag "jquery.infinitescroll.js" %>
-
-
组织活动
-
\ No newline at end of file
+
+
+ <% unless @activities.nil? %>
+ <% @activities.each do |act| %>
+ <% if act.org_act_type == 'CreateOrganization' %>
+
+ <% end %>
+ <% end %>
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+ <% end %>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 0394cdb53..639056b94 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -31,7 +31,24 @@ RedmineApp::Application.routes.draw do
# Enable Grack support
# mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
- resources :organizations
+ resources :organizations do
+ member do
+ get 'setting'#, :action => 'settings', :as => 'settings'
+ get 'clear_org_avatar_temp'
+ end
+ collection do
+ get 'check_uniq'
+ end
+ end
+
+ resources :org_member do
+ member do
+
+ end
+ collection do
+ get 'org_member_autocomplete'
+ end
+ end
resources :homework_users
resources :no_uses
diff --git a/db/schema.rb b/db/schema.rb
index 4b6d7ab5d..d75b4f7a4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20151029030006) do
+ActiveRecord::Schema.define(:version => 20151104090032) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -293,6 +293,16 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.boolean "diff_all"
end
+ create_table "columns_priv", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Table_name", :limit => 64, :default => "", :null => false
+ t.string "Column_name", :limit => 64, :default => "", :null => false
+ t.timestamp "Timestamp", :null => false
+ t.string "Column_priv", :limit => 0, :default => "", :null => false
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@@ -491,6 +501,33 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
+ create_table "db", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Select_priv", :limit => 1, :default => "N", :null => false
+ t.string "Insert_priv", :limit => 1, :default => "N", :null => false
+ t.string "Update_priv", :limit => 1, :default => "N", :null => false
+ t.string "Delete_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_priv", :limit => 1, :default => "N", :null => false
+ t.string "Drop_priv", :limit => 1, :default => "N", :null => false
+ t.string "Grant_priv", :limit => 1, :default => "N", :null => false
+ t.string "References_priv", :limit => 1, :default => "N", :null => false
+ t.string "Index_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_tmp_table_priv", :limit => 1, :default => "N", :null => false
+ t.string "Lock_tables_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Show_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Execute_priv", :limit => 1, :default => "N", :null => false
+ t.string "Event_priv", :limit => 1, :default => "N", :null => false
+ t.string "Trigger_priv", :limit => 1, :default => "N", :null => false
+ end
+
+ add_index "db", ["User"], :name => "User"
+
create_table "delayed_jobs", :force => true do |t|
t.integer "priority", :default => 0, :null => false
t.integer "attempts", :default => 0, :null => false
@@ -572,6 +609,31 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
+ create_table "event", :id => false, :force => true do |t|
+ t.string "db", :limit => 64, :default => "", :null => false
+ t.string "name", :limit => 64, :default => "", :null => false
+ t.binary "body", :limit => 2147483647, :null => false
+ t.string "definer", :limit => 77, :default => "", :null => false
+ t.datetime "execute_at"
+ t.integer "interval_value"
+ t.string "interval_field", :limit => 18
+ t.timestamp "created", :null => false
+ t.timestamp "modified", :null => false
+ t.datetime "last_executed"
+ t.datetime "starts"
+ t.datetime "ends"
+ t.string "status", :limit => 18, :default => "ENABLED", :null => false
+ t.string "on_completion", :limit => 8, :default => "DROP", :null => false
+ t.string "sql_mode", :limit => 0, :default => "", :null => false
+ t.string "comment", :limit => 64, :default => "", :null => false
+ t.integer "originator", :null => false
+ t.string "time_zone", :limit => 64, :default => "SYSTEM", :null => false
+ t.string "character_set_client", :limit => 32
+ t.string "collation_connection", :limit => 32
+ t.string "db_collation", :limit => 32
+ t.binary "body_utf8", :limit => 2147483647
+ end
+
create_table "first_pages", :force => true do |t|
t.string "web_title"
t.string "title"
@@ -623,6 +685,21 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.integer "locked"
end
+ create_table "func", :primary_key => "name", :force => true do |t|
+ t.boolean "ret", :default => false, :null => false
+ t.string "dl", :limit => 128, :default => "", :null => false
+ t.string "type", :limit => 9, :null => false
+ end
+
+ create_table "general_log", :id => false, :force => true do |t|
+ t.timestamp "event_time", :null => false
+ t.text "user_host", :limit => 16777215, :null => false
+ t.integer "thread_id", :null => false
+ t.integer "server_id", :null => false
+ t.string "command_type", :limit => 64, :null => false
+ t.text "argument", :limit => 16777215, :null => false
+ end
+
create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false
t.integer "user_id", :null => false
@@ -630,6 +707,35 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
+ create_table "help_category", :primary_key => "help_category_id", :force => true do |t|
+ t.string "name", :limit => 64, :null => false
+ t.integer "parent_category_id", :limit => 2
+ t.text "url", :null => false
+ end
+
+ add_index "help_category", ["name"], :name => "name", :unique => true
+
+ create_table "help_keyword", :primary_key => "help_keyword_id", :force => true do |t|
+ t.string "name", :limit => 64, :null => false
+ end
+
+ add_index "help_keyword", ["name"], :name => "name", :unique => true
+
+ create_table "help_relation", :id => false, :force => true do |t|
+ t.integer "help_topic_id", :null => false
+ t.integer "help_keyword_id", :null => false
+ end
+
+ create_table "help_topic", :primary_key => "help_topic_id", :force => true do |t|
+ t.string "name", :limit => 64, :null => false
+ t.integer "help_category_id", :limit => 2, :null => false
+ t.text "description", :null => false
+ t.text "example", :null => false
+ t.text "url", :null => false
+ end
+
+ add_index "help_topic", ["name"], :name => "name", :unique => true
+
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
@@ -714,6 +820,29 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.datetime "updated_at", :null => false
end
+ create_table "host", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "Select_priv", :limit => 1, :default => "N", :null => false
+ t.string "Insert_priv", :limit => 1, :default => "N", :null => false
+ t.string "Update_priv", :limit => 1, :default => "N", :null => false
+ t.string "Delete_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_priv", :limit => 1, :default => "N", :null => false
+ t.string "Drop_priv", :limit => 1, :default => "N", :null => false
+ t.string "Grant_priv", :limit => 1, :default => "N", :null => false
+ t.string "References_priv", :limit => 1, :default => "N", :null => false
+ t.string "Index_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_tmp_table_priv", :limit => 1, :default => "N", :null => false
+ t.string "Lock_tables_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Show_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Execute_priv", :limit => 1, :default => "N", :null => false
+ t.string "Trigger_priv", :limit => 1, :default => "N", :null => false
+ end
+
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@@ -943,6 +1072,15 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
+ create_table "ndb_binlog_index", :primary_key => "epoch", :force => true do |t|
+ t.integer "Position", :limit => 8, :null => false
+ t.string "File", :null => false
+ t.integer "inserts", :limit => 8, :null => false
+ t.integer "updates", :limit => 8, :null => false
+ t.integer "deletes", :limit => 8, :null => false
+ t.integer "schemaops", :limit => 8, :null => false
+ end
+
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@@ -1037,11 +1175,53 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.integer "project_id"
end
+ create_table "org_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "org_act_id"
+ t.string "org_act_type"
+ t.integer "container_id"
+ t.string "container_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_document_comments", :force => true do |t|
+ t.string "title"
+ t.text "content"
+ t.integer "organization_id"
+ t.integer "creator_id"
+ t.integer "parent_id"
+ t.integer "reply_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.boolean "locked", :default => false
+ t.integer "sticky", :default => 0
+ end
+
+ create_table "org_member_roles", :force => true do |t|
+ t.integer "org_member_id"
+ t.integer "role_id"
+ end
+
+ create_table "org_members", :force => true do |t|
+ t.integer "user_id"
+ t.integer "organization_id"
+ end
+
+ create_table "org_projects", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "project_id"
+ end
+
create_table "organizations", :force => true do |t|
t.string "name"
- t.string "logo_link"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.text "description"
+ t.integer "creator_id"
+ t.integer "home_id"
+ t.string "domain"
+ t.boolean "is_public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "phone_app_versions", :force => true do |t|
@@ -1051,6 +1231,10 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.datetime "updated_at", :null => false
end
+ create_table "plugin", :primary_key => "name", :force => true do |t|
+ t.string "dl", :limit => 128, :default => "", :null => false
+ end
+
create_table "poll_answers", :force => true do |t|
t.integer "poll_question_id"
t.text "answer_text"
@@ -1126,6 +1310,42 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.datetime "updated_at", :null => false
end
+ create_table "proc", :id => false, :force => true do |t|
+ t.string "db", :limit => 64, :default => "", :null => false
+ t.string "name", :limit => 64, :default => "", :null => false
+ t.string "type", :limit => 9, :null => false
+ t.string "specific_name", :limit => 64, :default => "", :null => false
+ t.string "language", :limit => 3, :default => "SQL", :null => false
+ t.string "sql_data_access", :limit => 17, :default => "CONTAINS_SQL", :null => false
+ t.string "is_deterministic", :limit => 3, :default => "NO", :null => false
+ t.string "security_type", :limit => 7, :default => "DEFINER", :null => false
+ t.binary "param_list", :null => false
+ t.binary "returns", :limit => 2147483647, :null => false
+ t.binary "body", :limit => 2147483647, :null => false
+ t.string "definer", :limit => 77, :default => "", :null => false
+ t.timestamp "created", :null => false
+ t.timestamp "modified", :null => false
+ t.string "sql_mode", :limit => 0, :default => "", :null => false
+ t.text "comment", :null => false
+ t.string "character_set_client", :limit => 32
+ t.string "collation_connection", :limit => 32
+ t.string "db_collation", :limit => 32
+ t.binary "body_utf8", :limit => 2147483647
+ end
+
+ create_table "procs_priv", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Routine_name", :limit => 64, :default => "", :null => false
+ t.string "Routine_type", :limit => 9, :null => false
+ t.string "Grantor", :limit => 77, :default => "", :null => false
+ t.string "Proc_priv", :limit => 0, :default => "", :null => false
+ t.timestamp "Timestamp", :null => false
+ end
+
+ add_index "procs_priv", ["Grantor"], :name => "Grantor"
+
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@@ -1200,6 +1420,18 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
+ create_table "proxies_priv", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Proxied_host", :limit => 60, :default => "", :null => false
+ t.string "Proxied_user", :limit => 16, :default => "", :null => false
+ t.boolean "With_grant", :default => false, :null => false
+ t.string "Grantor", :limit => 77, :default => "", :null => false
+ t.timestamp "Timestamp", :null => false
+ end
+
+ add_index "proxies_priv", ["Grantor"], :name => "Grantor"
+
create_table "queries", :force => true do |t|
t.integer "project_id"
t.string "name", :default => "", :null => false
@@ -1313,6 +1545,17 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.integer "is_teacher_score", :default => 0
end
+ create_table "servers", :primary_key => "Server_name", :force => true do |t|
+ t.string "Host", :limit => 64, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "Username", :limit => 64, :default => "", :null => false
+ t.string "Password", :limit => 64, :default => "", :null => false
+ t.integer "Port", :default => 0, :null => false
+ t.string "Socket", :limit => 64, :default => "", :null => false
+ t.string "Wrapper", :limit => 64, :default => "", :null => false
+ t.string "Owner", :limit => 64, :default => "", :null => false
+ end
+
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@@ -1333,6 +1576,20 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.string "description"
end
+ create_table "slow_log", :id => false, :force => true do |t|
+ t.timestamp "start_time", :null => false
+ t.text "user_host", :limit => 16777215, :null => false
+ t.time "query_time", :null => false
+ t.time "lock_time", :null => false
+ t.integer "rows_sent", :null => false
+ t.integer "rows_examined", :null => false
+ t.string "db", :limit => 512, :null => false
+ t.integer "last_insert_id", :null => false
+ t.integer "insert_id", :null => false
+ t.integer "server_id", :null => false
+ t.text "sql_text", :limit => 16777215, :null => false
+ end
+
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@@ -1414,6 +1671,19 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.string "subject"
end
+ create_table "tables_priv", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "Db", :limit => 64, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Table_name", :limit => 64, :default => "", :null => false
+ t.string "Grantor", :limit => 77, :default => "", :null => false
+ t.timestamp "Timestamp", :null => false
+ t.string "Table_priv", :limit => 0, :default => "", :null => false
+ t.string "Column_priv", :limit => 0, :default => "", :null => false
+ end
+
+ add_index "tables_priv", ["Grantor"], :name => "Grantor"
+
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
@@ -1463,6 +1733,32 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
+ create_table "time_zone", :primary_key => "Time_zone_id", :force => true do |t|
+ t.string "Use_leap_seconds", :limit => 1, :default => "N", :null => false
+ end
+
+ create_table "time_zone_leap_second", :primary_key => "Transition_time", :force => true do |t|
+ t.integer "Correction", :null => false
+ end
+
+ create_table "time_zone_name", :primary_key => "Name", :force => true do |t|
+ t.integer "Time_zone_id", :null => false
+ end
+
+ create_table "time_zone_transition", :id => false, :force => true do |t|
+ t.integer "Time_zone_id", :null => false
+ t.integer "Transition_time", :limit => 8, :null => false
+ t.integer "Transition_type_id", :null => false
+ end
+
+ create_table "time_zone_transition_type", :id => false, :force => true do |t|
+ t.integer "Time_zone_id", :null => false
+ t.integer "Transition_type_id", :null => false
+ t.integer "Offset", :default => 0, :null => false
+ t.integer "Is_DST", :limit => 1, :default => 0, :null => false
+ t.string "Abbreviation", :limit => 8, :default => "", :null => false
+ end
+
create_table "tokens", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.string "action", :limit => 30, :default => "", :null => false
@@ -1481,6 +1777,51 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
t.integer "fields_bits", :default => 0
end
+ create_table "user", :id => false, :force => true do |t|
+ t.string "Host", :limit => 60, :default => "", :null => false
+ t.string "User", :limit => 16, :default => "", :null => false
+ t.string "Password", :limit => 41, :default => "", :null => false
+ t.string "Select_priv", :limit => 1, :default => "N", :null => false
+ t.string "Insert_priv", :limit => 1, :default => "N", :null => false
+ t.string "Update_priv", :limit => 1, :default => "N", :null => false
+ t.string "Delete_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_priv", :limit => 1, :default => "N", :null => false
+ t.string "Drop_priv", :limit => 1, :default => "N", :null => false
+ t.string "Reload_priv", :limit => 1, :default => "N", :null => false
+ t.string "Shutdown_priv", :limit => 1, :default => "N", :null => false
+ t.string "Process_priv", :limit => 1, :default => "N", :null => false
+ t.string "File_priv", :limit => 1, :default => "N", :null => false
+ t.string "Grant_priv", :limit => 1, :default => "N", :null => false
+ t.string "References_priv", :limit => 1, :default => "N", :null => false
+ t.string "Index_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_priv", :limit => 1, :default => "N", :null => false
+ t.string "Show_db_priv", :limit => 1, :default => "N", :null => false
+ t.string "Super_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_tmp_table_priv", :limit => 1, :default => "N", :null => false
+ t.string "Lock_tables_priv", :limit => 1, :default => "N", :null => false
+ t.string "Execute_priv", :limit => 1, :default => "N", :null => false
+ t.string "Repl_slave_priv", :limit => 1, :default => "N", :null => false
+ t.string "Repl_client_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Show_view_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Alter_routine_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_user_priv", :limit => 1, :default => "N", :null => false
+ t.string "Event_priv", :limit => 1, :default => "N", :null => false
+ t.string "Trigger_priv", :limit => 1, :default => "N", :null => false
+ t.string "Create_tablespace_priv", :limit => 1, :default => "N", :null => false
+ t.string "ssl_type", :limit => 9, :default => "", :null => false
+ t.binary "ssl_cipher", :null => false
+ t.binary "x509_issuer", :null => false
+ t.binary "x509_subject", :null => false
+ t.integer "max_questions", :default => 0, :null => false
+ t.integer "max_updates", :default => 0, :null => false
+ t.integer "max_connections", :default => 0, :null => false
+ t.integer "max_user_connections", :default => 0, :null => false
+ t.string "plugin", :limit => 64, :default => ""
+ t.text "authentication_string"
+ end
+
create_table "user_activities", :force => true do |t|
t.string "act_type"
t.integer "act_id"
diff --git a/public/javascripts/org.js b/public/javascripts/org.js
new file mode 100644
index 000000000..f74277a9e
--- /dev/null
+++ b/public/javascripts/org.js
@@ -0,0 +1,34 @@
+//֯Աύ
+function submit_add_org_members(){
+ $("#org_member_add_form").submit();
+}
+
+function observeSearchfield(fieldId, targetId, url) {
+ $('#'+fieldId).each(function() {
+ var $this = $(this);
+ $this.addClass('autocomplete');
+ $this.attr('data-value-was', $this.val());
+ var check = function() {
+ var val = $this.val();
+ if ($this.attr('data-value-was') != val){
+ $this.attr('data-value-was', val);
+ $.ajax({
+ url: url,
+ type: 'get',
+ data: {q: $this.val()},
+ success: function(data){ if(targetId) $('#'+targetId).html(data); },
+ beforeSend: function(){ $this.addClass('ajax-loading'); },
+ complete: function(){ $this.removeClass('ajax-loading'); }
+ });
+ }
+ };
+ var reset = function() {
+ if (timer) {
+ clearInterval(timer);
+ timer = setInterval(check, 300);
+ }
+ };
+ var timer = setInterval(check, 300);
+ $this.bind('keyup click mousemove', reset);
+ });
+}
\ No newline at end of file
diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css
index b1dfbbcf0..8d9275f31 100644
--- a/public/stylesheets/org.css
+++ b/public/stylesheets/org.css
@@ -3,4 +3,31 @@
.orgName {width:130px; color:#484848;}
.organization_r_h02{ width:970px; height:40px; background:#eaeaea; margin-bottom:10px;}
-.organization_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
\ No newline at end of file
+.organization_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
+
+.orgSettingOp {width:45px; height:21px; color:#269ac9; text-align:center; border-bottom:3px solid #e4e4e4; float:left; font-weight:bold; cursor:pointer;}
+.orgBorder {width:628px; height:21px; border-bottom:3px solid #e4e4e4; float:left;}
+.orgOpActive {border-bottom:3px solid #269ac9 !important; color:#444444;}
+.logoBorder {border:1px solid #eaeaea; padding:2px;}
+.logoBorder:hover {border:1px solid #269ac9;}
+.logoEnter {border:1px solid #eaeaea; padding:2px 5px; margin-top:37px;}
+.orgNameInput {width:600px; outline:none; border:1px solid #eaeaea; float:right; height:22px;}
+.orgRow {font-size:14px; color:#484848;}
+.orgDes {width:600px; height:150px; outline:none; border:1px solid #eaeaea; float:right; resize:none;}
+.w607 {width:607px;}
+.orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;}
+a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;}
+a.saveBtn:hover {background-color:#297fb8;}
+.orgMemberList {width:410px; float:left;}
+.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;}
+.orgListUser {width:125px; float:left;}
+.orgListRole {width:285px; float:left;}
+.orgMemContainer {width:278px;}
+.orgMemberAdd {float:right; width:240px;}
+.orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;}
+.undis {display:none;}
+.dis {display:inline-block;}
+.upbtn { margin: 40px 0px 0px 15px;
+ display: block;
+ padding: 2px 5px;
+ border: 1px solid #EAEAEA;}
\ No newline at end of file