diff --git a/NOTICE b/NOTICE index 39e1fb5a94..e35b54607c 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ OpenNebula Open Source Project -Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) +Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) ----------------------------------------- You can find more information about the project, release notes and @@ -13,8 +13,9 @@ AUTHORS ACKNOWLEDGEMENTS The following people have contributed to the development of the technology -- Javier Fontan Muiños (jfontan@fdi.ucm.es) -- Constantino Vazquez Blanco (tinova@fdi.ucm.es) -- Jaime Melis Bayo (j.melis@fdi.ucm.es) -- Carlos Martin Sanchez (cmartins@fdi.ucm.es) -- Daniel Molina Aranda (danmolin@pdi.ucm.es) +- Javier Fontan Muiños (jfontan@opennebula.org) +- Constantino Vazquez Blanco (tinova@opennebula.org) +- Jaime Melis Bayo (jmelis@opennebula.org) +- Carlos Martin Sanchez (cmartin@opennebula.org) +- Daniel Molina Aranda (dmolina@opennebula.org) +- Hector Sanjuan Redondo (hsanjuan@opennebula.org) diff --git a/install.sh b/install.sh index 2c971bac5b..b5c507ac43 100755 --- a/install.sh +++ b/install.sh @@ -35,11 +35,11 @@ usage() { echo "-g: group of the user that will run opennebula, defults to user" echo " executing install.sh" echo "-k: keep configuration files of existing OpenNebula installation, useful" - echo " when upgrading. This flag should not be set when installing" + echo " when upgrading. This flag should not be set when installing" echo " OpenNebula for the first time" echo "-d: target installation directory, if not defined it'd be root. Must be" echo " an absolute path." - echo "-c: install only 'occi' or 'ec2' client files" + echo "-c: install client utilities: OpenNebula cli, occi and ec2 client files" echo "-r: remove Opennebula, only useful if -d was not specified, otherwise" echo " rm -rf \$ONE_LOCATION would do the job" echo "-l: creates symlinks instead of copying files, useful for development" @@ -47,7 +47,7 @@ usage() { } #------------------------------------------------------------------------------- -TEMP_OPT=`getopt -o hkrlc:u:g:d: -n 'install.sh' -- "$@"` +TEMP_OPT=`getopt -o hkrlcu:g:d: -n 'install.sh' -- "$@"` if [ $? != 0 ] ; then usage @@ -70,7 +70,7 @@ while true ; do -k) INSTALL_ETC="no" ; shift ;; -r) UNINSTALL="yes" ; shift ;; -l) LINK="yes" ; shift ;; - -c) CLIENT="$2" ; shift 2;; + -c) CLIENT="yes" ; shift ;; -u) ONEADMIN_USER="$2" ; shift 2;; -g) ONEADMIN_GROUP="$2"; shift 2;; -d) ROOT="$2" ; shift 2 ;; @@ -79,14 +79,6 @@ while true ; do esac done -if echo "$CLIENT" | egrep -ivq '^(no|occi|ec2)$'; then - echo "ERROR: client '$CLIENT' not valid. Use either 'occi' or 'ec2'." - usage - exit 1 -else - CLIENT=`echo $CLIENT | tr [:upper:] [:lower:]` -fi - #------------------------------------------------------------------------------- # Definition of locations #------------------------------------------------------------------------------- @@ -184,6 +176,7 @@ LIB_DIRS="$LIB_LOCATION/ruby \ $LIB_LOCATION/remotes/im \ $LIB_LOCATION/remotes/im/kvm.d \ $LIB_LOCATION/remotes/im/xen.d \ + $LIB_LOCATION/remotes/im/ganglia.d \ $LIB_LOCATION/remotes/vmm/xen \ $LIB_LOCATION/remotes/vmm/kvm" @@ -191,24 +184,27 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/im \ $VAR_LOCATION/remotes/im/kvm.d \ $VAR_LOCATION/remotes/im/xen.d \ + $VAR_LOCATION/remotes/im/ganglia.d \ $VAR_LOCATION/remotes/vmm/xen \ $VAR_LOCATION/remotes/vmm/kvm" LIB_ECO_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula + $LIB_LOCATION/ruby/OpenNebula \ $LIB_LOCATION/ruby/cloud/ \ $LIB_LOCATION/ruby/cloud/econe" LIB_OCCI_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula + $LIB_LOCATION/ruby/OpenNebula \ $LIB_LOCATION/ruby/cloud/occi" +LIB_CLI_DIRS="$LIB_LOCATION/ruby \ + $LIB_LOCATION/ruby/OpenNebula" + if [ "$CLIENT" = "no" ]; then MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS" -elif [ "$CLIENT" = "ec2" ]; then - MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS" -elif [ "$CLIENT" = "occi" ]; then - MAKE_DIRS="$MAKE_DIRS $LIB_OCCI_CLIENT_DIRS" +else + MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS \ + $LIB_CLI_DIRS" fi #------------------------------------------------------------------------------- @@ -216,61 +212,78 @@ fi # FILE DEFINITION, WHAT IS GOING TO BE INSTALLED AND WHERE #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- +INSTALL_FILES=( + BIN_FILES:$BIN_LOCATION + INCLUDE_FILES:$INCLUDE_LOCATION + LIB_FILES:$LIB_LOCATION + RUBY_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula + MADS_LIB_FILES:$LIB_LOCATION/mads + IM_PROBES_FILES:$VAR_LOCATION/remotes/im + IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d + IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d + IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d + VMM_SSH_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm + VMM_SSH_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen + VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll + VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/xen/poll + VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll_local + VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/xen/poll_local + IM_PROBES_FILES:$LIB_LOCATION/remotes/im + IM_PROBES_KVM_FILES:$LIB_LOCATION/remotes/im/kvm.d + IM_PROBES_XEN_FILES:$LIB_LOCATION/remotes/im/xen.d + IM_PROBES_GANGLIA_FILES:$LIB_LOCATION/remotes/im/ganglia.d + VMM_SSH_KVM_SCRIPTS:$LIB_LOCATION/remotes/vmm/kvm + VMM_SSH_XEN_SCRIPTS:$LIB_LOCATION/remotes/vmm/xen + VMM_SSH_XEN_KVM_POLL:$LIB_LOCATION/remotes/vmm/kvm/poll + VMM_SSH_XEN_KVM_POLL:$LIB_LOCATION/remotes/vmm/xen/poll + VMM_SSH_GANGLIA_POLL:$LIB_LOCATION/remotes/vmm/kvm/poll_local + VMM_SSH_GANGLIA_POLL:$LIB_LOCATION/remotes/vmm/xen/poll_local + NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs + SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh + DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy + LVM_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/lvm + EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples + TM_EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples/tm + HOOK_SHARE_FILES:$SHARE_LOCATION/hooks + COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud + ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe + ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views + ECO_BIN_FILES:$BIN_LOCATION + OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi + OCCI_BIN_FILES:$BIN_LOCATION + MAN_FILES:$MAN_LOCATION +) -INSTALL_FILES[0]="BIN_FILES:$BIN_LOCATION" -INSTALL_FILES[1]="INCLUDE_FILES:$INCLUDE_LOCATION" -INSTALL_FILES[2]="LIB_FILES:$LIB_LOCATION" -INSTALL_FILES[3]="RUBY_LIB_FILES:$LIB_LOCATION/ruby" -INSTALL_FILES[4]="RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula" -INSTALL_FILES[5]="MADS_LIB_FILES:$LIB_LOCATION/mads" -INSTALL_FILES[6]="IM_PROBES_FILES:$VAR_LOCATION/remotes/im" -INSTALL_FILES[7]="IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d" -INSTALL_FILES[8]="IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d" -INSTALL_FILES[9]="VMM_SSH_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm" -INSTALL_FILES[10]="VMM_SSH_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen" -INSTALL_FILES[11]="IM_PROBES_FILES:$LIB_LOCATION/remotes/im" -INSTALL_FILES[12]="IM_PROBES_KVM_FILES:$LIB_LOCATION/remotes/im/kvm.d" -INSTALL_FILES[13]="IM_PROBES_XEN_FILES:$LIB_LOCATION/remotes/im/xen.d" -INSTALL_FILES[14]="VMM_SSH_KVM_SCRIPTS:$LIB_LOCATION/remotes/vmm/kvm" -INSTALL_FILES[15]="VMM_SSH_XEN_SCRIPTS:$LIB_LOCATION/remotes/vmm/xen" -INSTALL_FILES[16]="NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs" -INSTALL_FILES[17]="SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh" -INSTALL_FILES[18]="DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy" -INSTALL_FILES[19]="LVM_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/lvm" -INSTALL_FILES[20]="EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples" -INSTALL_FILES[21]="TM_EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples/tm" -INSTALL_FILES[22]="HOOK_SHARE_FILES:$SHARE_LOCATION/hooks" -INSTALL_FILES[23]="COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud" -INSTALL_FILES[24]="ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe" -INSTALL_FILES[25]="ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views" -INSTALL_FILES[26]="ECO_BIN_FILES:$BIN_LOCATION" -INSTALL_FILES[27]="OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi" -INSTALL_FILES[28]="OCCI_BIN_FILES:$BIN_LOCATION" -INSTALL_FILES[29]="MAN_FILES:$MAN_LOCATION" +INSTALL_CLIENT_FILES=( + COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud + ECO_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/econe + ECO_BIN_CLIENT_FILES:$BIN_LOCATION + COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud + OCCI_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/occi + OCCI_BIN_CLIENT_FILES:$BIN_LOCATION + CLI_BIN_FILES:$BIN_LOCATION + CLI_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula +) -INSTALL_ECO_CLIENT_FILES[0]="COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud" -INSTALL_ECO_CLIENT_FILES[1]="ECO_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/econe" -INSTALL_ECO_CLIENT_FILES[2]="ECO_BIN_CLIENT_FILES:$BIN_LOCATION" - -INSTALL_OCCI_CLIENT_FILES[0]="COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud" -INSTALL_OCCI_CLIENT_FILES[1]="OCCI_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/occi" -INSTALL_OCCI_CLIENT_FILES[2]="OCCI_BIN_CLIENT_FILES:$BIN_LOCATION" - -INSTALL_ETC_FILES[0]="ETC_FILES:$ETC_LOCATION" -INSTALL_ETC_FILES[1]="VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2" -INSTALL_ETC_FILES[2]="VMM_SSH_ETC_FILES:$ETC_LOCATION/vmm_ssh" -INSTALL_ETC_FILES[3]="VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh" -INSTALL_ETC_FILES[4]="IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2" -INSTALL_ETC_FILES[5]="TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs" -INSTALL_ETC_FILES[6]="TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh" -INSTALL_ETC_FILES[7]="TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy" -INSTALL_ETC_FILES[8]="TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm" -INSTALL_ETC_FILES[9]="HM_ETC_FILES:$ETC_LOCATION/hm" -INSTALL_ETC_FILES[10]="AUTH_ETC_FILES:$ETC_LOCATION/auth" -INSTALL_ETC_FILES[11]="ECO_ETC_FILES:$ETC_LOCATION" -INSTALL_ETC_FILES[12]="ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates" -INSTALL_ETC_FILES[13]="OCCI_ETC_FILES:$ETC_LOCATION" -INSTALL_ETC_FILES[14]="OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates" +INSTALL_ETC_FILES=( + ETC_FILES:$ETC_LOCATION + VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 + VMM_SSH_ETC_FILES:$ETC_LOCATION/vmm_ssh + VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh + IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2 + TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs + TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh + TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy + TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm + HM_ETC_FILES:$ETC_LOCATION/hm + AUTH_ETC_FILES:$ETC_LOCATION/auth + ECO_ETC_FILES:$ETC_LOCATION + ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates + OCCI_ETC_FILES:$ETC_LOCATION + OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates +) #------------------------------------------------------------------------------- # Binary files, to be installed under $BIN_LOCATION @@ -304,6 +317,7 @@ RUBY_LIB_FILES="src/mad/ruby/ActionManager.rb \ src/mad/ruby/CommandManager.rb \ src/mad/ruby/OpenNebulaDriver.rb \ src/mad/ruby/VirtualMachineDriver.rb \ + src/mad/ruby/Ganglia.rb \ src/cli/client_utilities.rb \ src/cli/command_parse.rb \ src/oca/ruby/OpenNebula.rb \ @@ -367,7 +381,6 @@ VMM_SSH_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ src/vmm_mad/remotes/kvm/deploy \ src/vmm_mad/remotes/kvm/kvmrc \ src/vmm_mad/remotes/kvm/migrate \ - src/vmm_mad/remotes/kvm/poll \ src/vmm_mad/remotes/kvm/restore \ src/vmm_mad/remotes/kvm/save \ src/vmm_mad/remotes/kvm/shutdown" @@ -380,11 +393,17 @@ VMM_SSH_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ src/vmm_mad/remotes/xen/deploy \ src/vmm_mad/remotes/xen/xenrc \ src/vmm_mad/remotes/xen/migrate \ - src/vmm_mad/remotes/xen/poll \ src/vmm_mad/remotes/xen/restore \ src/vmm_mad/remotes/xen/save \ src/vmm_mad/remotes/xen/shutdown" +#----------------------------------------------------------------------------- +# VMM SH Driver xen/kvm scripts, to be installed under $REMOTES_LOCATION/vmm/* +#----------------------------------------------------------------------------- + +VMM_SSH_XEN_KVM_POLL="src/vmm_mad/remotes/poll_xen_kvm.rb" +VMM_SSH_GANGLIA_POLL="src/vmm_mad/remotes/poll_ganglia.rb" + #------------------------------------------------------------------------------- # Information Manager Probes, to be installed under $LIB_LOCATION/remotes #------------------------------------------------------------------------------- @@ -401,6 +420,8 @@ IM_PROBES_KVM_FILES="src/im_mad/remotes/kvm.d/kvm.rb \ src/im_mad/remotes/kvm.d/cpu.sh \ src/im_mad/remotes/kvm.d/name.sh" +IM_PROBES_GANGLIA_FILES="src/im_mad/remotes/ganglia.d/ganglia_probe" + #------------------------------------------------------------------------------- # Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands @@ -456,7 +477,7 @@ VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \ VMM_SSH_ETC_FILES="src/vmm_mad/ssh/vmm_sshrc \ src/vmm_mad/ssh/vmm_ssh_kvm.conf \ src/vmm_mad/ssh/vmm_ssh_xen.conf" - + VMM_SH_ETC_FILES="src/vmm_mad/sh/vmm_shrc" #------------------------------------------------------------------------------- @@ -609,6 +630,22 @@ OCCI_ETC_TEMPLATE_FILES="src/cloud/occi/etc/templates/common.erb \ src/cloud/occi/etc/templates/medium.erb \ src/cloud/occi/etc/templates/large.erb" +#----------------------------------------------------------------------------- +# CLI files +#----------------------------------------------------------------------------- + +CLI_LIB_FILES="src/mad/ruby/CommandManager.rb \ + src/cli/client_utilities.rb \ + src/cli/command_parse.rb \ + src/oca/ruby/OpenNebula.rb" + +CLI_BIN_FILES="src/cli/onevm \ + src/cli/onehost \ + src/cli/onevnet \ + src/cli/oneuser \ + src/cli/oneimage \ + src/cli/onecluster" + #----------------------------------------------------------------------------- # MAN files #----------------------------------------------------------------------------- @@ -661,10 +698,8 @@ do_file() { if [ "$CLIENT" = "no" ]; then INSTALL_SET=${INSTALL_FILES[@]} -elif [ "$CLIENT" = "occi" ]; then - INSTALL_SET=${INSTALL_OCCI_CLIENT_FILES[@]} -elif [ "$CLIENT" = "ec2" ]; then - INSTALL_SET=${INSTALL_ECO_CLIENT_FILES[@]} +else + INSTALL_SET=${INSTALL_CLIENT_FILES[@]} fi for i in ${INSTALL_SET[@]}; do diff --git a/share/etc/oned.conf b/share/etc/oned.conf index b8c88492bb..521791f9f5 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -149,6 +149,15 @@ IM_MAD = [ # arguments = "im_ec2/im_ec2.conf" ] #------------------------------------------------------------------------------- +#----------------------------------------------------------------------------- +# Ganglia Information Driver Manager Configuration +#----------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_ganglia", +# executable = "one_im_sh", +# arguments = "ganglia" ] +#----------------------------------------------------------------------------- + #------------------------------------------------------------------------------- # Dummy Information Driver Manager Configuration #------------------------------------------------------------------------------- diff --git a/share/hooks/ebtables-flush b/share/hooks/ebtables-flush index 1881b5aa34..049149c8bf 100755 --- a/share/hooks/ebtables-flush +++ b/share/hooks/ebtables-flush @@ -16,27 +16,50 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -def deactivate(rule) - system "sudo ebtables -D #{rule}" -end - -def get_interfaces - brctl_exit=`brctl show` - brctl_exit.split("\n")[1..-1].collect{|l| l.split.last } -end +#------------------------------------------------------------------------------ +# Configuration Options for the script. Change it to fit your installation +#------------------------------------------------------------------------------ +CONF = { + :ebtables => "sudo /sbin/ebtables", + :brctl => "/usr/sbin/brctl" +} +#------------------------------------------------------------------------------ RULE_TYPES=[ /-i ([\w\.\-]+) /, /-o ([\w\.\-]+) / ] +#------------------------------------------------------------------------------ +# Applies a given rule to the ebtables +#------------------------------------------------------------------------------ +def deactivate(rule) + system "#{CONF[:ebtables]} -D #{rule}" +end +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Gets the interfaces attached to a given bridge +#------------------------------------------------------------------------------ +def get_interfaces + brctl_exit =`#{CONF[:brctl]} show` + brctl_exit.split("\n")[1..-1].collect{|l| l.split.last } +end +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Gets the interfaces attached to a given bridge +#------------------------------------------------------------------------------ def get_rules - rules=Array.new + rules = Array.new + RULE_TYPES.each do |reg| - ebtables_exit=`sudo ebtables -L FORWARD` + ebtables_exit = `#{CONF[:ebtables]} -L FORWARD` + rules << ebtables_exit.split("\n")[3..-1].collect do |l| - line=l.strip - m=line.match(reg) + line = l.strip + m = line.match(reg) + if m interface=m[1] { @@ -48,14 +71,19 @@ def get_rules end end.compact end + rules.flatten end -# if executed on "done", we must wait a bit until the tap is detached from the bridge +############################################################################### +# Main +############################################################################### + +# on "done", it waits a bit until the tap is detached from the bridge sleep 1 -interfaces=get_interfaces -all_rules=get_rules +interfaces = get_interfaces +all_rules = get_rules all_rules.each do |rule| if !interfaces.include?(rule[:interface]) diff --git a/share/hooks/ebtables-kvm b/share/hooks/ebtables-kvm index b31ae342d7..2974090f59 100755 --- a/share/hooks/ebtables-kvm +++ b/share/hooks/ebtables-kvm @@ -16,60 +16,74 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -require 'pp' require 'rexml/document' -VM_NAME=ARGV[0] - -# Uncomment to act only on the listed bridges. -#FILTERED_BRIDGES = ['beth0'] +#------------------------------------------------------------------------------ +# Configuration Options for the script. Change it to fit your installation +#------------------------------------------------------------------------------ +CONF = { + :ebtables => "sudo /sbin/ebtables", + :brctl => "/usr/sbin/brctl", + :virsh => "virsh -c qemu:///system" +} +#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------ +# Applies a given rule to the ebtables +#------------------------------------------------------------------------------ def activate(rule) - system "sudo ebtables -A #{rule}" + system "#{CONF[:ebtables]} -A #{rule}" end - -def get_bridges - bridges = Hash.new - brctl_exit=`brctl show` +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Gets the interfaces attached to a given bridge +#------------------------------------------------------------------------------ +def get_interfaces + bridges = Hash.new + brctl_exit =`#{CONF[:brctl]} show` cur_bridge = "" + brctl_exit.split("\n")[1..-1].each do |l| l = l.split + if l.length > 1 cur_bridge = l[0] + bridges[cur_bridge] = Array.new bridges[cur_bridge] << l[3] else bridges[cur_bridge] << l[0] end end + bridges end +#------------------------------------------------------------------------------ -def get_interfaces - bridges = get_bridges - if defined? FILTERED_BRIDGES - FILTERED_BRIDGES.collect {|k,v| bridges[k]}.flatten - else - bridges.values.flatten - end -end +############################################################################### +# Main +############################################################################### -nets=`virsh -c qemu:///system dumpxml #{VM_NAME}` +VM_NAME = ARGV[0] -doc=REXML::Document.new(nets).root +nets = `#{CONF[:virsh]} dumpxml #{VM_NAME}` +doc = REXML::Document.new(nets).root interfaces = get_interfaces() doc.elements.each('/domain/devices/interface') {|net| - tap=net.elements['target'].attributes['dev'] - if interfaces.include? tap - iface_mac=net.elements['mac'].attributes['address'] - - mac=iface_mac.split(':') - mac[-1]='00' - net_mac=mac.join(':') - + + tap = net.elements['target'].attributes['dev'] + if interfaces.include? tap + iface_mac = net.elements['mac'].attributes['address'] + + mac = iface_mac.split(':') + mac[-1] = '00' + + net_mac = mac.join(':') + in_rule="FORWARD -s ! #{net_mac}/ff:ff:ff:ff:ff:00 -o #{tap} -j DROP" out_rule="FORWARD -s ! #{iface_mac} -i #{tap} -j DROP" @@ -77,4 +91,3 @@ doc.elements.each('/domain/devices/interface') {|net| activate(out_rule) end } - diff --git a/share/hooks/ebtables-xen b/share/hooks/ebtables-xen index bff2864f29..2babd8de13 100755 --- a/share/hooks/ebtables-xen +++ b/share/hooks/ebtables-xen @@ -16,64 +16,78 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -VM_NAME=ARGV[0] - -# Uncomment to act only on the listed bridges. -#FILTERED_BRIDGES = ['beth0'] +#------------------------------------------------------------------------------ +# Configuration Options for the script. Change it to fit your installation +#------------------------------------------------------------------------------ +CONF = { + :ebtables => "sudo /sbin/ebtables", + :brctl => "/usr/sbin/brctl", + :xm => "sudo /usr/sbin/xm" +} +#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------ +# Applies a given rule to the ebtables +#------------------------------------------------------------------------------ def activate(rule) - system "sudo ebtables -A #{rule}" + system "#{CONF[:ebtables]} -A #{rule}" end +#------------------------------------------------------------------------------ -def get_bridges - bridges = Hash.new - brctl_exit=`brctl show` +#------------------------------------------------------------------------------ +# Gets the interfaces attached to a given bridge +#------------------------------------------------------------------------------ +def get_interfaces + bridges = Hash.new + brctl_exit =`#{CONF[:brctl]} show` cur_bridge = "" + brctl_exit.split("\n")[1..-1].each do |l| l = l.split + if l.length > 1 cur_bridge = l[0] + bridges[cur_bridge] = Array.new bridges[cur_bridge] << l[3] else bridges[cur_bridge] << l[0] end end + bridges end +#------------------------------------------------------------------------------ -def get_interfaces - bridges = get_bridges - if defined? FILTERED_BRIDGES - FILTERED_BRIDGES.collect {|k,v| bridges[k]}.flatten - else - bridges.values.flatten - end -end +############################################################################### +# Main +############################################################################### -vm_id=`sudo xm domid #{VM_NAME}`.strip -networks=`sudo xm network-list #{vm_id}`.split("\n")[1..-1] +VM_NAME = ARGV[0] + +vm_id =`#{CONF[:xm]} domid #{VM_NAME}`.strip +networks =`#{CONF[:xm]} network-list #{vm_id}`.split("\n")[1..-1] interfaces = get_interfaces networks.each {|net| - n=net.split - iface_id=n[0] - iface_mac=n[2] + n = net.split - tap="vif#{vm_id}.#{iface_id}" + iface_id = n[0] + iface_mac = n[2] + + tap = "vif#{vm_id}.#{iface_id}" if interfaces.include? tap - mac=iface_mac.split(':') - mac[-1]='00' - net_mac=mac.join(':') + mac = iface_mac.split(':') + mac[-1] = '00' + net_mac = mac.join(':') - in_rule="FORWARD -s ! #{net_mac}/ff:ff:ff:ff:ff:00 -o #{tap} -j DROP" - out_rule="FORWARD -s ! #{iface_mac} -i #{tap} -j DROP" + in_rule = "FORWARD -s ! #{net_mac}/ff:ff:ff:ff:ff:00 -o #{tap} -j DROP" + out_rule = "FORWARD -s ! #{iface_mac} -i #{tap} -j DROP" activate(in_rule) activate(out_rule) end } - diff --git a/src/im_mad/remotes/ganglia.d/ganglia_probe b/src/im_mad/remotes/ganglia.d/ganglia_probe new file mode 100755 index 0000000000..51bab34db8 --- /dev/null +++ b/src/im_mad/remotes/ganglia.d/ganglia_probe @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby + +# Adds current directory to the library search path (make the script +# compatible with ruby 1.9.2) +$: << '.' + +ONE_LOCATION=ENV["ONE_LOCATION"] + +if !ONE_LOCATION + RUBY_LIB_LOCATION="/usr/lib/one/ruby" +else + RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" +end + +$: << RUBY_LIB_LOCATION + +require 'socket' +require 'pp' +require 'rexml/document' +require 'Ganglia' + +############################# +## CONFIGURATION GOES HERE ## +############################# + +# host and port where to get monitoring information +GANGLIA_HOST='localhost' +GANGLIA_PORT=8649 + +# If this variable is set the the information will be read from that file +# otherwise it will get information from the ganglia endpoint +# defined previously +#GANGLIA_FILE='data.xml' + + +host=ARGV[1] + +# Gets monitoring data from ganglia or file +begin + if defined?(GANGLIA_FILE) + ganglia=GangliaHost.new_from_file(host, GANGLIA_FILE) + else + ganglia=GangliaHost.new_from_ganglia(host, GANGLIA_HOST, GANGLIA_PORT) + end +rescue + STDERR.puts "Error reading ganglia data" + exit -1 +end + +data=ganglia.to_hash + + +# Monitoring info extraction + +info=Hash.new + +total_cpu=data['cpu_num'].to_i*100 + +info["TOTALCPU"]=total_cpu +info["CPUSPEED"]=data['cpu_speed'] + +info["TOTALMEMORY"]=data['mem_total'] +info["USEDMEMORY"]=data['mem_total'].to_i-data['mem_free'].to_i +info["FREEMEMORY"]=data['mem_free'].to_i + +free_cpu=(data['cpu_idle'].to_f/100.0) * total_cpu + +info["FREECPU"]=free_cpu +info["USEDCPU"]=total_cpu - free_cpu + +info["NETRX"]=data['bytes_out'] +info["NETTX"]=data['bytes_in'] + +info["KVM_VERSION"]=data['KVM_VERSION'] +info["XEN_VERSION"]=data['XEN_VERSION'] + +# Get opennebula metrics from ganglia + +info.merge!(ganglia.get_opennebula_metrics) + + +# Print information + +info.each do |key, value| + GangliaHost.print_info(key, value) +end + + + diff --git a/src/im_mad/remotes/run_probes b/src/im_mad/remotes/run_probes index 3209b285bc..d77b75714f 100755 --- a/src/im_mad/remotes/run_probes +++ b/src/im_mad/remotes/run_probes @@ -16,6 +16,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +export LANG=C + HYPERVISOR_DIR=$1.d ARGUMENTS=$* diff --git a/src/lcm/test/LifeCycleManagerTest.cc b/src/lcm/test/LifeCycleManagerTest.cc index 3565bbf492..1fabeb6045 100644 --- a/src/lcm/test/LifeCycleManagerTest.cc +++ b/src/lcm/test/LifeCycleManagerTest.cc @@ -133,13 +133,13 @@ private: /** * Wait until the VM changes to the specified state. - * There is a time-out of 3 seconds. + * There is a time-out of 30 seconds. */ void wait_assert(VirtualMachine* vm, VirtualMachine::VmState state, VirtualMachine::LcmState lcm_state = VirtualMachine::RUNNING) { - int n_steps = 100; + int n_steps = 1000; int step = 30000; int i = 0; diff --git a/src/mad/ruby/CommandManager.rb b/src/mad/ruby/CommandManager.rb index f198981988..98a40703d8 100644 --- a/src/mad/ruby/CommandManager.rb +++ b/src/mad/ruby/CommandManager.rb @@ -166,7 +166,7 @@ class RemotesCommand < SSHCommand cmd.run end - while cmd.code != 0 or retries != 0 + while cmd.code != 0 and retries != 0 sleep 1 cmd.run retries = retries - 1 diff --git a/src/mad/ruby/Ganglia.rb b/src/mad/ruby/Ganglia.rb new file mode 100644 index 0000000000..f9b3acb7e3 --- /dev/null +++ b/src/mad/ruby/Ganglia.rb @@ -0,0 +1,167 @@ +# ----------------------------------------------------------------------------- +# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +require 'socket' +require 'pp' +require 'rexml/document' + +begin + require 'rubygems' + require 'nokogiri' + $nokogiri_enabled=true +rescue LoadError + $nokogiri_enabled=false +end + +# ----------------------------------------------------------------------------- +# This class holds the parsing code of ganglia xml monitoring data +# ----------------------------------------------------------------------------- +class GangliaHost + + # Gets monitoring data from ganglia or file + def self.new_with_options(host, options) + begin + if options[:file] + xml=File.read(options[:file]) + else + socket=TCPSocket.new(options[:host], options[:port]) + xml=socket.read + socket.close + end + rescue + STDERR.puts "Error reading ganglia data" + nil + end + + self.new(xml, host) + end + + def self.new_from_file(host, file) + new_with_options(host, :file => file) + end + + def self.new_from_ganglia(host, server, port) + new_with_options(host, :host => server, :port => port) + end + + # Initializes the object with raw xml data and the host we + # want to monitor + def initialize(xml, host) + + # Checks if the host was specified as an IP address to + # choose the correct xpath string + if host.match(/(\d{1,3}\.){3}\d{1,3}/) + xpath="/GANGLIA_XML/CLUSTER/HOST[@IP='#{host}']" + else + xpath="/GANGLIA_XML/CLUSTER/HOST[@NAME='#{host}']" + end + + if $nokogiri_enabled + @doc=Nokogiri::XML.parse(xml) + @host=@doc.xpath(xpath) + else + @doc=REXML::Document.new(xml) + @host=@doc.root.elements[xpath] + end + end + + # Gets a metric value from the host + def get_value(name) + xpath="METRIC[@NAME='#{name}']" + + if $nokogiri_enabled + metric=@host.xpath(xpath).first + else + metric=@host.elements[xpath] + end + + if metric + if $nokogiri_enabled + metric.attr 'VAL' + else + metric.attributes['VAL'] + end + else + nil + end + end + + # The same as get_value + def [](name) + get_value(name) + end + + # Returns a hash with the hosts metrics + def to_hash + xpath='METRIC' + + if $nokogiri_enabled + values=Hash.new + + @host.xpath(xpath).each do |node| + values[node.attr('NAME')]=node.attr('VAL') + end + + values + else + values=Hash.new + + @host.elements.each(xpath) do |node| + values[node.attributes['NAME']]=node.attributes['VAL'] + end + + values + end + end + + # extract opennebula related metrics (start with OPENNEBULA_) and + # return a hash + def get_opennebula_metrics + all_info=self.to_hash + one_info=Hash.new + + keys=all_info.keys.select {|key| key.match(/^OPENNEBULA_.*/) } + + keys.each do |key| + m=key.match(/^OPENNEBULA_(.*)$/) + name=m[1] + + one_info[name]=all_info[key] + end + + one_info + end + + # extract base64 encoded yaml hash from OPENNEBULA_VMS_INFORMATION + # metric and return the hash with the VMs information + def get_vms_information + require 'base64' + require 'yaml' + + base64_info=self['OPENNEBULA_VMS_INFORMATION'] + + return nil if !base64_info + + info_yaml=Base64::decode64(base64_info) + info=YAML.load(info_yaml) + end + + # Helper class method to print monitoring values + def self.print_info(name, value) + return if value.nil? or value.to_s.strip.empty? + puts "#{name}=\"#{value}\"" + end +end diff --git a/src/oca/ruby/OpenNebula/XMLUtils.rb b/src/oca/ruby/OpenNebula/XMLUtils.rb index f9acffbee1..c532efd812 100644 --- a/src/oca/ruby/OpenNebula/XMLUtils.rb +++ b/src/oca/ruby/OpenNebula/XMLUtils.rb @@ -46,15 +46,19 @@ module OpenNebula # xml:: _String_ the XML document of the object # root_element:: _String_ Base xml element def initialize_xml(xml, root_element) - if NOKOGIRI - @xml = Nokogiri::XML(xml).xpath("/#{root_element}") - if @xml.size == 0 - @xml = nil - end + @xml = XMLElement.build_xml(xml, root_element) + + if OpenNebula.is_error?(@xml) + @xml = nil else - @xml = REXML::Document.new(xml).root - if @xml.name != root_element - @xml = nil + if NOKOGIRI + if @xml.size == 0 + @xml = nil + end + else + if @xml.name != root_element + @xml = nil + end end end end @@ -64,10 +68,14 @@ module OpenNebula # root_element:: _String_ Base xml element # [return] _XML_ object for the underlying XML engine def self.build_xml(xml, root_element) - if NOKOGIRI - doc = Nokogiri::XML(xml).xpath("/#{root_element}") - else - doc = REXML::Document.new(xml).root + begin + if NOKOGIRI + doc = Nokogiri::XML(xml).xpath("/#{root_element}") + else + doc = REXML::Document.new(xml).root + end + rescue Exception => e + return OpenNebula::Error.new(e.message) end return doc @@ -238,7 +246,7 @@ module OpenNebula if NOKOGIRI array = element.children - if array.length == 1 and array.first.text? + if array.length==1 and (array.first.text? or array.first.cdata?) r = array.first.text else r = {} @@ -249,8 +257,8 @@ module OpenNebula } end else + r = {} if element.has_elements? - r = {} element.each_element { |c| to_hash(r, c) } elsif element.has_text? r = element.text diff --git a/src/oca/ruby/test/VirtualMachine_spec.rb b/src/oca/ruby/test/VirtualMachine_spec.rb index f9e894532b..4fc6c90996 100644 --- a/src/oca/ruby/test/VirtualMachine_spec.rb +++ b/src/oca/ruby/test/VirtualMachine_spec.rb @@ -260,6 +260,23 @@ module OpenNebula @vm['HISTORY/HOSTNAME'].should eql('dummyhost') @vm['HISTORY/PSTIME'].should eql('1277375186') end + + it "should access an attribute using to_hash" do + vm_hash = @vm.to_hash + + vm_hash['VM']['NAME'].should eql('vm-example') + vm_hash['VM']['DEPLOY_ID'].should eql('dummy') + vm_hash['VM']['TEMPLATE']['MEMORY'].should eql('512') + vm_hash['VM']['ID'].should eql('6') + vm_hash['VM']['NAME'].should eql('vm-example') + vm_hash['VM']['LCM_STATE'].should eql('3') + vm_hash['VM']['DEPLOY_ID'].should eql('dummy') + vm_hash['VM']['TEMPLATE']['MEMORY'].should eql('512') + vm_hash['VM']['TEMPLATE']['CONTEXT']['DNS'].should eql('192.169.1.4') + vm_hash['VM']['TEMPLATE']['DISK'][1]['SIZE'].should eql('1024') + vm_hash['VM']['HISTORY']['HOSTNAME'].should eql('dummyhost') + vm_hash['VM']['HISTORY']['PSTIME'].should eql('1277375186') + end end diff --git a/src/sunstone/config.ru b/src/sunstone/config.ru new file mode 100644 index 0000000000..a7034811d0 --- /dev/null +++ b/src/sunstone/config.ru @@ -0,0 +1,24 @@ +#!/usr/bin/ruby + +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# TBD Change path for intallation tree +$: << File.dirname(__FILE__) + +require 'one-ui.rb' + +run Sinatra::Application diff --git a/src/sunstone/models/OneUI.rb b/src/sunstone/models/OneUI.rb new file mode 100644 index 0000000000..f41200adbf --- /dev/null +++ b/src/sunstone/models/OneUI.rb @@ -0,0 +1,216 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# TBD Change path for intallation tree + +#require 'OpenNebulaJSON' +require 'models/OpenNebulaJSON' +include OpenNebulaJSON + +class OneUI + def initialize(username, password) + # TBD one_client_user(name) from CloudServer + @client = Client.new("dummy:dummy") + @client.one_auth = "#{username}:#{password}" + end + + ############################################################################ + # + ############################################################################ + def self.authorize(user="", sha1_pass="") + if user.empty? || sha1_pass.empty? + return [401, false] + end + + # TBD get_user_password(name) from CloudServer + user_pool = UserPool.new(Client.new) + rc = user_pool.info + if OpenNebula.is_error?(rc) + return [500, false] + end + + user_pass = user_pool["USER[NAME=\"#{user}\"]/PASSWORD"] + if user_pass == sha1_pass + return [204, user_pool["USER[NAME=\"#{user}\"]/ID"]] + else + return [401, nil] + end + end + + ############################################################################ + # + ############################################################################ + def get_pool(kind, user_id) + user_flag = user_id=="0" ? -2 : -1 + + pool = case kind + when "cluster" then ClusterPoolJSON.new(@client) + when "host" then HostPoolJSON.new(@client) + when "image" then ImagePoolJSON.new(@client, user_flag) + when "vm" then VirtualMachinePoolJSON.new(@client, user_flag) + when "vnet" then VirtualNetworkPoolJSON.new(@client, user_flag) + when "user" then UserPoolJSON.new(@client) + else + error = Error.new("Error: #{kind} resource not supported") + return [404, error.to_json] + end + + rc = pool.info + if OpenNebula.is_error?(rc) + return [500, rc.to_json] + else + return [200, pool.to_json] + end + end + + ############################################################################ + # + ############################################################################ + def get_resource(kind, id) + resource = retrieve_resource(kind, id) + if OpenNebula.is_error?(resource) + return [404, resource.to_json] + else + return [200, resource.to_json] + end + end + + ############################################################################ + # + ############################################################################ + def create_resource(kind, template) + resource = case kind + when "cluster" then ClusterJSON.new(Cluster.build_xml, @client) + when "host" then HostJSON.new(Host.build_xml, @client) + when "image" then ImageJSON.new(Image.build_xml, @client) + when "vm" then VirtualMachineJSON.new(VirtualMachine.build_xml,@client) + when "vnet" then VirtualNetworkJSON.new(VirtualNetwork.build_xml, @client) + when "user" then UserJSON.new(User.build_xml, @client) + else + error = Error.new("Error: #{kind} resource not supported") + return [404, error.to_json] + end + + rc = resource.allocate(template) + if OpenNebula.is_error?(rc) + return [500, rc.to_json] + else + resource.info + return [201, resource.to_json] + end + end + + ############################################################################ + # + ############################################################################ + def delete_resource(kind, id) + resource = retrieve_resource(kind, id) + if OpenNebula.is_error?(resource) + return [404, resource.to_json] + end + + rc = resource.delete + if OpenNebula.is_error?(rc) + return [500, rc.to_json] + else + return [204, resource.to_json] + end + end + + ############################################################################ + # + ############################################################################ + def perform_action(kind, id, action_json) + resource = retrieve_resource(kind, id) + if OpenNebula.is_error?(resource) + return [404, resource.to_json] + end + + rc = resource.perform_action(action_json) + if OpenNebula.is_error?(rc) + return [500, rc.to_json] + else + return [204, resource.to_json] + end + end + + ############################################################################ + # + ############################################################################ + def get_configuration + one_config = VAR_LOCATION + "/config" + config = Hash.new + + begin + cfg = File.read(one_config) + rescue Exception => e + error = Error.new("Error reading config: #{e.inspect}") + return [500, error.to_json] + end + + cfg.lines do |line| + m=line.match(/^([^=]+)=(.*)$/) + + if m + name=m[1].strip.upcase + value=m[2].strip + config[name]=value + end + end + + return [200, config.to_json] + end + + ############################################################################ + # + ############################################################################ + def get_vm_log(id) + id = id.to_s + vm_log_file = VAR_LOCATION + "/#{id}/vm.log" + + begin + log = File.read(vm_log_file) + rescue Exception => e + error = Error.new("Error: log for VM #{id} not available") + return [500, error.to_s] + end + + return [200, log] + end + + private + + def retrieve_resource(kind, id) + resource = case kind + when "cluster" then ClusterJSON.new_with_id(id, @client) + when "host" then HostJSON.new_with_id(id, @client) + when "image" then ImageJSON.new_with_id(id, @client) + when "vm" then VirtualMachineJSON.new_with_id(id, @client) + when "vnet" then VirtualNetworkJSON.new_with_id(id, @client) + when "user" then UserJSON.new_with_id(id, @client) + else + error = Error.new("Error: #{kind} resource not supported") + return error + end + + rc = resource.info + if OpenNebula.is_error?(rc) + return rc + else + return resource + end + end +end diff --git a/src/sunstone/models/OpenNebulaJSON.rb b/src/sunstone/models/OpenNebulaJSON.rb new file mode 100644 index 0000000000..28821ef8e1 --- /dev/null +++ b/src/sunstone/models/OpenNebulaJSON.rb @@ -0,0 +1,54 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV["ONE_LOCATION"] + +if !ONE_LOCATION + RUBY_LIB_LOCATION = "/usr/lib/one/ruby" + VAR_LOCATION = "/var/lib/one" +else + RUBY_LIB_LOCATION = ONE_LOCATION+"/lib/ruby" + VAR_LOCATION = ONE_LOCATION+"/var" +end + +$: << RUBY_LIB_LOCATION + +require 'OpenNebula' +include OpenNebula + +# TBD Change path for intallation tree +#require 'OpenNebulaJSON/PoolJSON' +#require 'OpenNebulaJSON/HostJSON' +#require 'OpenNebulaJSON/JSONUtils' +require 'models/OpenNebulaJSON/ClusterJSON' +require 'models/OpenNebulaJSON/HostJSON' +require 'models/OpenNebulaJSON/ImageJSON' +require 'models/OpenNebulaJSON/JSONUtils' +require 'models/OpenNebulaJSON/PoolJSON' +require 'models/OpenNebulaJSON/UserJSON' +require 'models/OpenNebulaJSON/VirtualMachineJSON' +require 'models/OpenNebulaJSON/VirtualNetworkJSON' + +module OpenNebula + class Error + def to_json + message = { :message => @message } + error_hash = { :error => message } + + return JSON.pretty_generate error_hash + end + end +end diff --git a/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb b/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb new file mode 100644 index 0000000000..9c015d0187 --- /dev/null +++ b/src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'models/OpenNebulaJSON/JSONUtils' + +module OpenNebulaJSON + class ClusterJSON < OpenNebula::Cluster + include JSONUtils + + def allocate(template_json) + cluster_hash = parse_json(template_json,'cluster') + if OpenNebula.is_error?(cluster_hash) + return cluster_hash + end + + super(cluster_hash['name']) + end + + def perform_action(template_json) + action_hash = parse_json(template_json, 'action') + if OpenNebula.is_error?(action_hash) + return action_hash + end + + rc = case action_hash['perform'] + when "add_host" then self.add_host(action_hash['params']) + when "remove_host" then self.remove_host(action_hash['params']) + else + error_msg = "#{action_hash['perform']} action not " << + " available for this resource" + OpenNebula::Error.new(error_msg) + end + end + + def add_host(params=Hash.new) + super(params['host_id']) + end + + def remove_host(params=Hash.new) + super(params['host_id']) + end + end +end diff --git a/src/sunstone/models/OpenNebulaJSON/HostJSON.rb b/src/sunstone/models/OpenNebulaJSON/HostJSON.rb new file mode 100644 index 0000000000..42490d405a --- /dev/null +++ b/src/sunstone/models/OpenNebulaJSON/HostJSON.rb @@ -0,0 +1,57 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'models/OpenNebulaJSON/JSONUtils' + +module OpenNebulaJSON + class HostJSON < OpenNebula::Host + include JSONUtils + + def allocate(template_json) + host_hash = parse_json(template_json, 'host') + if OpenNebula.is_error?(host_hash) + return host_hash + end + + super(host_hash['name'], host_hash['im_mad'], host_hash['vm_mad'], + host_hash['tm_mad']) + end + + def delete + if self['HOST_SHARE/RUNNING_VMS'].to_i != 0 + OpenNebula::Error.new("Host still has associated VMs, aborting delete.") + else + super + end + end + + def perform_action(template_json) + action_hash = parse_json(template_json, 'action') + if OpenNebula.is_error?(action_hash) + return action_hash + end + + rc = case action_hash['perform'] + when "enable" then self.enable + when "disable" then self.disable + else + error_msg = "#{action_hash['perform']} action not " << + " available for this resource" + OpenNebula::Error.new(error_msg) + end + end + end +end diff --git a/src/sunstone/models/OpenNebulaJSON/ImageJSON.rb b/src/sunstone/models/OpenNebulaJSON/ImageJSON.rb new file mode 100644 index 0000000000..05cb041d21 --- /dev/null +++ b/src/sunstone/models/OpenNebulaJSON/ImageJSON.rb @@ -0,0 +1,67 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'models/OpenNebulaJSON/JSONUtils' + +module OpenNebulaJSON + class ImageJSON < OpenNebula::Image + include JSONUtils + + def allocate(template_json) + image_hash = parse_json(template_json, 'image') + if OpenNebula.is_error?(image_hash) + return image_hash + end + + if image_hash['image_raw'] + super(image_hash['image_raw']) + else + template = template_to_str(image_hash) + super(template) + end + end + + def perform_action(template_json) + action_hash = parse_json(template_json, 'action') + if OpenNebula.is_error?(action_hash) + return action_hash + end + + rc = case action_hash['perform'] + when "disable" then self.disable + when "enable" then self.enable + when "nonpersistent" then self.nonpersistent + when "persistent" then self.persistent + when "publish" then self.publish + when "rm_attr" then self.remove_attr(action_hash['params']) + when "unpublish" then self.unpublish + when "update" then self.update(action_hash['params']) + else + error_msg = "#{action_hash['perform']} action not " << + " available for this resource" + OpenNebula::Error.new(error_msg) + end + end + + def update(params=Hash.new) + super(params['name'], params['value']) + end + + def remove_attr(params=Hash.new) + super(params['name']) + end + end +end diff --git a/src/sunstone/models/OpenNebulaJSON/JSONUtils.rb b/src/sunstone/models/OpenNebulaJSON/JSONUtils.rb new file mode 100644 index 0000000000..ccd9c17ce5 --- /dev/null +++ b/src/sunstone/models/OpenNebulaJSON/JSONUtils.rb @@ -0,0 +1,89 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +module OpenNebulaJSON + require 'json' + + module JSONUtils + def to_json + begin + JSON.pretty_generate self.to_hash + rescue Exception => e + OpenNebula::Error.new(e.message) + end + end + + def parse_json(json_str, root_element) + begin + hash = JSON.parse(json_str) + rescue Exception => e + return OpenNebula::Error.new(e.message) + end + + if hash.has_key?(root_element) + return hash[root_element] + else + return OpenNebula::Error.new("Error parsing JSON: Wrong resource type") + end + end + + def template_to_str(attributes, indent=true) + if indent + ind_enter="\n" + ind_tab=' ' + else + ind_enter='' + ind_tab=' ' + end + + str=attributes.collect do |key, value| + if value + str_line="" + if value.class==Array && !value.empty? + value.each do |value2| + str_line << key.to_s.upcase << "=[" << ind_enter + if value2 && value2.class==Hash + str_line << value2.collect do |key3, value3| + str = ind_tab + key3.to_s.upcase + "=" + str += "\"#{value3.to_s}\"" if value3 + str + end.compact.join(",\n") + end + str_line << "\n]\n" + end + + elsif value.class==Hash && !value.empty? + str_line << key.to_s.upcase << "=[" << ind_enter + + str_line << value.collect do |key3, value3| + str = ind_tab + key3.to_s.upcase + "=" + str += "\"#{value3.to_s}\"" if value3 + str + end.compact.join(",\n") + + str_line << "\n]\n" + + else + str_line<"#{session['user']}", :expires=>time) + response.set_cookie("one-user_id", :value=>"#{session['user_id']}", :expires=>time) + File.read(File.dirname(__FILE__)+'/templates/index.html') +end + +get '/login' do + File.read(File.dirname(__FILE__)+'/templates/login.html') +end + +############################################################################## +# Login +############################################################################## +post '/login' do + build_session +end + +post '/logout' do + destroy_session +end + +############################################################################## +# GET Pool information +############################################################################## +get '/:pool' do + @OneUI.get_pool(params[:pool], session["user_id"]) +end + +############################################################################## +# GET Resource information +############################################################################## +get '/:resource/:id' do + @OneUI.get_resource(params[:resource], params[:id]) +end + +############################################################################## +# Delete Resource +############################################################################## +delete '/:resource/:id' do + @OneUI.delete_resource(params[:resource], params[:id]) +end + +############################################################################## +# Create a new Resource +############################################################################## +post '/:pool' do + @OneUI.create_resource(params[:pool], request.body.read) +end + +############################################################################## +# Perform an action on a Resource +############################################################################## +post '/:resource/:id/action' do + @OneUI.perform_action(params[:resource], params[:id], request.body.read) +end + +############################################################################## +# Config and Logs +############################################################################## +get '/config' do + @OneUI.get_configuration +end + +get '/vm/:id/log' do + @OneUI.get_vm_log(params[:id].to_i) +end diff --git a/src/sunstone/public/css/application.css b/src/sunstone/public/css/application.css new file mode 100644 index 0000000000..886e469918 --- /dev/null +++ b/src/sunstone/public/css/application.css @@ -0,0 +1,534 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +body { + font: 9pt Arial, Verdana, Geneva, Helvetica, sans-serif; +} + +p{ + margin:0 10px 10px; + } +a { + color: #000C96; text-decoration: none; + } +a:hover { + color: #127FE4; text-decoration: none; + } +select, button { + padding: 2px; + } + +h2 { + float:left; + font-size:20px; + margin-bottom: 5px; + padding-bottom: 0} + +h3 { + border-bottom: 1px solid #CCCCCC; + color: #353735; + font-size: 14px; + font-weight: normal; + padding: 5px 8px; + margin: 0 0; +} + +table#dashboard_table{ + width:100%; + margin: 0; + } + +table#dashboard_table tr { + vertical-align: top; +} + +table#dashboard_table td{ + width:50%; +} + +div.panel { + background-color: #ffffff; + padding:0; + width:80%; + margin: 10px; + border: 1px #ddd solid; + min-height: 110px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + box-shadow: 5px 5px 5px #888; +} + +div.panel h3 { + border: 0; + padding:5px 10px 5px 10px; + margin: 0; + background-color: #353735; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; +} + +div.panel .new-resource { + float: right; +} + +div.panel h3 a { + color: white; + font-weight: bold; +} + +div.panel_info { + padding: 5px; +} + +div.panel_info table.info_table { + background: none; + width: 100%; + margin:0; +} + +div.panel_info table.info_table tr { + border: 0; + border-bottom: 1px dotted #ccc; +} +div.panel_info table.info_table td { + border: 0; + width: 100%!important; +} + +div.panel_info table.info_table td.value_td { + text-align: right; +} + +.key_td_green { + color: green!important; +} + +.key_td_red { + color: #B81515!important; +} + + +ul.multi_action_menu { list-style: none; position: absolute; text-align: left; padding:0; border: 1px solid #D3D3D3; background-color: #F0EDED;} +ul.multi_action_menu li { cursor: pointer; padding: 2px 5px;} +ul.multi_action_menu li:hover { background-color: #D3D3D3;} + + +div.action_block { + display:inline; + margin-right: 5px; + border-right: 1px solid #D3D3D3; + } + +div.action_blocks { + margin-bottom: 0.5em; + text-align: right; + margin-top: 0.5em; + } + +input, textarea, select { + border: 0; + border: 1px #bbbbbb solid; +} + +input, textarea { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; +} + +form.create_form{ + margin:0; + padding:0;} + +fieldset{ + margin:0 0; + border:none; + border-top:1px solid #ccc; + padding: 10px 5px;} + +fieldset div{ + margin-bottom:.5em; + padding:0; + display:block; + } + + +fieldset input, +fieldset textarea{ + width:150px; + /*border-top:1px solid #555; + border-left:1px solid #555; + border-bottom:1px solid #ccc; + border-right:1px solid #ccc;*/ + padding:1px;color:#333; + vertical-align: top; + margin: 0 2px; + margin-bottom: 4px; + } + +fieldset select{ + width:154px; + /*border-top:1px solid #555; + border-left:1px solid #555; + border-bottom:1px solid #ccc; + border-right:1px solid #ccc;*/ + padding:1px; + color:#333; + vertical-align: top; + margin: 0 2px; + margin-bottom: 4px; + } + +/*Chrome hack*/ +input[type="radio"],input[type="checkbox"] { + width:20px; +} + +legend{ + margin-top:0; + margin-bottom: 5px; + padding:0 .5em; + color:#036; + background:transparent; + font-size:1.0em; + font-weight:bold; + } + +label{ + float: left; + width:150px; + padding:0 1em; + text-align:left; + } + + +div.tip { + display: inline-block; + padding-left: 5px; + vertical-align: middle; + float:none; + } + +div.tip span.ui-icon{ + display:inline-block; +} + +div.tip span.man_icon { + display:none; +} +.kvm .man_icon,.xen .man_icon,.img_man .man_icon { + display:inline-block!important; +} + +span.tipspan { + position: fixed; + display:block; + padding:4px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border: 1px solid #353735; + margin-left:2px; + margin-right:5px; + background-color: white; + color: #353735; + font-size:10px; +} +.vm_section input { + float:none; +} + +.vm_section legend{ + display:none!important; +} +.vm_section fieldset { + border:none!important; +} + +div.show_hide { + float:none; + clear:both; +} + +.vm_param label{ + float:left; +} + +fieldset div.vm_section { + margin-top:-8px; + margin-bottom:0px; +} + + +input:focus, +textarea:focus{ + background:#efefef; + color:#000; +} + +.form_buttons { + margin-top:25px; + text-align:right; +} + +.add_remove_button { + font-size:0.8em; + height:25px; + margin-bottom:4px; +} + +.add_button { + margin-left:177px; +} + +.remove_button { + +} + +tr.odd, tr.even { + background-color: #ffffff; + border: 1px #e9e9e9 solid; + height:30px!important; +} + +tr.odd td, tr.even td{ + border-left: 1px #e9e9e9 solid; +} + +tr.odd:hover{ + background-color: #E69138 !important; +} + +tr.even:hover{ + background-color: #E69138 !important; +} + +.show_hide label{ + width: 100%; +} + +.clear { + clear: both; +} + +/* Create dialogs */ +/* host: */ +#create_host_form fieldset label { + width: 200px; +} + +.action_block_info{ + width: 235px; + margin: auto; +} + +.icon_right { + display: inline-block; + margin-left: 20px; + position: relative; + top: 2px; + } +.icon_left { + float: left; + margin-right: 20px; + position: relative; + top: 0px; + /*border:1px solid;*/ +} + + + +.info_table{ + background: none repeat scroll 0 0 #FFFFFF; + border-collapse: collapse; + margin: 20px; + text-align: left; + display: inline-block; + width:45%; + vertical-align:top; + } + +.info_table th,h3 { + border-bottom: 2px solid #353735; + color: #353735; + font-size: 14px; + font-weight: normal; + padding: 10px 8px; +} + + +.info_table td{ + border-bottom: 1px solid #CCCCCC; + color: #353735; + padding: 6px 8px; + } + + +.info_table td.key_td{ + width: 100%; + text-align:left; + font-weight:bold; +} + +.info_table td.key_td:after{ + content:":"; +} + +.info_table td.value_td{ + text-align:left; +} + +#dialog > div > div { + margin: 0; + padding: 0; +} + +.loading_img { + vertical-align:middle; + display:inline; + overflow:hide; + +} + +.top_button { + font-size: 0.8em; + height: 25px; + margin: 3px 0; + vertical-align: middle; + /*width: 89px;*/ +} +.top_button button { + font-size: 0.9em; + height: 25px; + vertical-align: middle; +} + +/* +.multi_action_slct{ + font-size: 0.7em; + vertical-align:middle; + margin:3px 0; + height: 25px; +}*/ + +.ui-icon-refresh{ + position:relative!important; + top:14px!important; +} + +#vm_log { + padding: 0 20px 0 20px !important; +} + +#vm_log h3 { + border-bottom: 2px solid #353735; +} + +#vm_log pre { + font-size: 0.9em; +} + +#vm_log .vm_log_error { + color: red; + font-weight: bold; +} + +/* Growl */ +.jGrowl-notification h1 { + font-size: 1.2em; +} + +.jGrowl-notification, .jGrowl-closer, .jGrowl-notify-submit { + border: 2px #444444 solid; + background-color: #F3F3F3; + color: #666666; +} + +.jGrowl-notify-error { + border: 2px #660000 solid; + background-color: #F39999; + color: #660000; +} + +.jGrowl-notify-error table td.key_error { + text-transform: capitalize; + width: 100%; + font-weight: bold; +} + +.jGrowl-notify-error table td.key_error:after { + content:":"; +} + +.refresh_image { + position: relative; + top: 8px; + cursor: pointer; +} + +.ui-tabs .ui-tabs-nav li a { + /*padding: .5em 1em;*/ + padding: .3em 1em; +} + +ul.action_list{ + + /*background: #EDEDED;*/ + border: 1px solid #525252; + background-image: -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0.25, #E9E9E9), + color-stop(0.63, #F5F5F5) + ); + background-image: -moz-linear-gradient( + center bottom, + #E9E9E9 25%, + #F5F5F5 63% + ); + position:absolute; + z-index:1; + list-style-type:none; + text-align:left; + padding:5px 5px; + -webkit-border-radius:4px; + -webkit-border-bottom-right-radius:5px; + -webkit-border-bottom-left-radius:5px; + -moz-border-radius:4px; + -moz-border-radius-bottomright:5px; + -moz-border-radius-bottomleft:5px; + border-radius:4px; + border-bottom-right-radius:5px; + border-bottom-left-radius:5px; +} + +ul.action_list li a{ + font-size: 0.8em; + color:#575C5B; + +} +ul.action_list li a:hover{ + color:#E69138; + +} + +.progress_bar{ + height:10px; + background: #8F9392; +} + diff --git a/src/sunstone/public/css/demo_table_jui.css b/src/sunstone/public/css/demo_table_jui.css new file mode 100644 index 0000000000..b81a1cf99d --- /dev/null +++ b/src/sunstone/public/css/demo_table_jui.css @@ -0,0 +1,513 @@ +/* + * File: demo_table_jui.css + * CVS: $Id$ + * Description: CSS descriptions for DataTables demo pages + * Author: Allan Jardine + * Created: Tue May 12 06:47:22 BST 2009 + * Modified: $Date$ by $Author$ + * Language: CSS + * Project: DataTables + * + * Copyright 2009 Allan Jardine. All Rights Reserved. + * + * *************************************************************************** + * DESCRIPTION + * + * The styles given here are suitable for the demos that are used with the standard DataTables + * distribution (see www.datatables.net). You will most likely wish to modify these styles to + * meet the layout requirements of your site. + * + * Common issues: + * 'full_numbers' pagination - I use an extra selector on the body tag to ensure that there is + * no conflict between the two pagination types. If you want to use full_numbers pagination + * ensure that you either have "example_alt_pagination" as a body class name, or better yet, + * modify that selector. + * Note that the path used for Images is relative. All images are by default located in + * ../images/ - relative to this CSS file. + */ + + +/* + * jQuery UI specific styling + */ + +.paging_two_button .ui-button { + float: left; + cursor: pointer; + * cursor: hand; +} + +.paging_full_numbers .ui-button { + padding: 2px 6px; + margin: 0; + cursor: pointer; + * cursor: hand; +} + +.ui-buttonset .ui-button { + margin-right: -0.1em !important; +} + +.paging_full_numbers { + width: 350px !important; +} + +.ui-toolbar { + padding: 5px; +} + +.dataTables_paginate { + width: auto; +} + +.dataTables_info { + padding-top: 3px; +} + +table.display thead th { + padding: 3px 0px 3px 10px; + cursor: pointer; + * cursor: hand; +} + +div.dataTables_wrapper .ui-widget-header { + font-weight: normal; +} + + +/* + * Sort arrow icon positioning + */ +table.display thead th div.DataTables_sort_wrapper { + position: relative; + padding-right: 20px; + padding-right: 20px; +} + +table.display thead th div.DataTables_sort_wrapper span { + position: absolute; + top: 50%; + margin-top: -8px; + right: 0; +} + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Everything below this line is the same as demo_table.css. This file is + * required for 'cleanliness' of the markup + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables features + */ + +.dataTables_wrapper { + position: relative; + min-height: 302px; + _height: 302px; + clear: both; +} + +.dataTables_processing { + position: absolute; + top: 0px; + left: 50%; + width: 250px; + margin-left: -125px; + border: 1px solid #ddd; + text-align: center; + color: #999; + font-size: 11px; + padding: 2px 0; +} + +.dataTables_length { + width: 40%; + float: left; +} + +.dataTables_filter { + width: 50%; + float: right; + text-align: right; +} + +.dataTables_info { + width: 50%; + float: left; +} + +.dataTables_paginate { + float: right; + text-align: right; +} + +/* Pagination nested */ +.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { + height: 19px; + width: 19px; + margin-left: 3px; + float: left; +} + +.paginate_disabled_previous { + background-image: url('../images/back_disabled.jpg'); +} + +.paginate_enabled_previous { + background-image: url('../images/back_enabled.jpg'); +} + +.paginate_disabled_next { + background-image: url('../images/forward_disabled.jpg'); +} + +.paginate_enabled_next { + background-image: url('../images/forward_enabled.jpg'); +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables display + */ +table.display { + margin: 0 auto; + width: 100%; + clear: both; + border-collapse: collapse; +} + +table.display tfoot th { + padding: 3px 0px 3px 10px; + font-weight: bold; + font-weight: normal; +} + +table.display tr.heading2 td { + border-bottom: 1px solid #aaa; +} + +table.display td { + padding: 3px 10px; +} + +table.display td.center { + text-align: center; +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables sorting + */ + +.sorting_asc { + background: url('../images/sort_asc.jpg') no-repeat center right; +} + +.sorting_desc { + background: url('../images/sort_desc.jpg') no-repeat center right; +} + +.sorting { + background: url('../images/sort_both.jpg') no-repeat center right; +} + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables row classes + */ +table.display tr.odd.gradeA { + background-color: #ddffdd; +} + +table.display tr.even.gradeA { + background-color: #eeffee; +} + + + + +table.display tr.odd.gradeA { + background-color: #ddffdd; +} + +table.display tr.even.gradeA { + background-color: #eeffee; +} + +table.display tr.odd.gradeC { + background-color: #ddddff; +} + +table.display tr.even.gradeC { + background-color: #eeeeff; +} + +table.display tr.odd.gradeX { + background-color: #ffdddd; +} + +table.display tr.even.gradeX { + background-color: #ffeeee; +} + +table.display tr.odd.gradeU { + background-color: #ddd; +} + +table.display tr.even.gradeU { + background-color: #eee; +} + + +tr.odd { + background-color: #E2E4FF; +} + +tr.even { + background-color: white; +} + + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Misc + */ +.dataTables_scroll { + clear: both; +} + +.top, .bottom { + padding: 15px; + background-color: #F5F5F5; + border: 1px solid #CCCCCC; +} + +.top .dataTables_info { + float: none; +} + +.clear { + clear: both; +} + +.dataTables_empty { + text-align: center; +} + +tfoot input { + margin: 0.5em 0; + width: 100%; + color: #444; +} + +tfoot input.search_init { + color: #999; +} + +td.group { + background-color: #d1cfd0; + border-bottom: 2px solid #A19B9E; + border-top: 2px solid #A19B9E; +} + +td.details { + background-color: #d1cfd0; + border: 2px solid #A19B9E; +} + + +.example_alt_pagination div.dataTables_info { + width: 40%; +} + +.paging_full_numbers span.paginate_button, + .paging_full_numbers span.paginate_active { + border: 1px solid #aaa; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + padding: 2px 5px; + margin: 0 3px; + cursor: pointer; + *cursor: hand; +} + +.paging_full_numbers span.paginate_button { + background-color: #ddd; +} + +.paging_full_numbers span.paginate_button:hover { + background-color: #ccc; +} + +.paging_full_numbers span.paginate_active { + background-color: #99B3FF; +} + +table.display tr.even.row_selected td { + background-color: #B0BED9; +} + +table.display tr.odd.row_selected td { + background-color: #9FAFD1; +} + + +/* + * Sorting classes for columns + */ +/* For the standard odd/even */ +tr.odd td.sorting_1 { + background-color: #D3D6FF; +} + +tr.odd td.sorting_2 { + background-color: #DADCFF; +} + +tr.odd td.sorting_3 { + background-color: #E0E2FF; +} + +tr.even td.sorting_1 { + background-color: #EAEBFF; +} + +tr.even td.sorting_2 { + background-color: #F2F3FF; +} + +tr.even td.sorting_3 { + background-color: #F9F9FF; +} + + +/* For the Conditional-CSS grading rows */ +/* + Colour calculations (based off the main row colours) + Level 1: + dd > c4 + ee > d5 + Level 2: + dd > d1 + ee > e2 + */ +tr.odd.gradeA td.sorting_1 { + background-color: #c4ffc4; +} + +tr.odd.gradeA td.sorting_2 { + background-color: #d1ffd1; +} + +tr.odd.gradeA td.sorting_3 { + background-color: #d1ffd1; +} + +tr.even.gradeA td.sorting_1 { + background-color: #d5ffd5; +} + +tr.even.gradeA td.sorting_2 { + background-color: #e2ffe2; +} + +tr.even.gradeA td.sorting_3 { + background-color: #e2ffe2; +} + +tr.odd.gradeC td.sorting_1 { + background-color: #c4c4ff; +} + +tr.odd.gradeC td.sorting_2 { + background-color: #d1d1ff; +} + +tr.odd.gradeC td.sorting_3 { + background-color: #d1d1ff; +} + +tr.even.gradeC td.sorting_1 { + background-color: #d5d5ff; +} + +tr.even.gradeC td.sorting_2 { + background-color: #e2e2ff; +} + +tr.even.gradeC td.sorting_3 { + background-color: #e2e2ff; +} + +tr.odd.gradeX td.sorting_1 { + background-color: #ffc4c4; +} + +tr.odd.gradeX td.sorting_2 { + background-color: #ffd1d1; +} + +tr.odd.gradeX td.sorting_3 { + background-color: #ffd1d1; +} + +tr.even.gradeX td.sorting_1 { + background-color: #ffd5d5; +} + +tr.even.gradeX td.sorting_2 { + background-color: #ffe2e2; +} + +tr.even.gradeX td.sorting_3 { + background-color: #ffe2e2; +} + +tr.odd.gradeU td.sorting_1 { + background-color: #c4c4c4; +} + +tr.odd.gradeU td.sorting_2 { + background-color: #d1d1d1; +} + +tr.odd.gradeU td.sorting_3 { + background-color: #d1d1d1; +} + +tr.even.gradeU td.sorting_1 { + background-color: #d5d5d5; +} + +tr.even.gradeU td.sorting_2 { + background-color: #e2e2e2; +} + +tr.even.gradeU td.sorting_3 { + background-color: #e2e2e2; +} + + +/* + * Row highlighting example + */ +.ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted { + background-color: #ECFFB3; +} + +.ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted { + background-color: #E6FF99; +} \ No newline at end of file diff --git a/src/sunstone/public/css/jquery.jgrowl.css b/src/sunstone/public/css/jquery.jgrowl.css new file mode 100755 index 0000000000..a735d2fbd8 --- /dev/null +++ b/src/sunstone/public/css/jquery.jgrowl.css @@ -0,0 +1,131 @@ + +div.jGrowl { + padding: 10px; + z-index: 9999; + color: #fff; + font-size: 12px; +} + +/** Special IE6 Style Positioning **/ +div.ie6 { + position: absolute; +} + +div.ie6.top-right { + right: auto; + bottom: auto; + left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' ); + top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' ); +} + +div.ie6.top-left { + left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' ); + top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' ); +} + +div.ie6.bottom-right { + left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' ); + top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' ); +} + +div.ie6.bottom-left { + left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' ); + top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' ); +} + +div.ie6.center { + left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' ); + top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' ); + width: 100%; +} + +/** Normal Style Positions **/ +div.jGrowl { + position: absolute; +} + +body > div.jGrowl { + position: fixed; +} + +div.jGrowl.top-left { + left: 0px; + top: 0px; +} + +div.jGrowl.top-right { + right: 0px; + top: 0px; +} + +div.jGrowl.bottom-left { + left: 0px; + bottom: 0px; +} + +div.jGrowl.bottom-right { + right: 0px; + bottom: 0px; +} + +div.jGrowl.center { + top: 0px; + width: 50%; + left: 25%; +} + +/** Cross Browser Styling **/ +div.center div.jGrowl-notification, div.center div.jGrowl-closer { + margin-left: auto; + margin-right: auto; +} + +div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer { + opacity: 0.90; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=90); + zoom: 1; + width: 235px; + padding: 10px; + margin-top: 5px; + margin-bottom: 5px; + font-family: Tahoma, Arial, Helvetica, sans-serif; + font-size: 1em; + text-align: left; + display: none; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +div.jGrowl div.jGrowl-notification { + min-height: 20px; +} + +div.jGrowl div.jGrowl-notification div.jGrowl-header { + font-weight: bold; + font-size: .85em; +} + +div.jGrowl div.jGrowl-notification div.jGrowl-close { + z-index: 99; + float: right; + font-weight: bold; + font-size: 1em; + cursor: pointer; +} + +div.jGrowl div.jGrowl-closer { + padding-top: 4px; + padding-bottom: 4px; + cursor: pointer; + font-size: .9em; + font-weight: bold; + text-align: center; +} + +/** Hide jGrowl when printing **/ +@media print { + div.jGrowl { + display: none; + } +} diff --git a/src/sunstone/public/css/layout-default-latest.css b/src/sunstone/public/css/layout-default-latest.css new file mode 100644 index 0000000000..8575005874 --- /dev/null +++ b/src/sunstone/public/css/layout-default-latest.css @@ -0,0 +1,126 @@ +/* + * Default Layout Theme + * + * Created for jquery.layout + * + * Copyright (c) 2010 + * Fabrizio Balliano (http://www.fabrizioballiano.net) + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * Last Updated: 2010-02-10 + * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars + */ + +/* + * PANES & CONTENT-DIVs + */ +.ui-layout-pane { /* all 'panes' */ + background: #f5f5f5; + /* DO NOT add scrolling (or padding) to 'panes' that have a content-div, + otherwise you may get double-scrollbars - on the pane AND on the content-div + */ + padding: 10px; + overflow: auto; + } + /* (scrolling) content-div inside pane allows for fixed header(s) and/or footer(s) */ + .ui-layout-content { + padding: 10px; + position: relative; /* contain floated or positioned elements */ + overflow: auto; /* add scrolling to content-div */ + } + +/* + * RESIZER-BARS + */ +.ui-layout-resizer { /* all 'resizer-bars' */ + background: #DDD; + /*border: 1px solid #BBB; + border-width: 0;*/ + border: 1px #BBB solid; + } + .ui-layout-resizer-drag { /* REAL resizer while resize in progress */ + } + .ui-layout-resizer-hover { /* affects both open and closed states */ + } + /* NOTE: It looks best when 'hover' and 'dragging' are set to the same color, + otherwise color shifts while dragging when bar can't keep up with mouse */ + .ui-layout-resizer-open-hover , /* hover-color to 'resize' */ + .ui-layout-resizer-dragging { /* resizer beging 'dragging' */ + border-top: 1px solid #BBB; + border-bottom: 1px solid #BBB; + background: #DDD; + } + .ui-layout-resizer-dragging { /* CLONED resizer being dragged */ + border-left: 1px solid #BBB; + border-right: 1px solid #BBB; + } + /* NOTE: Add a 'dragging-limit' color to provide visual feedback when resizer hits min/max size limits */ + .ui-layout-resizer-dragging-limit { /* CLONED resizer at min or max size-limit */ + background: #E1A4A4; /* red */ + } + + .ui-layout-resizer-closed-hover { /* hover-color to 'slide open' */ + background: #EBD5AA; + } + .ui-layout-resizer-sliding { /* resizer when pane is 'slid open' */ + opacity: .10; /* show only a slight shadow */ + filter: alpha(opacity=10); + } + .ui-layout-resizer-sliding-hover { /* sliding resizer - hover */ + opacity: 1.00; /* on-hover, show the resizer-bar normally */ + filter: alpha(opacity=100); + } + /* sliding resizer - add 'outside-border' to resizer on-hover + * this sample illustrates how to target specific panes and states */ + .ui-layout-resizer-north-sliding-hover { border-bottom-width: 1px; } + .ui-layout-resizer-south-sliding-hover { border-top-width: 1px; } + .ui-layout-resizer-west-sliding-hover { border-right-width: 1px; } + .ui-layout-resizer-east-sliding-hover { border-left-width: 1px; } + +/* + * TOGGLER-BUTTONS + */ +.ui-layout-toggler { + border: 1px solid #BBB; /* match pane-border */ + background-color: #BBB; + } + .ui-layout-resizer-hover .ui-layout-toggler { + opacity: .60; + filter: alpha(opacity=60); + } + .ui-layout-toggler-hover , /* need when NOT resizable */ + .ui-layout-resizer-hover .ui-layout-toggler-hover { /* need specificity when IS resizable */ + background-color: #FC6; + opacity: 1.00; + filter: alpha(opacity=100); + } + .ui-layout-toggler-north , + .ui-layout-toggler-south { + border-width: 0 1px; /* left/right borders */ + } + .ui-layout-toggler-west , + .ui-layout-toggler-east { + border-width: 1px 0; /* top/bottom borders */ + } + /* hide the toggler-button when the pane is 'slid open' */ + .ui-layout-resizer-sliding ui-layout-toggler { + display: none; + } + /* + * style the text we put INSIDE the togglers + */ + .ui-layout-toggler .content { + color: #666; + font-size: 12px; + font-weight: bold; + width: 100%; + padding-bottom: 0.35ex; /* to 'vertically center' text inside text-span */ + } + +.ui-layout-resizer-south{ + border-left: 0; + border-right: 0; +} diff --git a/src/sunstone/public/css/layout.css b/src/sunstone/public/css/layout.css new file mode 100755 index 0000000000..d713822e56 --- /dev/null +++ b/src/sunstone/public/css/layout.css @@ -0,0 +1,173 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +body { + background: #f5f5f5; +} + +.outer-center, .inner-center { + padding: 0; +} + +.outer-center { + border: 0; +} + +.inner-south { + padding: 0; +} + +#dialog div { + border: 0; +} + +.tab { + padding: 5px 10px 0 10px; +} + +body { + font-family: Arial, Verdana, Geneva, Helvetica, sans-serif; + font-size: 13px; +} + +#header { + padding:0; + background-color: #353735; +} + +#footer { + padding:0; + background-color: #353735; +} + +#header { + padding: 0 10px 0 10px; + background-color: #353735; +} +#logo { + padding-top: 6px; + font-weight: bold; + color: white; + float:left; +} + +#login-info { + padding-top: 4px; + float: right; + padding-right: 5px; +} + +#links { + padding-top: 4px; + margin-right: 40px; + float: right; +} + +#login-info, #login-info a, #links, #links a { + color: white; +} + +#login-info, #login-info a { + font-weight: bold; +} +.sunstone-color { + color: #E69138; +} + +#footer { + padding-top: 9px; + font-size: 0.8em; + color: white; + text-align: center; +} + +#footer a { + color: white; + text-decoration: underline; +} + +#logo-wrapper { + float: right; + margin-top: 0px; + margin-right: 20px; +} + +#menu { + padding-right: 0; + padding-left: 0; + border-right: 1px solid #353735; + background-image: -webkit-gradient( + linear, + left top, + right top, + color-stop(0.95, rgb(99,102,99)), + color-stop(1, rgb(53,55,53)) +); +background-image: -moz-linear-gradient( + left center, + rgb(99,102,99) 95%, + rgb(53,55,53) 100% +); +} +#navigation { + list-style: none; + padding: 0; +} + +#navigation li { + line-height: 2em; + text-align: right; + padding-right: 10px; +} + +#navigation li a { + color: #ffffff; +} + +#navigation li:hover, .navigation-active-li { + background-image: -webkit-gradient( + linear, + left top, + right top, + color-stop(0.95, #E69138), + color-stop(1, rgb(53,55,53)) +); +background-image: -moz-linear-gradient( + left center, + #E69138 95%, + rgb(53,55,53) 100% +); + /* + background-image: -webkit-gradient( + linear, + right top, + left top, + color-stop(0, rgb(0,152,192)), + color-stop(1, rgb(255,255,255)) + ); + background-image: -moz-linear-gradient( + right center, + rgb(0,152,192) 0%, + rgb(255,255,255) 100% + ); + */ +} +.navigation-active-li-a { + font-weight: bold; +} +#navigation li:hover a, .navigation-active-li-a { + color: #ffffff !important; +} diff --git a/src/sunstone/public/css/login.css b/src/sunstone/public/css/login.css new file mode 100644 index 0000000000..baee3d985e --- /dev/null +++ b/src/sunstone/public/css/login.css @@ -0,0 +1,166 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +body { + background: #FAFAFA; + margin: 0px; + +} + + +#header { + height: 30px; + background-color: #353735; + padding: 0 10px 0 10px; +} + + +#logo { + padding-top: 6px; + font-size: 1.1em; + font-weight: bold; + color: white; + font-family: Arial, Verdana, Geneva, Helvetica, sans-serif; + font-size: 13px; +} + +#wrapper{ + margin-left: auto; + margin-right: auto; + width: 900px; + text-align: center; +} + + +div#logo_sunstone { + position: relative; + height: 100px; + width: 600px; + top: 80px; + margin-left: auto; + margin-right: auto; + background: url(/images/opennebula-sunstone-big.png) no-repeat center ; + + vertical-align: center; +} + +div#login { + width: 400px; + height: 300px; + position: relative; + + margin-left: auto; + margin-right: auto; + top: 90px; + padding-left: 80px; + padding-right: 80px; + background: url(../images/panel.png) no-repeat center ; + + vertical-align: center; +} + + +.box { + font-size:0.8em; + width: 300px; + height: 25px; + background: #FFFFFF; + margin-left: auto; + margin-right: auto; + margin-bottom: 10px; + border-bottom-color: gray; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-bottom-style: solid; + border-bottom-width: 1px; + border-left-color: gray; + border-left-style: solid; + border-left-width: 1px; + border-right-color: gray; + border-right-style: solid; + border-right-width: 1px; + border-top-color: gray; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border-top-style: solid; + border-top-width: 1px; + -moz-border-radius: 5px; + -moz-border-radius-topleft: 5px; + -moz-border-radius-topright: 5px; + -moz-border-radius-bottomright: 5px; + -moz-border-radius-bottomleft: 5px; +} + + + +div#login input#login_btn { + width: 130px; + height: 45px; + cursor: pointer; + margin-left: auto; + margin-right: 43px; + margin-top: 20px; + background-color: transparent; + border:0; + float: right; + background: url(../images/login.png) no-repeat center ; +} + +div#login input#login_btn:hover { + width: 130px; + height: 45px; + cursor: pointer; + margin-left: auto; + margin-right: 43px; + margin-top: 20px; + background-color: transparent; + border:0; + float: right; + background: url(../images/login_over.png) no-repeat center ; +} + +.error_message { + display: none; + position: relative; + top: 150px; + font-family: Arial, Helvetica, sans-serif; + color:red; + font-size:1.6em; +} + +#label_remember { + color:#353735; + font-size:0.4em; + font-family: Arial, Helvetica, sans-serif; +} + +.content { + padding-top:40px; + font-size:1.8em; + margin-bottom:0px; + margin-left:50px; + text-align:left; + font-family: Arial, Helvetica, sans-serif; +} + +#check_remember { + + margin-top: 35px; + margin-left:0px; +} + + + diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_575c5b_40x100.png b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_575c5b_40x100.png new file mode 100644 index 0000000000..f6faa0f3d8 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_575c5b_40x100.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_8f9392_40x100.png b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_8f9392_40x100.png new file mode 100644 index 0000000000..1e8453f255 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_8f9392_40x100.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 0000000000..5b5dab2ab7 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/src/sunstone/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 0000000000..ac8b229af9 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/src/sunstone/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000000..ad3d6346e0 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/src/sunstone/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000000..42ccba269b Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000000..5a46b47cb1 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000000..86c2baa655 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/src/sunstone/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000000..4443fdc1a1 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/src/sunstone/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000000..7c9fa6c6ed Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png b/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000000..6d02426c11 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png.old b/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png.old new file mode 100644 index 0000000000..b273ff111d Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_222222_256x240.png.old differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_2e83ff_256x240.png b/src/sunstone/public/css/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000000..09d1cdc856 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_454545_256x240.png b/src/sunstone/public/css/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000000..59bd45b907 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_888888_256x240.png b/src/sunstone/public/css/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000000..6d02426c11 Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/src/sunstone/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/src/sunstone/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000000..2ab019b73e Binary files /dev/null and b/src/sunstone/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/src/sunstone/public/css/smoothness/jquery-ui-1.8.7.custom.css b/src/sunstone/public/css/smoothness/jquery-ui-1.8.7.custom.css new file mode 100644 index 0000000000..e74edd7957 --- /dev/null +++ b/src/sunstone/public/css/smoothness/jquery-ui-1.8.7.custom.css @@ -0,0 +1,572 @@ +/* + * jQuery UI CSS Framework 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +/*.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; }*/ +/*.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }*/ +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #575c5b url(images/ui-bg_flat_0_575c5b_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; }/* + * jQuery UI Autocomplete 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Progressbar 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } diff --git a/src/sunstone/public/images/Refresh-icon.png b/src/sunstone/public/images/Refresh-icon.png new file mode 100644 index 0000000000..a9207d2653 Binary files /dev/null and b/src/sunstone/public/images/Refresh-icon.png differ diff --git a/src/sunstone/public/images/ajax-loader.gif b/src/sunstone/public/images/ajax-loader.gif new file mode 100644 index 0000000000..6f0e2ddb68 Binary files /dev/null and b/src/sunstone/public/images/ajax-loader.gif differ diff --git a/src/sunstone/public/images/box_gradient.png b/src/sunstone/public/images/box_gradient.png new file mode 100644 index 0000000000..4e2c718c0c Binary files /dev/null and b/src/sunstone/public/images/box_gradient.png differ diff --git a/src/sunstone/public/images/login.png b/src/sunstone/public/images/login.png new file mode 100644 index 0000000000..f87e0033a9 Binary files /dev/null and b/src/sunstone/public/images/login.png differ diff --git a/src/sunstone/public/images/login_over.png b/src/sunstone/public/images/login_over.png new file mode 100644 index 0000000000..dc5f102c7a Binary files /dev/null and b/src/sunstone/public/images/login_over.png differ diff --git a/src/sunstone/public/images/opennebula-sunstone-big.png b/src/sunstone/public/images/opennebula-sunstone-big.png new file mode 100644 index 0000000000..74b70be13d Binary files /dev/null and b/src/sunstone/public/images/opennebula-sunstone-big.png differ diff --git a/src/sunstone/public/images/opennebula-sunstone-small.png b/src/sunstone/public/images/opennebula-sunstone-small.png new file mode 100644 index 0000000000..7b411542c2 Binary files /dev/null and b/src/sunstone/public/images/opennebula-sunstone-small.png differ diff --git a/src/sunstone/public/images/panel.png b/src/sunstone/public/images/panel.png new file mode 100644 index 0000000000..815baddff9 Binary files /dev/null and b/src/sunstone/public/images/panel.png differ diff --git a/src/sunstone/public/images/pbar.gif b/src/sunstone/public/images/pbar.gif new file mode 100644 index 0000000000..b9d8856a73 Binary files /dev/null and b/src/sunstone/public/images/pbar.gif differ diff --git a/src/sunstone/public/js/base64.js b/src/sunstone/public/js/base64.js new file mode 100644 index 0000000000..54c86951c6 --- /dev/null +++ b/src/sunstone/public/js/base64.js @@ -0,0 +1,113 @@ +// adapted from here: http://ostermiller.org/calc/encode.html +var base64 = {}; + +(function () { + var END_OF_INPUT = -1, + base64Chars = new Array( + 'A','B','C','D','E','F','G','H', + 'I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X', + 'Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n', + 'o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3', + '4','5','6','7','8','9','+','/'), + reverseBase64Chars = new Array(), + base64Str, + base64Count; + + for (var i=0; i < base64Chars.length; i++){ + reverseBase64Chars[base64Chars[i]] = i; + } + + function setBase64Str(str){ + base64Str = str; + base64Count = 0; + } + function readBase64(){ + if (!base64Str) return END_OF_INPUT; + if (base64Count >= base64Str.length) return END_OF_INPUT; + var c = base64Str.charCodeAt(base64Count) & 0xff; + base64Count++; + return c; + } + function readReverseBase64(){ + if (!base64Str) return END_OF_INPUT; + while (true){ + if (base64Count >= base64Str.length) return END_OF_INPUT; + var nextCharacter = base64Str.charAt(base64Count); + base64Count++; + if (reverseBase64Chars[nextCharacter]){ + return reverseBase64Chars[nextCharacter]; + } + if (nextCharacter == 'A') return 0; + } + return END_OF_INPUT; + } + + function ntos(n){ + n=n.toString(16); + if (n.length == 1) n="0"+n; + n="%"+n; + return unescape(n); + } + + base64.encode = function(str){ + setBase64Str(str); + var result = ''; + var inBuffer = new Array(3); + var lineCount = 0; + var done = false; + while (!done && (inBuffer[0] = readBase64()) != END_OF_INPUT){ + inBuffer[1] = readBase64(); + inBuffer[2] = readBase64(); + result += (base64Chars[ inBuffer[0] >> 2 ]); + if (inBuffer[1] != END_OF_INPUT){ + result += (base64Chars [(( inBuffer[0] << 4 ) & 0x30) | (inBuffer[1] >> 4) ]); + if (inBuffer[2] != END_OF_INPUT){ + result += (base64Chars [((inBuffer[1] << 2) & 0x3c) | (inBuffer[2] >> 6) ]); + result += (base64Chars [inBuffer[2] & 0x3F]); + } else { + result += (base64Chars [((inBuffer[1] << 2) & 0x3c)]); + result += ('='); + done = true; + } + } else { + result += (base64Chars [(( inBuffer[0] << 4 ) & 0x30)]); + result += ('='); + result += ('='); + done = true; + } + lineCount += 4; + if (lineCount >= 76){ + result += ('\n'); + lineCount = 0; + } + } + return result; + } + + base64.decode = function(str){ + setBase64Str(str); + var result = ""; + var inBuffer = new Array(4); + var done = false; + while (!done && (inBuffer[0] = readReverseBase64()) != END_OF_INPUT + && (inBuffer[1] = readReverseBase64()) != END_OF_INPUT){ + inBuffer[2] = readReverseBase64(); + inBuffer[3] = readReverseBase64(); + result += ntos((((inBuffer[0] << 2) & 0xff)| inBuffer[1] >> 4)); + if (inBuffer[2] != END_OF_INPUT){ + result += ntos((((inBuffer[1] << 4) & 0xff)| inBuffer[2] >> 2)); + if (inBuffer[3] != END_OF_INPUT){ + result += ntos((((inBuffer[2] << 6) & 0xff) | inBuffer[3])); + } else { + done = true; + } + } else { + done = true; + } + } + return result; + } +})() \ No newline at end of file diff --git a/src/sunstone/public/js/jquery-1.4.4.min.js b/src/sunstone/public/js/jquery-1.4.4.min.js new file mode 100644 index 0000000000..8f3ca2e2da --- /dev/null +++ b/src/sunstone/public/js/jquery-1.4.4.min.js @@ -0,0 +1,167 @@ +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
t
";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/src/sunstone/public/js/jquery-ui-1.8.7.custom.min.js b/src/sunstone/public/js/jquery-ui-1.8.7.custom.min.js new file mode 100644 index 0000000000..b03a87e844 --- /dev/null +++ b/src/sunstone/public/js/jquery-ui-1.8.7.custom.min.js @@ -0,0 +1,781 @@ +/*! + * jQuery UI 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.7",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, +NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, +"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); +if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, +"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h, +d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); +c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a); +return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent", +true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, +left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= +k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=m/2; +i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= +d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= +a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), +g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Draggable 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== +"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= +this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- +this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); +d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis|| +this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element, +b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== +a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| +0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], +this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- +(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment== +"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"? +0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"), +10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor== +Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop(): +f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY; +if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.leftthis.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/ +b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?e:!(e-this.offset.click.left
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})}, +stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!= +document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= +i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), +top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= +this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", +nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== +String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); +this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; +if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), +d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset= +this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: +this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", +b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height; +f={width:c.size.width-(f?0:c.sizeDiff.width),height:c.size.height-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop", +b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top= +a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidthb.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height, +k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+ +a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this, +arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable, +{version:"1.8.7"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize, +function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n= +(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition= +false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left- +a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize", +b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top", +"Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset, +f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left= +a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+ +a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&& +e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative", +height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width= +d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery); +;/* + * jQuery UI Selectable 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), +selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, +c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", +c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= +this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this, +arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem= +c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset, +{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment(); +if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start", +a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute"); +if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a, +c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]== +document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp();this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate", +null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem): +d(this.domPosition.parent).prepend(this.currentItem);return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute|| +"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")}, +_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!= +this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a= +this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable"); +if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h= +0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width= +this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f}, +update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b= +null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this)); +this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])? +g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive", +g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over= +0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); +a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); +if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var f=d.closest(".ui-accordion-header");a.active=f.length?f:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", +function(g){return a._keydown(g)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(g){a._clickHandler.call(a,g,this);g.preventDefault()})},_createIcons:function(){var a=this.options;if(a.icons){c("").addClass("ui-icon "+ +a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex"); +this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); +b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,f=this.headers.index(a.target),g=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:g=this.headers[(f+1)%d];break;case b.LEFT:case b.UP:g=this.headers[(f-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); +a.preventDefault()}if(g){c(a.target).attr("tabIndex",-1);c(g).attr("tabIndex",0);g.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ +c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; +if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected); +a.next().addClass("ui-accordion-content-active")}h=a.next();f=this.active.next();g={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):h,oldContent:f};d=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(h,f,g,b,d)}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); +this.active.next().addClass("ui-accordion-content-active");var f=this.active.next(),g={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:f},h=this.active=c([]);this._toggle(h,f,g)}},_toggle:function(a,b,d,f,g){var h=this,e=h.options;h.toShow=a;h.toHide=b;h.data=d;var j=function(){if(h)return h._completed.apply(h,arguments)};h._trigger("changestart",null,h.data);h.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&f?{toShow:c([]),toHide:b,complete:j, +down:g,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:g,autoHeight:e.autoHeight||e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;f=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!f[k]&&!c.easing[k])k="slide";f[k]||(f[k]=function(l){this.slide(l,{easing:k,duration:i||700})}); +f[k](d)}else{if(e.collapsible&&f)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.7",animations:{slide:function(a, +b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},h={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){h[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);g[i]={value:j[1], +unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(h,{step:function(j,i){if(i.prop=="height")f=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=f*g[i.prop].value+g[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",paddingTop:"hide", +paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); +;/* + * jQuery UI Autocomplete 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + */ +(function(d){d.widget("ui.autocomplete",{options:{appendTo:"body",delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},_create:function(){var a=this,b=this.element[0].ownerDocument,f;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){f=false;var e=d.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:a._move("previousPage", +c);break;case e.PAGE_DOWN:a._move("nextPage",c);break;case e.UP:a._move("previous",c);c.preventDefault();break;case e.DOWN:a._move("next",c);c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:if(a.menu.active){f=true;c.preventDefault()}case e.TAB:if(!a.menu.active)return;a.menu.select(c);break;case e.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay); +break}}}).bind("keypress.autocomplete",function(c){if(f){f=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=d("
    ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo|| +"body",b)[0]).mousedown(function(c){var e=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(g){g.target!==a.element[0]&&g.target!==e&&!d.ui.contains(e,g.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,e){e=e.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:e})&&/^key/.test(c.originalEvent.type)&&a.element.val(e.value)},selected:function(c,e){var g=e.item.data("item.autocomplete"), +h=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=h;setTimeout(function(){a.previous=h;a.selectedItem=g},1)}false!==a._trigger("select",c,{item:g})&&a.element.val(g.value);a.term=a.element.val();a.close(c);a.selectedItem=g},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"); +this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0])},_initSource:function(){var a=this,b,f;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,e){e(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){f=this.options.source;this.source= +function(c,e){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:f,data:c,dataType:"json",success:function(g,h,i){i===a.xhr&&e(g);a.xhr=null},error:function(g){g===a.xhr&&e([]);a.xhr=null}})}}else this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}}); +d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,b){var f=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return f.test(c.label||c.value||c)})}})})(jQuery); +(function(d){d.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(b){if(d(b.target).closest(".ui-menu-item a").length){b.preventDefault();a.select(b)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", +-1).mouseenter(function(b){a.activate(b,d(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var f=b.offset().top-this.element.offset().top,c=this.element.attr("scrollTop"),e=this.element.height();if(f<0)this.element.attr("scrollTop",c+f);else f>=e&&this.element.attr("scrollTop",c+f-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:b})}, +deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,f){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0); +a.length?this.activate(f,a):this.activate(f,this.element.children(b))}else this.activate(f,this.element.children(b))},nextPage:function(a){if(this.hasScroll())if(!this.active||this.last())this.activate(a,this.element.children(".ui-menu-item:first"));else{var b=this.active.offset().top,f=this.element.height(),c=this.element.children(".ui-menu-item").filter(function(){var e=d(this).offset().top-b-f+d(this).height();return e<10&&e>-10});c.length||(c=this.element.children(".ui-menu-item:last"));this.activate(a, +c)}else this.activate(a,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(".ui-menu-item:last"));else{var b=this.active.offset().top,f=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-b+f-d(this).height();return c<10&&c>-10});result.length||(result=this.element.children(".ui-menu-item:first")); +this.activate(a,result)}else this.activate(a,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary;if(d.primary||d.secondary){b.addClass("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("");d.secondary&&b.append("");if(!this.options.text){b.addClass(e?"ui-button-icons-only":"ui-button-icon-only").removeClass("ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary"); +this.hasTitle||b.attr("title",c)}}else b.addClass("ui-button-text-only")}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()}, +destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery); +;/* + * jQuery UI Dialog 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.button.js + * jquery.ui.draggable.js + * jquery.ui.mouse.js + * jquery.ui.position.js + * jquery.ui.resizable.js + */ +(function(c,j){var k={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},l={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&& +c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
    ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex", +-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role", +"button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id",e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose= +b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");a.uiDialog.remove();a.originalTitle&& +a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==b.uiDialog[0]){e=c(this).css("z-index"); +isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",c.ui.dialog.maxZ); +d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===f[0]&&e.shiftKey){g.focus(1);return false}}}); +c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
    ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,function(f, +h){h=c.isFunction(h)?{click:h,text:f}:h;f=c('').attr(h,true).unbind("click").click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.fn.button&&f.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g= +d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize, +position:f.position,size:f.size}}a=a===j?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f, +h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length=== +1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);if(g in k)e=true;if(g in +l)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled"); +break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=this.options,b,d,e= +this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-b,0));this.uiDialog.is(":data(resizable)")&& +this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.7",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length=== +0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), +height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); +b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("
    ");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("").appendTo(this.element).addClass("ui-slider-handle"); +if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur(); +else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e= +false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h=== +b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); +this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b, +g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true}, +_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a; +if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value= +this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, +_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate); +if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, +1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.7"})})(jQuery); +;/* + * jQuery UI Tabs 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& +e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= +d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| +(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); +this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= +this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); +if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); +this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ +g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", +function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; +this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= +-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; +d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= +d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, +e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); +j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); +if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, +this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, +load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, +"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, +url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.7"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k')}function E(a,b){d.extend(a,b);for(var c in b)if(b[c]== +null||b[c]==G)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.7"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase(); +f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('
    ')}}, +_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&& +b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f== +""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a, +c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b), +true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{}); +b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass); +this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup", +this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs, +function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null: +f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true}, +_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos= +d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b, +c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&& +d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout", +function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!= +-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a, +"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]}, +_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e- +g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]? +b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")}, +_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"): +0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear= +false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay= +d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a); +else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b= +a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames, +j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y", +RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= +a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), +b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= +this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+r+"":f?"":''+r+"";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
    '+(c?h:"")+(this._isInRange(a,r)?'":"")+(c?"":h)+"
    ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z= +this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",C=0;C1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]- +1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='
    '+(/all|left/.test(t)&&C==0?c?f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,C>0||D>0,z,w)+'
    ';var A=j?'":"";for(t=0;t<7;t++){var q= +(t+h)%7;A+="=5?' class="ui-datepicker-week-end"':"")+'>'+s[q]+""}x+=A+"";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O";var P=!j?"":'";for(t=0;t<7;t++){var F= +p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,J=B&&!H||!F[0]||k&&qo;P+='";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+= +P+""}g++;if(g>11){g=0;m++}x+="
    '+this._get(a,"weekHeader")+"
    '+this._get(a,"calculateWeek")(q)+""+(B&&!v?" ":J?''+q.getDate()+"":''+q.getDate()+"")+"
    "+(l?""+(i[0]>0&&D==i[1]-1?'
    ':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
    ', +o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&& +l)?" ":""));a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";if(d.browser.mozilla)k+='";else{k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
    ";return k},_adjustInstDate:function(a,b,c){var e= +a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a, +"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); +c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, +"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= +function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b)); +return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.7";window["DP_jQuery_"+y]=d})(jQuery); +;/* + * jQuery UI Progressbar 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.7"})})(jQuery); +;/* + * jQuery UI Effects 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){f.queue(this,"fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l= +h.splice(h.length-1,1)[0];h.splice(1,0,l);f.dequeue(this)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c}, +b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.7",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%", +background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); +return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); +else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), +b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, +a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, +a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== +e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","left"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],10)/100* +f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/src/sunstone/public/js/jquery.dataTables.min.js b/src/sunstone/public/js/jquery.dataTables.min.js new file mode 100644 index 0000000000..cd6587553c --- /dev/null +++ b/src/sunstone/public/js/jquery.dataTables.min.js @@ -0,0 +1,142 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.7.5 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(j,qa,p){j.fn.dataTableSettings=[];var D=j.fn.dataTableSettings;j.fn.dataTableExt={};var n=j.fn.dataTableExt;n.sVersion="1.7.5";n.sErrMode="alert";n.iApiIndex=0;n.oApi={};n.afnFiltering=[];n.aoFeatures=[];n.ofnSearch={};n.afnSortData=[];n.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};n.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled", +sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl", +sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default", +sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner", +sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};n.oPagination={two_button:{fnInit:function(g,m,r){var s,w,y;if(g.bJUI){s=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;s.appendChild(y)}else{s=p.createElement("div");w=p.createElement("div")}s.className= +g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;s.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;m.appendChild(s);m.appendChild(w);j(s).click(function(){g.oApi._fnPageChange(g,"previous")&&r(g)});j(w).click(function(){g.oApi._fnPageChange(g,"next")&&r(g)});j(s).bind("selectstart",function(){return false});j(w).bind("selectstart",function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){m.setAttribute("id",g.sTableId+"_paginate"); +s.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var m=g.aanFeatures.p,r=0,s=m.length;r=w-s){s=w-r+1;x=w}else{s=y-Math.ceil(r/2)+1;x=s+r-1}for(r=s;r<= +x;r++)F+=y!=r?''+r+"":''+r+"";x=g.aanFeatures.p;var z,U=function(){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;m(g);return false},C=function(){return false};r=0;for(s=x.length;rm?1:0},"string-desc":function(g,m){g=g.toLowerCase();m=m.toLowerCase();return gm?-1:0},"html-asc":function(g,m){g=g.replace(/<.*?>/g,"").toLowerCase();m=m.replace(/<.*?>/g,"").toLowerCase();return gm?1:0},"html-desc":function(g,m){g=g.replace(/<.*?>/g,"").toLowerCase();m=m.replace(/<.*?>/g,"").toLowerCase();return gm?-1:0},"date-asc":function(g,m){g=Date.parse(g);m=Date.parse(m);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(m)|| +m==="")m=Date.parse("01/01/1970 00:00:00");return g-m},"date-desc":function(g,m){g=Date.parse(g);m=Date.parse(m);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(m)||m==="")m=Date.parse("01/01/1970 00:00:00");return m-g},"numeric-asc":function(g,m){return(g=="-"||g===""?0:g*1)-(m=="-"||m===""?0:m*1)},"numeric-desc":function(g,m){return(m=="-"||m===""?0:m*1)-(g=="-"||g===""?0:g*1)}};n.aTypes=[function(g){if(g.length===0)return"numeric";var m,r=false;m=g.charAt(0);if("0123456789-".indexOf(m)== +-1)return null;for(var s=1;s")!=-1)return"html";return null}];n.fnVersionCheck=function(g){var m=function(x,v){for(;x.length=parseInt(w,10)};n._oExternConfig={iNextUnique:0};j.fn.dataTable=function(g){function m(){this.fnRecordsTotal=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1? +this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance=this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...", +sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;this.asDataSearch= +[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button"; +this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(d,f){f=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})};this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b= +a+"";a=b.split("");var c="";b=b.length;for(var d=0;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(!(!a.bDestroying&&a.oFeatures.bServerSide&&!sa(a))){a.oFeatures.bServerSide||a.iDraw++;if(a.aiDisplay.length!==0){var i=a._iDisplayStart,h=a._iDisplayEnd;if(a.oFeatures.bServerSide){i=0;h=a.aoData.length}for(i= +i;itr",a.nTHead)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay); +typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,j(">tr",a.nTFoot)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function W(a){if(a.oFeatures.bSort)O(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)P(a,a.oPreviousSearch);else{E(a);C(a)}}function sa(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns", +value:ca(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:-1});if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(d=0;d")c=c.parentNode; +else if(i=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=va(a);e=1}else if(i=="f"&&a.oFeatures.bFilter){f=wa(a);e=1}else if(i=="r"&&a.oFeatures.bProcessing){f=xa(a);e=1}else if(i=="t"){f=ya(a);e=1}else if(i=="i"&&a.oFeatures.bInfo){f=za(a);e=1}else if(i=="p"&&a.oFeatures.bPaginate){f=Aa(a);e=1}else if(n.aoFeatures.length!==0){h=n.aoFeatures;q=0;for(k=h.length;qcaption",a.nTable);i=0;for(k=d.length;ij(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()0&&a.nTable.removeChild(i[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}i=a.nTHead.cloneNode(true);a.nTable.insertBefore(i,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);a.nTable.insertBefore(k,a.nTable.childNodes[1])}var J=fa(i);f=0;for(e=J.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=u(f)}else a.nTable.style.width= +u(f);f=j(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");L(function(B,I){l=B.style;l.paddingTop="0";l.paddingBottom="0";l.borderTopWidth="0";l.borderBottomWidth="0";l.height=0;t=j(B).width();I.style.width=u(t);G.push(t)},i,e);j(i).height(0);if(a.nTFoot!==null){h=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");L(function(B,I){l=B.style;l.paddingTop="0";l.paddingBottom="0";l.borderTopWidth="0";l.borderBottomWidth="0";t=j(B).width();I.style.width= +u(t);G.push(t)},h,k);j(h).height(0)}L(function(B){B.innerHTML="";B.style.width=u(G.shift())},i);a.nTFoot!==null&&L(function(B){B.innerHTML="";B.style.width=u(G.shift())},h);if(j(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight';var c=j("input",b);c.val(a.oPreviousSearch.sSearch.replace('"',"""));c.keyup(function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ja(a.aoData[a.aiDisplay[d]]._aData[c],a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Ca(a,b,c,d,f){var e=ia(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(n.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!== +0){a.aiDisplay.splice(0,a.aiDisplay.length);ha(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");return a}function O(a,b){var c,d,f,e,i,h,k=[],l=[],q=n.oSort,t=a.aoData,G=a.aoColumns;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){k=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(f=0;f=i)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else H(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function za(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Fa,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b} +function Fa(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),i=a.fnFormatNumber(c),h=a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_", +h)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",e).replace("_END_",i).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",e).replace("_END_",i).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div"); +a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");f.className=a.oClasses.sLength;f.innerHTML=a.oLanguage.sLengthMenu.replace("_MENU_",b);j('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);j("select",f).change(function(){var e=j(this).val(),i=a.aanFeatures.l;c=0;for(d=i.length;ca.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Ga(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=a;b.appendChild(c);a=c.offsetWidth; +b.removeChild(c);return a}function $(a){var b=0,c,d=0,f=a.aoColumns.length,e,i=j("th",a.nTHead);for(e=0;etd",b);e.each(function(h){this.style.width="";h=ga(a,h);if(h!==null&&a.aoColumns[h].sWidthOrig!=="")this.style.width=a.aoColumns[h].sWidthOrig});for(e=0;etd",b);if(f.length===0)f=j("thead tr:eq(0)>th",b);for(e=c=0;e +0)a.aoColumns[e].sWidth=u(d);c++}a.nTable.style.width=u(j(b).outerWidth());b.parentNode.removeChild(b)}}function Ia(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){j(b).width();b.style.width=u(j(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=u(j(b).outerWidth())}function Ha(a,b,c){if(typeof c=="undefined"||c){c=Ja(a,b);b=M(a,b);if(c<0)return null;return a.aoData[c].nTr.getElementsByTagName("td")[b]}var d=-1,f,e;c=-1;var i=p.createElement("div");i.style.visibility="hidden"; +i.style.position="absolute";p.body.appendChild(i);f=0;for(e=a.aoData.length;fd){d=i.offsetWidth;c=f}}p.body.removeChild(i);if(c>=0){b=M(a,b);if(a=a.aoData[c].nTr.getElementsByTagName("td")[b])return a}return null}function Ja(a,b){for(var c=-1,d=-1,f=0;fc){c=e.length;d=f}}return d}function u(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b= +a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+"px"}function Oa(a,b){if(a.length!=b.length)return 1;for(var c=0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function ua(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d4096){a=p.cookie.split(";");for(var h=0,k=a.length;h=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[n.iApiIndex]);da(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[n.iApiIndex]);this.fnClose(a);var f= +p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=S(d);e.innerHTML=b;b=j("tr",d.nTBody);j.inArray(a,b)!=-1&&j(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[n.iApiIndex]),c=0;ctr",d.nTHead)[0];i=j(">tr",d.nTFoot)[0];q=[];h=[];for(f=0;f=S(d)){l.appendChild(q[a]);l=j(">tr",d.nTHead);f=1;for(e=l.length;ftr",d.nTFoot);f=1;for(e=l.length;ftr",d.nTHead);f=1;for(e=l.length;ftr",d.nTFoot);f=1;for(e=l.length;ftd:eq("+k+")",d.aoData[f].nTr)[0])}}d.aoColumns[a].bVisible=true}else{l.removeChild(q[a]);f=0;for(e=d.aoColumns[a].anThExtra.length;ftr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();if(a.nTable!=a.nTHead.parentNode){j(">thead",a.nTable).remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&&a.nTable!=a.nTFoot.parentNode){j(">tfoot",a.nTable).remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);j(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];T(a);j(R(a)).removeClass(a.asStripClasses.join(" "));if(a.bJUI){j("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oJUIClasses.sSortableAsc, +n.oJUIClasses.sSortableDesc,n.oJUIClasses.sSortableNone].join(" "));j("th span",a.nTHead).remove()}else j("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oStdClasses.sSortableAsc,n.oStdClasses.sSortableDesc,n.oStdClasses.sSortableNone].join(" "));b.appendChild(a.nTable);d=0;for(f=a.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);j(">tr:odd",c).addClass(a.asDestoryStrips[1]);d=0;for(f=D.length;dt<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ma();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;La(e,g);e.aoDrawCallback.push({fn:na,sName:"state_save"})}if(typeof g.aaData!="undefined")h= +true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;j.getJSON(e.oLanguage.sUrl,null,function(q){y(e,q,true)});i=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=j("tbody>tr",this);a=0;for(b=e.asStripClasses.length;a< +b;a++)if(d.filter(":lt(2)").hasClass(e.asStripClasses[a])){c=true;break}if(c){e.asDestoryStrips=["",""];if(j(d[0]).hasClass(e.oClasses.sStripOdd))e.asDestoryStrips[0]+=e.oClasses.sStripOdd+" ";if(j(d[0]).hasClass(e.oClasses.sStripEven))e.asDestoryStrips[0]+=e.oClasses.sStripEven;if(j(d[1]).hasClass(e.oClasses.sStripOdd))e.asDestoryStrips[1]+=e.oClasses.sStripOdd+" ";if(j(d[1]).hasClass(e.oClasses.sStripEven))e.asDestoryStrips[1]+=e.oClasses.sStripEven;d.removeClass(e.asStripClasses.join(" "))}a=this.getElementsByTagName("thead"); +c=a.length===0?[]:fa(a[0]);var k;if(typeof g.aoColumns=="undefined"){k=[];a=0;for(b=c.length;a=0;a--){var l=g.aoColumnDefs[a].aTargets;j.isArray(l)||H(e,1,"aTargets must be an array of targets, not a "+typeof l); +c=0;for(d=l.length;c=0){for(;e.aoColumns.length<=l[c];)F(e);x(e,l[c],g.aoColumnDefs[a])}else if(typeof l[c]=="number"&&l[c]<0)x(e,e.aoColumns.length+l[c],g.aoColumnDefs[a]);else if(typeof l[c]=="string"){b=0;for(f=e.aoColumns.length;b=e.aoColumns.length)e.aaSorting[a][0]= +0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&&typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;c0)e.nTFoot=this.getElementsByTagName("tfoot")[0];if(h)for(a=0;a').addClass((o&&o.position)?o.position:$.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);} +if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',themeState:'highlight',corners:'10px',check:250,life:3000,closeDuration:'normal',openDuration:'normal',easing:'swing',closer:true,closeTemplate:'×',closerTemplate:'
    [ close all ]
    ',log:function(e,m,o){},beforeOpen:function(e,m,o){},afterOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);if(typeof o.speed!=='undefined'){o.openDuration=o.speed;o.closeDuration=o.speed;} +this.notifications.push({message:message,options:o});o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('
    '+'
    '+o.closeTemplate+'
    '+'
    '+o.header+'
    '+'
    '+message+'
    ').data("jGrowl",o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();$(notification).bind("mouseover.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",true);}).bind("mouseout.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",false);}).bind('jGrowl.beforeOpen',function(){if(o.beforeOpen.apply(notification,[notification,message,o,self.element])!=false){$(this).trigger('jGrowl.open');}}).bind('jGrowl.open',function(){if(o.open.apply(notification,[notification,message,o,self.element])!=false){if(o.glue=='after'){$('div.jGrowl-notification:last',self.element).after(notification);}else{$('div.jGrowl-notification:first',self.element).before(notification);} +$(this).animate(o.animateOpen,o.openDuration,o.easing,function(){if($.browser.msie&&(parseInt($(this).css('opacity'),10)===1||parseInt($(this).css('opacity'),10)===0)) +this.style.removeAttribute('filter');$(this).data("jGrowl").created=new Date();$(this).trigger('jGrowl.afterOpen');});}}).bind('jGrowl.afterOpen',function(){o.afterOpen.apply(notification,[notification,message,o,self.element]);}).bind('jGrowl.beforeClose',function(){if(o.beforeClose.apply(notification,[notification,message,o,self.element])!=false) +$(this).trigger('jGrowl.close');}).bind('jGrowl.close',function(){$(this).data('jGrowl.pause',true);$(this).animate(o.animateClose,o.closeDuration,o.easing,function(){$(this).remove();var close=o.close.apply(notification,[notification,message,o,self.element]);if($.isFunction(close)) +close.apply(notification,[notification,message,o,self.element]);});}).trigger('jGrowl.beforeOpen');if(o.corners!=''&&$.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',self.element).size()>1&&$('div.jGrowl-closer',self.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer ui-state-highlight ui-corner-all').addClass(this.defaults.theme).appendTo(self.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().trigger("jGrowl.beforeClose");if($.isFunction(self.defaults.closer)){self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+parseInt($(this).data("jGrowl").life))<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl.pause")==undefined||$(this).data("jGrowl.pause")!=true)){$(this).trigger('jGrowl.beforeClose');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},parseInt(this.defaults.check));if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"]){$(this.element).addClass('ie6');}},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);},close:function(){$(this.element).find('div.jGrowl-notification').each(function(){$(this).trigger('jGrowl.beforeClose');});}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery); \ No newline at end of file diff --git a/src/sunstone/public/js/jquery.layout.min-1.2.0.js b/src/sunstone/public/js/jquery.layout.min-1.2.0.js new file mode 100644 index 0000000000..bcc2f0f227 --- /dev/null +++ b/src/sunstone/public/js/jquery.layout.min-1.2.0.js @@ -0,0 +1,80 @@ +/* + * jquery.layout 1.2.0 + * + * Copyright (c) 2008 + * Fabrizio Balliano (http://www.fabrizioballiano.net) + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * $Date: 2008-12-27 02:17:22 +0100 (sab, 27 dic 2008) $ + * $Rev: 203 $ + * + * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars + */ +(function($){$.fn.layout=function(opts){var +prefix="ui-layout-",defaults={paneClass:prefix+"pane",resizerClass:prefix+"resizer",togglerClass:prefix+"toggler",togglerInnerClass:prefix+"",buttonClass:prefix+"button",contentSelector:"."+prefix+"content",contentIgnoreSelector:"."+prefix+"ignore"};var options={name:"",scrollToBookmarkOnLoad:true,defaults:{applyDefaultStyles:false,closable:true,resizable:true,slidable:true,contentSelector:defaults.contentSelector,contentIgnoreSelector:defaults.contentIgnoreSelector,paneClass:defaults.paneClass,resizerClass:defaults.resizerClass,togglerClass:defaults.togglerClass,buttonClass:defaults.buttonClass,resizerDragOpacity:1,maskIframesOnResize:true,minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerTip_open:"Close",togglerTip_closed:"Open",resizerTip:"Resize",sliderTip:"Slide Open",sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseout",hideTogglerOnSlide:false,togglerContent_open:"",togglerContent_closed:"",showOverflowOnHover:false,enableCursorHotkey:true,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{},initClosed:false,initHidden:false},north:{paneSelector:"."+prefix+"north",size:"auto",resizerCursor:"n-resize"},south:{paneSelector:"."+prefix+"south",size:"auto",resizerCursor:"s-resize"},east:{paneSelector:"."+prefix+"east",size:200,resizerCursor:"e-resize"},west:{paneSelector:"."+prefix+"west",size:200,resizerCursor:"w-resize"},center:{paneSelector:"."+prefix+"center"}};var effects={slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},scale:{all:{duration:"fast"}}};var config={allPanes:"north,south,east,west,center",borderPanes:"north,south,east,west",zIndex:{resizer_normal:1,pane_normal:2,mask:4,sliding:100,resizing:10000,animation:10000},resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden",zIndex:1},cssDef:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDef:{background:"#AAA"}},content:{cssReq:{overflow:"auto"},cssDef:{}},defaults:{cssReq:{position:"absolute",margin:0,zIndex:2},cssDef:{padding:"10px",background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{edge:"top",sizeType:"height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{edge:"bottom",sizeType:"height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{edge:"right",sizeType:"width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{edge:"left",sizeType:"width",dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}},center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}};var state={id:Math.floor(Math.random()*10000),container:{},north:{},south:{},east:{},west:{},center:{}};var +altEdge={top:"bottom",bottom:"top",left:"right",right:"left"},altSide={north:"south",south:"north",east:"west",west:"east"};var isStr=function(o){if(typeof o=="string")return true;else if(typeof o=="object"){try{var match=o.constructor.toString().match(/string/i);return(match!==null);}catch(e){}}return false;};var str=function(o){if(typeof o=="string"||isStr(o))return $.trim(o);else return o;};var min=function(x,y){return Math.min(x,y);};var max=function(x,y){return Math.max(x,y);};var transformData=function(d){var json={defaults:{fxSettings:{}},north:{fxSettings:{}},south:{fxSettings:{}},east:{fxSettings:{}},west:{fxSettings:{}},center:{fxSettings:{}}};d=d||{};if(d.effects||d.defaults||d.north||d.south||d.west||d.east||d.center)json=$.extend(json,d);else +$.each(d,function(key,val){a=key.split("__");json[a[1]?a[0]:"defaults"][a[1]?a[1]:a[0]]=val;});return json;};var setFlowCallback=function(action,pane,param){var +cb=action+","+pane+","+(param?1:0),cP,cbPane;$.each(c.borderPanes.split(","),function(i,p){if(c[p].isMoving){bindCallback(p);return false;}});function bindCallback(p,test){cP=c[p];if(!cP.doCallback){cP.doCallback=true;cP.callback=cb;}else{cpPane=cP.callback.split(",")[1];if(cpPane!=p&&cpPane!=pane)bindCallback(cpPane,true);}}};var execFlowCallback=function(pane){var cP=c[pane];c.isLayoutBusy=false;delete cP.isMoving;if(!cP.doCallback||!cP.callback)return;cP.doCallback=false;var +cb=cP.callback.split(","),param=(cb[2]>0?true:false);if(cb[0]=="open")open(cb[1],param);else if(cb[0]=="close")close(cb[1],param);if(!cP.doCallback)cP.callback=null;};var execUserCallback=function(pane,v_fn){if(!v_fn)return;var fn;try{if(typeof v_fn=="function")fn=v_fn;else if(typeof v_fn!="string")return;else if(v_fn.indexOf(",")>0){var +args=v_fn.split(","),fn=eval(args[0]);if(typeof fn=="function"&&args.length>1)return fn(args[1]);}else +fn=eval(v_fn);if(typeof fn=="function")return fn(pane,$Ps[pane],$.extend({},state[pane]),$.extend({},options[pane]),options.name);}catch(ex){}};var cssNum=function($E,prop){var +val=0,hidden=false,visibility="";if(!$.browser.msie){if($.curCSS($E[0],"display",true)=="none"){hidden=true;visibility=$.curCSS($E[0],"visibility",true);$E.css({display:"block",visibility:"hidden"});}}val=parseInt($.curCSS($E[0],prop,true),10)||0;if(hidden){$E.css({display:"none"});if(visibility&&visibility!="hidden")$E.css({visibility:visibility});}return val;};var cssW=function(e,outerWidth){var $E;if(isStr(e)){e=str(e);$E=$Ps[e];}else +$E=$(e);if(outerWidth<=0)return 0;else if(!(outerWidth>0))outerWidth=isStr(e)?getPaneSize(e):$E.outerWidth();if(!$.boxModel)return outerWidth;else +return outerWidth +-cssNum($E,"paddingLeft")-cssNum($E,"paddingRight")-($.curCSS($E[0],"borderLeftStyle",true)=="none"?0:cssNum($E,"borderLeftWidth"))-($.curCSS($E[0],"borderRightStyle",true)=="none"?0:cssNum($E,"borderRightWidth"));};var cssH=function(e,outerHeight){var $E;if(isStr(e)){e=str(e);$E=$Ps[e];}else +$E=$(e);if(outerHeight<=0)return 0;else if(!(outerHeight>0))outerHeight=(isStr(e))?getPaneSize(e):$E.outerHeight();if(!$.boxModel)return outerHeight;else +return outerHeight +-cssNum($E,"paddingTop")-cssNum($E,"paddingBottom")-($.curCSS($E[0],"borderTopStyle",true)=="none"?0:cssNum($E,"borderTopWidth"))-($.curCSS($E[0],"borderBottomStyle",true)=="none"?0:cssNum($E,"borderBottomWidth"));};var cssSize=function(pane,outerSize){if(c[pane].dir=="horz")return cssH(pane,outerSize);else +return cssW(pane,outerSize);};var getPaneSize=function(pane,inclSpace){var +$P=$Ps[pane],o=options[pane],s=state[pane],oSp=(inclSpace?o.spacing_open:0),cSp=(inclSpace?o.spacing_closed:0);if(!$P||s.isHidden)return 0;else if(s.isClosed||(s.isSliding&&inclSpace))return cSp;else if(c[pane].dir=="horz")return $P.outerHeight()+oSp;else +return $P.outerWidth()+oSp;};var setPaneMinMaxSizes=function(pane){var +d=cDims,edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$altPane=$Ps[altSide[pane]],paneSpacing=o.spacing_open,altPaneSpacing=options[altSide[pane]].spacing_open,altPaneSize=(!$altPane?0:(dir=="horz"?$altPane.outerHeight():$altPane.outerWidth())),containerSize=(dir=="horz"?d.innerHeight:d.innerWidth),limitSize=containerSize-paneSpacing-altPaneSize-altPaneSpacing,minSize=s.minSize||0,maxSize=Math.min(s.maxSize||9999,limitSize),minPos,maxPos;switch(pane){case"north":minPos=d.offsetTop+minSize;maxPos=d.offsetTop+maxSize;break;case"west":minPos=d.offsetLeft+minSize;maxPos=d.offsetLeft+maxSize;break;case"south":minPos=d.offsetTop+d.innerHeight-maxSize;maxPos=d.offsetTop+d.innerHeight-minSize;break;case"east":minPos=d.offsetLeft+d.innerWidth-maxSize;maxPos=d.offsetLeft+d.innerWidth-minSize;break;}$.extend(s,{minSize:minSize,maxSize:maxSize,minPosition:minPos,maxPosition:maxPos});};var getPaneDims=function(){var d={top:getPaneSize("north",true),bottom:getPaneSize("south",true),left:getPaneSize("west",true),right:getPaneSize("east",true),width:0,height:0};with(d){width=cDims.innerWidth-left-right;height=cDims.innerHeight-bottom-top;top+=cDims.top;bottom+=cDims.bottom;left+=cDims.left;right+=cDims.right;}return d;};var getElemDims=function($E){var +d={},e,b,p;$.each("Left,Right,Top,Bottom".split(","),function(){e=str(this);b=d["border"+e]=cssNum($E,"border"+e+"Width");p=d["padding"+e]=cssNum($E,"padding"+e);d["offset"+e]=b+p;if($E==$Container)d[e.toLowerCase()]=($.boxModel?p:0);});d.innerWidth=d.outerWidth=$E.outerWidth();d.innerHeight=d.outerHeight=$E.outerHeight();if($.boxModel){d.innerWidth-=(d.offsetLeft+d.offsetRight);d.innerHeight-=(d.offsetTop+d.offsetBottom);}return d;};var setTimer=function(pane,action,fn,ms){var +Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name])return;else Timers[name]=setTimeout(fn,ms);};var clearTimer=function(pane,action){var +Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name]){clearTimeout(Timers[name]);delete Timers[name];return true;}else +return false;};var create=function(){initOptions();initContainer();initPanes();initHandles();initResizable();sizeContent("all");if(options.scrollToBookmarkOnLoad)with(self.location)if(hash)replace(hash);initHotkeys();$(window).resize(function(){var timerID="timerLayout_"+state.id;if(window[timerID])clearTimeout(window[timerID]);window[timerID]=null;if(true||$.browser.msie)window[timerID]=setTimeout(resizeAll,100);else +resizeAll();});};var initContainer=function(){try{if($Container[0].tagName=="BODY"){$("html").css({height:"100%",overflow:"hidden"});$("body").css({position:"relative",height:"100%",overflow:"hidden",margin:0,padding:0,border:"none"});}else{var +CSS={overflow:"hidden"},p=$Container.css("position"),h=$Container.css("height");if(!$Container.hasClass("ui-layout-pane")){if(!p||"fixed,absolute,relative".indexOf(p)<0)CSS.position="relative";if(!h||h=="auto")CSS.height="100%";}$Container.css(CSS);}}catch(ex){}cDims=state.container=getElemDims($Container);};var initHotkeys=function(){$.each(c.borderPanes.split(","),function(i,pane){var o=options[pane];if(o.enableCursorHotkey||o.customHotkey){$(document).keydown(keyDown);return false;}});};var initOptions=function(){opts=transformData(opts);if(opts.effects){$.extend(effects,opts.effects);delete opts.effects;}$.each("name,scrollToBookmarkOnLoad".split(","),function(idx,key){if(opts[key]!==undefined)options[key]=opts[key];else if(opts.defaults[key]!==undefined){options[key]=opts.defaults[key];delete opts.defaults[key];}});$.each("paneSelector,resizerCursor,customHotkey".split(","),function(idx,key){delete opts.defaults[key];});$.extend(options.defaults,opts.defaults);c.center=$.extend(true,{},c.defaults,c.center);$.extend(options.center,opts.center);var o_Center=$.extend(true,{},options.defaults,opts.defaults,options.center);$.each("paneClass,contentSelector,contentIgnoreSelector,applyDefaultStyles,showOverflowOnHover".split(","),function(idx,key){options.center[key]=o_Center[key];});var defs=options.defaults;$.each(c.borderPanes.split(","),function(i,pane){c[pane]=$.extend(true,{},c.defaults,c[pane]);o=options[pane]=$.extend(true,{},options.defaults,options[pane],opts.defaults,opts[pane]);if(!o.paneClass)o.paneClass=defaults.paneClass;if(!o.resizerClass)o.resizerClass=defaults.resizerClass;if(!o.togglerClass)o.togglerClass=defaults.togglerClass;$.each(["_open","_close",""],function(i,n){var +sName="fxName"+n,sSpeed="fxSpeed"+n,sSettings="fxSettings"+n;o[sName]=opts[pane][sName]||opts[pane].fxName||opts.defaults[sName]||opts.defaults.fxName||o[sName]||o.fxName||defs[sName]||defs.fxName||"none";var fxName=o[sName];if(fxName=="none"||!$.effects||!$.effects[fxName]||(!effects[fxName]&&!o[sSettings]&&!o.fxSettings))fxName=o[sName]="none";var +fx=effects[fxName]||{},fx_all=fx.all||{},fx_pane=fx[pane]||{};o[sSettings]=$.extend({},fx_all,fx_pane,defs.fxSettings||{},defs[sSettings]||{},o.fxSettings,o[sSettings],opts.defaults.fxSettings,opts.defaults[sSettings]||{},opts[pane].fxSettings,opts[pane][sSettings]||{});o[sSpeed]=opts[pane][sSpeed]||opts[pane].fxSpeed||opts.defaults[sSpeed]||opts.defaults.fxSpeed||o[sSpeed]||o[sSettings].duration||o.fxSpeed||o.fxSettings.duration||defs.fxSpeed||defs.fxSettings.duration||fx_pane.duration||fx_all.duration||"normal";});});};var initPanes=function(){$.each(c.allPanes.split(","),function(){var +pane=str(this),o=options[pane],s=state[pane],fx=s.fx,dir=c[pane].dir,size=o.size=="auto"||isNaN(o.size)?0:o.size,minSize=o.minSize||1,maxSize=o.maxSize||9999,spacing=o.spacing_open||0,sel=o.paneSelector,isIE6=($.browser.msie&&$.browser.version<7),CSS={},$P,$C;$Cs[pane]=false;if(sel.substr(0,1)==="#")$P=$Ps[pane]=$Container.find(sel+":first");else{$P=$Ps[pane]=$Container.children(sel+":first");if(!$P.length)$P=$Ps[pane]=$Container.children("form:first").children(sel+":first");}if(!$P.length){$Ps[pane]=false;return true;}$P.attr("pane",pane).addClass(o.paneClass+" "+o.paneClass+"-"+pane);if(pane!="center"){s.isClosed=false;s.isSliding=false;s.isResizing=false;s.isHidden=false;s.noRoom=false;c[pane].pins=[];}CSS=$.extend({visibility:"visible",display:"block"},c.defaults.cssReq,c[pane].cssReq);if(o.applyDefaultStyles)$.extend(CSS,c.defaults.cssDef,c[pane].cssDef);$P.css(CSS);CSS={};switch(pane){case"north":CSS.top=cDims.top;CSS.left=cDims.left;CSS.right=cDims.right;break;case"south":CSS.bottom=cDims.bottom;CSS.left=cDims.left;CSS.right=cDims.right;break;case"west":CSS.left=cDims.left;break;case"east":CSS.right=cDims.right;break;case"center":}if(dir=="horz"){if(size===0||size=="auto"){$P.css({height:"auto"});size=$P.outerHeight();}size=max(size,minSize);size=min(size,maxSize);size=min(size,cDims.innerHeight-spacing);CSS.height=max(1,cssH(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.height+1);$P.css(CSS);}else if(dir=="vert"){if(size===0||size=="auto"){$P.css({width:"auto",float:"left"});size=$P.outerWidth();$P.css({float:"none"});}size=max(size,minSize);size=min(size,maxSize);size=min(size,cDims.innerWidth-spacing);CSS.width=max(1,cssW(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.width+1);$P.css(CSS);sizeMidPanes(pane,null,true);}else if(pane=="center"){$P.css(CSS);sizeMidPanes("center",null,true);}if(o.initClosed&&o.closable){$P.hide().addClass("closed");s.isClosed=true;}else if(o.initHidden||o.initClosed){hide(pane,true);s.isHidden=true;}else +$P.addClass("open");if(o.showOverflowOnHover)$P.hover(allowOverflow,resetOverflow);if(o.contentSelector){$C=$Cs[pane]=$P.children(o.contentSelector+":first");if(!$C.length){$Cs[pane]=false;return true;}$C.css(c.content.cssReq);if(o.applyDefaultStyles)$C.css(c.content.cssDef);$P.css({overflow:"hidden"});}});};var initHandles=function(){$.each(c.borderPanes.split(","),function(){var +pane=str(this),o=options[pane],s=state[pane],rClass=o.resizerClass,tClass=o.togglerClass,$P=$Ps[pane];$Rs[pane]=false;$Ts[pane]=false;if(!$P||(!o.closable&&!o.resizable))return;var +edge=c[pane].edge,isOpen=$P.is(":visible"),spacing=(isOpen?o.spacing_open:o.spacing_closed),_pane="-"+pane,_state=(isOpen?"-open":"-closed"),$R,$T;$R=$Rs[pane]=$("");if(isOpen&&o.resizable);else if(!isOpen&&o.slidable)$R.attr("title",o.sliderTip).css("cursor",o.sliderCursor);$R.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-resizer":"")).attr("resizer",pane).css(c.resizers.cssReq).css(edge,cDims[edge]+getPaneSize(pane)).addClass(rClass+" "+rClass+_pane+" "+rClass+_state+" "+rClass+_pane+_state).appendTo($Container);if(o.applyDefaultStyles)$R.css(c.resizers.cssDef);if(o.closable){$T=$Ts[pane]=$("
    ");$T.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-toggler":"")).css(c.togglers.cssReq).attr("title",(isOpen?o.togglerTip_open:o.togglerTip_closed)).click(function(evt){toggle(pane);evt.stopPropagation();}).mouseover(function(evt){evt.stopPropagation();}).addClass(tClass+" "+tClass+_pane+" "+tClass+_state+" "+tClass+_pane+_state).appendTo($R);if(o.togglerContent_open)$(""+o.togglerContent_open+"").addClass("content content-open").css("display",s.isClosed?"none":"block").appendTo($T);if(o.togglerContent_closed)$(""+o.togglerContent_closed+"").addClass("content content-closed").css("display",s.isClosed?"block":"none").appendTo($T);if(o.applyDefaultStyles)$T.css(c.togglers.cssDef);if(!isOpen)bindStartSlidingEvent(pane,true);}});sizeHandles("all",true);};var initResizable=function(){var +draggingAvailable=(typeof $.fn.draggable=="function"),minPosition,maxPosition,edge;$.each(c.borderPanes.split(","),function(){var +pane=str(this),o=options[pane],s=state[pane];if(!draggingAvailable||!$Ps[pane]||!o.resizable){o.resizable=false;return true;}var +rClass=o.resizerClass,dragClass=rClass+"-drag",dragPaneClass=rClass+"-"+pane+"-drag",draggingClass=rClass+"-dragging",draggingPaneClass=rClass+"-"+pane+"-dragging",draggingClassSet=false,$P=$Ps[pane],$R=$Rs[pane];if(!s.isClosed)$R.attr("title",o.resizerTip).css("cursor",o.resizerCursor);$R.draggable({containment:$Container[0],axis:(c[pane].dir=="horz"?"y":"x"),delay:200,distance:1,helper:"clone",opacity:o.resizerDragOpacity,zIndex:c.zIndex.resizing,start:function(e,ui){if(false===execUserCallback(pane,o.onresize_start))return false;s.isResizing=true;clearTimer(pane,"closeSlider");$R.addClass(dragClass+" "+dragPaneClass);draggingClassSet=false;var resizerWidth=(pane=="east"||pane=="south"?o.spacing_open:0);setPaneMinMaxSizes(pane);s.minPosition-=resizerWidth;s.maxPosition-=resizerWidth;edge=(c[pane].dir=="horz"?"top":"left");$(o.maskIframesOnResize===true?"iframe":o.maskIframesOnResize).each(function(){$('
    ').css({background:"#fff",opacity:"0.001",zIndex:9,position:"absolute",width:this.offsetWidth+"px",height:this.offsetHeight+"px"}).css($(this).offset()).appendTo(this.parentNode);});},drag:function(e,ui){if(!draggingClassSet){$(".ui-draggable-dragging").addClass(draggingClass+" "+draggingPaneClass).children().css("visibility","hidden");draggingClassSet=true;if(s.isSliding)$Ps[pane].css("zIndex",c.zIndex.sliding);}if(ui.position[edge]s.maxPosition)ui.position[edge]=s.maxPosition;},stop:function(e,ui){var +dragPos=ui.position,resizerPos,newSize;$R.removeClass(dragClass+" "+dragPaneClass);switch(pane){case"north":resizerPos=dragPos.top;break;case"west":resizerPos=dragPos.left;break;case"south":resizerPos=cDims.outerHeight-dragPos.top-$R.outerHeight();break;case"east":resizerPos=cDims.outerWidth-dragPos.left-$R.outerWidth();break;}newSize=resizerPos-cDims[c[pane].edge];sizePane(pane,newSize);$("div.ui-layout-mask").remove();s.isResizing=false;}});});};var hide=function(pane,onInit){var +o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||s.isHidden)return;if(false===execUserCallback(pane,o.onhide_start))return;s.isSliding=false;if($R)$R.hide();if(onInit||s.isClosed){s.isClosed=true;s.isHidden=true;$P.hide();sizeMidPanes(c[pane].dir=="horz"?"all":"center");execUserCallback(pane,o.onhide_end||o.onhide);}else{s.isHiding=true;close(pane,false);}};var show=function(pane,openPane){var +o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||!s.isHidden)return;if(false===execUserCallback(pane,o.onshow_start))return;s.isSliding=false;s.isShowing=true;if($R&&o.spacing_open>0)$R.show();if(openPane===false)close(pane,true);else +open(pane);};var toggle=function(pane){var s=state[pane];if(s.isHidden)show(pane);else if(s.isClosed)open(pane);else +close(pane);};var close=function(pane,force,noAnimation){var +$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&!s.isClosed&&(o.fxName_close!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_sliding="-sliding",_closed="-closed",isShowing=s.isShowing,isHiding=s.isHiding;delete s.isShowing;delete s.isHiding;if(!$P||(!o.resizable&&!o.closable))return;else if(!force&&s.isClosed&&!isShowing)return;if(c.isLayoutBusy){setFlowCallback("close",pane,force);return;}if(!isShowing&&false===execUserCallback(pane,o.onclose_start))return;c[pane].isMoving=true;c.isLayoutBusy=true;s.isClosed=true;if(isHiding)s.isHidden=true;else if(isShowing)s.isHidden=false;syncPinBtns(pane,false);if(!s.isSliding)sizeMidPanes(c[pane].dir=="horz"?"all":"center");if($R){$R.css(edge,cDims[edge]).removeClass(rClass+_open+" "+rClass+_pane+_open).removeClass(rClass+_sliding+" "+rClass+_pane+_sliding).addClass(rClass+_closed+" "+rClass+_pane+_closed);if(o.resizable)$R.draggable("disable").css("cursor","default").attr("title","");if($T){$T.removeClass(tClass+_open+" "+tClass+_pane+_open).addClass(tClass+_closed+" "+tClass+_pane+_closed).attr("title",o.togglerTip_closed);}sizeHandles();}if(doFX){lockPaneForFX(pane,true);$P.hide(o.fxName_close,o.fxSettings_close,o.fxSpeed_close,function(){lockPaneForFX(pane,false);if(!s.isClosed)return;close_2();});}else{$P.hide();close_2();}function close_2(){bindStartSlidingEvent(pane,true);if(!isShowing)execUserCallback(pane,o.onclose_end||o.onclose);if(isShowing)execUserCallback(pane,o.onshow_end||o.onshow);if(isHiding)execUserCallback(pane,o.onhide_end||o.onhide);execFlowCallback(pane);}};var open=function(pane,slide,noAnimation){var +$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&s.isClosed&&(o.fxName_open!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_closed="-closed",_sliding="-sliding",isShowing=s.isShowing;delete s.isShowing;if(!$P||(!o.resizable&&!o.closable))return;else if(!s.isClosed&&!s.isSliding)return;if(s.isHidden&&!isShowing){show(pane,true);return;}if(c.isLayoutBusy){setFlowCallback("open",pane,slide);return;}if(false===execUserCallback(pane,o.onopen_start))return;c[pane].isMoving=true;c.isLayoutBusy=true;if(s.isSliding&&!slide)bindStopSlidingEvents(pane,false);s.isClosed=false;if(isShowing)s.isHidden=false;setPaneMinMaxSizes(pane);if(s.size>s.maxSize)$P.css(c[pane].sizeType,max(1,cssSize(pane,s.maxSize)));bindStartSlidingEvent(pane,false);if(doFX){lockPaneForFX(pane,true);$P.show(o.fxName_open,o.fxSettings_open,o.fxSpeed_open,function(){lockPaneForFX(pane,false);if(s.isClosed)return;open_2();});}else{$P.show();open_2();}function open_2(){if(!s.isSliding)sizeMidPanes(c[pane].dir=="vert"?"center":"all");if($R){$R.css(edge,cDims[edge]+getPaneSize(pane)).removeClass(rClass+_closed+" "+rClass+_pane+_closed).addClass(rClass+_open+" "+rClass+_pane+_open).addClass(!s.isSliding?"":rClass+_sliding+" "+rClass+_pane+_sliding);if(o.resizable)$R.draggable("enable").css("cursor",o.resizerCursor).attr("title",o.resizerTip);else +$R.css("cursor","default");if($T){$T.removeClass(tClass+_closed+" "+tClass+_pane+_closed).addClass(tClass+_open+" "+tClass+_pane+_open).attr("title",o.togglerTip_open);}sizeHandles("all");}sizeContent(pane);syncPinBtns(pane,!s.isSliding);execUserCallback(pane,o.onopen_end||o.onopen);if(isShowing)execUserCallback(pane,o.onshow_end||o.onshow);execFlowCallback(pane);}};var lockPaneForFX=function(pane,doLock){var $P=$Ps[pane];if(doLock){$P.css({zIndex:c.zIndex.animation});if(pane=="south")$P.css({top:cDims.top+cDims.innerHeight-$P.outerHeight()});else if(pane=="east")$P.css({left:cDims.left+cDims.innerWidth-$P.outerWidth()});}else{if(!state[pane].isSliding)$P.css({zIndex:c.zIndex.pane_normal});if(pane=="south")$P.css({top:"auto"});else if(pane=="east")$P.css({left:"auto"});}};var bindStartSlidingEvent=function(pane,enable){var +o=options[pane],$R=$Rs[pane],trigger=o.slideTrigger_open;if(!$R||!o.slidable)return;if(trigger!="click"&&trigger!="dblclick"&&trigger!="mouseover")trigger="click";$R +[enable?"bind":"unbind"](trigger,slideOpen).css("cursor",(enable?o.sliderCursor:"default")).attr("title",(enable?o.sliderTip:""));};var bindStopSlidingEvents=function(pane,enable){var +o=options[pane],s=state[pane],trigger=o.slideTrigger_close,action=(enable?"bind":"unbind"),$P=$Ps[pane],$R=$Rs[pane];s.isSliding=enable;clearTimer(pane,"closeSlider");$P.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.pane_normal)});$R.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.resizer_normal)});if(trigger!="click"&&trigger!="mouseout")trigger="mouseout";if(enable){$P.bind(trigger,slideClosed);$R.bind(trigger,slideClosed);if(trigger="mouseout"){$P.bind("mouseover",cancelMouseOut);$R.bind("mouseover",cancelMouseOut);}}else{$P.unbind(trigger);$R.unbind(trigger);if(trigger="mouseout"){$P.unbind("mouseover");$R.unbind("mouseover");clearTimer(pane,"closeSlider");}}function cancelMouseOut(evt){clearTimer(pane,"closeSlider");evt.stopPropagation();}};var slideOpen=function(){var pane=$(this).attr("resizer");if(state[pane].isClosed){bindStopSlidingEvents(pane,true);open(pane,true);}};var slideClosed=function(){var +$E=$(this),pane=$E.attr("pane")||$E.attr("resizer"),o=options[pane],s=state[pane];if(s.isClosed||s.isResizing)return;else if(o.slideTrigger_close=="click")close_NOW();else +setTimer(pane,"closeSlider",close_NOW,300);function close_NOW(){bindStopSlidingEvents(pane,false);if(!s.isClosed)close(pane);}};var sizePane=function(pane,size){var +edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];setPaneMinMaxSizes(pane);s.minSize=max(s.minSize,o.minSize);if(o.maxSize>0)s.maxSize=min(s.maxSize,o.maxSize);size=max(size,s.minSize);size=min(size,s.maxSize);s.size=size;$R.css(edge,size+cDims[edge]);$P.css(c[pane].sizeType,max(1,cssSize(pane,size)));if(!s.isSliding)sizeMidPanes(dir=="horz"?"all":"center");sizeHandles();sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize);};var sizeMidPanes=function(panes,overrideDims,onInit){if(!panes||panes=="all")panes="east,west,center";var d=getPaneDims();if(overrideDims)$.extend(d,overrideDims);$.each(panes.split(","),function(){if(!$Ps[this])return;var +pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],hasRoom=true,CSS={};if(pane=="center"){d=getPaneDims();CSS=$.extend({},d);CSS.width=max(1,cssW(pane,CSS.width));CSS.height=max(1,cssH(pane,CSS.height));hasRoom=(CSS.width>1&&CSS.height>1);if($.browser.msie&&(!$.boxModel||$.browser.version<7)){if($Ps.north)$Ps.north.css({width:cssW($Ps.north,cDims.innerWidth)});if($Ps.south)$Ps.south.css({width:cssW($Ps.south,cDims.innerWidth)});}}else{CSS.top=d.top;CSS.bottom=d.bottom;CSS.height=max(1,cssH(pane,d.height));hasRoom=(CSS.height>1);}if(hasRoom){$P.css(CSS);if(s.noRoom){s.noRoom=false;if(s.isHidden)return;else show(pane,!s.isClosed);}if(!onInit){sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize);}}else if(!s.noRoom){s.noRoom=true;if(s.isHidden)return;if(onInit){$P.hide();if($R)$R.hide();}else hide(pane);}});};var sizeContent=function(panes){if(!panes||panes=="all")panes=c.allPanes;$.each(panes.split(","),function(){if(!$Cs[this])return;var +pane=str(this),ignore=options[pane].contentIgnoreSelector,$P=$Ps[pane],$C=$Cs[pane],e_C=$C[0],height=cssH($P);;$P.children().each(function(){if(this==e_C)return;var $E=$(this);if(!ignore||!$E.is(ignore))height-=$E.outerHeight();});if(height>0)height=cssH($C,height);if(height<1)$C.hide();else +$C.css({height:height}).show();});};var sizeHandles=function(panes,onInit){if(!panes||panes=="all")panes=c.borderPanes;$.each(panes.split(","),function(){var +pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane];if(!$P||!$R||(!o.resizable&&!o.closable))return;var +dir=c[pane].dir,_state=(s.isClosed?"_closed":"_open"),spacing=o["spacing"+_state],togAlign=o["togglerAlign"+_state],togLen=o["togglerLength"+_state],paneLen,offset,CSS={};if(spacing==0){$R.hide();return;}else if(!s.noRoom&&!s.isHidden)$R.show();if(dir=="horz"){paneLen=$P.outerWidth();$R.css({width:max(1,cssW($R,paneLen)),height:max(1,cssH($R,spacing)),left:cssNum($P,"left")});}else{paneLen=$P.outerHeight();$R.css({height:max(1,cssH($R,paneLen)),width:max(1,cssW($R,spacing)),top:cDims.top+getPaneSize("north",true)});}if($T){if(togLen==0||(s.isSliding&&o.hideTogglerOnSlide)){$T.hide();return;}else +$T.show();if(!(togLen>0)||togLen=="100%"||togLen>paneLen){togLen=paneLen;offset=0;}else{if(typeof togAlign=="string"){switch(togAlign){case"top":case"left":offset=0;break;case"bottom":case"right":offset=paneLen-togLen;break;case"middle":case"center":default:offset=Math.floor((paneLen-togLen)/2);}}else{var x=parseInt(togAlign);if(togAlign>=0)offset=x;else offset=paneLen-togLen+x;}}var +$TC_o=(o.togglerContent_open?$T.children(".content-open"):false),$TC_c=(o.togglerContent_closed?$T.children(".content-closed"):false),$TC=(s.isClosed?$TC_c:$TC_o);if($TC_o)$TC_o.css("display",s.isClosed?"none":"block");if($TC_c)$TC_c.css("display",s.isClosed?"block":"none");if(dir=="horz"){var width=cssW($T,togLen);$T.css({width:max(0,width),height:max(1,cssH($T,spacing)),left:offset});if($TC)$TC.css("marginLeft",Math.floor((width-$TC.outerWidth())/2));}else{var height=cssH($T,togLen);$T.css({height:max(0,height),width:max(1,cssW($T,spacing)),top:offset});if($TC)$TC.css("marginTop",Math.floor((height-$TC.outerHeight())/2));}}if(onInit&&o.initHidden){$R.hide();if($T)$T.hide();}});};var resizeAll=function(){var +oldW=cDims.innerWidth,oldH=cDims.innerHeight;cDims=state.container=getElemDims($Container);var +checkH=(cDims.innerHeights.maxSize)sizePane(pane,s.maxSize);}});sizeMidPanes("all");sizeHandles("all");};function keyDown(evt){if(!evt)return true;var code=evt.keyCode;if(code<33)return true;var +PANE={38:"north",40:"south",37:"west",39:"east"},isCursorKey=(code>=37&&code<=40),ALT=evt.altKey,SHIFT=evt.shiftKey,CTRL=evt.ctrlKey,pane=false,s,o,k,m,el;if(!CTRL&&!SHIFT)return true;else if(isCursorKey&&options[PANE[code]].enableCursorHotkey)pane=PANE[code];else +$.each(c.borderPanes.split(","),function(i,p){o=options[p];k=o.customHotkey;m=o.customHotkeyModifier;if((SHIFT&&m=="SHIFT")||(CTRL&&m=="CTRL")||(CTRL&&SHIFT)){if(k&&code==(isNaN(k)||k<=9?k.toUpperCase().charCodeAt(0):k)){pane=p;return false;}}});if(!pane)return true;o=options[pane];s=state[pane];if(!o.enableCursorHotkey||s.isHidden||!$Ps[pane])return true;el=evt.target||evt.srcElement;if(el&&SHIFT&&isCursorKey&&(el.tagName=="TEXTAREA"||(el.tagName=="INPUT"&&(code==37||code==39))))return true;toggle(pane);evt.stopPropagation();evt.returnValue=false;return false;};function allowOverflow(elem){if(this&&this.tagName)elem=this;var $P;if(typeof elem=="string")$P=$Ps[elem];else{if($(elem).attr("pane"))$P=$(elem);else $P=$(elem).parents("div[pane]:first");}if(!$P.length)return;var +pane=$P.attr("pane"),s=state[pane];if(s.cssSaved)resetOverflow(pane);if(s.isSliding||s.isResizing||s.isClosed){s.cssSaved=false;return;}var +newCSS={zIndex:(c.zIndex.pane_normal+1)},curCSS={},of=$P.css("overflow"),ofX=$P.css("overflowX"),ofY=$P.css("overflowY");if(of!="visible"){curCSS.overflow=of;newCSS.overflow="visible";}if(ofX&&ofX!="visible"&&ofX!="auto"){curCSS.overflowX=ofX;newCSS.overflowX="visible";}if(ofY&&ofY!="visible"&&ofY!="auto"){curCSS.overflowY=ofX;newCSS.overflowY="visible";}s.cssSaved=curCSS;$P.css(newCSS);$.each(c.allPanes.split(","),function(i,p){if(p!=pane)resetOverflow(p);});};function resetOverflow(elem){if(this&&this.tagName)elem=this;var $P;if(typeof elem=="string")$P=$Ps[elem];else{if($(elem).hasClass("ui-layout-pane"))$P=$(elem);else $P=$(elem).parents("div[pane]:first");}if(!$P.length)return;var +pane=$P.attr("pane"),s=state[pane],CSS=s.cssSaved||{};if(!s.isSliding&&!s.isResizing)$P.css("zIndex",c.zIndex.pane_normal);$P.css(CSS);s.cssSaved=false;};function getBtn(selector,pane,action){var +$E=$(selector),err="Error Adding Button \n\nInvalid ";if(!$E.length)alert(err+"selector: "+selector);else if(c.borderPanes.indexOf(pane)==-1)alert(err+"pane: "+pane);else{var btn=options[pane].buttonClass+"-"+action;$E.addClass(btn+" "+btn+"-"+pane);return $E;}return false;};function addToggleBtn(selector,pane){var $E=getBtn(selector,pane,"toggle");if($E)$E.attr("title",state[pane].isClosed?"Open":"Close").click(function(evt){toggle(pane);evt.stopPropagation();});};function addOpenBtn(selector,pane){var $E=getBtn(selector,pane,"open");if($E)$E.attr("title","Open").click(function(evt){open(pane);evt.stopPropagation();});};function addCloseBtn(selector,pane){var $E=getBtn(selector,pane,"close");if($E)$E.attr("title","Close").click(function(evt){close(pane);evt.stopPropagation();});};function addPinBtn(selector,pane){var $E=getBtn(selector,pane,"pin");if($E){var s=state[pane];$E.click(function(evt){setPinState($(this),pane,(s.isSliding||s.isClosed));if(s.isSliding||s.isClosed)open(pane);else close(pane);evt.stopPropagation();});setPinState($E,pane,(!s.isClosed&&!s.isSliding));c[pane].pins.push(selector);}};function syncPinBtns(pane,doPin){$.each(c[pane].pins,function(i,selector){setPinState($(selector),pane,doPin);});};function setPinState($Pin,pane,doPin){var updown=$Pin.attr("pin");if(updown&&doPin==(updown=="down"))return;var +root=options[pane].buttonClass,class1=root+"-pin",class2=class1+"-"+pane,UP1=class1+"-up",UP2=class2+"-up",DN1=class1+"-down",DN2=class2+"-down";$Pin.attr("pin",doPin?"down":"up").attr("title",doPin?"Un-Pin":"Pin").removeClass(doPin?UP1:DN1).removeClass(doPin?UP2:DN2).addClass(doPin?DN1:UP1).addClass(doPin?DN2:UP2);};var +$Container=$(this).css({overflow:"hidden"}),$Ps={},$Cs={},$Rs={},$Ts={},c=config,cDims=state.container;create();return{options:options,state:state,panes:$Ps,toggle:toggle,open:open,close:close,hide:hide,show:show,resizeContent:sizeContent,sizePane:sizePane,resizeAll:resizeAll,addToggleBtn:addToggleBtn,addOpenBtn:addOpenBtn,addCloseBtn:addCloseBtn,addPinBtn:addPinBtn,allowOverflow:allowOverflow,resetOverflow:resetOverflow,cssWidth:cssW,cssHeight:cssH};}})(jQuery); \ No newline at end of file diff --git a/src/sunstone/public/js/layout.js b/src/sunstone/public/js/layout.js new file mode 100755 index 0000000000..fd1da90ed4 --- /dev/null +++ b/src/sunstone/public/js/layout.js @@ -0,0 +1,102 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +var activeTab; +var outerLayout, innerLayout; + +function hideDialog(){ + innerLayout.close("south"); +} + +function popDialog(content){ + $("#dialog").html(content); + innerLayout.open("south"); +} + +function popDialogLoading(){ + var loading = '
    loading...
    '; + popDialog(loading); +} + +function showTab(tabname){ + activeTab = tabname; + + //clean selected menu + $("#navigation li").removeClass("navigation-active-li"); + $("#navigation li a").removeClass("navigation-active-li-a"); + + //select menu + var li = $("#navigation li:has(a[href='"+activeTab+"'])") + var li_a = $("#navigation li a[href='"+activeTab+"']") + li.addClass("navigation-active-li"); + li_a.addClass("navigation-active-li-a"); + + //show tab + $(".tab").hide(); + $(activeTab).show(); + //~ if (activeTab == '#dashboard') { + //~ emptyDashboard(); + //~ preloadTables(); + //~ } + innerLayout.close("south"); +} + +$(document).ready(function () { + $(".tab").hide(); + + $(".outer-west ul li a").click(function(){ + var tab = $(this).attr('href'); + showTab(tab); + return false; + }) + + outerLayout = $('body').layout({ + applyDefaultStyles: false + , center__paneSelector: ".outer-center" + , west__paneSelector: ".outer-west" + , west__size: 130 + , north__size: 26 + , south__size: 26 + , spacing_open: 0 // ALL panes + , spacing_closed: 0 // ALL panes + //, north__spacing_open: 0 + //, south__spacing_open: 0 + , north__maxSize: 200 + , south__maxSize: 200 + , south__closable: false + , north__closable: false + , west__closable: false + , south__resizable: false + , north__resizable: false + , west__resizable: false + }); + + var factor = 0.6; + var dialog_height = Math.floor($(".outer-center").height()*factor); + + innerLayout = $('div.outer-center').layout({ + fxName: "slide" + , initClosed: true + , center__paneSelector: ".inner-center" + , south__paneSelector: ".inner-south" + , south__size: dialog_height + , spacing_open: 8 // ALL panes + , spacing_closed: 12 // ALL panes + }); + + showTab("#dashboard"); +}); + diff --git a/src/sunstone/public/js/login.js b/src/sunstone/public/js/login.js new file mode 100644 index 0000000000..48de29347a --- /dev/null +++ b/src/sunstone/public/js/login.js @@ -0,0 +1,71 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +function auth_success(req, response){ + window.location.href = "/"; +} + +function auth_error(req, error){ + + var status = error.error.http_status; + + switch (status){ + case 401: + $("#one_error").hide(); + $("#auth_error").show(); + break; + case 500: + $("#auth_error").hide(); + $("#one_error").show(); + break; + } +} + +function authenticate(){ + var username = $("#username").val(); + var password = $("#password").val(); + var remember = $("#check_remember").is(":checked"); + + OpenNebula.Auth.login({ data: {username: username + , password: password} + , remember: remember + , success: auth_success + , error: auth_error + }); +} + +function logout(){ + OpenNebula.Auth.logout(); +} + + +$(document).ready(function(){ + $("#login_btn").click(function () { + authenticate(); + }); + + $("input").keydown(function (e){ + if (e.keyCode == 13) { + authenticate(); + } + }); + + $("#logout_btn").click(function () { + logout(); + }); + + $("input#username.box").get(0).focus(); +}); diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js new file mode 100644 index 0000000000..b3b5cbc7a7 --- /dev/null +++ b/src/sunstone/public/js/one-ui_views.js @@ -0,0 +1,3215 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + + +/*###################################################################### + * GLOBAL VARIABLES + * ###################################################################*/ + +var dataTable_hosts=null; +//~ var dataTable_clusters=null; +var dataTable_vMachines=null; +var dataTable_vNetworks=null; +var dataTable_users=null; +var dataTable_images=null; +var host_list_json = {}; +var cluster_list_json = {}; +var vmachine_list_json = {}; +var network_list_json = {}; +var user_list_json = {}; +var image_list_json = {}; +var hosts_select=""; +var clusters_select=""; +var vnetworks_select=""; +var images_select=""; +var cookie = {}; +var username = ''; +var uid = ''; +var spinner = 'retrieving'; + +/*###################################################################### + * DOCUMENT READY FUNCTIONS + * ###################################################################*/ + +$(document).ready(function() { + + readCookie(); + setLogin(); + insertTemplates(); //put templates in place + initDataTables(); + initCheckAllBoxes(); + initListButtons(); + setupCreateDialogs(); + setupTips(); + hideUnauthorizedDivs(); + refreshButtonListener(); //listen to manual refresh image clicks + confirmButtonListener(); //listen to buttons that require confirmation + confirmWithSelectListener(); //listen to buttons requiring a selector + actionButtonListener(); //listens to all simple actions (not creates) + setupImageAttributesDialogs(); //setups the add/update/remove attr dialogs + + //Jquery-ui eye-candy + $('button').button(); + $('div#select_helpers').hide(); + emptyDashboard(); + preloadTables(); + setupAutoRefresh(); + + $(".ui-widget-overlay").live("click", function (){ + $("div:ui-dialog:visible").dialog("close"); + }); + + //Dashboard link listener + $("#dashboard_table h3 a").live("click", function (){ + var tab = $(this).attr('href'); + showTab(tab); + return false; + }); + + //Close select lists... + $('*:not(.action_list,.list_button)').click(function(){ + $('.action_list:visible').hide(); + }); + + +}); + +//reads the cookie and places its info in the 'cookie' var +function readCookie(){ + $.each(document.cookie.split("; "), function(i,e){ + var e_split = e.split("="); + var key = e_split[0]; + var value = e_split[1]; + cookie[key] = value; + }); +} + +//sets the user info in the top bar and creates a listner in the signout button +function setLogin(){ + username = cookie["one-user"]; + uid = cookie["one-user_id"]; + + $("#user").html(username); + $("#logout").click(function(){ + OpenNebula.Auth.logout({success:function(){ + window.location.href = "/login"; + } + }); + return false; + }); +} + +function hideUnauthorizedDivs(){ + // hide all the oneadmin divs if user is not oneadmin + if (uid != 0) { + $(".oneadmin").hide(); + } +} +//puts predifined templates into the document body +//templates can be found in one-ui_views.templates.js +function insertTemplates(){ + $('div#dashboard').html(dashboard_tmpl); + $('div#hosts').html(hostlist_tmpl); + //$('div#clusters').html(clusterlist_tmpl); + $('div#virtualMachines').html(vmachinelist_tmpl); + $('div#virtualNetworks').html(vnetworklist_tmpl); + $('div#users').html(userlist_tmpl); + $('div#images').html(imagelist_tmpl); +} + + +//initializes the dataTables and sets the options +function initDataTables(){ + + dataTable_hosts = $("#datatable_hosts").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "bAutoWidth":false, + "sPaginationType": "full_numbers", + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0,4] }, + { "sWidth": "35px", "aTargets": [1] }, + { "sWidth": "120px", "aTargets": [5,6] } + ] + }); + + + //~ dataTable_clusters = $("#datatable_clusters").dataTable({ + //~ "bJQueryUI": true, + //~ "bSortClasses": false, + //~ "sPaginationType": "full_numbers", + //~ "aoColumnDefs": [ + //~ { "bSortable": false, "aTargets": ["check"] } + //~ ] + //~ }); + + dataTable_vMachines = $("#datatable_vmachines").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "bAutoWidth":false, + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0] }, + { "sWidth": "35px", "aTargets": [1] } + ] + }); + + dataTable_vNetworks = $("#datatable_vnetworks").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "bAutoWidth":false, + "sPaginationType": "full_numbers", + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0,5,6,7] }, + { "sWidth": "35px", "aTargets": [1] } + ] + }); + + if (uid == 0) { + dataTable_users = $("#datatable_users").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "bAutoWidth":false, + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0] }, + { "sWidth": "35px", "aTargets": [1] } + ] + }); + } + + dataTable_images = $("#datatable_images").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "bAutoWidth":false, + "sPaginationType": "full_numbers", + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0,3] }, + { "sWidth": "35px", "aTargets": [1] } + ] + }); + +} + +//Adds a listener to checks all the elements of a table +function initCheckAllBoxes(){ + //not showing nice in that position + //$('.check_all').button({ icons: {primary : "ui-icon-check" }, + // text : true}); + $('.check_all').css({"border":"2px"}); + $('.check_all').click(function(){ + if ($(this).attr("checked")) { + $('tbody input:checkbox', + $(this).parents("table")).each(function(){ + $(this).attr("checked","checked"); + }); + + } else { + $('tbody input:checkbox', + $(this).parents("table")).each(function(){ + $(this).removeAttr("checked"); + }); } + }); +} + +//Converts selects into buttons which show a of actions when clicked +function initListButtons(){ + + //for each multi_action select + $('.multi_action_slct').each(function(){ + //prepare replacement buttons + buttonset = $('
    Previous action').button(); + button1.attr("disabled","disabled"); + button2 = $('').button({ + text:false, + icons: { primary: "ui-icon-triangle-1-s" } + }); + buttonset.append(button1); + buttonset.append(button2); + buttonset.buttonset(); + + //prepare list + options = $('option', $(this)); + list = $('
      '); + $.each(options,function(){ + classes = $(this).attr("class"); + item = $('
    • '); + a = $(''+$(this).text()+''); + a.val($(this).val()); + item.html(a); + list.append(item); + }); + list.css({ + "display":"none" + }); + + + //replace the select and insert the buttons + $(this).before(buttonset); + $(this).parents('.action_blocks').append(list); + $(this).remove(); + //$(this).replaceWith(list); + + }); + + + //listen for events on this buttons and list + + //enable run the last action button + $('.action_list li a').click(function(){ + //enable run last action button + prev_action_button = $('.last_action_button',$(this).parents('.action_blocks')); + prev_action_button.val($(this).val()); + prev_action_button.removeClass("confirm_with_select_button"); + prev_action_button.removeClass("confirm_button"); + prev_action_button.addClass($(this).attr("class")); + confirmButtonListener(); + confirmWithSelectListener(); + actionButtonListener(); + prev_action_button.button("option","label",$(this).text()); + prev_action_button.button("enable"); + $(this).parents('ul').hide("blind",100); + return false; + }); + + + //Show the list of actions in place + $('.list_button').click(function(){ + $('.action_list',$(this).parents('.action_blocks')).css({ + "left": $(this).prev().position().left, + "top": $(this).prev().position().top+13, + "width": $(this).parent().outerWidth()-11 + }); + $('.action_list',$(this).parents('.action_blocks')).toggle("blind",100); + return false; + }); + + +} + +//Sets up all the "+ New Thing" dialogs. +function setupCreateDialogs(){ + createHostDialog(); + createClusterDialog(); + createVMachineDialog(); + createVNetworkDialog(); + createUserDialog(); + createImageDialog(); +} + +function refreshButtonListener(){ + $('.refresh_image').click(function(){ + action = $(this).attr('alt'); + callback = null; + + waiting_nodes = function(dataTable){ + nodes = dataTable.fnGetData(); + for (var i=0;i
      '); + }; + + $('div#confirm_dialog').html( + '
      \ +
      Do you want to proceed?
      \ +
      \ +
      Do you want to proceed?
      \ +
      \ +
      \ + \ + \ +
      \ +
      '); + + //prepare the jquery dialog + $('div#confirm_dialog').dialog({ + resizable:false, + modal:true, + width:300, + heigth:200, + autoOpen:false + }); + + $('div#confirm_dialog button').button(); + + //add listeners + $('.confirm_button').click(function(){ + val=$(this).val(); + tip=""; + //supported cases + switch (val) { + case "OpenNebula.VM.deploy": + tip="This will deploy the selected VMs on the selected host."; + break; + case "OpenNebula.VM.migrate": + tip="This will migrate the selected VMs to the selected host. "; + tip+="This is a \"cold\" migration, as the VMs will be stopped "; + tip+="prior to that migration"; + break; + case "OpenNebula.VM.livemigrate": + tip="This will live-migrate the selected VMs to the selected host."; + break; + case "OpenNebula.VM.hold": + tip="This will pause the selected VMs."; + break; + case "OpenNebula.VM.release": + tip="This will release the selected VMs"; + break; + case "OpenNebula.VM.suspend": + tip="This will suspend the selected VMs. You can resume them later."; + break; + case "OpenNebula.VM.resume": + tip="This will resume the selected VMs from their suspend state"; + break; + case "OpenNebula.VM.stop": + tip="This will shutdown the selected VMs."; + break; + case "OpenNebula.VM.restart": + tip="This will reboot the selected VMs."; + break; + case "OpenNebula.VM.shutdown": + tip="This will try to properly shutdown the selected VMs."; + break; + case "OpenNebula.VM.cancel": + tip="This will destroy the selected VMs"; + break; + case "OpenNebula.VM.delete": + tip="This will delete the selected VMs"; + break; + default: return false; + + } + $('div#confirm_tip').text(tip); + $('div#confirm_dialog button#proceed').val(val); + $('div#confirm_dialog').dialog("open"); + + return false; + }); + + $('div#confirm_dialog #cancel').click(function(){ + $('div#confirm_dialog').dialog("close"); + return false; + }); + +} + +//Listens to ".confirm_with_select_button" elements. Shows a dialog +//allowing to confirm or cancel an action, with a tip and a +//select input field. Depending on the action, the select can +//contain different values. If wanting to proceed, the action is +//executed for each of the checked elements of the table, with the +//selected item of the box as extra parameter. +function confirmWithSelectListener(){ + //add this dialog to the dialogs. + if (!($('div#confirm_with_select_dialog').length)){ + $('div#dialogs').append('
      '); + }; + + $('div#confirm_with_select_dialog').html( + '
      \ +
      \ + \ +
      \ + \ + \ +
      \ +
      '); + + //prepare the jquery dialog + $('div#confirm_with_select_dialog').dialog({ + resizable:false, + modal:true, + width:300, + heigth:300, + autoOpen:false + }); + + $('div#confirm_with_select_dialog button').button(); + //add listeners + $('.confirm_with_select_button').click(function(){ + val=$(this).val(); + tip=""; + dataTable=null; + select_helper=null; + callback=null; + //supported cases + switch (val) { + case "OpenNebula.Cluster.addhost": + tip="This will add the selected Hosts the the following cluster:"; + dataTable="dataTable_hosts"; + callback = function(req){ + OpenNebula.Host.show({data:{id:req.request.data}, success: updateHostElement, error: onError}); + }; + select_var = clusters_select; + break; + case "OpenNebula.Cluster.delete": + tip="Select the cluster you want to delete"; + dataTable="null"; + select_var = clusters_select; + callback = function (){ + OpenNebula.Host.list({success: updateClustersView,error: onError}); + } + break; + case "OpenNebula.VM.deploy": + tip="This will deploy the selected VMs. Please select a host for the deployment:"; + dataTable = "dataTable_vMachines"; + callback = function(req){ + OpenNebula.VM.show({data:{id:req.request.data},success: updateVMachineElement,error: onError})}; + select_var = hosts_select; + break; + case "OpenNebula.VM.migrate": + tip="This will migrate the selected VMs. Please select a host as destination for the migration:"; + dataTable = "dataTable_vMachines"; + callback = function(req){ + OpenNebula.VM.show({data:{id:req.request.data},success: updateVMachineElement, error: onError})}; + select_var = hosts_select; + break; + case "OpenNebula.VM.livemigrate": + tip="This will live-migrate the selected VMs. Please select a host as destination for the migration:"; + dataTable = "dataTable_vMachines"; + callback = function(req){ + OpenNebula.VM.show({data:{id:req.request.data},success: updateVMachineElement,error: onError})}; + select_var = hosts_select; + break; + default: return false; + + } + + //insert options + $('select#confirm_select').html(select_var); + + $('div#confirm_with_select_tip').text(tip); + + $('button#confirm_with_select_proceed').val(val); + $('button#confirm_with_select_proceed').attr("dataTable",dataTable); + $('div#confirm_with_select_dialog').dialog("open"); + + return false; + }); + + $('button#confirm_with_select_proceed').click(function(){ + action=$(this).val(); + + selected_item_id = $('#confirm_select :selected').val(); + dataTable=eval($(this).attr("dataTable")); + + var data; + switch (action) { + case "OpenNebula.Cluster.addhost": + data = {cluster_id: selected_item_id}; + break; + case "OpenNebula.Cluster.delete": + data = {cluster_id: selected_item_id}; + break; + case "OpenNebula.VM.deploy": + data = {host_id: selected_item_id}; + break; + case "OpenNebula.VM.migrate": + data = {host_id: selected_item_id}; + break; + case "OpenNebula.VM.livemigrate": + data = {host_id: selected_item_id}; + break; + default: return false; + } + + if (dataTable != null && selected_item_id.length){ + nodes = $('input:checked',dataTable.fnGetNodes()); + //prepare array for notification + var nodes_id = new Array(); + $.each(nodes, function(){ + nodes_id.push($(this).val()); + data.id = $(this).val(); + (eval(action)({data: data, success: callback, error: onError })); + }); + notifySubmit(action,nodes_id,selected_item_id); + } + else { //we execute the action only on the selected item + (eval(action)({data:{id: selected_item_id},success: callback,error: onError})); + } + + $('div#confirm_with_select_dialog').dialog("close"); + return false; + }); + + $('button#confirm_with_select_cancel').click(function(){ + $('div#confirm_with_select_dialog').dialog("close"); + return false; + }); + +} + +//Listens to click on ".action_button" elements. According to the value +//of the element, it sends actions to OpenNebula.js. This function +//handles all the simple actions of the UI: delete, enables, disables, etc... +function actionButtonListener(){ + //Listener + $('.action_button').click(function(){ + dataTable=null; //Which dataTable should be updated afterwards? + callback = null; //Which callback function should be used on success? + + //Actions have 1 fixed parametre (the element they primarly + //affect, fectched from the checkboxes of the list. + //Does our action need two params? (ex. add host to cluster) + extra_param = null; + + + action = $(this).val(); //Fetch the value of the action + + //Actions are grouped. For some of them no need to make a + //difference + switch (action){ + //Host list actions + //case "OpenNebula.Cluster.addhost": + case "OpenNebula.Cluster.removehost": + extra_param="0"; + case "OpenNebula.Host.enable": + case "OpenNebula.Host.disable": + dataTable = dataTable_hosts; + callback = function(req){ + OpenNebula.Host.show({data:{id:req.request.data[0]},success: updateHostElement,error: onError}); + }; + break; + + case "OpenNebula.Host.delete": + dataTable = dataTable_hosts; + callback = deleteHostElement; + break; + + //~ //Cluster list actions - now it is confirm with select + //~ case "OpenNebula.Cluster.delete": + //~ dataTable = dataTable_clusters; + //~ callback = deleteClusterElement; + //~ break; + + //VMachine list actions + case "OpenNebula.VM.deploy": + case "OpenNebula.VM.migrate": + case "OpenNebula.VM.livemigrate": + //Set an extra param if is a deploy, migrate or livemigrate + host = $('#vm_host :selected').val(); + //Making sure we selected a host + if (!host.length){ + break; + }; + extra_param = host; + + case "OpenNebula.VM.hold": + case "OpenNebula.VM.release": + case "OpenNebula.VM.suspend": + case "OpenNebula.VM.resume": + case "OpenNebula.VM.stop": + case "OpenNebula.VM.restart": + case "OpenNebula.VM.shutdown": + case "OpenNebula.VM.cancel": + dataTable = dataTable_vMachines; + callback = function(req){ + OpenNebula.VM.show({data:{id:req.request.data},success: updateVMachineElement,error: onError})}; + break; + case "OpenNebula.VM.delete": + dataTable = dataTable_vMachines; + callback = deleteVMachineElement; + break; + + //VNET list actions + case "OpenNebula.Network.publish": + case "OpenNebula.Network.unpublish": + dataTable = dataTable_vNetworks; + callback = function(req){ + OpenNebula.Network.show({data:{id:req.request.data},success: updateVNetworkElement, error: onError})}; + break; + break; + case "OpenNebula.Network.delete": + dataTable = dataTable_vNetworks; + callback = deleteVNetworkElement; + break; + case "OpenNebula.User.delete": + dataTable = dataTable_users; + callback = deleteUserElement; + break; + + //Images + case "OpenNebula.Image.delete": + dataTable = dataTable_images; + callback = deleteImageElement; + break; + case "OpenNebula.Image.enable": + case "OpenNebula.Image.disable": + case "OpenNebula.Image.persistent": + case "OpenNebula.Image.nonpersistent": + case "OpenNebula.Image.publish": + case "OpenNebula.Image.unpublish": + dataTable = dataTable_images; + callback = function(req){ + OpenNebula.Image.show({data:{id:req.request.data[0]},success: updateImageElement, error: onError}); + }; + break; + } + + $('div#confirm_dialog').dialog("close"); //in case we required it + + //If there is not a datatable set to fetch the elements affected, + //we assume the action was not recognised. + if (dataTable != null){ + + //Which rows of the datatable are checked? + nodes = $('input:checked',dataTable.fnGetNodes()); + + //For each we execute the action + var nodes_id = new Array(); + $.each(nodes, function(){ + //prepare array for notification + nodes_id.push($(this).val()); + //Calling action(id,callback,error_callback) + if (extra_param!=null){ //action with two parameters + data = extra_param; + data.id = $(this).val(); + (eval(action)({data: data, success: callback, error: onError})); + } else { //action with one parameter + (eval(action)({data:{id:$(this).val()},success: callback,error: onError})); + }; + }); + //Notify + if (extra_param!=null) { + notifySubmit(action,nodes_id,extra_param); + } else { + notifySubmit(action,nodes_id); + } + } + return false; + }); +} + +function preloadTables(){ + dataTable_hosts.fnClearTable(); + addElement([ + spinner, + '','','','','','',''],dataTable_hosts); + OpenNebula.Host.list({success: updateHostsView,error: onError}); + + //~ dataTable_clusters.fnClearTable(); + //~ addElement([ + //~ spinner, + //~ '',''],dataTable_clusters); + OpenNebula.Cluster.list({success: updateClustersView,error: onError}); + + dataTable_vNetworks.fnClearTable(); + addElement([ + spinner, + '','','','','','',''],dataTable_vNetworks); + OpenNebula.Network.list({success: updateVNetworksView, error: onError}); + + dataTable_vMachines.fnClearTable(); + addElement([ + spinner, + '','','','','','','',''],dataTable_vMachines); + OpenNebula.VM.list({success: updateVMachinesView, error: onError}); + + if (uid == 0){ + dataTable_users.fnClearTable(); + addElement([ + spinner, + '',''],dataTable_users); + OpenNebula.User.list({success: updateUsersView,error: onError}); + } + + dataTable_images.fnClearTable(); + addElement([ + spinner, + '','','','','','','','',''],dataTable_images); + OpenNebula.Image.list({success: updateImagesView, error: onError}); +} + + + +function setupImageAttributesDialogs(){ + $('div#dialogs').append('
      '); + + $('#image_attributes_dialog').html( + '
      \ +
      \ +
      \ +
      \ +
      \ + \ + \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      '); + + $('#image_attributes_dialog').dialog({ + autoOpen:false, + width:400, + modal:true, + height:270, + resizable:false, + }); + + $('.image_attribute_button').click(function(){ + action = $(this).val(); + desc = ""; + switch (action){ + case "OpenNebula.Image.addattr": + case "OpenNebula.Image.update": + $('#img_attr_value').show(); + $('#img_attr_value').prev().show(); + desc = "Please write the name and value of the attribute. It will be added or updated in all selected images:"; + $('#img_attr_action').val("OpenNebula.Image.addattr"); + break; + case "OpenNebula.Image.rmattr": + $('#img_attr_value').hide(); + $('#img_attr_value').prev().hide(); + desc = "Please type the attribute you want to remove:"; + $('#img_attr_action').val("OpenNebula.Image.rmattr"); + break; + } + + $('#img_attr_action_desc').html(desc); + $('#image_attributes_dialog').dialog('open'); + return false; + }); + + $('#img_attr_name').keyup(function(){ + $(this).val($(this).val().toUpperCase()); + }); + + $('#image_attributes_dialog #img_attr_proceed').click(function(){ + action = $('#img_attr_action').val(); + nodes = $('input:checked',dataTable_images.fnGetNodes()); + name = $('#img_attr_name').val(); + value = $('#img_attr_value').val(); + switch (action) { + case "OpenNebula.Image.addattr": + case "OpenNebula.Image.update": + $.each(nodes,function(){ + OpenNebula.Image.addattr({data: { + id: $(this).val() + , name: name + , value: value + } + , success: 0 + , error: onError + }); + }); + break; + case "OpenNebula.Image.rmattr": + $.each(nodes,function(){ + OpenNebula.Image.rmattr({data: { + id: $(this).val() + , name: name + , value: value + } + , success: 0 + , error: onError + }); + }); + break; + } + $('#image_attributes_dialog').dialog('close'); + return false; + }); + + $('#image_attributes_dialog #img_attr_cancel').click(function(){ + $('#image_attributes_dialog').dialog('close'); + return false; + }); + +} + +//Sets refresh intevals for the tables. +function setupAutoRefresh(){ + interval=120000; //2 minutes + //hosts + setInterval(function(){ + nodes = $('input:checked',dataTable_hosts.fnGetNodes()); + filter = $("#datatable_hosts_filter input").attr("value"); + if (!nodes.length && !filter.length){ + OpenNebula.Host.list({timeout: true, success: updateHostsView,error: onError}); + } + },interval); + + + //clusters + //~ setInterval(function(){ + //~ nodes = $('input:checked',dataTable_clusters.fnGetNodes()); + //~ if (!nodes.length){ + //~ OpenNebula.Cluster.list(updateClustersView,onError); + //~ } + //~ },interval+4000); //so that not all refreshing is done at the same time + + //clusters + setInterval(function(){ + OpenNebula.Cluster.list({timeout: true, success: updateClustersView,error: onError}); + },interval+4000); //so that not all refreshing is done at the same time + + + //Networks + setInterval(function(){ + nodes = $('input:checked',dataTable_vNetworks.fnGetNodes()); + filter = $("#datatable_vnetworks_filter input").attr("value"); + if (!nodes.length && !filter.length){ + OpenNebula.Network.list({timeout: true, success: updateVNetworksView, error: onError}); + } + },interval+8000); //so that not all refreshing is done at the same time + + //VMs + setInterval(function(){ + nodes = $('input:checked',dataTable_vMachines.fnGetNodes()); + filter = $("#datatable_vmachines_filter input").attr("value"); + if (!nodes.length && !filter.length){ + OpenNebula.VM.list({timeout: true, success: updateVMachinesView,error: onError}); + } + },interval+12000); //so that not all refreshing is done at the same time + + + //Users + //do not update if user is not oneadmin + if (uid == 0) { + setInterval(function(){ + nodes = $('input:checked',dataTable_users.fnGetNodes()); + filter = $("#datatable_users_filter input").attr("value"); + if (!nodes.length && !filter.length){ + OpenNebula.User.list({timeout: true, success: updateUsersView, error: onError}); + } + },interval+14000); //so that not all refreshing is done at the same time + } + + //Images + setInterval(function(){ + nodes = $('input:checked',dataTable_images.fnGetNodes()); + filter = $("#datatable_images_filter input").attr("value"); + if (!nodes.length && !filter.length){ + OpenNebula.Image.list({timeout: true, success: updateImagesView, error: onError}); + } + },interval+16000); +} + +/*###################################################################### + * CREATE DIALOGS + * ###################################################################*/ + + /*## HOSTS ## */ + +function createHostDialog(){ + + //We put the template in place + $('#create_host_dialog').html(create_host_tmpl); + + //Enable the jquery dialog but we keep it hidden + $create_host_dialog = $('#create_host_dialog').dialog({ + autoOpen: false, + modal: true, + width: 500 + }); + + //$('#create_host_dialog div.radioset').buttonset(); + //not working properly: sometimes selected option comes as undefined + //$('#create_host_button').button(); + + //Listen to the + New Host button and open dialog when clicked + $('.create_host_button').click(function(){ + $create_host_dialog.dialog('open'); + return false; + }); + + //Handle the form submission + $('#create_host_form').submit(function(){ + if (!($('#name',this).val().length)){ + notifyError("Host name missing!"); + return false; + } + host_json = { "host": { "name": $('#name',this).val(), + "tm_mad": $('#tm_mad :selected',this).val(), + "vm_mad": $('#vmm_mad :selected',this).val(), + "im_mad": $('#im_mad :selected',this).val()}} + + //Create the OpenNebula.Host. + //If it's successfull we refresh the list. + OpenNebula.Host.create({data: host_json, success: addHostElement, error: onError}); + $create_host_dialog.dialog('close'); + return false; + }); +} + + /*## CLUSTERS ## */ + +function createClusterDialog(){ + //Insert HTML in place + $('#create_cluster_dialog').html(create_cluster_tmpl); + + //Prepare the JQUERY dialog. Set style options here. + $create_cluster_dialog = $('#create_cluster_dialog').dialog({ + autoOpen: false, + modal: true, + width: 400 + }); + + //$('#create_cluster_button').button(); + + //Listen to a click on the + New Cluster button + $('.create_cluster_button').click(function(){ + $create_cluster_dialog.dialog('open'); + return false; + }); + + //Handle the submission of the form + $('#create_cluster_form').submit(function(){ + name=$('#name',this).val(); + cluster_json = { "cluster" : { "name" : name }}; + //Create the Cluster. + //If it's successfull we refresh the list. + OpenNebula.Cluster.create({ data:cluster_json, + success: function(){ + OpenNebula.Cluster.list(updateClustersView,onError)}, + error: onError}); + $create_cluster_dialog.dialog('close'); + return false; + }); +} + + /*## VNETS ## */ + +function createVNetworkDialog(){ + + //Insert dialog HTML in place + $('#create_vn_dialog').html(create_vn_tmpl); + + //Prepare the jquery-ui dialog. Set style options here. + $create_vn_dialog = $('#create_vn_dialog').dialog({ + autoOpen: false, + modal: true, + width: 475, + height: 500 + }); + + //Make the tabs look nice for the creation mode + $('#vn_tabs').tabs(); + $('div#ranged').hide(); + $('#fixed_check').click(function(){ + $('div#fixed').show(); + $('div#ranged').hide(); + }); + $('#ranged_check').click(function(){ + $('div#fixed').hide(); + $('div#ranged').show(); + }); + //$('#create_vn_button').button(); + + //We listen to the + New Vnet button and open the dialog when clicked + $('.create_vn_button').click(function(){ + $create_vn_dialog.dialog('open'); + return false; + }); + + //When we hit the add lease button... + $('#add_lease').click(function(){ + create_form = $('#create_vn_form_easy'); //this is our scope + + //Fetch the interesting values + lease_ip = $('#leaseip',create_form).val(); + lease_mac = $('#leasemac',create_form).val(); + + //We don't add anything to the list if there is nothing to add + if (lease_ip == null) { + notifyError("Please provide a lease IP"); + return false; + }; + + + lease = ""; //contains the HTML to be included in the select box + if (lease_mac == "") { + lease=''; + } else { + lease=''; + }; + + //We append the HTML into the select box. + $('select#leases').append(lease); + return false; + }); + + $('#remove_lease').click(function(){ + $('select#leases :selected').remove(); + return false; + }); + + //Handle submission of the easy mode + $('#create_vn_form_easy').submit(function(){ + //Fetch values + name = $('#name',this).val(); + if (!name.length){ + notifyError("Virtual Network name missing!"); + return false; + } + bridge = $('#bridge',this).val(); + type = $('input:checked',this).val(); + + //TBD: Name and bridge provided?! + + network_json = null; + if (type == "fixed") { + leases = $('#leases option', this); + leases_obj=[]; + + //for each specified lease we prepare the JSON object + $.each(leases,function(){ + leases_obj.push({"ip": $(this).val() }); + }); + + //and construct the final data for the request + network_json = { + "vnet" : { + "type" : "FIXED", + "leases" : leases_obj, + "bridge" : bridge, + "name" : name }}; + } + else { //type ranged + + network_addr = $('#net_address',this).val(); + network_size = $('#net_size',this).val(); + if (!network_addr.length){ + notifyError("Please provide a network address"); + return false; + }; + + //we form the object for the request + network_json = { + "vnet" : { + "type" : "RANGED", + "bridge" : bridge, + "network_size" : network_size, + "network_address" : network_addr, + "name" : name } + }; + }; + + //Create the VNetwork. + //If it's successfull we refresh the list. + OpenNebula.Network.create({ + data: network_json, + success: addVNetworkElement, + error: onError}); + $create_vn_dialog.dialog('close'); + return false; + }); + + $('#create_vn_form_manual').submit(function(){ + template=$('#template',this).val(); + vnet_json = {vnet: {vnet_raw: template}}; + OpenNebula.Network.create({data: vnet_json, success: addVNetworkElement,error: onError}); + $create_vn_dialog.dialog('close'); + return false; + }); + +} + + /*## VMACHINES ## */ + +function createVMachineDialog(){ + + /* #### createVMachineDialog() helper functions #### */ + + vmTabChange = function(event,ui){ + // ui.tab // anchor element of the selected (clicked) tab + // ui.panel // element, that contains the selected/clicked tab contents + // ui.index // zero-based index of the selected (clicked) tab + switch(ui.index){ + case 0: + enable_kvm(); + break; + case 1: + enable_xen(); + break; + case 2: + break; + case 3: + break; + } + } + + update_dynamic_css = function(){ + //This function used to be useful to add specific + //css to elements that changed. + //Now its not needed anymore apparently + /* + if (templ_type=="kvm"){ + $(xen_man_items).css({"font-weight":"normal"}); + $(kvm_man_items).css({"background":"green","font-weight":"bold"}); + $(kvm_opt_items).css({"background":"yellow"}); + } else if (templ_type=="xen"){ + $(kvm_man_items).css({"font-weight":"normal"}); + $(xen_man_items).css({"background":"green","font-weight":"bold"}); + $(xen_opt_items).css({"background":"yellow"}); + };*/ + }; + + enable_kvm = function(){ + man_class="kvm"; + opt_class="kvm_opt"; + $(xen_items).attr("disabled","disabled"); + $(xen_items).css("background",""); + $(kvm_items).removeAttr("disabled"); + //$(items+':disabled').hide(); + + + //particularities + $('div#disks select#TYPE option:selected').removeAttr("selected"); + $('div#disks select#TYPE').prepend( + ''); + $('div#disks select#TYPE option#no_type').attr("selected","selected"); + + $('select#boot_method option').removeAttr("selected"); + $('select#boot_method option#no_boot').html("Driver default"); + $('select#boot_method option').removeAttr("selected"); + $('.kernel, .bootloader', $('div#os_boot_opts')).hide(); + + $('input#TYPE', section_raw).val("kvm"); + + $(section_inputs).show(); + + update_dynamic_css(); + }; + + enable_xen = function(){ + man_class="xen"; + opt_class="xen_opt"; + $(kvm_items).attr("disabled","disabled"); + $(kvm_items).css("background",""); + $(xen_items).removeAttr("disabled"); + //$(items+':disabled').hide(); + + + //particularities + $('div#disks select#TYPE option#no_type').remove(); + + $('select#boot_method option:selected').removeAttr("selected"); + $('select#boot_method option#no_boot').html("Please choose"); + $('.kernel, .bootloader', $('div#os_boot_opts')).hide(); + + + $('input#TYPE', section_raw).val("kvm"); + $(section_inputs).hide(); //not present for xen + update_dynamic_css(); + }; + + mandatory_filter = function(context){ + man_items = ""; + if (templ_type == "kvm") + { man_items = ".kvm"; } + else if (templ_type == "xen") + { man_items = ".xen"; } + else {return false;}; + + //find enabled mandatory items in this context + man_items = $(man_items+' input:visible',context); + r = true; + $.each(man_items,function(){ + if ($(this).parents(".vm_param").attr("disabled") || + !($(this).val().length)) { + r = false; + return false; + }; + }); + return r; + + }; + + box_add_element = function(context,box_tag,filter){ + value=""; + params= $('.vm_param',context); + inputs= $('input:enabled',params); + selects = $('select:enabled',params); + fields = $.merge(inputs,selects); + + //are fields correctly set? + result = filter(); + if (!result) { + notifyError("There are mandatory parameters missing in this section"); + return false; + } + + value={}; + $.each(fields,function(){ + if (!($(this).parents(".vm_param").attr("disabled")) && + $(this).val().length){ + id = $(this).attr('id').length ? $(this).attr('id') : $(this).parent().attr('id'); + value[id] = $(this).val(); + } + }); + string = JSON.stringify(value); + option= ''; + $('select'+box_tag,context).append(option); + return false; + }; + + box_remove_element = function(section_tag,box_tag){ + context = $(section_tag); + $('select'+box_tag+' :selected',context).remove(); + return false; + }; + + addSectionJSON = function(template_json,context){ + params= $('.vm_param',context); + inputs= $('input:enabled',params); + selects = $('select:enabled',params); + fields = $.merge(inputs,selects); + + fields.each(function(){ + if (!($(this).parents(".vm_param").attr("disabled"))){ //if ! disabled + if ($(this).val().length){ //if has a length + template_json[$(this).attr('id')]=$(this).val(); + } + } + }); + } + + addBoxJSON = function(array,context,box_tag){ + $('select'+box_tag+' option',context).each(function(){ + array.push( JSON.parse($(this).val()) ); + }); + } + + removeEmptyObjects = function(obj){ + for (elem in obj){ + remove = false; + value = obj[elem]; + if (value instanceof Array) + { + if (value.length == 0) + remove = true; + } + else if (value instanceof Object) + { + var obj_length = 0; + for (e in value) + obj_length += 1; + if (obj_length == 0) + remove = true; + } + else + { + value = String(value); + if (value.length == 0) + remove = true; + } + if (remove) + delete obj[elem]; + } + return obj; + } + + iconToggle = function(){ + $('.icon_right').toggle( + function(e){ + $('span',e.currentTarget).removeClass("ui-icon-plusthick"); + $('span',e.currentTarget).addClass("ui-icon-minusthick"); + },function(e){ + $('span',e.currentTarget).removeClass("ui-icon-minusthick"); + $('span',e.currentTarget).addClass("ui-icon-plusthick"); + }); + } + + capacity_setup = function(){ + + //$('fieldset',section_capacity).hide(); + + //~ $('#add_capacity',section_capacity).click(function(){ + //~ $('fieldset',section_capacity).toggle(); + //~ return false; + //~ }); + + } + + os_boot_setup = function(){ + $('fieldset',section_os_boot).hide(); + $('.bootloader, .kernel',section_os_boot).hide(); + + $('#add_os_boot_opts',section_os_boot).click(function(){ + $('fieldset',section_os_boot).toggle(); + return false; + }); + + + //Chrome workaround + $('#boot_method').change(function(){ + $(this).trigger("click"); + }); + + $('#boot_method',section_os_boot).click(function(){ + select = $(this).val(); + switch (select) + { + case "kernel": + $('.bootloader',section_os_boot).hide(); + $('.bootloader',section_os_boot).attr("disabled","disabled"); + $('.kernel',section_os_boot).show(); + $('.kernel',section_os_boot).removeAttr("disabled"); + break; + case "bootloader": + $('.kernel',section_os_boot).hide(); + $('.kernel',section_os_boot).attr("disabled","disabled"); + $('.bootloader',section_os_boot).show(); + $('.bootloader',section_os_boot).removeAttr("disabled"); + break; + default: + $('.kernel, .bootloader',section_os_boot).hide(); + $('.kernel, .bootloader',section_os_boot).attr("disabled","disabled"); + $('.kernel input, .bootloader input',section_os_boot).val(""); + }; + }); + }; + + disks_setup = function(){ + + $('fieldset',section_disks).hide(); + $('.vm_param', section_disks).hide(); + //$('#image_vs_disk',section_disks).show(); + + $('#add_disks', section_disks).click(function(){ + $('fieldset',section_disks).toggle(); + return false; + }); + + $('#image_vs_disk input',section_disks).click(function(){ + //$('fieldset',section_disks).show(); + $('.vm_param', section_disks).show(); + select = $('#image_vs_disk :checked',section_disks).val(); + switch (select) + { + case "disk": + $('.add_image',section_disks).hide(); + $('.add_image',section_disks).attr("disabled","disabled"); + $('.add_disk',section_disks).show(); + $('.add_disk',section_disks).removeAttr("disabled"); + $('#TARGET',section_disks).parent().removeClass(opt_class); + $('#TARGET',section_disks).parent().addClass(man_class); + break; + case "image": + $('.add_disk',section_disks).hide(); + $('.add_disk',section_disks).attr("disabled","disabled"); + $('.add_image',section_disks).show(); + $('.add_image',section_disks).removeAttr("disabled"); + $('#TARGET',section_disks).parent().removeClass(man_class); + $('#TARGET',section_disks).parent().addClass(opt_class); + break; + } + $('#SIZE',section_disks).parent().hide(); + $('#SIZE',section_disks).parent().attr("disabled","disabled"); + $('#FORMAT',section_disks).parent().hide(); + $('#SIZE',section_disks).parent().attr("disabled","disabled"); + $('#TYPE :selected',section_disks).removeAttr("selected"); + + update_dynamic_css(); + }); + + + + //activate correct mandatory attributes when + //selecting disk type + + //Chrome workaround + $('select#TYPE',section_disks).change(function(){ + $(this).trigger('click'); + }); + + $('select#TYPE',section_disks).click(function(){ + select = $(this).val(); + switch (select) { + //size,format,target + case "swap": + //size mandatory + $('#SIZE',section_disks).parent().show(); + $('#SIZE',section_disks).parent().removeAttr("disabled"); + $('#SIZE',section_disks).parent().removeClass(opt_class); + $('#SIZE',section_disks).parent().addClass(man_class); + + //target optional + $('#TARGET',section_disks).parent().removeClass(man_class); + $('#TARGET',section_disks).parent().addClass(opt_class); + + //format hidden + $('#FORMAT',section_disks).parent().hide(); + $('#FORMAT',section_disks).parent().attr("disabled","disabled"); + break; + case "fs": + //size mandatory + $('#SIZE',section_disks).parent().show(); + $('#SIZE',section_disks).parent().removeAttr("disabled"); + $('#SIZE',section_disks).parent().removeClass(opt_class); + $('#SIZE',section_disks).parent().addClass(man_class); + + //target mandatory + $('#TARGET',section_disks).parent().removeClass(opt_class); + $('#TARGET',section_disks).parent().addClass(man_class); + + //format mandatory + $('#FORMAT',section_disks).parent().show(); + $('#FORMAT',section_disks).parent().removeAttr("disabled"); + $('#FORMAT',section_disks).parent().removeClass(opt_class); + $('#FORMAT',section_disks).parent().addClass(man_class); + + break; + case "block": + //size shown and optional + $('#SIZE',section_disks).parent().show(); + $('#SIZE',section_disks).parent().removeAttr("disabled"); + $('#SIZE',section_disks).parent().removeClass(man_class); + $('#SIZE',section_disks).parent().addClass(opt_class); + + //target mandatory + $('#TARGET',section_disks).parent().removeClass(opt_class); + $('#TARGET',section_disks).parent().addClass(man_class); + + //format hidden + $('#FORMAT',section_disks).parent().hide(); + $('#FORMAT',section_disks).parent().attr("disabled","disabled"); + break; + case "floppy": + case "disk": + case "cdrom": + //size hidden + $('#SIZE',section_disks).parent().hide(); + $('#SIZE',section_disks).parent().attr("disabled","disabled"); + + //target mandatory + $('#TARGET',section_disks).parent().removeClass(opt_class); + $('#TARGET',section_disks).parent().addClass(man_class); + + //format optional + $('#FORMAT',section_disks).parent().hide(); + $('#FORMAT',section_disks).parent().attr("disabled","disabled"); + + } + update_dynamic_css(); + }); + + diskFilter = function(){ + return mandatory_filter(section_disks); + }; + + $('#add_disk_button',section_disks).click(function(){ + box_add_element(section_disks,'#disks_box',diskFilter); + return false; + }); + $('#remove_disk_button',section_disks).click(function(){ + box_remove_element(section_disks,'#disks_box'); + return false; + }); + }; + + networks_setup = function(){ + + $('.vm_param',section_networks).hide(); + $('fieldset',section_networks).hide(); + + $('#add_networks',section_networks).click(function(){ + $('fieldset',section_networks).toggle(); + return false; + }); + + $('#network_vs_niccfg input',section_networks).click(function(){ + + select = $('#network_vs_niccfg :checked',section_networks).val(); + switch (select) { + case "network": + $('.niccfg',section_networks).hide(); + $('.niccfg',section_networks).attr("disabled","disabled"); + $('.network',section_networks).show(); + $('.network',section_networks).removeAttr("disabled"); + break; + case "niccfg": + $('.network',section_networks).hide(); + $('.network',section_networks).attr("disabled","disabled"); + $('.niccfg',section_networks).show(); + $('.niccfg',section_networks).removeAttr("disabled"); + break; + } + }); + + nicFilter = function(){ + network = $('select#network :selected',section_networks).attr('id'); + ip = $('#IP',section_networks).val(); + mac = $('#MAC',section_networks).val(); + + return (network != "no_network" || ip.length || mac.length); + }; + + $('#add_nic_button',section_networks).click(function(){ + box_add_element(section_networks,'#nics_box',nicFilter); + return false; + }); + $('#remove_nic_button',section_networks).click(function(){ + box_remove_element(section_networks,'#nics_box'); + return false; + }); + + }; + + inputs_setup = function() { + $('fieldset',section_inputs).hide(); + + $('#add_inputs',section_inputs).click(function(){ + $('fieldset',section_inputs).toggle(); + return false; + }); + + $('#add_input_button',section_inputs).click(function(){ + //no filter + box_add_element(section_inputs,'#inputs_box',function(){return true;}); + return false; + }); + $('#remove_input_button',section_inputs).click(function(){ + box_remove_element(section_inputs,'#inputs_box'); + return false; + }); + }; + + graphics_setup = function(){ + $('fieldset',section_graphics).hide(); + $('.vm_param',section_graphics).hide(); + $('select#TYPE',section_graphics).parent().show(); + + $('#add_graphics',section_graphics).click(function(){ + $('fieldset',section_graphics).toggle(); + return false; + }); + + //Chrome workaround + $('select#TYPE',section_graphics).change(function(){ + $(this).trigger("click"); + }); + $('select#TYPE',section_graphics).click(function(){ + g_type = $(this).val(); + switch (g_type) { + case "vnc": + $('#LISTEN',section_graphics).parent().show(); + $('#PORT',section_graphics).parent().show(); + $('#PASSWD',section_graphics).parent().show(); + $('#KEYMAP',section_graphics).parent().show(); + $('#PORT',section_graphics).parent().removeAttr("disabled"); + $('#PASSWD',section_graphics).parent().removeAttr("disabled"); + $('#KEYMAP',section_graphics).parent().removeAttr("disabled"); + break; + case "sdl": + $('#LISTEN',section_graphics).parent().show(); + $('#PORT',section_graphics).parent().hide(); + $('#PASSWD',section_graphics).parent().hide(); + $('#KEYMAP',section_graphics).parent().hide(); + $('#PORT',section_graphics).parent().attr("disabled","disabled"); + $('#PASSWD',section_graphics).parent().attr("disabled","disabled"); + $('#KEYMAP',section_graphics).parent().attr("disabled","disabled"); + break; + default: + $('#LISTEN',section_graphics).parent().hide(); + $('#PORT',section_graphics).parent().hide(); + $('#PASSWD',section_graphics).parent().hide(); + $('#KEYMAP',section_graphics).parent().hide(); + + } + }); + + } + + context_setup = function(){ + $('fieldset',section_context).hide(); + + $('#add_context',section_context).click(function(){ + $('fieldset',section_context).toggle(); + return false; + }); + + }; + + placement_setup = function(){ + $('fieldset',section_placement).hide(); + + $('#add_placement',section_placement).click(function(){ + $('fieldset',section_placement).toggle(); + return false; + }); + + }; + + raw_setup = function(){ + $('fieldset',section_raw).hide(); + + $('#add_raw',section_raw).click(function(){ + $('fieldset',section_raw).toggle(); + return false; + }); + }; + + /* #### createVMachineDialog() main body #### */ + + //Insert HTML in place + $('#create_vm_dialog').html(create_vm_tmpl); + $('#vm_create_tabs').tabs({ + select:vmTabChange + }); + + //Prepare jquery dialog + var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window + $create_vm_dialog = $('#create_vm_dialog').dialog({ + autoOpen: false, + modal: true, + width: 700, + height: height + }); + + //Listen to the + New VM button and open dialog + $('.create_vm_button').click(function(){ + $create_vm_dialog.dialog('open'); + return false; + }); + + iconToggle(); //toogle +/- buttons + + //Sections, used to stay within their scope + section_capacity = $('#capacity'); + section_os_boot = $('#os_boot_opts'); + section_disks = $('#disks'); + section_networks = $('#networks'); + section_inputs = $('#inputs'); + section_graphics = $('#graphics'); + section_context = $('#context'); + section_placement = $('#placement'); + section_raw = $('#raw'); + + //Different selector for items of kvm and xen (mandatory and optional) + items = '.vm_section input,.vm_section select'; + kvm_man_items = '.kvm input,.kvm select'; + kvm_opt_items = '.kvm_opt input, .kvm_opt select'; + kvm_items = kvm_man_items +','+kvm_opt_items; + xen_man_items = '.xen input,.xen select'; + xen_opt_items = '.xen_opt input, .xen_opt select'; + xen_items = xen_man_items +','+ xen_opt_items; + + //Starting template type, optional items class and mandatory items class + templ_type = "kvm"; + opt_class=".kvm_opt"; + man_class=".kvm"; + + $('#template_type #kvm').attr("checked","checked"); //check KVM + enable_kvm(); //enable all kvm options + + //handle change between templates. + $("#template_type input").click(function(){ + templ_type = $("#template_type :checked").val(); + switch (templ_type) + { + case "kvm": + enable_kvm(); + break; + case "xen": + enable_xen(); + break; + } + }); + + $('#fold_unfold_vm_params').toggle( + function(){ + $('.vm_section fieldset').show(); + return false; + }, + function(){ + $('.vm_section fieldset').hide(); + $('.vm_section fieldset').first().show(); + return false; + }); + + capacity_setup(); + os_boot_setup(); + disks_setup(); + networks_setup(); + inputs_setup(); + graphics_setup(); + context_setup(); + placement_setup(); + raw_setup(); + + $('button#create_vm_form_easy').click(function(){ + //validate form + + vm_json = {}; + + //process capacity options + scope = section_capacity; + + if (!mandatory_filter(scope)){ + notifyError("There are mandatory fields missing in the capacity section"); + return false; + }; + addSectionJSON(vm_json,scope); + + //process os_boot_opts + scope= section_os_boot; + switch (templ_type){ + case "xen": + boot_method = $('#boot_method option:selected',scope).val(); + if (!boot_method.length){ + notifyError("Xen templates must specify a boot method"); + return false;} + }; + + if (!mandatory_filter(scope)){ + notifyError("There are mandatory fields missing in the OS Boot options section"); + return false; + }; + addSectionJSON(vm_json,scope); + + //process disks + scope = section_disks; + vm_json["DISK"] = []; + addBoxJSON(vm_json["DISK"],scope,'#disks_box'); + + //process nics -> fetch from box + scope = section_networks; + vm_json["NIC"] = []; + addBoxJSON(vm_json["NIC"],scope,'#nics_box'); + + //process inputs -> fetch from box + scope = section_inputs; + vm_json["INPUT"] = []; + addBoxJSON(vm_json["INPUT"],scope,'#inputs_box'); + + //process graphics -> fetch fields with value + scope = section_graphics; + vm_json["GRAPHICS"] = {}; + addSectionJSON(vm_json["GRAPHICS"],scope); + + //context -> include + scope = section_context; + var context = $('#CONTEXT',scope).val(); + if (context) + vm_json["CONTEXT"] = context; + + //placement -> fetch with value + scope = section_placement; + addSectionJSON(vm_json,scope); + + //raw -> if value set type to driver and fetch + scope = section_raw; + vm_json["RAW"] = {}; + addSectionJSON(vm_json["RAW"],scope); + + // remove empty elements + vm_json = removeEmptyObjects(vm_json); + + //wrap it in the "vm" object + vm_json = {vm: vm_json} + OpenNebula.VM.create({data: vm_json, + success: addVMachineElement, + error: onError}); + + $create_vm_dialog.dialog('close'); + return false; + }); + + $('button#create_vm_form_manual').click(function(){ + template = $('#vm_template').val(); + + //wrap it in the "vm" object + template = {vm: {vm_raw: template}}; + + OpenNebula.VM.create({data: template, + success: addVMachineElement, + error: onError}); + $create_vm_dialog.dialog('close'); + return false; + }); + + $('button#reset').click(function(){ + $('select#disks_box option',section_disks).remove(); + $('select#nics_box option',section_networks).remove(); + $('select#inputs_box option',section_inputs).remove(); + return true; + }); + + } + + /*## USERS ## */ + +function createUserDialog(){ + + //Insert HTML in place + $('#create_user_dialog').html(create_user_tmpl); + + //Prepare jquery dialog + $create_user_dialog = $('#create_user_dialog').dialog({ + autoOpen: false, + modal:true, + width: 400 + }); + + //$('#create_user_button').button(); + + //Listen to the + New User button and open dialog + $('.create_user_button').click(function(){ + $create_user_dialog.dialog('open'); + return false; + }); + + //Handle form submission + $('#create_user_form').submit(function(){ + user_name=$('#username',this).val(); + user_password=$('#pass',this).val(); + user_json = { "user" : + { "name" : user_name, + "password" : user_password } + }; + OpenNebula.User.create({data: user_json, + success: addUserElement, + error: onError}); + $create_user_dialog.dialog('close'); + return false; + }); +} + +function createImageDialog(){ + //Insert HTML in place + $('#create_image_dialog').html(create_image_tmpl); + + //Prepare jquery dialog + $create_image_dialog = $('#create_image_dialog').dialog({ + autoOpen: false, + modal:true, + width: 520 + }); + + //Listen to the Register image button and open dialog + $('.create_image_button').click(function(){ + $create_image_dialog.dialog('open'); + return false; + }); + + //Effects + $('#img_tabs').tabs(); + $('#img_type option').first().attr("selected","selected"); + $('#datablock_img').attr("disabled","disabled"); + + //Chrome workaround + $('select#img_type').change(function(){ + $(this).trigger("click"); + }); + + $('select#img_type').click(function(){ + value = $(this).val(); + switch (value){ + case "DATABLOCK": + $('#datablock_img').removeAttr("disabled"); + break; + default: + $('#datablock_img').attr("disabled","disabled"); + $('#path_img').attr("checked","checked"); + $('#img_source,#img_fstype,#img_size').parent().hide(); + $('#img_path').parent().show(); + } + }); + + $('#img_source,#img_fstype,#img_size').parent().hide(); + $('#path_img').attr("checked","checked"); + $('#img_path').parent().addClass("img_man"); + + $('#img_public').click(function(){ + $('#img_persistent').removeAttr("checked"); + }); + + $('#img_persistent').click(function(){ + $('#img_public').removeAttr("checked"); + }); + + + + $('#src_path_select input').click(function(){ + value = $(this).val(); + switch (value){ + case "path": + $('#img_source,#img_fstype,#img_size').parent().hide(); + $('#img_source,#img_fstype,#img_size').parent().removeClass("img_man"); + $('#img_path').parent().show(); + $('#img_path').parent().addClass("img_man"); + break; + case "source": + $('#img_path,#img_fstype,#img_size').parent().hide(); + $('#img_path,#img_fstype,#img_size').parent().removeClass("img_man"); + $('#img_source').parent().show(); + $('#img_source').parent().addClass("img_man"); + break; + case "datablock": + $('#img_source,#img_path').parent().hide(); + $('#img_source,#img_path').parent().removeClass("img_man"); + $('#img_fstype,#img_size').parent().show(); + $('#img_fstype,#img_size').parent().addClass("img_man"); + break; + } + }); + + + $('#create_image_form_easy').submit(function(){ + exit = false; + $('.img_man',this).each(function(){ + if (!$('input',this).val().length){ + notifyError("There are mandatory missing parameters"); + exit = true; + return false; + } + }); + if (exit) { return false; } + img_json = {}; + + name = $('#img_name').val(); + img_json["NAME"] = name; + + desc = $('#img_desc').val(); + if (desc.length){ + img_json["DESCRIPTION"] = desc; + } + + type = $('#img_type').val(); + img_json["TYPE"]= type; + + img_json["PUBLIC"] = $('#img_public:checked').length ? "YES" : "NO"; + + img_json["PERSISTENT"] = $('#img_persistent:checked').length ? "YES" : "NO"; + + dev_prefix = $('#img_dev_prefix').val(); + if (dev_prefix.length){ + img_json["DEV_PREFIX"] = dev_prefix; + } + + bus = $('#img_bus').val(); + img_json["BUS"] = bus; + + switch ($('#src_path_select input:checked').val()){ + case "path": + path = $('#img_path').val(); + img_json["PATH"] = path; + break; + case "source": + source = $('#img_source').val(); + img_json["SOURCE"] = source; + break; + case "datablock": + size = $('#img_size').val(); + fstype = $('#img_fstype').val(); + img_json["SIZE"] = size; + img_json["FSTYPE"] = fstype; + break; + } + obj = { "image" : img_json }; + OpenNebula.Image.create({data: obj,success: addImageElement,error: onError}); + + $create_image_dialog.dialog('close'); + return false; + }); + + $('#create_image_form_manual').submit(function(){ + template=$('#template',this).val(); + OpenNebula.Image.create({data: template,success: addImageElement,error: onError}); + $create_image_dialog.dialog('close'); + return false; + }); + + +} + +/*###################################################################### + * UTIL FUNCTIONS + * ###################################################################*/ + +//Notifications +function notifySubmit(action, args, extra_param){ + var action_text = action.replace(/OpenNebula\./,'').replace(/\./,' '); + + var msg = "

      Submitted

      "; + msg += action_text + ": " + args; + if (extra_param != null) + msg += " >> " + extra_param; + + $.jGrowl(msg, {theme: "jGrowl-notify-submit"}); +} + +function notifyError(msg){ + msg = "

      Error

      " + msg; + + $.jGrowl(msg, {theme: "jGrowl-notify-error", sticky: true }); +} + +// Returns an HTML string with the json keys and values in the form +// key: value
      +// It recursively explores objects, and flattens their contents in +// the result. +function prettyPrintJSON(template_json){ + str = "" + for (field in template_json) { + if (typeof template_json[field] == 'object'){ + str += prettyPrintJSON(template_json[field]) + ''; + } else { + str += ''+field+''+template_json[field]+''; + }; + }; + return str; +} + +//Replaces all class"tip" divs with an information icon that +//displays the tip information on mouseover. +function setupTips(){ + $('div.tip').each(function(){ + tip = $(this).html(); + $(this).html(''); + $(this).append(''); + + $(this).append(''); + + + $('span.tipspan',this).html(tip); + $(this).parent().append('
      '); + $('span.tipspan',this).hide(); + $('span.info_icon',this).hover(function(e){ + var top, left; + top = e.pageY - 15;// - $(this).parents('#create_vm_dialog').offset().top - 15; + left = e.pageX + 15;// - $(this).parents('#create_vm_dialog').offset().left; + $(this).next().css( + {"top":top+"px", + "left":left+"px"}); + $(this).next().fadeIn(); + },function(){ + $(this).next().fadeOut(); + }); + }); +} + +//Returns the username of a user providing the uid. +//Crawls the user dataTable for that. If such user is not found, +//we return the uid. +function getUserName(uid){ + nodes = dataTable_users.fnGetData(); + user = "uid "+uid; + $.each(nodes,function(){ + if (uid == this[1]) { + user = this[2]; + return false; + } + }); + return user; + +} + +// Returns an string in the form key=value key=value ... +// Does not explore objects in depth. +function stringJSON(json){ + str = "" + for (field in json) { + str+= field + '=' + json[field] + ' '; + } + return str; +} + +// Returns the running time data +function str_start_time(vm){ + return pretty_time(vm.STIME); +} + +// Updates a data_table, with a 2D array containing +// Does a partial redraw, so the filter and pagination are kept +function updateView(item_list,data_table){ + if (data_table!=null) { + data_table.fnClearTable(); + data_table.fnAddData(item_list); + data_table.fnDraw(false); + }; +} + +function updateSingleElement(element,data_table,tag){ + tr = $(tag).parents('tr')[0]; + position = data_table.fnGetPosition(tr); + data_table.fnUpdate(element,position,0); +} + +function tableCheckboxesListener(dataTable){ + context = dataTable.parents('form'); + last_action_b = $('.last_action_button',context); + $('.top_button, .list_button',context).button("disable"); + if (last_action_b.length && last_action_b.val().length){ + last_action_b.button("disable"); + }; + $('.new_button',context).button("enable"); + + //listen to changes + $('input',dataTable).click(function(){ + dataTable = $(this).parents('table').dataTable(); + context = dataTable.parents('form'); + last_action_b = $('.last_action_button',context); + nodes_length = $('input:checked',dataTable.fnGetNodes()).length; + + if (nodes_length){ + $('.top_button, .list_button',context).button("enable"); + if (last_action_b.length && last_action_b.val().length){ + last_action_b.button("enable"); + }; + $('.new_button',context).button("enable"); + } else { + $('.top_button, .list_button',context).button("disable"); + last_action_b.button("disable"); + $('.new_button',context).button("enable"); + } + }); + +} + +function deleteElement(data_table,tag){ + tr = $(tag).parents('tr')[0]; + data_table.fnDeleteRow(tr); +} + +function addElement(element,data_table){ + data_table.fnAddData(element); +} + +function hostElementArray(host_json){ + host = host_json.HOST; + acpu = parseInt(host.HOST_SHARE.MAX_CPU); + if (!acpu) {acpu=100}; + acpu = acpu - parseInt(host.HOST_SHARE.CPU_USAGE); + + + total_mem = parseInt(host.HOST_SHARE.MAX_MEM); + free_mem = parseInt(host.HOST_SHARE.FREE_MEM); + ratio_mem = Math.round(((total_mem - free_mem) / total_mem) * 100); + + + total_cpu = parseInt(host.HOST_SHARE.MAX_CPU); + used_cpu = Math.max(total_cpu - parseInt(host.HOST_SHARE.USED_CPU),acpu); + + ratio_cpu = Math.round(((total_cpu - used_cpu) / total_cpu) * 100); + + + + pb_mem = +'
      \ +
      \ + '+ratio_mem+'%\ +
      \ +
      '; + + pb_cpu = +'
      \ +
      \ + '+ratio_cpu+'%\ +
      \ +
      '; + + + return [ '', + host.ID, + host.NAME, + host.CLUSTER, + host.HOST_SHARE.RUNNING_VMS, //rvm + pb_cpu, + pb_mem, + OpenNebula.Helper.resource_state("host",host.STATE) ]; + + + //~ return [ '', + //~ host.ID, + //~ host.NAME, + //~ host.CLUSTER, + //~ host.HOST_SHARE.RUNNING_VMS, //rvm + //~ host.HOST_SHARE.MAX_CPU, //tcpu + //~ parseInt(host.HOST_SHARE.MAX_CPU) - parseInt(host.HOST_SHARE.USED_CPU), //fcpu + //~ acpu, + //~ humanize_size(host.HOST_SHARE.MAX_MEM), + //~ humanize_size(host.HOST_SHARE.FREE_MEM), + //~ OpenNebula.Helper.resource_state("host",host.STATE) ]; +} + +//Adds a listener to show the extended info when clicking on a row +function hostInfoListener(){ + $('#tbodyhosts tr').click(function(e){ + //do nothing if we are clicking a checkbox! + if ($(e.target).is('input')) {return true;} + + popDialogLoading(); + aData = dataTable_hosts.fnGetData(this); + id = $(aData[0]).val(); + OpenNebula.Host.show({data:{id:id},success: updateHostInfo,error: onError}); + return false; + }); +} + +//~ function clusterElementArray(cluster_json){ + //~ cluster = cluster_json.CLUSTER; + //~ return ['', + //~ cluster.ID, + //~ cluster.NAME + //~ ] +//~ } + +function vMachineElementArray(vm_json){ + vm = vm_json.VM; + return [ + '', + vm.ID, + vm.USERNAME ? vm.USERNAME : getUserName(vm.UID), + vm.NAME, + OpenNebula.Helper.resource_state("vm",vm.STATE), + vm.CPU, + humanize_size(vm.MEMORY), + vm.HISTORY ? vm.HISTORY.HOSTNAME : "--", + str_start_time(vm) + ] +} + +//Adds a listener to show the extended info when clicking on a row +function vMachineInfoListener(){ + $('#tbodyvmachines tr').click(function(e){ + if ($(e.target).is('input')) {return true;} + aData = dataTable_vMachines.fnGetData(this); + id = $(aData[0]).val(); + OpenNebula.VM.show({data: {id:id},success: updateVMInfo,error: onError}); + return false; + }); +} + +function vNetworkElementArray(vn_json){ + network = vn_json.VNET; + if (network.TOTAL_LEASES != undefined){ + total_leases = network.TOTAL_LEASES; + }else if (network.LEASES.LEASE != undefined){ + total_leases = network.LEASES.LEASE.length ? network.LEASES.LEASE.length : "1"; + } else{ + total_leases = "0"; + } + username = network.USERNAME? network.USERNAME : getUserName(network.UID) + return ['', + network.ID, + username, + network.NAME, + parseInt(network.TYPE) ? "FIXED" : "RANGED", + network.BRIDGE, + parseInt(network.PUBLIC) ? "yes" : "no", + total_leases ]; +} +//Adds a listener to show the extended info when clicking on a row +function vNetworkInfoListener(){ + $('#tbodyvnetworks tr').click(function(e){ + if ($(e.target).is('input')) {return true;} + aData = dataTable_vNetworks.fnGetData(this); + id = $(aData[0]).val(); + OpenNebula.Network.show({data:{id: id},success: updateVNetworkInfo,error: onError}); + return false; + }); +} + +function userElementArray(user_json){ + user = user_json.USER; + return [ + '', + user.ID, + user.NAME + ] +} + +function imageElementArray(image_json){ + image = image_json.IMAGE; + return [ + '', + image.ID, + image.USERNAME ? image.USERNAME : getUserName(image.ID), + image.NAME, + OpenNebula.Helper.image_type(image.TYPE), + pretty_time(image.REGTIME), + parseInt(image.PUBLIC) ? "yes" : "no", + parseInt(image.PERSISTENT) ? "yes" : "no", + OpenNebula.Helper.resource_state("image",image.STATE), + image.RUNNING_VMS + ]; +} + +function imageInfoListener(){ + $('#tbodyimages tr').click(function(e){ + if ($(e.target).is('input')) {return true;} + aData = dataTable_images.fnGetData(this); + id = $(aData[0]).val(); + OpenNebula.Image.show({data: {id: id},success: updateImageInfo,error: onError}); + return false; + }); +} + +function updateHostSelect(host_list){ + + //update select helper + hosts_select=""; + hosts_select += ""; + $.each(host_list, function(){ + hosts_select += ""; + }); + + //update static selectors + $('#vm_host').html(hosts_select); +} + +function updateClusterSelect(cluster_list){ + + //update select helper + clusters_select= ""; + clusters_select+=""; + $.each(cluster_list, function(){ + clusters_select += ""; + }); + + //update static selectors + //$('#host_cluster').html(clusters_select); + +} + +function updateNetworkSelect(network_list){ + //update select helper + vnetworks_select=""; + vnetworks_select += ""; + $.each(network_list, function(){ + vnetworks_select += ""; + + }); + + //update static selectors + $('div.vm_section#networks select#NETWORK').html(vnetworks_select); +} + +function updateImageSelect(image_list){ + images_select=""; + images_select += ""; + $.each(image_list, function(){ + images_select += ""; + }); + + //update static selectors + $('div.vm_section#disks select#IMAGE').html(images_select); +} + + +// New layout +//~ function tabSelect(event,ui){ + //~ // ui.tab // anchor element of the selected (clicked) tab + //~ // ui.panel // element, that contains the selected/clicked tab contents + //~ // ui.index // zero-based index of the selected (clicked) tab + //~ switch(ui.index) + //~ { + //~ case 0: + //~ emptyDashboard(); + //~ preloadTables(); + //~ break; + //~ case 1: // Hosts + //~ OpenNebula.Host.list(updateHostsView,onError); + //~ break; + //~ case 2: // Clusters + //~ OpenNebula.Cluster.list(updateClustersView,onError); + //~ break; + //~ case 3: //VMs + //~ OpenNebula.VM.list(updateVMachinesView,onError); + //~ break; + //~ case 4: //VNs + //~ OpenNebula.Network.list(updateVNetworksView,onError); + //~ break; + //~ case 5: //Users + //~ OpenNebula.User.list(updateUsersView,onError); + //~ break; + //~ } +//~ } + +//puts the dashboard values into "retrieving" +function emptyDashboard(){ + $("#dashboard .value_td span").html(spinner); +} + +function updateDashboard(what){ + db = $('#dashboard'); + switch (what){ + case "hosts": + total_hosts=host_list_json.length; + active_hosts=0; + $.each(host_list_json,function(){ + if (parseInt(this.HOST.STATE) < 3){ + active_hosts++;} + }); + $('#total_hosts',db).html(total_hosts); + $('#active_hosts',db).html(active_hosts); + break; + case "clusters": + total_clusters=cluster_list_json.length; + $('#total_clusters',db).html(total_clusters); + break; + case "vms": + total_vms=vmachine_list_json.length; + running_vms=0; + failed_vms=0; + $.each(vmachine_list_json,function(){ + vm_state = parseInt(this.VM.STATE); + if (vm_state == 3){ + running_vms++; + } + else if (vm_state == 7) { + failed_vms++; + } + }); + $('#total_vms',db).html(total_vms); + $('#running_vms',db).html(running_vms); + $('#failed_vms',db).html(failed_vms); + break; + case "vnets": + public_vnets=0; + total_vnets=network_list_json.length; + $.each(network_list_json,function(){ + if (parseInt(this.VNET.PUBLIC)){ + public_vnets++;} + }); + $('#total_vnets',db).html(total_vnets); + $('#public_vnets',db).html(public_vnets); + break; + case "users": + total_users=user_list_json.length; + $('#total_users',db).html(total_users); + break; + case "images": + total_images=image_list_json.length; + public_images=0; + $.each(image_list_json,function(){ + if (parseInt(this.IMAGE.PUBLIC)){ + public_images++;} + }); + $('#total_images',db).html(total_images); + $('#public_images',db).html(public_images); + break; + } +} + +/*###################################################################### + * UPDATE VIEWS - CALLBACKS + * ##################################################################*/ +function onError(request,error_json) { + var method; + var action; + var object; + var id; + var reason; + var m; + var message = error_json.error.message; + + //redirect to login if unauthenticated + if (error_json.error.http_status=="401") { + window.location.href = "/login"; + }; + + //Parse known errors: + var action_error = new RegExp("^\\[(\\w+)\\] Error trying to (\\w+) (\\w+) \\[(\\w+)\\].*Reason: (.*)\.$"); + var get_error = new RegExp("^\\[(\\w+)\\] Error getting (\\w+) \\[(\\w+)\\]\.$"); + var auth_error = /^\[(\w+)\] User \[.\] not authorized to perform (\w+) on (\w+) \[?(\w+)\]?\.?$/; + + if (m = message.match(action_error)) { + method = m[1]; + action = m[2]; + object = m[3]; + id = m[4]; + reason = m[5]; + } else if (m = message.match(get_error)) { + method = m[1]; + action = "SHOW"; + object = m[2]; + id = m[3]; + } else if (m = message.match(auth_error)) { + method = m[1]; + action = m[2]; + object = m[3]; + id = m[4]; + } + + if (m) { + var rows; + var i; + var value; + rows = ["method","action","object","id","reason"]; + message = ""; + for (i in rows){ + key = rows[i]; + value = eval(key); + if (value) + message += ""+key+""+value+""; + } + message = "" + message + "
      "; + } + + notifyError(message); + return true; +} + +/* All the following functions follow a similar function: + * 'update*View' functions clear and fully repopulate the tables. + * 'update*Element' functions find and update a single element with new + * info. + * 'delete*Element' functions find and remove an element from the list. + * 'add*Element' functions add a new element to the list. + * */ + +function updateHostElement(request, host_json){ + id = host_json.HOST.ID; + element = hostElementArray(host_json); + updateSingleElement(element,dataTable_hosts,'#host_'+id) +} + +function deleteHostElement(req){ + deleteElement(dataTable_hosts,'#host_'+req.request.data); +} + +function addHostElement(request,host_json){ + element = hostElementArray(host_json); + addElement(element,dataTable_hosts); + hostInfoListener(); + tableCheckboxesListener(dataTable_hosts); +} + +function updateHostsView (request,host_list){ + host_list_json = host_list; + host_list_array = [] + + $.each(host_list,function(){ + //Grab table data from the host_list + host_list_array.push(hostElementArray(this)); + }); + + updateView(host_list_array,dataTable_hosts); + updateHostSelect(host_list); + updateDashboard("hosts"); + + //We need to re-add this listener as list has been refreshed + hostInfoListener(); + tableCheckboxesListener(dataTable_hosts); +} + + +//~ function updateClusterElement(request, cluster_json){ + //~ id = cluster_json.CLUSTER.ID; + //~ element = clusterElementArray(cluster_json); + //~ updateSingleElement(element,dataTable_clusters,'#cluster_'+id) +//~ } +//~ +//~ function deleteClusterElement(req){ + //~ deleteElement(dataTable_clusters,'#cluster_'+req.request.data); +//~ } +//~ +//~ function addClusterElement(request,cluster_json){ + //~ element = clusterElementArray(cluster_json); + //~ addElement(element,dataTable_clusters); +//~ } + +function updateClustersView(request, cluster_list){ + cluster_list_json = cluster_list; + //~ cluster_list_array = []; + + //~ $.each(cluster_list, function(){ + //~ cluster_list_array.push(clusterElementArray(this)); + //~ }); + //~ updateView(cluster_list_array,dataTable_clusters); + updateClusterSelect(cluster_list); + updateDashboard("clusters"); +} + + +function updateVMachineElement(request, vm_json){ + id = vm_json.VM.ID; + element = vMachineElementArray(vm_json); + updateSingleElement(element,dataTable_vMachines,'#vm_'+id) +} + +function deleteVMachineElement(req){ + deleteElement(dataTable_vMachines,'#vm_'+req.request.data); +} + +function addVMachineElement(request,vm_json){ + notifySubmit('OpenNebula.VM.create',vm_json.VM.ID); + element = vMachineElementArray(vm_json); + addElement(element,dataTable_vMachines); + vMachineInfoListener(); + updateVMInfo(null,vm_json); + tableCheckboxesListener(dataTable_vMachines); +} + +function updateVMachinesView(request, vmachine_list){ + vmachine_list_json = vmachine_list; + vmachine_list_array = []; + + $.each(vmachine_list,function(){ + vmachine_list_array.push( vMachineElementArray(this)); + }); + + updateView(vmachine_list_array,dataTable_vMachines); + vMachineInfoListener(); + tableCheckboxesListener(dataTable_vMachines); + updateDashboard("vms"); +} + + +function updateVNetworkElement(request, vn_json){ + id = vn_json.VNET.ID; + element = vNetworkElementArray(vn_json); + updateSingleElement(element,dataTable_vNetworks,'#vnetwork_'+id); + tableCheckboxesListener(dataTable_vNetworks); +} + +function deleteVNetworkElement(req){ + deleteElement(dataTable_vNetworks,'#vnetwork_'+req.request.data); +} + +function addVNetworkElement(request,vn_json){ + element = vNetworkElementArray(vn_json); + addElement(element,dataTable_vNetworks); + vNetworkInfoListener(); +} + +function updateVNetworksView(request, network_list){ + network_list_json = network_list; + network_list_array = []; + + $.each(network_list,function(){ + network_list_array.push(vNetworkElementArray(this)); + }); + + updateView(network_list_array,dataTable_vNetworks); + updateNetworkSelect(network_list); + vNetworkInfoListener(); + updateDashboard("vnets"); + tableCheckboxesListener(dataTable_vNetworks); + +} + +function updateUserElement(request, user_json){ + id = user_json.USER.ID; + element = userElementArray(user_json); + updateSingleElement(element,dataTable_users,'#user_'+id); + tableCheckboxesListener(dataTable_users); +} + +function deleteUserElement(req){ + deleteElement(dataTable_users,'#user_'+req.request.data); +} + +function addUserElement(request,user_json){ + element = userElementArray(user_json); + addElement(element,dataTable_users); +} + +function updateUsersView(request,users_list){ + user_list_json = users_list; + user_list_array = []; + + $.each(user_list_json,function(){ + user_list_array.push(userElementArray(this)); + }); + updateView(user_list_array,dataTable_users); + updateDashboard("users"); + tableCheckboxesListener(dataTable_users); +} + + +function updateImageElement(request, image_json){ + id = image_json.IMAGE.ID; + element = imageElementArray(image_json); + updateSingleElement(element,dataTable_images,'#image_'+id); + tableCheckboxesListener(dataTable_images); + imageInfoListener(); +} + +function deleteImageElement(req){ + deleteElement(dataTable_images,'#image_'+req.request.data); +} + +function addImageElement(request, image_json){ + element = imageElementArray(image_json); + addElement(element,dataTable_images); +} + +function updateImagesView(request, images_list){ + image_list_json = images_list; + image_list_array = []; + $.each(image_list_json,function(){ + image_list_array.push(imageElementArray(this)); + }); + + updateView(image_list_array,dataTable_images); + updateImageSelect(images_list); + imageInfoListener(); + tableCheckboxesListener(dataTable_images); + updateDashboard("images"); + + +} + + +/*###################################################################### + * UPDATE INFO DIALOGS FUNCTIONS - CALLBACKS + * ###################################################################*/ +//All functions in this section are callbacks for the "show" +//action. They receive the element JSON, format it and add it to the +//shown dialog. + + +function updateHostInfo(request,host){ + host_info = host.HOST + rendered_info = +'
      \ + \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Host information - '+host_info.NAME+'
      ID'+host_info.ID+'
      State'+OpenNebula.Helper.resource_state("host",host_info.STATE)+'
      Cluster'+host_info.CLUSTER+'
      IM MAD'+host_info.IM_MAD+'
      VM MAD'+host_info.VM_MAD+'
      TM MAD'+host_info.TM_MAD+'
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Host shares
      Max Mem'+humanize_size(host_info.HOST_SHARE.MAX_MEM)+'
      Used Mem (real)'+humanize_size(host_info.HOST_SHARE.USED_MEM)+'
      Used Mem (allocated)'+humanize_size(host_info.HOST_SHARE.MAX_USAGE)+'
      Used CPU (real)'+host_info.HOST_SHARE.USED_CPU+'
      Used CPU(allocated)'+host_info.HOST_SHARE.CPU_USAGE+'
      Running VMs'+host_info.HOST_SHARE.RUNNING_VMS+'
      \ +
      \ +
      \ + \ + '+ + prettyPrintJSON(host_info.TEMPLATE)+ + '
      Host template
      \ +
      \ +
      '; + popDialog(rendered_info); + $('#host_informations').tabs(); + + $('.host_info_action_button').button(); + //listen to buttons + $('.host_info_action_button').click(function(){ + id = host_info.ID; + action=$(this).val(); + + switch (action){ + case "OpenNebula.Host.delete": + $('#host_info_dialog').dialog("close"); + (eval(action)({data: {id: id}, + success: deleteHostElement, + error: onError})); + break; + case "OpenNebula.Host.enable": + case "OpenNebula.Host.disable": + (eval(action)({ data:{id:id}, + success: function(){ + updateBoth = function(req,res){ + updateHostElement(req,res); + updateHostInfo(req,res); + }; + OpenNebula.Host.show({data:{id: id},success: updateBoth, error: onError}); + + }, + error: onError})); + } + return false; + }); + + +} + +// Used as an event method to the VM info tabs. +function fetch_log(event, ui) { + if (ui.index == 2) //tab + { + var vm_id = $("#vm_log pre").attr('id').substr(10); + OpenNebula.VM.log({ data: {id: vm_id}, + success: function(req, res){ + log_lines = res.split("\n"); + var colored_log = ''; + for (line in log_lines){ + line = log_lines[line]; + if (line.match(/\[E\]/)){ + line = ''+line+'' + } + colored_log += line + "\n"; + } + $("#vm_log pre").html(colored_log); + }, + error: function(request,error_json){ + $("#vm_log pre").html(''); + onError(request,error_json); + } + }); + } +} + +function updateVMInfo(request,vm){ + vm_info = vm.VM; + id = vm_info.ID; + rendered_info = +'
      \ + \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Virtual Machine information - '+vm_info.NAME+'
      ID'+vm_info.ID+'
      Name'+vm_info.NAME+'
      State'+OpenNebula.Helper.resource_state("vm",vm_info.STATE)+'
      LCM State'+OpenNebula.Helper.resource_state("vm",vm_info.LCMSTATE)+'
      Start time'+pretty_time(vm_info.STIME)+'
      Deploy ID'+(vm_info.DEPLOY_ID ? vm_info.DEPLOY_ID : "-")+'
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Monitoring information
      Net_TX'+vm_info.NET_TX+'
      Net_RX'+vm_info.NET_RX+'
      Used Memory'+humanize_size(vm_info.MEMORY)+'
      Used CPU'+vm_info.CPU+'
      \ +
      \ +
      \ + \ + '+ + prettyPrintJSON(vm_info.TEMPLATE)+ + '
      VM template
      \ +
      \ +

      Virtual Machine Log - '+vm_info.NAME+'

      \ +
      '+spinner+'
      \ +
      \ +
      '; + + $('#vm_info_error',rendered_info).hide(); + popDialog(rendered_info); + $('#vm_informations').tabs({select: fetch_log}); + + /* Not used + $('#vm_info_simple_action').button(); + + + $('#vm_info_simple_action').click(function(){ + action = $('#vm_info_opt_actions').val(); + if (!action.length) { return false; }; + (eval(action)(id, + function(){OpenNebula.VM.show(id,updateVMInfo,onError)}, + function(request,error_json){ + $('#vm_info_error').html( + 'The request failed with the following error: '+ + error_json.error.message + + '. Resource: '+ request.request.resource + + '. Method: '+ request.request.method + '.'); + $('#vm_info_error').addClass("ui-state-error"); + $('#vm_info_error').show(); + + })); + });*/ +} + +function updateVNetworkInfo(request,vn){ + vn_info = vn.VNET; + rendered_info = +'
      \ + \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Virtual Network '+vn_info.ID+' information
      ID'+vn_info.ID+'
      UID'+vn_info.UID+'
      Public'+(parseInt(vn_info.PUBLIC) ? "yes" : "no" )+'
      \ + \ + \ + \ + '+ + prettyPrintJSON(vn_info.LEASES)+ + '
      Leases information
      \ +
      \ +
      \ + \ + '+ + prettyPrintJSON(vn_info.TEMPLATE)+ + '
      Virtual Network template
      \ +
      \ +
      '; + + popDialog(rendered_info); + $('#vn_informations').tabs(); +} + +function updateImageInfo(request,img){ + img_info = img.IMAGE; + rendered_info = +'
      \ + \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Image "'+img_info.NAME+'" information
      ID'+img_info.ID+'
      Name'+img_info.NAME+'
      Type'+OpenNebula.Helper.image_type(img_info.TYPE)+'
      Register time'+pretty_time(img_info.REGTIME)+'
      Public'+(img_info.PUBLIC ? "yes" : "no")+'
      Persistent'+(img_info.PERSISTENT ? "yes" : "no")+'
      Source'+img_info.SOURCE+'
      State'+img_info.STATE+'
      \ +
      \ +
      \ + \ + '+ + prettyPrintJSON(img_info.TEMPLATE)+ + '
      Image template
      \ +
      \ +
      '; + popDialog(rendered_info); + $('#image_informations').tabs(); +} + +// Auxiliary functions +function pad(number,length) { + var str = '' + number; + while (str.length < length) + str = '0' + str; + return str; +} + +function pretty_time(time_seconds) +{ + var d = new Date(); + d.setTime(time_seconds*1000); + + var secs = pad(d.getSeconds(),2); + var hour = pad(d.getHours(),2); + var mins = pad(d.getMinutes(),2); + var day = pad(d.getDate(),2); + var month = pad(d.getMonth(),2); + var year = d.getFullYear(); + + return hour + ":" + mins +":" + secs + " " + month + "/" + day + "/" + year; +} + +function humanize_size(value) { + if (typeof(value) === "undefined") { + value = 0; + } + var binarySufix = ["K", "M", "G", "T" ]; + var i=0; + while (value > 1024 && i < 3){ + value = value / 1024; + i++; + } + value = Math.round(value * 10) / 10; + + if (value - Math.round(value) == 0) { + value = Math.round(value); + } + + var st = value + binarySufix[i]; + return st; +} diff --git a/src/sunstone/public/js/one-ui_views.templates.js b/src/sunstone/public/js/one-ui_views.templates.js new file mode 100644 index 0000000000..67dbaa50b6 --- /dev/null +++ b/src/sunstone/public/js/one-ui_views.templates.js @@ -0,0 +1,1096 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +var dashboard_tmpl = +'\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      \ +
      \ +

      Hosts\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Total
      Active
      \ +
      \ +
      \ +
      \ +
      \ +

      Clusters\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ +
      Total
      \ +
      \ +
      \ +
      \ +
      \ +

      Virtual Machines\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Total
      Running
      Failed
      \ +
      \ +
      \ +
      \ +
      \ +

      Virtual Networks\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Total
      Public
      \ +
      \ +
      \ + \ +
      \ +
      \ +

      \ + Images\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      Total
      Public
      \ +
      \ +
      \ +
      \ +
      \ +

      Users\ +
      \ + +\ +
      \ +

      \ +
      \ + \ + \ + \ + \ + \ +
      Total
      \ +
      \ +
      \ +
      '; + + + + + + +var hostlist_tmpl = +'
      \ +
      \ +
      \ + OpenNebula.Host.list\ +
      \ +
      \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ +
      \ +
      \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      AllIDNameClusterRunning VMsCPU UseMemory useStatus
      \ +
      '; + +var create_host_tmpl = +'
      \ +
      \ + Host parameters\ + \ +
      \ +

      Drivers

      \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      '; + +//~ var clusterlist_tmpl = +//~ '
      \ + //~
      \ + //~
      \ + //~ OpenNebula.Cluster.list\ + //~
      \ + //~
      \ + //~ \ + //~
      \ + //~
      \ + //~ \ + //~
      \ + //~
      \ +//~ \ + //~ \ + //~ \ + //~ \ + //~ \ + //~ \ + //~ \ + //~ \ + //~ \ + //~ \ +//~
      AllIDName
      \ +//~
      '; + +var create_cluster_tmpl = +'
      \ +
      \ +
      \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      '; + +var vmachinelist_tmpl = +'
      \ +
      \ +
      \ + OpenNebula.VM.list\ +
      \ +
      \ + \ +
      \ +
      \ + \ +
      \ +
      \ + \ +
      \ +
      \ + \ +
      \ +
      \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      AllIDUserNameStatusCPUMemoryHostnameStart Time
      \ +
      '; + +var create_vm_tmpl = +'
      \ + \ +
      \ +
      \ +
      \ + \ +

      Fields marked with are mandatory
      \ + Fold / Unfold all sections

      \ +
      \ +\ + \ +
      \ +
      \ +

      Capacity options

      \ +
      \ +
      Capacity\ +
      \ + \ + \ +
      Name that the VM will get for description purposes. If NAME is not supplied a name generated by one will be in the form of one-<VID>.
      \ +
      \ +
      \ + \ + \ +
      Amount of RAM required for the VM, in Megabytes.
      \ +
      \ +
      \ + \ + \ +
      Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.
      \ +
      \ +
      \ + \ + \ +
      Number of virtual cpus. This value is optional, the default hypervisor behavior is used, usually one virtual CPU.
      \ +
      \ +
      \ +
      \ + \ +
      \ +
      \ +

      Boot/OS options

      \ +
      \ +
      OS and Boot options\ +
      \ + \ + \ +
      CPU architecture to virtualization
      \ +
      \ + \ +
      \ + \ + \ +
      Select boot method
      \ +
      \ +
      \ + \ + \ +
      Path to the OS kernel to boot the image
      \ +
      \ +
      \ + \ + \ +
      Path to the initrd image
      \ +
      \ +
      \ + \ + \ +
      Device to be mounted as root
      \ +
      \ +
      \ + \ + \ +
      Arguments for the booting kernel
      \ +
      \ +
      \ + \ + \ +
      Path to the bootloader executable
      \ +
      \ +
      \ + \ + \ +
      Boot device type
      \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add disks/images

      \ +
      \ +
      Disks\ +
      \ + \ + Disk\ + \ + Image\ + \ +
      \ +
      \ +
      \ + \ + \ +
      Name of the image to use
      \ +
      \ +
      \ + \ + \ +
      Type of disk device to emulate: ide, scsi
      \ +
      \ +
      \ + \ + \ +
      Device to map image disk. If set, it will overwrite the default device mapping
      \ +
      \ +
      \ + \ + \ +
      Specific image mapping driver. KVM: raw, qcow2. Xen:tap:aio:, file:. VMware unsupported
      \ +
      \ +
      \ + \ + \ +
      Disk type
      \ +
      \ +
      \ + \ + \ +
      Disk file location path or URL
      \ +
      \ +
      \ + \ + \ + \ +
      Disk file location path or URL. Mandatory for swap, fs and block images
      \ +
      \ +
      \ + \ + \ + \ +
      Filesystem type for the fs images
      \ +
      \ +
      \ + \ + \ +
      Clone this image
      \ +
      \ +
      \ + \ + \ +
      Save this image after shutting down the VM
      \ +
      \ +
      \ + \ + \ +
      Mount image as read-only
      \ +
      \ +
      \ + \ + \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +\ + \ +
      \ +
      \ +

      Setup Networks

      \ +
      \ +
      Network\ +
      \ + \ + Predefined\ + \ + Manual\ + \ + \ +
      \ +
      \ +
      \ + \ + \ +
      Name of the network to attach this device
      \ +
      \ +
      \ + \ + \ +
      Request an specific IP from the Network
      \ +
      \ +
      \ + \ + \ +
      HW address associated with the network interface
      \ +
      \ +
      \ + \ + \ +
      Name of the bridge the network device is going to be attached to
      \ +
      \ +
      \ + \ + \ +
      Name for the tun device created for the VM
      \ +
      \ +
      \ + \ + \ +
      Name of a shell script to be executed after creating the tun device for the VM
      \ +
      \ +
      \ + \ + \ +
      Hardware that will emulate this network interface. With Xen this is the type attribute of the vif.
      \ +
      \ +
      \ + \ + \ +
      \ + \ + \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add inputs

      \ +
      \ +
      Inputs\ +
      \ + \ + \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ + \ + \ +
      \ + \ + \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add Graphics

      \ +
      \ +
      Graphics\ +
      \ + \ + \ +
      \ +
      \ +
      \ + \ + \ +
      IP to listen on
      \ +
      \ +
      \ + \ + \ +
      Port for the VNC server
      \ +
      \ +
      \ + \ + \ +
      Password for the VNC server
      \ +
      \ +
      \ + \ + \ +
      Keyboard configuration locale to use in the VNC display
      \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add context

      \ +
      \ +
      Context\ +
      \ + \ + \ + \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add placement options

      \ +
      \ +
      Placement\ +
      \ + \ + \ +
      Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM
      \ +
      \ +
      \ + \ + \ +
      This field sets which attribute will be used to sort the suitable hosts for this VM. Basically, it defines which hosts are more suitable than others
      \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ +

      Add Hypervisor raw options

      \ +
      \ +
      Raw\ + \ +
      \ + \ + \ + \ +
      Raw data to be passed directly to the hypervisor
      \ +
      \ +
      \ +
      \ +\ +\ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +

      Write the Virtual Machine template here

      \ +
      \ + \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      '; + + +var vnetworklist_tmpl = +'
      \ +
      \ +
      \ + OpenNebula.Network.list\ +
      \ +
      \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ + \ +
      \ +
      \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      AllIDUserNameTypeBridgePublic?Total Leases
      \ +
      '; + +var create_vn_tmpl = +'
      \ + \ +
      \ +
      \ +
      \ + \ +
      \ +
      \ +
      \ + \ +
      \ +
      \ +
      \ + \ + Fixed network
      \ + Ranged network
      \ +
      \ +
      \ +
      \ +
      \ +
      \ + \ +
      \ + \ + \ +
      \ + \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ + \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ + \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +

      Write the Virtual Network template here

      \ +
      \ + \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      '; + +var userlist_tmpl = +'
      \ +
      \ +
      \ + OpenNebula.VM.list\ +
      \ +
      \ + \ +
      \ +
      \ + \ +
      \ +
      \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      AllIDName
      \ +
      '; + +var create_user_tmpl = +'
      \ +
      \ +
      \ + \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      '; + + +var imagelist_tmpl = +'
      \ +
      \ +
      \ + OpenNebula.Image.list\ +
      \ +
      \ + \ +
      \ +
      \ + \ + \ + \ +
      \ +
      \ + \ +
      \ +
      \ + \ +
      \ +
      \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
      AllIDUserNameTypeRegistration timePublicPersistentState#VMS
      \ +
      '; + +var create_image_tmpl = +'
      \ + \ +
      \ +
      \ +

      Fields marked with are mandatory
      \ +

      \ +
      \ + \ + \ +
      Name that the Image will get. Every image must have a unique name.
      \ +
      \ +
      \ + \ + \ +
      Human readable description of the image for other users.
      \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      Type of the image, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).
      \ +
      \ +
      \ + \ + \ +
      Public scope of the image
      \ +
      \ +
      \ + \ + \ +
      Persistence of the image
      \ +
      \ +
      \ + \ + \ +
      Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).
      \ +
      \ +
      \ + \ + \ +
      Type of disk device to emulate.
      \ +
      \ +
      \ +
      \ +
      \ + \ + Provide a path
      \ + Provide a source
      \ + Create an empty datablock\ +
      Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.
      \ +
      \ +
      \ + \ + \ +
      Path to the original file that will be copied to the image repository. If not specified for a DATABLOCK type image, an empty image will be created.
      \ +
      \ +
      \ + \ + \ +
      Source to be used in the DISK attribute. Useful for not file-based images.
      \ +
      \ +
      \ + \ + \ +
      Size of the datablock in MB.
      \ +
      \ +
      \ + \ + \ +
      Type of file system to be built. This can be any value understood by mkfs unix command.
      \ +
      \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +
      \ +

      Write the image template here

      \ + \ +
      \ +
      \ +
      \ + \ + \ +
      \ +
      \ +
      \ +
      \ +
      '; diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js new file mode 100644 index 0000000000..74fdbe8027 --- /dev/null +++ b/src/sunstone/public/js/opennebula.js @@ -0,0 +1,1832 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +var OpenNebula = { + + "Error": function(resp) + { + var error = {}; + if (resp.responseText) + { + error = JSON.parse(resp.responseText); + } + else + { + error.error = {}; + } + error.error.http_status = resp.status; + return error; + }, + + "is_error": function(obj) + { + if (obj.error) + { + return true; + } + else + { + return false; + } + }, + + "Helper": { + "resource_state": function(type, value) + { + switch(type) + { + case "HOST","host": + return ["INIT", + "MONITORING", + "MONITORED", + "ERROR", + "DISABLED"][value]; + break; + case "VM","vm": + return ["INIT", + "PENDING", + "HOLD", + "ACTIVE", + "STOPPED", + "SUSPENDED", + "DONE", + "FAILED"][value]; + break; + case "IMAGE","image": + return ["INIT", + "READY", + "USED", + "DISABLED"][value]; + break; + default: + return; + } + }, + + "image_type": function(value) + { + return ["OS", "CDROM", "DATABLOCK"][value]; + }, + + "action": function(action, params) + { + obj = { + "action": { + "perform": action + } + } + if (params) + { + obj.action.params = params; + } + return obj; + }, + + "request": function(resource, method, data) { + var r = { + "request": { + "resource" : resource, + "method" : method + } + } + if (data) + { + if (typeof(data) != "array") + { + data = [data]; + } + r.request.data = data; + } + return r; + }, + + "pool": function(resource, response) + { + var pool_name = resource + "_POOL"; + var type = resource; + var pool; + + if (typeof(pool_name) == "undefined") + { + return Error('Incorrect Pool'); + } + + var p_pool = []; + + pool = response[pool_name][type]; + + if (pool == null) + { + return p_pool; + } + else if (pool.length) + { + for (i=0;i + + + OpenNebula Admin Console + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + + + + + + + +
      +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      +
      + + diff --git a/src/sunstone/templates/login.html b/src/sunstone/templates/login.html new file mode 100644 index 0000000000..031f6b35f7 --- /dev/null +++ b/src/sunstone/templates/login.html @@ -0,0 +1,48 @@ + + + + OpenNebula Admin Console Login + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      + Username + + Password + +
      + + + +
      +
      +
      + +
      + Invalid username or password +
      +
      + OpenNebula is not running +
      +
      + + + diff --git a/src/sunstone/test/examples/cluster/addhost.json b/src/sunstone/test/examples/cluster/addhost.json new file mode 100644 index 0000000000..4dea067a19 --- /dev/null +++ b/src/sunstone/test/examples/cluster/addhost.json @@ -0,0 +1,8 @@ +{ + "action": { + "params": { + "host_id": "0" + }, + "perform": "add_host" + } +} diff --git a/src/sunstone/test/examples/cluster/cluster1.json b/src/sunstone/test/examples/cluster/cluster1.json new file mode 100644 index 0000000000..56122e6cd6 --- /dev/null +++ b/src/sunstone/test/examples/cluster/cluster1.json @@ -0,0 +1,5 @@ +{ + "cluster": { + "name": "cluster_one" + } +} diff --git a/src/sunstone/test/examples/cluster/cluster2.json b/src/sunstone/test/examples/cluster/cluster2.json new file mode 100644 index 0000000000..27f53c62b4 --- /dev/null +++ b/src/sunstone/test/examples/cluster/cluster2.json @@ -0,0 +1,5 @@ +{ + "cluster": { + "name": "cluster_two" + } +} diff --git a/src/sunstone/test/examples/cluster/rmhost.json b/src/sunstone/test/examples/cluster/rmhost.json new file mode 100644 index 0000000000..a6bc0e3d43 --- /dev/null +++ b/src/sunstone/test/examples/cluster/rmhost.json @@ -0,0 +1,8 @@ +{ + "action": { + "params": { + "host_id": "0" + }, + "perform": "remove_host" + } +} diff --git a/src/sunstone/test/examples/error/wrong_action.json b/src/sunstone/test/examples/error/wrong_action.json new file mode 100644 index 0000000000..14624e7dc1 --- /dev/null +++ b/src/sunstone/test/examples/error/wrong_action.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "dance" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/host/disable.json b/src/sunstone/test/examples/host/disable.json new file mode 100644 index 0000000000..61df114117 --- /dev/null +++ b/src/sunstone/test/examples/host/disable.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "disable" + } +} diff --git a/src/sunstone/test/examples/host/enable.json b/src/sunstone/test/examples/host/enable.json new file mode 100644 index 0000000000..430eec2ce1 --- /dev/null +++ b/src/sunstone/test/examples/host/enable.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "enable" + } +} diff --git a/src/sunstone/test/examples/host/host0.json b/src/sunstone/test/examples/host/host0.json new file mode 100644 index 0000000000..714bf8e839 --- /dev/null +++ b/src/sunstone/test/examples/host/host0.json @@ -0,0 +1,8 @@ +{ + "host": { + "vm_mad": "vmm_dummy", + "tm_mad": "tm_dummy", + "name": "host_one", + "im_mad": "im_dummy" + } +} diff --git a/src/sunstone/test/examples/host/host1.json b/src/sunstone/test/examples/host/host1.json new file mode 100644 index 0000000000..87c0449339 --- /dev/null +++ b/src/sunstone/test/examples/host/host1.json @@ -0,0 +1,8 @@ +{ + "host": { + "vm_mad": "vmm_dummy", + "tm_mad": "tm_dummy", + "name": "host_two", + "im_mad": "im_dummy" + } +} diff --git a/src/sunstone/test/examples/image/disable.json b/src/sunstone/test/examples/image/disable.json new file mode 100644 index 0000000000..61df114117 --- /dev/null +++ b/src/sunstone/test/examples/image/disable.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "disable" + } +} diff --git a/src/sunstone/test/examples/image/enable.json b/src/sunstone/test/examples/image/enable.json new file mode 100644 index 0000000000..430eec2ce1 --- /dev/null +++ b/src/sunstone/test/examples/image/enable.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "enable" + } +} diff --git a/src/sunstone/test/examples/image/image0.json b/src/sunstone/test/examples/image/image0.json new file mode 100644 index 0000000000..1a4321f714 --- /dev/null +++ b/src/sunstone/test/examples/image/image0.json @@ -0,0 +1,7 @@ +{ + "image": { + "name": "first_image", + "type": "OS", + "path": "/etc/hosts" + } +} diff --git a/src/sunstone/test/examples/image/image1.json b/src/sunstone/test/examples/image/image1.json new file mode 100644 index 0000000000..91354fe95c --- /dev/null +++ b/src/sunstone/test/examples/image/image1.json @@ -0,0 +1,7 @@ +{ + "image": { + "name": "second_image", + "type": "CDROM", + "size": "512" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/image/nonpersistent.json b/src/sunstone/test/examples/image/nonpersistent.json new file mode 100644 index 0000000000..d3ec668784 --- /dev/null +++ b/src/sunstone/test/examples/image/nonpersistent.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "nonpersistent" + } +} diff --git a/src/sunstone/test/examples/image/persistent.json b/src/sunstone/test/examples/image/persistent.json new file mode 100644 index 0000000000..e3368bb656 --- /dev/null +++ b/src/sunstone/test/examples/image/persistent.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "persistent" + } +} diff --git a/src/sunstone/test/examples/image/publish.json b/src/sunstone/test/examples/image/publish.json new file mode 100644 index 0000000000..71ec3f7eb0 --- /dev/null +++ b/src/sunstone/test/examples/image/publish.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "publish" + } +} diff --git a/src/sunstone/test/examples/image/removeattr.json b/src/sunstone/test/examples/image/removeattr.json new file mode 100644 index 0000000000..a0a5672893 --- /dev/null +++ b/src/sunstone/test/examples/image/removeattr.json @@ -0,0 +1,8 @@ +{ + "action": { + "params": { + "name": "FOO" + }, + "perform": "rm_attr" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/image/unpublish.json b/src/sunstone/test/examples/image/unpublish.json new file mode 100644 index 0000000000..da41ade888 --- /dev/null +++ b/src/sunstone/test/examples/image/unpublish.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "unpublish" + } +} diff --git a/src/sunstone/test/examples/image/update.json b/src/sunstone/test/examples/image/update.json new file mode 100644 index 0000000000..960a10428b --- /dev/null +++ b/src/sunstone/test/examples/image/update.json @@ -0,0 +1,9 @@ +{ + "action": { + "params": { + "name": "FOO", + "value": "mock" + }, + "perform": "update" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/user/passwd.json b/src/sunstone/test/examples/user/passwd.json new file mode 100644 index 0000000000..240ac5d136 --- /dev/null +++ b/src/sunstone/test/examples/user/passwd.json @@ -0,0 +1,8 @@ +{ + "action": { + "params": { + "password": "newpass" + }, + "perform": "passwd" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/user/user1.json b/src/sunstone/test/examples/user/user1.json new file mode 100644 index 0000000000..4c54e16fb7 --- /dev/null +++ b/src/sunstone/test/examples/user/user1.json @@ -0,0 +1,6 @@ +{ + "user": { + "name": "user_one", + "password": "pass1" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/user/user2.json b/src/sunstone/test/examples/user/user2.json new file mode 100644 index 0000000000..39aa8683ef --- /dev/null +++ b/src/sunstone/test/examples/user/user2.json @@ -0,0 +1,6 @@ +{ + "user": { + "name": "user_two", + "password": "pass2" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vm/deploy.json b/src/sunstone/test/examples/vm/deploy.json new file mode 100644 index 0000000000..57182ed694 --- /dev/null +++ b/src/sunstone/test/examples/vm/deploy.json @@ -0,0 +1,8 @@ +{ + "action": { + "params": { + "host_id": "0" + }, + "perform": "deploy" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vm/hold.json b/src/sunstone/test/examples/vm/hold.json new file mode 100644 index 0000000000..cff6fd4f16 --- /dev/null +++ b/src/sunstone/test/examples/vm/hold.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "hold" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vm/save_as.json b/src/sunstone/test/examples/vm/save_as.json new file mode 100644 index 0000000000..8f4ae8e40e --- /dev/null +++ b/src/sunstone/test/examples/vm/save_as.json @@ -0,0 +1,9 @@ +{ + "action": { + "params": { + "disk_id": "0", + "image_name": "new_image" + }, + "perform": "save_as" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vm/vm0.json b/src/sunstone/test/examples/vm/vm0.json new file mode 100644 index 0000000000..54a30daf01 --- /dev/null +++ b/src/sunstone/test/examples/vm/vm0.json @@ -0,0 +1,12 @@ +{ + "vm": { + "memory": "256", + "cpu": "1", + "disk": { + "type": "fs", + "format": "ext3", + "size": "1024" + }, + "name": "vm1" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vm/vm1.json b/src/sunstone/test/examples/vm/vm1.json new file mode 100644 index 0000000000..a44c2f7fda --- /dev/null +++ b/src/sunstone/test/examples/vm/vm1.json @@ -0,0 +1,7 @@ +{ + "vm": { + "memory": "512", + "cpu": "2", + "name": "vm2" + } +} \ No newline at end of file diff --git a/src/sunstone/test/examples/vnet/fixed_vnet.json b/src/sunstone/test/examples/vnet/fixed_vnet.json new file mode 100644 index 0000000000..98c08bbb73 --- /dev/null +++ b/src/sunstone/test/examples/vnet/fixed_vnet.json @@ -0,0 +1,16 @@ +{ + "vnet": { + "type": "FIXED", + "leases": [ + { + "ip": "10.0.1.1" + }, + { + "ip": "10.0.1.2" + } + ], + "bridge": "vbr2", + "network_address": "10.0.1.0", + "name": "fixed_vnet" + } +} diff --git a/src/sunstone/test/examples/vnet/publish.json b/src/sunstone/test/examples/vnet/publish.json new file mode 100644 index 0000000000..71ec3f7eb0 --- /dev/null +++ b/src/sunstone/test/examples/vnet/publish.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "publish" + } +} diff --git a/src/sunstone/test/examples/vnet/ranged_vnet.json b/src/sunstone/test/examples/vnet/ranged_vnet.json new file mode 100644 index 0000000000..55dae7ae6f --- /dev/null +++ b/src/sunstone/test/examples/vnet/ranged_vnet.json @@ -0,0 +1,9 @@ +{ + "vnet": { + "type": "RANGED", + "bridge": "vbr1", + "network_size": "200", + "network_address": "10.0.0.0", + "name": "ranged_vnet" + } +} diff --git a/src/sunstone/test/examples/vnet/unpublish.json b/src/sunstone/test/examples/vnet/unpublish.json new file mode 100644 index 0000000000..da41ade888 --- /dev/null +++ b/src/sunstone/test/examples/vnet/unpublish.json @@ -0,0 +1,5 @@ +{ + "action": { + "perform": "unpublish" + } +} diff --git a/src/sunstone/test/spec/cluster_spec.rb b/src/sunstone/test/spec/cluster_spec.rb new file mode 100644 index 0000000000..b483b9563c --- /dev/null +++ b/src/sunstone/test/spec/cluster_spec.rb @@ -0,0 +1,176 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'Cluster tests' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @host0_s = File.read(EXAMPLES_PATH + '/host/host0.json') + post '/host', @host0_s + last_response.status.should eql(201) + + @cluster1_s = File.read(EXAMPLES_PATH + '/cluster/cluster1.json') + @cluster1_h = JSON.parse(@cluster1_s) + + @cluster2_s = File.read(EXAMPLES_PATH + '/cluster/cluster2.json') + @cluster2_h = JSON.parse(@cluster2_s) + + @action_addhost = File.read(EXAMPLES_PATH + '/cluster/addhost.json') + @action_rmhost = File.read(EXAMPLES_PATH + '/cluster/rmhost.json') + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should create a first cluster" do + post '/cluster', @cluster1_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['CLUSTER']['ID'].should eql("1") + end + + it "should create a second cluster" do + post '/cluster', @cluster2_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['CLUSTER']['ID'].should eql("2") + end + + it "should get Cluster 1 information" do + get '/cluster/1' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['CLUSTER']['NAME'].should eql(@cluster1_h['cluster']['name']) + end + + it "should add Host 0 to Cluster 1" do + post '/cluster/1/action', @action_addhost + + last_response.status.should eql(204) + end + + it "should get Host 0 information after adding it to the Cluster 1" do + get '/host/0' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['CLUSTER'].should eql("cluster_one") + end + + it "should remove Host 0 from Cluster 1" do + post '/cluster/1/action', @action_rmhost + + last_response.status.should eql(204) + end + + it "should get Host 0 information after removing it from Cluster 1" do + get '/host/0' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['CLUSTER'].should eql("default") + end + + it "should get Cluster 2 information" do + get '/cluster/2' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['CLUSTER']['NAME'].should eql(@cluster2_h['cluster']['name']) + end + + it "should get cluster_pool information" do + get '/cluster' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['CLUSTER_POOL']['CLUSTER'].size.should eql(3) + json_response['CLUSTER_POOL']['CLUSTER'].each do |cluster| + if cluster['ID'] == '1' + cluster['NAME'].should eql(@cluster1_h['cluster']['name']) + elsif cluster['ID'] == '2' + cluster['NAME'].should eql(@cluster2_h['cluster']['name']) + else + cluster['NAME'].should eql("default") + end + end + end + + it "should try to get Cluster 3 information and check the error, because " << + "it does not exist" do + get '/cluster/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to add Host 0 to Cluster 3 and check the error, because " << + "it does not exist" do + post '/cluster/3/action', @action_addhost + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to remove Host 0 from Cluster 3 and check the error, " << + "because it does not exist" do + post '/cluster/3/action', @action_removehost + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/cluster/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should delete the Cluster 2" do + delete '/cluster/2' + + last_response.status.should eql(204) + end + + it "should try to get the deleted Cluster information and check the error" do + url = '/cluster/2' + get url + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end diff --git a/src/sunstone/test/spec/host_spec.rb b/src/sunstone/test/spec/host_spec.rb new file mode 100644 index 0000000000..f652353438 --- /dev/null +++ b/src/sunstone/test/spec/host_spec.rb @@ -0,0 +1,203 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'Host tests NOKOGIRI' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @host0_s = File.read(EXAMPLES_PATH + '/host/host0.json') + @host0_h = JSON.parse(@host0_s) + + @host1_s = File.read(EXAMPLES_PATH + '/host/host1.json') + @host1_h = JSON.parse(@host1_s) + + @action_enable = File.read(EXAMPLES_PATH + '/host/enable.json') + @action_disable = File.read(EXAMPLES_PATH + '/host/disable.json') + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should get empty host_pool information" do + get '/host' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST_POOL'].empty?.should eql(true) + end + + it "should create a first host" do + post '/host', @host0_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['ID'].should eql("0") + end + + it "should create a second host" do + post '/host', @host1_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['ID'].should eql("1") + end + + it "should get host 0 information" do + url = '/host/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['NAME'].should eql(@host0_h['host']['name']) + json_response['HOST']['IM_MAD'].should eql(@host0_h['host']['im_mad']) + json_response['HOST']['VM_MAD'].should eql(@host0_h['host']['vm_mad']) + json_response['HOST']['TM_MAD'].should eql(@host0_h['host']['tm_mad']) + json_response['HOST']['CLUSTER'].should eql("default") + json_response['HOST']['STATE'].should eql("0") + end + + it "should disable host 0" do + url = '/host/0/action' + post url, @action_disable + + last_response.status.should eql(204) + end + + it "should get host 0 information after disabling it" do + url = '/host/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['STATE'].should eql("4") + end + + it "should enable host 0" do + url = '/host/0/action' + post url, @action_enable + + last_response.status.should eql(204) + end + + it "should get host 0 information after enabling it" do + url = '/host/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['STATE'].should eql("0") + end + + it "should get host 1 information" do + url = '/host/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST']['NAME'].should eql(@host1_h['host']['name']) + json_response['HOST']['IM_MAD'].should eql(@host1_h['host']['im_mad']) + json_response['HOST']['VM_MAD'].should eql(@host1_h['host']['vm_mad']) + json_response['HOST']['TM_MAD'].should eql(@host1_h['host']['tm_mad']) + json_response['HOST']['CLUSTER'].should eql("default") + json_response['HOST']['STATE'].should eql("0") + end + + it "should get host_pool information" do + get '/host' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['HOST_POOL']['HOST'].size.should eql(2) + json_response['HOST_POOL']['HOST'].each do |host| + if host['ID'] == '0' + host['NAME'].should eql(@host0_h['host']['name']) + host['IM_MAD'].should eql(@host0_h['host']['im_mad']) + host['VM_MAD'].should eql(@host0_h['host']['vm_mad']) + host['TM_MAD'].should eql(@host0_h['host']['tm_mad']) + elsif host['ID'] == '1' + host['NAME'].should eql(@host1_h['host']['name']) + host['IM_MAD'].should eql(@host1_h['host']['im_mad']) + host['VM_MAD'].should eql(@host1_h['host']['vm_mad']) + host['TM_MAD'].should eql(@host1_h['host']['tm_mad']) + end + end + end + + it "should try to get host 3 information and check the error, because " << + "it does not exist" do + get '/host/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to enable host 3 and check the error, because " << + "it does not exist" do + post '/host/3/action', @action_enable + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to disable a third host and check the error, because " << + "it does not exist" do + post '/host/3/action', @action_disable + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/host/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should delete host 1" do + url = '/host/1' + delete url + + last_response.status.should eql(204) + end + + it "should try to get the deleted host information and check the error" do + url = '/host/1' + get url + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end + diff --git a/src/sunstone/test/spec/image_spec.rb b/src/sunstone/test/spec/image_spec.rb new file mode 100644 index 0000000000..447d9f6613 --- /dev/null +++ b/src/sunstone/test/spec/image_spec.rb @@ -0,0 +1,327 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'Image tests' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @image0_s = File.read(EXAMPLES_PATH + '/image/image0.json') + @image0_h = JSON.parse(@image0_s) + + @image1_s = File.read(EXAMPLES_PATH + '/image/image1.json') + @image1_h = JSON.parse(@image1_s) + + @action_enable = File.read(EXAMPLES_PATH + '/image/enable.json') + @action_disable = File.read(EXAMPLES_PATH + '/image/disable.json') + + @action_nonpersistent = File.read(EXAMPLES_PATH + '/image/nonpersistent.json') + @action_persistent = File.read(EXAMPLES_PATH + '/image/persistent.json') + + @action_publish = File.read(EXAMPLES_PATH + '/image/publish.json') + @action_unpublish = File.read(EXAMPLES_PATH + '/image/unpublish.json') + + @action_update = File.read(EXAMPLES_PATH + '/image/update.json') + @action_removeattr = File.read(EXAMPLES_PATH + '/image/removeattr.json') + + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should create a first Image" do + post '/image', @image0_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['ID'].should eql("0") + end + + it "should create a second Image" do + post '/image', @image1_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['ID'].should eql("1") + end + + it "should get Image 0 information" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['NAME'].should eql(@image0_h['image']['name']) + json_response['IMAGE']['TYPE'].should eql("0") + json_response['IMAGE']['TEMPLATE']['PATH'].should eql(@image0_h['image']['path']) + json_response['IMAGE']['PUBLIC'].should eql("0") + json_response['IMAGE']['PERSISTENT'].should eql("0") + end + + ############################################################################ + # Publish / Unpublish + ############################################################################ + it "should publish Image 0" do + url = '/image/0/action' + post url, @action_publish + + last_response.status.should eql(204) + end + + it "should get Image 0 information after publishing it" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['PUBLIC'].should eql("1") + end + + it "should unpublish Image 0" do + url = '/image/0/action' + post url, @action_unpublish + + last_response.status.should eql(204) + end + + it "should get Image 0 information after unpublishing it" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['PUBLIC'].should eql("0") + end + + ############################################################################ + # Persistent / NonPersstent + ############################################################################ + it "should do Image 0 persistent" do + url = '/image/0/action' + post url, @action_persistent + + last_response.status.should eql(204) + end + + it "should get Image 0 information after doing it persistent" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['PERSISTENT'].should eql("1") + end + + it "should do Image 0 nonpersistent" do + url = '/image/0/action' + post url, @action_nonpersistent + + last_response.status.should eql(204) + end + + it "should get Image 0 information after doing it nonpersistent" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['PERSISTENT'].should eql("0") + end + + ############################################################################ + # Disable / Enable + ############################################################################ + it "should disable Image 0" do + url = '/image/0/action' + post url, @action_disable + + last_response.status.should eql(204) + end + + it "should Image 0 information after disabling it" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['STATE'].should eql("3") + end + + it "should enable Image 0" do + url = '/image/0/action' + post url, @action_enable + + last_response.status.should eql(204) + end + + it "should get Image 0 information after enabling it" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['STATE'].should eql("1") + end + + ############################################################################ + # Update / Remove attr + ############################################################################ + it "should add a new attribute to Image 0" do + url = '/image/0/action' + post url, @action_update + + last_response.status.should eql(204) + end + + it "should get first Image information after adding a new attribute" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['TEMPLATE']['FOO'].should eql("mock") + end + + it "should remove an attribute from Image 0" do + url = '/image/0/action' + post url, @action_removeattr + + last_response.status.should eql(204) + end + + it "should get Image 0 information after removing an attribute" do + url = '/image/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['TEMPLATE']['FOO'].should eql(nil) + end + + + it "should get Image 1 information" do + url = '/image/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE']['NAME'].should eql(@image1_h['image']['name']) + json_response['IMAGE']['TYPE'].should eql("1") + json_response['IMAGE']['TEMPLATE']['SIZE'].should eql(@image1_h['image']['size']) + end + + ############################################################################ + # Pool + ############################################################################ + it "should get image_pool information" do + get '/image' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['IMAGE_POOL']['IMAGE'].size.should eql(2) + json_response['IMAGE_POOL']['IMAGE'].each do |image| + if image['ID'] == '0' + image['NAME'].should eql(@image0_h['image']['name']) + image['TYPE'].should eql("0") + image['TEMPLATE']['PATH'].should eql(@image0_h['image']['path']) + image['PUBLIC'].should eql("0") + image['PERSISTENT'].should eql("0") + elsif image['ID'] == '1' + image['NAME'].should eql(@image1_h['image']['name']) + image['TYPE'].should eql("1") + image['TEMPLATE']['SIZE'].should eql(@image1_h['image']['size']) + image['PUBLIC'].should eql("0") + image['PERSISTENT'].should eql("0") + end + end + end + + ############################################################################ + # Delete + ############################################################################ + it "should delete Image 1" do + url = '/image/1' + delete url + + last_response.status.should eql(204) + end + + ############################################################################ + # Errors + ############################################################################ + it "should try to get Image 3 information and check the error, because " << + "it does not exist" do + get '/image/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to publish Image 3 and check the error, because " << + "it does not exist" do + post '/image/3/action', @action_publish + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to unpublish Image 3 and check the error, because " << + "it does not exist" do + post '/image/3/action', @action_unpublish + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/image/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to get the deleted Image information and check the error" do + url = '/image/1' + get url + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end diff --git a/src/vmm_mad/remotes/xen/poll b/src/sunstone/test/spec/spec_helper.rb old mode 100755 new mode 100644 similarity index 58% rename from src/vmm_mad/remotes/xen/poll rename to src/sunstone/test/spec/spec_helper.rb index 7c45ddaae3..52bc72f514 --- a/src/vmm_mad/remotes/xen/poll +++ b/src/sunstone/test/spec/spec_helper.rb @@ -1,7 +1,5 @@ -#!/bin/bash - # -------------------------------------------------------------------------- # -# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # @@ -16,49 +14,28 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -source $(dirname $0)/xenrc +EXAMPLES_PATH = File.join(File.dirname(__FILE__),'../examples') +ONEUI_LIB_LOCATION = File.join(File.dirname(__FILE__), '..', '..') +$: << ONEUI_LIB_LOCATION -INFO_MEM=4 -INFO_CPU=3 -INFO_NETTX=10 -INFO_NETRX=11 -INFO_STATE=1 +# Load the testing libraries +require 'rubygems' +require 'spec' +require 'rack/test' +require 'json' +# Load the Sinatra app +require 'one-ui' -AWK_SCRIPT=' -{ - mem=$5; - cpu=$4; - nettx=$11; - netrx=$12; - stat=$2 - gsub("-", "", stat); +# Make Rack::Test available to all spec contexts +Spec::Runner.configure do |conf| + conf.include Rack::Test::Methods +end - if(stat=="r" || - stat=="b" || - stat=="s" || - stat=="d") - state="a"; - else if(stat=="p") state="a"; - else if(stat=="c") state="c"; - else state="u"; +# Set the Sinatra environment +set :environment, :test - print "USEDMEMORY=" mem " USEDCPU=" cpu " NETTX=" nettx " NETRX=" netrx " STATE=" state -} -' - -function get_info() { - $XM_POLL | egrep "^ *(migrating-)?$1 " | tail -1 | sed 's/^ *//' | sed 's/no limit/no_limit/' -} - - - -info=`get_info $1 2>/dev/null | awk "$AWK_SCRIPT"` - - -if [ -n "$info" ]; then - echo $info -else - echo STATE=d -fi -exit 0 +# Add an app method for RSpec +def app + Sinatra::Application +end diff --git a/src/sunstone/test/spec/user_spec.rb b/src/sunstone/test/spec/user_spec.rb new file mode 100644 index 0000000000..c054419e20 --- /dev/null +++ b/src/sunstone/test/spec/user_spec.rb @@ -0,0 +1,161 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'User tests' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @user1_s = File.read(EXAMPLES_PATH + '/user/user1.json') + @user1_h = JSON.parse(@user1_s) + + @user2_s = File.read(EXAMPLES_PATH + '/user/user2.json') + @user2_h = JSON.parse(@user2_s) + + @action_passwd = File.read(EXAMPLES_PATH + '/user/passwd.json') + @action_passwd_h = JSON.parse(@action_passwd) + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should create a first User" do + post '/user', @user1_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['USER']['ID'].should eql("1") + end + + it "should create a second User" do + post '/user', @user2_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['USER']['ID'].should eql("2") + end + + it "should get User 1 information" do + url = '/user/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['USER']['NAME'].should eql(@user1_h['user']['name']) + password = Digest::SHA1.hexdigest(@user1_h['user']['password']) + json_response['USER']['PASSWORD'].should eql(password) + end + + it "should change User 1 password" do + url = '/user/1/action' + post url, @action_passwd + + last_response.status.should eql(204) + end + + it "should get User 1 information after changing its password" do + url = '/user/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['USER']['NAME'].should eql(@user1_h['user']['name']) + password = Digest::SHA1.hexdigest(@action_passwd_h['action']['params']['password']) + json_response['USER']['PASSWORD'].should eql(password) + end + + it "should get User 2 information" do + url = '/user/2' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['USER']['NAME'].should eql(@user2_h['user']['name']) + password = Digest::SHA1.hexdigest(@user2_h['user']['password']) + json_response['USER']['PASSWORD'].should eql(password) + end + + it "should get user_pool information" do + get '/user' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['USER_POOL']['USER'].size.should eql(3) + json_response['USER_POOL']['USER'].each do |user| + if user['ID'] == '1' + user['NAME'].should eql(@user1_h['user']['name']) + password = Digest::SHA1.hexdigest(@action_passwd_h['action']['params']['password']) + user['PASSWORD'].should eql(password) + elsif user['ID'] == '2' + user['NAME'].should eql(@user2_h['user']['name']) + password = Digest::SHA1.hexdigest(@user2_h['user']['password']) + user['PASSWORD'].should eql(password) + end + end + end + + it "should try to get User 3 information and check the error, because " << + "it does not exist" do + get '/user/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to change password of User 3 and check the error, because " << + "it does not exist" do + post '/user/3/action', @action_passwd + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/user/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should delete User 2" do + url = '/user/2' + delete url + + last_response.status.should eql(204) + end + + it "should try to get the deleted User information and check the error" do + url = '/user/2' + get url + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end diff --git a/src/sunstone/test/spec/vm_spec.rb b/src/sunstone/test/spec/vm_spec.rb new file mode 100644 index 0000000000..cecd164724 --- /dev/null +++ b/src/sunstone/test/spec/vm_spec.rb @@ -0,0 +1,251 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'VirtualMachine tests' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @host0_s = File.read(EXAMPLES_PATH + '/host/host0.json') + post '/host', @host0_s + last_response.status.should eql(201) + sleep 2 + + @vm0_s = File.read(EXAMPLES_PATH + '/vm/vm0.json') + @vm0_h = JSON.parse(@vm0_s) + + @vm1_s = File.read(EXAMPLES_PATH + '/vm/vm1.json') + @vm1_h = JSON.parse(@vm1_s) + + @action_deploy = File.read(EXAMPLES_PATH + '/vm/deploy.json') + @action_hold = File.read(EXAMPLES_PATH + '/vm/hold.json') + @action_saveas = File.read(EXAMPLES_PATH + '/vm/save_as.json') + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should get empty vm_pool information" do + get '/vm' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM_POOL'].empty?.should eql(true) + end + + it "should create a first VirtualMachine" do + post '/vm', @vm0_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['VM']['ID'].should eql("0") + end + + + it "should get VirtualMachine 0 information" do + url = '/vm/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['NAME'].should eql(@vm0_h['vm']['name']) + json_response['VM']['STATE'].should eql("1") + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory']) + end + + it "should create a second VirtualMachine" do + post '/vm', @vm1_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['VM']['ID'].should eql("1") + end + + it "should get VirtualMachine 1 information" do + url = '/vm/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['NAME'].should eql(@vm1_h['vm']['name']) + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm1_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm1_h['vm']['memory']) + end + + ############################################################################ + # Deploy + ############################################################################ + it "should deploy VirtualMachine 0 in Host 0" do + url = '/vm/0/action' + post url, @action_deploy + + last_response.status.should eql(204) + end + + it "should get first VirtualMachine information after deploying it" do + url = '/vm/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['STATE'].should eql("3") + json_response['VM']['NAME'].should eql(@vm0_h['vm']['name']) + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory']) + end + + it "should try to delete a host with running VMs and check the error" do + delete '/host/0' + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + ############################################################################ + # Save_as + ############################################################################ + it "should prepare the VirtualMachine 0 disk to be saved" do + url = '/vm/0/action' + post url, @action_saveas + + last_response.status.should eql(204) + end + + it "should get VirtualMachine 0 information after save_as action" do + url = '/vm/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['STATE'].should eql("3") + json_response['VM']['NAME'].should eql(@vm0_h['vm']['name']) + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory']) + json_response['VM']['TEMPLATE']['DISK']["SAVE_AS"].should eql("0") + end + + ############################################################################ + # Stop + ############################################################################ + it "should stop VirtualMachine 1" do + url = '/vm/1/action' + post url, @action_hold + + last_response.status.should eql(204) + end + + it "should get VirtualMachine 1 information after stopping it" do + url = '/vm/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['STATE'].should eql("2") + json_response['VM']['NAME'].should eql(@vm1_h['vm']['name']) + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm1_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm1_h['vm']['memory']) + end + + ############################################################################ + # Pool + ############################################################################ + it "should get vm_pool information" do + get '/vm' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM_POOL']['VM'].size.should eql(2) + json_response['VM_POOL']['VM'].each do |vm| + if vm['ID'] == '0' + vm['NAME'].should eql(@vm0_h['vm']['name']) + vm['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu']) + vm['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory']) + elsif vm['ID'] == '1' + vm['NAME'].should eql(@vm1_h['vm']['name']) + vm['TEMPLATE']['CPU'].should eql(@vm1_h['vm']['cpu']) + vm['TEMPLATE']['MEMORY'].should eql(@vm1_h['vm']['memory']) + end + end + end + + ############################################################################ + # Delete + ############################################################################ + it "should delete VirtualMachine 1" do + url = '/vm/1' + delete url + + last_response.status.should eql(204) + end + + it "should get the deleted VirtualMchine information" do + url = '/vm/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VM']['STATE'].should eql("6") + json_response['VM']['NAME'].should eql(@vm1_h['vm']['name']) + json_response['VM']['TEMPLATE']['CPU'].should eql(@vm1_h['vm']['cpu']) + json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm1_h['vm']['memory']) + end + + ############################################################################ + # Errors + ############################################################################ + it "should try to get VirtualMachine 3 information and check the error, " << + " because it does not exist" do + get '/vm/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to deploy VirtualMachine 3 and check the error, because " << + "it does not exist" do + post '/vm/3/action', @action_deploy + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/vm/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end diff --git a/src/sunstone/test/spec/vnet_spec.rb b/src/sunstone/test/spec/vnet_spec.rb new file mode 100644 index 0000000000..08dd7eb209 --- /dev/null +++ b/src/sunstone/test/spec/vnet_spec.rb @@ -0,0 +1,207 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe 'VirtualNetwork tests' do + before(:all) do + basic_authorize('oneadmin','opennebula') + post '/login' + last_response.status.should eql(204) + + @ranged_vnet_s = File.read(EXAMPLES_PATH + '/vnet/ranged_vnet.json') + @ranged_vnet_h = JSON.parse(@ranged_vnet_s) + + @fixed_vnet_s = File.read(EXAMPLES_PATH + '/vnet/fixed_vnet.json') + @fixed_vnet_h = JSON.parse(@fixed_vnet_s) + + @action_publish = File.read(EXAMPLES_PATH + '/vnet/publish.json') + @action_unpublish = File.read(EXAMPLES_PATH + '/vnet/unpublish.json') + @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') + end + + it "should get empty host_pool information" do + get '/vnet' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET_POOL'].empty?.should eql(true) + end + + it "should create a ranged VirtualNetwork" do + post '/vnet', @ranged_vnet_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['ID'].should eql("0") + end + + it "should create a fixed VirtualNetwork" do + post '/vnet', @fixed_vnet_s + + last_response.status.should eql(201) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['ID'].should eql("1") + end + + it "should get VirtualNetwork 0 information" do + url = '/vnet/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['NAME'].should eql(@ranged_vnet_h['vnet']['name']) + json_response['VNET']['TYPE'].should eql("0") + json_response['VNET']['BRIDGE'].should eql(@ranged_vnet_h['vnet']['bridge']) + json_response['VNET']['TEMPLATE']['NETWORK_SIZE'].should eql(@ranged_vnet_h['vnet']['network_size']) + json_response['VNET']['TEMPLATE']['NETWORK_ADDRESS'].should eql(@ranged_vnet_h['vnet']['network_address']) + json_response['VNET']['PUBLIC'].should eql("0") + end + + it "should publish VirtualNetwork 0" do + url = '/vnet/0/action' + post url, @action_publish + + last_response.status.should eql(204) + end + + it "should get VirtualNetwork 0 information after publishing it" do + url = '/vnet/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['PUBLIC'].should eql("1") + end + + it "should unpublish VirtualNetwork 0" do + url = '/vnet/0/action' + post url, @action_unpublish + + last_response.status.should eql(204) + end + + it "should get VirtualNetwork 0 information after unpublishing it" do + url = '/vnet/0' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['PUBLIC'].should eql("0") + end + + + it "should get VirtualNetwork 1 information" do + url = '/vnet/1' + get url + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET']['NAME'].should eql(@fixed_vnet_h['vnet']['name']) + json_response['VNET']['TYPE'].should eql("1") + json_response['VNET']['BRIDGE'].should eql(@fixed_vnet_h['vnet']['bridge']) + json_response['VNET']['TEMPLATE']['NETWORK_ADDRESS'].should eql(@fixed_vnet_h['vnet']['network_address']) + json_response['VNET']['PUBLIC'].should eql("0") + end + + it "should get vnet_pool information" do + get '/vnet' + + last_response.status.should eql(200) + + json_response = JSON.parse(last_response.body) + json_response['VNET_POOL']['VNET'].size.should eql(2) + json_response['VNET_POOL']['VNET'].each do |vnet| + if vnet['ID'] == '0' + vnet['NAME'].should eql(@ranged_vnet_h['vnet']['name']) + vnet['TYPE'].should eql("0") + vnet['BRIDGE'].should eql(@ranged_vnet_h['vnet']['bridge']) + vnet['TEMPLATE']['NETWORK_SIZE'].should eql(@ranged_vnet_h['vnet']['network_size']) + vnet['TEMPLATE']['NETWORK_ADDRESS'].should eql(@ranged_vnet_h['vnet']['network_address']) + vnet['PUBLIC'].should eql("0") + elsif vnet['ID'] == '1' + vnet['NAME'].should eql(@fixed_vnet_h['vnet']['name']) + vnet['TYPE'].should eql("1") + vnet['BRIDGE'].should eql(@fixed_vnet_h['vnet']['bridge']) + vnet['TEMPLATE']['NETWORK_ADDRESS'].should eql(@fixed_vnet_h['vnet']['network_address']) + vnet['PUBLIC'].should eql("0") + end + end + end + + it "should try to get VirtualNetwork 3 information and check the error, because " << + "it does not exist" do + get '/vnet/3' + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to publish VirtualNetwork 3 and check the error, because " << + "it does not exist" do + post '/vnet/3/action', @action_publish + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to unpublish VirtualNetwork 3 and check the error, because " << + "it does not exist" do + post '/vnet/3/action', @action_unpublish + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should try to perform a wrong action and check the error" do + post '/vnet/0/action', @wrong_action + + last_response.status.should eql(500) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end + + it "should delete VirtualNetwork 1" do + url = '/vnet/1' + delete url + + last_response.status.should eql(204) + end + + it "should try to get the deleted VirtualNetwork information and check the error" do + url = '/vnet/1' + get url + + last_response.status.should eql(404) + + json_response = JSON.parse(last_response.body) + json_response['error']['message'].should_not eql(nil) + end +end diff --git a/src/vmm_mad/remotes/kvm/poll b/src/sunstone/test/test.sh old mode 100755 new mode 100644 similarity index 60% rename from src/vmm_mad/remotes/kvm/poll rename to src/sunstone/test/test.sh index 54d9ff3e7d..1878677758 --- a/src/vmm_mad/remotes/kvm/poll +++ b/src/sunstone/test/test.sh @@ -1,7 +1,7 @@ #!/bin/bash # -------------------------------------------------------------------------- # -# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # @@ -16,43 +16,34 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -source $(dirname $0)/kvmrc - -AWK_SCRIPT=' -BEGIN { FS=":" }; - -$1=="Used memory" { - split($2, data, " "); - print "USEDMEMORY=" data[1] -}; - -$1=="State" { - vstat=$2; - gsub(" ", "", vstat); - - if(vstat=="running" || - vstat=="blocked" || - vstat=="shutdown" || - vstat=="dying") - state="a"; - else if(vstat=="paused") state="p"; - else if(vstat=="crashed") state="c"; - else state="u"; - - print "STATE=" state -} -' - -deploy_id=$1 - -virsh_cmd="virsh --connect $LIBVIRT_URI --readonly dominfo $deploy_id" -awk_cmd="awk \'$AWK_SCRIPT\'" - -info=`$virsh_cmd 2>/dev/null | awk "$AWK_SCRIPT"` - -if [ -n "$info" ]; then - echo $info -else - echo STATE=d +if [ -z $ONE_LOCATION ]; then + echo "ONE_LOCATION not defined." + exit -1 fi -exit 0 + +VAR_LOCATION="$ONE_LOCATION/var" + +if [ "$(ls -A $VAR_LOCATION)" ]; then + echo "$VAR_LOCATION is not empty." + exit -1 +fi + +for j in `ls ./spec/*_spec.rb` ; do + PID=$$ + + oned -f & + sleep 2s; + + spec $j -f s + CODE=$? + + pkill -P $PID oned + sleep 2s; + pkill -9 -P $PID oned + + if [ $CODE != 0 ] ; then + exit 1 + fi + + find $VAR_LOCATION -mindepth 1 -delete +done diff --git a/src/tm_mad/lvm/tm_lvmrc b/src/tm_mad/lvm/tm_lvmrc index f90f9b133e..cd005003d1 100644 --- a/src/tm_mad/lvm/tm_lvmrc +++ b/src/tm_mad/lvm/tm_lvmrc @@ -28,7 +28,7 @@ DEFAULT_LV_SIZE="1G" # -------------------------------------------------------------------------- # function get_vid { - echo $1 |$SED -e 's%^.*/\([^/]*\)/images.*$%\1%' + echo $1 |$SED -e 's%^.*/([^/]*)/images.*$%\1%' } function get_lv_name { diff --git a/src/tm_mad/tm_common.sh b/src/tm_mad/tm_common.sh index cb087cc23e..6634c8afca 100644 --- a/src/tm_mad/tm_common.sh +++ b/src/tm_mad/tm_common.sh @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +export LANG=C + if [ -z "$ONE_LOCATION" ]; then ONE_LOCAL_VAR=/var/lib/one else diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index 2a8e71f614..bcd665b98c 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -35,6 +35,8 @@ int LibVirtDriver::deployment_description_kvm( int memory_in_kb = 0; + string emulator_path = ""; + string kernel = ""; string initrd = ""; string boot = ""; @@ -256,7 +258,14 @@ int LibVirtDriver::deployment_description_kvm( if (emulator == "kvm") { - file << "\t\t/usr/bin/kvm" << endl; + get_default("EMULATOR",emulator_path); + + if(emulator_path.empty()) + { + emulator_path = "/usr/bin/kvm"; + } + + file << "\t\t" << emulator_path << "" << endl; } get_default("DISK","DRIVER",default_driver); diff --git a/src/vmm_mad/remotes/kvm/kvmrc b/src/vmm_mad/remotes/kvm/kvmrc index 0fc5d39ddd..abe2945774 100644 --- a/src/vmm_mad/remotes/kvm/kvmrc +++ b/src/vmm_mad/remotes/kvm/kvmrc @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +export LANG=C + export LIBVIRT_URI=qemu:///system export QEMU_PROTOCOL=qemu diff --git a/src/vmm_mad/remotes/poll_ganglia.rb b/src/vmm_mad/remotes/poll_ganglia.rb new file mode 100755 index 0000000000..15981f22a0 --- /dev/null +++ b/src/vmm_mad/remotes/poll_ganglia.rb @@ -0,0 +1,82 @@ +#!/usr/bin/env ruby + +# ----------------------------------------------------------------------------- +# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# Adds current directory to the library search path (make the script +# compatible with ruby 1.9.2) +$: << '.' + +ONE_LOCATION=ENV["ONE_LOCATION"] + +if !ONE_LOCATION + RUBY_LIB_LOCATION="/usr/lib/one/ruby" +else + RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" +end + +$: << RUBY_LIB_LOCATION + +require 'socket' +require 'pp' +require 'rexml/document' +require 'Ganglia' + +############################# +## CONFIGURATION GOES HERE ## +############################# + +# host and port where to get monitoring information +GANGLIA_HOST='localhost' +GANGLIA_PORT=8649 + +# If this variable is set the the information will be read from that file +# otherwise it will get information from the ganglia endpoint +# defined previously +#GANGLIA_FILE='data.xml' + + +host=ARGV[0] +domain=ARGV[1] + +# Gets monitoring data from ganglia or file +begin + if defined?(GANGLIA_FILE) + ganglia=GangliaHost.new_from_file(host, GANGLIA_FILE) + else + ganglia=GangliaHost.new_from_ganglia(host, GANGLIA_HOST, GANGLIA_PORT) + end +rescue + STDERR.puts "Error reading ganglia data" + exit -1 +end + +doms_info=ganglia.get_vms_information +dom_id=domain.split('-').last + +# Get key one- or key from the hash +dom_info=doms_info[domain] +dom_info=doms_info[dom_id] if !dom_info + +if dom_info + info=dom_info.map do |key, value| + "#{key.to_s.upcase}=#{value}" + end.join(' ') + + puts info +end + + diff --git a/src/vmm_mad/remotes/poll_xen_kvm.rb b/src/vmm_mad/remotes/poll_xen_kvm.rb new file mode 100755 index 0000000000..8984cdb7b8 --- /dev/null +++ b/src/vmm_mad/remotes/poll_xen_kvm.rb @@ -0,0 +1,348 @@ +#!/usr/bin/env ruby + +# -------------------------------------------------------------------------- # +# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'pp' +require 'rexml/document' + +ENV['LANG']='C' + +module KVM + CONF={ + :dominfo => 'virsh --connect LIBVIRT_URI --readonly dominfo', + :list => 'virsh --connect LIBVIRT_URI --readonly list', + :dumpxml => 'virsh --connect LIBVIRT_URI --readonly dumpxml', + :domifstat => 'virsh --connect LIBVIRT_URI --readonly domifstat', + 'LIBVIRT_URI' => 'qemu:///system' + } + + def self.get_vm_info(vm_id) + if !vm_id or vm_id.empty? + STDERR.puts "VM id not specified" + return nil + end + + data=dom_info(vm_id) + + if !data + return {:STATE => 'd'} + end + + + ps_data=process_info(data['UUID']) + + + monitor=Hash.new + + monitor[:cpu]=ps_data[2] + monitor[:resident_memory]=ps_data[5].to_i + monitor[:max_memory]=data['Max memory'].split(/\s+/).first.to_i + + monitor[:memory]=[monitor[:resident_memory], monitor[:max_memory]].max + + + state=data['State'] + + + monitor[:state]=get_state(data['State']) + monitor[:cpus]=data['CPU(s)'] + + values=Hash.new + + values[:state]=monitor[:state] + values[:usedcpu]=monitor[:cpu] + values[:usedmemory]=monitor[:memory] + + values.merge!(get_interface_statistics(vm_id)) + + values + end + + def self.get_all_vm_info + names=get_vm_names + + vms=Hash.new + + names.each do |vm| + info=get_vm_info(vm) + info[:name]=vm + + vms[vm]=info + end + + vms + end + +private + + def self.virsh(command) + CONF[command].gsub('LIBVIRT_URI', CONF['LIBVIRT_URI']) + end + + def self.dom_info(vmid) + text=`#{virsh(:dominfo)} #{vmid}` + + return nil if $?.exitstatus != 0 + + lines=text.split(/\n/) + + hash=Hash.new + + data=lines.map do |line| + parts=line.split(/:\s+/) + hash[parts[0]]=parts[1] + end + + hash + end + + def self.get_vm_names + text=`#{virsh(:list)}` + + return [] if $?.exitstatus != 0 + + lines=text.split(/\n/)[2..-1] + + lines.map do |line| + line.split(/\s+/)[1] + end + end + + def self.get_interface_names(vmid) + text=`#{virsh(:dumpxml)} #{vmid}` + + doc=REXML::Document.new(text) + interfaces = [] + doc.elements.each('domain/devices/interface/target') do |ele| + interfaces << ele.attributes["dev"] + end + + interfaces + end + + def self.get_interface_statistics(vmid) + interfaces=get_interface_names(vmid) + + if interfaces && !interfaces.empty? + text=`#{virsh(:domifstat)} #{vmid} #{interfaces.join(' ')}` + + values={} + + text.each_line do |line| + columns=line.split(/\s+/) + case columns[1] + when 'rx_bytes' + values[:netrx]=columns[2] + when 'tx_bytes' + values[:nettx]=columns[2] + end + end + + values + else + {} + end + end + + def self.process_info(uuid) + ps=`ps auxwww | grep -- '-uuid #{uuid}' | grep -v grep` + ps.split(/\s+/) + end + + def self.get_state(state) + case state.gsub('-', '') + when *%w{running blocked shutdown dying idle} + 'a' + when 'paused' + 'p' + when 'crashed' + 'e' + else + '-' + end + end +end + +module XEN + CONF={ + 'XM_POLL' => 'sudo /usr/sbin/xentop -bi2' + } + + def self.get_vm_info(vm_id) + data = get_all_vm_info[vm_id] + + if !data + return {:STATE => 'd'} + else + return data + end + end + + def self.get_all_vm_info + begin + text=`#{CONF['XM_POLL']}` + lines=text.strip.split("\n") + block_size=lines.length/2 + valid_lines=lines.last(block_size) + + domain_lines=valid_lines[4..-1] + + domains=Hash.new + + domain_lines.each do |dom| + dom_data=dom.gsub('no limit', 'no-limit').strip.split + + dom_hash=Hash.new + + dom_hash[:name]=dom_data[0] + dom_hash[:state]=get_state(dom_data[1]) + dom_hash[:usedcpu]=dom_data[3] + dom_hash[:usedmemory]=dom_data[4] + dom_hash[:nettx]=dom_data[10] + dom_hash[:netrx]=dom_data[11] + + domains[dom_hash[:name]]=dom_hash + end + + domains + rescue + STDERR.puts "Error executing #{CONF['XM_POLL']}" + nil + end + end + + def self.get_state(state) + case state.gsub('-', '')[-1..-1] + when *%w{r b s d} + 'a' + when 'p' + 'p' + when 'c' + 'e' + else + '-' + end + end +end + + +def select_hypervisor + hypervisor=nil + params=ARGV.clone + + params.each_with_index do |param, index| + case param + when '--kvm' + hypervisor=KVM + ARGV.delete_at(index) + when '--xen' + hypervisor=XEN + ARGV.delete_at(index) + end + end + + if !hypervisor + case $0 + when %r{/vmm\/kvm/} + hypervisor=KVM + when %r{/vmm\/xen/} + hypervisor=XEN + end + end + + hypervisor +end + +def load_vars(hypervisor) + case hypervisor.name + when 'XEN' + file='xenrc' + vars=%w{XM_POLL} + when 'KVM' + file='kvmrc' + vars=%w{LIBVIRT_URI} + else + return + end + +begin + env=`. #{File.dirname($0)+"/#{file}"};env` + + lines=env.split("\n") + vars.each do |var| + lines.each do |line| + if a=line.match(/^(#{var})=(.*)$/) + hypervisor::CONF[var]=a[2] + break + end + end + end +rescue +end +end + + +def print_data(name, value) + if value + "#{name.to_s.upcase}=#{value}" + else + nil + end +end + + + +def print_one_vm_info(hypervisor, vm_id) + info=hypervisor.get_vm_info(vm_id) + + exit(-1) if !info + + #info.merge!(get_interface_statistics(vm_id)) + + values=info.map do |key, value| + print_data(key, value) + end + + puts values.zip.join(' ') +end + +def print_all_vm_info(hypervisor) + require 'yaml' + require 'base64' + + vms=hypervisor.get_all_vm_info + + puts Base64.encode64(vms.to_yaml).delete("\n") +end + +hypervisor=select_hypervisor + +if !hypervisor + STDERR.puts "Could not detect hypervisor" + exit(-1) +end + +load_vars(hypervisor) + +vm_id=ARGV[0] + +if vm_id + print_one_vm_info(hypervisor, vm_id) +else + print_all_vm_info(hypervisor) +end + diff --git a/src/vmm_mad/remotes/xen/xenrc b/src/vmm_mad/remotes/xen/xenrc index 0715fac7e3..6ce17b0c7a 100644 --- a/src/vmm_mad/remotes/xen/xenrc +++ b/src/vmm_mad/remotes/xen/xenrc @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +export LANG=C + export XM_PATH="/usr/sbin/xm" export XM_CANCEL="sudo $XM_PATH destroy" export XM_CREATE="sudo $XM_PATH create" diff --git a/src/vmm_mad/ssh/vmm_ssh_kvm.conf b/src/vmm_mad/ssh/vmm_ssh_kvm.conf index fc11a10ca9..5ed8ac0a79 100644 --- a/src/vmm_mad/ssh/vmm_ssh_kvm.conf +++ b/src/vmm_mad/ssh/vmm_ssh_kvm.conf @@ -1,15 +1,19 @@ # Default configuration attributes for the KVM driver -# (all domains will use these values as defaults) -# Valid atributes are: +# (all domains will use these values as defaults). These values can +# be overridden in each VM template. Valid atributes are: +# - emulator # - os [kernel,initrd,boot,root,kernel_cmd,arch] # - memory # - cpu # - vcpu # - features [acpi, pae] -# - disk [driver ] +# - disk [driver ]A + +#EMULATOR = /usr/libexec/qemu-kvm #VCPU = 1 #MEMORY = 128 + OS = [ boot = "hd", arch = "i686" ] FEATURES = [ PAE = "no", ACPI = "yes" ] diff --git a/src/vmm_mad/ssh/vmm_ssh_xen.conf b/src/vmm_mad/ssh/vmm_ssh_xen.conf index 8d41b2770b..96267f44dd 100644 --- a/src/vmm_mad/ssh/vmm_ssh_xen.conf +++ b/src/vmm_mad/ssh/vmm_ssh_xen.conf @@ -1,6 +1,6 @@ # Default configuration attributes for the Xen driver -# (all domains will use these values as defaults) -# Valid atributes: +# (all domains will use these values as defaults). These values can +# be overridden in each VM template. Valid atributes are: # - credit # - os [kernel,initrd,root,kernel_cmd] # - memory