Skip to content
Browse files

V1.0.1 - added support for embedded docs. improved nav

  • Loading branch information...
1 parent a182b70 commit 05ea8fa008c6a1377751a3043915187f14e4d75f @derailed committed
Showing with 3,485 additions and 183 deletions.
  1. +10 −1 HISTORY
  2. +2 −0 README.rdoc
  3. +2 −2 bin/mongo3
  4. +1 −1 lib/app.rb
  5. +2 −10 lib/controllers/collections.rb
  6. +13 −1 lib/controllers/databases.rb
  7. +19 −2 lib/controllers/explore.rb
  8. +32 −0 lib/helpers/collection_helper.rb
  9. +0 −5 lib/helpers/explore_helper.rb
  10. +5 −0 lib/helpers/main_helper.rb
  11. +15 −0 lib/helpers/paths_helper.rb
  12. +1 −1 lib/mongo3.rb
  13. +39 −24 lib/mongo3/connection.rb
  14. +10 −4 lib/mongo3/user.rb
  15. +24 −8 lib/mongo3/zone.rb
  16. BIN lib/public/images/favicon.png
  17. BIN lib/public/images/information.png
  18. BIN lib/public/images/tree/Thumbs.db
  19. BIN lib/public/images/tree/array.png
  20. BIN lib/public/images/tree/arrow_refresh.png
  21. BIN lib/public/images/tree/collapsable-last.gif
  22. BIN lib/public/images/tree/collapsable.gif
  23. BIN lib/public/images/tree/collection.png
  24. BIN lib/public/images/tree/cross.png
  25. BIN lib/public/images/tree/disk.png
  26. BIN lib/public/images/tree/expandable-last.gif
  27. BIN lib/public/images/tree/expandable-last.png
  28. BIN lib/public/images/tree/expandable.gif
  29. BIN lib/public/images/tree/expandable.png
  30. BIN lib/public/images/tree/folder_add.png
  31. BIN lib/public/images/tree/folder_delete.png
  32. BIN lib/public/images/tree/folder_edit.png
  33. BIN lib/public/images/tree/icons.png
  34. BIN lib/public/images/tree/leaf-last.gif
  35. BIN lib/public/images/tree/leaf-last.png
  36. BIN lib/public/images/tree/leaf.gif
  37. BIN lib/public/images/tree/leaf.png
  38. BIN lib/public/images/tree/line_bg.gif
  39. BIN lib/public/images/tree/line_bg_over.gif
  40. BIN lib/public/images/tree/line_bg_over_last.gif
  41. BIN lib/public/images/tree/minus.gif
  42. BIN lib/public/images/tree/page_add.png
  43. BIN lib/public/images/tree/page_delete.png
  44. BIN lib/public/images/tree/page_edit.png
  45. BIN lib/public/images/tree/plus.gif
  46. BIN lib/public/images/tree/root.gif
  47. BIN lib/public/images/tree/spacer.gif
  48. BIN lib/public/images/tree/spinner.gif
  49. BIN lib/public/images/tree/tree_line.gif
  50. +451 −0 lib/public/javascripts/jquery.simple.tree.js
  51. +6 −0 lib/public/javascripts/jquery.tiptip.min.js
  52. +1 −0 lib/public/javascripts/jquery.tree.min.js
  53. +2,058 −0 lib/public/javascripts/jstree/jquery.tree.js
  54. BIN lib/public/javascripts/themes/mongo3/bg.jpg
  55. BIN lib/public/javascripts/themes/mongo3/dot_for_ie.gif
  56. BIN lib/public/javascripts/themes/mongo3/icons.png
  57. +39 −0 lib/public/javascripts/themes/mongo3/style.css
  58. BIN lib/public/javascripts/themes/mongo3/throbber.gif
  59. +194 −61 lib/public/stylesheets/mongo3.css
  60. +1 −1 lib/views/collections/_fields_form.erb
  61. +1 −1 lib/views/collections/_index_form.erb
  62. +40 −15 lib/views/collections/_index_rows.erb
  63. 0 lib/views/collections/_nodes.erb
  64. +4 −4 lib/views/collections/_results.erb
  65. +2 −2 lib/views/collections/{_rows.erb → _rows_table.erb}
  66. +81 −0 lib/views/collections/_rows_tree.erb
  67. +1 −1 lib/views/collections/_search_form.erb
  68. +20 −0 lib/views/collections/blee.erb
  69. +1 −1 lib/views/collections/list.erb
  70. +1 −1 lib/views/collections/update.js.erb
  71. +9 −7 lib/views/databases/_results.erb
  72. +21 −4 lib/views/explore/_node_info.erb
  73. +11 −1 lib/views/explore/explore.erb
  74. +1 −0 lib/views/explore/load_collection.js.erb
  75. +1 −0 lib/views/explore/load_database.js.erb
  76. +13 −7 lib/views/layout.erb
  77. +2 −2 lib/views/users/_results.erb
  78. +20 −0 spec/configs/crap.yml
  79. +4 −0 spec/configs/hosed.yml
  80. +9 −0 spec/configs/landscape.yml
  81. +0 −3 spec/landscape.yml
  82. +105 −12 spec/mongo3/connection_spec.rb
  83. +38 −0 spec/mongo3/node_spec.rb
  84. +72 −0 spec/mongo3/user_spec.rb
  85. +69 −0 spec/mongo3/zone_spec.rb
  86. +20 −0 spec/mongo3_spec.rb
  87. +13 −0 spec/spec_helper.rb
  88. +1 −1 tasks/setup.rb
View
11 HISTORY
@@ -26,4 +26,13 @@
o Added user administration - should be able to crub users on zone now
o Added mongo based session store using mongo_rack. (Per Kyle's suggestion! ). This is now the default session store.
You can alternatively still use memcache ( see README for instructions )
- o Bug fixes and some cleanup
+ o Bug fixes and some cleanup
+
+0.0.8 - Bug fixes and clean up
+
+0.0.9 - Bug fixes and clean up
+
+0.1.0 - Big improvements!
+ o Added better support for docs and embedded docs.
+ o Change navigation to make it easier to drilldown.
+ o More tests
View
2 README.rdoc
@@ -34,8 +34,10 @@
* CRUD on dbs, collections, indexes [done]
* Administer users [done]
* Collection rename
+* Database creation
* Manage logs
* Support for shards and replication
+* Add support for drilling down array and embedded documents [done]
== DEPENDENCIES
View
4 bin/mongo3
@@ -44,7 +44,7 @@ Main {
end
# default port
- def default_port() 6666; end
+ def default_port() 6663; end
# sleepy time...
def sleep_time() 3; end
@@ -74,4 +74,4 @@ Main {
end
opts
end
-}
+}
View
2 lib/app.rb
@@ -14,7 +14,7 @@
# Configurations
configure :production do
- set :logging, false
+ set :logging, true
end
configure do
View
12 lib/controllers/collections.rb
@@ -3,6 +3,7 @@
module Collections
# ---------------------------------------------------------------------------
+ # BOZO - Move to indexes ctrl
post "/collections/create_index/" do
json = params[:index].gsub( /'/, "\"" )
tokens = json.split( "|" )
@@ -34,7 +35,7 @@ module Collections
# ---------------------------------------------------------------------------
# Paginate on a collection
get "/collections/:page" do
- @back_url = "/explore/back"
+ @back_url = "/databases/1"
@page = params[:page].to_i || 1
@indexes = options.connection.indexes_for( session[:path_names] )
@@ -46,9 +47,6 @@ module Collections
# ---------------------------------------------------------------------------
post "/collections/refresh/:page/" do
- selected_cols = params[:cols].keys.sort
- session[:selected_cols] = selected_cols
-
load_cltn( params[:page].to_i )
erb :'collections/update.js', :layout => false
@@ -119,12 +117,6 @@ def load_cltn( page=1 )
path_names = session[:path_names]
@cltn = options.connection.paginate_cltn( path_names, query_params, @page, 15 )
- @cols = []
- @selected_cols = []
- unless @cltn.empty?
- @cols = @cltn.first.keys.sort
- @selected_cols = session[:selected_cols] || @cols[0...5]
- end
end
end
end
View
14 lib/controllers/databases.rb
@@ -4,7 +4,19 @@ module Databases
get "/databases/:page" do
page = params[:page].to_i || 1
path_names = session[:path_names]
-
+ tokens = path_names.split( "|" )
+
+ # Could be we have a cltn path. if so adjust for it
+ if tokens.size > 3
+ tokens.pop
+ session[:path_names] = tokens.join( "|")
+ path_names = session[:path_names]
+ path_ids = session[:path_ids].split( "|" )
+ path_ids.pop
+ session[:path_ids] = path_ids.join( "|" )
+ end
+
+puts "DB PATH #{path_names.inspect}"
@cltns = options.connection.paginate_db( path_names, page, 10 )
@back_url = "/explore/back"
View
21 lib/controllers/explore.rb
@@ -7,7 +7,7 @@ module Explore
@node_id = params[:db_id]
db_name = params[:db_name].gsub( /\(\d+\)/, '' )
- options.connection.drop_database( session[:path_names], db_name )
+ options.connection.drop_db( "#{session[:path_names]}|#{db_name}" )
flash_it!( :info, "Database `#{db_name} was dropped successfully!" )
@@ -43,14 +43,16 @@ module Explore
crumbs_from_path( path_ids, path_names )
+puts "PATHS #{path_names} -- #{@node_id}"
@root = options.connection.build_partial_tree( path_names )
+Mongo3::Node.dump( @root )
@nodes = @root.find( @node_id ).children
erb :'explore/explore'
end
# -----------------------------------------------------------------------------
- get '/explore/show/:path_ids/:path_names' do
+ get '/explore/info/:path_ids/:path_names' do
path_ids = params[:path_ids]
path_names = params[:path_names]
@@ -78,6 +80,21 @@ module Explore
erb :'explore/more_data_js', :layout => false
end
+ # ---------------------------------------------------------------------------
+ get "/explore/show/:path_ids/:path_names" do
+ path_ids = params[:path_ids]
+ path_names = params[:path_names]
+
+ # crumbs_from_path( path_ids, path_names )
+ update_paths!( path_ids, path_names )
+
+ if cltn_path?( path_ids )
+ erb :'explore/load_collection.js', :layout => false
+ else
+ erb :'explore/load_database.js', :layout => false
+ end
+ end
+
# -----------------------------------------------------------------------------
get '/explore/update_crumb/:path_ids/:path_names' do
path_ids = params[:path_ids]
View
32 lib/helpers/collection_helper.rb
@@ -15,6 +15,38 @@ module CollectionHelper
helpers do
include WillPaginate::ViewHelpers::Base
+ def format_nodes( item, col )
+ buff = []
+ _format_nodes( buff, item, col )
+ buff.join( "\n" )
+ end
+
+ def _format_nodes( buff, item, col=nil )
+ if item.is_a?( Array )
+ buff << "<li><ins style=\"background-position:-48px -16px\"></ins><span>#{col} <span class=\"meta\" style=\"color:#c1c1c1\">(#{item.size})</span></span>"
+ return buff if item.empty?
+ buff << "<ul>"
+ count = 0
+ item.each do |element|
+ _format_nodes( buff, element )
+ count += 1
+ end
+ buff << "</ul>"
+ buff << "</li>"
+ elsif item.is_a?( Hash )
+ buff << "<li><ins style=\"background-position:-48px -16px\"></ins><span>#{col} (#{item.size})</span>"
+ return buff if item.empty?
+ buff << "<ul>"
+ item.each_pair do |key,val|
+ _format_nodes( buff, val, key )
+ end
+ buff << "</ul>"
+ buff << "</li>"
+ else
+ buff << "<li><ins></ins><span title=\"#{item.to_s}\">#{truncate(item.to_s,90)} <span class=\"meta\" style=\"color:#c1c1c1\">#{col ? "[#{col} - #{item.class}]" : "[#{item.class}]"}</span></span></li>"
+ end
+ end
+
# Attempts to format an attribute to some human readable format
def format_value( value )
if value.is_a?( Fixnum)
View
5 lib/helpers/explore_helper.rb
@@ -1,11 +1,6 @@
module ExploreHelper
helpers do
-
- # looking at zone path?
- def zone_path?( path )
- path.split( "|" ).size == 1
- end
# compute legend title
def legend_title( path )
View
5 lib/helpers/main_helper.rb
@@ -61,6 +61,11 @@ def display_info( info )
end
def partial( page, options={} )
+ if object = options.delete(:object)
+ template = page.to_s.split("/").last
+ options.merge!( :locals => { template.to_sym => object } )
+ end
+
if page.to_s.index( /\// )
page = page.to_s.gsub( /\//, '/_' )
else
View
15 lib/helpers/paths_helper.rb
@@ -1,6 +1,21 @@
module PathHelper
helpers do
+ # looking at zone path?
+ def zone_path?( path )
+ path.split( "|" ).size == 1
+ end
+
+ # looking at db path?
+ def db_path?( path )
+ path.split( "|" ).size == 3
+ end
+
+ # looking at cltn path?
+ def cltn_path?( path )
+ path.split( "|" ).size == 4
+ end
+
def reset_paths!
session[:path_ids] = "home"
session[:path_names] = "home"
View
2 lib/mongo3.rb
@@ -1,7 +1,7 @@
module Mongo3
# :stopdoc:
- VERSION = '0.0.9' unless defined? Mongo3::VERSION
+ VERSION = '0.1.0' unless defined? Mongo3::VERSION
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR unless defined? Mongo3::LIBPATH
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR unless defined? Mongo3::PATH
# :startdoc:
View
63 lib/mongo3/connection.rb
@@ -1,6 +1,8 @@
require 'yaml'
# BOZO !! Time to refact no?
+# TODO !! Arg check and errors
+# TODO !! Add logging
module Mongo3
class Connection
@@ -8,15 +10,7 @@ def initialize( config_file )
@config_file = config_file
end
- # drop a database using context and db name
- def drop_database( path_names, db_name )
- path_name_tokens = path_names.split( "|" )
- zone = path_name_tokens[1]
- connect_for( zone ) do |con|
- con.drop_database( db_name )
- end
- end
-
+ # drop a db using a db path
def drop_db( path_names )
path_name_tokens = path_names.split( "|" )
zone = path_name_tokens[1]
@@ -42,12 +36,12 @@ def indexes_for( path_names )
def drop_index( path_names, index )
path_name_tokens = path_names.split( "|" )
- zone = path_name_tokens[1]
+ zone = path_name_tokens[1]
connect_for( zone ) do |con|
cltn_name = path_name_tokens.pop
db_name = path_name_tokens.pop
db = con.db( db_name )
- cltn = db[cltn_name]
+ cltn = db[cltn_name]
cltn.drop_index( index )
end
end
@@ -84,7 +78,7 @@ def clear_cltn( path_names )
db_name = path_name_tokens.pop
db = con.db( db_name )
cltn = db[cltn_name]
- cltn.remove
+ cltn.remove( {} )
end
end
@@ -96,7 +90,7 @@ def delete_row( path_names, id )
db_name = path_name_tokens.pop
db = con.db( db_name )
cltn = db[cltn_name]
- cltn.remove( {:_id => Mongo::ObjectID.from_string(id) } )
+ res = cltn.remove( {:_id => Mongo::ObjectID.from_string(id) } )
end
end
@@ -150,7 +144,7 @@ def show( path_names )
end
def paginate_db( path_names, page=1, per_page=10 )
- path_name_tokens = path_names.split( "|" )
+ path_name_tokens = path_names.split( "|" )
zone = path_name_tokens[1]
list = nil
connect_for( zone ) do |con|
@@ -189,7 +183,15 @@ def paginate_cltn( path_names, query_params=[{},[]], page=1, per_page=10 )
list = WillPaginate::Collection.create( page, per_page, count ) do |pager|
offset = (page-1)*per_page
sort = query_params.last.empty? ? [ ['_id', Mongo::DESCENDING] ] : query_params.last
- results = cltn.find( query_params.first,
+ query = query_params.first
+
+ # Scan for regexes...
+ query.each_pair do |k,v|
+ if v.is_a?( String ) and v.index( /^\// )
+ query[k] = Regexp.new( v.gsub( "/", '' ) )
+ end
+ end
+ results = cltn.find( query,
:sort => sort,
:skip => offset,
:limit => per_page ).to_a
@@ -398,14 +400,23 @@ def database_names( con )
# Connects to mongo given an zone
def connect_for( zone, &block )
info = landscape[zone]
- # puts ">>> Connecting for #{zone} -- #{info['host']}-#{info['port']}"
- con = Mongo::Connection.new( info['host'], info['port'], { :slave_ok => true } )
+ raise "Unable to find zone info in config file for zone `#{zone}" unless info
+ raise "Check your config. Unable to find `host information" unless info['host']
+ raise "Check your config. Unable to find `port information" unless info['port']
+
+ begin
+ con = Mongo::Connection.new( info['host'], info['port'], { :slave_ok => true } )
- if info['user'] and info['password']
- con.db( 'admin' ).authenticate( info['user'], info['password'] )
+ if info['user'] and info['password']
+ con.db( 'admin' ).authenticate( info['user'], info['password'] )
+ end
+ yield con
+ con.close()
+ rescue => boom
+ # puts boom
+ # puts boom.backtrace.each {|l| puts l }
+ raise "MongoDB connection failed for `#{info['host'].inspect}:#{info['port'].inspect}"
end
- yield con
- con.close()
end
# db request occurs within dist 2
@@ -461,10 +472,14 @@ def slave_zone?( tokens )
# Initialize the mongo installation landscape
def config
unless @config
- @config = YAML.load_file( @config_file )
+ begin
+ @config = YAML.load_file( @config_file )
+ rescue => boom
+ @config = nil
+ raise "Unable to grok yaml landscape file. #{boom}"
+ end
end
@config
- end
-
+ end
end
end
View
14 lib/mongo3/user.rb
@@ -8,19 +8,25 @@ class User < Mongo3::Zone
# add a new user
def add( path, user_name, password )
connect_for( path ) do |con|
- admin_db = con.db('admin')
- user_cltn = admin_db[Mongo::DB::SYSTEM_USER_COLLECTION]
+ user_cltn = users( con )
row = { :user => user_name }
user = user_cltn.find_one( row )
raise "User #{user_name} already exists!" if user
- row[:pwd] = admin_db.send( :hash_password, user_name, password )
- user_cltn.save( row )
+ row[:pwd] = user_cltn.db.send( :hash_password, user_name, password )
+ return user_cltn.save( row )
end
end
+ def clear!( path )
+ connect_for( path ) do |con|
+ res = users( con ).remove( {} )
+ end
+ end
+
def rename( zone, old_name, new_name )
+ raise "NYI"
end
def delete( path, id )
View
32 lib/mongo3/zone.rb
@@ -15,20 +15,31 @@ def zone_for_path( path )
end
# Connects to mongo given an zone
+ # BOZO !! Shit is dupped in connection. Fix it !!
def connect_for( path, &block )
- zone = zone_for_path( path )
+ zone = zone_for_path( path )
info = config[zone]
- # puts ">>> Connecting for #{zone} -- #{info['host']}-#{info['port']}"
- con = Mongo::Connection.new( info['host'], info['port'], { :slave_ok => true } )
+ raise "Unable to find zone info in config file for zone `#{zone}" unless info
+ raise "Check your config. Unable to find `host information" unless info['host']
+ raise "Check your config. Unable to find `port information" unless info['port']
+
+ con = nil
+ begin
+ con = Mongo::Connection.new( info['host'], info['port'], { :slave_ok => true } )
- if info['user'] and info['password']
- con.db( 'admin' ).authenticate( info['user'], info['password'] )
- end
- yield con
+ if info['user'] and info['password']
+ con.db( 'admin' ).authenticate( info['user'], info['password'] )
+ end
+ rescue => boom
+ raise "MongoDB connection failed for `#{info['host']}:#{info['post']}"
+ end
+
+ yield con
con.close()
end
# find zone matching the host and port combination
+ # BOZO !! Dupped in connection. Fix it !!
def zone_for( host, port )
config.each_pair do |zone, info|
return zone if info['host'] == host and info['port'] == port.to_i
@@ -39,7 +50,12 @@ def zone_for( host, port )
# Initialize the mongo installation landscape
def config
unless @config
- @config = YAML.load_file( @config_file )
+ begin
+ @config = YAML.load_file( @config_file )
+ rescue => boom
+ @config = nil
+ raise "Unable to grok yaml landscape file. #{boom}"
+ end
end
@config
end
View
BIN lib/public/images/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/information.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/Thumbs.db
Binary file not shown.
View
BIN lib/public/images/tree/array.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/arrow_refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/collapsable-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/collapsable.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/collection.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/cross.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/disk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/expandable-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/expandable-last.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/expandable.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/expandable.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/folder_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/folder_delete.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/folder_edit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/icons.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/leaf-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/leaf-last.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/leaf.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/leaf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/line_bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/line_bg_over.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/line_bg_over_last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/minus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/public/images/tree/page_add.png
Diff not rendered.
View
BIN lib/public/images/tree/page_delete.png
Diff not rendered.
View
BIN lib/public/images/tree/page_edit.png
Diff not rendered.
View
BIN lib/public/images/tree/plus.gif
Diff not rendered.
View
BIN lib/public/images/tree/root.gif
Diff not rendered.
View
BIN lib/public/images/tree/spacer.gif
Diff not rendered.
View
BIN lib/public/images/tree/spinner.gif
Diff not rendered.
View
BIN lib/public/images/tree/tree_line.gif
Diff not rendered.
View
451 lib/public/javascripts/jquery.simple.tree.js
@@ -0,0 +1,451 @@
+/*
+* jQuery SimpleTree Drag&Drop plugin
+* Update on 22th May 2008
+* Version 0.3
+*
+* Licensed under BSD <http://en.wikipedia.org/wiki/BSD_License>
+* Copyright (c) 2008, Peter Panov <panov@elcat.kg>, IKEEN Group http://www.ikeen.com
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the Peter Panov, IKEEN Group nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY Peter Panov, IKEEN Group ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL Peter Panov, IKEEN Group BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+$.fn.simpleTree = function(opt){
+ return this.each(function(){
+ var TREE = this;
+ var ROOT = $('.root',this);
+ var mousePressed = false;
+ var mouseMoved = false;
+ var dragMoveType = false;
+ var dragNode_destination = false;
+ var dragNode_source = false;
+ var dragDropTimer = false;
+ var ajaxCache = Array();
+
+ TREE.option = {
+ drag: true,
+ animate: false,
+ autoclose: false,
+ speed: 'fast',
+ afterAjax: false,
+ afterMove: false,
+ afterClick: false,
+ afterDblClick: false,
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu cliks available
+ afterContextMenu: false,
+ docToFolderConvert:false
+ };
+ TREE.option = $.extend(TREE.option,opt);
+ $.extend(this, {getSelected: function(){
+ return $('span.active', this).parent();
+ }});
+ TREE.closeNearby = function(obj)
+ {
+ $(obj).siblings().filter('.folder-open, .folder-open-last').each(function(){
+ var childUl = $('>ul',this);
+ var className = this.className;
+ this.className = className.replace('open','close');
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed);
+ }else{
+ childUl.hide();
+ }
+ });
+ };
+ TREE.nodeToggle = function(obj)
+ {
+ var childUl = $('>ul',obj);
+ if(childUl.is(':visible')){
+ obj.className = obj.className.replace('open','close');
+
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed);
+ }else{
+ childUl.hide();
+ }
+ }else{
+ obj.className = obj.className.replace('close','open');
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed, function(){
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
+ });
+ }else{
+ childUl.show();
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
+ }
+ }
+ };
+ TREE.setAjaxNodes = function(node, parentId, callback)
+ {
+ if($.inArray(parentId,ajaxCache) == -1){
+ ajaxCache[ajaxCache.length]=parentId;
+ var url = $.trim($('>li', node).text());
+ if(url && url.indexOf('url:'))
+ {
+ url=$.trim(url.replace(/.*\{url:(.*)\}/i ,'$1'));
+ $.ajax({
+ type: "GET",
+ url: url,
+ contentType:'html',
+ cache:false,
+ success: function(responce){
+ node.removeAttr('class');
+ node.html(responce);
+ $.extend(node,{url:url});
+ TREE.setTreeNodes(node, true);
+ if(typeof TREE.option.afterAjax == 'function')
+ {
+ TREE.option.afterAjax(node);
+ }
+ if(typeof callback == 'function')
+ {
+ callback(node);
+ }
+ }
+ });
+ }
+
+ }
+ };
+ TREE.setTreeNodes = function(obj, useParent){
+ obj = useParent? obj.parent():obj;
+ $('li>span', obj).addClass('text')
+ .bind('selectstart', function() {
+ return false;
+ }).click(function(){
+ $('.active',TREE).attr('class','text');
+ if(this.className=='text')
+ {
+ this.className='active';
+ }
+ if(typeof TREE.option.afterClick == 'function')
+ {
+ TREE.option.afterClick($(this).parent());
+ }
+ return false;
+ }).dblclick(function(){
+ mousePressed = false;
+ TREE.nodeToggle($(this).parent().get(0));
+ if(typeof TREE.option.afterDblClick == 'function')
+ {
+ TREE.option.afterDblClick($(this).parent());
+ }
+ return false;
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu actions
+ // available
+ }).bind("contextmenu",function(){
+ $('.active',TREE).attr('class','text');
+ if(this.className=='text')
+ {
+ this.className='active';
+ }
+ if(typeof TREE.option.afterContextMenu == 'function')
+ {
+ TREE.option.afterContextMenu($(this).parent());
+ }
+ return false;
+ }).mousedown(function(event){
+ mousePressed = true;
+ cloneNode = $(this).parent().clone();
+ var LI = $(this).parent();
+ if(TREE.option.drag)
+ {
+ $('>ul', cloneNode).hide();
+ $('body').append('<div id="drag_container"><ul></ul></div>');
+ $('#drag_container').hide().css({opacity:'0.8'});
+ $('#drag_container >ul').append(cloneNode);
+ $("<img>").attr({id : "tree_plus",src : "images/plus.gif"}).css({width: "7px",display: "block",position: "absolute",left : "5px",top: "5px", display:'none'}).appendTo("body");
+ $(document).bind("mousemove", {LI:LI}, TREE.dragStart).bind("mouseup",TREE.dragEnd);
+ }
+ return false;
+ }).mouseup(function(){
+ if(mousePressed && mouseMoved && dragNode_source)
+ {
+ TREE.moveNodeToFolder($(this).parent());
+ }
+ TREE.eventDestroy();
+ });
+ $('li', obj).each(function(i){
+ var className = this.className;
+ var open = false;
+ var cloneNode=false;
+ var LI = this;
+ var childNode = $('>ul',this);
+ if(childNode.size()>0){
+ var setClassName = 'folder-';
+ if(className && className.indexOf('open')>=0){
+ setClassName=setClassName+'open';
+ open=true;
+ }else{
+ setClassName=setClassName+'close';
+ }
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
+
+ if(!open || className.indexOf('ajax')>=0)childNode.hide();
+
+ TREE.setTrigger(this);
+ }else{
+ var setClassName = 'doc';
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
+ }
+ }).before('<li class="line">&nbsp;</li>')
+ .filter(':last-child').after('<li class="line-last"></li>');
+ TREE.setEventLine($('.line, .line-last', obj));
+ };
+ TREE.setTrigger = function(node){
+ $('>span',node).before('<img class="trigger" src="images/spacer.gif" border=0>');
+ var trigger = $('>.trigger', node);
+ trigger.click(function(event){
+ TREE.nodeToggle(node);
+ });
+ if(!$.browser.msie)
+ {
+ trigger.css('float','left');
+ }
+ };
+ TREE.dragStart = function(event){
+ var LI = $(event.data.LI);
+ if(mousePressed)
+ {
+ mouseMoved = true;
+ if(dragDropTimer) clearTimeout(dragDropTimer);
+ if($('#drag_container:not(:visible)')){
+ $('#drag_container').show();
+ LI.prev('.line').hide();
+ dragNode_source = LI;
+ }
+ $('#drag_container').css({position:'absolute', "left" : (event.pageX + 5), "top": (event.pageY + 15) });
+ if(LI.is(':visible'))LI.hide();
+ var temp_move = false;
+ if(event.target.tagName.toLowerCase()=='span' && $.inArray(event.target.className, Array('text','active','trigger'))!= -1)
+ {
+ var parent = event.target.parentNode;
+ var offs = $(parent).offset({scroll:false});
+ var screenScroll = {x : (offs.left - 3),y : event.pageY - offs.top};
+ var isrc = $("#tree_plus").attr('src');
+ var ajaxChildSize = $('>ul.ajax',parent).size();
+ var ajaxChild = $('>ul.ajax',parent);
+ screenScroll.x += 19;
+ screenScroll.y = event.pageY - screenScroll.y + 5;
+
+ if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize==0)
+ {
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','images/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ dragDropTimer = setTimeout(function(){
+ parent.className = parent.className.replace('close','open');
+ $('>ul',parent).show();
+ }, 700);
+ }else if(parent.className.indexOf('folder')>=0 && ajaxChildSize==0){
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','images/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ }else if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize>0)
+ {
+ mouseMoved = false;
+ $("#tree_plus").attr('src','images/minus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+
+ $('>ul',parent).show();
+ /*
+ Thanks for the idea of Erik Dohmen
+ */
+ TREE.setAjaxNodes(ajaxChild,parent.id, function(){
+ parent.className = parent.className.replace('close','open');
+ mouseMoved = true;
+ $("#tree_plus").attr('src','images/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ });
+
+ }else{
+ if(TREE.option.docToFolderConvert)
+ {
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ }else{
+ $("#tree_plus").hide();
+ }
+ }
+ }else{
+ $("#tree_plus").hide();
+ }
+ return false;
+ }
+ return true;
+ };
+ TREE.dragEnd = function(){
+ if(dragDropTimer) clearTimeout(dragDropTimer);
+ TREE.eventDestroy();
+ };
+ TREE.setEventLine = function(obj){
+ obj.mouseover(function(){
+ if(this.className.indexOf('over')<0 && mousePressed && mouseMoved)
+ {
+ this.className = this.className.replace('line','line-over');
+ }
+ }).mouseout(function(){
+ if(this.className.indexOf('over')>=0)
+ {
+ this.className = this.className.replace('-over','');
+ }
+ }).mouseup(function(){
+ if(mousePressed && dragNode_source && mouseMoved)
+ {
+ dragNode_destination = $(this).parents('li:first');
+ TREE.moveNodeToLine(this);
+ TREE.eventDestroy();
+ }
+ });
+ };
+ TREE.checkNodeIsLast = function(node)
+ {
+ if(node.className.indexOf('last')>=0)
+ {
+ var prev_source = dragNode_source.prev().prev();
+ if(prev_source.size()>0)
+ {
+ prev_source[0].className+='-last';
+ }
+ node.className = node.className.replace('-last','');
+ }
+ };
+ TREE.checkLineIsLast = function(line)
+ {
+ if(line.className.indexOf('last')>=0)
+ {
+ var prev = $(line).prev();
+ if(prev.size()>0)
+ {
+ prev[0].className = prev[0].className.replace('-last','');
+ }
+ dragNode_source[0].className+='-last';
+ }
+ };
+ TREE.eventDestroy = function()
+ {
+ // added by Erik Dohmen (2BinBusiness.nl), the unbind mousemove TREE.dragStart action
+ // like this other mousemove actions binded through other actions ain't removed (use it myself
+ // to determine location for context menu)
+ $(document).unbind('mousemove',TREE.dragStart).unbind('mouseup').unbind('mousedown');
+ $('#drag_container, #tree_plus').remove();
+ if(dragNode_source)
+ {
+ $(dragNode_source).show().prev('.line').show();
+ }
+ dragNode_destination = dragNode_source = mousePressed = mouseMoved = false;
+ //ajaxCache = Array();
+ };
+ TREE.convertToFolder = function(node){
+ node[0].className = node[0].className.replace('doc','folder-open');
+ node.append('<ul><li class="line-last"></li></ul>');
+ TREE.setTrigger(node[0]);
+ TREE.setEventLine($('.line, .line-last', node));
+ };
+ TREE.convertToDoc = function(node){
+ $('>ul', node).remove();
+ $('img', node).remove();
+ node[0].className = node[0].className.replace(/folder-(open|close)/gi , 'doc');
+ };
+ TREE.moveNodeToFolder = function(node)
+ {
+ if(!TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1)
+ {
+ return true;
+ }else if(TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1){
+ TREE.convertToFolder(node);
+ }
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ var lastLine = $('>ul >.line-last', node);
+ if(lastLine.size()>0)
+ {
+ TREE.moveNodeToLine(lastLine[0]);
+ }
+ };
+ TREE.moveNodeToLine = function(node){
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ TREE.checkLineIsLast(node);
+ var parent = $(dragNode_source).parents('li:first');
+ var line = $(dragNode_source).prev('.line');
+ $(node).before(dragNode_source);
+ $(dragNode_source).before(line);
+ node.className = node.className.replace('-over','');
+ var nodeSize = $('>ul >li', parent).not('.line, .line-last').filter(':visible').size();
+ if(TREE.option.docToFolderConvert && nodeSize==0)
+ {
+ TREE.convertToDoc(parent);
+ }else if(nodeSize==0)
+ {
+ parent[0].className=parent[0].className.replace('open','close');
+ $('>ul',parent).hide();
+ }
+
+ // added by Erik Dohmen (2BinBusiness.nl) select node
+ if($('span:first',dragNode_source).attr('class')=='text')
+ {
+ $('.active',TREE).attr('class','text');
+ $('span:first',dragNode_source).attr('class','active');
+ }
+
+ if(typeof(TREE.option.afterMove) == 'function')
+ {
+ var pos = $(dragNode_source).prevAll(':not(.line)').size();
+ TREE.option.afterMove($(node).parents('li:first'), $(dragNode_source), pos);
+ }
+ };
+
+ TREE.addNode = function(id, text, callback)
+ {
+ var temp_node = $('<li><ul><li id="'+id+'"><span>'+text+'</span></li></ul></li>');
+ TREE.setTreeNodes(temp_node);
+ dragNode_destination = TREE.getSelected();
+ dragNode_source = $('.doc-last',temp_node);
+ TREE.moveNodeToFolder(dragNode_destination);
+ temp_node.remove();
+ if(typeof(callback) == 'function')
+ {
+ callback(dragNode_destination, dragNode_source);
+ }
+ };
+ TREE.delNode = function(callback)
+ {
+ dragNode_source = TREE.getSelected();
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ dragNode_source.prev().remove();
+ dragNode_source.remove();
+ if(typeof(callback) == 'function')
+ {
+ callback(dragNode_destination);
+ }
+ };
+
+ TREE.init = function(obj)
+ {
+ TREE.setTreeNodes(obj, false);
+ };
+ TREE.init(ROOT);
+ });
+}
View
6 lib/public/javascripts/jquery.tiptip.min.js
@@ -0,0 +1,6 @@
+(function($){$.fn.tipTip=function(options){var defaults={maxWidth:"200px",edgeOffset:3,delay:400,fadeIn:200,fadeOut:200,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow");}
+return this.each(function(){var org_elem=$(this);var org_title=org_elem.attr("title");if(org_title!=""){org_elem.removeAttr("title");var timeout=false;org_elem.hover(function(){opts.enter.call(this);tiptip_content.text(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(w_compare<0){if((w_compare+left)<parseInt($(window).scrollLeft())){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare);}else if((tip_w+left)>parseInt($(window).width())){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w-5);marg_left=Math.round(left-(tip_w+opts.edgeOffset));marg_top=Math.round(top+h_compare);}}
+if((top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop())){t_class=t_class+"_top";arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset));}else if(((top+org_height)-(opts.edgeOffset+tip_h))<0||t_class==""){t_class=t_class+"_bottom";arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset);}
+if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5;}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5;}
+tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout);}
+timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn);},opts.delay);},function(){opts.exit.call(this);if(timeout){clearTimeout(timeout);}tiptip_holder.fadeOut(opts.fadeOut);});}});}})(jQuery);
View
1 lib/public/javascripts/jquery.tree.min.js
@@ -0,0 +1 @@
+(function($){$.tree={datastores:{},plugins:{},defaults:{data:{async:false,type:"html",opts:{method:"GET",url:false}},selected:false,opened:[],languages:[],ui:{dots:true,animation:0,scroll_spd:4,theme_path:false,theme_name:"default",selected_parent_close:"select_parent",selected_delete:"select_previous"},types:{"default":{clickable:true,renameable:true,deletable:true,creatable:true,draggable:true,max_children:-1,max_depth:-1,valid_children:"all",icon:{image:false,position:false}}},rules:{multiple:false,multitree:"none",type_attr:"rel",createat:"bottom",drag_copy:"ctrl",drag_button:"left",use_max_children:true,use_max_depth:true,max_children:-1,max_depth:-1,valid_children:"all"},lang:{new_node:"New folder",loading:"Loading ..."},callback:{beforechange:function(NODE,TREE_OBJ){return true},beforeopen:function(NODE,TREE_OBJ){return true},beforeclose:function(NODE,TREE_OBJ){return true},beforemove:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforecreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforerename:function(NODE,LANG,TREE_OBJ){return true},beforedelete:function(NODE,TREE_OBJ){return true},beforedata:function(NODE,TREE_OBJ){return{id:$(NODE).attr("id")||0}},ondata:function(DATA,TREE_OBJ){return DATA},onparse:function(STR,TREE_OBJ){return STR},onhover:function(NODE,TREE_OBJ){},onselect:function(NODE,TREE_OBJ){},ondeselect:function(NODE,TREE_OBJ){},onchange:function(NODE,TREE_OBJ){},onrename:function(NODE,TREE_OBJ,RB){},onmove:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncopy:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncreate:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},ondelete:function(NODE,TREE_OBJ,RB){},onopen:function(NODE,TREE_OBJ){},onopen_all:function(TREE_OBJ){},onclose_all:function(TREE_OBJ){},onclose:function(NODE,TREE_OBJ){},error:function(TEXT,TREE_OBJ){},ondblclk:function(NODE,TREE_OBJ){TREE_OBJ.toggle_branch.call(TREE_OBJ,NODE);TREE_OBJ.select_branch.call(TREE_OBJ,NODE)},onrgtclk:function(NODE,TREE_OBJ,EV){},onload:function(TREE_OBJ){},oninit:function(TREE_OBJ){},onfocus:function(TREE_OBJ){},ondestroy:function(TREE_OBJ){},onsearch:function(NODES,TREE_OBJ){NODES.addClass("search")},ondrop:function(NODE,REF_NODE,TYPE,TREE_OBJ){},check:function(RULE,NODE,VALUE,TREE_OBJ){return VALUE},check_move:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true}},plugins:{}},create:function(){return new tree_component()},focused:function(){return tree_component.inst[tree_component.focused]},reference:function(obj){var o=$(obj);if(!o.size())o=$("#"+obj);if(!o.size())return null;o=(o.is(".tree"))?o.attr("id"):o.parents(".tree:eq(0)").attr("id");return tree_component.inst[o]||null},rollback:function(data){for(var i in data){if(!data.hasOwnProperty(i))continue;var tmp=tree_component.inst[i];var lock=!tmp.locked;if(lock)tmp.lock(true);tmp.inp=false;tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");if(data[i].selected){tmp.selected=$("#"+data[i].selected);tmp.selected_arr=[];tmp.container.find("a.clicked").each(function(){tmp.selected_arr.push(tmp.get_node(this))})}if(lock)tmp.lock(false);delete lock;delete tmp}},drop_mode:function(opts){opts=$.extend(opts,{show:false,type:"default",str:"Foreign node"});tree_component.drag_drop.foreign=true;tree_component.drag_drop.isdown=true;tree_component.drag_drop.moving=true;tree_component.drag_drop.appended=false;tree_component.drag_drop.f_type=opts.type;tree_component.drag_drop.f_data=opts;if(!opts.show){tree_component.drag_drop.drag_help=false;tree_component.drag_drop.drag_node=false}else{tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>"+opts.str+"</a></li></ul></div>");tree_component.drag_drop.drag_node=tree_component.drag_drop.drag_help.find("li:eq(0)")}if($.tree.drag_start!==false)$.tree.drag_start.call(null,false)},drag_start:false,drag:false,drag_end:false};$.fn.tree=function(opts){return this.each(function(){var conf=$.extend({},opts);if(tree_component.inst&&tree_component.inst[$(this).attr('id')])tree_component.inst[$(this).attr('id')].destroy();if(conf!==false)new tree_component().init(this,conf)})};function tree_component(){return{cntr:++tree_component.cntr,settings:$.extend({},$.tree.defaults),init:function(elem,conf){var _this=this;this.container=$(elem);if(this.container.size==0)return false;tree_component.inst[this.cntr]=this;if(!this.container.attr("id"))this.container.attr("id","jstree_"+this.cntr);tree_component.inst[this.container.attr("id")]=tree_component.inst[this.cntr];tree_component.focused=this.cntr;this.settings=$.extend(true,{},this.settings,conf);if(this.settings.languages&&this.settings.languages.length){this.current_lang=this.settings.languages[0];var st=false;var id="#"+this.container.attr("id");for(var ln=0;ln<this.settings.languages.length;ln++){st=tree_component.add_css(id+" ."+this.settings.languages[ln]);if(st!==false)st.style.display=(this.settings.languages[ln]==this.current_lang)?"":"none"}}else this.current_lang=false;this.container.addClass("tree");if(this.settings.ui.theme_name!==false){if(this.settings.ui.theme_path===false){$("script").each(function(){if(this.src.toString().match(/jquery\.tree.*?js$/)){_this.settings.ui.theme_path=this.src.toString().replace(/jquery\.tree.*?js$/,"")+"themes/"+_this.settings.ui.theme_name+"/style.css";return false}})}if(this.settings.ui.theme_path!=""&&$.inArray(this.settings.ui.theme_path,tree_component.themes)==-1){tree_component.add_sheet({url:this.settings.ui.theme_path});tree_component.themes.push(this.settings.ui.theme_path)}this.container.addClass("tree-"+this.settings.ui.theme_name)}var type_icons="";for(var t in this.settings.types){if(!this.settings.types.hasOwnProperty(t))continue;if(!this.settings.types[t].icon)continue;if(this.settings.types[t].icon.image||this.settings.types[t].icon.position){if(t=="default")type_icons+="#"+this.container.attr("id")+" li > a ins { ";else type_icons+="#"+this.container.attr("id")+" li[rel="+t+"] > a ins { ";if(this.settings.types[t].icon.image)type_icons+=" background-image:url("+this.settings.types[t].icon.image+"); ";if(this.settings.types[t].icon.position)type_icons+=" background-position:"+this.settings.types[t].icon.position+"; ";type_icons+="} "}}if(type_icons!="")tree_component.add_sheet({str:type_icons});if(this.settings.rules.multiple)this.selected_arr=[];this.offset=false;this.hovered=false;this.locked=false;if(tree_component.drag_drop.marker===false)tree_component.drag_drop.marker=$("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");this.callback("oninit",[this]);this.refresh();this.attach_events();this.focus()},refresh:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;if(obj&&!this.settings.data.async)obj=false;this.is_partial_refresh=obj?true:false;this.opened=Array();if(this.settings.opened!=false){$.each(this.settings.opened,function(i,item){if(this.replace(/^#/,"").length>0){_this.opened.push("#"+this.replace(/^#/,""))}});this.settings.opened=false}else{this.container.find("li.open").each(function(i){if(this.id){_this.opened.push("#"+this.id)}})}if(this.selected){this.settings.selected=Array();if(obj){$(obj).find("li:has(a.clicked)").each(function(){if(this.id)_this.settings.selected.push("#"+this.id)})}else{if(this.selected_arr){$.each(this.selected_arr,function(){if(this.attr("id"))_this.settings.selected.push("#"+this.attr("id"))})}else{if(this.selected.attr("id"))this.settings.selected.push("#"+this.selected.attr("id"))}}}else if(this.settings.selected!==false){var tmp=Array();if((typeof this.settings.selected).toLowerCase()=="object"){$.each(this.settings.selected,function(){if(this.replace(/^#/,"").length>0)tmp.push("#"+this.replace(/^#/,""))})}else{if(this.settings.selected.replace(/^#/,"").length>0)tmp.push("#"+this.settings.selected.replace(/^#/,""))}this.settings.selected=tmp}if(obj&&this.settings.data.async){this.opened=Array();obj=this.get_node(obj);obj.find("li.open").each(function(i){_this.opened.push("#"+this.id)});if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");if(obj.hasClass("leaf"))obj.removeClass("leaf");obj.children("ul:eq(0)").html("");return this.open_branch(obj,true,function(){_this.reselect.apply(_this)})}var _this=this;var _datastore=new $.tree.datastores[this.settings.data.type]();if(this.container.children("ul").size()==0){this.container.html("<ul class='ltr' style='direction:ltr;'><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(this.settings.lang.loading||"Loading ...")+"</a></li></ul>")}_datastore.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);_this.container.empty().append($("<ul class='ltr'>").html(str));_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");_this.container.find("li").not(".open").not(".closed").addClass("leaf");_this.reselect()})})},reselect:function(is_callback){var _this=this;if(!is_callback)this.cl_count=0;else this.cl_count--;if(this.opened&&this.opened.length){var opn=false;for(var j=0;this.opened&&j<this.opened.length;j++){if(this.settings.data.async){var tmp=this.get_node(this.opened[j]);if(tmp.size()&&tmp.hasClass("closed")>0){opn=true;var tmp=this.opened[j].toString().replace('/','\\/');delete this.opened[j];this.open_branch(tmp,true,function(){_this.reselect.apply(_this,[true])});this.cl_count++}}else this.open_branch(this.opened[j],true)}if(this.settings.data.async&&opn)return;if(this.cl_count>0)return;delete this.opened}if(this.cl_count>0)return;this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");if(this.settings.ui.dots==false)this.container.children("ul:eq(0)").addClass("no_dots");if(this.scrtop){this.container.scrollTop(_this.scrtop);delete this.scrtop}if(this.settings.selected!==false){$.each(this.settings.selected,function(i){if(_this.is_partial_refresh)_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false));else _this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false&&i>0))});this.settings.selected=false}this.callback("onload",[_this])},get:function(obj,format,opts){if(!format)format=this.settings.data.type;if(!opts)opts=this.settings.data.opts;return new $.tree.datastores[format]().get(obj,this,opts)},attach_events:function(){var _this=this;this.container.bind("mousedown.jstree",function(event){if(tree_component.drag_drop.isdown){tree_component.drag_drop.move_type=false;event.preventDefault();event.stopPropagation();event.stopImmediatePropagation();return false}}).bind("mouseup.jstree",function(event){setTimeout(function(){_this.focus.apply(_this)},5)}).bind("click.jstree",function(event){return true});$("#"+this.container.attr("id")+" li").live("click",function(event){if(event.target.tagName!="LI")return true;_this.off_height();if(event.pageY-$(event.target).offset().top>_this.li_height)return true;_this.toggle_branch.apply(_this,[event.target]);event.stopPropagation();return false});$("#"+this.container.attr("id")+" li a").live("click.jstree",function(event){if(event.which&&event.which==3)return true;if(_this.locked){event.preventDefault();event.target.blur();return _this.error("LOCKED")}_this.select_branch.apply(_this,[event.target,event.ctrlKey||_this.settings.rules.multiple=="on"]);if(_this.inp){_this.inp.blur()}event.preventDefault();event.target.blur();return false}).live("dblclick.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();event.target.blur();return _this.error("LOCKED")}_this.callback("ondblclk",[_this.get_node(event.target).get(0),_this]);event.preventDefault();event.stopPropagation();event.target.blur()}).live("contextmenu.jstree",function(event){if(_this.locked){event.target.blur();return _this.error("LOCKED")}return _this.callback("onrgtclk",[_this.get_node(event.target).get(0),_this,event])}).live("mouseover.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();return _this.error("LOCKED")}if(_this.hovered!==false&&(event.target.tagName=="A"||event.target.tagName=="INS")){_this.hovered.children("a").removeClass("hover");_this.hovered=false}_this.callback("onhover",[_this.get_node(event.target).get(0),_this])}).live("mousedown.jstree",function(event){if(_this.settings.rules.drag_button=="left"&&event.which&&event.which!=1)return true;if(_this.settings.rules.drag_button=="right"&&event.which&&event.which!=3)return true;_this.focus.apply(_this);if(_this.locked)return _this.error("LOCKED");var obj=_this.get_node(event.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&obj.children("a:eq(0)").hasClass("clicked")){var counter=0;for(var i in _this.selected_arr){if(!_this.selected_arr.hasOwnProperty(i))continue;if(_this.check("draggable",_this.selected_arr[i])){_this.selected_arr[i].addClass("dragged");tree_component.drag_drop.origin_tree=_this;counter++}}if(counter>0){if(_this.check("draggable",obj))tree_component.drag_drop.drag_node=obj;else tree_component.drag_drop.drag_node=_this.container.find("li.dragged:eq(0)");tree_component.drag_drop.isdown=true;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=tree_component.drag_drop.drag_node.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove();tree_component.drag_drop.dragged=_this.container.find("li.dragged")}}else{if(_this.check("draggable",obj)){tree_component.drag_drop.drag_node=obj;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=obj.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");tree_component.drag_drop.isdown=true;tree_component.drag_drop.foreign=false;tree_component.drag_drop.origin_tree=_this;obj.addClass("dragged");tree_component.drag_drop.dragged=_this.container.find("li.dragged")}}tree_component.drag_drop.init_x=event.pageX;tree_component.drag_drop.init_y=event.pageY;obj.blur();event.preventDefault();event.stopPropagation();return false})},focus:function(){if(this.locked)return false;if(tree_component.focused!=this.cntr){tree_component.focused=this.cntr;this.callback("onfocus",[this])}},off_height:function(){if(this.offset===false){this.container.css({position:"relative"});this.offset=this.container.offset();var tmp=0;tmp=parseInt($.curCSS(this.container.get(0),"paddingTop",true),10);if(tmp)this.offset.top+=tmp;tmp=parseInt($.curCSS(this.container.get(0),"borderTopWidth",true),10);if(tmp)this.offset.top+=tmp;this.container.css({position:""})}if(!this.li_height){var tmp=this.container.find("ul li.closed, ul li.leaf").eq(0);this.li_height=tmp.height();if(tmp.children("ul:eq(0)").size())this.li_height-=tmp.children("ul:eq(0)").height();if(!this.li_height)this.li_height=18}},scroll_check:function(x,y){var _this=this;var cnt=_this.container;var off=_this.container.offset();var st=cnt.scrollTop();var sl=cnt.scrollLeft();var h_cor=(cnt.get(0).scrollWidth>cnt.width())?40:20;if(y-off.top<20)cnt.scrollTop(Math.max((st-_this.settings.ui.scroll_spd),0));if(cnt.height()-(y-off.top)<h_cor)cnt.scrollTop(st+_this.settings.ui.scroll_spd);if(x-off.left<20)cnt.scrollLeft(Math.max((sl-_this.settings.ui.scroll_spd),0));if(cnt.width()-(x-off.left)<40)cnt.scrollLeft(sl+_this.settings.ui.scroll_spd);if(cnt.scrollLeft()!=sl||cnt.scrollTop()!=st){tree_component.drag_drop.move_type=false;tree_component.drag_drop.ref_node=false;tree_component.drag_drop.marker.hide()}tree_component.drag_drop.scroll_time=setTimeout(function(){_this.scroll_check(x,y)},50)},scroll_into_view:function(obj){obj=obj?this.get_node(obj):this.selected;if(!obj)return false;var off_t=obj.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t))},get_node:function(obj){return $(obj).closest("li")},get_type:function(obj){obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var tmp=obj.attr(this.settings.rules.type_attr);return tmp||"default"},set_type:function(str,obj){obj=!obj?this.selected:this.get_node(obj);if(!obj||!str)return;obj.attr(this.settings.rules.type_attr,str)},get_text:function(obj,lang){obj=this.get_node(obj);if(!obj||obj.size()==0)return"";if(this.settings.languages&&this.settings.languages.length){lang=lang?lang:this.current_lang;obj=obj.children("a."+lang)}else obj=obj.children("a:visible");var val="";obj.contents().each(function(){if(this.nodeType==3){val=this.data;return false}});return val},check:function(rule,obj){if(this.locked)return false;var v=false;if(obj===-1){if(typeof this.settings.rules[rule]!="undefined")v=this.settings.rules[rule]}else{obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var t=this.get_type(obj);if(typeof this.settings.types[t]!="undefined"&&typeof this.settings.types[t][rule]!="undefined")v=this.settings.types[t][rule];else if(typeof this.settings.types["default"]!="undefined"&&typeof this.settings.types["default"][rule]!="undefined")v=this.settings.types["default"][rule]}if(typeof v=="function")v=v.call(null,obj,this);v=this.callback("check",[rule,obj,v,this]);return v},check_move:function(nod,ref_node,how){if(this.locked)return false;if($(ref_node).closest("li.dragged").size())return false;var tree1=nod.parents(".tree:eq(0)").get(0);var tree2=ref_node.parents(".tree:eq(0)").get(0);if(tree1&&tree1!=tree2){var m=$.tree.reference(tree2.id).settings.rules.multitree;if(m=="none"||($.isArray(m)&&$.inArray(tree1.id,m)==-1))return false}var p=(how!="inside")?this.parent(ref_node):this.get_node(ref_node);nod=this.get_node(nod);if(p==false)return false;var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",p):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",p):-1,valid_children:this.check("valid_children",p)};var nod_type=(typeof nod=="string")?nod:this.get_type(nod);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||(typeof r.valid_children=="object"&&$.inArray(nod_type,$.makeArray(r.valid_children))==-1)))return false;if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1){if(r.max_children==0)return false;var c_count=1;if(tree_component.drag_drop.moving==true&&tree_component.drag_drop.foreign==false){c_count=tree_component.drag_drop.dragged.size();c_count=c_count-p.find('> ul > li.dragged').size()}if(r.max_children<p.find('> ul > li').size()+c_count)return false}}if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("MOVE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=p;while(t!==-1){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i)}if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED")}if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;if(typeof nod!="string"){var t=nod;while(t.size()>0){if(mx-incr<0)return this.error("MOVE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++}}}}if(this.callback("check_move",[nod,ref_node,how,this])==false)return false;return true},hover_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=_this.get_node(obj);if(!obj.size())return this.error("HOVER: NOT A VALID NODE");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(this.hovered)this.hovered.children("A").removeClass("hover");this.hovered=obj;this.hovered.children("a").addClass("hover");this.scroll_into_view(this.hovered)},select_branch:function(obj,multiple){if(this.locked)return this.error("LOCKED");if(!obj&&this.hovered!==false)obj=this.hovered;var _this=this;obj=_this.get_node(obj);if(!obj.size())return this.error("SELECT: NOT A VALID NODE");obj.children("a").removeClass("hover");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(_this.callback("beforechange",[obj.get(0),_this])===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&multiple&&obj.children("a.clicked").size()>0){return this.deselect_branch(obj)}if(this.settings.rules.multiple!=false&&multiple){this.selected_arr.push(obj)}if(this.settings.rules.multiple!=false&&!multiple){for(var i in this.selected_arr){if(!this.selected_arr.hasOwnProperty(i))continue;this.selected_arr[i].children("A").removeClass("clicked");this.callback("ondeselect",[this.selected_arr[i].get(0),_this])}this.selected_arr=[];this.selected_arr.push(obj);if(this.selected&&this.selected.children("A").hasClass("clicked")){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this])}}if(!this.settings.rules.multiple){if(this.selected){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this])}}this.selected=obj;if(this.hovered!==false){this.hovered.children("A").removeClass("hover");this.hovered=obj}this.selected.children("a").addClass("clicked").end().parents("li.closed").each(function(){_this.open_branch(this,true)});this.scroll_into_view(this.selected);this.callback("onselect",[this.selected.get(0),_this]);this.callback("onchange",[this.selected.get(0),_this])},deselect_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(obj.children("a.clicked").size()==0)return this.error("DESELECT: NODE NOT SELECTED");obj.children("a").removeClass("clicked");this.callback("ondeselect",[obj.get(0),_this]);if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(obj.get(0)==this.selected.get(0)){this.selected=this.selected_arr[0]}}else{if(this.settings.rules.multiple!=false)this.selected_arr=[];this.selected=false}this.callback("onchange",[obj.get(0),_this])},toggle_branch:function(obj){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(obj.hasClass("closed"))return this.open_branch(obj);if(obj.hasClass("open"))return this.close_branch(obj)},open_branch:function(obj,disable_animation,callback){var _this=this;if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(!obj.size())return this.error("OPEN: NO SUCH NODE");if(obj.hasClass("leaf"))return this.error("OPEN: OPENING LEAF NODE");if(this.settings.data.async&&obj.find("li").size()==0){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(_this.settings.lang.loading||"Loading ...")+"</a></li></ul>");obj.removeClass("closed").addClass("open");var _datastore=new $.tree.datastores[this.settings.data.type]();_datastore.load(this.callback("beforedata",[obj,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);if(!data||data.length==0){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return}_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);obj.children("ul:eq(0)").replaceWith($("<ul>").html(str));obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");obj.find("li").not(".open").not(".closed").addClass("leaf");_this.open_branch.apply(_this,[obj]);if(callback)callback.call()})});return true}else{if(!this.settings.data.async){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER")}if(parseInt(this.settings.ui.animation)>0&&!disable_animation){obj.children("ul:eq(0)").css("display","none");obj.removeClass("closed").addClass("open");obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){$(this).css("display","");if(callback)callback.call()})}else{obj.removeClass("closed").addClass("open");if(callback)callback.call()}this.callback("onopen",[obj.get(0),this]);return true}},close_branch:function(obj,disable_animation){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(!obj.size())return this.error("CLOSE: NO SUCH NODE");if(_this.callback("beforeclose",[obj.get(0),_this])===false)return this.error("CLOSE: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&obj.children("ul:eq(0)").size()==1){obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");$(this).css("display","")})}else{if(obj.hasClass("open"))obj.removeClass("open").addClass("closed")}if(this.selected&&this.settings.ui.selected_parent_close!==false&&obj.children("ul:eq(0)").find("a.clicked").size()>0){obj.find("li:has(a.clicked)").each(function(){_this.deselect_branch(this)});if(this.settings.ui.selected_parent_close=="select_parent"&&obj.children("a.clicked").size()==0)this.select_branch(obj,(this.settings.rules.multiple!=false&&this.selected_arr.length>0))}this.callback("onclose",[obj.get(0),this])},open_all:function(obj,callback){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;var s=obj.find("li.closed").size();if(!callback)this.cl_count=0;else this.cl_count--;if(s>0){this.cl_count+=s;obj.find("li.closed").each(function(){var __this=this;_this.open_branch.apply(_this,[this,true,function(){_this.open_all.apply(_this,[__this,true])}])})}else if(this.cl_count==0)this.callback("onopen_all",[this])},close_all:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;obj.find("li.open").each(function(){_this.close_branch(this,true)});this.callback("onclose_all",[this])},set_lang:function(i){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;if(this.locked)return this.error("LOCKED");if(!$.inArray(i,this.settings.languages)&&typeof this.settings.languages[i]!="undefined")i=this.settings.languages[i];if(typeof i=="undefined")return false;if(i==this.current_lang)return true;var st=false;var id="#"+this.container.attr("id");st=tree_component.get_css(id+" ."+this.current_lang);if(st!==false)st.style.display="none";st=tree_component.get_css(id+" ."+i);if(st!==false)st.style.display="";this.current_lang=i;return true},get_lang:function(){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;return this.current_lang},create:function(obj,ref_node,position){if(this.locked)return this.error("LOCKED");var root=false;if(ref_node==-1){root=true;ref_node=this.container}else ref_node=ref_node?this.get_node(ref_node):this.selected;if(!root&&(!ref_node||!ref_node.size()))return this.error("CREATE: NO NODE SELECTED");var pos=position;var tmp=ref_node;if(position=="before"){position=ref_node.parent().children().index(ref_node);ref_node=ref_node.parents("li:eq(0)")}if(position=="after"){position=ref_node.parent().children().index(ref_node)+1;ref_node=ref_node.parents("li:eq(0)")}if(!root&&ref_node.size()==0){root=true;ref_node=this.container}if(!root){if(!this.check("creatable",ref_node))return this.error("CREATE: CANNOT CREATE IN NODE");if(ref_node.hasClass("closed")){if(this.settings.data.async&&ref_node.children("ul").size()==0){var _this=this;return this.open_branch(ref_node,true,function(){_this.create.apply(_this,[obj,ref_node,position])})}else this.open_branch(ref_node,true)}}var torename=false;if(!obj)obj={};else obj=$.extend(true,{},obj);if(!obj.attributes)obj.attributes={};if(!obj.attributes[this.settings.rules.type_attr])obj.attributes[this.settings.rules.type_attr]=this.get_type(tmp)||"default";if(this.settings.languages.length){if(!obj.data){obj.data={};torename=true}for(var i=0;i<this.settings.languages.length;i++){if(!obj.data[this.settings.languages[i]])obj.data[this.settings.languages[i]]=((typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[i])?this.settings.lang.new_node[i]:this.settings.lang.new_node}}else{if(!obj.data){obj.data=this.settings.lang.new_node;torename=true}}obj=this.callback("ondata",[obj,this]);var obj_s=$.tree.datastores.json().parse(obj,this);obj_s=this.callback("onparse",[obj_s,this]);var $li=$(obj_s);if($li.children("ul").size()){if(!$li.is(".open"))$li.addClass("closed")}else $li.addClass("leaf");$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");$li.find("li").not(".open").not(".closed").addClass("leaf");var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",(root?-1:ref_node)):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",(root?-1:ref_node)):-1,valid_children:this.check("valid_children",(root?-1:ref_node))};var nod_type=this.get_type($li);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||($.isArray(r.valid_children)&&$.inArray(nod_type,r.valid_children)==-1)))return this.error("CREATE: NODE NOT A VALID CHILD");if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1&&r.max_children>=this.children(ref_node).size())return this.error("CREATE: MAX_CHILDREN REACHED")}if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("CREATE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=ref_node;while(t!==-1&&!root){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i)}if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED")}if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;var t=$li;while(t.size()>0){if(mx-incr<0)return this.error("CREATE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++}}}if((typeof position).toLowerCase()=="undefined"||position=="inside")position=(this.settings.rules.createat=="top")?0:ref_node.children("ul:eq(0)").children("li").size();if(ref_node.children("ul").size()==0||(root==true&&ref_node.children("ul").children("li").size()==0)){if(!root)var a=this.moved($li,ref_node.children("a:eq(0)"),"inside",true);else var a=this.moved($li,this.container.children("ul:eq(0)"),"inside",true)}else if(pos=="before"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else if(pos=="after"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",true);else if(ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);if(a===false)return this.error("CREATE: ABORTED");if(torename){this.select_branch($li.children("a:eq(0)"));this.rename()}return $li},rename:function(obj,new_name){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.selected;var _this=this;if(!obj||!obj.size())return this.error("RENAME: NO NODE SELECTED");if(!this.check("renameable",obj))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.callback("beforerename",[obj.get(0),_this.current_lang,_this]))return this.error("RENAME: STOPPED BY USER");obj.parents("li.closed").each(function(){_this.open_branch(this)});if(this.current_lang)obj=obj.find("a."+this.current_lang);else obj=obj.find("a:first");var rb={};rb[this.container.attr("id")]=this.get_rollback();var icn=obj.children("ins").clone();if((typeof new_name).toLowerCase()=="string"){obj.text(new_name).prepend(icn);_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb])}else{var last_value="";obj.contents().each(function(){if(this.nodeType==3){last_value=this.data;return false}});_this.inp=$("<input type='text' autocomplete='off' />");_this.inp.val(last_value.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")).bind("mousedown",function(event){event.stopPropagation()}).bind("mouseup",function(event){event.stopPropagation()}).bind("click",function(event){event.stopPropagation()}).bind("keyup",function(event){var key=event.keyCode||event.which;if(key==27){this.value=last_value;this.blur();return}if(key==13){this.blur();return}});_this.inp.blur(function(event){if(this.value=="")this.value=last_value;obj.text(this.value).prepend(icn);obj.get(0).style.display="";obj.prevAll("span").remove();_this.inp=false;_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb])});var spn=$("<span />").addClass(obj.attr("class")).append(icn).append(_this.inp);obj.get(0).style.display="none";obj.parent().prepend(spn);_this.inp.get(0).focus();_this.inp.get(0).select()}},remove:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var rb={};rb[this.container.attr("id")]=this.get_rollback();if(obj&&(!this.selected||this.get_node(obj).get(0)!=this.selected.get(0))){obj=this.get_node(obj);if(obj.size()){if(!this.check("deletable",obj))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[obj.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=obj.parent();if(obj.find("a.clicked").size()){var reset_selected=false;_this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){if(!reset_selected&&this==_this.selected.get(0))reset_selected=true;if($(this).parents().index(obj)!=-1)return true;_this.selected_arr.push($(this))});if(reset_selected)this.selected=this.selected_arr[0]||false}obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove()}this.callback("ondelete",[obj.get(0),this,rb])}}else if(this.selected){if(!this.check("deletable",this.selected))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[this.selected.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();var obj=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1){var stop=true;var tmp=this.settings.ui.selected_delete=="select_previous"?this.prev(this.selected):false}obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove()}if(!stop&&this.settings.rules.multiple!=false){var _this=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove()}}if(stop&&tmp)this.select_branch(tmp);this.callback("ondelete",[obj.get(0),this,rb])}else return this.error("DELETE: NO NODE SELECTED")},next:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.nextAll("li").size()>0)?obj.nextAll("li:eq(0)"):false;if(obj.hasClass("open"))return obj.find("li:eq(0)");else if(obj.nextAll("li").size()>0)return obj.nextAll("li:eq(0)");else return obj.parents("li").next("li").eq(0)},prev:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.prevAll("li").size()>0)?obj.prevAll("li:eq(0)"):false;if(obj.prev("li").size()){var obj=obj.prev("li").eq(0);while(obj.hasClass("open"))obj=obj.children("ul:eq(0)").children("li:last");return obj}else return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):false},parent:function(obj){obj=this.get_node(obj);if(!obj.size())return false;return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):-1},children:function(obj){if(obj===-1)return this.container.children("ul:eq(0)").children("li");obj=this.get_node(obj);if(!obj.size())return false;return obj.children("ul:eq(0)").children("li")},toggle_dots:function(){if(this.settings.ui.dots){this.settings.ui.dots=false;this.container.children("ul:eq(0)").addClass("no_dots")}else{this.settings.ui.dots=true;this.container.children("ul:eq(0)").removeClass("no_dots")}},callback:function(cb,args){var p=false;var r=null;for(var i in this.settings.plugins){if(typeof $.tree.plugins[i]!="object")continue;p=$.tree.plugins[i];if(p.callbacks&&typeof p.callbacks[cb]=="function")r=p.callbacks[cb].apply(this,args);if(typeof r!=="undefined"&&r!==null){if(cb=="ondata"||cb=="onparse")args[0]=r;else return r}}p=this.settings.callback[cb];if(typeof p=="function")return p.apply(null,args)},get_rollback:function(){var rb={};rb.html=this.container.html();rb.selected=this.selected?this.selected.attr("id"):false;return rb},moved:function(what,where,how,is_new,is_copy,rb){var what=$(what);var $parent=$(what).parents("ul:eq(0)");var $where=$(where);if($where.is("ins"))$where=$where.parent();if(!rb){var rb={};rb[this.container.attr("id")]=this.get_rollback();if(!is_new){var tmp=what.size()>1?what.eq(0).parents(".tree:eq(0)"):what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];rb[tmp.container.attr("id")]=tmp.get_rollback()}delete tmp}}if(how=="inside"&&this.settings.data.async){var _this=this;if(this.get_node($where).hasClass("closed")){return this.open_branch(this.get_node($where),true,function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy,rb])})}if(this.get_node($where).find("> ul > li > a.loading").size()==1){setTimeout(function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy])},200);return}}if(what.size()>1){var _this=this;var tmp=this.moved(what.eq(0),where,how,false,is_copy,rb);what.each(function(i){if(i==0)return;if(tmp){tmp=_this.moved(this,tmp.children("a:eq(0)"),"after",false,is_copy,rb)}});return what}if(is_copy){_what=what.clone();_what.each(function(i){this.id=this.id+"_copy";$(this).find("li").each(function(){this.id=this.id+"_copy"});$(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged")})}else _what=what;if(is_new){if(!this.callback("beforecreate",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false}else{if(!this.callback("beforemove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false}if(!is_new){var tmp=what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];if(tmp.settings.languages.length){var res=[];if(this.settings.languages.length==0)res.push("."+tmp.current_lang);else{for(var i in this.settings.languages){if(!this.settings.languages.hasOwnProperty(i))continue;for(var j in tmp.settings.languages){if(!tmp.settings.languages.hasOwnProperty(j))continue;if(this.settings.languages[i]==tmp.settings.languages[j])res.push("."+this.settings.languages[i])}}}if(res.length==0)return this.error("MOVE: NO COMMON LANGUAGES");_what.find("a").not(res.join(",")).remove()}_what.find("a.clicked").removeClass("clicked")}}what=_what;switch(how){case"before":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().before(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"after":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().after(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"inside":if($where.parent().children("ul:first").size()){if(this.settings.rules.createat=="top"){$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");var tmp_node=$where.parent().children("ul:first").children("li:first");if(tmp_node.size()){how="before";where=tmp_node}}else{var tmp_node=$where.parent().children("ul:first").children(".last");if(tmp_node.size()){how="after";where=tmp_node}$where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last")}}else{what.addClass("last");$where.parent().removeClass("leaf").append("<ul/>");if(!$where.parent().hasClass("open"))$where.parent().addClass("closed");$where.parent().children("ul:first").prepend(what)}if($where.parent().hasClass("closed")){this.open_branch($where)}break;default:break}if($parent.find("li").size()==0){var $li=$parent.parent();$li.removeClass("open").removeClass("closed").addClass("leaf");if(!$li.is(".tree"))$li.children("ul").remove();$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last")}else{$parent.children("li.last").removeClass("last");$parent.children("li:last").addClass("last")}if(is_copy)this.callback("oncopy",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);else if(is_new)this.callback("oncreate",[this.get_node(what).get(0),($where.is("ul")?-1:this.get_node(where).get(0)),how,this,rb]);else this.callback("onmove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);return what},error:function(code){this.callback("error",[code,this]);return false},lock:function(state){this.locked=state;if(this.locked)this.container.children("ul:eq(0)").addClass("locked");else this.container.children("ul:eq(0)").removeClass("locked")},cut:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("CUT: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=false;tree_component.cut_copy.cut_nodes=obj},copy:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("COPY: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=obj;tree_component.cut_copy.cut_nodes=false},paste:function(obj,position){if(this.locked)return this.error("LOCKED");var root=false;if(obj==-1){root=true;obj=this.container}else obj=obj?this.get_node(obj):this.selected;if(!root&&(!obj||!obj.size()))return this.error("PASTE: NO NODE SELECTED");if(!tree_component.cut_copy.copy_nodes&&!tree_component.cut_copy.cut_nodes)return this.error("PASTE: NOTHING TO DO");var _this=this;var pos=position;if(position=="before"){position=obj.parent().children().index(obj);obj=obj.parents("li:eq(0)")}else if(position=="after"){position=obj.parent().children().index(obj)+1;obj=obj.parents("li:eq(0)")}else if((typeof position).toLowerCase()=="undefined"||position=="inside"){position=(this.settings.rules.createat=="top")?0:obj.children("ul:eq(0)").children("li").size()}if(!root&&obj.size()==0){root=true;obj=this.container}if(tree_component.cut_copy.copy_nodes&&tree_component.cut_copy.copy_nodes.size()){var ok=true;if(!root&&!this.check_move(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside",false,true);else var a=this.moved(tree_component.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside",false,true)}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",false,true);else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",false,true);tree_component.cut_copy.copy_nodes=false}if(tree_component.cut_copy.cut_nodes&&tree_component.cut_copy.cut_nodes.size()){var ok=true;obj.parents().andSelf().each(function(){if(tree_component.cut_copy.cut_nodes.index(this)!=-1){ok=false;return false}});if(!ok)return this.error("Invalid paste");if(!root&&!this.check_move(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside");else var a=this.moved(tree_component.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside")}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after");else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");tree_component.cut_copy.cut_nodes=false}},search:function(str,func){var _this=this;if(!str||(this.srch&&str!=this.srch)){this.srch="";this.srch_opn=false;this.container.find("a.search").removeClass("search")}this.srch=str;if(!str)return;if(!func)func="contains";if(this.settings.data.async){if(!this.srch_opn){var dd=$.extend({"search":str},this.callback("beforedata",[false,this]));$.ajax({type:this.settings.data.opts.method,url:this.settings.data.opts.url,data:dd,dataType:"text",success:function(data){_this.srch_opn=$.unique(data.split(","));_this.search.apply(_this,[str,func])}})}else if(this.srch_opn.length){if(this.srch_opn&&this.srch_opn.length){var opn=false;for(var j=0;j<this.srch_opn.length;j++){if(this.get_node("#"+this.srch_opn[j]).size()>0){opn=true;var tmp="#"+this.srch_opn[j];delete this.srch_opn[j];this.open_branch(tmp,true,function(){_this.search.apply(_this,[str,func])})}}if(!opn){this.srch_opn=[];_this.search.apply(_this,[str,func])}}}else{this.srch_opn=false;var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;this.callback("onsearch",[this.container.find(selector+":"+func+"('"+str+"')"),this])}}else{var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;var nn=this.container.find(selector+":"+func+"('"+str+"')");nn.parents("li.closed").each(function(){_this.open_branch(this,true)});this.callback("onsearch",[nn,this])}},add_sheet:tree_component.add_sheet,destroy:function(){this.callback("ondestroy",[this]);this.container.unbind(".jstree");$("#"+this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-"+this.settings.ui.theme_name).children("ul").removeClass("no_dots ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search");if(this.cntr==tree_component.focused){for(var i in tree_component.inst){if(i!=this.cntr&&i!=this.container.attr("id")){tree_component.inst[i].focus();break}}}tree_component.inst[this.cntr]=false;tree_component.inst[this.container.attr("id")]=false;delete tree_component.inst[this.cntr];delete tree_component.inst[this.container.attr("id")];tree_component.cntr--}}};tree_component.cntr=0;tree_component.inst={};tree_component.themes=[];tree_component.drag_drop={isdown:false,drag_node:false,drag_help:false,dragged:false,init_x:false,init_y:false,moving:false,origin_tree:false,marker:false,move_type:false,ref_node:false,appended:false,foreign:false,droppable:[],open_time:false,scroll_time:false};tree_component.mouseup=function(event){var tmp=tree_component.drag_drop;if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.moving&&$.tree.drag_end!==false)$.tree.drag_end.call(null,event,tmp);if(tmp.foreign===false&&tmp.drag_node&&tmp.drag_node.size()){tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.moved(tmp.dragged,tmp.ref_node,tmp.move_type,false,(tmp.origin_tree.settings.rules.drag_copy=="on"||(tmp.origin_tree.settings.rules.drag_copy=="ctrl"&&event.ctrlKey)))}tmp.move_type=false;tmp.ref_node=false}if(tmp.foreign!==false){if(tmp.drag_help)tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.callback("ondrop",[tmp.f_data,tree1.get_node(tmp.ref_node).get(0),tmp.move_type,tree1])}tmp.foreign=false;tmp.move_type=false;tmp.ref_node=false}if(tree_component.drag_drop.marker)tree_component.drag_drop.marker.hide();if(tmp.dragged&&tmp.dragged.size())tmp.dragged.removeClass("dragged");tmp.dragged=false;tmp.drag_help=false;tmp.drag_node=false;tmp.f_type=false;tmp.f_data=false;tmp.init_x=false;tmp.init_y=false;tmp.moving=false;tmp.appended=false;tmp.origin_tree=false;if(tmp.isdown){tmp.isdown=false;event.preventDefault();event.stopPropagation();return false}};tree_component.mousemove=function(event){var tmp=tree_component.drag_drop;var is_start=false;if(tmp.isdown){if(!tmp.moving&&Math.abs(tmp.init_x-event.pageX)<5&&Math.abs(tmp.init_y-event.pageY)<5){event.preventDefault();event.stopPropagation();return false}else{if(!tmp.moving){tree_component.drag_drop.moving=true;is_start=true}}if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.drag_help!==false){if(!tmp.appended){if(tmp.foreign!==false)tmp.origin_tree=$.tree.focused();$("body").append(tmp.drag_help);tmp.w=tmp.drag_help.width();tmp.appended=true}tmp.drag_help.css({"left":(event.pageX+5),"top":(event.pageY+15)})}if(is_start&&$.tree.drag_start!==false)$.tree.drag_start.call(null,event,tmp);if($.tree.drag!==false)$.tree.drag.call(null,event,tmp);if(event.target.tagName=="DIV"&&event.target.id=="jstree-marker")return false;var et=$(event.target);if(et.is("ins"))et=et.parent();var cnt=et.is(".tree")?et:et.parents(".tree:eq(0)");if(cnt.size()==0||!tree_component.inst[cnt.attr("id")]){if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();return false}var tree2=tree_component.inst[cnt.attr("id")];tree2.off_height();if(tmp.scroll_time)clearTimeout(tmp.scroll_time);tmp.scroll_time=setTimeout(function(){tree2.scroll_check(event.pageX,event.pageY)},50);var mov=false;var st=cnt.scrollTop();if(event.target.tagName=="A"||event.target.tagName=="INS"){if(et.is("#jstree-dragged"))return false;if(tree2.get_node(event.target).hasClass("closed")){tmp.open_time=setTimeout(function(){tree2.open_branch(et)},500)}var et_off=et.offset();var goTo={x:(et_off.left-1),y:(event.pageY-et_off.top)};var arr=[];if(goTo.y<tree2.li_height/3+1)arr=["before","inside","after"];else if(goTo.y>tree2.li_height*2/3-1)arr=["after","inside","before"];else{if(goTo.y<tree2.li_height/2)arr=["inside","before","after"];else arr=["inside","after","before"]}var ok=false;var nn=(tmp.foreign==false)?tmp.origin_tree.container.find("li.dragged"):tmp.f_type;$.each(arr,function(i,val){if(tree2.check_move(nn,et,val)){mov=val;ok=true;return false}});if(ok){switch(mov){case"before":goTo.y=et_off.top-2;tree_component.drag_drop.marker.attr("class","marker");break;case"after":goTo.y=et_off.top-2+tree2.li_height;tree_component.drag_drop.marker.attr("class","marker");break;case"inside":goTo.x-=2;goTo.y=et_off.top-2+tree2.li_height/2;tree_component.drag_drop.marker.attr("class","marker_plus");break}tmp.move_type=mov;tmp.ref_node=$(event.target);if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.css({"left":goTo.x,"top":goTo.y}).show()}}if((et.is(".tree")||et.is("ul"))&&et.find("li:eq(0)").size()==0){var et_off=et.offset();tmp.move_type="inside";tmp.ref_node=cnt.children("ul:eq(0)");if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.attr("class","marker_plus");tree_component.drag_drop.marker.css({"left":(et_off.left+10),"top":et_off.top+15}).show()}else if((event.target.tagName!="A"&&event.target.tagName!="INS")||!ok){if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide()}event.preventDefault();event.stopPropagation();return false}return true};$(function(){$(document).bind("mousemove.jstree",tree_component.mousemove);$(document).bind("mouseup.jstree",tree_component.mouseup)});tree_component.cut_copy={copy_nodes:false,cut_nodes:false};tree_component.css=false;tree_component.get_css=function(rule_name,delete_flag){rule_name=rule_name.toLowerCase();var css_rules=tree_component.css.cssRules||tree_component.css.rules;var j=0;do{if(css_rules.length&&j>css_rules.length+5)return false;if(css_rules[j].selectorText&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if(tree_component.css.removeRule)document.styleSheets[i].removeRule(j);if(tree_component.css.deleteRule)document.styleSheets[i].deleteRule(j);return true}else return css_rules[j]}}while(css_rules[++j]);return false};tree_component.add_css=function(rule_name){if(tree_component.get_css(rule_name))return false;(tree_component.css.insertRule)?tree_component.css.insertRule(rule_name+' { }',0):tree_component.css.addRule(rule_name,null,0);return tree_component.get_css(rule_name)};tree_component.remove_css=function(rule_name){return tree_component.get_css(rule_name,true)};tree_component.add_sheet=function(opts){if(opts.str){var tmp=document.createElement("style");tmp.type="text/css";if(tmp.styleSheet)tmp.styleSheet.cssText=opts.str;else tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);return tmp.sheet}if(opts.url){if(document.createStyleSheet){try{document.createStyleSheet(opts.url)}catch(e){}}else{var newSS=document.createElement('link');newSS.rel='stylesheet';newSS.type='text/css';newSS.media="all";newSS.href=opts.url;document.getElementsByTagName("head")[0].appendChild(newSS);return newSS.styleSheet}}};$(function(){var u=navigator.userAgent.toLowerCase();var v=(u.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1];var css='/* TREE LAYOUT */ .tree ul { margin:0 0 0 5px; padding:0 0 0 0; list-style-type:none; } .tree li { display:block; min-height:18px; line-height:18px; padding:0 0 0 15px; margin:0 0 0 0; /* Background fix */ clear:both; } .tree li ul { display:none; } .tree li a, .tree li span { display:inline-block;line-height:16px;height:16px;color:black;white-space:nowrap;text-decoration:none;padding:1px 4px 1px 4px;margin:0; } .tree li a:focus { outline: none; } .tree li a input, .tree li span input { margin:0;padding:0 0;display:inline-block;height:12px !important;border:1px solid white;background:white;font-size:10px;font-family:Verdana; } .tree li a input:not([class="xxx"]), .tree li span input:not([class="xxx"]) { padding:1px 0; } /* FOR DOTS */ .tree .ltr li.last { float:left; } .tree > ul li.last { overflow:visible; } /* OPEN OR CLOSE */ .tree li.open ul { display:block; } .tree li.closed ul { display:none !important; } /* FOR DRAGGING */ #jstree-dragged { position:absolute; top:-10px; left:-10px; margin:0; padding:0; } #jstree-dragged ul ul ul { display:none; } #jstree-marker { padding:0; margin:0; line-height:5px; font-size:1px; overflow:hidden; height:5px; position:absolute; left:-45px; top:-30px; z-index:1000; background-color:transparent; background-repeat:no-repeat; display:none; } #jstree-marker.marker { width:45px; background-position:-32px top; } #jstree-marker.marker_plus { width:5px; background-position:right top; } /* BACKGROUND DOTS */ .tree li li { overflow:hidden; } .tree > .ltr > li { display:table; } /* ICONS */ .tree ul ins { display:inline-block; text-decoration:none; width:16px; height:16px; } .tree .ltr ins { margin:0 4px 0 0px; } ';if(/msie/.test(u)&&!/opera/.test(u)){if(parseInt(v)==6)css+='.tree li { height:18px; zoom:1; } .tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); } .marker { width:45px; background-position:-32px top; } .marker_plus { width:5px; background-position:right top; }';if(parseInt(v)==7)css+='.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }'}if(/opera/.test(u))css+='.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';if(/mozilla/.test(u)&&!/(compatible|webkit)/.test(u)&&v.indexOf("1.8")==0)css+='.tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }';tree_component.css=tree_component.add_sheet({str:css})})})(jQuery);(function($){$.extend($.tree.datastores,{"html":function(){return{get:function(obj,tree,opts){return obj&&$(obj).size()?$('<div>').append(tree.get_node(obj).clone()).html():tree.container.children("ul:eq(0)").html()},parse:function(data,tree,opts,callback){if(callback)callback.call(null,data);return data},load:function(data,tree,opts,callback){if(opts.url){$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"html",'success':function(d,textStatus){callback.call(null,d)},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus)}})}else{callback.call(null,opts.static||tree.container.children("ul:eq(0)").html())}}}},"json":function(){return{get:function(obj,tree,opts){var _this=this;if(!obj||$(obj).size()==0)obj=tree.container.children("ul").children("li");else obj=$(obj);if(!opts)opts={};if(!opts.outer_attrib)opts.outer_attrib=["id","rel","class"];if(!opts.inner_attrib)opts.inner_attrib=[];if(obj.size()>1){var arr=[];obj.each(function(){arr.push(_this.get(this,tree,opts))});return arr}if(obj.size()==0)return[];var json={attributes:{},data:{}};if(obj.hasClass("open"))json.data.state="open";if(obj.hasClass("closed"))json.data.state="closed";for(var i in opts.outer_attrib){if(!opts.outer_attrib.hasOwnProperty(i))continue;var val=(opts.outer_attrib[i]=="class")?obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," "):obj.attr(opts.outer_attrib[i]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.attributes[opts.outer_attrib[i]]=val;delete val}if(tree.settings.languages.length){for(var i in tree.settings.languages){if(!tree.settings.languages.hasOwnProperty(i))continue;var a=obj.children("a."+tree.settings.languages[i]);if(opts.force||opts.inner_attrib.length||a.children("ins").get(0).style.backgroundImage.toString().length||a.children("ins").get(0).className.length){json.data[tree.settings.languages[i]]={};json.data[tree.settings.languages[i]].title=tree.get_text(obj,tree.settings.languages[i]);if(a.children("ins").get(0).style.className.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.className}if(a.children("ins").get(0).style.backgroundImage.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}if(opts.inner_attrib.length){json.data[tree.settings.languages[i]].attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data[tree.settings.languages[i]].attributes[opts.inner_attrib[j]]=val;delete val}}}else{json.data[tree.settings.languages[i]]=tree.get_text(obj,tree.settings.languages[i])}}}else{var a=obj.children("a");json.data.title=tree.get_text(obj);if(a.children("ins").size()&&a.children("ins").get(0).className.length){json.data.icon=a.children("ins").get(0).className}if(a.children("ins").size()&&a.children("ins").get(0).style.backgroundImage.length){json.data.icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}if(opts.inner_attrib.length){json.data.attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data.attributes[opts.inner_attrib[j]]=val;delete val}}}if(obj.children("ul").size()>0){json.children=[];obj.children("ul").children("li").each(function(){json.children.push(_this.get(this,tree,opts))})}return json},parse:function(data,tree,opts,callback){if(Object.prototype.toString.apply(data)==="[object Array]"){var str='';for(var i=0;i<data.length;i++){if(typeof data[i]=="function")continue;str+=this.parse(data[i],tree,opts)}if(callback)callback.call(null,str);return str}if(!data||!data.data){if(callback)callback.call(null,false);return""}var str='';str+="<li ";var cls=false;if(data.attributes){for(var i in data.attributes){if(!data.attributes.hasOwnProperty(i))continue;if(i=="class"){str+=" class='"+data.attributes[i]+" ";if(data.state=="closed"||data.state=="open")str+=" "+data.state+" ";str+="' ";cls=true}else str+=" "+i+"='"+data.attributes[i]+"' "}}if(!cls&&(data.state=="closed"||data.state=="open"))str+=" class='"+data.state+"' ";str+=">";if(tree.settings.languages.length){for(var i=0;i<tree.settings.languages.length;i++){var attr={};attr["href"]="";attr["style"]="";attr["class"]=tree.settings.languages[i];if(data.data[tree.settings.languages[i]]&&(typeof data.data[tree.settings.languages[i]].attributes).toLowerCase()!="undefined"){for(var j in data.data[tree.settings.languages[i]].attributes){if(!data.data[tree.settings.languages[i]].attributes.hasOwnProperty(j))continue;if(j=="style"||j=="class")attr[j]+=" "+data.data[tree.settings.languages[i]].attributes[j];else attr[j]=data.data[tree.settings.languages[i]].attributes[j]}}str+="<a";for(var j in attr){if(!attr.hasOwnProperty(j))continue;str+=' '+j+'="'+attr[j]+'" '}str+=">";if(data.data[tree.settings.languages[i]]&&data.data[tree.settings.languages[i]].icon){str+="<ins "+(data.data[tree.settings.languages[i]].icon.indexOf("/")==-1?" class='"+data.data[tree.settings.languages[i]].icon+"' ":" style='background-image:url(\""+data.data[tree.settings.languages[i]].icon+"\");' ")+">&nbsp;</ins>"}else str+="<ins>&nbsp;</ins>";str+=((typeof data.data[tree.settings.languages[i]].title).toLowerCase()!="undefined"?data.data[tree.settings.languages[i]].title:data.data[tree.settings.languages[i]])+"</a>"}}else{var attr={};attr["href"]="";attr["style"]="";attr["class"]="";if((typeof data.data.attributes).toLowerCase()!="undefined"){for(var i in data.data.attributes){if(!data.data.attributes.hasOwnProperty(i))continue;if(i=="style"||i=="class")attr[i]+=" "+data.data.attributes[i];else attr[i]=data.data.attributes[i]}}str+="<a";for(var i in attr){if(!attr.hasOwnProperty(i))continue;str+=' '+i+'="'+attr[i]+'" '}str+=">";if(data.data.icon){str+="<ins "+(data.data.icon.indexOf("/")==-1?" class='"+data.data.icon+"' ":" style='background-image:url(\""+data.data.icon+"\");' ")+">&nbsp;</ins>"}else str+="<ins>&nbsp;</ins>";str+=((typeof data.data.title).toLowerCase()!="undefined"?data.data.title:data.data)+"</a>"}if(data.children&&data.children.length){str+='<ul>';for(var i=0;i<data.children.length;i++){str+=this.parse(data.children[i],tree,opts)}str+='</ul>'}str+="</li>";if(callback)callback.call(null,str);return str},load:function(data,tree,opts,callback){if(opts.static){callback.call(null,opts.static)}else{$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"json",'success':function(d,textStatus){callback.call(null,d)},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus)}})}}}}})})(jQuery);
View
2,058 lib/public/javascripts/jstree/jquery.tree.js
2,058 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN lib/public/javascripts/themes/mongo3/bg.jpg
Diff not rendered.
View
BIN lib/public/javascripts/themes/mongo3/dot_for_ie.gif
Diff not rendered.
View
BIN lib/public/javascripts/themes/mongo3/icons.png
Diff not rendered.
View
39 lib/public/javascripts/themes/mongo3/style.css
@@ -0,0 +1,39 @@
+.tree li {
+ width: 875px;
+ float: left;
+}
+
+/* BACKGROUND */
+.tree-mongo3 .ltr, .tree-mongo3 .rtl { background:transparent; min-width:100%; _width:100%; margin-left:0; margin-right:0; display:table; }
+.tree-mongo3 .ltr > li.leaf, .tree-mongo3 .rtl > li.leaf { background-image:none; }
+
+/* LOCKED */
+.tree-mongo3 .locked li a { color:gray; }
+/* DOTS */
+.tree-mongo3 ul { background-position:6px 1px; background-repeat:repeat-y; background-image:url(data:image/gif;base64,R0lGODlhAgACAIAAAB4dGf///yH5BAEAAAEALAAAAAACAAIAAAICRF4AOw==); _background-image:url("dot_for_ie.gif"); *background-image:url("dot_for_ie.gif"); }
+.tree-mongo3 li { background-position:-64px -16px; background-repeat:no-repeat; background-image:url("icons.png"); }
+/* NO DOTS */
+.tree-mongo3 .no_dots, .tree-mongo3 .no_dots ul { background:transparent; }
+.tree-mongo3 .no_dots li.leaf { background-image:none; background-color:transparent; }
+/* OPEN or CLOSED */
+.tree-mongo3 li.open { background:url("icons.png") -32px -48px no-repeat; }
+.tree-mongo3 li.closed, #jstree-dragged.tree-mongo3 li li.open { background:url("icons.png") -48px -32px no-repeat; }
+#jstree-marker { background-image:url("icons.png"); }
+/* DEFAULT, HOVER, CLICKED, LOADING STATES */
+.tree-mongo3 li a, .tree-mongo3 li span { color:#fff; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
+.tree-mongo3 li a:hover, .tree-mongo3 li a.hover, .tree-mongo3 li span:hover { color: #92b948; }
+.tree-mongo3 li a.clicked, .tree-mongo3 li a.clicked:hover, .tree-mongo3 li span.clicked { background: #beebff; border:1px solid #99defd; padding:0px 3px 0px 3px; }
+/* ICONS */
+.tree-mongo3 ins { vertical-align:text-bottom; background-image:url("icons.png"); background-position:0 0; background-repeat:no-repeat; }
+.tree-mongo3 ul li a.loading ins { background-image:url("throbber.gif") !important; background-position:0 0 !important; } /* UL is added to make selector stronger */
+.tree-mongo3 li a ins.forbidden { background-position:-16px -16px; }
+.tree-mongo3 .locked li a ins { background-position:0 -48px; }
+.tree-mongo3 li span ins { background-position:-16px 0; }
+#jstree-dragged.tree-mongo3 ins { background:url("icons.png") -16px -32px no-repeat; }
+#jstree-dragged.tree-mongo3 ins.forbidden { background:url("icons.png") -16px -16px no-repeat; }
+
+/* CONTEXT MENU */
+.tree-mongo3-context a ins { background-image:url("icons.png"); background-repeat:no-repeat; background-position:-64px -64px; }
+.tree-mongo3-context a ins.create { background-position:0 -16px; }
+.tree-mongo3-context a ins.rename { background-position:-16px 0px; }
+.tree-mongo3-context a ins.remove { background-position:0 -32px; }
View
BIN lib/public/javascripts/themes/mongo3/throbber.gif
Diff not rendered.
View
255 lib/public/stylesheets/mongo3.css
@@ -20,13 +20,6 @@ body {
margin: 0;
}
-span#version {
- color: #4d7bff;
- font-size: .4em;
- vertical-align: bottom;
- margin: 88px 0px 0px -57px;
-}
-
img {
border: none;
vertical-align: text-top;
@@ -34,17 +27,18 @@ img {
/* Flash */
div.flash {
- display: none;
- width: 95%;
- padding: 10px;
- margin: 20px 0 0px 300px;
- font-size: .5em;
- color: #fff;
- border: 1px #92b948 solid;
- -moz-border-radius-bottomleft: 20px;
- -moz-border-radius-topleft: 0px;
- -moz-border-radius-bottomright: 0px;
- -moz-border-radius-topright: 20px;
+ display: none;
+ width: 95%;
+ padding: 10px;
+ margin: 20px 0 0px 300px;
+ font-size: .5em;
+ color: #fff;
+ border: 1px #92b948 solid;
+ -moz-border-radius: 20px 0px 20px 0px;
+ -webkit-border-top-right-radius: 20px;
+ -webkit-border-top-left-radius: 0px;
+ -webkit-border-bottom-left-radius: 20px;
+ -webkit-border-bottom-right-radius: 0px;
}
div.flash_error {
color: #f00;
@@ -67,13 +61,25 @@ div#logo {
margin: 10px 0px 25px 20px;
}
+div#version {
+ color: #4d7bff;
+ font-size: .4em;
+ margin: 64px 0px 0px 255px;
+}
+
+img#logo {
+ display: inline;
+ float: left;
+}
+
+
#main {
clear: left;
margin: 20px 10px 10px 20px;
overflow: none;
}
-ul {
+ul.list {
list-style-image: none;
list-style-position: outside;
list-style-type: none;
@@ -221,15 +227,9 @@ div.scrollable div.items {
/* Commons */
div.borders {
- -moz-border-radius-bottomleft: 7px;
- -moz-border-radius-topleft: 7px;
- -moz-border-radius-bottomright: 7px;
- -moz-border-radius-topright: 7px;
- -webkit-border-top-left-radius: 7px;
- -webkit-border-top-right-radius: 7px;
- -webkit-border-bottom-right-radius: 7px;
- -webkit-border-bottom-left-radius: 7px;
- border: 1px #92b948 solid;
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ border: 1px #92b948 solid;
}
/* Explorer css */
@@ -291,10 +291,8 @@ div#fields {
margin: 20px 10px;
padding: 10px 10px;
overflow: hidden;
- -moz-border-radius-bottomleft: 7px;
- -moz-border-radius-topleft: 7px;
- -moz-border-radius-bottomright: 7px;
- -moz-border-radius-topright: 7px;
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
border: 1px #92b948 solid;
}
div.title {
@@ -378,31 +376,28 @@ img.del_index {
}
input.search {
- background: transparent url(/images/search.png) no-repeat 2px 6px;
- width: 96%;
- border: 2px #434343 solid;
- -moz-border-radius-bottomleft: 0px;
- -moz-border-radius-bottomright: 10px;
- -moz-border-radius-topleft: 10px;
- -moz-border-radius-topright: 0px;
- height: 25px;
- font-size: 1.2em;
- color: #92b948;
- padding: 5px 0px 0px 20px;
- margin: 5px 5px;
+ background: transparent url(/images/search.png) no-repeat 2px 6px;
+ width: 96%;
+ border: 2px #434343 solid;
+ -moz-border-radius: 40px/10px;
+ -webkit-border-radius: 40px 10px;
+ height: 25px;
+ font-size: 1.2em;
+ color: #92b948;
+ padding: 5px 0px 0px 20px;
+ margin: 5px 5px;
}
button {
- -moz-border-radius-bottomleft: 14px;
- -moz-border-radius-bottomright: 14px;
- -moz-border-radius-topleft: 14px;
- -moz-border-radius-topright: 14px;
- -moz-box-shadow: 2px 2px 6px #232323;
- background: transparent url(/images/button.png) repeat-x center bottom;
- height: 20px;
- width: 100px;
- margin-right: 10px;
- color: #c1c1c1;
+ -moz-border-radius: 14px;
+ -moz-box-shadow: 2px 2px 6px #232323;
+ -webkit-border-radius: 14px;
+ -webkit-box-shadow: 2px 2px 6px #232323;
+ background: transparent url(/images/button.png) repeat-x center bottom;
+ height: 20px;
+ width: 100px;
+ margin-right: 10px;
+ color: #c1c1c1;
}
button.show:hover {
@@ -448,7 +443,7 @@ button.drop:hover {
img.delete {
cursor: pointer;
border: 0;
- display:none;
+/* display:none;*/
}
img.wait {
width: 16px;
@@ -467,8 +462,8 @@ img.wait {
border: 2px solid #333;
opacity: 0.8;
-moz-border-radius: 6px;
+ -moz-box-shadow: 0 0 20px #92b948;
-webkit-border-radius: 6px;
- -moz-box-shadow: 0 0 20px #92b948;
-webkit-box-shadow: 0 0 20px #92b948;
}
@@ -488,13 +483,25 @@ div#info {
}
/* Node information */
-div.item img {
+div.item img.drop {
z-index: 100;
display: none;
float: left;
margin-right: 10px;
}
+p.info {
+ float:left;
+}
+
+p.show {
+ float: left;
+}
+img.info {
+ display: block;
+ float: right;
+}
+
div#legend {
border-bottom: 1px #434343 solid;
font-size: 0.5em;
@@ -528,10 +535,8 @@ div.selected {
/* Users */
input.field_border {
- -moz-border-radius-bottomleft: 0px;
- -moz-border-radius-bottomright: 10px;
- -moz-border-radius-topleft: 10px;
- -moz-border-radius-topright: 0px;
+ -moz-border-radius: 40px/10px;
+ -webkit-border-radius: 40px 10px;
}
input.user {
@@ -548,3 +553,131 @@ input.user {
button.user:hover {
background-color: #ad1ecb;
}
+
+/* ------------------------------------------------------------------------- */
+/* Tooltips */
+#tiptip_holder {
+ display: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 99999;
+}
+
+#tiptip_holder.tip_top {
+ padding-bottom: 5px;
+}
+
+#tiptip_holder.tip_bottom {
+ padding-top: 5px;
+}
+
+#tiptip_holder.tip_right {
+ padding-left: 5px;
+}
+
+#tiptip_holder.tip_left {
+ padding-right: 5px;
+}
+
+#tiptip_content {
+ font-size: 11px;
+ color: #fff;
+ text-shadow: 0 0 2px #000;
+ padding: 4px 8px;
+ border: 1px solid rgba(255,255,255,0.25);
+ background-color: rgb(45,45,45);
+ background-color: rgba(45,45,45,0.92);
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));
+ border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ box-shadow: 0 0 3px #555;
+ -webkit-box-shadow: 0 0 3px #555;
+ -moz-box-shadow: 0 0 3px #555;
+}
+
+#tiptip_arrow, #tiptip_arrow_inner {
+ position: absolute;
+ border-color: transparent;
+ border-style: solid;
+ border-width: 6px;
+ height: 0;
+ width: 0;
+}
+
+#tiptip_holder.tip_top #tiptip_arrow {
+ border-top-color: #fff;
+ border-top-color: rgba(255,255,255,0.35);
+}
+
+#tiptip_holder.tip_bottom #tiptip_arrow {
+ border-bottom-color: #fff;
+ border-bottom-color: rgba(255,255,255,0.35);
+}
+
+#tiptip_holder.tip_right #tiptip_arrow {
+ border-right-color: #fff;
+ border-right-color: rgba(255,255,255,0.35);
+}
+
+#tiptip_holder.tip_left #tiptip_arrow {
+ border-left-color: #fff;
+ border-left-color: rgba(255,255,255,0.35);
+}
+
+#tiptip_holder.tip_top #tiptip_arrow_inner {
+ margin-top: -7px;
+ margin-left: -6px;
+ border-top-color: rgb(45,45,45);
+ border-top-color: rgba(45,45,45,0.92);
+}
+
+#tiptip_holder.tip_bottom #tiptip_arrow_inner {
+ margin-top: -5px;
+ margin-left: -6px;
+ border-bottom-color: rgb(45,45,45);
+ border-bottom-color: rgba(45,45,45,0.92);
+}
+
+#tiptip_holder.tip_right #tiptip_arrow_inner {
+ margin-top: -6px;
+ margin-left: -5px;
+ border-right-color: rgb(45,45,45);
+ border-right-color: rgba(45,45,45,0.92);
+}
+
+#tiptip_holder.tip_left #tiptip_arrow_inner {
+ margin-top: -6px;
+ margin-left: -7px;
+ border-left-color: rgb(45,45,45);
+ border-left-color: rgba(45,45,45,0.92);
+}
+
+/* Webkit Hacks */
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+ #tiptip_content {
+ padding: 4px 8px 5px 8px;
+ background-color: rgba(45,45,45,0.88);
+ }
+ #tiptip_holder.tip_bottom #tiptip_arrow_inner {
+ border-bottom-color: rgba(45,45,45,0.88);
+ }
+ #tiptip_holder.tip_top #tiptip_arrow_inner {
+ border-top-color: rgba(20,20,20,0.92);
+ }
+}
+
+/* ------------------------------------------------------------------------- */
+/* Document Tree */
+span span.meta {
+ font-style: italic;
+ color: #c1c1c1;
+}
+
+div.delete {
+ display: inline;
+ float: right;
+ width: 5%;
+}
+
View
2 lib/views/collections/_fields_form.erb
@@ -9,7 +9,7 @@
</div>
<fieldset style="float:right;">
<button type="submit" id="submit_button" class="button show">show</button>
- <img id="show_load" src="/images/loading.gif" style="width:20px;height:20px;vertical-align:top;display:none"></img>
+ <img id="show_load" src="/images/loading.gif" style="width:20px;height:20px;vertical-align:top;display:none"/>
</fieldset>
</form>
View
2 lib/views/collections/_index_form.erb
@@ -4,7 +4,7 @@
<fieldset>
<input id="index" type="text" name="index" class="search" value=""/>
<button type="submit" id="submit_button" class="button search" style="display:none">create</button>
- <img id="create_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"></img>
+ <img id="create_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"/>
</fieldset>
</form>
View
55 lib/views/collections/_index_rows.erb
@@ -3,16 +3,18 @@
<div class="borders" style="padding:10px">
<table id="indexes" class="cltn" border="0" cellpadding="10" cellspacing="20">
<thead>
- <th width="2%">&nbsp;</td>
- <th>Name</th>
- <th>Settings</th>
+ <tr>
+ <th width="3%">&nbsp;</th>
+ <th>Name</th>
+ <th>Settings</th>
+ </tr>
</thead>
<tbody>
<% @indexes.keys.sort.each do |name| %>
<tr id="<%=name%>" valign="top">
<td id="<%=name%>">
- <img class="del_index" id="<%=name%>" src="/images/delete.png" title="delete this index"/>
- <img class="wait" id="wait_<%=name%>" src="/images/loading.gif"></img>
+ <img rel="div#confirm_drop" class="drop" style="display:none" id="<%=name%>" src="/images/delete.png" title="delete this index"/>
+ <img class="wait" id="wait_<%=name%>" src="/images/loading.gif"/>
</td>
<td><%=name%></td>
<% buff = [];@indexes[name].each do |pair| %>
@@ -25,30 +27,53 @@
</table>
</div>
+<div class="modal" id="confirm_drop" style="font-size:1em">
+ <p>Dropping index. Are you sure?</p>
+ <p style="margin:10px">
+ <button class="close yes">Yes</button>
+ <button class="close">No</button>
+ </p>
+</div>
+
<script>
$( function() {
- $("table#indexes tr" ).hover(
+ $("table#indexes tbody tr" ).hover(
function() {
$(this).addClass( 'highlight' );
- $("td#" + $(this).attr('id') + " img.del_index" ).show();
+ $("td#" + $(this).attr('id') + " img.drop" ).show();
},
function() {
$(this).removeClass( 'highlight' );
- $("td#" + $(this).attr('id') + " img.del_index" ).hide();
+ $("td#" + $(this).attr('id') + " img.drop" ).hide();
});
- $( "img.del_index" ).click( function() {
- var id = $(this).attr('id');
+
+ $('img.drop' ).overlay( {
+ expose: {
+ color: '#212021',
+ loadSpeed: 200,
+ opacity: 0.9
+ },
+ onBeforeLoad: function() {
+ $("button.yes").attr( 'id', this.getTrigger().attr('id') );
+ },
+ closeOnClick: false
+ });
+
+ $( 'button.yes' ).click( function() {
+ var self = $(this);
$.ajax({
- data: {id: id},
+ data: {id:self.attr('id')},
dataType: 'script',
type: 'post',
url: '/collections/drop_index/',
- beforeSend: function() { $('img#_wait_' + id ).show(); },
+ beforeSend: function() {
+ $('img#_wait_' + self.attr('id') ).show();
+ },
complete: function() {
- $('img#_wait_' + id ).hide();
- $('tr#' + id ).fadeOut();
+ $('img#_wait_' + self.attr('id') ).hide();
+ $('tr#' + self.