From: felix Date: Sun, 17 Jun 2007 13:29:51 +0000 (+0000) Subject: Erste Version X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e9d08564e9945c026a3b7b55d3e8099cf04b645a;p=bytewurf.git Erste Version git-svn-id: https://www.internetallee.de/svn/bytewurf@49 a944a559-bf0e-0410-8ddc-85264b264b6c --- diff --git a/projekte/MDB/.classpath b/projekte/MDB/.classpath new file mode 100644 index 0000000..b0cfddf --- /dev/null +++ b/projekte/MDB/.classpath @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projekte/MDB/.project b/projekte/MDB/.project new file mode 100644 index 0000000..b4345d5 --- /dev/null +++ b/projekte/MDB/.project @@ -0,0 +1,23 @@ + + + MDB + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.codehaus.groovy.eclipse.groovyBuilder + + + + + + org.eclipse.jdt.core.javanature + org.codehaus.groovy.eclipse.groovyNature + + diff --git a/projekte/MDB/MDB.launch b/projekte/MDB/MDB.launch new file mode 100644 index 0000000..8b61fac --- /dev/null +++ b/projekte/MDB/MDB.launch @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/projekte/MDB/application.properties b/projekte/MDB/application.properties new file mode 100644 index 0000000..60834e9 --- /dev/null +++ b/projekte/MDB/application.properties @@ -0,0 +1,4 @@ +#Do not edit app.grails.* properties, they may change automatically. DO NOT put application configuration in here, it is not the right place! +#Sat Jun 09 12:00:15 CEST 2007 +app.grails.version=0.5 +app.name=MDB diff --git a/projekte/MDB/bin/ApplicationBootStrap.groovy b/projekte/MDB/bin/ApplicationBootStrap.groovy new file mode 100644 index 0000000..83c5684 --- /dev/null +++ b/projekte/MDB/bin/ApplicationBootStrap.groovy @@ -0,0 +1,13 @@ +class ApplicationBootStrap { + + def init = { servletContext -> + new Partei(name:'CDU').save() + new Partei(name:'FDP').save() + new Partei(name:'SPD').save() + new Wahlkreis(ort:'Bonn-Beuel').save() + new Wahlkreis(ort:'Bonn').save() + new Wahlkreis(ort:'Neuss').save() + } + def destroy = { + } +} diff --git a/projekte/MDB/bin/ApplicationDataSource.groovy b/projekte/MDB/bin/ApplicationDataSource.groovy new file mode 100644 index 0000000..71ac60a --- /dev/null +++ b/projekte/MDB/bin/ApplicationDataSource.groovy @@ -0,0 +1,8 @@ +class ApplicationDataSource { + boolean pooling = true + String dbCreate = "create-drop" // one of 'create', 'create-drop','update' + String url = "jdbc:hsqldb:mem:testDB" + String driverClassName = "org.hsqldb.jdbcDriver" + String username = "sa" + String password = "" +} diff --git a/projekte/MDB/bin/ApplicationTagLib.groovy b/projekte/MDB/bin/ApplicationTagLib.groovy new file mode 100644 index 0000000..02b499d --- /dev/null +++ b/projekte/MDB/bin/ApplicationTagLib.groovy @@ -0,0 +1,132 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * The base application tag library for Grails many of which take inspiration from Rails helpers (thanks guys! :) + * This tag library tends to get extended by others as tags within here can be re-used in said libraries + * + * @author Graeme Rocher + * @since 17-Jan-2006 + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + +class ApplicationTagLib { + /** + * Creates a link to a resource, generally used as a method rather than a tag. + * + * eg. + */ + @Property createLinkTo = { attrs -> + out << grailsAttributes.getApplicationUri(request) + if(attrs['dir']) { + out << "/${attrs['dir']}" + } + if(attrs['file']) { + out << "/${attrs['file']}" + } + } + + /** + * General linking to controllers, actions etc. Examples: + * + * link 1 + * link 2 + */ + @Property link = { attrs, body -> + out << " + out << k << "=\"" << v << "\" " + } + out << ">" + // output the body + body() + + // close tag + out << "" + } + + + /** + * Creates a grails application link from a set of attributes. This + * link can then be included in links, ajax calls etc. Generally used as a method call + * rather than a tag eg. + * + * List + */ + @Property createLink = { attrs -> + out << grailsAttributes.getApplicationUri(request) + // prefer a URL attribute + if(attrs['url']) { + attrs = attrs.remove('url') + } + // if the current attribute null set the controller uri to the current controller + if(attrs["controller"]) { + out << '/' << attrs.remove("controller") + } + else { + out << grailsAttributes.getControllerUri(request) + } + if(attrs["action"]) { + out << '/' << attrs.remove("action") + } + if(attrs["id"]) { + out << '/' << attrs.remove("id") + } + if(attrs['params']) { + def pms = attrs.remove('params') + out << '?' + def i = 0 + pms.each { k,v -> + out << "${k}=${v}" + if(++i < pms.size()) + out << '&' + } + } + } + + /** + * Helper method for creating tags called like: + * + * withTag(name:'script',attrs:[type:'text/javascript']) { + * + * } + */ + @Property withTag = { attrs, body -> + out << "<${attrs.name}" + if(attrs.attrs) { + attrs.attrs.each{ k,v -> + if(v instanceof Closure) { + out << " $k=\"" + v() + out << '"' + } + else { + out << " $k=\"$v\"" + } + } + } + out << '>' + body() + out << "" + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/FormTagLib.groovy b/projekte/MDB/bin/FormTagLib.groovy new file mode 100644 index 0000000..d6433ff --- /dev/null +++ b/projekte/MDB/bin/FormTagLib.groovy @@ -0,0 +1,340 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + + /** + * A tag lib that provides tags for working with form controls + * + * @author Graeme Rocher + * @since 17-Jan-2006 + */ + +class FormTagLib { + /** + * General linking to controllers, actions etc. Examples: + * + * ... + * ... + */ + @Property form = { attrs, body -> + out << "
+ + out << k << "=\"" << v << "\" " + } + out << ">" + // output the body + body() + + // close tag + out << "
" + } + /** + * Creates a submit button that submits to an action in the controller specified by the form action + * The value of the action attribute is translated into the action name, for example "Edit" becomes + * "edit" or "List People" becomes "listPeople" + * + * + * + */ + @Property actionSubmit = { attrs -> + out << ' + out << k << "=\"" << v << "\" " + } + // close tag + out.println '/>' + + } + /** + * A simple date picker that renders a date as selects + * eg. + */ + @Property datePicker = { attrs -> + def value = (attrs['value'] ? attrs['value'] : new Date()) + def name = attrs['name'] + def c = null + if(value instanceof Calendar) { + c = value + } + else { + c = new GregorianCalendar(); + c.setTime(value) + } + def day = c.get(GregorianCalendar.DAY_OF_MONTH) + def month = c.get(GregorianCalendar.MONTH) + def year = c.get(GregorianCalendar.YEAR) + def hour = c.get(GregorianCalendar.HOUR_OF_DAY) + def minute = c.get(GregorianCalendar.MINUTE) + def dfs = new java.text.DateFormatSymbols(RCU.getLocale(request)) + + + out << "" + + // create day select + out.println "' + // create month select + out.println "' + // create year select + out.println "' + // do hour select + out.println " :' + + // do minute select + out.println "' + } + + /** + * A helper tag for creating TimeZone selects + * eg. + */ + @Property timeZoneSelect = { attrs -> + attrs['from'] = TimeZone.getAvailableIDs(); + attrs['value'] = (attrs['value'] ? attrs['value'].ID : TimeZone.getDefault().ID ) + + // set the option value as a closure that formats the TimeZone for display + attrs['optionValue'] = { + TimeZone tz = TimeZone.getTimeZone(it); + def shortName = tz.getDisplayName(tz.inDaylightTime(date),TimeZone.SHORT); + def longName = tz.getDisplayName(tz.inDaylightTime(date),TimeZone.LONG); + + def offset = tz.rawOffset; + def hour = offset / (60*60*1000); + def min = Math.abs(offset / (60*1000)) % 60; + + return "${shortName}, ${longName} ${hour}:${min}" + } + + // use generic select + select( attrs ) + } + + /** + * A helper tag for creating locale selects + * + * eg. + */ + @Property localeSelect = {attrs -> + attrs['from'] = Locale.getAvailableLocales() + attrs['value'] = (attrs['value'] ? attrs['value'] : RCU.getLocale(request) ) + // set the key as a closure that formats the locale + attrs['optionKey'] = { "${it.language}_${it.country}" } + // set the option value as a closure that formats the locale for display + attrs['optionValue'] = { "${it.language}, ${it.country}, ${it.displayName}" } + + // use generic select + select( attrs ) + } + + /** + * A helper tag for creating currency selects + * + * eg. + */ + @Property currencySelect = { attrs, body -> + if(!attrs['from']) { + attrs['from'] = ['EUR', 'XCD','USD','XOF','NOK','AUD','XAF','NZD','MAD','DKK','GBP','CHF','XPF','ILS','ROL','TRL'] + } + def currency = (attrs['value'] ? attrs['value'] : Currency.getInstance( RCU.getLocale(request) )) + attrs['value'] = currency.currencyCode + // invoke generic select + select( attrs ) + } + + /** + * A helper tag for creating HTML selects + * + * Examples: + * + * + */ + @Property select = { attrs -> + def from = attrs.remove('from') + def keys = attrs.remove('keys') + def optionKey = attrs.remove('optionKey') + def optionValue = attrs.remove('optionValue') + def value = attrs.remove('value') + + out << "' + } + + /** + * A helper tag for creating checkboxes + **/ + @Property checkBox = { attrs -> + def value = attrs.remove('value') + def name = attrs.remove('name') + if(!value) value = false + out << '" + out << ' + out << k << "=\"" << v << "\" " + } + // close the tag, with no body + out << ' />' + + } + + /** + * A helper tag for creating radio buttons + */ + @Property radio = { attrs -> + def value = attrs.remove('value') + def name = attrs.remove('name') + def checked = (attrs.remove('checked') ? true : false) + out << ' + out << k << "=\"" << v << "\" " + } + // close the tag, with no body + out << ' >' + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/JavascriptTagLib.groovy b/projekte/MDB/bin/JavascriptTagLib.groovy new file mode 100644 index 0000000..d5f6239 --- /dev/null +++ b/projekte/MDB/bin/JavascriptTagLib.groovy @@ -0,0 +1,454 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + + /** + * A tag lib that provides tags for developing javascript and ajax applications + * + * @author Graeme Rocher + * @since 17-Jan-2006 + */ +class JavascriptTagLib { + + /** + * Mappings to the relevant files to be included for each library + */ + static final INCLUDED_LIBRARIES = "org.codehaus.grails.INCLUDED_JS_LIBRARIES" + static final INCLUDED_JS = "org.codehaus.grails.INCLUDED_JS" + static final LIBRARY_MAPPINGS = [ + prototype : ['prototype/prototype'], + yahoo : [ 'yahoo/yahoo-min','yahoo/connection-min', 'yahoo/dom-min','yahoo/event-min','yahoo/animation-min'], + dojo : [ 'dojo/dojo'] + ] + + static { + LIBRARY_MAPPINGS.scriptaculous = LIBRARY_MAPPINGS.prototype + ['prototype/scriptaculous','prototype/builder','prototype/controls','prototype/effects','prototype/slider','prototype/draganddrop'] + LIBRARY_MAPPINGS.rico = LIBRARY_MAPPINGS.prototype + ['prototype/rico'] + } + /** + * Includes a javascript src file, library or inline script + * if the tag has no 'src' or 'library' attributes its assumed to be an inline script: + * + * alert('hello') + * + * The 'library' attribute will attempt to use the library mappings defined above to import the + * right js files and not duplicate imports eg. + * + * // imports all the necessary js for the scriptaculous library + * + * The 'src' attribute will merely import the js file but within the right context (ie inside the /js/ directory of + * the Grails application: + * + * // actually imports '/app/js/myscript.js' + **/ + @Property javascript = { attrs, body -> + if(!request[INCLUDED_JS]) request[INCLUDED_JS] = [] + if(!request[INCLUDED_LIBRARIES]) request[INCLUDED_LIBRARIES] = [] + + if(attrs.src) { + out << '' + } + else if(attrs.library) { + + if(LIBRARY_MAPPINGS.containsKey(attrs.library)) { + if(!request[INCLUDED_LIBRARIES].contains(attrs.library)) { + LIBRARY_MAPPINGS[attrs.library].each { + if(!request[INCLUDED_JS].contains(it)) { + request[INCLUDED_JS] << it + out << '' + } + } + request[INCLUDED_LIBRARIES] << attrs.library + } + } + else { + if(!request[INCLUDED_LIBRARIES].contains(attrs.library)) { + out << '' + request[INCLUDED_LIBRARIES] << attrs.library + request[INCLUDED_JS] << attrs.library + } + } + } + else { + out.println '' + } + } + /** + * Creates a remote function call using the prototype library + */ + @Property remoteFunction = { attrs -> + // before remote function + def after = '' + if(attrs["before"]) + out << "${attrs.remove('before')};" + if(attrs["after"]) + after = "${attrs.remove('after')};" + + def p = getProvider() + p.doRemoteFunction(owner,attrs,out) + attrs.remove('update') + // after remote function + if(after) + out << after + } + + /** + * A link to a remote uri that used the prototype library to invoke the link via ajax + */ + @Property remoteLink = { attrs, body -> + out << " + out << k << "=\"" << v << "\" " + } + out << ">" + // output the body + body() + + // close tag + out << "" + } + + /** + * A form which used prototype to serialize its parameters and submit via an asynchronous ajax call + */ + @Property formRemote = { attrs, body -> + if(!attrs.name) { + throwTagError("Tag [formRemote] is missing required attribute [name]") + } + if(!attrs.url) { + throwTagError("Tag [formRemote] is missing required attribute [url]") + } + + // get javascript provider + def p = getProvider() + def url = attrs.url.clone() + + // prepare form settings + prepareAjaxForm(p,attrs) + + def params = [ onsubmit:TagLibUtil.outToString(remoteFunction,attrs) + 'return false', + method: (attrs.method? attrs.method : 'POST' ), + action: (attrs.action? attrs.action : TagLibUtil.outToString(createLink,url)) + ] + attrs.remove('url') + params.putAll(attrs) + withTag(name:'form',attrs:params) { + body() + } + } + + /** + * Creates a form submit button that submits the current form to a remote ajax call + */ + @Property submitToRemote = { attrs, body -> + // get javascript provider + def p = getProvider() + // prepare form settings + prepareAjaxForm(p,attrs) + def params = [ onclick:TagLibUtil.outToString(remoteFunction,attrs) + 'return false', + type: 'button', + name: attrs.remove('name'), + value: attrs.remove('value'), + ] + + withTag(name:'input', attrs:params) { + body() + } + } + + private prepareAjaxForm(provider,attrs) { + if(provider instanceof PrototypeProvider) { + attrs.params = "Form.serialize(this)" + } + else if(provider instanceof YahooProvider) { + if(attrs.before) { + attrs.before += ";YAHOO.util.Connect.setForm('${attrs.name}')" + } + else { + attrs.before = "YAHOO.util.Connect.setForm('${attrs.name}')" + } + } + else if(provider instanceof DojoProvider) { + if(attrs.params) attrs.params.formNode = "dojo.byId('${attrs.name}')" + else { + attrs.params = [formNode:"dojo.byId('${attrs.name}')"] + } + } + } + /** + * Escapes a javasacript string replacing single/double quotes and new lines + * + * This is some "text" to be escaped + */ + @Property escapeJavascript = { attrs,body -> + def js = '' + if(body instanceof Closure) { + def tmp = out + def sw = new StringWriter() + out = new PrintWriter(out) + // invoke body + body() + // restore out + out = tmp + js = sw.toString() + + } + else if(body instanceof String) { + js = body + } + else if(attrs instanceof String) { + js = attrs + } + out << js.replaceAll(/\r\n|\n|\r/, '\\\\n') + .replaceAll("[\"']",{ (it[0] == '"'? '\\"' : "\\'") } ) + } + + /** + * Returns the provider of the necessary function calls to perform Javascript functions + * + **/ + private JavascriptProvider getProvider() { + if(request[JavascriptTagLib.INCLUDED_LIBRARIES]?.contains('yahoo')) { + return new YahooProvider() + } + else if(request[JavascriptTagLib.INCLUDED_LIBRARIES]?.contains('dojo')) { + return new DojoProvider() + } + else { + return new PrototypeProvider() + } + } +} +/** + * Interface defining methods that a JavaScript provider should implement + * + * @author Graeme Rocher + **/ +interface JavascriptProvider { + /** + * Creates a remote function call + * + * @param The attributes to use + * @param The output to write to + */ + def doRemoteFunction(taglib,attrs, out) +} + +/** + * Prototype implementation of JavaScript provider + * + * @author Graeme Rocher + */ +class PrototypeProvider implements JavascriptProvider { + def doRemoteFunction(taglib,attrs, out) { + out << 'new Ajax.' + if(attrs.update) { + out << 'Updater(' + if(attrs.update instanceof Map) { + out << "{" + def update = [] + if(attrs.update?.success) { + update << "success:'${attrs['update']['success']}'" + } + if(attrs.update?.failure) { + update << "failure:'${attrs['update']['failure']}'" + } + out << update.join(',') + out << "}," + } + else { + out << "'" << attrs.update << "'," + } + attrs.remove("update") + } + else { + out << "Request(" + } + out << "'" + + if(attrs.url) { + taglib.createLink(attrs.url) + } + else { + taglib.createLink(attrs) + } + + out << "'," + + // process options + out << getAjaxOptions(attrs) + // close + out << ');' + } + + // helper function to build ajax options + def getAjaxOptions(options) { + def ajaxOptions = [] + + if(options) { + // process callbacks + def callbacks = options.findAll { k,v -> + k ==~ /on(\p{Upper}|\d){1}\w+/ + } + callbacks.each { k,v -> + ajaxOptions << "${k}:function(e){${v}}" + options.remove(k) + } + + // necessary defaults + if(options['asynchronous']) + ajaxOptions << "asynchronous:${options.remove('asynchronous')}" + else + ajaxOptions << "asynchronous:true" + + + if(options['evalScripts']) + ajaxOptions << "evalScripts:${options.remove('evalScripts')}" + else + ajaxOptions << "evalScripts:true" + + if(options.params) { + ajaxOptions << "parameters:${options.remove('params')}" + } + // remaining options + options.each { k, v -> + if(k!='url') { + switch(v) { + case 'true': ajaxOptions << "${k}:${v}"; break; + case 'false': ajaxOptions << "${k}:${v}"; break; + case ~/\s*function(\w*)\s*/: ajaxOptions << "${k}:${v}"; break; + default:ajaxOptions << "${k}:'${v}'"; break; + } + } + } + } + // set defaults + else { + ajaxOptions << "asynchronous:true" + ajaxOptions << "evalScripts:true" + } + + return "{${ajaxOptions.join(',')}}" + } + +} + +/** + * A implementation for the Yahoo library + * + * @author Graeme Rocher + **/ +class YahooProvider implements JavascriptProvider { + def doRemoteFunction(taglib,attrs, out) { + def method = (attrs.method ? attrs.method : 'GET' ) + out << "YAHOO.util.Connect.asyncRequest('${method}','" + + if(attrs.url) { + taglib.createLink(attrs.url) + } + else { + taglib.createLink(attrs) + } + + out << "'," + buildYahooCallback(attrs,out) + out << ',null);' + } + + + // helper method to create yahoo callback object + def buildYahooCallback(attrs,out) { + out << '{ ' + if(attrs.update) { + out <<'success: function(o) { ' + if(attrs.update instanceof Map) { + if(attrs.update.success) { + out << "YAHOO.util.Dom.get('${attrs.update.success}').innerHTML = o.responseText;" + } + } + else { + out << "YAHOO.util.Dom.get('${attrs.update}').innerHTML = o.responseText;" + } + if(attrs.onSuccess) { + out << ";${attrs.onSuccess}(o);" + } + out << ' }' + out << ', failure: function(o) {' + if(attrs.update instanceof Map) { + if(attrs.update.failure) { + out << "YAHOO.util.Dom.get('${attrs.update.failure}').innerHTML = o.statusText;" + } + } + if(attrs.onFailure) { + out << "${attrs.onFailure}(o);" + } + out << '}' + } + out << '}' + } +} +/** + * An implementation for the Dojo javascript library + * + * @author Graeme Rocher + */ +class DojoProvider implements JavascriptProvider { + def doRemoteFunction(taglib,attrs, out) { + out << 'dojo.io.bind({url:\'' + taglib.createLink(attrs) + out << '\',load:function(type,data,evt) {' + if(attrs.update) { + out << 'dojo.html.textContent( dojo.byId(\'' + out << (attrs.update instanceof Map ? attrs.update.success : attrs.update) + out << '\'),data);' + } + if(attrs.onSuccess) { + out << ";${attrs.onSuccess}(type,data,evt);" + } + out << '}' + out << ',error:function(type,error) { ' + if(attrs.update instanceof Map) { + if(attrs.update.failure) { + out << "dojo.html.textContent( dojo.byId('${attrs.update.failure}'),error.message);" + } + } + if(attrs.onFailure) { + out << ";${attrs.onFailure}(type,error.message);" + } + out << '}' + attrs.params?.each {k,v -> + out << ",$k:$v" + } + out << '});' + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/Listenplatz.groovy b/projekte/MDB/bin/Listenplatz.groovy new file mode 100644 index 0000000..2139366 --- /dev/null +++ b/projekte/MDB/bin/Listenplatz.groovy @@ -0,0 +1,11 @@ +class Listenplatz { + def Long id + def Long version + def Integer position + def Person person + def Wahlkreisliste wahlkreisliste + + def String toString() { "${this.class.name} : $id $position auf $wahlkreisliste" } + + def belongsTo = [Person, Wahlkreisliste] +} diff --git a/projekte/MDB/bin/ListenplatzController.groovy b/projekte/MDB/bin/ListenplatzController.groovy new file mode 100644 index 0000000..6cc0e5f --- /dev/null +++ b/projekte/MDB/bin/ListenplatzController.groovy @@ -0,0 +1,73 @@ + + +class ListenplatzController { + def index = { redirect(action:list,params:params) } + + def list = { + [ listenplatzList: Listenplatz.list( params ) ] + } + + def show = { + [ listenplatz : Listenplatz.get( params.id ) ] + } + + def delete = { + def listenplatz = Listenplatz.get( params.id ) + if(listenplatz) { + listenplatz.delete() + flash.message = "Listenplatz ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Listenplatz not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def listenplatz = Listenplatz.get( params.id ) + + if(!listenplatz) { + flash.message = "Listenplatz not found with id ${params.id}" + redirect(action:list) + } + else { + return [ listenplatz : listenplatz ] + } + } + + def update = { + def listenplatz = Listenplatz.get( params.id ) + if(listenplatz) { + listenplatz.properties = params + if(listenplatz.save()) { + redirect(action:show,id:listenplatz.id) + } + else { + render(view:'edit',model:[listenplatz:listenplatz]) + } + } + else { + flash.message = "Listenplatz not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def listenplatz = new Listenplatz() + listenplatz.properties = params + return ['listenplatz':listenplatz] + } + + def save = { + def listenplatz = new Listenplatz() + listenplatz.properties = params + if(listenplatz.save()) { + redirect(action:show,id:listenplatz.id) + } + else { + render(view:'create',model:[listenplatz:listenplatz]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/bin/Partei.groovy b/projekte/MDB/bin/Partei.groovy new file mode 100644 index 0000000..74fddca --- /dev/null +++ b/projekte/MDB/bin/Partei.groovy @@ -0,0 +1,10 @@ +class Partei { + Long id + Long version + String name + def relatesToMany = [ mitglieder: Parteimitgliedschaft ] + def Set mitglieder = new HashSet() + + String toString() { "$name (${mitglieder.size()}" } + +} diff --git a/projekte/MDB/bin/ParteiController.groovy b/projekte/MDB/bin/ParteiController.groovy new file mode 100644 index 0000000..19987a8 --- /dev/null +++ b/projekte/MDB/bin/ParteiController.groovy @@ -0,0 +1,73 @@ + + +class ParteiController { + def index = { redirect(action:list,params:params) } + + def list = { + [ parteiList: Partei.list( params ) ] + } + + def show = { + [ partei : Partei.get( params.id ) ] + } + + def delete = { + def partei = Partei.get( params.id ) + if(partei) { + partei.delete() + flash.message = "Partei ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Partei not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def partei = Partei.get( params.id ) + + if(!partei) { + flash.message = "Partei not found with id ${params.id}" + redirect(action:list) + } + else { + return [ partei : partei ] + } + } + + def update = { + def partei = Partei.get( params.id ) + if(partei) { + partei.properties = params + if(partei.save()) { + redirect(action:show,id:partei.id) + } + else { + render(view:'edit',model:[partei:partei]) + } + } + else { + flash.message = "Partei not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def partei = new Partei() + partei.properties = params + return ['partei':partei] + } + + def save = { + def partei = new Partei() + partei.properties = params + if(partei.save()) { + redirect(action:show,id:partei.id) + } + else { + render(view:'create',model:[partei:partei]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/bin/Parteimitgliedschaft.groovy b/projekte/MDB/bin/Parteimitgliedschaft.groovy new file mode 100644 index 0000000..1bc7dda --- /dev/null +++ b/projekte/MDB/bin/Parteimitgliedschaft.groovy @@ -0,0 +1,12 @@ +class Parteimitgliedschaft { + Long id + Long version + def belongsTo = [ Partei, Person] + def Person person + def Partei partei + def Date von + def Date bis + + String toString() { "${partei} $von - $bis" } + +} diff --git a/projekte/MDB/bin/ParteimitgliedschaftController.groovy b/projekte/MDB/bin/ParteimitgliedschaftController.groovy new file mode 100644 index 0000000..f7d55bd --- /dev/null +++ b/projekte/MDB/bin/ParteimitgliedschaftController.groovy @@ -0,0 +1,73 @@ + + +class ParteimitgliedschaftController { + def index = { redirect(action:list,params:params) } + + def list = { + [ parteimitgliedschaftList: Parteimitgliedschaft.list( params ) ] + } + + def show = { + [ parteimitgliedschaft : Parteimitgliedschaft.get( params.id ) ] + } + + def delete = { + def parteimitgliedschaft = Parteimitgliedschaft.get( params.id ) + if(parteimitgliedschaft) { + parteimitgliedschaft.delete() + flash.message = "Parteimitgliedschaft ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Parteimitgliedschaft not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def parteimitgliedschaft = Parteimitgliedschaft.get( params.id ) + + if(!parteimitgliedschaft) { + flash.message = "Parteimitgliedschaft not found with id ${params.id}" + redirect(action:list) + } + else { + return [ parteimitgliedschaft : parteimitgliedschaft ] + } + } + + def update = { + def parteimitgliedschaft = Parteimitgliedschaft.get( params.id ) + if(parteimitgliedschaft) { + parteimitgliedschaft.properties = params + if(parteimitgliedschaft.save()) { + redirect(action:show,id:parteimitgliedschaft.id) + } + else { + render(view:'edit',model:[parteimitgliedschaft:parteimitgliedschaft]) + } + } + else { + flash.message = "Parteimitgliedschaft not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def parteimitgliedschaft = new Parteimitgliedschaft() + parteimitgliedschaft.properties = params + return ['parteimitgliedschaft':parteimitgliedschaft] + } + + def save = { + def parteimitgliedschaft = new Parteimitgliedschaft() + parteimitgliedschaft.properties = params + if(parteimitgliedschaft.save()) { + redirect(action:show,id:parteimitgliedschaft.id) + } + else { + render(view:'create',model:[parteimitgliedschaft:parteimitgliedschaft]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/bin/Person.groovy b/projekte/MDB/bin/Person.groovy new file mode 100644 index 0000000..af2f5cd --- /dev/null +++ b/projekte/MDB/bin/Person.groovy @@ -0,0 +1,29 @@ +class Person { + Long id + Long version + String nachname; + String vorname; + String titel; + String geburtsort; + Date geburtsdatum; + String sterbeort; + Date sterbedatum; + + def constraints = { + nachname() + vorname() + titel() + geburtsdatum() + geburtsort() + sterbedatum() + sterbeort() + } + + def relatesToMany = [ listenplaetze: Listenplatz, mitgliedschaften: Parteimitgliedschaft ] + + Set listenplaetze = new HashSet() + Set mitgliedschaften = new HashSet() + + String toString() { "$nachname, $titel $vorname" } + +} diff --git a/projekte/MDB/bin/PersonController.groovy b/projekte/MDB/bin/PersonController.groovy new file mode 100644 index 0000000..0b525be --- /dev/null +++ b/projekte/MDB/bin/PersonController.groovy @@ -0,0 +1,73 @@ + + +class PersonController { + def index = { redirect(action:list,params:params) } + + def list = { + [ personList: Person.list( params ) ] + } + + def show = { + [ person : Person.get( params.id ) ] + } + + def delete = { + def person = Person.get( params.id ) + if(person) { + person.delete() + flash.message = "Person ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Person not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def person = Person.get( params.id ) + + if(!person) { + flash.message = "Person not found with id ${params.id}" + redirect(action:list) + } + else { + return [ person : person ] + } + } + + def update = { + def person = Person.get( params.id ) + if(person) { + person.properties = params + if(person.save()) { + redirect(action:show,id:person.id) + } + else { + render(view:'edit',model:[person:person]) + } + } + else { + flash.message = "Person not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def person = new Person() + person.properties = params + return ['person':person] + } + + def save = { + def person = new Person() + person.properties = params + if(person.save()) { + redirect(action:show,id:person.id) + } + else { + render(view:'create',model:[person:person]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/bin/RenderTagLib.groovy b/projekte/MDB/bin/RenderTagLib.groovy new file mode 100644 index 0000000..1c62386 --- /dev/null +++ b/projekte/MDB/bin/RenderTagLib.groovy @@ -0,0 +1,295 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * An tag library that contains tags to help rendering of views and layouts + * + * @author Graeme Rocher + * @since 17-Jan-2006 + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + +class RenderTagLib implements com.opensymphony.module.sitemesh.RequestConstants { + + protected getPage() { + return request[PAGE] + } + + /** + * Used to retrieve a property of the decorated page + * + * + */ + def pageProperty = { attrs -> + if(!attrs.name) { + throwTagError("Tag [pageProperty] is missing required attribute [name]") + } + + def htmlPage = getPage() + + String propertyValue = htmlPage.getProperty(attrs.name) + + if (!propertyValue) + propertyValue = attrs.'default'; + + if (propertyValue) { + if (attrs.writeEntireProperty) { + out << ' ' + out << propertyName.substring(propertyName.lastIndexOf('.') + 1) + out << "=\"${propertyValue}\"" + } + else { + out << propertyValue + } + } + } + + /** + * Invokes the body of this tag if the page property exists: + * + * body to invoke + * + * of it equals a certain value: + * + *body to invoke + */ + def ifPageProperty = { attrs, body -> + if(attrs.name) { + def htmlPage = getPage() + def names = ((attrs.name instanceof List) ? attrs.name : [attrs.name]) + + + def invokeBody = true + for(i in 0.. + */ + def layoutTitle = { attrs -> + String title = page.title + if (!title && attrs.'default') title = attrs.'default' + if (title) out << title; + } + + /** + * Used in layouts to render the body of a SiteMesh layout + * + * + */ + def layoutBody = { attrs -> + getPage().writeBody(out) + } + + /** + * Used in layouts to render the head of a SiteMesh layout + * + * + */ + def layoutHead = { attrs -> + getPage().writeHead(out) + } + + + /** + * Creates next/previous links to support pagination for the current controller + * + * + */ + def paginate = { attrs -> + if(attrs.total == null) + throwTagError("Tag [paginate] is missing required attribute [total]") + + def mkp = new groovy.xml.MarkupBuilder(out) + def total = attrs.total.toInteger() + def max = params.max?.toInteger() + def offset = params.offset?.toInteger() + def action = (attrs.action? attrs.action : 'list') + def breadcrumb = true + if(attrs.breadcrumb) breadcrumb = Boolean.valueOf(attrs.breadcrumb) + + if(!max) max = (attrs.max ? attrs.max.toInteger() : 10) + if(!offset) offset = (attrs.offset ? attrs.offset.toInteger() : 0) + + def linkParams = [offset:offset-10,max:max] + def linkTagAttrs = ['class':'prevLink',action:action] + if(attrs.controller) { + linkTagAttrs.controller = attrs.controller + } + if(attrs.id) { + linkTagAttrs.id = attrs.id + } + if(attrs.params)linkParams.putAll(attrs.params) + linkTagAttrs.params = linkParams + + def combined = max + offset + if(offset > 0) { + link(linkTagAttrs.clone(),{out<< (attrs.prev? attrs.prev : 'Previous' ) }) + } + + if(total > max) { + linkTagAttrs.'class' = 'step' + if(breadcrumb) { + def j = 0 + 0.step(total,max) { i -> + if(offset == i) { + mkp.a('class':'step',"${++j}") + } + else { + linkParams.offset=i + link(linkTagAttrs.clone(),{out<<++j}) + } + } + } + } + linkParams.offset = offset+10 + if(combined < total) { + linkTagAttrs.'class'='nextLink' + link(linkTagAttrs,{out<< (attrs.'next'? attrs.'next' : 'Next' )}) + } + + } + + /** + * allows rendering of templates inside views for collections, models and beans. Examples: + * + * + * + * + */ + def render = { attrs, body -> + if(!attrs.template) + throwTagError("Tag [render] is missing required attribute [template]") + + def engine = grailsAttributes.getPagesTemplateEngine() + def uri = grailsAttributes.getTemplateUri(attrs.template,request) + def var = attrs['var'] + + def url = servletContext.getResource(uri) + if(!url) + throwTagError("No template found for name [${attrs.template}] in tag [render]") + + def t = engine.createTemplate( uri, + servletContext, + request, + response) + + if(attrs.model instanceof Map) { + t.make( attrs.model ).writeTo(out) + } + else if(attrs.collection) { + attrs.collection.each { + if(var) { + def b = [:] + b.put(var, it) + t.make(b).writeTo(out) + } + else { + t.make( ['it': it] ).writeTo(out) + } + } + } + else if(attrs.bean) { + if(var) { + def b = [:] + b.put(var, attrs.bean) + t.make(b).writeTo(out) + } + else { + t.make( [ 'it' : attrs.bean ] ).writeTo(out) + } + } + else { + t.make().writeTo(out) + } + } + + /** + * Attempts to render input for a property value based by attempting to choose a rendering component + * to use based on the property type + */ + def renderInput = { attrs, body -> + def bean = attrs['bean'] + if(!bean) { + throwTagError("Tag [renderInput] is missing required attribute [bean]") + } + if(!attrs['property']) { + throwTagError("Tag [renderInput] is missing required attribute [property]") + } + + def app = grailsAttributes.getGrailsApplication() + def dc = app.getGrailsDomainClass(bean.class.name) + def pv = bean.metaPropertyValues.find { + it.name == attrs['property'] + } + if(!pv) { + throwTagError("Property [${attrs['property']}] does not exist in tag [renderInput] for bean [${bean}]") + } + def engine = grailsAttributes.getPagesTemplateEngine() + def uri = findUriForType(pv.type) + + if(!uri) + throwTagError("Type [${pv.type}] is unsupported by tag [renderInput]. No template found.") + + def t = engine.createTemplate( uri, + servletContext, + request, + response) + if(!t) { + throwTagError("Type [${pv.type}] is unsupported by tag [renderInput]. No template found.") + } + + def binding = [ name:pv.name,value:pv.value] + binding['constraints'] = (dc ? dc.constrainedProperties : null) + + t.make(binding).writeTo(out) + } + + private String findUriForType(type) { + if(type == Object.class) + return null; + def uri = "/WEB-INF/internal/render/${type.name}.gsp"; + def url = servletContext.getResource(uri) + + if(url != null) { + return uri + } + else { + return findUriForType(type.superClass) + } + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/TagLibUtil.groovy b/projekte/MDB/bin/TagLibUtil.groovy new file mode 100644 index 0000000..00066a1 --- /dev/null +++ b/projekte/MDB/bin/TagLibUtil.groovy @@ -0,0 +1,41 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * Tag lib utility methods + * + * @author Graeme Rocher + * @since 3-Apr-2006 + */ +class TagLibUtil { + /** + * Helper method for writing the output to a string instead of the response writer + */ + static def outToString(tag,attrs) { + def sw = new StringWriter() + def result = null + def saveOut = tag.delegate.out + try { + tag.delegate.out = new PrintWriter(sw) + if(tag) { + tag(attrs) + } + } + finally { + tag.delegate.out = saveOut; + } + return sw.toString() + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/UITagLib.groovy b/projekte/MDB/bin/UITagLib.groovy new file mode 100644 index 0000000..d50e5c4 --- /dev/null +++ b/projekte/MDB/bin/UITagLib.groovy @@ -0,0 +1,185 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + +/** +* A tag lib that provides UI widgets for use with Grails +* +* @author Graeme Rocher +* @since 24-March-2006 +*/ +class UITagLib { + + /** + * A tree widget based on the Yahoo UI library + **/ + @Property tree = { attrs, body -> + if(!request[JavascriptTagLib.INCLUDED_LIBRARIES] || !request[JavascriptTagLib.INCLUDED_LIBRARIES].contains('yahoo')) { + out << '' + } + else { + if(!attrs.id) + throwTagError("Tag [tree] is missing required attribute [id]") + if(!attrs.root) + throwTagError("Tag [tree] is missing required attribute [root]") + + def nodeEvents = attrs.findAll { k,v -> k ==~ /^onNode\w*/ } + + out << """ +
+ """ + } + } + + // Recursive method that traverses an object graphic building up the tree + def buildTreeFromChildren(children,parentName,childrenPropertyName,index) { + if(children) { + children.each { child -> + def label = child.toString() + + out.println "var node${index} = new YAHOO.widget.TextNode({label:'$label',id:'${child.ident()}'}, ${parentName}, false);" + def moreChildren = child.getProperty(childrenPropertyName) + if(moreChildren) { + buildTreeFromChildren(moreChildren,"node${index}",childrenPropertyName,++index) + index = index + moreChildren.size() + } + } + } + } + + /** + * A Rich Text Editor component that by default uses fckeditor with a basepath of /fckeditor. + * TODO: Add support for other rich text editing components like those from the Dojo framework + * + * Example: + * + * + */ + @Property richTextEditor = { attrs -> + withTag(name:'script',attributes:[type:'text/javascript']) { + if(attrs.onComplete) { + out.println "function FCKeditor_OnComplete( editorInstance ) {" + out.println "${attrs.onComplete}(editorInstance);" + out.println "}" + } + out << """ + var oFCKeditor = new FCKeditor( '${attrs.name}' ) ; + oFCKeditor.BasePath = \"""" + if(attrs.basepath) { + createLinkTo(dir:attrs.basepath) + } + else { + createLinkTo(dir:"fckeditor/") + } + out.println '";' + if(attrs.toolbar) { + out << "oFCKeditor.ToolbarSet = '${attrs.toolbar}';" + } + if(attrs.height) + out.println "oFCKeditor.Height = ${attrs.height};" + if(attrs.value) { + out << "oFCKeditor.Value = \"" + escapeJavascript(Collections.EMPTY_MAP,attrs.value) + out.println "\" ;" + } + + out.println "oFCKeditor.Create();" + } + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/ValidationTagLib.groovy b/projekte/MDB/bin/ValidationTagLib.groovy new file mode 100644 index 0000000..b553000 --- /dev/null +++ b/projekte/MDB/bin/ValidationTagLib.groovy @@ -0,0 +1,290 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.springframework.validation.Errors; +import org.springframework.context.NoSuchMessageException; +import org.springframework.web.servlet.support.RequestContextUtils as RCU; +import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; + +/** +* A tag lib that provides tags to handle validation and errors +* +* @author Graeme Rocher +* @since 17-Jan-2006 +*/ + +class ValidationTagLib { + /** + * Checks if the request has errors either for a field or global errors + */ + def hasErrors = { attrs, body -> + def model = attrs['model'] + def checkList = [] + if(model) { + checkList = model.findAll { k,v -> + grailsApplication.isGrailsDomainClass(v.class) + } + } + if(attrs['bean']) { + checkList << attrs['bean'] + } + else { + if(request.attributeNames) { + request.attributeNames.each { ra -> + if(ra) { + if(ra instanceof Errors) + checkList << ra + else if(grailsApplication.isGrailsDomainClass(ra.class)) + checkList << ra + } + } + } + } + + for(i in checkList) { + def errors = null + if(grailsApplication.isGrailsDomainClass(i.class)) { + if(i.hasErrors()) + errors = i.errors + } + else if(i instanceof Errors) { + errors = i + } + if(errors) { + if(attrs['field']) { + if(errors.hasFieldErrors(attrs['field'])) { + body() + } + } + else { + body() + } + } + } + } + + /** + * Loops through each error for either field or global errors + */ + def eachError = { attrs, body -> + def model = attrs['model'] + def errorList = [] + if(model) { + errorList = model.findAll { k,v -> + grailsApplication.isGrailsDomainClass(v.class) + } + } + if(attrs['bean']) { + errorList << attrs['bean'] + } + else { + request.attributeNames.each { + def ra = request[it] + if(ra) { + if(ra instanceof Errors) + errorList << ra + else if(grailsApplication.isGrailsDomainClass(ra.class)) + errorList << ra + } + } + } + + for(i in errorList) { + def errors = null + if(grailsApplication.isGrailsDomainClass(i.class)) { + if(i.hasErrors()) + errors = i.errors + } + else if(i instanceof Errors) { + errors = i + } + if(errors && errors.hasErrors()) { + if(attrs['field']) { + if(errors.hasFieldErrors(attrs['field'])) { + errors.getFieldErrors( attrs["field"] ).each { + body(it) + } + } + } + else { + errors.allErrors.each { + body( it ) + } + } + } + } + } + + /** + * Loops through each error and renders it using one of the supported mechanisms (defaults to "list" if unsupported) + */ + def renderErrors = { attrs, body -> + def renderAs = attrs.remove('as') + if(!renderAs) renderAs = 'list' + + if(renderAs == 'list') { + out << "
    " + eachError(attrs, { + out << "
  • " + message(error:it) + out << "
  • " + } + ) + out << "
" + } + } + /** + * Resolves a message code for a given error or code from the resource bundle + */ + def message = { attrs -> + def messageSource = grailsAttributes + .getApplicationContext() + .getBean("messageSource") + + def locale = RCU.getLocale(request) + + if(attrs['error']) { + def error = attrs['error'] + def defaultMessage = ( attrs['default'] ? attrs['default'] : error.defaultMessage ) + def message = messageSource.getMessage( error.code, + error.arguments, + defaultMessage, + locale ) + if(message) { + out << message + } + else { + out << error.code + } + } + if(attrs['code']) { + def code = attrs['code'] + def defaultMessage = ( attrs['default'] ? attrs['default'] : code ) + + def message = messageSource.getMessage( code, + null, + defaultMessage, + locale ) + if(message) { + out << message + } + else { + out << code + } + } + } + // Maps out how Grails contraints map to Apache commons validators + static CONSTRAINT_TYPE_MAP = [ email : 'email', + creditCard : 'creditCard', + match : 'mask', + blank: 'required', + nullable: 'required', + maxSize: 'maxLength', + minSize: 'minLength', + range: 'intRange', + size: 'intRange', + length: 'maxLength,minLength' ] + /** + * Validates a form using Apache commons validator javascript against constraints defined in a Grails + * domain class + * + * TODO: This tag is a work in progress + */ + def validate = { attrs, body -> + def form = attrs["form"] + def againstClass = attrs["against"] + if(!form) + throwTagError("Tag [validate] is missing required attribute [form]") + + if(!againstClass) { + againstClass = form.substring(0,1).toUpperCase() + form.substring(1) + } + + def app = grailsAttributes.getGrailsApplication() + def dc = app.getGrailsDomainClass(againstClass) + + if(!dc) + throwTagError("Tag [validate] could not find a domain class to validate against for name [${againstClass}]") + + def constrainedProperties = dc.constrainedProperties.collect { k,v -> return v } + def appliedConstraints = [] + + constrainedProperties.each { + appliedConstraints += it.collect{ it.appliedConstraints } + } + + appliedConstraints = appliedConstraints.flatten() + def fieldValidations = [:] + appliedConstraints.each { + def validateType = CONSTRAINT_TYPE_MAP[it.name] + if(validateType) { + if(fieldValidations[validateType]) { + fieldValidations[validateType] << it + } + else { + fieldValidations[validateType] = [it] + } + } + } + + out << '' + } +} \ No newline at end of file diff --git a/projekte/MDB/bin/Wahlkreis.groovy b/projekte/MDB/bin/Wahlkreis.groovy new file mode 100644 index 0000000..b98e070 --- /dev/null +++ b/projekte/MDB/bin/Wahlkreis.groovy @@ -0,0 +1,9 @@ +class Wahlkreis { + Long id + Long version + + def String toString() { "${this.class.name} : $id: $ort" } + def String ort + def relatesToMany = [ wahlkreislisten: Wahlkreisliste ] + def Set wahlkreislisten = new HashSet() +} diff --git a/projekte/MDB/bin/WahlkreisController.groovy b/projekte/MDB/bin/WahlkreisController.groovy new file mode 100644 index 0000000..4c74140 --- /dev/null +++ b/projekte/MDB/bin/WahlkreisController.groovy @@ -0,0 +1,73 @@ + + +class WahlkreisController { + def index = { redirect(action:list,params:params) } + + def list = { + [ wahlkreisList: Wahlkreis.list( params ) ] + } + + def show = { + [ wahlkreis : Wahlkreis.get( params.id ) ] + } + + def delete = { + def wahlkreis = Wahlkreis.get( params.id ) + if(wahlkreis) { + wahlkreis.delete() + flash.message = "Wahlkreis ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Wahlkreis not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def wahlkreis = Wahlkreis.get( params.id ) + + if(!wahlkreis) { + flash.message = "Wahlkreis not found with id ${params.id}" + redirect(action:list) + } + else { + return [ wahlkreis : wahlkreis ] + } + } + + def update = { + def wahlkreis = Wahlkreis.get( params.id ) + if(wahlkreis) { + wahlkreis.properties = params + if(wahlkreis.save()) { + redirect(action:show,id:wahlkreis.id) + } + else { + render(view:'edit',model:[wahlkreis:wahlkreis]) + } + } + else { + flash.message = "Wahlkreis not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def wahlkreis = new Wahlkreis() + wahlkreis.properties = params + return ['wahlkreis':wahlkreis] + } + + def save = { + def wahlkreis = new Wahlkreis() + wahlkreis.properties = params + if(wahlkreis.save()) { + redirect(action:show,id:wahlkreis.id) + } + else { + render(view:'create',model:[wahlkreis:wahlkreis]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/bin/Wahlkreisliste.groovy b/projekte/MDB/bin/Wahlkreisliste.groovy new file mode 100644 index 0000000..cdd58cf --- /dev/null +++ b/projekte/MDB/bin/Wahlkreisliste.groovy @@ -0,0 +1,14 @@ +class Wahlkreisliste { + def Long id + def Long version + + def String toString() { "${this.class.name} : $id ($beschreibung $wahldatum in ${wahlkreis})" } + + def String beschreibung + def Date wahldatum + def belongsTo = [ wahlkreis ] + def relatesToMany = [ listenplaetze: Listenplatz ] + + def Set listenplaetze = new HashSet() + def Wahlkreis wahlkreis +} diff --git a/projekte/MDB/bin/WahlkreislisteController.groovy b/projekte/MDB/bin/WahlkreislisteController.groovy new file mode 100644 index 0000000..746c4ce --- /dev/null +++ b/projekte/MDB/bin/WahlkreislisteController.groovy @@ -0,0 +1,73 @@ + + +class WahlkreislisteController { + def index = { redirect(action:list,params:params) } + + def list = { + [ wahlkreislisteList: Wahlkreisliste.list( params ) ] + } + + def show = { + [ wahlkreisliste : Wahlkreisliste.get( params.id ) ] + } + + def delete = { + def wahlkreisliste = Wahlkreisliste.get( params.id ) + if(wahlkreisliste) { + wahlkreisliste.delete() + flash.message = "Wahlkreisliste ${params.id} deleted." + redirect(action:list) + } + else { + flash.message = "Wahlkreisliste not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def wahlkreisliste = Wahlkreisliste.get( params.id ) + + if(!wahlkreisliste) { + flash.message = "Wahlkreisliste not found with id ${params.id}" + redirect(action:list) + } + else { + return [ wahlkreisliste : wahlkreisliste ] + } + } + + def update = { + def wahlkreisliste = Wahlkreisliste.get( params.id ) + if(wahlkreisliste) { + wahlkreisliste.properties = params + if(wahlkreisliste.save()) { + redirect(action:show,id:wahlkreisliste.id) + } + else { + render(view:'edit',model:[wahlkreisliste:wahlkreisliste]) + } + } + else { + flash.message = "Wahlkreisliste not found with id ${params.id}" + redirect(action:edit,id:params.id) + } + } + + def create = { + def wahlkreisliste = new Wahlkreisliste() + wahlkreisliste.properties = params + return ['wahlkreisliste':wahlkreisliste] + } + + def save = { + def wahlkreisliste = new Wahlkreisliste() + wahlkreisliste.properties = params + if(wahlkreisliste.save()) { + redirect(action:show,id:wahlkreisliste.id) + } + else { + render(view:'create',model:[wahlkreisliste:wahlkreisliste]) + } + } + +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/conf/ApplicationBootStrap.groovy b/projekte/MDB/grails-app/conf/ApplicationBootStrap.groovy new file mode 100644 index 0000000..a267382 --- /dev/null +++ b/projekte/MDB/grails-app/conf/ApplicationBootStrap.groovy @@ -0,0 +1,42 @@ +class ApplicationBootStrap { + + def init = { servletContext -> + def bonnBeuel = new Wahlkreis(ort:'Bonn-Beuel') + .addToWahlkreislisten(beschreibung: 'Bonn-Beuel West', wahldatum: new Date()) + .addToWahlkreislisten(beschreibung: 'Bonn-Beuel Nord', wahldatum: new Date()) + .save() + def bonn = new Wahlkreis(ort:'Bonn') + .addToWahlkreislisten(beschreibung: 'Bonn Nord', wahldatum: new Date()) + .addToWahlkreislisten(beschreibung: 'Bonn Süd', wahldatum: new Date()) + .save() + def neuss = new Wahlkreis(ort:'Neuss') + .addToWahlkreislisten(beschreibung: 'Neuss Süd', wahldatum: new Date()) + .addToWahlkreislisten(beschreibung: 'Neuss Nord', wahldatum: new Date()) + .addToWahlkreislisten(beschreibung: 'Neuss Innenstadt', wahldatum: new Date()) + .save() + + Person f = new Person(nachname: 'Schumacher', vorname: 'Felix', titel:'', geburtsort:'',geburtsdatum: new Date(), sterbeort: '',sterbedatum: new Date()) + .addToKommentare(inhalt: 'Depp') + .save() + Person u = new Person(nachname: 'Herrmann', vorname: 'Urte', titel:'', geburtsort:'',geburtsdatum: new Date(), sterbeort: '',sterbedatum: new Date()) + .addToKommentare(inhalt: 'Arbeitet bei der Aktion Mensch') + .save() + Person s = new Person(nachname: 'Arnold', vorname: 'Sven', titel:'', geburtsort:'',geburtsdatum: new Date(), sterbeort: '',sterbedatum: new Date()) + .addToKommentare(inhalt: 'Geschäftsführer bei Localite') + .save() + + def cdu = new Partei(name:'CDU') + .addToMitglieder(person: u, von: new Date(), bis: new Date()) + .save() + def fdp = new Partei(name:'FDP') + .addToMitglieder(person: f, von: new Date(), bis: new Date()) + .addToMitglieder(person: s, von: new Date(), bis: new Date()) + .save() + def spd = new Partei(name:'SPD') + .addToMitglieder(person: s, von: new Date(), bis: new Date()) + .save() + } + + def destroy = { + } +} diff --git a/projekte/MDB/grails-app/conf/ApplicationDataSource.groovy b/projekte/MDB/grails-app/conf/ApplicationDataSource.groovy new file mode 100644 index 0000000..71ac60a --- /dev/null +++ b/projekte/MDB/grails-app/conf/ApplicationDataSource.groovy @@ -0,0 +1,8 @@ +class ApplicationDataSource { + boolean pooling = true + String dbCreate = "create-drop" // one of 'create', 'create-drop','update' + String url = "jdbc:hsqldb:mem:testDB" + String driverClassName = "org.hsqldb.jdbcDriver" + String username = "sa" + String password = "" +} diff --git a/projekte/MDB/grails-app/conf/DevelopmentDataSource.groovy b/projekte/MDB/grails-app/conf/DevelopmentDataSource.groovy new file mode 100644 index 0000000..42eae3b --- /dev/null +++ b/projekte/MDB/grails-app/conf/DevelopmentDataSource.groovy @@ -0,0 +1,8 @@ +class DevelopmentDataSource { + boolean pooling = true + String dbCreate = "create-drop" // one of 'create', 'create-drop','update' + String url = "jdbc:hsqldb:mem:testDB" + String driverClassName = "org.hsqldb.jdbcDriver" + String username = "sa" + String password = "" +} diff --git a/projekte/MDB/grails-app/conf/MDBUrlMappings.groovy b/projekte/MDB/grails-app/conf/MDBUrlMappings.groovy new file mode 100644 index 0000000..b8a0c8c --- /dev/null +++ b/projekte/MDB/grails-app/conf/MDBUrlMappings.groovy @@ -0,0 +1,9 @@ +class MDBUrlMappings { + static mappings = { + "/$controller/$action?/$id?"{ + constraints { + // apply constraints here + } + } + } +} diff --git a/projekte/MDB/grails-app/conf/TestDataSource.groovy b/projekte/MDB/grails-app/conf/TestDataSource.groovy new file mode 100644 index 0000000..f5c3d3c --- /dev/null +++ b/projekte/MDB/grails-app/conf/TestDataSource.groovy @@ -0,0 +1,8 @@ +class TestDataSource { + boolean pooling = true + String dbCreate = "create-drop" // one of 'create', 'create-drop','update' + String url = "jdbc:hsqldb:mem:testDB" + String driverClassName = "org.hsqldb.jdbcDriver" + String username = "sa" + String password = "" +} diff --git a/projekte/MDB/grails-app/conf/log4j.development.properties b/projekte/MDB/grails-app/conf/log4j.development.properties new file mode 100644 index 0000000..9b507b7 --- /dev/null +++ b/projekte/MDB/grails-app/conf/log4j.development.properties @@ -0,0 +1,60 @@ +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +# Enable logging for everything. Rarely useful +log4j.rootLogger=error, stdout + + +# This logger is for your own application artefact logs +# Artefacts are logged by their type and optionally class name i.e: +# +# log4j.logger.grails.app.controller.HelloController=debug, stdout +# ...will control the logs from just that controller +# +# log4j.logger.grails.app.domain=trace, stdout +# ...will control the logs for all domain classes +# +# At the time of writing, supported artefact type ids include: +# domain (aka Domain Class), task (aka Job), service, dataSource, +# controller, tagLib, urlMappings, codec, bootstrap +# +# The default "info" level for all artefacts is set here +log4j.logger.grails.app=info,stdout +log4j.additivity.grails.app=false + +## This logger is for Grails' public APIs within the grails. package +log4j.logger.grails=info,stdout +log4j.additivity.grails=false + +## Enable this logger to log Hibernate output +# handy to see its database interaction activity +#log4j.logger.org.hibernate=debug,stdout +#log4j.additivity.org.hibernate=false + +# Enable this logger to see what Spring does, occasionally useful +#log4j.logger.org.springframework=info,stdout +#log4j.additivity.org.springframework=false + +# This logger covers all of Grails' internals +# Enable to see whats going on underneath. +log4j.logger.org.codehaus.groovy.grails=info,stdout +log4j.additivity.org.codehaus.groovy.grails=false + +# This logger is useful if you just want to see what Grails +# configures with Spring at runtime. Setting to debug will show +# each bean that is configured +log4j.logger.org.codehaus.groovy.grails.commons.spring=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.spring=false + +# Interesting Logger to see what some of the Grails factory beans are doing +log4j.logger.org.codehaus.groovy.grails.beans.factory=info,stdout +log4j.additivity.org.codehaus.groovy.grails.beans.factory=false + +# This logger outputs what Grails is doing dynamically under the covers +log4j.logger.org.codehaus.groovy.grails.commons.metaclass=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.metaclass=false + +# These two loggers are for tracking what plugins are doing +log4j.logger.org.codehaus.groovy.grails.plugins=info,stdout +log4j.additivity.org.codehaus.groovy.grails.plugins=false +log4j.logger.grails.spring=info,stdout +log4j.additivity.grails.spring=false diff --git a/projekte/MDB/grails-app/conf/log4j.production.properties b/projekte/MDB/grails-app/conf/log4j.production.properties new file mode 100644 index 0000000..9b507b7 --- /dev/null +++ b/projekte/MDB/grails-app/conf/log4j.production.properties @@ -0,0 +1,60 @@ +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +# Enable logging for everything. Rarely useful +log4j.rootLogger=error, stdout + + +# This logger is for your own application artefact logs +# Artefacts are logged by their type and optionally class name i.e: +# +# log4j.logger.grails.app.controller.HelloController=debug, stdout +# ...will control the logs from just that controller +# +# log4j.logger.grails.app.domain=trace, stdout +# ...will control the logs for all domain classes +# +# At the time of writing, supported artefact type ids include: +# domain (aka Domain Class), task (aka Job), service, dataSource, +# controller, tagLib, urlMappings, codec, bootstrap +# +# The default "info" level for all artefacts is set here +log4j.logger.grails.app=info,stdout +log4j.additivity.grails.app=false + +## This logger is for Grails' public APIs within the grails. package +log4j.logger.grails=info,stdout +log4j.additivity.grails=false + +## Enable this logger to log Hibernate output +# handy to see its database interaction activity +#log4j.logger.org.hibernate=debug,stdout +#log4j.additivity.org.hibernate=false + +# Enable this logger to see what Spring does, occasionally useful +#log4j.logger.org.springframework=info,stdout +#log4j.additivity.org.springframework=false + +# This logger covers all of Grails' internals +# Enable to see whats going on underneath. +log4j.logger.org.codehaus.groovy.grails=info,stdout +log4j.additivity.org.codehaus.groovy.grails=false + +# This logger is useful if you just want to see what Grails +# configures with Spring at runtime. Setting to debug will show +# each bean that is configured +log4j.logger.org.codehaus.groovy.grails.commons.spring=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.spring=false + +# Interesting Logger to see what some of the Grails factory beans are doing +log4j.logger.org.codehaus.groovy.grails.beans.factory=info,stdout +log4j.additivity.org.codehaus.groovy.grails.beans.factory=false + +# This logger outputs what Grails is doing dynamically under the covers +log4j.logger.org.codehaus.groovy.grails.commons.metaclass=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.metaclass=false + +# These two loggers are for tracking what plugins are doing +log4j.logger.org.codehaus.groovy.grails.plugins=info,stdout +log4j.additivity.org.codehaus.groovy.grails.plugins=false +log4j.logger.grails.spring=info,stdout +log4j.additivity.grails.spring=false diff --git a/projekte/MDB/grails-app/conf/log4j.test.properties b/projekte/MDB/grails-app/conf/log4j.test.properties new file mode 100644 index 0000000..9b507b7 --- /dev/null +++ b/projekte/MDB/grails-app/conf/log4j.test.properties @@ -0,0 +1,60 @@ +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +# Enable logging for everything. Rarely useful +log4j.rootLogger=error, stdout + + +# This logger is for your own application artefact logs +# Artefacts are logged by their type and optionally class name i.e: +# +# log4j.logger.grails.app.controller.HelloController=debug, stdout +# ...will control the logs from just that controller +# +# log4j.logger.grails.app.domain=trace, stdout +# ...will control the logs for all domain classes +# +# At the time of writing, supported artefact type ids include: +# domain (aka Domain Class), task (aka Job), service, dataSource, +# controller, tagLib, urlMappings, codec, bootstrap +# +# The default "info" level for all artefacts is set here +log4j.logger.grails.app=info,stdout +log4j.additivity.grails.app=false + +## This logger is for Grails' public APIs within the grails. package +log4j.logger.grails=info,stdout +log4j.additivity.grails=false + +## Enable this logger to log Hibernate output +# handy to see its database interaction activity +#log4j.logger.org.hibernate=debug,stdout +#log4j.additivity.org.hibernate=false + +# Enable this logger to see what Spring does, occasionally useful +#log4j.logger.org.springframework=info,stdout +#log4j.additivity.org.springframework=false + +# This logger covers all of Grails' internals +# Enable to see whats going on underneath. +log4j.logger.org.codehaus.groovy.grails=info,stdout +log4j.additivity.org.codehaus.groovy.grails=false + +# This logger is useful if you just want to see what Grails +# configures with Spring at runtime. Setting to debug will show +# each bean that is configured +log4j.logger.org.codehaus.groovy.grails.commons.spring=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.spring=false + +# Interesting Logger to see what some of the Grails factory beans are doing +log4j.logger.org.codehaus.groovy.grails.beans.factory=info,stdout +log4j.additivity.org.codehaus.groovy.grails.beans.factory=false + +# This logger outputs what Grails is doing dynamically under the covers +log4j.logger.org.codehaus.groovy.grails.commons.metaclass=info,stdout +log4j.additivity.org.codehaus.groovy.grails.commons.metaclass=false + +# These two loggers are for tracking what plugins are doing +log4j.logger.org.codehaus.groovy.grails.plugins=info,stdout +log4j.additivity.org.codehaus.groovy.grails.plugins=false +log4j.logger.grails.spring=info,stdout +log4j.additivity.grails.spring=false diff --git a/projekte/MDB/grails-app/controllers/KommentarController.groovy b/projekte/MDB/grails-app/controllers/KommentarController.groovy new file mode 100644 index 0000000..3844ab5 --- /dev/null +++ b/projekte/MDB/grails-app/controllers/KommentarController.groovy @@ -0,0 +1,5 @@ + + +class KommentarController { + def scaffold = Kommentar +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/ListenplatzController.groovy b/projekte/MDB/grails-app/controllers/ListenplatzController.groovy new file mode 100644 index 0000000..8fd37ef --- /dev/null +++ b/projekte/MDB/grails-app/controllers/ListenplatzController.groovy @@ -0,0 +1,5 @@ + + +class ListenplatzController { + def scaffold = Listenplatz +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/ParteiController.groovy b/projekte/MDB/grails-app/controllers/ParteiController.groovy new file mode 100644 index 0000000..3e7f8dd --- /dev/null +++ b/projekte/MDB/grails-app/controllers/ParteiController.groovy @@ -0,0 +1,6 @@ + + +class ParteiController { + def scaffold = Partei + +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/ParteimitgliedschaftController.groovy b/projekte/MDB/grails-app/controllers/ParteimitgliedschaftController.groovy new file mode 100644 index 0000000..5a13940 --- /dev/null +++ b/projekte/MDB/grails-app/controllers/ParteimitgliedschaftController.groovy @@ -0,0 +1,6 @@ + + +class ParteimitgliedschaftController { + def scaffold = Parteimitgliedschaft + +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/PersonController.groovy b/projekte/MDB/grails-app/controllers/PersonController.groovy new file mode 100644 index 0000000..b1df903 --- /dev/null +++ b/projekte/MDB/grails-app/controllers/PersonController.groovy @@ -0,0 +1,5 @@ + + +class PersonController { + def scaffold = Person +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/WahlkreisController.groovy b/projekte/MDB/grails-app/controllers/WahlkreisController.groovy new file mode 100644 index 0000000..3da2ad3 --- /dev/null +++ b/projekte/MDB/grails-app/controllers/WahlkreisController.groovy @@ -0,0 +1,5 @@ + + +class WahlkreisController { + def scaffold = Wahlkreis +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/controllers/WahlkreislisteController.groovy b/projekte/MDB/grails-app/controllers/WahlkreislisteController.groovy new file mode 100644 index 0000000..3d45cbd --- /dev/null +++ b/projekte/MDB/grails-app/controllers/WahlkreislisteController.groovy @@ -0,0 +1,5 @@ + + +class WahlkreislisteController { + def scaffold = Wahlkreisliste +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/domain/Kommentar.groovy b/projekte/MDB/grails-app/domain/Kommentar.groovy new file mode 100644 index 0000000..3374fd3 --- /dev/null +++ b/projekte/MDB/grails-app/domain/Kommentar.groovy @@ -0,0 +1,9 @@ +class Kommentar { + static belongsTo = [Person] + + String inhalt + Date eingegeben = new Date() + Person person + + String toString() { "${inhalt}" } +} diff --git a/projekte/MDB/grails-app/domain/Listenplatz.groovy b/projekte/MDB/grails-app/domain/Listenplatz.groovy new file mode 100644 index 0000000..c280edf --- /dev/null +++ b/projekte/MDB/grails-app/domain/Listenplatz.groovy @@ -0,0 +1,11 @@ +class Listenplatz { + static belongsTo = [Person, Wahlkreisliste] + + Integer nummer + Person person + Wahlkreisliste wahlkreisliste + + def String toString() { + "${person} ist Nr. ${nummer} auf $wahlkreisliste" + } +} diff --git a/projekte/MDB/grails-app/domain/Partei.groovy b/projekte/MDB/grails-app/domain/Partei.groovy new file mode 100644 index 0000000..b3d0f3c --- /dev/null +++ b/projekte/MDB/grails-app/domain/Partei.groovy @@ -0,0 +1,8 @@ +class Partei { + static hasMany = [ mitglieder: Parteimitgliedschaft] + + String name + + String toString() { "$name" } + +} diff --git a/projekte/MDB/grails-app/domain/Parteimitgliedschaft.groovy b/projekte/MDB/grails-app/domain/Parteimitgliedschaft.groovy new file mode 100644 index 0000000..3cf0000 --- /dev/null +++ b/projekte/MDB/grails-app/domain/Parteimitgliedschaft.groovy @@ -0,0 +1,13 @@ +class Parteimitgliedschaft { + static belongsTo = [ Partei, Person] + + Person person + Partei partei + Date von + Date bis + + String toString() { + "${person} in ${partei} ${von} - ${bis}" + } + +} diff --git a/projekte/MDB/grails-app/domain/Person.groovy b/projekte/MDB/grails-app/domain/Person.groovy new file mode 100644 index 0000000..5d72662 --- /dev/null +++ b/projekte/MDB/grails-app/domain/Person.groovy @@ -0,0 +1,20 @@ +class Person { + static hasMany = [ + listenplaetze: Listenplatz, + mitgliedschaften: Parteimitgliedschaft, + kommentare: Kommentar + ] + + String nachname; + String vorname; + String titel; + String geburtsort; + Date geburtsdatum; + String sterbeort; + Date sterbedatum; + + def String toString() { + "$nachname, $titel $vorname" + } + +} diff --git a/projekte/MDB/grails-app/domain/Wahlkreis.groovy b/projekte/MDB/grails-app/domain/Wahlkreis.groovy new file mode 100644 index 0000000..a6b20a5 --- /dev/null +++ b/projekte/MDB/grails-app/domain/Wahlkreis.groovy @@ -0,0 +1,10 @@ +class Wahlkreis { + static hasMany = [ wahlkreislisten: Wahlkreisliste ] + + String ort + + def String toString() { + "${ort}" + } + +} diff --git a/projekte/MDB/grails-app/domain/Wahlkreisliste.groovy b/projekte/MDB/grails-app/domain/Wahlkreisliste.groovy new file mode 100644 index 0000000..b71ca1f --- /dev/null +++ b/projekte/MDB/grails-app/domain/Wahlkreisliste.groovy @@ -0,0 +1,13 @@ +class Wahlkreisliste { + static belongsTo = Wahlkreis + + static hasMany = [ listenplaetze: Listenplatz ] + + String beschreibung + Date wahldatum + Wahlkreis wahlkreis + + def String toString() { + "${beschreibung} ${wahldatum} in ${wahlkreis}" + } +} diff --git a/projekte/MDB/grails-app/i18n/messages.properties b/projekte/MDB/grails-app/i18n/messages.properties new file mode 100644 index 0000000..54d0cc7 --- /dev/null +++ b/projekte/MDB/grails-app/i18n/messages.properties @@ -0,0 +1,20 @@ +default.doesnt.match.message=Property [{0}] of class [{1}] with value [{2}] does not match the required pattern [{3}] +default.invalid.url.message=Property [{0}] of class [{1}] with value [{2}] is not a valid URL +default.invalid.creditCard.message=Property [{0}] of class [{1}] with value [{2}] is not a valid credit card number +default.invalid.email.message=Property [{0}] of class [{1}] with value [{2}] is not a valid e-mail address. +default.invalid.message=Property [{0}] of class [{1}] is not a valid [{2}]. +default.invalid.range.message=Property [{0}] of class [{1}] with value [{2}] does not fall within the valid range from [{3}] to [{4}] +default.invalid.size.message=Property [{0}] of class [{1}] with value [{2}] does not fall within the valid size range from [{3}] to [{4}] +default.invalid.length.message=Property [{0}] of class [{1}] with value [{2}] does not fall within the valid length range from [{3}] to [{4}] +default.invalid.min.message=Property [{0}] of class [{1}] with value [{2}] is less than minimum value [{3}] +default.invalid.max.message=Property [{0}] of class [{1}] with value [{2}] exceeds maxim value [{3}] +default.invalid.max.length.message=Property [{0}] of class [{1}] with value [{2}] exceeds the maxim length of [{3}] +default.invalid.min.length.message=Property [{0}] of class [{1}] with value [{2}] is less than the minimum length of [{3}] +default.invalid.max.size.message=Property [{0}] of class [{1}] with value [{2}] exceeds the maxim size of [{3}] +default.invalid.min.size.message=Property [{0}] of class [{1}] with value [{2}] is less than the minimum size of [{3}] +default.not.inlist.message=Property [{0}] of class [{1}] with value [{2}] is not contained within the list [{3}] +default.blank.message=Property [{0}] of class [{1}] cannot be blank +default.not.equal.message=Property [{0}] of class [{1}] with value [{2}] must equal [{3}] +default.null.message=Property [{0}] of class [{1}] cannot be null +default.not.unique.message=Property [{0}] of class [{1}] with value [{2}] must be unique +default.not.editable.message=Property [{0}] of class [{1}] with value [{2}] cannot be changed from [{3}] \ No newline at end of file diff --git a/projekte/MDB/grails-app/taglib/TagLibUtil.groovy b/projekte/MDB/grails-app/taglib/TagLibUtil.groovy new file mode 100644 index 0000000..00066a1 --- /dev/null +++ b/projekte/MDB/grails-app/taglib/TagLibUtil.groovy @@ -0,0 +1,41 @@ +/* Copyright 2004-2005 the original author or authors. + * + * 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 c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * Tag lib utility methods + * + * @author Graeme Rocher + * @since 3-Apr-2006 + */ +class TagLibUtil { + /** + * Helper method for writing the output to a string instead of the response writer + */ + static def outToString(tag,attrs) { + def sw = new StringWriter() + def result = null + def saveOut = tag.delegate.out + try { + tag.delegate.out = new PrintWriter(sw) + if(tag) { + tag(attrs) + } + } + finally { + tag.delegate.out = saveOut; + } + return sw.toString() + } +} \ No newline at end of file diff --git a/projekte/MDB/grails-app/views/error.jsp b/projekte/MDB/grails-app/views/error.jsp new file mode 100644 index 0000000..1f58dfe --- /dev/null +++ b/projekte/MDB/grails-app/views/error.jsp @@ -0,0 +1,48 @@ +<%@ page contentType="text/html;charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + Grails Runtime Exception + + + + +

Grails Runtime Exception

+

Error Details

+
+ Message:
+ Caused by:
+ Class:
+ At Line: []
+ Code Snippet:
+
+ +
+
+
+
+

Stack Trace

+
+ +
+ + \ No newline at end of file diff --git a/projekte/MDB/grails-app/views/layouts/main.gsp b/projekte/MDB/grails-app/views/layouts/main.gsp new file mode 100644 index 0000000..7335c1c --- /dev/null +++ b/projekte/MDB/grails-app/views/layouts/main.gsp @@ -0,0 +1,16 @@ + + + <g:layoutTitle default="Grails" /> + + + + + + + +

MDB

+ + + \ No newline at end of file diff --git a/projekte/MDB/grails-tests/KommentarTests.groovy b/projekte/MDB/grails-tests/KommentarTests.groovy new file mode 100644 index 0000000..7e11714 --- /dev/null +++ b/projekte/MDB/grails-tests/KommentarTests.groovy @@ -0,0 +1,6 @@ +class KommentarTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/grails-tests/ListenplatzTests.groovy b/projekte/MDB/grails-tests/ListenplatzTests.groovy new file mode 100644 index 0000000..dae1a5c --- /dev/null +++ b/projekte/MDB/grails-tests/ListenplatzTests.groovy @@ -0,0 +1,6 @@ +class ListenplatzTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/grails-tests/ParteiTests.groovy b/projekte/MDB/grails-tests/ParteiTests.groovy new file mode 100644 index 0000000..66619fe --- /dev/null +++ b/projekte/MDB/grails-tests/ParteiTests.groovy @@ -0,0 +1,6 @@ +class ParteiTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/grails-tests/ParteimitgliedschaftTests.groovy b/projekte/MDB/grails-tests/ParteimitgliedschaftTests.groovy new file mode 100644 index 0000000..b165c1a --- /dev/null +++ b/projekte/MDB/grails-tests/ParteimitgliedschaftTests.groovy @@ -0,0 +1,6 @@ +class ParteimitgliedschaftTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/grails-tests/PersonTests.groovy b/projekte/MDB/grails-tests/PersonTests.groovy new file mode 100644 index 0000000..255374b --- /dev/null +++ b/projekte/MDB/grails-tests/PersonTests.groovy @@ -0,0 +1,12 @@ +class PersonTests extends GroovyTestCase { + + void testSomething() { + Person.list()*.delete() + Person f = new Person(nachname: 'Schumacher', vorname: 'Felix', titel:'', geburtsort:'',geburtsdatum: new Date(), sterbeort: '',sterbedatum: new Date()) + Person u = new Person(nachname: 'Herrmann', vorname: 'Urte', titel:'', geburtsort:'',geburtsdatum: new Date(), sterbeort: '',sterbedatum: new Date()) + f.save() + u.save() + assert Person.list() + assert Person.findAll()[0].nachname == 'Schumacher' + } +} diff --git a/projekte/MDB/grails-tests/WahlkreisTests.groovy b/projekte/MDB/grails-tests/WahlkreisTests.groovy new file mode 100644 index 0000000..4fbfb48 --- /dev/null +++ b/projekte/MDB/grails-tests/WahlkreisTests.groovy @@ -0,0 +1,6 @@ +class WahlkreisTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/grails-tests/WahlkreislisteTests.groovy b/projekte/MDB/grails-tests/WahlkreislisteTests.groovy new file mode 100644 index 0000000..4ed8177 --- /dev/null +++ b/projekte/MDB/grails-tests/WahlkreislisteTests.groovy @@ -0,0 +1,6 @@ +class WahlkreislisteTests extends GroovyTestCase { + + void testSomething() { + + } +} diff --git a/projekte/MDB/spring/resources.xml b/projekte/MDB/spring/resources.xml new file mode 100644 index 0000000..2b48ae6 --- /dev/null +++ b/projekte/MDB/spring/resources.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/projekte/MDB/target/test-reports/TEST-KommentarTests.xml b/projekte/MDB/target/test-reports/TEST-KommentarTests.xml new file mode 100644 index 0000000..90737c4 --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-KommentarTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-ListenplatzTests.xml b/projekte/MDB/target/test-reports/TEST-ListenplatzTests.xml new file mode 100644 index 0000000..27e7328 --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-ListenplatzTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-ParteiTests.xml b/projekte/MDB/target/test-reports/TEST-ParteiTests.xml new file mode 100644 index 0000000..9282820 --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-ParteiTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-ParteimitgliedschaftTests.xml b/projekte/MDB/target/test-reports/TEST-ParteimitgliedschaftTests.xml new file mode 100644 index 0000000..8ba84ff --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-ParteimitgliedschaftTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-PersonTests.xml b/projekte/MDB/target/test-reports/TEST-PersonTests.xml new file mode 100644 index 0000000..93e4d87 --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-PersonTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-WahlkreisTests.xml b/projekte/MDB/target/test-reports/TEST-WahlkreisTests.xml new file mode 100644 index 0000000..e0ac8b3 --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-WahlkreisTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/TEST-WahlkreislisteTests.xml b/projekte/MDB/target/test-reports/TEST-WahlkreislisteTests.xml new file mode 100644 index 0000000..20d337d --- /dev/null +++ b/projekte/MDB/target/test-reports/TEST-WahlkreislisteTests.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/projekte/MDB/target/test-reports/plain/TEST-KommentarTests.txt b/projekte/MDB/target/test-reports/plain/TEST-KommentarTests.txt new file mode 100644 index 0000000..a6048c2 --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-KommentarTests.txt @@ -0,0 +1,4 @@ +Testsuite: KommentarTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-ListenplatzTests.txt b/projekte/MDB/target/test-reports/plain/TEST-ListenplatzTests.txt new file mode 100644 index 0000000..8004296 --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-ListenplatzTests.txt @@ -0,0 +1,4 @@ +Testsuite: ListenplatzTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0,001 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-ParteiTests.txt b/projekte/MDB/target/test-reports/plain/TEST-ParteiTests.txt new file mode 100644 index 0000000..7cfb0fa --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-ParteiTests.txt @@ -0,0 +1,4 @@ +Testsuite: ParteiTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-ParteimitgliedschaftTests.txt b/projekte/MDB/target/test-reports/plain/TEST-ParteimitgliedschaftTests.txt new file mode 100644 index 0000000..fef140a --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-ParteimitgliedschaftTests.txt @@ -0,0 +1,4 @@ +Testsuite: ParteimitgliedschaftTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0,001 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-PersonTests.txt b/projekte/MDB/target/test-reports/plain/TEST-PersonTests.txt new file mode 100644 index 0000000..5860e18 --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-PersonTests.txt @@ -0,0 +1,4 @@ +Testsuite: PersonTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0,105 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-WahlkreisTests.txt b/projekte/MDB/target/test-reports/plain/TEST-WahlkreisTests.txt new file mode 100644 index 0000000..5c6c0ff --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-WahlkreisTests.txt @@ -0,0 +1,4 @@ +Testsuite: WahlkreisTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0 sec diff --git a/projekte/MDB/target/test-reports/plain/TEST-WahlkreislisteTests.txt b/projekte/MDB/target/test-reports/plain/TEST-WahlkreislisteTests.txt new file mode 100644 index 0000000..399cda4 --- /dev/null +++ b/projekte/MDB/target/test-reports/plain/TEST-WahlkreislisteTests.txt @@ -0,0 +1,4 @@ +Testsuite: WahlkreislisteTests +Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0 sec + +Testcase: testSomething took 0 sec diff --git a/projekte/MDB/web-app/css/main.css b/projekte/MDB/web-app/css/main.css new file mode 100644 index 0000000..c278c88 --- /dev/null +++ b/projekte/MDB/web-app/css/main.css @@ -0,0 +1,122 @@ +a:active,a:link,a:visited,a:hover { + color:#0D5798; +} +.menuButton { + background-color:#8CAFCD; + border: 1px solid white; + border-style: none solid none none ; + margin-left:0px; + padding-bottom: 5px; +} + +.menuButton a:active,.menuButton a:link,.menuButton a:visited,.menuButton a:hover { + font-family:Arial,sans-serif; + font-size:0.9em; + color: white; + font-weight:bold; + text-decoration:none; + padding:20px; +} +.actionButton a:active,.actionButton a:link,.actionButton a:visited,.actionButton a:hover { + font-family:Arial,sans-serif; + font-size:0.8em; + font-weight:bold; + color: #578BB8; +} + + +h1 { + font-family:Arial,sans-serif; + color:#578BB8; + font-size:1.6em; +} + +body { + margin:0px; + font-family:Arial,sans-serif; + color: #616161; +} +textarea { + width: 300px; + height: 100px; +} +table { + width: 100%; +} +.body { + padding: 25px; +} +.nav { + width:100%; + margin-top: 30px; + background-color:#D6D6D6; + height: 30px; + border: 2px solid #578BB8; + border-style: solid none none none ; +} + +th { + background-color:#578BB8; + color:white; + width:30px; + font-family:Arial,sans-serif; + padding:5px; + +} +td { + background-color:#F0F0F0; + text-align:center; +} +.dialog +{ + padding: 15px; + background-color:#F0F0F0; + +} +.dialog label{ + width: 120px; + font-weight: bold; +} + +.dialog .textfield, textarea{ + width: 180px; + margin-bottom: 5px; +} + +textarea{ + width: 250px; + height: 150px; +} +.prop { + padding: 5px; +} +.buttons { + margin-top: 15px; +} +.actionButtons { + width:100px; +} +div .errors { + border: 2px solid red; + padding: 5px; + margin-top:10px; + margin-bottom:10px; +} +td .errors { + border: 1px solid red; +} +.message { + border: 1px solid #FFCC00; + padding: 5px; + margin-top:10px; + margin-bottom:10px; +} +.prop .name { + font-weight:bold; + text-align:left; + width:20%; +} +.prop .value { + text-align:left; + width:80%; +} \ No newline at end of file diff --git a/projekte/MDB/web-app/css/tree/check/tree.css b/projekte/MDB/web-app/css/tree/check/tree.css new file mode 100644 index 0000000..7430d2e --- /dev/null +++ b/projekte/MDB/web-app/css/tree/check/tree.css @@ -0,0 +1,58 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn {background: url(../../img/default/tn.gif) 0 0 no-repeat; width:16px; height:22px; } + +/* first or middle sibling, collapsable */ +.ygtvtm {background: url(../../img/default/tm.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh {background: url(../../img/default/tmh.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* first or middle sibling, expandable */ +.ygtvtp {background: url(../../img/default/tp.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* first or middle sibling, expandable, hover */ +.ygtvtph {background: url(../../img/default/tph.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* last sibling, no children */ +.ygtvln {background: url(../../img/default/ln.gif) 0 0 no-repeat; width:16px; height:22px; } + +/* Last sibling, collapsable */ +.ygtvlm {background: url(../../img/default/lm.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* Last sibling, collapsable, hover */ +.ygtvlmh {background: url(../../img/default/lmh.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* Last sibling, expandable */ +.ygtvlp { background: url(../../img/default/lp.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* Last sibling, expandable, hover */ +.ygtvlph { background: url(../../img/default/lph.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + +/* Loading icon */ +.ygtvloading { background: url(../../img/default/loading.gif) 0 0 no-repeat; width:16px; height:22px; } + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { background: url(../../img/default/vline.gif) 0 0 no-repeat; width:16px; height:22px; } + +.ygtvblankdepthcell { width:16px; height:22px; } + +/* the style of the div around each node */ +.ygtvitem { } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:1%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + +.ygtvcheck0 { background: url(../../img/check/check0.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } +.ygtvcheck1 { background: url(../../img/check/check1.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } +.ygtvcheck2 { background: url(../../img/check/check2.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer } + diff --git a/projekte/MDB/web-app/css/tree/default/tree.css b/projekte/MDB/web-app/css/tree/default/tree.css new file mode 100644 index 0000000..effce51 --- /dev/null +++ b/projekte/MDB/web-app/css/tree/default/tree.css @@ -0,0 +1,97 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { + width:16px; height:22px; + background: url(../../img/default/tn.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable */ +.ygtvtm { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/tm.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/tmh.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable */ +.ygtvtp { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/tp.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable, hover */ +.ygtvtph { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/tph.gif) 0 0 no-repeat; +} + +/* last sibling, no children */ +.ygtvln { + width:16px; height:22px; + background: url(../../img/default/ln.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable */ +.ygtvlm { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/lm.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable, hover */ +.ygtvlmh { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/lmh.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable */ +.ygtvlp { + width:16px; height:22px; + cursor:pointer ; + background: url(../../img/default/lp.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable, hover */ +.ygtvlph { + width:17px; height:22px; cursor:pointer ; + background: url(../../img/default/lph.gif) 0 0 no-repeat; +} + +/* Loading icon */ +.ygtvloading { + width:16px; height:22px; + background: url(../../img/default/loading.gif) 0 0 no-repeat; +} + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { + width:16px; height:22px; + background: url(../../img/default/vline.gif) 0 0 no-repeat; +} + +.ygtvblankdepthcell { width:16px; height:22px; } + +/* the style of the div around each node */ +.ygtvitem { } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:2%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + diff --git a/projekte/MDB/web-app/css/tree/folders/tree.css b/projekte/MDB/web-app/css/tree/folders/tree.css new file mode 100644 index 0000000..5f3b26f --- /dev/null +++ b/projekte/MDB/web-app/css/tree/folders/tree.css @@ -0,0 +1,55 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { background: url(../../img/folders/tn.gif) 0 0 no-repeat; width:17px; height:22px; } + +/* first or middle sibling, collapsable */ +.ygtvtm { background: url(../../img/folders/tm.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { background: url(../../img/folders/tmh.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* first or middle sibling, expandable */ +.ygtvtp { background: url(../../img/folders/tp.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* first or middle sibling, expandable, hover */ +.ygtvtph { background: url(../../img/folders/tph.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* last sibling, no children */ +.ygtvln { background: url(../../img/folders/ln.gif) 0 0 no-repeat; width:17px; height:22px; } + +/* Last sibling, collapsable */ +.ygtvlm { background: url(../../img/folders/lm.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* Last sibling, collapsable, hover */ +.ygtvlmh { background: url(../../img/folders/lmh.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* Last sibling, expandable */ +.ygtvlp { background: url(../../img/folders/lp.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* Last sibling, expandable, hover */ +.ygtvlph { background: url(../../img/folders/lph.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } + +/* Loading icon */ +.ygtvloading { background: url(../../img/folders/loading.gif) 0 0 no-repeat; width:16px; height:22px; } + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { background: url(../../img/folders/vline.gif) 0 0 no-repeat; width:17px; height:22px; } + +.ygtvblankdepthcell { width:17px; height:22px; } + +/* the style of the div around each node */ +.ygtvitem { } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:1%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + + diff --git a/projekte/MDB/web-app/css/tree/menu/tree.css b/projekte/MDB/web-app/css/tree/menu/tree.css new file mode 100644 index 0000000..1c5600a --- /dev/null +++ b/projekte/MDB/web-app/css/tree/menu/tree.css @@ -0,0 +1,58 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { width:1em; height:20px; } + +/* first or middle sibling, collapsable */ +.ygtvtm { background: url(../../img/menu/collapse.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { background: url(../../img/menu/collapseh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* first or middle sibling, expandable */ +.ygtvtp { background: url(../../img/menu/expand.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* first or middle sibling, expandable, hover */ +.ygtvtph { background: url(../../img/menu/expandh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* last sibling, no children */ +.ygtvln { width:1em; height:20px; } + +/* Last sibling, collapsable */ +.ygtvlm { background: url(../../img/menu/collapse.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* Last sibling, collapsable, hover */ +.ygtvlmh { background: url(../../img/menu/collapseh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* Last sibling, expandable */ +.ygtvlp { background: url(../../img/menu/expand.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* Last sibling, expandable, hover */ +.ygtvlph { background: url(../../img/menu/expandh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer } + +/* Loading icon */ +.ygtvloading { background: url(../../img/menu/loading.gif) 0 6px no-repeat; width:1em; height:22px; } + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { width:1em; height:20px; } + +.ygtvblankdepthcell { width:1em; height:20px; } + +/* the style of the div around each node */ +.ygtvitem { border: 0px solid grey; } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:1%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + /* + margin-left:2px; + text-decoration: none; + */ + font-size: 12px; +} + + diff --git a/projekte/MDB/web-app/images/grails_logo.jpg b/projekte/MDB/web-app/images/grails_logo.jpg new file mode 100644 index 0000000..73db72e Binary files /dev/null and b/projekte/MDB/web-app/images/grails_logo.jpg differ diff --git a/projekte/MDB/web-app/images/spinner.gif b/projekte/MDB/web-app/images/spinner.gif new file mode 100644 index 0000000..1ed786f Binary files /dev/null and b/projekte/MDB/web-app/images/spinner.gif differ diff --git a/projekte/MDB/web-app/images/tree/bullet.gif b/projekte/MDB/web-app/images/tree/bullet.gif new file mode 100644 index 0000000..9d28c2f Binary files /dev/null and b/projekte/MDB/web-app/images/tree/bullet.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/check0.gif b/projekte/MDB/web-app/images/tree/check/check0.gif new file mode 100644 index 0000000..193028b Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/check0.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/check1.gif b/projekte/MDB/web-app/images/tree/check/check1.gif new file mode 100644 index 0000000..1813175 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/check1.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/check2.gif b/projekte/MDB/web-app/images/tree/check/check2.gif new file mode 100644 index 0000000..7d9ceba Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/check2.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/lm.gif b/projekte/MDB/web-app/images/tree/check/lm.gif new file mode 100644 index 0000000..e7d0a3c Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/lm.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/lmh.gif b/projekte/MDB/web-app/images/tree/check/lmh.gif new file mode 100644 index 0000000..3ff6302 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/lmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/ln.gif b/projekte/MDB/web-app/images/tree/check/ln.gif new file mode 100644 index 0000000..b7b3e55 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/ln.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/loading.gif b/projekte/MDB/web-app/images/tree/check/loading.gif new file mode 100644 index 0000000..0bbf3bc Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/loading.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/lp.gif b/projekte/MDB/web-app/images/tree/check/lp.gif new file mode 100644 index 0000000..b87f003 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/lp.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/lph.gif b/projekte/MDB/web-app/images/tree/check/lph.gif new file mode 100644 index 0000000..e3478d8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/lph.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/tm.gif b/projekte/MDB/web-app/images/tree/check/tm.gif new file mode 100644 index 0000000..e30abad Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/tm.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/tmh.gif b/projekte/MDB/web-app/images/tree/check/tmh.gif new file mode 100644 index 0000000..ad7e557 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/tmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/tn.gif b/projekte/MDB/web-app/images/tree/check/tn.gif new file mode 100644 index 0000000..4a28039 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/tn.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/tp.gif b/projekte/MDB/web-app/images/tree/check/tp.gif new file mode 100644 index 0000000..d6d0ed0 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/tp.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/tph.gif b/projekte/MDB/web-app/images/tree/check/tph.gif new file mode 100644 index 0000000..e4d7d99 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/tph.gif differ diff --git a/projekte/MDB/web-app/images/tree/check/vline.gif b/projekte/MDB/web-app/images/tree/check/vline.gif new file mode 100644 index 0000000..1fb0de8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/check/vline.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/lm.gif b/projekte/MDB/web-app/images/tree/default/lm.gif new file mode 100644 index 0000000..e7d0a3c Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/lm.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/lmh.gif b/projekte/MDB/web-app/images/tree/default/lmh.gif new file mode 100644 index 0000000..3ff6302 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/lmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/ln.gif b/projekte/MDB/web-app/images/tree/default/ln.gif new file mode 100644 index 0000000..b7b3e55 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/ln.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/loading.gif b/projekte/MDB/web-app/images/tree/default/loading.gif new file mode 100644 index 0000000..0bbf3bc Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/loading.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/lp.gif b/projekte/MDB/web-app/images/tree/default/lp.gif new file mode 100644 index 0000000..b87f003 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/lp.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/lph.gif b/projekte/MDB/web-app/images/tree/default/lph.gif new file mode 100644 index 0000000..e3478d8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/lph.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/tm.gif b/projekte/MDB/web-app/images/tree/default/tm.gif new file mode 100644 index 0000000..e30abad Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/tm.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/tmh.gif b/projekte/MDB/web-app/images/tree/default/tmh.gif new file mode 100644 index 0000000..ad7e557 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/tmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/tn.gif b/projekte/MDB/web-app/images/tree/default/tn.gif new file mode 100644 index 0000000..4a28039 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/tn.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/tp.gif b/projekte/MDB/web-app/images/tree/default/tp.gif new file mode 100644 index 0000000..d6d0ed0 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/tp.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/tph.gif b/projekte/MDB/web-app/images/tree/default/tph.gif new file mode 100644 index 0000000..e4d7d99 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/tph.gif differ diff --git a/projekte/MDB/web-app/images/tree/default/vline.gif b/projekte/MDB/web-app/images/tree/default/vline.gif new file mode 100644 index 0000000..1fb0de8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/default/vline.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/lm.gif b/projekte/MDB/web-app/images/tree/folders/lm.gif new file mode 100644 index 0000000..b562300 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/lm.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/lmh.gif b/projekte/MDB/web-app/images/tree/folders/lmh.gif new file mode 100644 index 0000000..a17fe23 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/lmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/ln.gif b/projekte/MDB/web-app/images/tree/folders/ln.gif new file mode 100644 index 0000000..b7b3e55 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/ln.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/loading.gif b/projekte/MDB/web-app/images/tree/folders/loading.gif new file mode 100644 index 0000000..0bbf3bc Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/loading.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/lp.gif b/projekte/MDB/web-app/images/tree/folders/lp.gif new file mode 100644 index 0000000..b9f5485 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/lp.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/lph.gif b/projekte/MDB/web-app/images/tree/folders/lph.gif new file mode 100644 index 0000000..f663714 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/lph.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/tm.gif b/projekte/MDB/web-app/images/tree/folders/tm.gif new file mode 100644 index 0000000..56622cc Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/tm.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/tmh.gif b/projekte/MDB/web-app/images/tree/folders/tmh.gif new file mode 100644 index 0000000..e42349e Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/tmh.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/tn.gif b/projekte/MDB/web-app/images/tree/folders/tn.gif new file mode 100644 index 0000000..4a28039 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/tn.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/tp.gif b/projekte/MDB/web-app/images/tree/folders/tp.gif new file mode 100644 index 0000000..906e8c4 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/tp.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/tph.gif b/projekte/MDB/web-app/images/tree/folders/tph.gif new file mode 100644 index 0000000..8aa7c25 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/tph.gif differ diff --git a/projekte/MDB/web-app/images/tree/folders/vline.gif b/projekte/MDB/web-app/images/tree/folders/vline.gif new file mode 100644 index 0000000..1fb0de8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/folders/vline.gif differ diff --git a/projekte/MDB/web-app/images/tree/greybg.png b/projekte/MDB/web-app/images/tree/greybg.png new file mode 100644 index 0000000..1ff7817 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/greybg.png differ diff --git a/projekte/MDB/web-app/images/tree/header.gif b/projekte/MDB/web-app/images/tree/header.gif new file mode 100644 index 0000000..6bb816c Binary files /dev/null and b/projekte/MDB/web-app/images/tree/header.gif differ diff --git a/projekte/MDB/web-app/images/tree/logo.gif b/projekte/MDB/web-app/images/tree/logo.gif new file mode 100644 index 0000000..7b00575 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/logo.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/collapse.gif b/projekte/MDB/web-app/images/tree/menu/collapse.gif new file mode 100644 index 0000000..45a475b Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/collapse.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/collapseh.gif b/projekte/MDB/web-app/images/tree/menu/collapseh.gif new file mode 100644 index 0000000..4f13b3e Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/collapseh.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/collapseon.gif b/projekte/MDB/web-app/images/tree/menu/collapseon.gif new file mode 100644 index 0000000..0a4dba1 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/collapseon.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/dash.gif b/projekte/MDB/web-app/images/tree/menu/dash.gif new file mode 100644 index 0000000..06580b9 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/dash.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/expand.gif b/projekte/MDB/web-app/images/tree/menu/expand.gif new file mode 100644 index 0000000..bdbed54 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/expand.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/expandh.gif b/projekte/MDB/web-app/images/tree/menu/expandh.gif new file mode 100644 index 0000000..343279e Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/expandh.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/expandon.gif b/projekte/MDB/web-app/images/tree/menu/expandon.gif new file mode 100644 index 0000000..9781085 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/expandon.gif differ diff --git a/projekte/MDB/web-app/images/tree/menu/loading.gif b/projekte/MDB/web-app/images/tree/menu/loading.gif new file mode 100644 index 0000000..0bbf3bc Binary files /dev/null and b/projekte/MDB/web-app/images/tree/menu/loading.gif differ diff --git a/projekte/MDB/web-app/images/tree/navHover2.png b/projekte/MDB/web-app/images/tree/navHover2.png new file mode 100644 index 0000000..9097f63 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/navHover2.png differ diff --git a/projekte/MDB/web-app/images/tree/qbottom.png b/projekte/MDB/web-app/images/tree/qbottom.png new file mode 100644 index 0000000..aa792d8 Binary files /dev/null and b/projekte/MDB/web-app/images/tree/qbottom.png differ diff --git a/projekte/MDB/web-app/images/tree/qmiddle.png b/projekte/MDB/web-app/images/tree/qmiddle.png new file mode 100644 index 0000000..331fc6b Binary files /dev/null and b/projekte/MDB/web-app/images/tree/qmiddle.png differ diff --git a/projekte/MDB/web-app/images/tree/qtop.png b/projekte/MDB/web-app/images/tree/qtop.png new file mode 100644 index 0000000..07e845e Binary files /dev/null and b/projekte/MDB/web-app/images/tree/qtop.png differ diff --git a/projekte/MDB/web-app/index.gsp b/projekte/MDB/web-app/index.gsp new file mode 100644 index 0000000..ef390eb --- /dev/null +++ b/projekte/MDB/web-app/index.gsp @@ -0,0 +1,28 @@ + + + Welcome to Grails + + + +

Grails Logo

+

Welcome to MDB

+

+ This is the main page of MDB. Probably you would like to: +

+ +
+

+ For Developers: Below ist a list of all available controllers: +

+ +
+ + + diff --git a/projekte/MDB/web-app/js/application.js b/projekte/MDB/web-app/js/application.js new file mode 100644 index 0000000..1bf791a --- /dev/null +++ b/projekte/MDB/web-app/js/application.js @@ -0,0 +1,13 @@ +var Ajax; +if (Ajax && (Ajax != null)) { + Ajax.Responders.register({ + onCreate: function() { + if($('spinner') && Ajax.activeRequestCount>0) + Effect.Appear('spinner',{duration:0.5,queue:'end'}); + }, + onComplete: function() { + if($('spinner') && Ajax.activeRequestCount==0) + Effect.Fade('spinner',{duration:0.5,queue:'end'}); + } + }); +} diff --git a/projekte/MDB/web-app/js/prototype/animation.js b/projekte/MDB/web-app/js/prototype/animation.js new file mode 100644 index 0000000..c35c2a5 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/animation.js @@ -0,0 +1,7 @@ +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 0.10.0 +*/ +YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={doMethod:function(attribute,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attribute,val,unit){YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);},getAttribute:function(attribute){return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));},defaultUnit:'px',defaultUnits:{opacity:' '},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var endTime=null;var actualFrames=0;var defaultValues={};el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.setDefault=function(attribute,val){if(val.constructor!=Array&&(val=='auto'||isNaN(val))){switch(attribute){case'width':val=el.clientWidth||el.offsetWidth;break;case'height':val=el.clientHeight||el.offsetHeight;break;case'left':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetLeft;}else{val=0;}break;case'top':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetTop;}else{val=0;}break;default:val=0;}}defaultValues[attribute]=val;};this.getDefault=function(attribute){return defaultValues[attribute];};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.animate=function(){if(this.isAnimated()){return false;}this.onStart.fire();this._onStart.fire();this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);var attributes=this.attributes;var el=this.getEl();var val;for(var attribute in attributes){val=this.getAttribute(attribute);this.setDefault(attribute,val);}isAnimated=true;actualFrames=0;startTime=new Date();};this.stop=function(){if(!this.isAnimated()){return false;}this.currentFrame=0;endTime=new Date();var data={time:endTime,duration:endTime-startTime,frames:actualFrames,fps:actualFrames/this.duration};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};var onTween=function(){var start;var end=null;var val;var unit;var attributes=this['attributes'];for(var attribute in attributes){unit=attributes[attribute]['unit']||this.defaultUnits[attribute]||this.defaultUnit;if(typeof attributes[attribute]['from']!='undefined'){start=attributes[attribute]['from'];}else{start=this.getDefault(attribute);}if(typeof attributes[attribute]['to']!='undefined'){end=attributes[attribute]['to'];}else if(typeof attributes[attribute]['by']!='undefined'){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&control[0].constructor!=Array){control=[control];}if(YAHOO.util.Dom.getStyle(this.getEl(),'position')=='static'){YAHOO.util.Dom.setStyle(this.getEl(),'position','relative');}if(typeof attributes['points']['from']!='undefined'){YAHOO.util.Dom.setXY(this.getEl(),attributes['points']['from']);start=this.getAttribute('points');}else if((start[0]===0||start[1]===0)){YAHOO.util.Dom.setXY(this.getEl(),YAHOO.util.Dom.getXY(this.getEl()));start=this.getAttribute('points');}var i,len;if(typeof attributes['points']['to']!='undefined'){end=translateValues(attributes['points']['to'],this);for(i=0,len=control.length;i0){translatedPoints=translatedPoints.concat(control);}translatedPoints[translatedPoints.length]=end;}};this._onStart.subscribe(onStart);};YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Anim.call(this,el,attributes,duration,method);}};YAHOO.util.Scroll.prototype=new YAHOO.util.Anim();YAHOO.util.Scroll.prototype.defaultUnits.scroll=' ';YAHOO.util.Scroll.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}return val;};YAHOO.util.Scroll.prototype.getAttribute=function(attribute){var val=null;var el=this.getEl();if(attribute=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=parseFloat(YAHOO.util.Dom.getStyle(el,attribute));}return val;};YAHOO.util.Scroll.prototype.setAttribute=function(attribute,val,unit){var el=this.getEl();if(attribute=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{YAHOO.util.Dom.setStyle(el,attribute,val+unit);}}; diff --git a/projekte/MDB/web-app/js/prototype/builder.js b/projekte/MDB/web-app/js/prototype/builder.js new file mode 100644 index 0000000..5b15ba9 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/builder.js @@ -0,0 +1,101 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// See scriptaculous.js for full license. + +var Builder = { + NODEMAP: { + AREA: 'map', + CAPTION: 'table', + COL: 'table', + COLGROUP: 'table', + LEGEND: 'fieldset', + OPTGROUP: 'select', + OPTION: 'select', + PARAM: 'object', + TBODY: 'table', + TD: 'table', + TFOOT: 'table', + TH: 'table', + THEAD: 'table', + TR: 'table' + }, + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, + // due to a Firefox bug + node: function(elementName) { + elementName = elementName.toUpperCase(); + + // try innerHTML approach + var parentTag = this.NODEMAP[elementName] || 'div'; + var parentElement = document.createElement(parentTag); + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" + elementName + ">"; + } catch(e) {} + var element = parentElement.firstChild || null; + + // see if browser added wrapping tags + if(element && (element.tagName != elementName)) + element = element.getElementsByTagName(elementName)[0]; + + // fallback to createElement approach + if(!element) element = document.createElement(elementName); + + // abort if nothing could be created + if(!element) return; + + // attributes (or text) + if(arguments[1]) + if(this._isStringOrNumber(arguments[1]) || + (arguments[1] instanceof Array)) { + this._children(element, arguments[1]); + } else { + var attrs = this._attributes(arguments[1]); + if(attrs.length) { + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" +elementName + " " + + attrs + ">"; + } catch(e) {} + element = parentElement.firstChild || null; + // workaround firefox 1.0.X bug + if(!element) { + element = document.createElement(elementName); + for(attr in arguments[1]) + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; + } + if(element.tagName != elementName) + element = parentElement.getElementsByTagName(elementName)[0]; + } + } + + // text, or array of children + if(arguments[2]) + this._children(element, arguments[2]); + + return element; + }, + _text: function(text) { + return document.createTextNode(text); + }, + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + attrs.push((attribute=='className' ? 'class' : attribute) + + '="' + attributes[attribute].toString().escapeHTML() + '"'); + return attrs.join(" "); + }, + _children: function(element, children) { + if(typeof children=='object') { // array can hold nodes and text + children.flatten().each( function(e) { + if(typeof e=='object') + element.appendChild(e) + else + if(Builder._isStringOrNumber(e)) + element.appendChild(Builder._text(e)); + }); + } else + if(Builder._isStringOrNumber(children)) + element.appendChild(Builder._text(children)); + }, + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + } +} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/controls.js b/projekte/MDB/web-app/js/prototype/controls.js new file mode 100644 index 0000000..de0261e --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/controls.js @@ -0,0 +1,815 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005 Jon Tirsen (http://www.tirsen.com) +// Contributors: +// Richard Livsey +// Rahul Bhargava +// Rob Wills +// +// See scriptaculous.js for full license. + +// Autocompleter.Base handles all the autocompletion functionality +// that's independent of the data source for autocompletion. This +// includes drawing the autocompletion menu, observing keyboard +// and mouse events, and similar. +// +// Specific autocompleters need to provide, at the very least, +// a getUpdatedChoices function that will be invoked every time +// the text inside the monitored textbox changes. This method +// should get the text for which to provide autocompletion by +// invoking this.getToken(), NOT by directly accessing +// this.element.value. This is to allow incremental tokenized +// autocompletion. Specific auto-completion logic (AJAX, etc) +// belongs in getUpdatedChoices. +// +// Tokenized incremental autocompletion is enabled automatically +// when an autocompleter is instantiated with the 'tokens' option +// in the options parameter, e.g.: +// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); +// will incrementally autocomplete with a comma as the token. +// Additionally, ',' in the above example can be replaced with +// a token array, e.g. { tokens: [',', '\n'] } which +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it +// allows smart autocompletion after linebreaks. + +var Autocompleter = {} +Autocompleter.Base = function() {}; +Autocompleter.Base.prototype = { + baseInitialize: function(element, update, options) { + this.element = $(element); + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; + this.entryCount = 0; + + if (this.setOptions) + this.setOptions(options); + else + this.options = options || {}; + + this.options.paramName = this.options.paramName || this.element.name; + this.options.tokens = this.options.tokens || []; + this.options.frequency = this.options.frequency || 0.4; + this.options.minChars = this.options.minChars || 1; + this.options.onShow = this.options.onShow || + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + } + Effect.Appear(update,{duration:0.15}); + }; + this.options.onHide = this.options.onHide || + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + + if (typeof(this.options.tokens) == 'string') + this.options.tokens = new Array(this.options.tokens); + + this.observer = null; + + this.element.setAttribute('autocomplete','off'); + + Element.hide(this.update); + + Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); + }, + + show: function() { + if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); + if(!this.iefix && + (navigator.appVersion.indexOf('MSIE')>0) && + (navigator.userAgent.indexOf('Opera')<0) && + (Element.getStyle(this.update, 'position')=='absolute')) { + new Insertion.After(this.update, + ''); + this.iefix = $(this.update.id+'_iefix'); + } + if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); + }, + + fixIEOverlapping: function() { + Position.clone(this.update, this.iefix); + this.iefix.style.zIndex = 1; + this.update.style.zIndex = 2; + Element.show(this.iefix); + }, + + hide: function() { + this.stopIndicator(); + if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); + if(this.iefix) Element.hide(this.iefix); + }, + + startIndicator: function() { + if(this.options.indicator) Element.show(this.options.indicator); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.hide(this.options.indicator); + }, + + onKeyPress: function(event) { + if(this.active) + switch(event.keyCode) { + case Event.KEY_TAB: + case Event.KEY_RETURN: + this.selectEntry(); + Event.stop(event); + case Event.KEY_ESC: + this.hide(); + this.active = false; + Event.stop(event); + return; + case Event.KEY_LEFT: + case Event.KEY_RIGHT: + return; + case Event.KEY_UP: + this.markPrevious(); + this.render(); + if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); + return; + } + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return; + + this.changed = true; + this.hasFocus = true; + + if(this.observer) clearTimeout(this.observer); + this.observer = + setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); + }, + + activate: function() { + this.changed = false; + this.hasFocus = true; + this.getUpdatedChoices(); + }, + + onHover: function(event) { + var element = Event.findElement(event, 'LI'); + if(this.index != element.autocompleteIndex) + { + this.index = element.autocompleteIndex; + this.render(); + } + Event.stop(event); + }, + + onClick: function(event) { + var element = Event.findElement(event, 'LI'); + this.index = element.autocompleteIndex; + this.selectEntry(); + this.hide(); + }, + + onBlur: function(event) { + // needed to make click events working + setTimeout(this.hide.bind(this), 250); + this.hasFocus = false; + this.active = false; + }, + + render: function() { + if(this.entryCount > 0) { + for (var i = 0; i < this.entryCount; i++) + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : + Element.removeClassName(this.getEntry(i),"selected"); + + if(this.hasFocus) { + this.show(); + this.active = true; + } + } else { + this.active = false; + this.hide(); + } + }, + + markPrevious: function() { + if(this.index > 0) this.index-- + else this.index = this.entryCount-1; + }, + + markNext: function() { + if(this.index < this.entryCount-1) this.index++ + else this.index = 0; + }, + + getEntry: function(index) { + return this.update.firstChild.childNodes[index]; + }, + + getCurrentEntry: function() { + return this.getEntry(this.index); + }, + + selectEntry: function() { + this.active = false; + this.updateElement(this.getCurrentEntry()); + }, + + updateElement: function(selectedElement) { + if (this.options.updateElement) { + this.options.updateElement(selectedElement); + return; + } + var value = ''; + if (this.options.select) { + var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; + if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); + } else + value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); + + var lastTokenPos = this.findLastToken(); + if (lastTokenPos != -1) { + var newValue = this.element.value.substr(0, lastTokenPos + 1); + var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/); + if (whitespace) + newValue += whitespace[0]; + this.element.value = newValue + value; + } else { + this.element.value = value; + } + this.element.focus(); + + if (this.options.afterUpdateElement) + this.options.afterUpdateElement(this.element, selectedElement); + }, + + updateChoices: function(choices) { + if(!this.changed && this.hasFocus) { + this.update.innerHTML = choices; + Element.cleanWhitespace(this.update); + Element.cleanWhitespace(this.update.firstChild); + + if(this.update.firstChild && this.update.firstChild.childNodes) { + this.entryCount = + this.update.firstChild.childNodes.length; + for (var i = 0; i < this.entryCount; i++) { + var entry = this.getEntry(i); + entry.autocompleteIndex = i; + this.addObservers(entry); + } + } else { + this.entryCount = 0; + } + + this.stopIndicator(); + + this.index = 0; + this.render(); + } + }, + + addObservers: function(element) { + Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); + Event.observe(element, "click", this.onClick.bindAsEventListener(this)); + }, + + onObserverEvent: function() { + this.changed = false; + if(this.getToken().length>=this.options.minChars) { + this.startIndicator(); + this.getUpdatedChoices(); + } else { + this.active = false; + this.hide(); + } + }, + + getToken: function() { + var tokenPos = this.findLastToken(); + if (tokenPos != -1) + var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,''); + else + var ret = this.element.value; + + return /\n/.test(ret) ? '' : ret; + }, + + findLastToken: function() { + var lastTokenPos = -1; + + for (var i=0; i lastTokenPos) + lastTokenPos = thisTokenPos; + } + return lastTokenPos; + } +} + +Ajax.Autocompleter = Class.create(); +Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { + initialize: function(element, update, url, options) { + this.baseInitialize(element, update, options); + this.options.asynchronous = true; + this.options.onComplete = this.onComplete.bind(this); + this.options.defaultParams = this.options.parameters || null; + this.url = url; + }, + + getUpdatedChoices: function() { + entry = encodeURIComponent(this.options.paramName) + '=' + + encodeURIComponent(this.getToken()); + + this.options.parameters = this.options.callback ? + this.options.callback(this.element, entry) : entry; + + if(this.options.defaultParams) + this.options.parameters += '&' + this.options.defaultParams; + + new Ajax.Request(this.url, this.options); + }, + + onComplete: function(request) { + this.updateChoices(request.responseText); + } + +}); + +// The local array autocompleter. Used when you'd prefer to +// inject an array of autocompletion options into the page, rather +// than sending out Ajax queries, which can be quite slow sometimes. +// +// The constructor takes four parameters. The first two are, as usual, +// the id of the monitored textbox, and id of the autocompletion menu. +// The third is the array you want to autocomplete from, and the fourth +// is the options block. +// +// Extra local autocompletion options: +// - choices - How many autocompletion choices to offer +// +// - partialSearch - If false, the autocompleter will match entered +// text only at the beginning of strings in the +// autocomplete array. Defaults to true, which will +// match text at the beginning of any *word* in the +// strings in the autocomplete array. If you want to +// search anywhere in the string, additionally set +// the option fullSearch to true (default: off). +// +// - fullSsearch - Search anywhere in autocomplete array strings. +// +// - partialChars - How many characters to enter before triggering +// a partial match (unlike minChars, which defines +// how many characters are required to do any match +// at all). Defaults to 2. +// +// - ignoreCase - Whether to ignore case when autocompleting. +// Defaults to true. +// +// It's possible to pass in a custom function as the 'selector' +// option, if you prefer to write your own autocompletion logic. +// In that case, the other options above will not apply unless +// you support them. + +Autocompleter.Local = Class.create(); +Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { + initialize: function(element, update, array, options) { + this.baseInitialize(element, update, options); + this.options.array = array; + }, + + getUpdatedChoices: function() { + this.updateChoices(this.options.selector(this)); + }, + + setOptions: function(options) { + this.options = Object.extend({ + choices: 10, + partialSearch: true, + partialChars: 2, + ignoreCase: true, + fullSearch: false, + selector: function(instance) { + var ret = []; // Beginning matches + var partial = []; // Inside matches + var entry = instance.getToken(); + var count = 0; + + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { + + var elem = instance.options.array[i]; + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : + elem.indexOf(entry); + + while (foundPos != -1) { + if (foundPos == 0 && elem.length != entry.length) { + ret.push("
  • " + elem.substr(0, entry.length) + "" + + elem.substr(entry.length) + "
  • "); + break; + } else if (entry.length >= instance.options.partialChars && + instance.options.partialSearch && foundPos != -1) { + if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { + partial.push("
  • " + elem.substr(0, foundPos) + "" + + elem.substr(foundPos, entry.length) + "" + elem.substr( + foundPos + entry.length) + "
  • "); + break; + } + } + + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + elem.indexOf(entry, foundPos + 1); + + } + } + if (partial.length) + ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) + return "
      " + ret.join('') + "
    "; + } + }, options || {}); + } +}); + +// AJAX in-place editor +// +// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor + +// Use this if you notice weird scrolling problems on some browsers, +// the DOM might be a bit confused when this gets called so do this +// waits 1 ms (with setTimeout) until it does the activation +Field.scrollFreeActivate = function(field) { + setTimeout(function() { + Field.activate(field); + }, 1); +} + +Ajax.InPlaceEditor = Class.create(); +Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99"; +Ajax.InPlaceEditor.prototype = { + initialize: function(element, url, options) { + this.url = url; + this.element = $(element); + + this.options = Object.extend({ + okButton: true, + okText: "ok", + cancelLink: true, + cancelText: "cancel", + savingText: "Saving...", + clickToEditText: "Click to edit", + okText: "ok", + rows: 1, + onComplete: function(transport, element) { + new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); + }, + onFailure: function(transport) { + alert("Error communicating with the server: " + transport.responseText.stripTags()); + }, + callback: function(form) { + return Form.serialize(form); + }, + handleLineBreaks: true, + loadingText: 'Loading...', + savingClassName: 'inplaceeditor-saving', + loadingClassName: 'inplaceeditor-loading', + formClassName: 'inplaceeditor-form', + highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor, + highlightendcolor: "#FFFFFF", + externalControl: null, + submitOnBlur: false, + ajaxOptions: {}, + evalScripts: false + }, options || {}); + + if(!this.options.formId && this.element.id) { + this.options.formId = this.element.id + "-inplaceeditor"; + if ($(this.options.formId)) { + // there's already a form with that name, don't specify an id + this.options.formId = null; + } + } + + if (this.options.externalControl) { + this.options.externalControl = $(this.options.externalControl); + } + + this.originalBackground = Element.getStyle(this.element, 'background-color'); + if (!this.originalBackground) { + this.originalBackground = "transparent"; + } + + this.element.title = this.options.clickToEditText; + + this.onclickListener = this.enterEditMode.bindAsEventListener(this); + this.mouseoverListener = this.enterHover.bindAsEventListener(this); + this.mouseoutListener = this.leaveHover.bindAsEventListener(this); + Event.observe(this.element, 'click', this.onclickListener); + Event.observe(this.element, 'mouseover', this.mouseoverListener); + Event.observe(this.element, 'mouseout', this.mouseoutListener); + if (this.options.externalControl) { + Event.observe(this.options.externalControl, 'click', this.onclickListener); + Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener); + Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener); + } + }, + enterEditMode: function(evt) { + if (this.saving) return; + if (this.editing) return; + this.editing = true; + this.onEnterEditMode(); + if (this.options.externalControl) { + Element.hide(this.options.externalControl); + } + Element.hide(this.element); + this.createForm(); + this.element.parentNode.insertBefore(this.form, this.element); + Field.scrollFreeActivate(this.editField); + // stop the event to avoid a page refresh in Safari + if (evt) { + Event.stop(evt); + } + return false; + }, + createForm: function() { + this.form = document.createElement("form"); + this.form.id = this.options.formId; + Element.addClassName(this.form, this.options.formClassName) + this.form.onsubmit = this.onSubmit.bind(this); + + this.createEditField(); + + if (this.options.textarea) { + var br = document.createElement("br"); + this.form.appendChild(br); + } + + if (this.options.okButton) { + okButton = document.createElement("input"); + okButton.type = "submit"; + okButton.value = this.options.okText; + okButton.className = 'editor_ok_button'; + this.form.appendChild(okButton); + } + + if (this.options.cancelLink) { + cancelLink = document.createElement("a"); + cancelLink.href = "#"; + cancelLink.appendChild(document.createTextNode(this.options.cancelText)); + cancelLink.onclick = this.onclickCancel.bind(this); + cancelLink.className = 'editor_cancel'; + this.form.appendChild(cancelLink); + } + }, + hasHTMLLineBreaks: function(string) { + if (!this.options.handleLineBreaks) return false; + return string.match(/
    /i); + }, + convertHTMLLineBreaks: function(string) { + return string.replace(/
    /gi, "\n").replace(//gi, "\n").replace(/<\/p>/gi, "\n").replace(/

    /gi, ""); + }, + createEditField: function() { + var text; + if(this.options.loadTextURL) { + text = this.options.loadingText; + } else { + text = this.getText(); + } + + var obj = this; + + if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) { + this.options.textarea = false; + var textField = document.createElement("input"); + textField.obj = this; + textField.type = "text"; + textField.name = "value"; + textField.value = text; + textField.style.backgroundColor = this.options.highlightcolor; + textField.className = 'editor_field'; + var size = this.options.size || this.options.cols || 0; + if (size != 0) textField.size = size; + if (this.options.submitOnBlur) + textField.onblur = this.onSubmit.bind(this); + this.editField = textField; + } else { + this.options.textarea = true; + var textArea = document.createElement("textarea"); + textArea.obj = this; + textArea.name = "value"; + textArea.value = this.convertHTMLLineBreaks(text); + textArea.rows = this.options.rows; + textArea.cols = this.options.cols || 40; + textArea.className = 'editor_field'; + if (this.options.submitOnBlur) + textArea.onblur = this.onSubmit.bind(this); + this.editField = textArea; + } + + if(this.options.loadTextURL) { + this.loadExternalText(); + } + this.form.appendChild(this.editField); + }, + getText: function() { + return this.element.innerHTML; + }, + loadExternalText: function() { + Element.addClassName(this.form, this.options.loadingClassName); + this.editField.disabled = true; + new Ajax.Request( + this.options.loadTextURL, + Object.extend({ + asynchronous: true, + onComplete: this.onLoadedExternalText.bind(this) + }, this.options.ajaxOptions) + ); + }, + onLoadedExternalText: function(transport) { + Element.removeClassName(this.form, this.options.loadingClassName); + this.editField.disabled = false; + this.editField.value = transport.responseText.stripTags(); + }, + onclickCancel: function() { + this.onComplete(); + this.leaveEditMode(); + return false; + }, + onFailure: function(transport) { + this.options.onFailure(transport); + if (this.oldInnerHTML) { + this.element.innerHTML = this.oldInnerHTML; + this.oldInnerHTML = null; + } + return false; + }, + onSubmit: function() { + // onLoading resets these so we need to save them away for the Ajax call + var form = this.form; + var value = this.editField.value; + + // do this first, sometimes the ajax call returns before we get a chance to switch on Saving... + // which means this will actually switch on Saving... *after* we've left edit mode causing Saving... + // to be displayed indefinitely + this.onLoading(); + + if (this.options.evalScripts) { + new Ajax.Request( + this.url, Object.extend({ + parameters: this.options.callback(form, value), + onComplete: this.onComplete.bind(this), + onFailure: this.onFailure.bind(this), + asynchronous:true, + evalScripts:true + }, this.options.ajaxOptions)); + } else { + new Ajax.Updater( + { success: this.element, + // don't update on failure (this could be an option) + failure: null }, + this.url, Object.extend({ + parameters: this.options.callback(form, value), + onComplete: this.onComplete.bind(this), + onFailure: this.onFailure.bind(this) + }, this.options.ajaxOptions)); + } + // stop the event to avoid a page refresh in Safari + if (arguments.length > 1) { + Event.stop(arguments[0]); + } + return false; + }, + onLoading: function() { + this.saving = true; + this.removeForm(); + this.leaveHover(); + this.showSaving(); + }, + showSaving: function() { + this.oldInnerHTML = this.element.innerHTML; + this.element.innerHTML = this.options.savingText; + Element.addClassName(this.element, this.options.savingClassName); + this.element.style.backgroundColor = this.originalBackground; + Element.show(this.element); + }, + removeForm: function() { + if(this.form) { + if (this.form.parentNode) Element.remove(this.form); + this.form = null; + } + }, + enterHover: function() { + if (this.saving) return; + this.element.style.backgroundColor = this.options.highlightcolor; + if (this.effect) { + this.effect.cancel(); + } + Element.addClassName(this.element, this.options.hoverClassName) + }, + leaveHover: function() { + if (this.options.backgroundColor) { + this.element.style.backgroundColor = this.oldBackground; + } + Element.removeClassName(this.element, this.options.hoverClassName) + if (this.saving) return; + this.effect = new Effect.Highlight(this.element, { + startcolor: this.options.highlightcolor, + endcolor: this.options.highlightendcolor, + restorecolor: this.originalBackground + }); + }, + leaveEditMode: function() { + Element.removeClassName(this.element, this.options.savingClassName); + this.removeForm(); + this.leaveHover(); + this.element.style.backgroundColor = this.originalBackground; + Element.show(this.element); + if (this.options.externalControl) { + Element.show(this.options.externalControl); + } + this.editing = false; + this.saving = false; + this.oldInnerHTML = null; + this.onLeaveEditMode(); + }, + onComplete: function(transport) { + this.leaveEditMode(); + this.options.onComplete.bind(this)(transport, this.element); + }, + onEnterEditMode: function() {}, + onLeaveEditMode: function() {}, + dispose: function() { + if (this.oldInnerHTML) { + this.element.innerHTML = this.oldInnerHTML; + } + this.leaveEditMode(); + Event.stopObserving(this.element, 'click', this.onclickListener); + Event.stopObserving(this.element, 'mouseover', this.mouseoverListener); + Event.stopObserving(this.element, 'mouseout', this.mouseoutListener); + if (this.options.externalControl) { + Event.stopObserving(this.options.externalControl, 'click', this.onclickListener); + Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener); + Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener); + } + } +}; + +Ajax.InPlaceCollectionEditor = Class.create(); +Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); +Object.extend(Ajax.InPlaceCollectionEditor.prototype, { + createEditField: function() { + if (!this.cached_selectTag) { + var selectTag = document.createElement("select"); + var collection = this.options.collection || []; + var optionTag; + collection.each(function(e,i) { + optionTag = document.createElement("option"); + optionTag.value = (e instanceof Array) ? e[0] : e; + if(this.options.value==optionTag.value) optionTag.selected = true; + optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e)); + selectTag.appendChild(optionTag); + }.bind(this)); + this.cached_selectTag = selectTag; + } + + this.editField = this.cached_selectTag; + if(this.options.loadTextURL) this.loadExternalText(); + this.form.appendChild(this.editField); + this.options.callback = function(form, value) { + return "value=" + encodeURIComponent(value); + } + } +}); + +// Delayed observer, like Form.Element.Observer, +// but waits for delay after last key input +// Ideal for live-search fields + +Form.Element.DelayedObserver = Class.create(); +Form.Element.DelayedObserver.prototype = { + initialize: function(element, delay, callback) { + this.delay = delay || 0.5; + this.element = $(element); + this.callback = callback; + this.timer = null; + this.lastValue = $F(this.element); + Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); + }, + delayedListener: function(event) { + if(this.lastValue == $F(this.element)) return; + if(this.timer) clearTimeout(this.timer); + this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); + this.lastValue = $F(this.element); + }, + onTimerEvent: function() { + this.timer = null; + this.callback(this.element, $F(this.element)); + } +}; diff --git a/projekte/MDB/web-app/js/prototype/dragdrop.js b/projekte/MDB/web-app/js/prototype/dragdrop.js new file mode 100644 index 0000000..be2a30f --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/dragdrop.js @@ -0,0 +1,915 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) +// +// See scriptaculous.js for full license. + +/*--------------------------------------------------------------------------*/ + +var Droppables = { + drops: [], + + remove: function(element) { + this.drops = this.drops.reject(function(d) { return d.element==$(element) }); + }, + + add: function(element) { + element = $(element); + var options = Object.extend({ + greedy: true, + hoverclass: null, + tree: false + }, arguments[1] || {}); + + // cache containers + if(options.containment) { + options._containers = []; + var containment = options.containment; + if((typeof containment == 'object') && + (containment.constructor == Array)) { + containment.each( function(c) { options._containers.push($(c)) }); + } else { + options._containers.push($(containment)); + } + } + + if(options.accept) options.accept = [options.accept].flatten(); + + Element.makePositioned(element); // fix IE + options.element = element; + + this.drops.push(options); + }, + + findDeepestChild: function(drops) { + deepest = drops[0]; + + for (i = 1; i < drops.length; ++i) + if (Element.isParent(drops[i].element, deepest.element)) + deepest = drops[i]; + + return deepest; + }, + + isContained: function(element, drop) { + var containmentNode; + if(drop.tree) { + containmentNode = element.treeNode; + } else { + containmentNode = element.parentNode; + } + return drop._containers.detect(function(c) { return containmentNode == c }); + }, + + isAffected: function(point, element, drop) { + return ( + (drop.element!=element) && + ((!drop._containers) || + this.isContained(element, drop)) && + ((!drop.accept) || + (Element.classNames(element).detect( + function(v) { return drop.accept.include(v) } ) )) && + Position.within(drop.element, point[0], point[1]) ); + }, + + deactivate: function(drop) { + if(drop.hoverclass) + Element.removeClassName(drop.element, drop.hoverclass); + this.last_active = null; + }, + + activate: function(drop) { + if(drop.hoverclass) + Element.addClassName(drop.element, drop.hoverclass); + this.last_active = drop; + }, + + show: function(point, element) { + if(!this.drops.length) return; + var affected = []; + + if(this.last_active) this.deactivate(this.last_active); + this.drops.each( function(drop) { + if(Droppables.isAffected(point, element, drop)) + affected.push(drop); + }); + + if(affected.length>0) { + drop = Droppables.findDeepestChild(affected); + Position.within(drop.element, point[0], point[1]); + if(drop.onHover) + drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); + + Droppables.activate(drop); + } + }, + + fire: function(event, element) { + if(!this.last_active) return; + Position.prepare(); + + if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) + if (this.last_active.onDrop) + this.last_active.onDrop(element, this.last_active.element, event); + }, + + reset: function() { + if(this.last_active) + this.deactivate(this.last_active); + } +} + +var Draggables = { + drags: [], + observers: [], + + register: function(draggable) { + if(this.drags.length == 0) { + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.updateDrag.bindAsEventListener(this); + this.eventKeypress = this.keyPress.bindAsEventListener(this); + + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + Event.observe(document, "keypress", this.eventKeypress); + } + this.drags.push(draggable); + }, + + unregister: function(draggable) { + this.drags = this.drags.reject(function(d) { return d==draggable }); + if(this.drags.length == 0) { + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + Event.stopObserving(document, "keypress", this.eventKeypress); + } + }, + + activate: function(draggable) { + window.focus(); // allows keypress events if window isn't currently focused, fails for Safari + this.activeDraggable = draggable; + }, + + deactivate: function() { + this.activeDraggable = null; + }, + + updateDrag: function(event) { + if(!this.activeDraggable) return; + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + // Mozilla-based browsers fire successive mousemove events with + // the same coordinates, prevent needless redrawing (moz bug?) + if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; + this._lastPointer = pointer; + this.activeDraggable.updateDrag(event, pointer); + }, + + endDrag: function(event) { + if(!this.activeDraggable) return; + this._lastPointer = null; + this.activeDraggable.endDrag(event); + this.activeDraggable = null; + }, + + keyPress: function(event) { + if(this.activeDraggable) + this.activeDraggable.keyPress(event); + }, + + addObserver: function(observer) { + this.observers.push(observer); + this._cacheObserverCallbacks(); + }, + + removeObserver: function(element) { // element instead of observer fixes mem leaks + this.observers = this.observers.reject( function(o) { return o.element==element }); + this._cacheObserverCallbacks(); + }, + + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' + if(this[eventName+'Count'] > 0) + this.observers.each( function(o) { + if(o[eventName]) o[eventName](eventName, draggable, event); + }); + }, + + _cacheObserverCallbacks: function() { + ['onStart','onEnd','onDrag'].each( function(eventName) { + Draggables[eventName+'Count'] = Draggables.observers.select( + function(o) { return o[eventName]; } + ).length; + }); + } +} + +/*--------------------------------------------------------------------------*/ + +var Draggable = Class.create(); +Draggable.prototype = { + initialize: function(element) { + var options = Object.extend({ + handle: false, + starteffect: function(element) { + element._opacity = Element.getOpacity(element); + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + }, + reverteffect: function(element, top_offset, left_offset) { + var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; + element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur}); + }, + endeffect: function(element) { + var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0 + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity}); + }, + zindex: 1000, + revert: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + snap: false // false, or xy or [x,y] or function(x,y){ return [x,y] } + }, arguments[1] || {}); + + this.element = $(element); + + if(options.handle && (typeof options.handle == 'string')) { + var h = Element.childrenWithClassName(this.element, options.handle, true); + if(h.length>0) this.handle = h[0]; + } + if(!this.handle) this.handle = $(options.handle); + if(!this.handle) this.handle = this.element; + + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) + options.scroll = $(options.scroll); + + Element.makePositioned(this.element); // fix IE + + this.delta = this.currentDelta(); + this.options = options; + this.dragging = false; + + this.eventMouseDown = this.initDrag.bindAsEventListener(this); + Event.observe(this.handle, "mousedown", this.eventMouseDown); + + Draggables.register(this); + }, + + destroy: function() { + Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); + Draggables.unregister(this); + }, + + currentDelta: function() { + return([ + parseInt(Element.getStyle(this.element,'left') || '0'), + parseInt(Element.getStyle(this.element,'top') || '0')]); + }, + + initDrag: function(event) { + if(Event.isLeftClick(event)) { + // abort on form elements, fixes a Firefox issue + var src = Event.element(event); + if(src.tagName && ( + src.tagName=='INPUT' || + src.tagName=='SELECT' || + src.tagName=='OPTION' || + src.tagName=='BUTTON' || + src.tagName=='TEXTAREA')) return; + + if(this.element._revert) { + this.element._revert.cancel(); + this.element._revert = null; + } + + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var pos = Position.cumulativeOffset(this.element); + this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); + + Draggables.activate(this); + Event.stop(event); + } + }, + + startDrag: function(event) { + this.dragging = true; + + if(this.options.zindex) { + this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); + this.element.style.zIndex = this.options.zindex; + } + + if(this.options.ghosting) { + this._clone = this.element.cloneNode(true); + Position.absolutize(this.element); + this.element.parentNode.insertBefore(this._clone, this.element); + } + + if(this.options.scroll) { + if (this.options.scroll == window) { + var where = this._getWindowScroll(this.options.scroll); + this.originalScrollLeft = where.left; + this.originalScrollTop = where.top; + } else { + this.originalScrollLeft = this.options.scroll.scrollLeft; + this.originalScrollTop = this.options.scroll.scrollTop; + } + } + + Draggables.notify('onStart', this, event); + if(this.options.starteffect) this.options.starteffect(this.element); + }, + + updateDrag: function(event, pointer) { + if(!this.dragging) this.startDrag(event); + Position.prepare(); + Droppables.show(pointer, this.element); + Draggables.notify('onDrag', this, event); + this.draw(pointer); + if(this.options.change) this.options.change(this); + + if(this.options.scroll) { + this.stopScrolling(); + + var p; + if (this.options.scroll == window) { + with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } + } else { + p = Position.page(this.options.scroll); + p[0] += this.options.scroll.scrollLeft; + p[1] += this.options.scroll.scrollTop; + p.push(p[0]+this.options.scroll.offsetWidth); + p.push(p[1]+this.options.scroll.offsetHeight); + } + var speed = [0,0]; + if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); + if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); + if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); + if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); + this.startScrolling(speed); + } + + // fix AppleWebKit rendering + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); + + Event.stop(event); + }, + + finishDrag: function(event, success) { + this.dragging = false; + + if(this.options.ghosting) { + Position.relativize(this.element); + Element.remove(this._clone); + this._clone = null; + } + + if(success) Droppables.fire(event, this.element); + Draggables.notify('onEnd', this, event); + + var revert = this.options.revert; + if(revert && typeof revert == 'function') revert = revert(this.element); + + var d = this.currentDelta(); + if(revert && this.options.reverteffect) { + this.options.reverteffect(this.element, + d[1]-this.delta[1], d[0]-this.delta[0]); + } else { + this.delta = d; + } + + if(this.options.zindex) + this.element.style.zIndex = this.originalZ; + + if(this.options.endeffect) + this.options.endeffect(this.element); + + Draggables.deactivate(this); + Droppables.reset(); + }, + + keyPress: function(event) { + if(event.keyCode!=Event.KEY_ESC) return; + this.finishDrag(event, false); + Event.stop(event); + }, + + endDrag: function(event) { + if(!this.dragging) return; + this.stopScrolling(); + this.finishDrag(event, true); + Event.stop(event); + }, + + draw: function(point) { + var pos = Position.cumulativeOffset(this.element); + var d = this.currentDelta(); + pos[0] -= d[0]; pos[1] -= d[1]; + + if(this.options.scroll && (this.options.scroll != window)) { + pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; + pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; + } + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) + }.bind(this)); + + if(this.options.snap) { + if(typeof this.options.snap == 'function') { + p = this.options.snap(p[0],p[1],this); + } else { + if(this.options.snap instanceof Array) { + p = p.map( function(v, i) { + return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this)) + } else { + p = p.map( function(v) { + return Math.round(v/this.options.snap)*this.options.snap }.bind(this)) + } + }} + + var style = this.element.style; + if((!this.options.constraint) || (this.options.constraint=='horizontal')) + style.left = p[0] + "px"; + if((!this.options.constraint) || (this.options.constraint=='vertical')) + style.top = p[1] + "px"; + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering + }, + + stopScrolling: function() { + if(this.scrollInterval) { + clearInterval(this.scrollInterval); + this.scrollInterval = null; + Draggables._lastScrollPointer = null; + } + }, + + startScrolling: function(speed) { + this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; + this.lastScrolled = new Date(); + this.scrollInterval = setInterval(this.scroll.bind(this), 10); + }, + + scroll: function() { + var current = new Date(); + var delta = current - this.lastScrolled; + this.lastScrolled = current; + if(this.options.scroll == window) { + with (this._getWindowScroll(this.options.scroll)) { + if (this.scrollSpeed[0] || this.scrollSpeed[1]) { + var d = delta / 1000; + this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); + } + } + } else { + this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; + this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; + } + + Position.prepare(); + Droppables.show(Draggables._lastPointer, this.element); + Draggables.notify('onDrag', this); + Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); + Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; + Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; + if (Draggables._lastScrollPointer[0] < 0) + Draggables._lastScrollPointer[0] = 0; + if (Draggables._lastScrollPointer[1] < 0) + Draggables._lastScrollPointer[1] = 0; + this.draw(Draggables._lastScrollPointer); + + if(this.options.change) this.options.change(this); + }, + + _getWindowScroll: function(w) { + var T, L, W, H; + with (w.document) { + if (w.document.documentElement && documentElement.scrollTop) { + T = documentElement.scrollTop; + L = documentElement.scrollLeft; + } else if (w.document.body) { + T = body.scrollTop; + L = body.scrollLeft; + } + if (w.innerWidth) { + W = w.innerWidth; + H = w.innerHeight; + } else if (w.document.documentElement && documentElement.clientWidth) { + W = documentElement.clientWidth; + H = documentElement.clientHeight; + } else { + W = body.offsetWidth; + H = body.offsetHeight + } + } + return { top: T, left: L, width: W, height: H }; + } +} + +/*--------------------------------------------------------------------------*/ + +var SortableObserver = Class.create(); +SortableObserver.prototype = { + initialize: function(element, observer) { + this.element = $(element); + this.observer = observer; + this.lastValue = Sortable.serialize(this.element); + }, + + onStart: function() { + this.lastValue = Sortable.serialize(this.element); + }, + + onEnd: function() { + Sortable.unmark(); + if(this.lastValue != Sortable.serialize(this.element)) + this.observer(this.element) + } +} + +var Sortable = { + sortables: {}, + + _findRootElement: function(element) { + while (element.tagName != "BODY") { + if(element.id && Sortable.sortables[element.id]) return element; + element = element.parentNode; + } + }, + + options: function(element) { + element = Sortable._findRootElement($(element)); + if(!element) return; + return Sortable.sortables[element.id]; + }, + + destroy: function(element){ + var s = Sortable.options(element); + + if(s) { + Draggables.removeObserver(s.element); + s.droppables.each(function(d){ Droppables.remove(d) }); + s.draggables.invoke('destroy'); + + delete Sortable.sortables[s.element.id]; + } + }, + + create: function(element) { + element = $(element); + var options = Object.extend({ + element: element, + tag: 'li', // assumes li children, override with tag: 'tagname' + dropOnEmpty: false, + tree: false, + treeTag: 'ul', + overlap: 'vertical', // one of 'vertical', 'horizontal' + constraint: 'vertical', // one of 'vertical', 'horizontal', false + containment: element, // also takes array of elements (or id's); or false + handle: false, // or a CSS class + only: false, + hoverclass: null, + ghosting: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + format: /^[^_]*_(.*)$/, + onChange: Prototype.emptyFunction, + onUpdate: Prototype.emptyFunction + }, arguments[1] || {}); + + // clear any old sortable with same element + this.destroy(element); + + // build options for the draggables + var options_for_draggable = { + revert: true, + scroll: options.scroll, + scrollSpeed: options.scrollSpeed, + scrollSensitivity: options.scrollSensitivity, + ghosting: options.ghosting, + constraint: options.constraint, + handle: options.handle }; + + if(options.starteffect) + options_for_draggable.starteffect = options.starteffect; + + if(options.reverteffect) + options_for_draggable.reverteffect = options.reverteffect; + else + if(options.ghosting) options_for_draggable.reverteffect = function(element) { + element.style.top = 0; + element.style.left = 0; + }; + + if(options.endeffect) + options_for_draggable.endeffect = options.endeffect; + + if(options.zindex) + options_for_draggable.zindex = options.zindex; + + // build options for the droppables + var options_for_droppable = { + overlap: options.overlap, + containment: options.containment, + tree: options.tree, + hoverclass: options.hoverclass, + onHover: Sortable.onHover + //greedy: !options.dropOnEmpty + } + + var options_for_tree = { + onHover: Sortable.onEmptyHover, + overlap: options.overlap, + containment: options.containment, + hoverclass: options.hoverclass + } + + // fix for gecko engine + Element.cleanWhitespace(element); + + options.draggables = []; + options.droppables = []; + + // drop on empty handling + if(options.dropOnEmpty || options.tree) { + Droppables.add(element, options_for_tree); + options.droppables.push(element); + } + + (this.findElements(element, options) || []).each( function(e) { + // handles are per-draggable + var handle = options.handle ? + Element.childrenWithClassName(e, options.handle)[0] : e; + options.draggables.push( + new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); + Droppables.add(e, options_for_droppable); + if(options.tree) e.treeNode = element; + options.droppables.push(e); + }); + + if(options.tree) { + (Sortable.findTreeElements(element, options) || []).each( function(e) { + Droppables.add(e, options_for_tree); + e.treeNode = element; + options.droppables.push(e); + }); + } + + // keep reference + this.sortables[element.id] = options; + + // for onupdate + Draggables.addObserver(new SortableObserver(element, options.onUpdate)); + + }, + + // return all suitable-for-sortable elements in a guaranteed order + findElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.tag); + }, + + findTreeElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.treeTag); + }, + + onHover: function(element, dropon, overlap) { + if(Element.isParent(dropon, element)) return; + + if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { + return; + } else if(overlap>0.5) { + Sortable.mark(dropon, 'before'); + if(dropon.previousSibling != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, dropon); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } else { + Sortable.mark(dropon, 'after'); + var nextElement = dropon.nextSibling || null; + if(nextElement != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, nextElement); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } + }, + + onEmptyHover: function(element, dropon, overlap) { + var oldParentNode = element.parentNode; + var droponOptions = Sortable.options(dropon); + + if(!Element.isParent(dropon, element)) { + var index; + + var children = Sortable.findElements(dropon, {tag: droponOptions.tag}); + var child = null; + + if(children) { + var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); + + for (index = 0; index < children.length; index += 1) { + if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { + offset -= Element.offsetSize (children[index], droponOptions.overlap); + } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { + child = index + 1 < children.length ? children[index + 1] : null; + break; + } else { + child = children[index]; + break; + } + } + } + + dropon.insertBefore(element, child); + + Sortable.options(oldParentNode).onChange(element); + droponOptions.onChange(element); + } + }, + + unmark: function() { + if(Sortable._marker) Element.hide(Sortable._marker); + }, + + mark: function(dropon, position) { + // mark on ghosting only + var sortable = Sortable.options(dropon.parentNode); + if(sortable && !sortable.ghosting) return; + + if(!Sortable._marker) { + Sortable._marker = $('dropmarker') || document.createElement('DIV'); + Element.hide(Sortable._marker); + Element.addClassName(Sortable._marker, 'dropmarker'); + Sortable._marker.style.position = 'absolute'; + document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); + } + var offsets = Position.cumulativeOffset(dropon); + Sortable._marker.style.left = offsets[0] + 'px'; + Sortable._marker.style.top = offsets[1] + 'px'; + + if(position=='after') + if(sortable.overlap == 'horizontal') + Sortable._marker.style.left = (offsets[0]+dropon.clientWidth) + 'px'; + else + Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px'; + + Element.show(Sortable._marker); + }, + + _tree: function(element, options, parent) { + var children = Sortable.findElements(element, options) || []; + + for (var i = 0; i < children.length; ++i) { + var match = children[i].id.match(options.format); + + if (!match) continue; + + var child = { + id: encodeURIComponent(match ? match[1] : null), + element: element, + parent: parent, + children: new Array, + position: parent.children.length, + container: Sortable._findChildrenElement(children[i], options.treeTag.toUpperCase()) + } + + /* Get the element containing the children and recurse over it */ + if (child.container) + this._tree(child.container, options, child) + + parent.children.push (child); + } + + return parent; + }, + + /* Finds the first element of the given tag type within a parent element. + Used for finding the first LI[ST] within a L[IST]I[TEM].*/ + _findChildrenElement: function (element, containerTag) { + if (element && element.hasChildNodes) + for (var i = 0; i < element.childNodes.length; ++i) + if (element.childNodes[i].tagName == containerTag) + return element.childNodes[i]; + + return null; + }, + + tree: function(element) { + element = $(element); + var sortableOptions = this.options(element); + var options = Object.extend({ + tag: sortableOptions.tag, + treeTag: sortableOptions.treeTag, + only: sortableOptions.only, + name: element.id, + format: sortableOptions.format + }, arguments[1] || {}); + + var root = { + id: null, + parent: null, + children: new Array, + container: element, + position: 0 + } + + return Sortable._tree (element, options, root); + }, + + /* Construct a [i] index for a particular node */ + _constructIndex: function(node) { + var index = ''; + do { + if (node.id) index = '[' + node.position + ']' + index; + } while ((node = node.parent) != null); + return index; + }, + + sequence: function(element) { + element = $(element); + var options = Object.extend(this.options(element), arguments[1] || {}); + + return $(this.findElements(element, options) || []).map( function(item) { + return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; + }); + }, + + setSequence: function(element, new_sequence) { + element = $(element); + var options = Object.extend(this.options(element), arguments[2] || {}); + + var nodeMap = {}; + this.findElements(element, options).each( function(n) { + if (n.id.match(options.format)) + nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; + n.parentNode.removeChild(n); + }); + + new_sequence.each(function(ident) { + var n = nodeMap[ident]; + if (n) { + n[1].appendChild(n[0]); + delete nodeMap[ident]; + } + }); + }, + + serialize: function(element) { + element = $(element); + var options = Object.extend(Sortable.options(element), arguments[1] || {}); + var name = encodeURIComponent( + (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); + + if (options.tree) { + return Sortable.tree(element, arguments[1]).children.map( function (item) { + return [name + Sortable._constructIndex(item) + "=" + + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); + }).flatten().join('&'); + } else { + return Sortable.sequence(element, arguments[1]).map( function(item) { + return name + "[]=" + encodeURIComponent(item); + }).join('&'); + } + } +} + +/* Returns true if child is contained within element */ +Element.isParent = function(child, element) { + if (!child.parentNode || child == element) return false; + + if (child.parentNode == element) return true; + + return Element.isParent(child.parentNode, element); +} + +Element.findChildren = function(element, only, recursive, tagName) { + if(!element.hasChildNodes()) return null; + tagName = tagName.toUpperCase(); + if(only) only = [only].flatten(); + var elements = []; + $A(element.childNodes).each( function(e) { + if(e.tagName && e.tagName.toUpperCase()==tagName && + (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) + elements.push(e); + if(recursive) { + var grandchildren = Element.findChildren(e, only, recursive, tagName); + if(grandchildren) elements.push(grandchildren); + } + }); + + return (elements.length>0 ? elements.flatten() : []); +} + +Element.offsetSize = function (element, type) { + if (type == 'vertical' || type == 'height') + return element.offsetHeight; + else + return element.offsetWidth; +} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/effects.js b/projekte/MDB/web-app/js/prototype/effects.js new file mode 100644 index 0000000..0864323 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/effects.js @@ -0,0 +1,958 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// See scriptaculous.js for full license. + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if(this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if(this.slice(0,1) == '#') { + if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if(this.length==7) color = this.toLowerCase(); + } + } + return(color.length==7 ? color : (arguments[0] || this)); +} + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +} + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +} + +Element.setContentZoom = function(element, percent) { + element = $(element); + Element.setStyle(element, {fontSize: (percent/100) + 'em'}); + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); +} + +Element.getOpacity = function(element){ + var opacity; + if (opacity = Element.getStyle(element, 'opacity')) + return parseFloat(opacity); + if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/)) + if(opacity[1]) return parseFloat(opacity[1]) / 100; + return 1.0; +} + +Element.setOpacity = function(element, value){ + element= $(element); + if (value == 1){ + Element.setStyle(element, { opacity: + (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? + 0.999999 : null }); + if(/MSIE/.test(navigator.userAgent)) + Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')}); + } else { + if(value < 0.00001) value = 0; + Element.setStyle(element, {opacity: value}); + if(/MSIE/.test(navigator.userAgent)) + Element.setStyle(element, + { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') + + 'alpha(opacity='+value*100+')' }); + } +} + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +} + +Element.childrenWithClassName = function(element, className, findFirst) { + var classNameRegExp = new RegExp("(^|\\s)" + className + "(\\s|$)"); + var results = $A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) { + return (c.className && c.className.match(classNameRegExp)); + }); + if(!results) results = []; + return results; +} + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +Array.prototype.call = function() { + var args = arguments; + this.each(function(f){ f.apply(this, args) }); +} + +/*--------------------------------------------------------------------------*/ + +var Effect = { + tagifyText: function(element) { + var tagifyStyle = 'position:relative'; + if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1'; + element = $(element); + $A(element.childNodes).each( function(child) { + if(child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + Builder.node('span',{style: tagifyStyle}, + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if(((typeof element == 'object') || + (typeof element == 'function')) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || {}); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + var options = Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, arguments[2] || {}); + Effect[element.visible() ? + Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); + } +}; + +var Effect2 = Effect; // deprecated + +/* ------------- transitions ------------- */ + +Effect.Transitions = {} + +Effect.Transitions.linear = function(pos) { + return pos; +} +Effect.Transitions.sinoidal = function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; +} +Effect.Transitions.reverse = function(pos) { + return 1-pos; +} +Effect.Transitions.flicker = function(pos) { + return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; +} +Effect.Transitions.wobble = function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; +} +Effect.Transitions.pulse = function(pos) { + return (Math.floor(pos*10) % 2 == 0 ? + (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10))); +} +Effect.Transitions.none = function(pos) { + return 0; +} +Effect.Transitions.full = function(pos) { + return 1; +} + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(); +Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = (typeof effect.options.queue == 'string') ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if(!this.interval) + this.interval = setInterval(this.loop.bind(this), 40); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if(this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + this.effects.invoke('loop', timePos); + } +}); + +Effect.Queues = { + instances: $H(), + get: function(queueName) { + if(typeof queueName != 'string') return queueName; + + if(!this.instances[queueName]) + this.instances[queueName] = new Effect.ScopedQueue(); + + return this.instances[queueName]; + } +} +Effect.Queue = Effect.Queues.get('global'); + +Effect.DefaultOptions = { + transition: Effect.Transitions.sinoidal, + duration: 1.0, // seconds + fps: 25.0, // max. 25fps due to Effect.Queue implementation + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' +} + +Effect.Base = function() {}; +Effect.Base.prototype = { + position: null, + start: function(options) { + this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {}); + this.currentFrame = 0; + this.state = 'idle'; + this.startOn = this.options.delay*1000; + this.finishOn = this.startOn + (this.options.duration*1000); + this.event('beforeStart'); + if(!this.options.sync) + Effect.Queues.get(typeof this.options.queue == 'string' ? + 'global' : this.options.queue.scope).add(this); + }, + loop: function(timePos) { + if(timePos >= this.startOn) { + if(timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if(this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); + var frame = Math.round(pos * this.options.fps * this.options.duration); + if(frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + render: function(pos) { + if(this.state == 'idle') { + this.state = 'running'; + this.event('beforeSetup'); + if(this.setup) this.setup(); + this.event('afterSetup'); + } + if(this.state == 'running') { + if(this.options.transition) pos = this.options.transition(pos); + pos *= (this.options.to-this.options.from); + pos += this.options.from; + this.position = pos; + this.event('beforeUpdate'); + if(this.update) this.update(pos); + this.event('afterUpdate'); + } + }, + cancel: function() { + if(!this.options.sync) + Effect.Queues.get(typeof this.options.queue == 'string' ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if(this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + return '#'; + } +} + +Effect.Parallel = Class.create(); +Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if(effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Opacity = Class.create(); +Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + // make this work on IE on elements without 'layout' + if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || {}); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(); +Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || {}); + this.start(options); + }, + setup: function() { + // Bug in Opera: Opera returns the "real" position of a static element or + // relative element that does not have top/left explicitly set. + // ==> Always set top and left for position relative elements in your stylesheets + // (to 0 if you do not need them) + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if(this.options.mode == 'absolute') { + // absolute movement, so we need to calc deltaX and deltaY + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: this.options.x * position + this.originalLeft + 'px', + top: this.options.y * position + this.originalTop + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || {})); +}; + +Effect.Scale = Class.create(); +Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { + initialize: function(element, percent) { + this.element = $(element) + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or {} with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || {}); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = {}; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%'].each( function(fontSizeType) { + if(fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if(this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if(/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if(!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if(this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = {}; + if(this.options.scaleX) d.width = width + 'px'; + if(this.options.scaleY) d.height = height + 'px'; + if(this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if(this.elementPositioning == 'absolute') { + if(this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if(this.options.scaleY) d.top = -topd + 'px'; + if(this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(); +Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {}); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if(this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = { + backgroundImage: this.element.getStyle('background-image') }; + this.element.setStyle({backgroundImage: 'none'}); + if(!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if(!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = Class.create(); +Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { + initialize: function(element) { + this.element = $(element); + this.start(arguments[1] || {}); + }, + setup: function() { + Position.prepare(); + var offsets = Position.cumulativeOffset(this.element); + if(this.options.offset) offsets[1] += this.options.offset; + var max = window.innerHeight ? + window.height - window.innerHeight : + document.body.scrollHeight - + (document.documentElement.clientHeight ? + document.documentElement.clientHeight : document.body.clientHeight); + this.scrollStart = Position.deltaY; + this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart; + }, + update: function(position) { + Position.prepare(); + window.scrollTo(Position.deltaX, + this.scrollStart + (position*this.delta)); + } +}); + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if(effect.options.to!=0) return; + effect.element.hide(); + effect.element.setStyle({opacity: oldOpacity}); + }}, arguments[1] || {}); + return new Effect.Opacity(element,options); +} + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from); + effect.element.show(); + }}, arguments[1] || {}); + return new Effect.Opacity(element,options); +} + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + effect.effects[0].element.setStyle({position: 'absolute'}); }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide(); + effect.effects[0].element.setStyle(oldStyle); } + }, arguments[1] || {}) + ); +} + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide(); + effect.element.undoClipping(); + } + }, arguments[1] || {}) + ); +} + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, + Object.extend({ scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping(); + effect.element.setStyle({height: '0px'}); + effect.element.show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || {}) + ); +} + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, { + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned(); + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide(); + effect.element.undoClipping(); + effect.element.undoPositioned(); + effect.element.setStyle({opacity: oldOpacity}); + } + }) + } + }); +} + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide(); + effect.effects[0].element.undoPositioned(); + effect.effects[0].element.setStyle(oldStyle); + } + }, arguments[1] || {})); +} + +Effect.Shake = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + effect.element.undoPositioned(); + effect.element.setStyle(oldStyle); + }}) }}) }}) }}) }}) }}); +} + +Effect.SlideDown = function(element) { + element = $(element); + element.cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = $(element.firstChild).getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.firstChild.makePositioned(); + if(window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping(); + effect.element.setStyle({height: '0px'}); + effect.element.show(); }, + afterUpdateInternal: function(effect) { + effect.element.firstChild.setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + // IE will crash if child is undoPositioned first + if(/MSIE/.test(navigator.userAgent)){ + effect.element.undoPositioned(); + effect.element.firstChild.undoPositioned(); + }else{ + effect.element.firstChild.undoPositioned(); + effect.element.undoPositioned(); + } + effect.element.firstChild.setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || {}) + ); +} + +Effect.SlideUp = function(element) { + element = $(element); + element.cleanWhitespace(); + var oldInnerBottom = $(element.firstChild).getStyle('bottom'); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + restoreAfterFinish: true, + beforeStartInternal: function(effect) { + effect.element.makePositioned(); + effect.element.firstChild.makePositioned(); + if(window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping(); + effect.element.show(); }, + afterUpdateInternal: function(effect) { + effect.element.firstChild.setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, + afterFinishInternal: function(effect) { + effect.element.hide(); + effect.element.undoClipping(); + effect.element.firstChild.undoPositioned(); + effect.element.undoPositioned(); + effect.element.setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || {}) + ); +} + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, + { restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(effect.element); }, + afterFinishInternal: function(effect) { + effect.element.hide(effect.element); + effect.element.undoClipping(effect.element); } + }); +} + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || {}); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide(); + effect.element.makeClipping(); + effect.element.makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}); + effect.effects[0].element.show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping(); + effect.effects[0].element.undoPositioned(); + effect.effects[0].element.setStyle(oldStyle); + } + }, options) + ) + } + }); +} + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || {}); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned(); + effect.effects[0].element.makeClipping(); }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide(); + effect.effects[0].element.undoClipping(); + effect.effects[0].element.undoPositioned(); + effect.effects[0].element.setStyle(oldStyle); } + }, options) + ); +} + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || {}; + var oldOpacity = element.getInlineOpacity(); + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) }; + reverser.bind(transition); + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 3.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +} + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + Element.makeClipping(element); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide(); + effect.element.undoClipping(); + effect.element.setStyle(oldStyle); + } }); + }}, arguments[1] || {})); +}; + +['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom', + 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each( + function(f) { Element.Methods[f] = Element[f]; } +); + +Element.Methods.visualEffect = function(element, effect, options) { + s = effect.gsub(/_/, '-').camelize(); + effect_class = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[effect_class](element, options); + return $(element); +}; + +Element.addMethods(); \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/prototype.js b/projekte/MDB/web-app/js/prototype/prototype.js new file mode 100644 index 0000000..0caf9cd --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/prototype.js @@ -0,0 +1,2006 @@ +/* Prototype JavaScript framework, version 1.5.0_rc0 + * (c) 2005 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * +/*--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.5.0_rc0', + ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', + + emptyFunction: function() {}, + K: function(x) {return x} +} + +var Class = { + create: function() { + return function() { + this.initialize.apply(this, arguments); + } + } +} + +var Abstract = new Object(); + +Object.extend = function(destination, source) { + for (var property in source) { + destination[property] = source[property]; + } + return destination; +} + +Object.inspect = function(object) { + try { + if (object == undefined) return 'undefined'; + if (object == null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } +} + +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } +} + +Function.prototype.bindAsEventListener = function(object) { + var __method = this; + return function(event) { + return __method.call(object, event || window.event); + } +} + +Object.extend(Number.prototype, { + toColorPart: function() { + var digits = this.toString(16); + if (this < 16) return '0' + digits; + return digits; + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + } +}); + +var Try = { + these: function() { + var returnValue; + + for (var i = 0; i < arguments.length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) {} + } + + return returnValue; + } +} + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create(); +PeriodicalExecuter.prototype = { + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(); + } finally { + this.currentlyExecuting = false; + } + } + } +} +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += (replacement(match) || '').toString(); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return this; + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : this; + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var div = document.createElement('div'); + var text = document.createTextNode(this); + div.appendChild(text); + return div.innerHTML; + }, + + unescapeHTML: function() { + var div = document.createElement('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? div.childNodes[0].nodeValue : ''; + }, + + toQueryParams: function() { + var pairs = this.match(/^\??(.*)$/)[1].split('&'); + return pairs.inject({}, function(params, pairString) { + var pair = pairString.split('='); + params[pair[0]] = pair[1]; + return params; + }); + }, + + toArray: function() { + return this.split(''); + }, + + camelize: function() { + var oStringList = this.split('-'); + if (oStringList.length == 1) return oStringList[0]; + + var camelizedString = this.indexOf('-') == 0 + ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) + : oStringList[0]; + + for (var i = 1, len = oStringList.length; i < len; i++) { + var s = oStringList[i]; + camelizedString += s.charAt(0).toUpperCase() + s.substring(1); + } + + return camelizedString; + }, + + inspect: function() { + return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'"; + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (typeof replacement == 'function') return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +} + +String.prototype.parseQuery = String.prototype.toQueryParams; + +var Template = Class.create(); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; +Template.prototype = { + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + return this.template.gsub(this.pattern, function(match) { + var before = match[1]; + if (before == '\\') return match[2]; + return before + (object[match[3]] || '').toString(); + }); + } +} + +var $break = new Object(); +var $continue = new Object(); + +var Enumerable = { + each: function(iterator) { + var index = 0; + try { + this._each(function(value) { + try { + iterator(value, index++); + } catch (e) { + if (e != $continue) throw e; + } + }); + } catch (e) { + if (e != $break) throw e; + } + }, + + all: function(iterator) { + var result = true; + this.each(function(value, index) { + result = result && !!(iterator || Prototype.K)(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator) { + var result = true; + this.each(function(value, index) { + if (result = !!(iterator || Prototype.K)(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator) { + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function (iterator) { + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator) { + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(pattern, iterator) { + var results = []; + this.each(function(value, index) { + var stringValue = value.toString(); + if (stringValue.match(pattern)) + results.push((iterator || Prototype.K)(value, index)); + }) + return results; + }, + + include: function(object) { + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inject: function(memo, iterator) { + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.collect(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator) { + var trues = [], falses = []; + this.each(function(value, index) { + ((iterator || Prototype.K)(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value, index) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator) { + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator) { + return this.collect(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.collect(Prototype.K); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (typeof args.last() == 'function') + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + inspect: function() { + return '#'; + } +} + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray +}); +var $A = Array.from = function(iterable) { + if (!iterable) return []; + if (iterable.toArray) { + return iterable.toArray(); + } else { + var results = []; + for (var i = 0; i < iterable.length; i++) + results.push(iterable[i]); + return results; + } +} + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) + Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0; i < this.length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != undefined || value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(value && value.constructor == Array ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + indexOf: function(object) { + for (var i = 0; i < this.length; i++) + if (this[i] == object) return i; + return -1; + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + } +}); +var Hash = { + _each: function(iterator) { + for (var key in this) { + var value = this[key]; + if (typeof value == 'function') continue; + + var pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + merge: function(hash) { + return $H(hash).inject($H(this), function(mergedHash, pair) { + mergedHash[pair.key] = pair.value; + return mergedHash; + }); + }, + + toQueryString: function() { + return this.map(function(pair) { + return pair.map(encodeURIComponent).join('='); + }).join('&'); + }, + + inspect: function() { + return '#'; + } +} + +function $H(object) { + var hash = Object.extend({}, object || {}); + Object.extend(hash, Enumerable); + Object.extend(hash, Hash); + return hash; +} +ObjectRange = Class.create(); +Object.extend(ObjectRange.prototype, Enumerable); +Object.extend(ObjectRange.prototype, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + do { + iterator(value); + value = value.succ(); + } while (this.include(value)); + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +} + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +} + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responderToAdd) { + if (!this.include(responderToAdd)) + this.responders.push(responderToAdd); + }, + + unregister: function(responderToRemove) { + this.responders = this.responders.without(responderToRemove); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (responder[callback] && typeof responder[callback] == 'function') { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) {} + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { + Ajax.activeRequestCount++; + }, + + onComplete: function() { + Ajax.activeRequestCount--; + } +}); + +Ajax.Base = function() {}; +Ajax.Base.prototype = { + setOptions: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + parameters: '' + } + Object.extend(this.options, options || {}); + }, + + responseIsSuccess: function() { + return this.transport.status == undefined + || this.transport.status == 0 + || (this.transport.status >= 200 && this.transport.status < 300); + }, + + responseIsFailure: function() { + return !this.responseIsSuccess(); + } +} + +Ajax.Request = Class.create(); +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Request.prototype = Object.extend(new Ajax.Base(), { + initialize: function(url, options) { + this.transport = Ajax.getTransport(); + this.setOptions(options); + this.request(url); + }, + + request: function(url) { + var parameters = this.options.parameters || ''; + if (parameters.length > 0) parameters += '&_='; + + try { + this.url = url; + if (this.options.method == 'get' && parameters.length > 0) + this.url += (this.url.match(/\?/) ? '&' : '?') + parameters; + + Ajax.Responders.dispatch('onCreate', this, this.transport); + + this.transport.open(this.options.method, this.url, + this.options.asynchronous); + + if (this.options.asynchronous) { + this.transport.onreadystatechange = this.onStateChange.bind(this); + setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10); + } + + this.setRequestHeaders(); + + var body = this.options.postBody ? this.options.postBody : parameters; + this.transport.send(this.options.method == 'post' ? body : null); + + } catch (e) { + this.dispatchException(e); + } + }, + + setRequestHeaders: function() { + var requestHeaders = + ['X-Requested-With', 'XMLHttpRequest', + 'X-Prototype-Version', Prototype.Version, + 'Accept', 'text/javascript, text/html, application/xml, text/xml, */*']; + + if (this.options.method == 'post') { + requestHeaders.push('Content-type', this.options.contentType); + + /* Force "Connection: close" for Mozilla browsers to work around + * a bug where XMLHttpReqeuest sends an incorrect Content-length + * header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType) + requestHeaders.push('Connection', 'close'); + } + + if (this.options.requestHeaders) + requestHeaders.push.apply(requestHeaders, this.options.requestHeaders); + + for (var i = 0; i < requestHeaders.length; i += 2) + this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]); + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState != 1) + this.respondToReadyState(this.transport.readyState); + }, + + header: function(name) { + try { + return this.transport.getResponseHeader(name); + } catch (e) {} + }, + + evalJSON: function() { + try { + return eval('(' + this.header('X-JSON') + ')'); + } catch (e) {} + }, + + evalResponse: function() { + try { + return eval(this.transport.responseText); + } catch (e) { + this.dispatchException(e); + } + }, + + respondToReadyState: function(readyState) { + var event = Ajax.Request.Events[readyState]; + var transport = this.transport, json = this.evalJSON(); + + if (event == 'Complete') { + try { + (this.options['on' + this.transport.status] + || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(transport, json); + } catch (e) { + this.dispatchException(e); + } + + if ((this.header('Content-type') || '').match(/^text\/javascript/i)) + this.evalResponse(); + } + + try { + (this.options['on' + event] || Prototype.emptyFunction)(transport, json); + Ajax.Responders.dispatch('on' + event, this, transport, json); + } catch (e) { + this.dispatchException(e); + } + + /* Avoid memory leak in MSIE: clean up the oncomplete event handler */ + if (event == 'Complete') + this.transport.onreadystatechange = Prototype.emptyFunction; + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Updater = Class.create(); + +Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { + initialize: function(container, url, options) { + this.containers = { + success: container.success ? $(container.success) : $(container), + failure: container.failure ? $(container.failure) : + (container.success ? null : $(container)) + } + + this.transport = Ajax.getTransport(); + this.setOptions(options); + + var onComplete = this.options.onComplete || Prototype.emptyFunction; + this.options.onComplete = (function(transport, object) { + this.updateContent(); + onComplete(transport, object); + }).bind(this); + + this.request(url); + }, + + updateContent: function() { + var receiver = this.responseIsSuccess() ? + this.containers.success : this.containers.failure; + var response = this.transport.responseText; + + if (!this.options.evalScripts) + response = response.stripScripts(); + + if (receiver) { + if (this.options.insertion) { + new this.options.insertion(receiver, response); + } else { + Element.update(receiver, response); + } + } + + if (this.responseIsSuccess()) { + if (this.onComplete) + setTimeout(this.onComplete.bind(this), 10); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(); +Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { + initialize: function(container, url, options) { + this.setOptions(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = {}; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(request) { + if (this.options.decay) { + this.decay = (request.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = request.responseText; + } + this.timer = setTimeout(this.onTimerEvent.bind(this), + this.decay * this.frequency * 1000); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $() { + var results = [], element; + for (var i = 0; i < arguments.length; i++) { + element = arguments[i]; + if (typeof element == 'string') + element = document.getElementById(element); + results.push(Element.extend(element)); + } + return results.length < 2 ? results[0] : results; +} + +document.getElementsByClassName = function(className, parentElement) { + var children = ($(parentElement) || document.body).getElementsByTagName('*'); + return $A(children).inject([], function(elements, child) { + if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) + elements.push(Element.extend(child)); + return elements; + }); +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Element) + var Element = new Object(); + +Element.extend = function(element) { + if (!element) return; + if (_nativeExtensions) return element; + + if (!element._extended && element.tagName && element != window) { + var methods = Element.Methods, cache = Element.extend.cache; + for (property in methods) { + var value = methods[property]; + if (typeof value == 'function') + element[property] = cache.findOrStore(value); + } + } + + element._extended = true; + return element; +} + +Element.extend.cache = { + findOrStore: function(value) { + return this[value] = this[value] || function() { + return value.apply(null, [this].concat($A(arguments))); + } + } +} + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + Element[Element.visible(element) ? 'hide' : 'show'](element); + } + }, + + hide: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + element.style.display = 'none'; + } + }, + + show: function() { + for (var i = 0; i < arguments.length; i++) { + var element = $(arguments[i]); + element.style.display = ''; + } + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + }, + + update: function(element, html) { + $(element).innerHTML = html.stripScripts(); + setTimeout(function() {html.evalScripts()}, 10); + }, + + replace: function(element, html) { + element = $(element); + if (element.outerHTML) { + element.outerHTML = html.stripScripts(); + } else { + var range = element.ownerDocument.createRange(); + range.selectNodeContents(element); + element.parentNode.replaceChild( + range.createContextualFragment(html.stripScripts()), element); + } + setTimeout(function() {html.evalScripts()}, 10); + }, + + getHeight: function(element) { + element = $(element); + return element.offsetHeight; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).include(className); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).add(className); + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + return Element.classNames(element).remove(className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + for (var i = 0; i < element.childNodes.length; i++) { + var node = element.childNodes[i]; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + Element.remove(node); + } + }, + + empty: function(element) { + return $(element).innerHTML.match(/^\s*$/); + }, + + childOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + while (element = element.parentNode) + if (element == ancestor) return true; + return false; + }, + + scrollTo: function(element) { + element = $(element); + var x = element.x ? element.x : element.offsetLeft, + y = element.y ? element.y : element.offsetTop; + window.scrollTo(x, y); + }, + + getStyle: function(element, style) { + element = $(element); + var value = element.style[style.camelize()]; + if (!value) { + if (document.defaultView && document.defaultView.getComputedStyle) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css.getPropertyValue(style) : null; + } else if (element.currentStyle) { + value = element.currentStyle[style.camelize()]; + } + } + + if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) + if (Element.getStyle(element, 'position') == 'static') value = 'auto'; + + return value == 'auto' ? null : value; + }, + + setStyle: function(element, style) { + element = $(element); + for (var name in style) + element.style[name.camelize()] = style[name]; + }, + + getDimensions: function(element) { + element = $(element); + if (Element.getStyle(element, 'display') != 'none') + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = ''; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = 'none'; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return; + element._overflow = element.style.overflow; + if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') + element.style.overflow = 'hidden'; + }, + + undoClipping: function(element) { + element = $(element); + if (element._overflow) return; + element.style.overflow = element._overflow; + element._overflow = undefined; + } +} + +Object.extend(Element, Element.Methods); + +var _nativeExtensions = false; + +if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) { + var HTMLElement = {} + HTMLElement.prototype = document.createElement('div').__proto__; +} + +Element.addMethods = function(methods) { + Object.extend(Element.Methods, methods || {}); + + if(typeof HTMLElement != 'undefined') { + var methods = Element.Methods, cache = Element.extend.cache; + for (property in methods) { + var value = methods[property]; + if (typeof value == 'function') + HTMLElement.prototype[property] = cache.findOrStore(value); + } + _nativeExtensions = true; + } +} + +Element.addMethods(); + +var Toggle = new Object(); +Toggle.display = Element.toggle; + +/*--------------------------------------------------------------------------*/ + +Abstract.Insertion = function(adjacency) { + this.adjacency = adjacency; +} + +Abstract.Insertion.prototype = { + initialize: function(element, content) { + this.element = $(element); + this.content = content.stripScripts(); + + if (this.adjacency && this.element.insertAdjacentHTML) { + try { + this.element.insertAdjacentHTML(this.adjacency, this.content); + } catch (e) { + var tagName = this.element.tagName.toLowerCase(); + if (tagName == 'tbody' || tagName == 'tr') { + this.insertContent(this.contentFromAnonymousTable()); + } else { + throw e; + } + } + } else { + this.range = this.element.ownerDocument.createRange(); + if (this.initializeRange) this.initializeRange(); + this.insertContent([this.range.createContextualFragment(this.content)]); + } + + setTimeout(function() {content.evalScripts()}, 10); + }, + + contentFromAnonymousTable: function() { + var div = document.createElement('div'); + div.innerHTML = '' + this.content + '
    '; + return $A(div.childNodes[0].childNodes[0].childNodes); + } +} + +var Insertion = new Object(); + +Insertion.Before = Class.create(); +Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { + initializeRange: function() { + this.range.setStartBefore(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, this.element); + }).bind(this)); + } +}); + +Insertion.Top = Class.create(); +Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(true); + }, + + insertContent: function(fragments) { + fragments.reverse(false).each((function(fragment) { + this.element.insertBefore(fragment, this.element.firstChild); + }).bind(this)); + } +}); + +Insertion.Bottom = Class.create(); +Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { + initializeRange: function() { + this.range.selectNodeContents(this.element); + this.range.collapse(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.appendChild(fragment); + }).bind(this)); + } +}); + +Insertion.After = Class.create(); +Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { + initializeRange: function() { + this.range.setStartAfter(this.element); + }, + + insertContent: function(fragments) { + fragments.each((function(fragment) { + this.element.parentNode.insertBefore(fragment, + this.element.nextSibling); + }).bind(this)); + } +}); + +/*--------------------------------------------------------------------------*/ + +Element.ClassNames = Class.create(); +Element.ClassNames.prototype = { + initialize: function(element) { + this.element = $(element); + }, + + _each: function(iterator) { + this.element.className.split(/\s+/).select(function(name) { + return name.length > 0; + })._each(iterator); + }, + + set: function(className) { + this.element.className = className; + }, + + add: function(classNameToAdd) { + if (this.include(classNameToAdd)) return; + this.set(this.toArray().concat(classNameToAdd).join(' ')); + }, + + remove: function(classNameToRemove) { + if (!this.include(classNameToRemove)) return; + this.set(this.select(function(className) { + return className != classNameToRemove; + }).join(' ')); + }, + + toString: function() { + return this.toArray().join(' '); + } +} + +Object.extend(Element.ClassNames.prototype, Enumerable); +var Selector = Class.create(); +Selector.prototype = { + initialize: function(expression) { + this.params = {classNames: []}; + this.expression = expression.toString().strip(); + this.parseExpression(); + this.compileMatcher(); + }, + + parseExpression: function() { + function abort(message) { throw 'Parse error in selector: ' + message; } + + if (this.expression == '') abort('empty expression'); + + var params = this.params, expr = this.expression, match, modifier, clause, rest; + while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { + params.attributes = params.attributes || []; + params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); + expr = match[1]; + } + + if (expr == '*') return this.params.wildcard = true; + + while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { + modifier = match[1], clause = match[2], rest = match[3]; + switch (modifier) { + case '#': params.id = clause; break; + case '.': params.classNames.push(clause); break; + case '': + case undefined: params.tagName = clause.toUpperCase(); break; + default: abort(expr.inspect()); + } + expr = rest; + } + + if (expr.length > 0) abort(expr.inspect()); + }, + + buildMatchExpression: function() { + var params = this.params, conditions = [], clause; + + if (params.wildcard) + conditions.push('true'); + if (clause = params.id) + conditions.push('element.id == ' + clause.inspect()); + if (clause = params.tagName) + conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); + if ((clause = params.classNames).length > 0) + for (var i = 0; i < clause.length; i++) + conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')'); + if (clause = params.attributes) { + clause.each(function(attribute) { + var value = 'element.getAttribute(' + attribute.name.inspect() + ')'; + var splitValueBy = function(delimiter) { + return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; + } + + switch (attribute.operator) { + case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; + case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; + case '|=': conditions.push( + splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() + ); break; + case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; + case '': + case undefined: conditions.push(value + ' != null'); break; + default: throw 'Unknown operator ' + attribute.operator + ' in selector'; + } + }); + } + + return conditions.join(' && '); + }, + + compileMatcher: function() { + this.match = new Function('element', 'if (!element.tagName) return false; \ + return ' + this.buildMatchExpression()); + }, + + findElements: function(scope) { + var element; + + if (element = $(this.params.id)) + if (this.match(element)) + if (!scope || Element.childOf(element, scope)) + return [element]; + + scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); + + var results = []; + for (var i = 0; i < scope.length; i++) + if (this.match(element = scope[i])) + results.push(Element.extend(element)); + + return results; + }, + + toString: function() { + return this.expression; + } +} + +function $$() { + return $A(arguments).map(function(expression) { + return expression.strip().split(/\s+/).inject([null], function(results, expr) { + var selector = new Selector(expr); + return results.map(selector.findElements.bind(selector)).flatten(); + }); + }).flatten(); +} +var Field = { + clear: function() { + for (var i = 0; i < arguments.length; i++) + $(arguments[i]).value = ''; + }, + + focus: function(element) { + $(element).focus(); + }, + + present: function() { + for (var i = 0; i < arguments.length; i++) + if ($(arguments[i]).value == '') return false; + return true; + }, + + select: function(element) { + $(element).select(); + }, + + activate: function(element) { + element = $(element); + element.focus(); + if (element.select) + element.select(); + } +} + +/*--------------------------------------------------------------------------*/ + +var Form = { + serialize: function(form) { + var elements = Form.getElements($(form)); + var queryComponents = new Array(); + + for (var i = 0; i < elements.length; i++) { + var queryComponent = Form.Element.serialize(elements[i]); + if (queryComponent) + queryComponents.push(queryComponent); + } + + return queryComponents.join('&'); + }, + + getElements: function(form) { + form = $(form); + var elements = new Array(); + + for (var tagName in Form.Element.Serializers) { + var tagElements = form.getElementsByTagName(tagName); + for (var j = 0; j < tagElements.length; j++) + elements.push(tagElements[j]); + } + return elements; + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) + return inputs; + + var matchingInputs = new Array(); + for (var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || + (name && input.name != name)) + continue; + matchingInputs.push(input); + } + + return matchingInputs; + }, + + disable: function(form) { + var elements = Form.getElements(form); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + element.blur(); + element.disabled = 'true'; + } + }, + + enable: function(form) { + var elements = Form.getElements(form); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + element.disabled = ''; + } + }, + + findFirstElement: function(form) { + return Form.getElements(form).find(function(element) { + return element.type != 'hidden' && !element.disabled && + ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + Field.activate(Form.findFirstElement(form)); + }, + + reset: function(form) { + $(form).reset(); + } +} + +Form.Element = { + serialize: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + var parameter = Form.Element.Serializers[method](element); + + if (parameter) { + var key = encodeURIComponent(parameter[0]); + if (key.length == 0) return; + + if (parameter[1].constructor != Array) + parameter[1] = [parameter[1]]; + + return parameter[1].map(function(value) { + return key + '=' + encodeURIComponent(value); + }).join('&'); + } + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + var parameter = Form.Element.Serializers[method](element); + + if (parameter) + return parameter[1]; + } +} + +Form.Element.Serializers = { + input: function(element) { + switch (element.type.toLowerCase()) { + case 'submit': + case 'hidden': + case 'password': + case 'text': + return Form.Element.Serializers.textarea(element); + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element); + } + return false; + }, + + inputSelector: function(element) { + if (element.checked) + return [element.name, element.value]; + }, + + textarea: function(element) { + return [element.name, element.value]; + }, + + select: function(element) { + return Form.Element.Serializers[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + }, + + selectOne: function(element) { + var value = '', opt, index = element.selectedIndex; + if (index >= 0) { + opt = element.options[index]; + value = opt.value || opt.text; + } + return [element.name, value]; + }, + + selectMany: function(element) { + var value = []; + for (var i = 0; i < element.length; i++) { + var opt = element.options[i]; + if (opt.selected) + value.push(opt.value || opt.text); + } + return [element.name, value]; + } +} + +/*--------------------------------------------------------------------------*/ + +var $F = Form.Element.getValue; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = function() {} +Abstract.TimedObserver.prototype = { + initialize: function(element, frequency, callback) { + this.frequency = frequency; + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + this.registerCallback(); + }, + + registerCallback: function() { + setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + onTimerEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + } +} + +Form.Element.Observer = Class.create(); +Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(); +Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = function() {} +Abstract.EventObserver.prototype = { + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + var elements = Form.getElements(this.element); + for (var i = 0; i < elements.length; i++) + this.registerCallback(elements[i]); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + case 'password': + case 'text': + case 'textarea': + case 'select-one': + case 'select-multiple': + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +} + +Form.Element.EventObserver = Class.create(); +Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(); +Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) { + var Event = new Object(); +} + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + + element: function(event) { + return event.target || event.srcElement; + }, + + isLeftClick: function(event) { + return (((event.which) && (event.which == 1)) || + ((event.button) && (event.button == 1))); + }, + + pointerX: function(event) { + return event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)); + }, + + pointerY: function(event) { + return event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)); + }, + + stop: function(event) { + if (event.preventDefault) { + event.preventDefault(); + event.stopPropagation(); + } else { + event.returnValue = false; + event.cancelBubble = true; + } + }, + + // find the first node with the given tagName, starting from the + // node the event was triggered on; traverses the DOM upwards + findElement: function(event, tagName) { + var element = Event.element(event); + while (element.parentNode && (!element.tagName || + (element.tagName.toUpperCase() != tagName.toUpperCase()))) + element = element.parentNode; + return element; + }, + + observers: false, + + _observeAndCache: function(element, name, observer, useCapture) { + if (!this.observers) this.observers = []; + if (element.addEventListener) { + this.observers.push([element, name, observer, useCapture]); + element.addEventListener(name, observer, useCapture); + } else if (element.attachEvent) { + this.observers.push([element, name, observer, useCapture]); + element.attachEvent('on' + name, observer); + } + }, + + unloadCache: function() { + if (!Event.observers) return; + for (var i = 0; i < Event.observers.length; i++) { + Event.stopObserving.apply(this, Event.observers[i]); + Event.observers[i][0] = null; + } + Event.observers = false; + }, + + observe: function(element, name, observer, useCapture) { + var element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.attachEvent)) + name = 'keydown'; + + this._observeAndCache(element, name, observer, useCapture); + }, + + stopObserving: function(element, name, observer, useCapture) { + var element = $(element); + useCapture = useCapture || false; + + if (name == 'keypress' && + (navigator.appVersion.match(/Konqueror|Safari|KHTML/) + || element.detachEvent)) + name = 'keydown'; + + if (element.removeEventListener) { + element.removeEventListener(name, observer, useCapture); + } else if (element.detachEvent) { + element.detachEvent('on' + name, observer); + } + } +}); + +/* prevent memory leaks in IE */ +if (navigator.appVersion.match(/\bMSIE\b/)) + Event.observe(window, 'unload', Event.unloadCache, false); +var Position = { + // set to true if needed, warning: firefox performance problems + // NOT neeeded for page scrolling, only if draggable contained in + // scrollable elements + includeScrollOffsets: false, + + // must be called before calling withinIncludingScrolloffset, every time the + // page is scrolled + prepare: function() { + this.deltaX = window.pageXOffset + || document.documentElement.scrollLeft + || document.body.scrollLeft + || 0; + this.deltaY = window.pageYOffset + || document.documentElement.scrollTop + || document.body.scrollTop + || 0; + }, + + realOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return [valueL, valueT]; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return [valueL, valueT]; + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + p = Element.getStyle(element, 'position'); + if (p == 'relative' || p == 'absolute') break; + } + } while (element); + return [valueL, valueT]; + }, + + offsetParent: function(element) { + if (element.offsetParent) return element.offsetParent; + if (element == document.body) return element; + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return element; + + return document.body; + }, + + // caches x/y coordinate pair to use with overlap + within: function(element, x, y) { + if (this.includeScrollOffsets) + return this.withinIncludingScrolloffsets(element, x, y); + this.xcomp = x; + this.ycomp = y; + this.offset = this.cumulativeOffset(element); + + return (y >= this.offset[1] && + y < this.offset[1] + element.offsetHeight && + x >= this.offset[0] && + x < this.offset[0] + element.offsetWidth); + }, + + withinIncludingScrolloffsets: function(element, x, y) { + var offsetcache = this.realOffset(element); + + this.xcomp = x + offsetcache[0] - this.deltaX; + this.ycomp = y + offsetcache[1] - this.deltaY; + this.offset = this.cumulativeOffset(element); + + return (this.ycomp >= this.offset[1] && + this.ycomp < this.offset[1] + element.offsetHeight && + this.xcomp >= this.offset[0] && + this.xcomp < this.offset[0] + element.offsetWidth); + }, + + // within must be called directly before + overlap: function(mode, element) { + if (!mode) return 0; + if (mode == 'vertical') + return ((this.offset[1] + element.offsetHeight) - this.ycomp) / + element.offsetHeight; + if (mode == 'horizontal') + return ((this.offset[0] + element.offsetWidth) - this.xcomp) / + element.offsetWidth; + }, + + clone: function(source, target) { + source = $(source); + target = $(target); + target.style.position = 'absolute'; + var offsets = this.cumulativeOffset(source); + target.style.top = offsets[1] + 'px'; + target.style.left = offsets[0] + 'px'; + target.style.width = source.offsetWidth + 'px'; + target.style.height = source.offsetHeight + 'px'; + }, + + page: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent==document.body) + if (Element.getStyle(element,'position')=='absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } while (element = element.parentNode); + + return [valueL, valueT]; + }, + + clone: function(source, target) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || {}) + + // find page position of source + source = $(source); + var p = Position.page(source); + + // find coordinate system to use + target = $(target); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(target,'position') == 'absolute') { + parent = Position.offsetParent(target); + delta = Position.page(parent); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if(options.setWidth) target.style.width = source.offsetWidth + 'px'; + if(options.setHeight) target.style.height = source.offsetHeight + 'px'; + }, + + absolutize: function(element) { + element = $(element); + if (element.style.position == 'absolute') return; + Position.prepare(); + + var offsets = Position.positionedOffset(element); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px';; + element.style.left = left + 'px';; + element.style.width = width + 'px';; + element.style.height = height + 'px';; + }, + + relativize: function(element) { + element = $(element); + if (element.style.position == 'relative') return; + Position.prepare(); + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + } +} + +// Safari returns margins on body which is incorrect if the child is absolutely +// positioned. For performance reasons, redefine Position.cumulativeOffset for +// KHTML/WebKit only. +if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { + Position.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return [valueL, valueT]; + } +} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/rico.js b/projekte/MDB/web-app/js/prototype/rico.js new file mode 100644 index 0000000..f0b6fb5 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/rico.js @@ -0,0 +1,2691 @@ +/** + * + * Copyright 2005 Sabre Airline Solutions + * + * 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. + **/ + + +//-------------------- rico.js +var Rico = { + Version: '1.1-beta2' +} + +Rico.ArrayExtensions = new Array(); + +if (Object.prototype.extend) { + // in prototype.js... + Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend; +} + +if (Array.prototype.push) { + // in prototype.js... + Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.push; +} + +if (!Array.prototype.remove) { + Array.prototype.remove = function(dx) { + if( isNaN(dx) || dx > this.length ) + return false; + for( var i=0,n=0; i 1 ) { + if(typeof(arguments[1]) == "object" && arguments[1].length != undefined) { + queryString = this._createQueryString(arguments[1], 0); + } + else { + queryString = this._createQueryString(arguments, 1); + } + } + + new Ajax.Request(requestURL, this._requestOptions(queryString)); + }, + + sendRequestWithData: function(requestName, xmlDocument) { + var requestURL = this.requestURLS[requestName]; + if ( requestURL == null ) + return; + + var queryString = ""; + if ( arguments.length > 2 ) { + if(typeof(arguments[2]) == "object" && arguments[2].length != undefined) { + queryString = this._createQueryString(arguments[2], 0); + } + else { + queryString = this._createQueryString(arguments, 2); + } + } + + new Ajax.Request(requestURL + "?" + queryString, this._requestOptions(null,xmlDocument)); + }, + + sendRequestAndUpdate: function(requestName,container,options) { + var requestURL = this.requestURLS[requestName]; + if ( requestURL == null ) + return; + + var queryString = ""; + if ( arguments.length > 3 ) { + if(typeof(arguments[3]) == "object" && arguments[3].length != undefined) { + queryString = this._createQueryString(arguments[3], 0); + } + else { + queryString = this._createQueryString(arguments, 3); + } + } + + var updaterOptions = this._requestOptions(queryString); + updaterOptions.onComplete = null; + updaterOptions.extend(options); + + new Ajax.Updater(container, requestURL, updaterOptions); + }, + + sendRequestWithDataAndUpdate: function(requestName,xmlDocument,container,options) { + var requestURL = this.requestURLS[requestName]; + if ( requestURL == null ) + return; + + var queryString = ""; + if ( arguments.length > 4 ) { + if(typeof(arguments[4]) == "object" && arguments[4].length != undefined) { + queryString = this._createQueryString(arguments[4], 0); + } + else { + queryString = this._createQueryString(arguments, 4); + } + } + + + var updaterOptions = this._requestOptions(queryString,xmlDocument); + updaterOptions.onComplete = null; + updaterOptions.extend(options); + + new Ajax.Updater(container, requestURL + "?" + queryString, updaterOptions); + }, + + // Private -- not part of intended engine API -------------------------------------------------------------------- + + _requestOptions: function(queryString,xmlDoc) { + var self = this; + + var requestHeaders = ['X-Rico-Version', Rico.Version ]; + var sendMethod = "post" + if ( arguments[1] ) + requestHeaders.push( 'Content-type', 'text/xml' ); + else + sendMethod = "get"; + + return { requestHeaders: requestHeaders, + parameters: queryString, + postBody: arguments[1] ? xmlDoc : null, + method: sendMethod, + onComplete: self._onRequestComplete.bind(self) }; + }, + + _createQueryString: function( theArgs, offset ) { + var self = this; + var queryString = "" + for ( var i = offset ; i < theArgs.length ; i++ ) { + if ( i != offset ) + queryString += "&"; + + var anArg = theArgs[i]; + + if ( anArg.name != undefined && anArg.value != undefined ) { + queryString += anArg.name + "=" + escape(anArg.value); + } + else { + var ePos = anArg.indexOf('='); + var argName = anArg.substring( 0, ePos ); + var argValue = anArg.substring( ePos + 1 ); + queryString += argName + "=" + escape(argValue); + } + } + + return queryString; + }, + _onRequestComplete : function(request) { + + //!!TODO: error handling infrastructure?? + if (request.status != 200) + return; + + var response = request.responseXML.getElementsByTagName("ajax-response"); + if (response == null || response.length != 1) + return; + this._processAjaxResponse( response[0].childNodes ); + }, + + _processAjaxResponse: function( xmlResponseElements ) { + for ( var i = 0 ; i < xmlResponseElements.length ; i++ ) { + var responseElement = xmlResponseElements[i]; + + // only process nodes of type element..... + if ( responseElement.nodeType != 1 ) + continue; + + var responseType = responseElement.getAttribute("type"); + var responseId = responseElement.getAttribute("id"); + + if ( responseType == "object" ) + this._processAjaxObjectUpdate( this.ajaxObjects[ responseId ], responseElement ); + else if ( responseType == "element" ) + this._processAjaxElementUpdate( this.ajaxElements[ responseId ], responseElement ); + else + alert('unrecognized AjaxResponse type : ' + responseType ); + } + }, + + _processAjaxObjectUpdate: function( ajaxObject, responseElement ) { + ajaxObject.ajaxUpdate( responseElement ); + }, + + _processAjaxElementUpdate: function( ajaxElement, responseElement ) { + ajaxElement.innerHTML = RicoUtil.getContentAsString(responseElement); + } + +} + +var ajaxEngine = new Rico.AjaxEngine(); + + +//-------------------- ricoColor.js +Rico.Color = Class.create(); + +Rico.Color.prototype = { + + initialize: function(red, green, blue) { + this.rgb = { r: red, g : green, b : blue }; + }, + + setRed: function(r) { + this.rgb.r = r; + }, + + setGreen: function(g) { + this.rgb.g = g; + }, + + setBlue: function(b) { + this.rgb.b = b; + }, + + setHue: function(h) { + + // get an HSB model, and set the new hue... + var hsb = this.asHSB(); + hsb.h = h; + + // convert back to RGB... + this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b); + }, + + setSaturation: function(s) { + // get an HSB model, and set the new hue... + var hsb = this.asHSB(); + hsb.s = s; + + // convert back to RGB and set values... + this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b); + }, + + setBrightness: function(b) { + // get an HSB model, and set the new hue... + var hsb = this.asHSB(); + hsb.b = b; + + // convert back to RGB and set values... + this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b ); + }, + + darken: function(percent) { + var hsb = this.asHSB(); + this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0)); + }, + + brighten: function(percent) { + var hsb = this.asHSB(); + this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1)); + }, + + blend: function(other) { + this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2); + this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2); + this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2); + }, + + isBright: function() { + var hsb = this.asHSB(); + return this.asHSB().b > 0.5; + }, + + isDark: function() { + return ! this.isBright(); + }, + + asRGB: function() { + return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")"; + }, + + asHex: function() { + return "#" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart(); + }, + + asHSB: function() { + return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b); + }, + + toString: function() { + return this.asHex(); + } + +}; + +Rico.Color.createFromHex = function(hexCode) { + + if ( hexCode.indexOf('#') == 0 ) + hexCode = hexCode.substring(1); + var red = hexCode.substring(0,2); + var green = hexCode.substring(2,4); + var blue = hexCode.substring(4,6); + return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) ); +} + +/** + * Factory method for creating a color from the background of + * an HTML element. + */ +Rico.Color.createColorFromBackground = function(elem) { + + var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color"); + + if ( actualColor == "transparent" && elem.parent ) + return Rico.Color.createColorFromBackground(elem.parent); + + if ( actualColor == null ) + return new Rico.Color(255,255,255); + + if ( actualColor.indexOf("rgb(") == 0 ) { + var colors = actualColor.substring(4, actualColor.length - 1 ); + var colorArray = colors.split(","); + return new Rico.Color( parseInt( colorArray[0] ), + parseInt( colorArray[1] ), + parseInt( colorArray[2] ) ); + + } + else if ( actualColor.indexOf("#") == 0 ) { + var redPart = parseInt(actualColor.substring(1,3), 16); + var greenPart = parseInt(actualColor.substring(3,5), 16); + var bluePart = parseInt(actualColor.substring(5), 16); + return new Rico.Color( redPart, greenPart, bluePart ); + } + else + return new Rico.Color(255,255,255); +} + +Rico.Color.HSBtoRGB = function(hue, saturation, brightness) { + + var red = 0; + var green = 0; + var blue = 0; + + if (saturation == 0) { + red = parseInt(brightness * 255.0 + 0.5); + green = red; + blue = red; + } + else { + var h = (hue - Math.floor(hue)) * 6.0; + var f = h - Math.floor(h); + var p = brightness * (1.0 - saturation); + var q = brightness * (1.0 - saturation * f); + var t = brightness * (1.0 - (saturation * (1.0 - f))); + + switch (parseInt(h)) { + case 0: + red = (brightness * 255.0 + 0.5); + green = (t * 255.0 + 0.5); + blue = (p * 255.0 + 0.5); + break; + case 1: + red = (q * 255.0 + 0.5); + green = (brightness * 255.0 + 0.5); + blue = (p * 255.0 + 0.5); + break; + case 2: + red = (p * 255.0 + 0.5); + green = (brightness * 255.0 + 0.5); + blue = (t * 255.0 + 0.5); + break; + case 3: + red = (p * 255.0 + 0.5); + green = (q * 255.0 + 0.5); + blue = (brightness * 255.0 + 0.5); + break; + case 4: + red = (t * 255.0 + 0.5); + green = (p * 255.0 + 0.5); + blue = (brightness * 255.0 + 0.5); + break; + case 5: + red = (brightness * 255.0 + 0.5); + green = (p * 255.0 + 0.5); + blue = (q * 255.0 + 0.5); + break; + } + } + + return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) }; +} + +Rico.Color.RGBtoHSB = function(r, g, b) { + + var hue; + var saturaton; + var brightness; + + var cmax = (r > g) ? r : g; + if (b > cmax) + cmax = b; + + var cmin = (r < g) ? r : g; + if (b < cmin) + cmin = b; + + brightness = cmax / 255.0; + if (cmax != 0) + saturation = (cmax - cmin)/cmax; + else + saturation = 0; + + if (saturation == 0) + hue = 0; + else { + var redc = (cmax - r)/(cmax - cmin); + var greenc = (cmax - g)/(cmax - cmin); + var bluec = (cmax - b)/(cmax - cmin); + + if (r == cmax) + hue = bluec - greenc; + else if (g == cmax) + hue = 2.0 + redc - bluec; + else + hue = 4.0 + greenc - redc; + + hue = hue / 6.0; + if (hue < 0) + hue = hue + 1.0; + } + + return { h : hue, s : saturation, b : brightness }; +} + + +//-------------------- ricoCorner.js + +Rico.Corner = { + + round: function(e, options) { + var e = $(e); + this._setOptions(options); + + var color = this.options.color; + if ( this.options.color == "fromElement" ) + color = this._background(e); + + var bgColor = this.options.bgColor; + if ( this.options.bgColor == "fromParent" ) + bgColor = this._background(e.offsetParent); + + this._roundCornersImpl(e, color, bgColor); + }, + + _roundCornersImpl: function(e, color, bgColor) { + if(this.options.border) + this._renderBorder(e,bgColor); + if(this._isTopRounded()) + this._roundTopCorners(e,color,bgColor); + if(this._isBottomRounded()) + this._roundBottomCorners(e,color,bgColor); + }, + + _renderBorder: function(el,bgColor) { + var borderValue = "1px solid " + this._borderColor(bgColor); + var borderL = "border-left: " + borderValue; + var borderR = "border-right: " + borderValue; + var style = "style='" + borderL + ";" + borderR + "'"; + el.innerHTML = "

    " + el.innerHTML + "
    " + }, + + _roundTopCorners: function(el, color, bgColor) { + var corner = this._createCorner(bgColor); + for(var i=0 ; i < this.options.numSlices ; i++ ) + corner.appendChild(this._createCornerSlice(color,bgColor,i,"top")); + el.style.paddingTop = 0; + el.insertBefore(corner,el.firstChild); + }, + + _roundBottomCorners: function(el, color, bgColor) { + var corner = this._createCorner(bgColor); + for(var i=(this.options.numSlices-1) ; i >= 0 ; i-- ) + corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom")); + el.style.paddingBottom = 0; + el.appendChild(corner); + }, + + _createCorner: function(bgColor) { + var corner = document.createElement("div"); + corner.style.backgroundColor = (this._isTransparent() ? "transparent" : bgColor); + return corner; + }, + + _createCornerSlice: function(color,bgColor, n, position) { + var slice = document.createElement("span"); + + var inStyle = slice.style; + inStyle.backgroundColor = color; + inStyle.display = "block"; + inStyle.height = "1px"; + inStyle.overflow = "hidden"; + inStyle.fontSize = "1px"; + + var borderColor = this._borderColor(color,bgColor); + if ( this.options.border && n == 0 ) { + inStyle.borderTopStyle = "solid"; + inStyle.borderTopWidth = "1px"; + inStyle.borderLeftWidth = "0px"; + inStyle.borderRightWidth = "0px"; + inStyle.borderBottomWidth = "0px"; + inStyle.height = "0px"; // assumes css compliant box model + inStyle.borderColor = borderColor; + } + else if(borderColor) { + inStyle.borderColor = borderColor; + inStyle.borderStyle = "solid"; + inStyle.borderWidth = "0px 1px"; + } + + if ( !this.options.compact && (n == (this.options.numSlices-1)) ) + inStyle.height = "2px"; + + this._setMargin(slice, n, position); + this._setBorder(slice, n, position); + + return slice; + }, + + _setOptions: function(options) { + this.options = { + corners : "all", + color : "fromElement", + bgColor : "fromParent", + blend : true, + border : false, + compact : false + }.extend(options || {}); + + this.options.numSlices = this.options.compact ? 2 : 4; + if ( this._isTransparent() ) + this.options.blend = false; + }, + + _whichSideTop: function() { + if ( this._hasString(this.options.corners, "all", "top") ) + return ""; + + if ( this.options.corners.indexOf("tl") >= 0 && this.options.corners.indexOf("tr") >= 0 ) + return ""; + + if (this.options.corners.indexOf("tl") >= 0) + return "left"; + else if (this.options.corners.indexOf("tr") >= 0) + return "right"; + return ""; + }, + + _whichSideBottom: function() { + if ( this._hasString(this.options.corners, "all", "bottom") ) + return ""; + + if ( this.options.corners.indexOf("bl")>=0 && this.options.corners.indexOf("br")>=0 ) + return ""; + + if(this.options.corners.indexOf("bl") >=0) + return "left"; + else if(this.options.corners.indexOf("br")>=0) + return "right"; + return ""; + }, + + _borderColor : function(color,bgColor) { + if ( color == "transparent" ) + return bgColor; + else if ( this.options.border ) + return this.options.border; + else if ( this.options.blend ) + return this._blend( bgColor, color ); + else + return ""; + }, + + + _setMargin: function(el, n, corners) { + var marginSize = this._marginSize(n); + var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom(); + + if ( whichSide == "left" ) { + el.style.marginLeft = marginSize + "px"; el.style.marginRight = "0px"; + } + else if ( whichSide == "right" ) { + el.style.marginRight = marginSize + "px"; el.style.marginLeft = "0px"; + } + else { + el.style.marginLeft = marginSize + "px"; el.style.marginRight = marginSize + "px"; + } + }, + + _setBorder: function(el,n,corners) { + var borderSize = this._borderSize(n); + var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom(); + + if ( whichSide == "left" ) { + el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = "0px"; + } + else if ( whichSide == "right" ) { + el.style.borderRightWidth = borderSize + "px"; el.style.borderLeftWidth = "0px"; + } + else { + el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px"; + } + }, + + _marginSize: function(n) { + if ( this._isTransparent() ) + return 0; + + var marginSizes = [ 5, 3, 2, 1 ]; + var blendedMarginSizes = [ 3, 2, 1, 0 ]; + var compactMarginSizes = [ 2, 1 ]; + var smBlendedMarginSizes = [ 1, 0 ]; + + if ( this.options.compact && this.options.blend ) + return smBlendedMarginSizes[n]; + else if ( this.options.compact ) + return compactMarginSizes[n]; + else if ( this.options.blend ) + return blendedMarginSizes[n]; + else + return marginSizes[n]; + }, + + _borderSize: function(n) { + var transparentBorderSizes = [ 5, 3, 2, 1 ]; + var blendedBorderSizes = [ 2, 1, 1, 1 ]; + var compactBorderSizes = [ 1, 0 ]; + var actualBorderSizes = [ 0, 2, 0, 0 ]; + + if ( this.options.compact && (this.options.blend || this._isTransparent()) ) + return 1; + else if ( this.options.compact ) + return compactBorderSizes[n]; + else if ( this.options.blend ) + return blendedBorderSizes[n]; + else if ( this.options.border ) + return actualBorderSizes[n]; + else if ( this._isTransparent() ) + return transparentBorderSizes[n]; + return 0; + }, + + _hasString: function(str) { for(var i=1 ; i= 0) return true; return false; }, + _blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; }, + _background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } }, + _isTransparent: function() { return this.options.color == "transparent"; }, + _isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); }, + _isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); }, + _hasSingleTextChild: function(el) { return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3; } +} + + +//-------------------- ricoDragAndDrop.js +Rico.DragAndDrop = Class.create(); + +Rico.DragAndDrop.prototype = { + + initialize: function() { + this.dropZones = new Array(); + this.draggables = new Array(); + this.currentDragObjects = new Array(); + this.dragElement = null; + this.lastSelectedDraggable = null; + this.currentDragObjectVisible = false; + this.interestedInMotionEvents = false; + }, + + registerDropZone: function(aDropZone) { + this.dropZones[ this.dropZones.length ] = aDropZone; + }, + + deregisterDropZone: function(aDropZone) { + var newDropZones = new Array(); + var j = 0; + for ( var i = 0 ; i < this.dropZones.length ; i++ ) { + if ( this.dropZones[i] != aDropZone ) + newDropZones[j++] = this.dropZones[i]; + } + + this.dropZones = newDropZones; + }, + + clearDropZones: function() { + this.dropZones = new Array(); + }, + + registerDraggable: function( aDraggable ) { + this.draggables[ this.draggables.length ] = aDraggable; + this._addMouseDownHandler( aDraggable ); + }, + + clearSelection: function() { + for ( var i = 0 ; i < this.currentDragObjects.length ; i++ ) + this.currentDragObjects[i].deselect(); + this.currentDragObjects = new Array(); + this.lastSelectedDraggable = null; + }, + + hasSelection: function() { + return this.currentDragObjects.length > 0; + }, + + setStartDragFromElement: function( e, mouseDownElement ) { + this.origPos = RicoUtil.toDocumentPosition(mouseDownElement); + this.startx = e.screenX - this.origPos.x + this.starty = e.screenY - this.origPos.y + //this.startComponentX = e.layerX ? e.layerX : e.offsetX; + //this.startComponentY = e.layerY ? e.layerY : e.offsetY; + //this.adjustedForDraggableSize = false; + + this.interestedInMotionEvents = this.hasSelection(); + this._terminateEvent(e); + }, + + updateSelection: function( draggable, extendSelection ) { + if ( ! extendSelection ) + this.clearSelection(); + + if ( draggable.isSelected() ) { + this.currentDragObjects.removeItem(draggable); + draggable.deselect(); + if ( draggable == this.lastSelectedDraggable ) + this.lastSelectedDraggable = null; + } + else { + this.currentDragObjects[ this.currentDragObjects.length ] = draggable; + draggable.select(); + this.lastSelectedDraggable = draggable; + } + }, + + _mouseDownHandler: function(e) { + if ( arguments.length == 0 ) + e = event; + + // if not button 1 ignore it... + var nsEvent = e.which != undefined; + if ( (nsEvent && e.which != 1) || (!nsEvent && e.button != 1)) + return; + + var eventTarget = e.target ? e.target : e.srcElement; + var draggableObject = eventTarget.draggable; + + var candidate = eventTarget; + while (draggableObject == null && candidate.parentNode) { + candidate = candidate.parentNode; + draggableObject = candidate.draggable; + } + + if ( draggableObject == null ) + return; + + this.updateSelection( draggableObject, e.ctrlKey ); + + // clear the drop zones postion cache... + if ( this.hasSelection() ) + for ( var i = 0 ; i < this.dropZones.length ; i++ ) + this.dropZones[i].clearPositionCache(); + + this.setStartDragFromElement( e, draggableObject.getMouseDownHTMLElement() ); + }, + + + _mouseMoveHandler: function(e) { + var nsEvent = e.which != undefined; + if ( !this.interestedInMotionEvents ) { + this._terminateEvent(e); + return; + } + + if ( ! this.hasSelection() ) + return; + + if ( ! this.currentDragObjectVisible ) + this._startDrag(e); + + if ( !this.activatedDropZones ) + this._activateRegisteredDropZones(); + + //if ( !this.adjustedForDraggableSize ) + // this._adjustForDraggableSize(e); + + this._updateDraggableLocation(e); + this._updateDropZonesHover(e); + + this._terminateEvent(e); + }, + + _makeDraggableObjectVisible: function(e) + { + if ( !this.hasSelection() ) + return; + + var dragElement; + if ( this.currentDragObjects.length > 1 ) + dragElement = this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects); + else + dragElement = this.currentDragObjects[0].getSingleObjectDragGUI(); + + // go ahead and absolute position it... + if ( RicoUtil.getElementsComputedStyle(dragElement, "position") != "absolute" ) + dragElement.style.position = "absolute"; + + // need to parent him into the document... + if ( dragElement.parentNode == null || dragElement.parentNode.nodeType == 11 ) + document.body.appendChild(dragElement); + + this.dragElement = dragElement; + this._updateDraggableLocation(e); + + this.currentDragObjectVisible = true; + }, + + /** + _adjustForDraggableSize: function(e) { + var dragElementWidth = this.dragElement.offsetWidth; + var dragElementHeight = this.dragElement.offsetHeight; + if ( this.startComponentX > dragElementWidth ) + this.startx -= this.startComponentX - dragElementWidth + 2; + if ( e.offsetY ) { + if ( this.startComponentY > dragElementHeight ) + this.starty -= this.startComponentY - dragElementHeight + 2; + } + this.adjustedForDraggableSize = true; + }, + **/ + + _updateDraggableLocation: function(e) { + var dragObjectStyle = this.dragElement.style; + dragObjectStyle.left = (e.screenX - this.startx) + "px" + dragObjectStyle.top = (e.screenY - this.starty) + "px"; + }, + + _updateDropZonesHover: function(e) { + var n = this.dropZones.length; + for ( var i = 0 ; i < n ; i++ ) { + if ( ! this._mousePointInDropZone( e, this.dropZones[i] ) ) + this.dropZones[i].hideHover(); + } + + for ( var i = 0 ; i < n ; i++ ) { + if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) { + if ( this.dropZones[i].canAccept(this.currentDragObjects) ) + this.dropZones[i].showHover(); + } + } + }, + + _startDrag: function(e) { + for ( var i = 0 ; i < this.currentDragObjects.length ; i++ ) + this.currentDragObjects[i].startDrag(); + + this._makeDraggableObjectVisible(e); + }, + + _mouseUpHandler: function(e) { + if ( ! this.hasSelection() ) + return; + + var nsEvent = e.which != undefined; + if ( (nsEvent && e.which != 1) || (!nsEvent && e.button != 1)) + return; + + this.interestedInMotionEvents = false; + + if ( this.dragElement == null ) { + this._terminateEvent(e); + return; + } + + if ( this._placeDraggableInDropZone(e) ) + this._completeDropOperation(e); + else { + this._terminateEvent(e); + new Effect.Position( this.dragElement, + this.origPos.x, + this.origPos.y, + 200, + 20, + { complete : this._doCancelDragProcessing.bind(this) } ); + } + }, + + _completeDropOperation: function(e) { + if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() ) { + if ( this.dragElement.parentNode != null ) + this.dragElement.parentNode.removeChild(this.dragElement); + } + + this._deactivateRegisteredDropZones(); + this._endDrag(); + this.clearSelection(); + this.dragElement = null; + this.currentDragObjectVisible = false; + this._terminateEvent(e); + }, + + _doCancelDragProcessing: function() { + this._cancelDrag(); + + if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() ) { + if ( this.dragElement.parentNode != null ) { + this.dragElement.parentNode.removeChild(this.dragElement); + } + } + + this._deactivateRegisteredDropZones(); + this.dragElement = null; + this.currentDragObjectVisible = false; + }, + + _placeDraggableInDropZone: function(e) { + var foundDropZone = false; + var n = this.dropZones.length; + for ( var i = 0 ; i < n ; i++ ) { + if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) { + if ( this.dropZones[i].canAccept(this.currentDragObjects) ) { + this.dropZones[i].hideHover(); + this.dropZones[i].accept(this.currentDragObjects); + foundDropZone = true; + break; + } + } + } + + return foundDropZone; + }, + + _cancelDrag: function() { + for ( var i = 0 ; i < this.currentDragObjects.length ; i++ ) + this.currentDragObjects[i].cancelDrag(); + }, + + _endDrag: function() { + for ( var i = 0 ; i < this.currentDragObjects.length ; i++ ) + this.currentDragObjects[i].endDrag(); + }, + + _mousePointInDropZone: function( e, dropZone ) { + + var absoluteRect = dropZone.getAbsoluteRect(); + + return e.clientX > absoluteRect.left && + e.clientX < absoluteRect.right && + e.clientY > absoluteRect.top && + e.clientY < absoluteRect.bottom; + }, + + _addMouseDownHandler: function( aDraggable ) + { + var htmlElement = aDraggable.getMouseDownHTMLElement(); + if ( htmlElement != null ) { + htmlElement.draggable = aDraggable; + this._addMouseDownEvent( htmlElement ); + } + }, + + _activateRegisteredDropZones: function() { + var n = this.dropZones.length; + for ( var i = 0 ; i < n ; i++ ) { + var dropZone = this.dropZones[i]; + if ( dropZone.canAccept(this.currentDragObjects) ) + dropZone.activate(); + } + + this.activatedDropZones = true; + }, + + _deactivateRegisteredDropZones: function() { + var n = this.dropZones.length; + for ( var i = 0 ; i < n ; i++ ) + this.dropZones[i].deactivate(); + this.activatedDropZones = false; + }, + + _addMouseDownEvent: function( htmlElement ) { + if ( typeof document.implementation != "undefined" && + document.implementation.hasFeature("HTML", "1.0") && + document.implementation.hasFeature("Events", "2.0") && + document.implementation.hasFeature("CSS", "2.0") ) { + htmlElement.addEventListener("mousedown", this._mouseDownHandler.bindAsEventListener(this), false); + } + else { + htmlElement.attachEvent( "onmousedown", this._mouseDownHandler.bindAsEventListener(this) ); + } + }, + + _terminateEvent: function(e) { + if ( e.stopPropagation != undefined ) + e.stopPropagation(); + else if ( e.cancelBubble != undefined ) + e.cancelBubble = true; + + if ( e.preventDefault != undefined ) + e.preventDefault(); + else + e.returnValue = false; + }, + + initializeEventHandlers: function() { + if ( typeof document.implementation != "undefined" && + document.implementation.hasFeature("HTML", "1.0") && + document.implementation.hasFeature("Events", "2.0") && + document.implementation.hasFeature("CSS", "2.0") ) { + document.addEventListener("mouseup", this._mouseUpHandler.bindAsEventListener(this), false); + document.addEventListener("mousemove", this._mouseMoveHandler.bindAsEventListener(this), false); + } + else { + document.attachEvent( "onmouseup", this._mouseUpHandler.bindAsEventListener(this) ); + document.attachEvent( "onmousemove", this._mouseMoveHandler.bindAsEventListener(this) ); + } + } +} + +//var dndMgr = new Rico.DragAndDrop(); +//dndMgr.initializeEventHandlers(); + + +//-------------------- ricoDraggable.js +Rico.Draggable = Class.create(); + +Rico.Draggable.prototype = { + + initialize: function( type, htmlElement ) { + this.type = type; + this.htmlElement = $(htmlElement); + this.selected = false; + }, + + /** + * Returns the HTML element that should have a mouse down event + * added to it in order to initiate a drag operation + * + **/ + getMouseDownHTMLElement: function() { + return this.htmlElement; + }, + + select: function() { + this.selected = true; + + if ( this.showingSelected ) + return; + + var htmlElement = this.getMouseDownHTMLElement(); + + var color = Rico.Color.createColorFromBackground(htmlElement); + color.isBright() ? color.darken(0.033) : color.brighten(0.033); + + this.saveBackground = RicoUtil.getElementsComputedStyle(htmlElement, "backgroundColor", "background-color"); + htmlElement.style.backgroundColor = color.asHex(); + this.showingSelected = true; + }, + + deselect: function() { + this.selected = false; + if ( !this.showingSelected ) + return; + + var htmlElement = this.getMouseDownHTMLElement(); + + htmlElement.style.backgroundColor = this.saveBackground; + this.showingSelected = false; + }, + + isSelected: function() { + return this.selected; + }, + + startDrag: function() { + }, + + cancelDrag: function() { + }, + + endDrag: function() { + }, + + getSingleObjectDragGUI: function() { + return this.htmlElement; + }, + + getMultiObjectDragGUI: function( draggables ) { + return this.htmlElement; + }, + + getDroppedGUI: function() { + return this.htmlElement; + }, + + toString: function() { + return this.type + ":" + this.htmlElement + ":"; + } + +} + + +//-------------------- ricoDropzone.js +Rico.Dropzone = Class.create(); + +Rico.Dropzone.prototype = { + + initialize: function( htmlElement ) { + this.htmlElement = $(htmlElement); + this.absoluteRect = null; + }, + + getHTMLElement: function() { + return this.htmlElement; + }, + + clearPositionCache: function() { + this.absoluteRect = null; + }, + + getAbsoluteRect: function() { + if ( this.absoluteRect == null ) { + var htmlElement = this.getHTMLElement(); + var pos = RicoUtil.toViewportPosition(htmlElement); + + this.absoluteRect = { + top: pos.y, + left: pos.x, + bottom: pos.y + htmlElement.offsetHeight, + right: pos.x + htmlElement.offsetWidth + }; + } + return this.absoluteRect; + }, + + activate: function() { + var htmlElement = this.getHTMLElement(); + if (htmlElement == null || this.showingActive) + return; + + this.showingActive = true; + this.saveBackgroundColor = htmlElement.style.backgroundColor; + + var fallbackColor = "#ffea84"; + var currentColor = Rico.Color.createColorFromBackground(htmlElement); + if ( currentColor == null ) + htmlElement.style.backgroundColor = fallbackColor; + else { + currentColor.isBright() ? currentColor.darken(0.2) : currentColor.brighten(0.2); + htmlElement.style.backgroundColor = currentColor.asHex(); + } + }, + + deactivate: function() { + var htmlElement = this.getHTMLElement(); + if (htmlElement == null || !this.showingActive) + return; + + htmlElement.style.backgroundColor = this.saveBackgroundColor; + this.showingActive = false; + this.saveBackgroundColor = null; + }, + + showHover: function() { + var htmlElement = this.getHTMLElement(); + if ( htmlElement == null || this.showingHover ) + return; + + this.saveBorderWidth = htmlElement.style.borderWidth; + this.saveBorderStyle = htmlElement.style.borderStyle; + this.saveBorderColor = htmlElement.style.borderColor; + + this.showingHover = true; + htmlElement.style.borderWidth = "1px"; + htmlElement.style.borderStyle = "solid"; + //htmlElement.style.borderColor = "#ff9900"; + htmlElement.style.borderColor = "#ffff00"; + }, + + hideHover: function() { + var htmlElement = this.getHTMLElement(); + if ( htmlElement == null || !this.showingHover ) + return; + + htmlElement.style.borderWidth = this.saveBorderWidth; + htmlElement.style.borderStyle = this.saveBorderStyle; + htmlElement.style.borderColor = this.saveBorderColor; + this.showingHover = false; + }, + + canAccept: function(draggableObjects) { + return true; + }, + + accept: function(draggableObjects) { + var htmlElement = this.getHTMLElement(); + if ( htmlElement == null ) + return; + + n = draggableObjects.length; + for ( var i = 0 ; i < n ; i++ ) + { + var theGUI = draggableObjects[i].getDroppedGUI(); + if ( RicoUtil.getElementsComputedStyle( theGUI, "position" ) == "absolute" ) + { + theGUI.style.position = "static"; + theGUI.style.top = ""; + theGUI.style.top = ""; + } + htmlElement.appendChild(theGUI); + } + } +} + + +//-------------------- ricoEffects.js + +/** + * Use the Effect namespace for effects. If using scriptaculous effects + * this will already be defined, otherwise we'll just create an empty + * object for it... + **/ +if ( window.Effect == undefined ) + Effect = {}; + +Effect.SizeAndPosition = Class.create(); +Effect.SizeAndPosition.prototype = { + + initialize: function(element, x, y, w, h, duration, steps, options) { + this.element = $(element); + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.duration = duration; + this.steps = steps; + this.options = arguments[7] || {}; + + this.sizeAndPosition(); + }, + + sizeAndPosition: function() { + if (this.isFinished()) { + if(this.options.complete) this.options.complete(this); + return; + } + + if (this.timer) + clearTimeout(this.timer); + + var stepDuration = Math.round(this.duration/this.steps) ; + + // Get original values: x,y = top left corner; w,h = width height + var currentX = this.element.offsetLeft; + var currentY = this.element.offsetTop; + var currentW = this.element.offsetWidth; + var currentH = this.element.offsetHeight; + + // If values not set, or zero, we do not modify them, and take original as final as well + this.x = (this.x) ? this.x : currentX; + this.y = (this.y) ? this.y : currentY; + this.w = (this.w) ? this.w : currentW; + this.h = (this.h) ? this.h : currentH; + + // how much do we need to modify our values for each step? + var difX = this.steps > 0 ? (this.x - currentX)/this.steps : 0; + var difY = this.steps > 0 ? (this.y - currentY)/this.steps : 0; + var difW = this.steps > 0 ? (this.w - currentW)/this.steps : 0; + var difH = this.steps > 0 ? (this.h - currentH)/this.steps : 0; + + this.moveBy(difX, difY); + this.resizeBy(difW, difH); + + this.duration -= stepDuration; + this.steps--; + + this.timer = setTimeout(this.sizeAndPosition.bind(this), stepDuration); + }, + + isFinished: function() { + return this.steps <= 0; + }, + + moveBy: function( difX, difY ) { + var currentLeft = this.element.offsetLeft; + var currentTop = this.element.offsetTop; + var intDifX = parseInt(difX); + var intDifY = parseInt(difY); + + var style = this.element.style; + if ( intDifX != 0 ) + style.left = (currentLeft + intDifX) + "px"; + if ( intDifY != 0 ) + style.top = (currentTop + intDifY) + "px"; + }, + + resizeBy: function( difW, difH ) { + var currentWidth = this.element.offsetWidth; + var currentHeight = this.element.offsetHeight; + var intDifW = parseInt(difW); + var intDifH = parseInt(difH); + + var style = this.element.style; + if ( intDifW != 0 ) + style.width = (currentWidth + intDifW) + "px"; + if ( intDifH != 0 ) + style.height = (currentHeight + intDifH) + "px"; + } +} + +Effect.Size = Class.create(); +Effect.Size.prototype = { + + initialize: function(element, w, h, duration, steps, options) { + new Effect.SizeAndPosition(element, null, null, w, h, duration, steps, options); + } +} + +Effect.Position = Class.create(); +Effect.Position.prototype = { + + initialize: function(element, x, y, duration, steps, options) { + new Effect.SizeAndPosition(element, x, y, null, null, duration, steps, options); + } +} + +Effect.Round = Class.create(); +Effect.Round.prototype = { + + initialize: function(tagName, className, options) { + var elements = document.getElementsByTagAndClassName(tagName,className); + for ( var i = 0 ; i < elements.length ; i++ ) + Rico.Corner.round( elements[i], options ); + } +}; + +Effect.FadeTo = Class.create(); +Effect.FadeTo.prototype = { + + initialize: function( element, opacity, duration, steps, options) { + this.element = $(element); + this.opacity = opacity; + this.duration = duration; + this.steps = steps; + this.options = arguments[4] || {}; + this.fadeTo(); + }, + + fadeTo: function() { + if (this.isFinished()) { + if(this.options.complete) this.options.complete(this); + return; + } + + if (this.timer) + clearTimeout(this.timer); + + var stepDuration = Math.round(this.duration/this.steps) ; + var currentOpacity = this.getElementOpacity(); + var delta = this.steps > 0 ? (this.opacity - currentOpacity)/this.steps : 0; + + this.changeOpacityBy(delta); + this.duration -= stepDuration; + this.steps--; + + this.timer = setTimeout(this.fadeTo.bind(this), stepDuration); + }, + + changeOpacityBy: function(v) { + var currentOpacity = this.getElementOpacity(); + var newOpacity = Math.max(0, Math.min(currentOpacity+v, 1)); + this.element.ricoOpacity = newOpacity; + + this.element.style.filter = "alpha(opacity:"+Math.round(newOpacity*100)+")"; + this.element.style.opacity = newOpacity; /*//*/; + }, + + isFinished: function() { + return this.steps <= 0; + }, + + getElementOpacity: function() { + if ( this.element.ricoOpacity == undefined ) { + var opacity; + if ( this.element.currentStyle ) { + opacity = this.element.currentStyle.opacity; + } + else if ( document.defaultView.getComputedStyle != undefined ) { + var computedStyle = document.defaultView.getComputedStyle; + opacity = computedStyle(this.element, null).getPropertyValue('opacity'); + } + + this.element.ricoOpacity = opacity != undefined ? opacity : 1.0; + } + + return parseFloat(this.element.ricoOpacity); + } +} + +Effect.AccordionSize = Class.create(); + +Effect.AccordionSize.prototype = { + + initialize: function(e1, e2, start, end, duration, steps, options) { + this.e1 = $(e1); + this.e2 = $(e2); + this.start = start; + this.end = end; + this.duration = duration; + this.steps = steps; + this.options = arguments[6] || {}; + + this.accordionSize(); + }, + + accordionSize: function() { + + if (this.isFinished()) { + // just in case there are round errors or such... + this.e1.style.height = this.start + "px"; + this.e2.style.height = this.end + "px"; + + if(this.options.complete) + this.options.complete(this); + return; + } + + if (this.timer) + clearTimeout(this.timer); + + var stepDuration = Math.round(this.duration/this.steps) ; + + var diff = this.steps > 0 ? (parseInt(this.e1.offsetHeight) - this.start)/this.steps : 0; + this.resizeBy(diff); + + this.duration -= stepDuration; + this.steps--; + + this.timer = setTimeout(this.accordionSize.bind(this), stepDuration); + }, + + isFinished: function() { + return this.steps <= 0; + }, + + resizeBy: function(diff) { + var h1Height = this.e1.offsetHeight; + var h2Height = this.e2.offsetHeight; + var intDiff = parseInt(diff); + if ( diff != 0 ) { + this.e1.style.height = (h1Height - intDiff) + "px"; + this.e2.style.height = (h2Height + intDiff) + "px"; + } + } + +}; + + +//-------------------- ricoLiveGrid.js + +// Rico.LiveGridMetaData ----------------------------------------------------- + +Rico.LiveGridMetaData = Class.create(); + +Rico.LiveGridMetaData.prototype = { + + initialize: function( pageSize, totalRows, columnCount, options ) { + this.pageSize = pageSize; + this.totalRows = totalRows; + this.setOptions(options); + this.scrollArrowHeight = 16; + this.columnCount = columnCount; + }, + + setOptions: function(options) { + this.options = { + largeBufferSize : 7.0, // 7 pages + nearLimitFactor : 0.2 // 20% of buffer + }.extend(options || {}); + }, + + getPageSize: function() { + return this.pageSize; + }, + + getTotalRows: function() { + return this.totalRows; + }, + + setTotalRows: function(n) { + this.totalRows = n; + }, + + getLargeBufferSize: function() { + return parseInt(this.options.largeBufferSize * this.pageSize); + }, + + getLimitTolerance: function() { + return parseInt(this.getLargeBufferSize() * this.options.nearLimitFactor); + } +}; + +// Rico.LiveGridScroller ----------------------------------------------------- + +Rico.LiveGridScroller = Class.create(); + +Rico.LiveGridScroller.prototype = { + + initialize: function(liveGrid, viewPort) { + this.isIE = navigator.userAgent.toLowerCase().indexOf("msie") >= 0; + this.liveGrid = liveGrid; + this.metaData = liveGrid.metaData; + this.createScrollBar(); + this.scrollTimeout = null; + this.lastScrollPos = 0; + this.viewPort = viewPort; + this.rows = new Array(); + }, + + isUnPlugged: function() { + return this.scrollerDiv.onscroll == null; + }, + + plugin: function() { + this.scrollerDiv.onscroll = this.handleScroll.bindAsEventListener(this); + }, + + unplug: function() { + this.scrollerDiv.onscroll = null; + }, + + sizeIEHeaderHack: function() { + if ( !this.isIE ) return; + var headerTable = $(this.liveGrid.tableId + "_header"); + if ( headerTable ) + headerTable.rows[0].cells[0].style.width = + (headerTable.rows[0].cells[0].offsetWidth + 1) + "px"; + }, + + createScrollBar: function() { + var visibleHeight = this.liveGrid.viewPort.visibleHeight(); + // create the outer div... + this.scrollerDiv = document.createElement("div"); + var scrollerStyle = this.scrollerDiv.style; + scrollerStyle.borderRight = "1px solid #ababab"; // hard coded color!!! + scrollerStyle.position = "relative"; + scrollerStyle.left = this.isIE ? "-6px" : "-3px"; + scrollerStyle.width = "19px"; + scrollerStyle.height = visibleHeight + "px"; + scrollerStyle.overflow = "auto"; + + // create the inner div... + this.heightDiv = document.createElement("div"); + this.heightDiv.style.width = "1px"; + + this.heightDiv.style.height = parseInt(visibleHeight * + this.metaData.getTotalRows()/this.metaData.getPageSize()) + "px" ; + this.scrollerDiv.appendChild(this.heightDiv); + this.scrollerDiv.onscroll = this.handleScroll.bindAsEventListener(this); + + var table = this.liveGrid.table; + table.parentNode.parentNode.insertBefore( this.scrollerDiv, table.parentNode.nextSibling ); + }, + + updateSize: function() { + var table = this.liveGrid.table; + var visibleHeight = this.viewPort.visibleHeight(); + this.heightDiv.style.height = parseInt(visibleHeight * + this.metaData.getTotalRows()/this.metaData.getPageSize()) + "px"; + }, + + rowToPixel: function(rowOffset) { + return (rowOffset / this.metaData.getTotalRows()) * this.heightDiv.offsetHeight + }, + + moveScroll: function(rowOffset) { + this.scrollerDiv.scrollTop = this.rowToPixel(rowOffset); + if ( this.metaData.options.onscroll ) + this.metaData.options.onscroll( this.liveGrid, rowOffset ); + }, + + handleScroll: function() { + if ( this.scrollTimeout ) + clearTimeout( this.scrollTimeout ); + + var contentOffset = parseInt(this.scrollerDiv.scrollTop / this.viewPort.rowHeight); + this.liveGrid.requestContentRefresh(contentOffset); + this.viewPort.scrollTo(this.scrollerDiv.scrollTop); + + if ( this.metaData.options.onscroll ) + this.metaData.options.onscroll( this.liveGrid, contentOffset ); + + this.scrollTimeout = setTimeout( this.scrollIdle.bind(this), 1200 ); + }, + + scrollIdle: function() { + if ( this.metaData.options.onscrollidle ) + this.metaData.options.onscrollidle(); + } +}; + +// Rico.LiveGridBuffer ----------------------------------------------------- + +Rico.LiveGridBuffer = Class.create(); + +Rico.LiveGridBuffer.prototype = { + + initialize: function(metaData, viewPort) { + this.startPos = 0; + this.size = 0; + this.metaData = metaData; + this.rows = new Array(); + this.updateInProgress = false; + this.viewPort = viewPort; + this.maxBufferSize = metaData.getLargeBufferSize() * 2; + this.maxFetchSize = metaData.getLargeBufferSize(); + this.lastOffset = 0; + }, + + getBlankRow: function() { + if (!this.blankRow ) { + this.blankRow = new Array(); + for ( var i=0; i < this.metaData.columnCount ; i++ ) + this.blankRow[i] = " "; + } + return this.blankRow; + }, + + loadRows: function(ajaxResponse) { + var rowsElement = ajaxResponse.getElementsByTagName('rows')[0]; + this.updateUI = rowsElement.getAttribute("update_ui") == "true" + var newRows = new Array() + var trs = rowsElement.getElementsByTagName("tr"); + for ( var i=0 ; i < trs.length; i++ ) { + var row = newRows[i] = new Array(); + var cells = trs[i].getElementsByTagName("td"); + for ( var j=0; j < cells.length ; j++ ) { + var cell = cells[j]; + var convertSpaces = cell.getAttribute("convert_spaces") == "true"; + var cellContent = RicoUtil.getContentAsString(cell); + row[j] = convertSpaces ? this.convertSpaces(cellContent) : cellContent; + if (!row[j]) + row[j] = ' '; + } + } + return newRows; + }, + + update: function(ajaxResponse, start) { + var newRows = this.loadRows(ajaxResponse); + if (this.rows.length == 0) { // initial load + this.rows = newRows; + this.size = this.rows.length; + this.startPos = start; + return; + } + if (start > this.startPos) { //appending + if (this.startPos + this.rows.length < start) { + this.rows = newRows; + this.startPos = start;// + } else { + this.rows = this.rows.concat( newRows.slice(0, newRows.length)); + if (this.rows.length > this.maxBufferSize) { + var fullSize = this.rows.length; + this.rows = this.rows.slice(this.rows.length - this.maxBufferSize, this.rows.length) + this.startPos = this.startPos + (fullSize - this.rows.length); + } + } + } else { //prepending + if (start + newRows.length < this.startPos) { + this.rows = newRows; + } else { + this.rows = newRows.slice(0, this.startPos).concat(this.rows); + if (this.rows.length > this.maxBufferSize) + this.rows = this.rows.slice(0, this.maxBufferSize) + } + this.startPos = start; + } + this.size = this.rows.length; + }, + + clear: function() { + this.rows = new Array(); + this.startPos = 0; + this.size = 0; + }, + + isOverlapping: function(start, size) { + return ((start < this.endPos()) && (this.startPos < start + size)) || (this.endPos() == 0) + }, + + isInRange: function(position) { + return (position >= this.startPos) && (position + this.metaData.getPageSize() <= this.endPos()); + //&& this.size() != 0; + }, + + isNearingTopLimit: function(position) { + return position - this.startPos < this.metaData.getLimitTolerance(); + }, + + endPos: function() { + return this.startPos + this.rows.length; + }, + + isNearingBottomLimit: function(position) { + return this.endPos() - (position + this.metaData.getPageSize()) < this.metaData.getLimitTolerance(); + }, + + isAtTop: function() { + return this.startPos == 0; + }, + + isAtBottom: function() { + return this.endPos() == this.metaData.getTotalRows(); + }, + + isNearingLimit: function(position) { + return ( !this.isAtTop() && this.isNearingTopLimit(position)) || + ( !this.isAtBottom() && this.isNearingBottomLimit(position) ) + }, + + getFetchSize: function(offset) { + var adjustedOffset = this.getFetchOffset(offset); + var adjustedSize = 0; + if (adjustedOffset >= this.startPos) { //apending + var endFetchOffset = this.maxFetchSize + adjustedOffset; + if (endFetchOffset > this.metaData.totalRows) + endFetchOffset = this.metaData.totalRows; + adjustedSize = endFetchOffset - adjustedOffset; + } else {//prepending + var adjustedSize = this.startPos - adjustedOffset; + if (adjustedSize > this.maxFetchSize) + adjustedSize = this.maxFetchSize; + } + return adjustedSize; + }, + + getFetchOffset: function(offset) { + var adjustedOffset = offset; + if (offset > this.startPos) //apending + adjustedOffset = (offset > this.endPos()) ? offset : this.endPos(); + else { //prepending + if (offset + this.maxFetchSize >= this.startPos) { + var adjustedOffset = this.startPos - this.maxFetchSize; + if (adjustedOffset < 0) + adjustedOffset = 0; + } + } + this.lastOffset = adjustedOffset; + return adjustedOffset; + }, + + getRows: function(start, count) { + var begPos = start - this.startPos + var endPos = begPos + count + + // er? need more data... + if ( endPos > this.size ) + endPos = this.size + + var results = new Array() + var index = 0; + for ( var i=begPos ; i < endPos; i++ ) { + results[index++] = this.rows[i] + } + return results + }, + + convertSpaces: function(s) { + return s.split(" ").join(" "); + } + +}; + + +//Rico.GridViewPort -------------------------------------------------- +Rico.GridViewPort = Class.create(); + +Rico.GridViewPort.prototype = { + + initialize: function(table, rowHeight, visibleRows, buffer, liveGrid) { + this.lastDisplayedStartPos = 0; + this.div = table.parentNode; + this.table = table + this.rowHeight = rowHeight; + this.div.style.height = this.rowHeight * visibleRows; + this.div.style.overflow = "hidden"; + this.buffer = buffer; + this.liveGrid = liveGrid; + this.visibleRows = visibleRows + 1; + this.lastPixelOffset = 0; + this.startPos = 0; + }, + + populateRow: function(htmlRow, row) { + for (var j=0; j < row.length; j++) { + htmlRow.cells[j].innerHTML = row[j] + } + }, + + bufferChanged: function() { + this.refreshContents( parseInt(this.lastPixelOffset / this.rowHeight)); + }, + + clearRows: function() { + if (!this.isBlank) { + for (var i=0; i < this.visibleRows; i++) + this.populateRow(this.table.rows[i], this.buffer.getBlankRow()); + this.isBlank = true; + } + }, + + clearContents: function() { + this.clearRows(); + this.scrollTo(0); + this.startPos = 0; + this.lastStartPos = -1; + }, + + refreshContents: function(startPos) { + if (startPos == this.lastRowPos && !this.isPartialBlank && !this.isBlank) { + return; + } + if ((startPos + this.visibleRows < this.buffer.startPos) + || (this.buffer.startPos + this.buffer.size < startPos) + || (this.buffer.size == 0)) { + this.clearRows(); + return; + } + this.isBlank = false; + var viewPrecedesBuffer = this.buffer.startPos > startPos + var contentStartPos = viewPrecedesBuffer ? this.buffer.startPos: startPos; + + var contentEndPos = (this.buffer.startPos + this.buffer.size < startPos + this.visibleRows) + ? this.buffer.startPos + this.buffer.size + : startPos + this.visibleRows; + var rowSize = contentEndPos - contentStartPos; + var rows = this.buffer.getRows(contentStartPos, rowSize ); + var blankSize = this.visibleRows - rowSize; + var blankOffset = viewPrecedesBuffer ? 0: rowSize; + var contentOffset = viewPrecedesBuffer ? blankSize: 0; + + for (var i=0; i < rows.length; i++) {//initialize what we have + this.populateRow(this.table.rows[i + contentOffset], rows[i]); + } + for (var i=0; i < blankSize; i++) {// blank out the rest + this.populateRow(this.table.rows[i + blankOffset], this.buffer.getBlankRow()); + } + this.isPartialBlank = blankSize > 0; + this.lastRowPos = startPos; + }, + + scrollTo: function(pixelOffset) { + if (this.lastPixelOffset == pixelOffset) + return; + + this.refreshContents(parseInt(pixelOffset / this.rowHeight)) + this.div.scrollTop = pixelOffset % this.rowHeight + + this.lastPixelOffset = pixelOffset; + }, + + visibleHeight: function() { + return parseInt(this.div.style.height); + } + +}; + + +Rico.LiveGridRequest = Class.create(); +Rico.LiveGridRequest.prototype = { + initialize: function( requestOffset, options ) { + this.requestOffset = requestOffset; + } +}; + +// Rico.LiveGrid ----------------------------------------------------- + +Rico.LiveGrid = Class.create(); + +Rico.LiveGrid.prototype = { + + initialize: function( tableId, visibleRows, totalRows, url, options ) { + if ( options == null ) + options = {}; + + this.tableId = tableId; + this.table = $(tableId); + var columnCount = this.table.rows[0].cells.length + this.metaData = new Rico.LiveGridMetaData(visibleRows, totalRows, columnCount, options); + this.buffer = new Rico.LiveGridBuffer(this.metaData); + + var rowCount = this.table.rows.length; + this.viewPort = new Rico.GridViewPort(this.table, + this.table.offsetHeight/rowCount, + visibleRows, + this.buffer, this); + this.scroller = new Rico.LiveGridScroller(this,this.viewPort); + + this.additionalParms = options.requestParameters || []; + + options.sortHandler = this.sortHandler.bind(this); + + if ( $(tableId + '_header') ) + this.sort = new Rico.LiveGridSort(tableId + '_header', options) + + this.processingRequest = null; + this.unprocessedRequest = null; + + this.initAjax(url); + if ( options.prefetchBuffer || options.prefetchOffset > 0) { + var offset = 0; + if (options.offset ) { + offset = options.offset; + this.scroller.moveScroll(offset); + this.viewPort.scrollTo(this.scroller.rowToPixel(offset)); + } + if (options.sortCol) { + this.sortCol = options.sortCol; + this.sortDir = options.sortDir; + } + this.requestContentRefresh(offset); + } + }, + + resetContents: function() { + this.scroller.moveScroll(0); + this.buffer.clear(); + this.viewPort.clearContents(); + }, + + sortHandler: function(column) { + this.sortCol = column.name; + this.sortDir = column.currentSort; + + this.resetContents(); + this.requestContentRefresh(0) + }, + + setRequestParams: function() { + this.additionalParms = []; + for ( var i=0 ; i < arguments.length ; i++ ) + this.additionalParms[i] = arguments[i]; + }, + + setTotalRows: function( newTotalRows ) { + this.resetContents(); + this.metaData.setTotalRows(newTotalRows); + this.scroller.updateSize(); + }, + + initAjax: function(url) { + ajaxEngine.registerRequest( this.tableId + '_request', url ); + ajaxEngine.registerAjaxObject( this.tableId + '_updater', this ); + }, + + invokeAjax: function() { + }, + + handleTimedOut: function() { + //server did not respond in 4 seconds... assume that there could have been + //an error or something, and allow requests to be processed again... + this.processingRequest = null; + this.processQueuedRequest(); + }, + + fetchBuffer: function(offset) { + if ( this.buffer.isInRange(offset) && + !this.buffer.isNearingLimit(offset)) { + return; + } + if (this.processingRequest) { + this.unprocessedRequest = new Rico.LiveGridRequest(offset); + return; + } + var bufferStartPos = this.buffer.getFetchOffset(offset); + this.processingRequest = new Rico.LiveGridRequest(offset); + this.processingRequest.bufferOffset = bufferStartPos; + var fetchSize = this.buffer.getFetchSize(offset); + var partialLoaded = false; + var callParms = []; + callParms.push(this.tableId + '_request'); + callParms.push('id=' + this.tableId); + callParms.push('page_size=' + fetchSize); + callParms.push('offset=' + bufferStartPos); + if ( this.sortCol) { + callParms.push('sort_col=' + this.sortCol); + callParms.push('sort_dir=' + this.sortDir); + } + + for( var i=0 ; i < this.additionalParms.length ; i++ ) + callParms.push(this.additionalParms[i]); + ajaxEngine.sendRequest.apply( ajaxEngine, callParms ); + + this.timeoutHandler = setTimeout( this.handleTimedOut.bind(this), 20000 ); //todo: make as option + }, + + requestContentRefresh: function(contentOffset) { + this.fetchBuffer(contentOffset); + }, + + ajaxUpdate: function(ajaxResponse) { + try { + clearTimeout( this.timeoutHandler ); + this.buffer.update(ajaxResponse,this.processingRequest.bufferOffset); + this.viewPort.bufferChanged(); + } + catch(err) {} + finally {this.processingRequest = null; } + this.processQueuedRequest(); + }, + + processQueuedRequest: function() { + if (this.unprocessedRequest != null) { + this.requestContentRefresh(this.unprocessedRequest.requestOffset); + this.unprocessedRequest = null + } + } + +}; + + +//-------------------- ricoLiveGridSort.js +Rico.LiveGridSort = Class.create(); + +Rico.LiveGridSort.prototype = { + + initialize: function(headerTableId, options) { + this.headerTableId = headerTableId; + this.headerTable = $(headerTableId); + this.setOptions(options); + this.applySortBehavior(); + + if ( this.options.sortCol ) { + this.setSortUI( this.options.sortCol, this.options.sortDir ); + } + }, + + setSortUI: function( columnName, sortDirection ) { + var cols = this.options.columns; + for ( var i = 0 ; i < cols.length ; i++ ) { + if ( cols[i].name == columnName ) { + this.setColumnSort(i, sortDirection); + break; + } + } + }, + + setOptions: function(options) { + this.options = { + sortAscendImg: 'images/sort_asc.gif', + sortDescendImg: 'images/sort_desc.gif', + imageWidth: 9, + imageHeight: 5, + ajaxSortURLParms: [] + }.extend(options); + + // preload the images... + new Image().src = this.options.sortAscendImg; + new Image().src = this.options.sortDescendImg; + + this.sort = options.sortHandler; + if ( !this.options.columns ) + this.options.columns = this.introspectForColumnInfo(); + else { + // allow client to pass { columns: [ ["a", true], ["b", false] ] } + // and convert to an array of Rico.TableColumn objs... + this.options.columns = this.convertToTableColumns(this.options.columns); + } + }, + + applySortBehavior: function() { + var headerRow = this.headerTable.rows[0]; + var headerCells = headerRow.cells; + for ( var i = 0 ; i < headerCells.length ; i++ ) { + this.addSortBehaviorToColumn( i, headerCells[i] ); + } + }, + + addSortBehaviorToColumn: function( n, cell ) { + if ( this.options.columns[n].isSortable() ) { + cell.id = this.headerTableId + '_' + n; + cell.style.cursor = 'pointer'; + cell.onclick = this.headerCellClicked.bindAsEventListener(this); + cell.innerHTML = cell.innerHTML + '' + + '   '; + } + }, + + // event handler.... + headerCellClicked: function(evt) { + var eventTarget = evt.target ? evt.target : evt.srcElement; + var cellId = eventTarget.id; + var columnNumber = parseInt(cellId.substring( cellId.lastIndexOf('_') + 1 )); + var sortedColumnIndex = this.getSortedColumnIndex(); + if ( sortedColumnIndex != -1 ) { + if ( sortedColumnIndex != columnNumber ) { + this.removeColumnSort(sortedColumnIndex); + this.setColumnSort(columnNumber, Rico.TableColumn.SORT_ASC); + } + else + this.toggleColumnSort(sortedColumnIndex); + } + else + this.setColumnSort(columnNumber, Rico.TableColumn.SORT_ASC); + + if (this.options.sortHandler) { + this.options.sortHandler(this.options.columns[columnNumber]); + } + }, + + removeColumnSort: function(n) { + this.options.columns[n].setUnsorted(); + this.setSortImage(n); + }, + + setColumnSort: function(n, direction) { + this.options.columns[n].setSorted(direction); + this.setSortImage(n); + }, + + toggleColumnSort: function(n) { + this.options.columns[n].toggleSort(); + this.setSortImage(n); + }, + + setSortImage: function(n) { + var sortDirection = this.options.columns[n].getSortDirection(); + + var sortImageSpan = $( this.headerTableId + '_img_' + n ); + if ( sortDirection == Rico.TableColumn.UNSORTED ) + sortImageSpan.innerHTML = '  '; + else if ( sortDirection == Rico.TableColumn.SORT_ASC ) + sortImageSpan.innerHTML = '  '; + else if ( sortDirection == Rico.TableColumn.SORT_DESC ) + sortImageSpan.innerHTML = '  '; + }, + + getSortedColumnIndex: function() { + var cols = this.options.columns; + for ( var i = 0 ; i < cols.length ; i++ ) { + if ( cols[i].isSorted() ) + return i; + } + + return -1; + }, + + introspectForColumnInfo: function() { + var columns = new Array(); + var headerRow = this.headerTable.rows[0]; + var headerCells = headerRow.cells; + for ( var i = 0 ; i < headerCells.length ; i++ ) + columns.push( new Rico.TableColumn( this.deriveColumnNameFromCell(headerCells[i],i), true ) ); + return columns; + }, + + convertToTableColumns: function(cols) { + var columns = new Array(); + for ( var i = 0 ; i < cols.length ; i++ ) + columns.push( new Rico.TableColumn( cols[i][0], cols[i][1] ) ); + }, + + deriveColumnNameFromCell: function(cell,columnNumber) { + var cellContent = cell.innerText != undefined ? cell.innerText : cell.textContent; + return cellContent ? cellContent.toLowerCase().split(' ').join('_') : "col_" + columnNumber; + } +}; + +Rico.TableColumn = Class.create(); + +Rico.TableColumn.UNSORTED = 0; +Rico.TableColumn.SORT_ASC = "ASC"; +Rico.TableColumn.SORT_DESC = "DESC"; + +Rico.TableColumn.prototype = { + initialize: function(name, sortable) { + this.name = name; + this.sortable = sortable; + this.currentSort = Rico.TableColumn.UNSORTED; + }, + + isSortable: function() { + return this.sortable; + }, + + isSorted: function() { + return this.currentSort != Rico.TableColumn.UNSORTED; + }, + + getSortDirection: function() { + return this.currentSort; + }, + + toggleSort: function() { + if ( this.currentSort == Rico.TableColumn.UNSORTED || this.currentSort == Rico.TableColumn.SORT_DESC ) + this.currentSort = Rico.TableColumn.SORT_ASC; + else if ( this.currentSort == Rico.TableColumn.SORT_ASC ) + this.currentSort = Rico.TableColumn.SORT_DESC; + }, + + setUnsorted: function(direction) { + this.setSorted(Rico.TableColumn.UNSORTED); + }, + + setSorted: function(direction) { + // direction must by one of Rico.TableColumn.UNSORTED, .SORT_ASC, or .SET_DESC... + this.currentSort = direction; + } + +}; + + +//-------------------- ricoUtil.js + +var RicoUtil = { + + getElementsComputedStyle: function ( htmlElement, cssProperty, mozillaEquivalentCSS) { + if ( arguments.length == 2 ) + mozillaEquivalentCSS = cssProperty; + + var el = $(htmlElement); + if ( el.currentStyle ) + return el.currentStyle[cssProperty]; + else + return document.defaultView.getComputedStyle(el, null).getPropertyValue(mozillaEquivalentCSS); + }, + + createXmlDocument : function() { + if (document.implementation && document.implementation.createDocument) { + var doc = document.implementation.createDocument("", "", null); + + if (doc.readyState == null) { + doc.readyState = 1; + doc.addEventListener("load", function () { + doc.readyState = 4; + if (typeof doc.onreadystatechange == "function") + doc.onreadystatechange(); + }, false); + } + + return doc; + } + + if (window.ActiveXObject) + return Try.these( + function() { return new ActiveXObject('MSXML2.DomDocument') }, + function() { return new ActiveXObject('Microsoft.DomDocument')}, + function() { return new ActiveXObject('MSXML.DomDocument') }, + function() { return new ActiveXObject('MSXML3.DomDocument') } + ) || false; + + return null; + }, + + getContentAsString: function( parentNode ) { + return parentNode.xml != undefined ? + this._getContentAsStringIE(parentNode) : + this._getContentAsStringMozilla(parentNode); + }, + + _getContentAsStringIE: function(parentNode) { + var contentStr = ""; + for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) + contentStr += parentNode.childNodes[i].xml; + return contentStr; + }, + + _getContentAsStringMozilla: function(parentNode) { + var xmlSerializer = new XMLSerializer(); + var contentStr = ""; + for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) + contentStr += xmlSerializer.serializeToString(parentNode.childNodes[i]); + return contentStr; + }, + + toViewportPosition: function(element) { + return this._toAbsolute(element,true); + }, + + toDocumentPosition: function(element) { + return this._toAbsolute(element,false); + }, + + /** + * Compute the elements position in terms of the window viewport + * so that it can be compared to the position of the mouse (dnd) + * This is additions of all the offsetTop,offsetLeft values up the + * offsetParent hierarchy, ...taking into account any scrollTop, + * scrollLeft values along the way... + * + * IE has a bug reporting a correct offsetLeft of elements within a + * a relatively positioned parent!!! + **/ + _toAbsolute: function(element,accountForDocScroll) { + + if ( navigator.userAgent.toLowerCase().indexOf("msie") == -1 ) + return this._toAbsoluteMozilla(element,accountForDocScroll); + + var x = 0; + var y = 0; + var parent = element; + while ( parent ) { + + var borderXOffset = 0; + var borderYOffset = 0; + if ( parent != element ) { + var borderXOffset = parseInt(this.getElementsComputedStyle(parent, "borderLeftWidth" )); + var borderYOffset = parseInt(this.getElementsComputedStyle(parent, "borderTopWidth" )); + borderXOffset = isNaN(borderXOffset) ? 0 : borderXOffset; + borderYOffset = isNaN(borderYOffset) ? 0 : borderYOffset; + } + + x += parent.offsetLeft - parent.scrollLeft + borderXOffset; + y += parent.offsetTop - parent.scrollTop + borderYOffset; + parent = parent.offsetParent; + } + + if ( accountForDocScroll ) { + x -= this.docScrollLeft(); + y -= this.docScrollTop(); + } + + return { x:x, y:y }; + }, + + /** + * Mozilla did not report all of the parents up the hierarchy via the + * offsetParent property that IE did. So for the calculation of the + * offsets we use the offsetParent property, but for the calculation of + * the scrollTop/scrollLeft adjustments we navigate up via the parentNode + * property instead so as to get the scroll offsets... + * + **/ + _toAbsoluteMozilla: function(element,accountForDocScroll) { + var x = 0; + var y = 0; + var parent = element; + while ( parent ) { + x += parent.offsetLeft; + y += parent.offsetTop; + parent = parent.offsetParent; + } + + parent = element; + while ( parent && + parent != document.body && + parent != document.documentElement ) { + if ( parent.scrollLeft ) + x -= parent.scrollLeft; + if ( parent.scrollTop ) + y -= parent.scrollTop; + parent = parent.parentNode; + } + + if ( accountForDocScroll ) { + x -= this.docScrollLeft(); + y -= this.docScrollTop(); + } + + return { x:x, y:y }; + }, + + docScrollLeft: function() { + if ( window.pageXOffset ) + return window.pageXOffset; + else if ( document.documentElement && document.documentElement.scrollLeft ) + return document.documentElement.scrollLeft; + else if ( document.body ) + return document.body.scrollLeft; + else + return 0; + }, + + docScrollTop: function() { + if ( window.pageYOffset ) + return window.pageYOffset; + else if ( document.documentElement && document.documentElement.scrollTop ) + return document.documentElement.scrollTop; + else if ( document.body ) + return document.body.scrollTop; + else + return 0; + } + +}; diff --git a/projekte/MDB/web-app/js/prototype/scriptaculous.js b/projekte/MDB/web-app/js/prototype/scriptaculous.js new file mode 100644 index 0000000..f61fc57 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/scriptaculous.js @@ -0,0 +1,47 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +var Scriptaculous = { + Version: '1.6.1', + require: function(libraryName) { + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write(''); + }, + load: function() { + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || + (typeof Element.Methods=='undefined') || + parseFloat(Prototype.Version.split(".")[0] + "." + + Prototype.Version.split(".")[1]) < 1.5) + throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); + + $A(document.getElementsByTagName("script")).findAll( function(s) { + return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) + }).each( function(s) { + var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); + var includes = s.src.match(/\?.*load=([a-z,]*)/); + (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each( + function(include) { Scriptaculous.require(path+include+'.js') }); + }); + } +} + +Scriptaculous.load(); \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/slider.js b/projekte/MDB/web-app/js/prototype/slider.js new file mode 100644 index 0000000..c0f1fc0 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/slider.js @@ -0,0 +1,283 @@ +// Copyright (c) 2005 Marty Haught, Thomas Fuchs +// +// See http://script.aculo.us for more info +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if(!Control) var Control = {}; +Control.Slider = Class.create(); + +// options: +// axis: 'vertical', or 'horizontal' (default) +// +// callbacks: +// onChange(value) +// onSlide(value) +Control.Slider.prototype = { + initialize: function(handle, track, options) { + var slider = this; + + if(handle instanceof Array) { + this.handles = handle.collect( function(e) { return $(e) }); + } else { + this.handles = [$(handle)]; + } + + this.track = $(track); + this.options = options || {}; + + this.axis = this.options.axis || 'horizontal'; + this.increment = this.options.increment || 1; + this.step = parseInt(this.options.step || '1'); + this.range = this.options.range || $R(0,1); + + this.value = 0; // assure backwards compat + this.values = this.handles.map( function() { return 0 }); + this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; + this.options.startSpan = $(this.options.startSpan || null); + this.options.endSpan = $(this.options.endSpan || null); + + this.restricted = this.options.restricted || false; + + this.maximum = this.options.maximum || this.range.end; + this.minimum = this.options.minimum || this.range.start; + + // Will be used to align the handle onto the track, if necessary + this.alignX = parseInt(this.options.alignX || '0'); + this.alignY = parseInt(this.options.alignY || '0'); + + this.trackLength = this.maximumOffset() - this.minimumOffset(); + this.handleLength = this.isVertical() ? this.handles[0].offsetHeight : this.handles[0].offsetWidth; + + this.active = false; + this.dragging = false; + this.disabled = false; + + if(this.options.disabled) this.setDisabled(); + + // Allowed values array + this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; + if(this.allowedValues) { + this.minimum = this.allowedValues.min(); + this.maximum = this.allowedValues.max(); + } + + this.eventMouseDown = this.startDrag.bindAsEventListener(this); + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.update.bindAsEventListener(this); + + // Initialize handles in reverse (make sure first handle is active) + this.handles.each( function(h,i) { + i = slider.handles.length-1-i; + slider.setValue(parseFloat( + (slider.options.sliderValue instanceof Array ? + slider.options.sliderValue[i] : slider.options.sliderValue) || + slider.range.start), i); + Element.makePositioned(h); // fix IE + Event.observe(h, "mousedown", slider.eventMouseDown); + }); + + Event.observe(this.track, "mousedown", this.eventMouseDown); + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + + this.initialized = true; + }, + dispose: function() { + var slider = this; + Event.stopObserving(this.track, "mousedown", this.eventMouseDown); + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + this.handles.each( function(h) { + Event.stopObserving(h, "mousedown", slider.eventMouseDown); + }); + }, + setDisabled: function(){ + this.disabled = true; + }, + setEnabled: function(){ + this.disabled = false; + }, + getNearestValue: function(value){ + if(this.allowedValues){ + if(value >= this.allowedValues.max()) return(this.allowedValues.max()); + if(value <= this.allowedValues.min()) return(this.allowedValues.min()); + + var offset = Math.abs(this.allowedValues[0] - value); + var newValue = this.allowedValues[0]; + this.allowedValues.each( function(v) { + var currentOffset = Math.abs(v - value); + if(currentOffset <= offset){ + newValue = v; + offset = currentOffset; + } + }); + return newValue; + } + if(value > this.range.end) return this.range.end; + if(value < this.range.start) return this.range.start; + return value; + }, + setValue: function(sliderValue, handleIdx){ + if(!this.active) { + this.activeHandle = this.handles[handleIdx]; + this.activeHandleIdx = handleIdx; + this.updateStyles(); + } + handleIdx = handleIdx || this.activeHandleIdx || 0; + if(this.initialized && this.restricted) { + if((handleIdx>0) && (sliderValuethis.values[handleIdx+1])) + sliderValue = this.values[handleIdx+1]; + } + sliderValue = this.getNearestValue(sliderValue); + this.values[handleIdx] = sliderValue; + this.value = this.values[0]; // assure backwards compat + + this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = + this.translateToPx(sliderValue); + + this.drawSpans(); + if(!this.dragging || !this.event) this.updateFinished(); + }, + setValueBy: function(delta, handleIdx) { + this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, + handleIdx || this.activeHandleIdx || 0); + }, + translateToPx: function(value) { + return Math.round( + ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * + (value - this.range.start)) + "px"; + }, + translateToValue: function(offset) { + return ((offset/(this.trackLength-this.handleLength) * + (this.range.end-this.range.start)) + this.range.start); + }, + getRange: function(range) { + var v = this.values.sortBy(Prototype.K); + range = range || 0; + return $R(v[range],v[range+1]); + }, + minimumOffset: function(){ + return(this.isVertical() ? this.alignY : this.alignX); + }, + maximumOffset: function(){ + return(this.isVertical() ? + this.track.offsetHeight - this.alignY : this.track.offsetWidth - this.alignX); + }, + isVertical: function(){ + return (this.axis == 'vertical'); + }, + drawSpans: function() { + var slider = this; + if(this.spans) + $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); + if(this.options.startSpan) + this.setSpan(this.options.startSpan, + $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); + if(this.options.endSpan) + this.setSpan(this.options.endSpan, + $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); + }, + setSpan: function(span, range) { + if(this.isVertical()) { + span.style.top = this.translateToPx(range.start); + span.style.height = this.translateToPx(range.end - range.start + this.range.start); + } else { + span.style.left = this.translateToPx(range.start); + span.style.width = this.translateToPx(range.end - range.start + this.range.start); + } + }, + updateStyles: function() { + this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); + Element.addClassName(this.activeHandle, 'selected'); + }, + startDrag: function(event) { + if(Event.isLeftClick(event)) { + if(!this.disabled){ + this.active = true; + + var handle = Event.element(event); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + if(handle==this.track) { + var offsets = Position.cumulativeOffset(this.track); + this.event = event; + this.setValue(this.translateToValue( + (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) + )); + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } else { + // find the handle (prevents issues with Safari) + while((this.handles.indexOf(handle) == -1) && handle.parentNode) + handle = handle.parentNode; + + this.activeHandle = handle; + this.activeHandleIdx = this.handles.indexOf(this.activeHandle); + this.updateStyles(); + + var offsets = Position.cumulativeOffset(this.activeHandle); + this.offsetX = (pointer[0] - offsets[0]); + this.offsetY = (pointer[1] - offsets[1]); + } + } + Event.stop(event); + } + }, + update: function(event) { + if(this.active) { + if(!this.dragging) this.dragging = true; + this.draw(event); + // fix AppleWebKit rendering + if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); + Event.stop(event); + } + }, + draw: function(event) { + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var offsets = Position.cumulativeOffset(this.track); + pointer[0] -= this.offsetX + offsets[0]; + pointer[1] -= this.offsetY + offsets[1]; + this.event = event; + this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); + if(this.initialized && this.options.onSlide) + this.options.onSlide(this.values.length>1 ? this.values : this.value, this); + }, + endDrag: function(event) { + if(this.active && this.dragging) { + this.finishDrag(event, true); + Event.stop(event); + } + this.active = false; + this.dragging = false; + }, + finishDrag: function(event, success) { + this.active = false; + this.dragging = false; + this.updateFinished(); + }, + updateFinished: function() { + if(this.initialized && this.options.onChange) + this.options.onChange(this.values.length>1 ? this.values : this.value, this); + this.event = null; + } +} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/prototype/unittest.js b/projekte/MDB/web-app/js/prototype/unittest.js new file mode 100644 index 0000000..d2c2d81 --- /dev/null +++ b/projekte/MDB/web-app/js/prototype/unittest.js @@ -0,0 +1,383 @@ +// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005 Jon Tirsen (http://www.tirsen.com) +// (c) 2005 Michael Schuerig (http://www.schuerig.de/michael/) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +// experimental, Firefox-only +Event.simulateMouse = function(element, eventName) { + var options = Object.extend({ + pointerX: 0, + pointerY: 0, + buttons: 0 + }, arguments[2] || {}); + var oEvent = document.createEvent("MouseEvents"); + oEvent.initMouseEvent(eventName, true, true, document.defaultView, + options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, + false, false, false, false, 0, $(element)); + + if(this.mark) Element.remove(this.mark); + this.mark = document.createElement('div'); + this.mark.appendChild(document.createTextNode(" ")); + document.body.appendChild(this.mark); + this.mark.style.position = 'absolute'; + this.mark.style.top = options.pointerY + "px"; + this.mark.style.left = options.pointerX + "px"; + this.mark.style.width = "5px"; + this.mark.style.height = "5px;"; + this.mark.style.borderTop = "1px solid red;" + this.mark.style.borderLeft = "1px solid red;" + + if(this.step) + alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); + + $(element).dispatchEvent(oEvent); +}; + +// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2. +// You need to downgrade to 1.0.4 for now to get this working +// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much +Event.simulateKey = function(element, eventName) { + var options = Object.extend({ + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false, + keyCode: 0, + charCode: 0 + }, arguments[2] || {}); + + var oEvent = document.createEvent("KeyEvents"); + oEvent.initKeyEvent(eventName, true, true, window, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.keyCode, options.charCode ); + $(element).dispatchEvent(oEvent); +}; + +Event.simulateKeys = function(element, command) { + for(var i=0; i' + + '' + + '' + + '' + + '
    StatusTestMessage
    '; + this.logsummary = $('logsummary') + this.loglines = $('loglines'); + }, + _toHTML: function(txt) { + return txt.escapeHTML().replace(/\n/g,"
    "); + } +} + +Test.Unit.Runner = Class.create(); +Test.Unit.Runner.prototype = { + initialize: function(testcases) { + this.options = Object.extend({ + testLog: 'testlog' + }, arguments[1] || {}); + this.options.resultsURL = this.parseResultsURLQueryParameter(); + if (this.options.testLog) { + this.options.testLog = $(this.options.testLog) || null; + } + if(this.options.tests) { + this.tests = []; + for(var i = 0; i < this.options.tests.length; i++) { + if(/^test/.test(this.options.tests[i])) { + this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"])); + } + } + } else { + if (this.options.test) { + this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])]; + } else { + this.tests = []; + for(var testcase in testcases) { + if(/^test/.test(testcase)) { + this.tests.push(new Test.Unit.Testcase(testcase, testcases[testcase], testcases["setup"], testcases["teardown"])); + } + } + } + } + this.currentTest = 0; + this.logger = new Test.Unit.Logger(this.options.testLog); + setTimeout(this.runTests.bind(this), 1000); + }, + parseResultsURLQueryParameter: function() { + return window.location.search.parseQuery()["resultsURL"]; + }, + // Returns: + // "ERROR" if there was an error, + // "FAILURE" if there was a failure, or + // "SUCCESS" if there was neither + getResult: function() { + var hasFailure = false; + for(var i=0;i 0) { + return "ERROR"; + } + if (this.tests[i].failures > 0) { + hasFailure = true; + } + } + if (hasFailure) { + return "FAILURE"; + } else { + return "SUCCESS"; + } + }, + postResults: function() { + if (this.options.resultsURL) { + new Ajax.Request(this.options.resultsURL, + { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); + } + }, + runTests: function() { + var test = this.tests[this.currentTest]; + if (!test) { + // finished! + this.postResults(); + this.logger.summary(this.summary()); + return; + } + if(!test.isWaiting) { + this.logger.start(test.name); + } + test.run(); + if(test.isWaiting) { + this.logger.message("Waiting for " + test.timeToWait + "ms"); + setTimeout(this.runTests.bind(this), test.timeToWait || 1000); + } else { + this.logger.finish(test.status(), test.summary()); + this.currentTest++; + // tail recursive, hopefully the browser will skip the stackframe + this.runTests(); + } + }, + summary: function() { + var assertions = 0; + var failures = 0; + var errors = 0; + var messages = []; + for(var i=0;i 0) return 'failed'; + if (this.errors > 0) return 'error'; + return 'passed'; + }, + assert: function(expression) { + var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; + try { expression ? this.pass() : + this.fail(message); } + catch(e) { this.error(e); } + }, + assertEqual: function(expected, actual) { + var message = arguments[2] || "assertEqual"; + try { (expected == actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertEnumEqual: function(expected, actual) { + var message = arguments[2] || "assertEnumEqual"; + try { $A(expected).length == $A(actual).length && + expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? + this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + + ', actual ' + Test.Unit.inspect(actual)); } + catch(e) { this.error(e); } + }, + assertNotEqual: function(expected, actual) { + var message = arguments[2] || "assertNotEqual"; + try { (expected != actual) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } + }, + assertNull: function(obj) { + var message = arguments[1] || 'assertNull' + try { (obj==null) ? this.pass() : + this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } + catch(e) { this.error(e); } + }, + assertHidden: function(element) { + var message = arguments[1] || 'assertHidden'; + this.assertEqual("none", element.style.display, message); + }, + assertNotNull: function(object) { + var message = arguments[1] || 'assertNotNull'; + this.assert(object != null, message); + }, + assertInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertInstanceOf'; + try { + (actual instanceof expected) ? this.pass() : + this.fail(message + ": object was not an instance of the expected type"); } + catch(e) { this.error(e); } + }, + assertNotInstanceOf: function(expected, actual) { + var message = arguments[2] || 'assertNotInstanceOf'; + try { + !(actual instanceof expected) ? this.pass() : + this.fail(message + ": object was an instance of the not expected type"); } + catch(e) { this.error(e); } + }, + _isVisible: function(element) { + element = $(element); + if(!element.parentNode) return true; + this.assertNotNull(element); + if(element.style && Element.getStyle(element, 'display') == 'none') + return false; + + return this._isVisible(element.parentNode); + }, + assertNotVisible: function(element) { + this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1])); + }, + assertVisible: function(element) { + this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1])); + }, + benchmark: function(operation, iterations) { + var startAt = new Date(); + (iterations || 1).times(operation); + var timeTaken = ((new Date())-startAt); + this.info((arguments[2] || 'Operation') + ' finished ' + + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); + return timeTaken; + } +} + +Test.Unit.Testcase = Class.create(); +Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), { + initialize: function(name, test, setup, teardown) { + Test.Unit.Assertions.prototype.initialize.bind(this)(); + this.name = name; + this.test = test || function() {}; + this.setup = setup || function() {}; + this.teardown = teardown || function() {}; + this.isWaiting = false; + this.timeToWait = 1000; + }, + wait: function(time, nextPart) { + this.isWaiting = true; + this.test = nextPart; + this.timeToWait = time; + }, + run: function() { + try { + try { + if (!this.isWaiting) this.setup.bind(this)(); + this.isWaiting = false; + this.test.bind(this)(); + } finally { + if(!this.isWaiting) { + this.teardown.bind(this)(); + } + } + } + catch(e) { this.error(e); } + } +}); diff --git a/projekte/MDB/web-app/js/yahoo/animation-min.js b/projekte/MDB/web-app/js/yahoo/animation-min.js new file mode 100644 index 0000000..c35c2a5 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/animation-min.js @@ -0,0 +1,7 @@ +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 0.10.0 +*/ +YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={doMethod:function(attribute,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attribute,val,unit){YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);},getAttribute:function(attribute){return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));},defaultUnit:'px',defaultUnits:{opacity:' '},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var endTime=null;var actualFrames=0;var defaultValues={};el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.setDefault=function(attribute,val){if(val.constructor!=Array&&(val=='auto'||isNaN(val))){switch(attribute){case'width':val=el.clientWidth||el.offsetWidth;break;case'height':val=el.clientHeight||el.offsetHeight;break;case'left':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetLeft;}else{val=0;}break;case'top':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetTop;}else{val=0;}break;default:val=0;}}defaultValues[attribute]=val;};this.getDefault=function(attribute){return defaultValues[attribute];};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.animate=function(){if(this.isAnimated()){return false;}this.onStart.fire();this._onStart.fire();this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);var attributes=this.attributes;var el=this.getEl();var val;for(var attribute in attributes){val=this.getAttribute(attribute);this.setDefault(attribute,val);}isAnimated=true;actualFrames=0;startTime=new Date();};this.stop=function(){if(!this.isAnimated()){return false;}this.currentFrame=0;endTime=new Date();var data={time:endTime,duration:endTime-startTime,frames:actualFrames,fps:actualFrames/this.duration};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};var onTween=function(){var start;var end=null;var val;var unit;var attributes=this['attributes'];for(var attribute in attributes){unit=attributes[attribute]['unit']||this.defaultUnits[attribute]||this.defaultUnit;if(typeof attributes[attribute]['from']!='undefined'){start=attributes[attribute]['from'];}else{start=this.getDefault(attribute);}if(typeof attributes[attribute]['to']!='undefined'){end=attributes[attribute]['to'];}else if(typeof attributes[attribute]['by']!='undefined'){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&control[0].constructor!=Array){control=[control];}if(YAHOO.util.Dom.getStyle(this.getEl(),'position')=='static'){YAHOO.util.Dom.setStyle(this.getEl(),'position','relative');}if(typeof attributes['points']['from']!='undefined'){YAHOO.util.Dom.setXY(this.getEl(),attributes['points']['from']);start=this.getAttribute('points');}else if((start[0]===0||start[1]===0)){YAHOO.util.Dom.setXY(this.getEl(),YAHOO.util.Dom.getXY(this.getEl()));start=this.getAttribute('points');}var i,len;if(typeof attributes['points']['to']!='undefined'){end=translateValues(attributes['points']['to'],this);for(i=0,len=control.length;i0){translatedPoints=translatedPoints.concat(control);}translatedPoints[translatedPoints.length]=end;}};this._onStart.subscribe(onStart);};YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Anim.call(this,el,attributes,duration,method);}};YAHOO.util.Scroll.prototype=new YAHOO.util.Anim();YAHOO.util.Scroll.prototype.defaultUnits.scroll=' ';YAHOO.util.Scroll.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}return val;};YAHOO.util.Scroll.prototype.getAttribute=function(attribute){var val=null;var el=this.getEl();if(attribute=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=parseFloat(YAHOO.util.Dom.getStyle(el,attribute));}return val;};YAHOO.util.Scroll.prototype.setAttribute=function(attribute,val,unit){var el=this.getEl();if(attribute=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{YAHOO.util.Dom.setStyle(el,attribute,val+unit);}}; diff --git a/projekte/MDB/web-app/js/yahoo/assets/Thumbs.db b/projekte/MDB/web-app/js/yahoo/assets/Thumbs.db new file mode 100644 index 0000000..89f1c2f Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/Thumbs.db differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/alrt16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/alrt16_1.gif new file mode 100644 index 0000000..443d39b Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/alrt16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/blck16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/blck16_1.gif new file mode 100644 index 0000000..5668961 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/blck16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/calendar.css b/projekte/MDB/web-app/js/yahoo/assets/calendar.css new file mode 100644 index 0000000..b4433d3 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/assets/calendar.css @@ -0,0 +1,163 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ +/* Container Styles */ + +.calcontainer {*height:1%;} /* IE */ +.calcontainer:after {content:'.';clear:both;display:block;visibility:hidden;height:0;} /* others */ + +.calbordered { + float:left; + padding:5px; + background-color:#F7F9FB; + border:1px solid #7B9EBD; +} + +.calbordered .title { + font:73% Arial,Helvetica,sans-serif; + color:#000; + font-weight:bold; + margin-bottom:5px; + height:auto; + width:304px; + position:relative; +} + +.title .close-icon { + position:absolute; + right:0; + top:0; + border:none; +} + +.cal2up { + float:left; +} + +.calnavleft { + position:absolute; + top:0; + bottom:0; + height:12px; + left:2px; +} + +.calnavright { + position:absolute; + top:0; + bottom:0; + height:12px; + right:2px; +} + +/* Calendar element styles */ + +.calendar { + font:73% Arial,Helvetica,sans-serif; + text-align:center; + border-spacing:0; +} + +td.calcell { + width:1.5em; + height:1em; + border:1px solid #E0E0E0; + background-color:#FFF; +} + +.calendar.wait td.calcell { + color:#999; + background-color:#CCC; +} + +.calendar.wait td.calcell a { + color:#999; + font-style:italic; +} + +td.calcell a { + color:#003DB8; + text-decoration:none; +} + +td.calcell.today { + border:1px solid #000; +} + +td.calcell.oom { + cursor:default; + color:#999; + background-color:#EEE; + border:1px solid #E0E0E0; +} + +td.calcell.selected { + color:#003DB8; + background-color:#FFF19F; + border:1px solid #FF9900; +} + +td.calcell.calcellhover { + cursor:pointer; + color:#FFF; + background-color:#FF9900; + border:1px solid #FF9900; +} + +/* Added to perform some correction for Opera 8.5 + hover redraw bug */ +table:hover { + background-color:#FFF; +} + +td.calcell.calcellhover a { + color:#FFF; +} + +td.calcell.restricted { + text-decoration:line-through; +} + +td.calcell.previous { + color:#CCC; +} + +td.calcell.highlight1 { background-color:#CCFF99; } +td.calcell.highlight2 { background-color:#99CCFF; } +td.calcell.highlight3 { background-color:#FFCCCC; } +td.calcell.highlight4 { background-color:#CCFF99; } + + +.calhead { + border:1px solid #E0E0E0; + vertical-align:middle; + background-color:#FFF; +} + +.calheader { + position:relative; + width:100%; +} + +.calheader img { + border:none; +} + +.calweekdaycell { + color:#666; + font-weight:normal; +} + +.calfoot { + background-color:#EEE; +} + +.calrowhead, .calrowfoot { + color:#666; + font-size:9px; + font-style:italic; + font-weight:normal; + width:15px; +} + +.calrowhead { + border-right-width:2px; +} diff --git a/projekte/MDB/web-app/js/yahoo/assets/callt.gif b/projekte/MDB/web-app/js/yahoo/assets/callt.gif new file mode 100644 index 0000000..a6cc8da Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/callt.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/calrt.gif b/projekte/MDB/web-app/js/yahoo/assets/calrt.gif new file mode 100644 index 0000000..ee137b2 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/calrt.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/calx.gif b/projekte/MDB/web-app/js/yahoo/assets/calx.gif new file mode 100644 index 0000000..27e7bc3 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/calx.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/close12_1.gif b/projekte/MDB/web-app/js/yahoo/assets/close12_1.gif new file mode 100644 index 0000000..e2f67d7 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/close12_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/container.css b/projekte/MDB/web-app/js/yahoo/assets/container.css new file mode 100644 index 0000000..795e9a0 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/assets/container.css @@ -0,0 +1,206 @@ +.overlay { + position:absolute; + display:block; +} + +.tt { + visibility:hidden; + position:absolute; + color:#333; + background-color:#FDFFB4; + font-family:arial,helvetica,verdana,sans-serif; + padding:2px; + border:1px solid #FCC90D; + font:100% sans-serif; + width:auto; +} + +* html body.masked select { + visibility:hidden; +} + +* html div.panel-container select { + visibility:inherit; +} + +* html div.drag select { + visibility:hidden; +} + +* html div.hide-select select { + visibility:hidden; +} + +.mask { + z-index:0; + display:none; + position:absolute; + top:0; + left:0; + background-color:#CCC; + -moz-opacity: 0.5; + opacity:.50; + filter: alpha(opacity=50); + } +.mask[id]{ /* IE6 and below Can't See This */ + position:fixed; +} + +.hide-scrollbars * { + overflow:hidden; +} + +.hide-scrollbars textarea, .hide-scrollbars select { + overflow:hidden; + display:none; +} + +.show-scrollbars textarea, .show-scrollbars select { + overflow:visible; +} + +.panel-container { + position:absolute; + background-color:transparent; + z-index:6; + visibility:hidden; + overflow:visible; + width:auto; +} + +.panel-container.matte { + padding:3px; + background-color:#FFF; +} + +.panel-container.matte .underlay { + display:none; +} + +.panel-container.shadow { + padding:0px; + background-color:transparent; +} + +.panel-container.shadow .underlay { + visibility:inherit; + position:absolute; + background-color:#CCC; + top:3px;left:3px; + z-index:0; + width:100%; + height:100%; + -moz-opacity: 0.7; + opacity:.70; + filter:alpha(opacity=70); +} + +.panel { + visibility:hidden; + border-collapse:separate; + position:relative; + left:0px;top:0px; + font:1em Arial; + background-color:#FFF; + border:1px solid #000; + z-index:1; + overflow:auto; +} + +.panel .hd { + background-color:#3d77cb; + color:#FFF; + font-size:1em; + height:1em; + border:1px solid #FFF; + border-bottom:1px solid #000; + font-weight:bold; + overflow:hidden; + padding:4px; +} + +.panel .bd { + overflow:hidden; + padding:4px; +} + +.panel .bd p { + margin:0 0 1em; +} + +.panel .close { + position:absolute; + top:5px; + right:4px; + z-index:6; + height:12px; + width:12px; + margin:0px; + padding:0px; + background-repeat:no-repeat; + cursor:pointer; + visibility:inherit; +} + +.panel .close.nonsecure { + background-image:url(http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/alt3/close12_1.gif); +} + +.panel .close.secure { + background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/nt/ic/ut/alt3/close12_1.gif); +} + +.panel .ft { + padding:4px; + overflow:hidden; +} + +.simple-dialog .bd .icon { + background-repeat:no-repeat; + width:16px; + height:16px; + margin-right:10px; + float:left; +} + +.dialog .ft, .simple-dialog .ft { + padding-bottom:5px; + padding-right:5px; + text-align:right; +} + +.dialog form, .simple-dialog form { + margin:0; +} + +.button-group button { + font:100 76% verdana; + text-decoration:none; + background-color: #E4E4E4; + color: #333; + cursor: hand; + vertical-align: middle; + border: 2px solid #797979; + border-top-color:#FFF; + border-left-color:#FFF; + margin:2px; + padding:2px; +} + +.button-group button.default { + font-weight:bold; +} + +.button-group button:hover, .button-group button.hover { + border:2px solid #90A029; + background-color:#EBF09E; + border-top-color:#FFF; + border-left-color:#FFF; +} + +.button-group button:active { + border:2px solid #E4E4E4; + background-color:#BBB; + border-top-color:#333; + border-left-color:#333; +} diff --git a/projekte/MDB/web-app/js/yahoo/assets/hlp16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/hlp16_1.gif new file mode 100644 index 0000000..4645c8f Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/hlp16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/info16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/info16_1.gif new file mode 100644 index 0000000..22f697a Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/info16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/lm.gif b/projekte/MDB/web-app/js/yahoo/assets/lm.gif new file mode 100644 index 0000000..e7d0a3c Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/lm.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/lmh.gif b/projekte/MDB/web-app/js/yahoo/assets/lmh.gif new file mode 100644 index 0000000..3ff6302 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/lmh.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/ln.gif b/projekte/MDB/web-app/js/yahoo/assets/ln.gif new file mode 100644 index 0000000..b7b3e55 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/ln.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/loading.gif b/projekte/MDB/web-app/js/yahoo/assets/loading.gif new file mode 100644 index 0000000..0bbf3bc Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/loading.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/lp.gif b/projekte/MDB/web-app/js/yahoo/assets/lp.gif new file mode 100644 index 0000000..b87f003 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/lp.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/lph.gif b/projekte/MDB/web-app/js/yahoo/assets/lph.gif new file mode 100644 index 0000000..e3478d8 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/lph.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menu.css b/projekte/MDB/web-app/js/yahoo/assets/menu.css new file mode 100644 index 0000000..4c09b9a --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/assets/menu.css @@ -0,0 +1,264 @@ +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +*/ + + +/* Menu styles */ + +div.yuimenu { + + z-index:1; + visibility:hidden; + background-color:#f6f7ee; + border:solid 1px #c4c4be; + padding:1px; + +} + + +/* MenuBar Styles */ + +div.yuimenubar { + + background-color:#f6f7ee; + +} + +/* + Application of "zoom:1" triggers "haslayout" in IE so that the module's + body clears its floated elements +*/ +div.yuimenubar div.bd { + + zoom:1; + +} + +/* + Clear the module body for other browsers +*/ +div.yuimenubar div.bd:after { + + content:'.'; + display:block; + clear:both; + visibility:hidden; + height:0; + +} + + +/* Matches the group title (H6) inside a Menu or MenuBar instance */ + +div.yuimenu h6, +div.yuimenubar h6 { + + font-size:100%; + font-weight:normal; + margin:0; + border:solid 1px #c4c4be; + color:#b9b9b9; + +} + +div.yuimenubar h6 { + + float:left; + display:inline; /* Prevent margin doubling in IE */ + padding:4px 12px; + border-width:0 1px 0 0; + +} + +div.yuimenu h6 { + + float:none; + display:block; + border-width:1px 0 0 0; + padding:5px 10px 0 10px; + +} + + +/* Matches the UL inside a Menu or MenuBar instance */ + +div.yuimenubar ul { + + list-style-type:none; + margin:0; + padding:0; + overflow:hidden; + +} + +div.yuimenu ul { + + list-style-type:none; + border:solid 1px #c4c4be; + border-width:1px 0 0 0; + margin:0; + padding:10px 0; + +} + + +div.yuimenu ul.first, +div.yuimenu ul.hastitle, +div.yuimenu h6.first { + + border-width:0; + +} + + +/* MenuItem and MenuBarItem styles */ + +div.yuimenu li, +div.yuimenubar li { + + font-size:85%; + cursor:pointer; + cursor:hand; + white-space:nowrap; + text-align:left; + +} + +div.yuimenu li.yuimenuitem { + + padding:2px 24px; + +} + +div.yuimenu li li, +div.yuimenubar li li { + + font-size:100%; + +} + + +/* Matches the help text for a MenuItem instance */ + +div.yuimenu li em { + + font-style:normal; + margin:0 0 0 40px; + +} + +div.yuimenu li a em { + + margin:0; + +} + +div.yuimenu li a, +div.yuimenubar li a { + + /* + "zoom:1" triggers "haslayout" in IE to ensure that the mouseover and + mouseout events bubble to the parent LI in IE. + */ + zoom:1; + color:#000; + text-decoration:none; + +} + + +/* Matches the sub menu indicator for a MenuItem instance */ + +div.yuimenu li img { + + margin:0 -16px 0 10px; + border:0; + +} + +div.yuimenu li.hassubmenu, +div.yuimenu li.hashelptext { + + text-align:right; + +} + +div.yuimenu li.hassubmenu a.hassubmenu, +div.yuimenu li.hashelptext a.hashelptext { + + float:left; + display:inline; /* Prevent margin doubling in IE */ + text-align:left; + +} + + +/* Matches focused and selected MenuItem instances */ + +div.yuimenu li.selected, +div.yuimenubar li.selected { + + background-color:#8c8ad0; + +} + +div.yuimenu li.selected a.selected, +div.yuimenubar li.selected a.selected { + + text-decoration:underline; + +} + +div.yuimenu li.selected a.selected, +div.yuimenu li.selected em.selected, +div.yuimenubar li.selected a.selected { + + color:#fff; + +} + + +/* Matches disabled MenuItem instances */ + +div.yuimenu li.disabled, +div.yuimenubar li.disabled { + + cursor:default; + +} + +div.yuimenu li.disabled a.disabled, +div.yuimenu li.disabled em.disabled, +div.yuimenubar li.disabled a.disabled { + + color:#b9b9b9; + cursor:default; + +} + +div.yuimenubar li.yuimenubaritem { + + float:left; + display:inline; /* Prevent margin doubling in IE */ + border-width:0 0 0 1px; + border-style:solid; + border-color:#c4c4be; + padding:4px 24px; + margin:0; + +} + +div.yuimenubar li.yuimenubaritem.first { + + border-width:0; + +} + +div.yuimenubar li.yuimenubaritem img { + + margin:0 0 0 10px; + vertical-align:middle; + +} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_clk_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_clk_1.gif new file mode 100644 index 0000000..65d7929 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_clk_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_dim_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_dim_1.gif new file mode 100644 index 0000000..028adad Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_dim_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_nrm_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_nrm_1.gif new file mode 100644 index 0000000..a3f0757 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarodwn9_nrm_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_dim_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_dim_1.gif new file mode 100644 index 0000000..59c6389 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_dim_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_hov_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_hov_1.gif new file mode 100644 index 0000000..7042ae6 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_hov_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_nrm_1.gif b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_nrm_1.gif new file mode 100644 index 0000000..acd7f20 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/menuarorght9_nrm_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tip16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/tip16_1.gif new file mode 100644 index 0000000..8f0be2b Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tip16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tm.gif b/projekte/MDB/web-app/js/yahoo/assets/tm.gif new file mode 100644 index 0000000..e30abad Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tm.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tmh.gif b/projekte/MDB/web-app/js/yahoo/assets/tmh.gif new file mode 100644 index 0000000..ad7e557 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tmh.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tn.gif b/projekte/MDB/web-app/js/yahoo/assets/tn.gif new file mode 100644 index 0000000..4a28039 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tn.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tp.gif b/projekte/MDB/web-app/js/yahoo/assets/tp.gif new file mode 100644 index 0000000..d6d0ed0 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tp.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tph.gif b/projekte/MDB/web-app/js/yahoo/assets/tph.gif new file mode 100644 index 0000000..e4d7d99 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/tph.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/tree.css b/projekte/MDB/web-app/js/yahoo/assets/tree.css new file mode 100644 index 0000000..ad8591b --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/assets/tree.css @@ -0,0 +1,98 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { + width:16px; height:22px; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/tn.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable */ +.ygtvtm { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/tm.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/tmh.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable */ +.ygtvtp { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/tp.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable, hover */ +.ygtvtph { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/tph.gif) 0 0 no-repeat; +} + +/* last sibling, no children */ +.ygtvln { + width:16px; height:22px; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/ln.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable */ +.ygtvlm { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/lm.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable, hover */ +.ygtvlmh { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/lmh.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable */ +.ygtvlp { + width:16px; height:22px; + cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/lp.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable, hover */ +.ygtvlph { + width:16px; height:22px; cursor:pointer ; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/lph.gif) 0 0 no-repeat; +} + +/* Loading icon */ +.ygtvloading { + width:16px; height:22px; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/loading.gif) 0 0 no-repeat; +} + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { + width:16px; height:22px; + background: url(../../../../../../../i/us/nt/widg/tree/dflt/vline.gif) 0 0 no-repeat; +} + +.ygtvblankdepthcell { width:16px; height:22px; } + +/* the style of the div around each node */ +.ygtvitem { } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:2%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + +.ygtvspacer { height: 10px; width: 10px; margin: 2px; } diff --git a/projekte/MDB/web-app/js/yahoo/assets/vline.gif b/projekte/MDB/web-app/js/yahoo/assets/vline.gif new file mode 100644 index 0000000..1fb0de8 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/vline.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/assets/warn16_1.gif b/projekte/MDB/web-app/js/yahoo/assets/warn16_1.gif new file mode 100644 index 0000000..d679df5 Binary files /dev/null and b/projekte/MDB/web-app/js/yahoo/assets/warn16_1.gif differ diff --git a/projekte/MDB/web-app/js/yahoo/calendar-min.js b/projekte/MDB/web-app/js/yahoo/calendar-min.js new file mode 100644 index 0000000..5fe4046 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/calendar-min.js @@ -0,0 +1,211 @@ +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 0.10.0 +*/ +YAHOO.widget.DateMath=new function(){this.DAY="D";this.WEEK="W";this.YEAR="Y";this.MONTH="M";this.ONE_DAY_MS=1000*60*60*24;this.add=function(date,field,amount){var d=new Date(date.getTime());switch(field) +{case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0) +{newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11) +{newMonth-=12;years+=1;}} +d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+7);break;} +return d;};this.subtract=function(date,field,amount){return this.add(date,field,(amount*-1));};this.before=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()ms){return true;}else{return false;}};this.getJan1=function(calendarYear){return new Date(calendarYear,0,1);};this.getDayOffset=function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;};this.getWeekNumber=function(date,calendarYear,weekStartsOn){if(!weekStartsOn){weekStartsOn=0;} +if(!calendarYear){calendarYear=date.getFullYear();} +var weekNum=-1;var jan1=this.getJan1(calendarYear);var jan1DayOfWeek=jan1.getDay();var month=date.getMonth();var day=date.getDate();var year=date.getFullYear();var dayOffset=this.getDayOffset(date,calendarYear);if(dayOffset<0&&dayOffset>=(-1*jan1DayOfWeek)){weekNum=1;}else{weekNum=1;var testDate=this.getJan1(calendarYear);while(testDate.getTime()0) +{this.init(id,containerId,monthyear,selected);}} +YAHOO.widget.Calendar_Core.IMG_ROOT=(window.location.href.toLowerCase().indexOf("https")==0?"https://a248.e.akamai.net/sec.yimg.com/i/":"http://us.i1.yimg.com/us.yimg.com/i/");YAHOO.widget.Calendar_Core.DATE="D";YAHOO.widget.Calendar_Core.MONTH_DAY="MD";YAHOO.widget.Calendar_Core.WEEKDAY="WD";YAHOO.widget.Calendar_Core.RANGE="R";YAHOO.widget.Calendar_Core.MONTH="M";YAHOO.widget.Calendar_Core.DISPLAY_DAYS=42;YAHOO.widget.Calendar_Core.STOP_RENDER="S";YAHOO.widget.Calendar_Core.prototype={Config:null,parent:null,index:-1,cells:null,weekHeaderCells:null,weekFooterCells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,pageDate:null,_pageDate:null,minDate:null,maxDate:null,selectedDates:null,_selectedDates:null,shellRendered:false,table:null,headerCell:null};YAHOO.widget.Calendar_Core.prototype.init=function(id,containerId,monthyear,selected){this.setupConfig();this.id=id;this.cellDates=new Array();this.cells=new Array();this.renderStack=new Array();this._renderStack=new Array();this.oDomContainer=document.getElementById(containerId);this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);var month;var year;if(monthyear) +{var aMonthYear=monthyear.split(this.Locale.DATE_FIELD_DELIMITER);month=parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);year=parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);}else{month=this.today.getMonth()+1;year=this.today.getFullYear();} +this.pageDate=new Date(year,month-1,1);this._pageDate=new Date(this.pageDate.getTime());if(selected) +{this.selectedDates=this._parseDates(selected);this._selectedDates=this.selectedDates.concat();}else{this.selectedDates=new Array();this._selectedDates=new Array();} +this.wireDefaultEvents();this.wireCustomEvents();};YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents=function(){this.doSelectCell=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){if(cal.Options.MULTI_SELECT){var link=cell.getElementsByTagName("A")[0];link.blur();var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1) +{cal.deselectCell(index);}else{cal.selectCell(index);}}else{var link=cell.getElementsByTagName("A")[0];link.blur() +cal.selectCell(index);}}} +this.doCellMouseOver=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){YAHOO.widget.Calendar_Core.prependCssClass(cell,cal.Style.CSS_CELL_HOVER);}} +this.doCellMouseOut=function(e,cal){YAHOO.widget.Calendar_Core.removeCssClass(this,cal.Style.CSS_CELL_HOVER);} +this.doNextMonth=function(e,cal){cal.nextMonth();} +this.doPreviousMonth=function(e,cal){cal.previousMonth();}} +YAHOO.widget.Calendar_Core.prototype.wireCustomEvents=function(){} +YAHOO.widget.Calendar_Core.prototype.setupConfig=function(){this.Config=new Object();this.Config.Style={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTED:"selected",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"calendar",CSS_BORDER:"calbordered",CSS_CONTAINER:"calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};this.Style=this.Config.Style;this.Config.Locale={MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"],WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],DATE_DELIMITER:",",DATE_FIELD_DELIMITER:"/",DATE_RANGE_DELIMITER:"-",MY_MONTH_POSITION:1,MY_YEAR_POSITION:2,MD_MONTH_POSITION:1,MD_DAY_POSITION:2,MDY_MONTH_POSITION:1,MDY_DAY_POSITION:2,MDY_YEAR_POSITION:3};this.Locale=this.Config.Locale;this.Config.Options={MULTI_SELECT:false,SHOW_WEEKDAYS:true,START_WEEKDAY:0,SHOW_WEEK_HEADER:false,SHOW_WEEK_FOOTER:false,HIDE_BLANK_WEEKS:false,NAV_ARROW_LEFT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/callt.gif",NAV_ARROW_RIGHT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/calrt.gif"};this.Options=this.Config.Options;this.customConfig();if(!this.Options.LOCALE_MONTHS){this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;} +if(!this.Options.LOCALE_WEEKDAYS){this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;} +if(this.Options.START_WEEKDAY>0) +{for(var w=0;w0){this.preMonthDays-=this.Options.START_WEEKDAY;} +if(this.preMonthDays<0){this.preMonthDays+=7;} +this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var weekRowIndex=0;for(var c=0;c=d1.getTime()&&workingDate.getTime()<=d2.getTime()) +{renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(r,1);}} +break;case YAHOO.widget.Calendar_Core.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday) +{renderer=rArray[2];} +break;case YAHOO.widget.Calendar_Core.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month) +{renderer=rArray[2];} +break;} +if(renderer){cellRenderers[cellRenderers.length]=renderer;}}} +if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1) +{cellRenderers[cellRenderers.length]=this.renderCellStyleSelected;} +if(this.minDate) +{this.minDate=YAHOO.widget.DateMath.clearTime(this.minDate);} +if(this.maxDate) +{this.maxDate=YAHOO.widget.DateMath.clearTime(this.maxDate);} +if((this.minDate&&(workingDate.getTime()this.maxDate.getTime()))){cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=this.renderCellDefault;} +for(var x=0;x=0&&c<=6){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TOP);} +if((c%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_LEFT);} +if(((c+1)%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_RIGHT);} +var postDays=this.postMonthDays;if(postDays>=7&&this.Options.HIDE_BLANK_WEEKS){var blankWeeks=Math.floor(postDays/7);for(var p=0;p=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_BOTTOM);}}};YAHOO.widget.Calendar_Core.prototype.renderFooter=function(){};YAHOO.widget.Calendar_Core.prototype._unload=function(e,cal){for(var c in cal.cells){c=null;} +cal.cells=null;cal.tbody=null;cal.oDomContainer=null;cal.table=null;cal.headerCell=null;cal=null;};YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;} +YAHOO.widget.Calendar_Core.prototype.renderRowHeader=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_HEADER);var useYear=this.pageDate.getFullYear();if(!YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)){useYear=workingDate.getFullYear();} +var weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useYear,this.Options.START_WEEKDAY);cell.innerHTML=weekNum;if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderRowFooter=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_FOOTER);if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML="";var link=document.createElement("a");link.href="javascript:void(null);";link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));cell.appendChild(link);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.addMonths=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractMonths=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.addYears=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractYears=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar_Core.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar_Core.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar_Core.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar_Core.prototype.reset=function(){this.selectedDates.length=0;this.selectedDates=this._selectedDates.concat();this.pageDate=new Date(this._pageDate.getTime());this.onReset();};YAHOO.widget.Calendar_Core.prototype.clear=function(){this.selectedDates.length=0;this.pageDate=new Date(this.today.getTime());this.onClear();};YAHOO.widget.Calendar_Core.prototype.select=function(date){this.onBeforeSelect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a-1) +{if(this.pageDate.getMonth()==dCellDate.getMonth()&&this.pageDate.getFullYear()==dCellDate.getFullYear()) +{YAHOO.widget.Calendar_Core.removeCssClass(cell,this.Style.CSS_CELL_SELECTED);} +this.selectedDates.splice(cellDateIndex,1);} +if(this.parent){this.parent.sync(this);} +this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectAll=function(){this.onBeforeDeselect();var count=this.selectedDates.length;this.selectedDates.length=0;if(this.parent){this.parent.sync(this);} +if(count>0){this.onDeselect();} +return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype._toFieldArray=function(date){var returnDate=new Array();if(date instanceof Date) +{returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];} +else if(typeof date=='string') +{returnDate=this._parseDates(date);} +else if(date instanceof Array) +{for(var i=0;i0) +{this.init(id,containerId,monthyear,selected);}} +YAHOO.widget.Calendar.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar.prototype.buildShell=function(){this.border=document.createElement("DIV");this.border.className=this.Style.CSS_BORDER;this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.border.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();};YAHOO.widget.Calendar.prototype.renderShell=function(){this.border.appendChild(this.table);this.oDomContainer.appendChild(this.border);this.shellRendered=true;};YAHOO.widget.Calendar.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;var linkLeft=document.createElement("A");linkLeft.href="javascript:"+this.id+".previousMonth()";var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);var linkRight=document.createElement("A");linkRight.href="javascript:"+this.id+".nextMonth()";var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkLeft);headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));headerContainer.appendChild(linkRight);this.headerCell.appendChild(headerContainer);};YAHOO.widget.Cal=YAHOO.widget.Calendar;YAHOO.widget.CalendarGroup=function(pageCount,id,containerId,monthyear,selected){if(arguments.length>0) +{this.init(pageCount,id,containerId,monthyear,selected);}} +YAHOO.widget.CalendarGroup.prototype.init=function(pageCount,id,containerId,monthyear,selected){this.id=id;this.selectedDates=new Array();this.containerId=containerId;this.pageCount=pageCount;this.pages=new Array();for(var p=0;p0) +{year+=1;} +cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){for(var p=0;p=0;--p) +{var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p0) +{this.init(id,containerId,monthyear,selected);}} +YAHOO.widget.Calendar2up_Cal.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar2up_Cal.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;if(this.index==0){var linkLeft=document.createElement("A");linkLeft.href="javascript:void(null)";YAHOO.util.Event.addListener(linkLeft,"click",this.parent.doPreviousMonth,this.parent);var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);headerContainer.appendChild(linkLeft);} +headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));if(this.index==1){var linkRight=document.createElement("A");linkRight.href="javascript:void(null)";YAHOO.util.Event.addListener(linkRight,"click",this.parent.doNextMonth,this.parent);var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkRight);} +this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar2up=function(id,containerId,monthyear,selected){if(arguments.length>0) +{this.buildWrapper(containerId);this.init(2,id,containerId,monthyear,selected);}} +YAHOO.widget.Calendar2up.prototype=new YAHOO.widget.CalendarGroup();YAHOO.widget.Calendar2up.prototype.constructChild=function(id,containerId,monthyear,selected){var cal=new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);return cal;};YAHOO.widget.Calendar2up.prototype.buildWrapper=function(containerId){var outerContainer=document.getElementById(containerId);outerContainer.className="calcontainer";var innerContainer=document.createElement("DIV");innerContainer.className="calbordered";innerContainer.id=containerId+"_inner";var cal1Container=document.createElement("DIV");cal1Container.id=containerId+"_0";cal1Container.className="cal2up";cal1Container.style.marginRight="10px";var cal2Container=document.createElement("DIV");cal2Container.id=containerId+"_1";cal2Container.className="cal2up";outerContainer.appendChild(innerContainer);innerContainer.appendChild(cal1Container);innerContainer.appendChild(cal2Container);this.innerContainer=innerContainer;this.outerContainer=outerContainer;} +YAHOO.widget.Calendar2up.prototype.render=function(){this.renderHeader();YAHOO.widget.CalendarGroup.prototype.render.call(this);this.renderFooter();};YAHOO.widget.Calendar2up.prototype.renderHeader=function(){if(!this.title){this.title="";} +if(!this.titleDiv) +{this.titleDiv=document.createElement("DIV");if(this.title=="") +{this.titleDiv.style.display="none";}} +this.titleDiv.className="title";this.titleDiv.innerHTML=this.title;if(this.outerContainer.style.position=="absolute") +{var linkClose=document.createElement("A");linkClose.href="javascript:void(null)";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this);var imgClose=document.createElement("IMG");imgClose.src=YAHOO.widget.Calendar_Core.IMG_ROOT+"us/my/bn/x_d.gif";imgClose.className="close-icon";linkClose.appendChild(imgClose);this.linkClose=linkClose;this.titleDiv.appendChild(linkClose);} +this.innerContainer.insertBefore(this.titleDiv,this.innerContainer.firstChild);} +YAHOO.widget.Calendar2up.prototype.hide=function(e,cal){if(!cal) +{cal=this;} +cal.outerContainer.style.display="none";} +YAHOO.widget.Calendar2up.prototype.renderFooter=function(){} +YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up; \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/connection-min.js b/projekte/MDB/web-app/js/yahoo/connection-min.js new file mode 100644 index 0000000..41fe4b3 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/connection-min.js @@ -0,0 +1,72 @@ +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +*/ +YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_isFormSubmit:false,_sFormData:null,_poll:[],_polling_interval:50,_transaction_id:0,setProgId:function(id) +{this.msxml_progid.unshift(id);},setPollingInterval:function(i) +{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId) +{var obj,http;try +{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};} +catch(e) +{for(var i=0;i=200&&httpStatus<300){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);} +else{callback.success.apply(callback.scope,[responseObject]);}}} +else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);} +else{callback.failure.apply(callback.scope,[responseObject]);}} +break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);} +else{callback.failure.apply(callback.scope,[responseObject]);}}}} +this.releaseObject(o);},createResponseObject:function(o,callbackArg) +{var obj={};var headerObj={};try +{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split("\n");for(var i=0;i0){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.Overlay.prototype=new YAHOO.widget.Module();YAHOO.widget.Overlay.prototype.constructor=YAHOO.widget.Overlay;YAHOO.widget.Overlay.superclass=YAHOO.widget.Module.prototype;YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);} +if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);} +if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}} +this.initEvent.fire(YAHOO.widget.Overlay);} +YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);} +YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});} +YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);} +YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");} +YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");} +YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(xrightConstraint){x=rightConstraint;} +if(ybottomConstraint){y=bottomConstraint;} +this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);} +YAHOO.widget.Overlay.prototype.center=function(){var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");} +YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);} +YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");} +YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();} +YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();} +if(YAHOO.widget.Overlay._initialized==undefined){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;} +YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);} +YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:new Array(),initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;} +this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));} +this.overlays.sort(this.compareZIndexDesc);}} +this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null +o.blurEvent=null;o.focus=null;o.blur=null;}} +this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex10){YAHOO.widget.Tooltip.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.Tooltip.prototype=new YAHOO.widget.Overlay();YAHOO.widget.Tooltip.prototype.constructor=YAHOO.widget.Tooltip;YAHOO.widget.Tooltip.superclass=YAHOO.widget.Overlay.prototype;YAHOO.widget.Tooltip.CSS_TOOLTIP="tt";YAHOO.widget.Tooltip.prototype.init=function(el,userConfig){if(document.readyState&&document.readyState!="complete"){var deferredInit=function(){this.init(el,userConfig);} +YAHOO.util.Event.addListener(window,"load",deferredInit,this,true);}else{YAHOO.widget.Tooltip.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Tooltip);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Tooltip.CSS_TOOLTIP);if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.render(this.cfg.getProperty("container"));this.initEvent.fire(YAHOO.widget.Tooltip);}} +YAHOO.widget.Tooltip.prototype.initDefaultConfig=function(){YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);this.cfg.addProperty("preventoverlap",{value:true,handler:this.configPreventOverlap,validator:this.cfg.checkBoolean,supercedes:["x","y","xy"]});this.cfg.addProperty("showdelay",{value:200,handler:this.configShowDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("autodismissdelay",{value:5000,handler:this.configAutoDismissDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("hidedelay",{value:250,handler:this.configHideDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("text",{handler:this.configText,suppressEvent:true});this.cfg.addProperty("container",{value:document.body,handler:this.configContainer});} +YAHOO.widget.Tooltip.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}} +YAHOO.widget.Tooltip.prototype.configContainer=function(type,args,obj){var container=args[0];if(typeof container=='string'){this.cfg.setProperty("container",document.getElementById(container),true);}} +YAHOO.widget.Tooltip.prototype.configPreventOverlap=function(type,args,obj){var preventoverlap=args[0];if(preventoverlap){if(!YAHOO.util.Config.alreadySubscribed(this.moveEvent,this.preventOverlap,this)){this.moveEvent.subscribe(this.preventOverlap,this,true);}}else{this.moveEvent.unsubscribe(this.preventOverlap,this);}} +YAHOO.widget.Tooltip.prototype.configContext=function(type,args,obj){var context=args[0];if(context){if(typeof context=="string"){this.cfg.setProperty("context",document.getElementById(context),true);} +var contextElement=this.cfg.getProperty("context");if(contextElement&&contextElement.title&&!this.cfg.getProperty("text")){this.cfg.setProperty("text",contextElement.title);} +YAHOO.util.Event.addListener(contextElement,"mouseover",this.onContextMouseOver,this);YAHOO.util.Event.addListener(contextElement,"mouseout",this.onContextMouseOut,this);}} +YAHOO.widget.Tooltip.prototype.onContextMouseOver=function(e,obj){if(!obj){obj=this;} +var context=obj.cfg.getProperty("context");if(context.title){obj.tempTitle=context.title;context.title="";} +this.procId=obj.doShow(e);} +YAHOO.widget.Tooltip.prototype.onContextMouseOut=function(e,obj){if(!obj){obj=this;} +var context=obj.cfg.getProperty("context");if(obj.tempTitle){context.title=obj.tempTitle;} +if(this.procId){clearTimeout(this.procId);} +setTimeout(function(){obj.hide();},obj.cfg.getProperty("hidedelay"));} +YAHOO.widget.Tooltip.prototype.doShow=function(e){var pageX=YAHOO.util.Event.getPageX(e);var pageY=YAHOO.util.Event.getPageY(e);var context=this.cfg.getProperty("context");var yOffset=25;if(this.browser=="opera"&&context.tagName=="A"){yOffset+=12;} +var me=this;return setTimeout(function(){me.moveTo(pageX,pageY+yOffset);me.show();me.doHide();},this.cfg.getProperty("showdelay"));} +YAHOO.widget.Tooltip.prototype.doHide=function(){var me=this;setTimeout(function(){me.hide();},this.cfg.getProperty("autodismissdelay"));} +YAHOO.widget.Tooltip.prototype.preventOverlap=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var elementRegion=YAHOO.util.Dom.getRegion(this.element);var contextRegion=YAHOO.util.Dom.getRegion(this.cfg.getProperty("context"));var intersection=contextRegion.intersect(elementRegion);if(intersection){var overlapHeight=intersection.bottom-intersection.top;y=(y-overlapHeight-10);this.cfg.setProperty("y",y);}} +YAHOO.widget.Panel=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.Panel.prototype=new YAHOO.widget.Overlay();YAHOO.widget.Panel.prototype.constructor=YAHOO.widget.Panel;YAHOO.widget.Panel.superclass=YAHOO.widget.Overlay.prototype;YAHOO.widget.Panel.CSS_PANEL="panel";YAHOO.widget.Panel.CSS_PANEL_CONTAINER="panel-container";YAHOO.widget.Panel.prototype.showMaskEvent=null;YAHOO.widget.Panel.prototype.hideMaskEvent=null;YAHOO.widget.Panel.prototype.init=function(el,userConfig){YAHOO.widget.Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Panel);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.beforeRenderEvent.subscribe(function(){var draggable=this.cfg.getProperty("draggable");if(draggable){if(!this.header){this.setHeader(" ");}}},this,true);this.initEvent.fire(YAHOO.widget.Panel);} +YAHOO.widget.Panel.prototype.initEvents=function(){YAHOO.widget.Panel.superclass.initEvents.call(this);this.showMaskEvent=new YAHOO.util.CustomEvent("showMask");this.hideMaskEvent=new YAHOO.util.CustomEvent("hideMask");} +YAHOO.widget.Panel.prototype.initDefaultConfig=function(){YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);this.cfg.addProperty("close",{value:true,handler:this.configClose,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("draggable",{value:true,handler:this.configDraggable,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("underlay",{value:"shadow",handler:this.configUnderlay,supercedes:["visible"]});this.cfg.addProperty("modal",{value:false,handler:this.configModal,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("keylisteners",{handler:this.configKeyListeners,suppressEvent:true,supercedes:["visible"]});} +YAHOO.widget.Panel.prototype.configClose=function(type,args,obj){var val=args[0];var doHide=function(e,obj){obj.hide();} +if(val){if(!this.close){this.close=document.createElement("DIV");YAHOO.util.Dom.addClass(this.close,"close");if(this.isSecure){YAHOO.util.Dom.addClass(this.close,"secure");}else{YAHOO.util.Dom.addClass(this.close,"nonsecure");} +this.close.innerHTML=" ";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doHide,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}} +YAHOO.widget.Panel.prototype.configDraggable=function(type,args,obj){var val=args[0];if(val){if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}}else{if(this.dd){this.dd.unreg();} +if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","auto");}}} +YAHOO.widget.Panel.prototype.configUnderlay=function(type,args,obj){var val=args[0];switch(val.toLowerCase()){case"shadow":YAHOO.util.Dom.removeClass(this.element,"matte");YAHOO.util.Dom.addClass(this.element,"shadow");if(!this.underlay){this.underlay=document.createElement("DIV");this.underlay.className="underlay";this.underlay.innerHTML=" ";this.element.appendChild(this.underlay);} +this.sizeUnderlay();break;case"matte":YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.addClass(this.element,"matte");break;case"none":default:YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.removeClass(this.element,"matte");break;}} +YAHOO.widget.Panel.prototype.configModal=function(type,args,obj){var modal=args[0];if(modal){this.buildMask();if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMask,this)){this.showEvent.subscribe(this.showMask,this,true);} +if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMask,this)){this.hideEvent.subscribe(this.hideMask,this,true);} +if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);}}else{this.beforeShowEvent.unsubscribe(this.showMask,this);this.hideEvent.unsubscribe(this.hideMask,this);YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);}} +YAHOO.widget.Panel.prototype.configKeyListeners=function(type,args,obj){var listeners=args[0];if(listeners){if(listeners instanceof Array){for(var i=0;i0){YAHOO.widget.Dialog.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.Dialog.prototype=new YAHOO.widget.Panel();YAHOO.widget.Dialog.prototype.constructor=YAHOO.widget.Dialog;YAHOO.widget.Dialog.superclass=YAHOO.widget.Panel.prototype;YAHOO.widget.Dialog.CSS_DIALOG="dialog";YAHOO.widget.Dialog.prototype.beforeSubmitEvent=null;YAHOO.widget.Dialog.prototype.submitEvent=null;YAHOO.widget.Dialog.prototype.manualSubmitEvent=null;YAHOO.widget.Dialog.prototype.asyncSubmitEvent=null;YAHOO.widget.Dialog.prototype.formSubmitEvent=null;YAHOO.widget.Dialog.prototype.cancelEvent=null;YAHOO.widget.Dialog.prototype.initDefaultConfig=function(){YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);var callback={success:null,failure:null,argument:null,scope:this} +this.configOnSuccess=function(type,args,obj){var fn=args[0];callback.success=fn;} +this.configOnFailure=function(type,args,obj){var fn=args[0];callback.failure=fn;} +this.doSubmit=function(){var method=this.cfg.getProperty("postmethod");switch(method){case"async":YAHOO.util.Connect.setForm(this.form.name);var cObj=YAHOO.util.Connect.asyncRequest('POST',this.form.action,callback);this.asyncSubmitEvent.fire();break;case"form":this.form.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}} +this.cfg.addProperty("postmethod",{value:"async",validator:function(val){if(val!="form"&&val!="async"&&val!="none"&&val!="manual"){return false;}else{return true;}}});this.cfg.addProperty("onsuccess",{handler:this.configOnSuccess,suppressEvent:true});this.cfg.addProperty("onfailure",{handler:this.configOnFailure,suppressEvent:true});this.cfg.addProperty("buttons",{value:"none",handler:this.configButtons});} +YAHOO.widget.Dialog.prototype.initEvents=function(){YAHOO.widget.Dialog.superclass.initEvents.call(this);this.beforeSubmitEvent=new YAHOO.util.CustomEvent("beforeSubmit");this.submitEvent=new YAHOO.util.CustomEvent("submit");this.manualSubmitEvent=new YAHOO.util.CustomEvent("manualSubmit");this.asyncSubmitEvent=new YAHOO.util.CustomEvent("asyncSubmit");this.formSubmitEvent=new YAHOO.util.CustomEvent("formSubmit");this.cancelEvent=new YAHOO.util.CustomEvent("cancel");} +YAHOO.widget.Dialog.prototype.init=function(el,userConfig){YAHOO.widget.Dialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Dialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Dialog.CSS_DIALOG);if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.renderEvent.subscribe(this.registerForm,this,true);this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.beforeRenderEvent.subscribe(function(){var buttonCfg=this.cfg.getProperty("buttons");if(buttonCfg&&buttonCfg!="none"){if(!this.footer){this.setFooter("");}}},this,true);this.initEvent.fire(YAHOO.widget.Dialog);} +YAHOO.widget.Dialog.prototype.registerForm=function(){var form=this.element.getElementsByTagName("FORM")[0];if(!form){var formHTML="
    ";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];} +this.firstFormElement=function(){for(var f=0;f=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;break;}}} +return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);} +var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}} +YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("SPAN");this.buttonSpan.className="button-group";for(var b=0;b0){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.SimpleDialog.prototype=new YAHOO.widget.Dialog();YAHOO.widget.SimpleDialog.prototype.constructor=YAHOO.widget.SimpleDialog;YAHOO.widget.SimpleDialog.superclass=YAHOO.widget.Dialog.prototype;YAHOO.widget.SimpleDialog.ICON_BLOCK="nt/ic/ut/bsc/blck16_1.gif";YAHOO.widget.SimpleDialog.ICON_ALARM="nt/ic/ut/bsc/alrt16_1.gif";YAHOO.widget.SimpleDialog.ICON_HELP="nt/ic/ut/bsc/hlp16_1.gif";YAHOO.widget.SimpleDialog.ICON_INFO="nt/ic/ut/bsc/info16_1.gif";YAHOO.widget.SimpleDialog.ICON_WARN="nt/ic/ut/bsc/warn16_1.gif";YAHOO.widget.SimpleDialog.ICON_TIP="nt/ic/ut/bsc/tip16_1.gif";YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG="simple-dialog";YAHOO.widget.SimpleDialog.prototype.initDefaultConfig=function(){YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);this.cfg.addProperty("icon",{value:"none",handler:this.configIcon,suppressEvent:true});this.cfg.addProperty("text",{value:"",handler:this.configText,suppressEvent:true,supercedes:["icon"]});} +YAHOO.widget.SimpleDialog.prototype.init=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(YAHOO.widget.SimpleDialog);} +YAHOO.widget.SimpleDialog.prototype.registerForm=function(){YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);this.form.innerHTML+="";} +YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML="";this.body.innerHTML=iconHTML+this.body.innerHTML;}} +YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}} +YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement){this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn");this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut");this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete");this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete");} +YAHOO.widget.ContainerEffect.prototype.init=function(animClass){if(!animClass){animClass=YAHOO.util.Anim;} +this.animIn=new animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);} +YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();} +YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();} +YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){} +YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){} +YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){} +YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){} +YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){} +YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){} +YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut});fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");} +if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;} +YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);} +fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;} +if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);} +obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();} +fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}} +fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;} +YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut});slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";} +slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&¤tX0){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}} +YAHOO.widget.Overlay.prototype=new YAHOO.widget.Module();YAHOO.widget.Overlay.prototype.constructor=YAHOO.widget.Overlay;YAHOO.widget.Overlay.superclass=YAHOO.widget.Module.prototype;YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);} +if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);} +if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}} +this.initEvent.fire(YAHOO.widget.Overlay);} +YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);} +YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});} +YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);} +YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");} +YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");} +YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(xrightConstraint){x=rightConstraint;} +if(ybottomConstraint){y=bottomConstraint;} +this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);} +YAHOO.widget.Overlay.prototype.center=function(){var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");} +YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);} +YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");} +YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();} +YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();} +if(YAHOO.widget.Overlay._initialized==undefined){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;} +YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);} +YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:new Array(),initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);} +this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;} +this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));} +this.overlays.sort(this.compareZIndexDesc);}} +this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null +o.blurEvent=null;o.focus=null;o.blur=null;}} +this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex1=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"t: "+this.top+", r: "+this.right+", b: "+this.bottom+", l: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){this.x=x;this.y=y;this.top=y;this[1]=y;this.right=x;this.bottom=y;this.left=x;this[0]=x;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/dragdrop-min.js b/projekte/MDB/web-app/js/yahoo/dragdrop-min.js new file mode 100644 index 0000000..664cf19 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/dragdrop-min.js @@ -0,0 +1 @@ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ YAHOO.util.DragDrop=function(id,_2){if(id){this.init(id,_2);}};YAHOO.util.DragDrop.prototype={id:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=this.DDM.getElement(this.id);}return this._domRef;},getDragEl:function(){return this.DDM.getElement(this.dragElId);},init:function(id,_6){this.initTarget(id,_6);YAHOO.util.Event.addListener(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_7){this.DDM=YAHOO.util.DDM;this.padding=[0,0,0,0];this.groups={};this.id=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.handleElId=id;YAHOO.util.Event.onAvailable(id,this.handleOnAvailable,this,true);this.addToGroup((_7)?_7:"default");},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_8,_9,_10,_11){if(!_9&&0!==_9){this.padding=[_8,_8,_8,_8];}else{if(!_10&&0!==_10){this.padding=[_8,_9,_8,_9];}else{this.padding=[_8,_9,_10,_11];}}},setInitPosition:function(_12,_13){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_12||0;var dy=_13||0;var p=YAHOO.util.Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||YAHOO.util.Dom.getXY(this.getEl());this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_19){this.groups[_19]=true;this.DDM.regDragDrop(this,_19);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){YAHOO.util.Event.addListener(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);},unreg:function(){YAHOO.util.Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var EU=YAHOO.util.Event;var _22=e.which||e.button;if(this.primaryButtonOnly&&_22>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(EU.getPageX(e),EU.getPageY(e));if(this.DDM.isOverTarget(pt,this)){var _24=EU.getTarget(e);if(this.isValidHandleChild(_24)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_24,this.id))){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}}},addInvalidHandleType:function(_25){var _26=_25.toUpperCase();this.invalidHandleTypes[_26]=_26;},addInvalidHandleId:function(id){this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_27){this.invalidHandleClasses.push(_27);},removeInvalidHandleType:function(_28){var _29=_28.toUpperCase();delete this.invalidHandleTypes[_29];},removeInvalidHandleId:function(id){delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_30){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_36){if(!_37[i]){this.xTicks[this.xTicks.length]=i;_37[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_36){if(!_37[i]){this.xTicks[this.xTicks.length]=i;_37[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_38,_39){this.yTicks=[];this.yTickSize=_39;var _40={};for(var i=this.initPageY;i>=this.minY;i=i-_39){if(!_40[i]){this.yTicks[this.yTicks.length]=i;_40[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_39){if(!_40[i]){this.yTicks[this.yTicks.length]=i;_40[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_41,_42,_43){this.leftConstraint=_41;this.rightConstraint=_42;this.minX=this.initPageX-_41;this.maxX=this.initPageX+_42;if(_43){this.setXTicks(this.initPageX,_43);}this.constrainX=true;},setYConstraint:function(iUp,_45,_46){this.topConstraint=iUp;this.bottomConstraint=_45;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_45;if(_46){this.setYTicks(this.initPageY,_46);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_48){if(!_48){return val;}else{if(_48[0]>=val){return _48[0];}else{for(var i=0,len=_48.length;i=val){var _50=val-_48[i];var _51=_48[_49]-val;return (_51>_50)?_48[i]:_48[_49];}}return _48[_48.length-1];}}},toString:function(val,_52){return ("YAHOO.util.DragDrop {"+this.id+"}");}};if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=new function(){this.ids={};this.handleIds={};this.dragCurrent=null;this.dragOvers={};this.deltaX=0;this.deltaY=0;this.preventDefault=true;this.stopPropagation=true;this.initalized=false;this.locked=false;this.init=function(){};this.POINT=0;this.INTERSECT=1;this.mode=this.POINT;this._execOnAll=function(_53,_54){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_53].apply(oDD,_54);}}};this._onLoad=function(){var EU=YAHOO.util.Event;EU.on(document,"mouseup",this.handleMouseUp,this,true);EU.on(document,"mousemove",this.handleMouseMove,this,true);EU.on(window,"unload",this._onUnload,this,true);EU.on(window,"resize",this._onResize,this,true);this.initalized=true;};this._onResize=function(e){this._execOnAll("resetConstraints",[]);};this.lock=function(){this.locked=true;};this.unlock=function(){this.locked=false;};this.isLocked=function(){return this.locked;};this.locationCache={};this.useCache=true;this.clickPixelThresh=3;this.clickTimeThresh=1000;this.dragThreshMet=false;this.clickTimeout=null;this.startX=0;this.startY=0;this.regDragDrop=function(oDD,_56){if(!this.initialized){this.init();}if(!this.ids[_56]){this.ids[_56]={};}this.ids[_56][oDD.id]=oDD;};this._remove=function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];};this.regHandle=function(_58,_59){if(!this.handleIds[_58]){this.handleIds[_58]={};}this.handleIds[_58][_59]=_59;};this.isDragDrop=function(id){return (this.getDDById(id))?true:false;};this.getRelated=function(_60,_61){var _62=[];for(var i in _60.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_61||dd.isTarget){_62[_62.length]=dd;}}}return _62;};this.isLegalTarget=function(oDD,_64){var _65=this.getRelated(oDD);for(var i=0,len=_65.length;ithis.clickPixelThresh||_70>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);};this.fireEvents=function(e,_71){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _73=[];var _74=[];var _75=[];var _76=[];var _77=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_74.push(ddo);}_73[i]=true;delete this.dragOvers[i];}for(var _79 in dc.groups){if("string"!=typeof _79){continue;}for(i in this.ids[_79]){var oDD=this.ids[_79][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_71){_76.push(oDD);}else{if(!_73[oDD.id]){_77.push(oDD);}else{_75.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_74.length){dc.b4DragOut(e,_74);dc.onDragOut(e,_74);}if(_77.length){dc.onDragEnter(e,_77);}if(_75.length){dc.b4DragOver(e,_75);dc.onDragOver(e,_75);}if(_76.length){dc.b4DragDrop(e,_76);dc.onDragDrop(e,_76);}}else{var len=0;for(i=0,len=_74.length;i1000){}else{setTimeout(YAHOO.util.DDM._addListeners,10);if(document&&document.body){this._timeoutCount+=1;}}}};this.handleWasClicked=function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_107){if(id){this.init(id,_107);}};YAHOO.util.DD.prototype=new YAHOO.util.DragDrop();YAHOO.util.DD.prototype.scroll=true;YAHOO.util.DD.prototype.autoOffset=function(_108,_109){var el=this.getEl();var _110=YAHOO.util.Dom.getXY(el);var x=_108-_110[0];var y=_109-_110[1];this.setDelta(x,y);};YAHOO.util.DD.prototype.setDelta=function(_111,_112){this.deltaX=_111;this.deltaY=_112;};YAHOO.util.DD.prototype.setDragElPos=function(_113,_114){var el=this.getDragEl();this.alignElWithMouse(el,_113,_114);};YAHOO.util.DD.prototype.alignElWithMouse=function(el,_115,_116){var _117=this.getTargetCoord(_115,_116);var _118=[_117.x,_117.y];YAHOO.util.Dom.setXY(el,_118);this.cachePosition(_117.x,_117.y);this.autoScroll(_117.x,_117.y,el.offsetHeight,el.offsetWidth);};YAHOO.util.DD.prototype.cachePosition=function(_119,_120){if(_119){this.lastPageX=_119;this.lastPageY=_120;}else{var _121=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_121[0];this.lastPageY=_121[1];}};YAHOO.util.DD.prototype.autoScroll=function(x,y,h,w){if(this.scroll){var _124=this.DDM.getClientHeight();var _125=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _129=w+x;var _130=(_124+st-y-this.deltaY);var _131=(_125+sl-x-this.deltaX);var _132=40;var _133=(document.all)?80:30;if(bot>_124&&_130<_132){window.scrollTo(sl,st+_133);}if(y0&&y-st<_132){window.scrollTo(sl,st-_133);}if(_129>_125&&_131<_132){window.scrollTo(sl+_133,st);}if(x0&&x-sl<_132){window.scrollTo(sl-_133,st);}}};YAHOO.util.DD.prototype.getTargetCoord=function(_134,_135){var x=_134-this.deltaX;var y=_135-this.deltaY;if(this.constrainX){if(xthis.maxX){x=this.maxX;}}if(this.constrainY){if(ythis.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};};YAHOO.util.DD.prototype.b4MouseDown=function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DD.prototype.b4Drag=function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DDProxy=function(id,_136){if(id){this.forceCssPosition=false;this.init(id,_136);this.initFrame();}};YAHOO.util.DDProxy.prototype=new YAHOO.util.DD();YAHOO.util.DDProxy.frameDiv=null;YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.util.DDProxy.prototype.borderWidth=2;YAHOO.util.DDProxy.prototype.resizeFrame=true;YAHOO.util.DDProxy.prototype.centerFrame=false;YAHOO.util.DDProxy.createFrame=function(){var THIS=YAHOO.util.DDProxy;if(!document||!document.body){setTimeout(THIS.createFrame,50);return;}if(!THIS.frameDiv){THIS.frameDiv=document.createElement("div");THIS.frameDiv.id=THIS.dragElId;var s=THIS.frameDiv.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;document.body.appendChild(THIS.frameDiv);}};YAHOO.util.DDProxy.prototype.initFrame=function(){YAHOO.util.DDProxy.createFrame();this.setDragElId(YAHOO.util.DDProxy.dragElId);this.useAbsMath=true;};YAHOO.util.DDProxy.prototype.showFrame=function(_138,_139){var el=this.getEl();var s=this.getDragEl().style;if(this.resizeFrame){s.width=(parseInt(el.offsetWidth,10)-(2*this.borderWidth))+"px";s.height=(parseInt(el.offsetHeight,10)-(2*this.borderWidth))+"px";}if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.width,10)/2));}this.setDragElPos(_138,_139);s.visibility="";};YAHOO.util.DDProxy.prototype.b4MouseDown=function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);};YAHOO.util.DDProxy.prototype.b4StartDrag=function(x,y){this.showFrame(x,y);};YAHOO.util.DDProxy.prototype.b4EndDrag=function(e){var s=this.getDragEl().style;s.visibility="hidden";};YAHOO.util.DDProxy.prototype.endDrag=function(e){var lel=this.getEl();var del=this.getDragEl();del.style.visibility="";lel.style.visibility="hidden";YAHOO.util.DDM.moveToEl(lel,del);del.style.visibility="hidden";lel.style.visibility="";};YAHOO.util.DDTarget=function(id,_142){if(id){this.initTarget(id,_142);}};YAHOO.util.DDTarget.prototype=new YAHOO.util.DragDrop(); \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/event-min.js b/projekte/MDB/web-app/js/yahoo/event-min.js new file mode 100644 index 0000000..5ebcfbc --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/event-min.js @@ -0,0 +1 @@ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ YAHOO.util.CustomEvent=function(_1,_2){this.type=_1;this.scope=_2||window;this.subscribers=[];if(YAHOO.util.Event){YAHOO.util.Event.regCE(this);}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_4,_5){this.subscribers.push(new YAHOO.util.Subscriber(fn,_4,_5));},unsubscribe:function(fn,_6){var _7=false;for(var i=0,len=this.subscribers.length;i=0){_57=_15[_56];}if(!el||!_57){return false;}if(el.removeEventListener){el.removeEventListener(_55,_57[this.WFN],false);}else{if(el.detachEvent){el.detachEvent("on"+_55,_57[this.WFN]);}}delete _15[_56][this.WFN];delete _15[_56][this.FN];delete _15[_56];return true;},getTarget:function(ev,_59){var t=ev.target||ev.srcElement;if(_59&&t&&"#text"==t.nodeName){return t.parentNode;}else{return t;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return t;},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||((ev.type=="keypress")?ev.keyCode:0);},_getCacheIndex:function(el,_64,fn){for(var i=0,len=_15.length;i0);}var _69=[];for(var i=0,len=_16.length;i0){for(i=0,len=_15.length;i0){YAHOO.widget.MenuModule.superclass.constructor.call(this,_1,_2);}};YAHOO.widget.MenuModule.prototype=new YAHOO.widget.Overlay();YAHOO.widget.MenuModule.prototype.constructor=YAHOO.widget.MenuModule;YAHOO.widget.MenuModule.superclass=YAHOO.widget.Overlay.prototype;YAHOO.widget.MenuModule.prototype.CSS_CLASS_NAME="yuimenu";YAHOO.widget.MenuModule.prototype.ITEM_TYPE=null;YAHOO.widget.MenuModule.prototype.GROUP_TITLE_TAG_NAME="H6";YAHOO.widget.MenuModule.prototype._aGroupTitleElements=null;YAHOO.widget.MenuModule.prototype._aItemGroups=null;YAHOO.widget.MenuModule.prototype._aListElements=null;YAHOO.widget.MenuModule.prototype._oEventUtil=YAHOO.util.Event;YAHOO.widget.MenuModule.prototype._oDom=YAHOO.util.Dom;YAHOO.widget.MenuModule.prototype._oCurrentItem=null;YAHOO.widget.MenuModule.prototype._bFiredMouseOverEvent=false;YAHOO.widget.MenuModule.prototype._bFiredMouseOutEvent=false;YAHOO.widget.MenuModule.prototype.activeItem=null;YAHOO.widget.MenuModule.prototype.parent=null;YAHOO.widget.MenuModule.prototype.srcElement=null;YAHOO.widget.MenuModule.prototype.mouseOverEvent=null;YAHOO.widget.MenuModule.prototype.mouseOutEvent=null;YAHOO.widget.MenuModule.prototype.mouseDownEvent=null;YAHOO.widget.MenuModule.prototype.mouseUpEvent=null;YAHOO.widget.MenuModule.prototype.clickEvent=null;YAHOO.widget.MenuModule.prototype.keyPressEvent=null;YAHOO.widget.MenuModule.prototype.keyDownEvent=null;YAHOO.widget.MenuModule.prototype.keyUpEvent=null;YAHOO.widget.MenuModule.prototype.init=function(_3,_4){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuModuleItem;}this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];var _5;if(typeof _3=="string"){_5=document.getElementById(_3);}else{if(_3.tagName){_5=_3;}}if(_5){switch(_5.tagName){case "DIV":this.srcElement=_5;YAHOO.widget.MenuModule.superclass.init.call(this,_5);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);var _6=this.body.firstChild,i=0;do{switch(_6.tagName){case this.GROUP_TITLE_TAG_NAME:this._aGroupTitleElements[i]=_6;break;case "UL":this._aListElements[i]=_6;this._aItemGroups[i]=[];i++;break;}}while((_6=_6.nextSibling));if(this._aListElements[0]){this._oDom.addClass(this._aListElements[0],"first");}break;case "SELECT":this.srcElement=_5;var _7=this._oDom.generateId();YAHOO.widget.MenuModule.superclass.init.call(this,_7);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);break;}}else{YAHOO.widget.MenuModule.superclass.init.call(this,_3);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);}if(this.element){this._oDom.addClass(this.element,this.CSS_CLASS_NAME);this._oEventUtil.addListener(this.element,"mouseover",this._onElementMouseOver,this,true);this._oEventUtil.addListener(this.element,"mouseout",this._onElementMouseOut,this,true);this._oEventUtil.addListener(this.element,"mousedown",this._onDOMEvent,this,true);this._oEventUtil.addListener(this.element,"mouseup",this._onDOMEvent,this,true);this._oEventUtil.addListener(this.element,"click",this._onElementClick,this,true);this._oEventUtil.addListener(this.element,"keydown",this._onDOMEvent,this,true);this._oEventUtil.addListener(this.element,"keyup",this._onDOMEvent,this,true);this._oEventUtil.addListener(this.element,"keypress",this._onDOMEvent,this,true);var _8=YAHOO.util.CustomEvent;this.mouseOverEvent=new _8("mouseOverEvent",this);this.mouseOutEvent=new _8("mouseOutEvent",this);this.mouseDownEvent=new _8("mouseDownEvent",this);this.mouseUpEvent=new _8("mouseUpEvent",this);this.clickEvent=new _8("clickEvent",this);this.keyPressEvent=new _8("keyPressEvent",this);this.keyDownEvent=new _8("keyDownEvent",this);this.keyUpEvent=new _8("keyUpEvent",this);this.beforeRenderEvent.subscribe(this._onBeforeRender,this,true);this.renderEvent.subscribe(this._onRender,this,true);this.showEvent.subscribe(this._onShow,this,true);this.hideEvent.subscribe(this._onHide,this,true);if(_4){this.cfg.applyConfig(_4,true);}this.cfg.queueProperty("visible",false);if(this.srcElement){this._initSubTree();}}this.initEvent.fire(YAHOO.widget.MenuModule);};YAHOO.widget.MenuModule.prototype._getFirstEnabledItem=function(){var _9=this._aItemGroups.length,oItem,aItemGroup;for(var i=0;i<_9;i++){aItemGroup=this._aItemGroups[i];if(aItemGroup){var _b=aItemGroup.length;for(var n=0;n<_b;n++){oItem=aItemGroup[n];if(!oItem.cfg.getProperty("disabled")){return oItem;}oItem=null;}}}};YAHOO.widget.MenuModule.prototype._checkPosition=function(_d){if(typeof _d=="string"){var _e=_d.toLowerCase();return ("dynamic,static".indexOf(_e)!=-1);}};YAHOO.widget.MenuModule.prototype._addItemToGroup=function(_f,_10,_11){if(typeof _11=="number"){var _12=typeof _f=="number"?_f:0,aGroup=this._getItemGroup(_12);if(!aGroup){aGroup=this._createItemGroup(_12);}var _13=(_11>=aGroup.length);if(aGroup[_11]){aGroup.splice(_11,0,_10);}else{aGroup[_11]=_10;}var _14=aGroup[_11];if(_14){if(_13&&!_14.element.parentNode){this._aListElements[_12].appendChild(_14.element);}else{function getNextItemSibling(_15,_16){return (_15[_16]||getNextItemSibling(_15,(_16+1)));}var _17=getNextItemSibling(aGroup,(_11+1));if(_17&&!_14.element.parentNode){this._aListElements[_12].insertBefore(_14.element,_17.element);}}_14.parent=this;this._subscribeToItemEvents(_14);this._configureItemSubmenuModule(_14);this._updateItemProperties(_12);return _14;}}else{var _12=typeof _f=="number"?_f:0,aGroup=this._getItemGroup(_12);if(!aGroup){aGroup=this._createItemGroup(_12);}var _18=aGroup.length;aGroup[_18]=_10;var _14=aGroup[_18];if(_14){if(!this._oDom.isAncestor(this._aListElements[_12],_14.element)){this._aListElements[_12].appendChild(_14.element);}_14.element.setAttribute("groupindex",_12);_14.element.setAttribute("index",_18);_14.parent=this;_14.index=_18;_14.groupIndex=_12;this._subscribeToItemEvents(_14);this._configureItemSubmenuModule(_14);if(_18===0){this._oDom.addClass(_14.element,"first");}return _14;}}};YAHOO.widget.MenuModule.prototype._removeItemFromGroupByIndex=function(_19,_1a){var _1b=typeof _19=="number"?_19:0,aGroup=this._getItemGroup(_1b);if(aGroup){var _1c=aGroup.splice(_1a,1),oItem=_1c[0];if(oItem){this._updateItemProperties(_1b);if(aGroup.length===0){var oUL=this._aListElements[_1b];if(this.body&&oUL){this.body.removeChild(oUL);}this._aItemGroups.splice(_1b,1);this._aListElements.splice(_1b,1);oUL=this._aListElements[0];if(oUL){this._oDom.addClass(oUL,"first");}}return oItem;}}};YAHOO.widget.MenuModule.prototype._removeItemFromGroupByValue=function(_1e,_1f){var _20=this._getItemGroup(_1e);if(_20){var _21=_20.length,nItemIndex=-1;if(_21>0){var i=_21-1;do{if(_20[i]==_1f){nItemIndex=i;break;}}while(i--);if(nItemIndex>-1){return this._removeItemFromGroupByIndex(_1e,nItemIndex);}}}};YAHOO.widget.MenuModule.prototype._updateItemProperties=function(_23){var _24=this._getItemGroup(_23),nItems=_24.length;if(nItems>0){var i=nItems-1,oItem,oLI;do{oItem=_24[i];if(oItem){oLI=oItem.element;oItem.index=i;oItem.groupIndex=_23;oLI.setAttribute("groupindex",_23);oLI.setAttribute("index",i);this._oDom.removeClass(oLI,"first");}}while(i--);if(oLI){this._oDom.addClass(oLI,"first");}}};YAHOO.widget.MenuModule.prototype._createItemGroup=function(_26){if(!this._aItemGroups[_26]){this._aItemGroups[_26]=[];var oUL=document.createElement("ul");this._aListElements[_26]=oUL;return this._aItemGroups[_26];}};YAHOO.widget.MenuModule.prototype._getItemGroup=function(_28){var _29=((typeof _28=="number")?_28:0);return this._aItemGroups[_29];};YAHOO.widget.MenuModule.prototype._configureItemSubmenuModule=function(_2a){var _2b=_2a.cfg.getProperty("submenu");if(_2b){this.cfg.configChangedEvent.subscribe(this._onParentMenuModuleConfigChange,_2b,true);this.renderEvent.subscribe(this._onParentMenuModuleRender,_2b,true);_2b.beforeShowEvent.subscribe(this._onSubmenuBeforeShow,_2b,true);_2b.showEvent.subscribe(this._onSubmenuShow,_2b,true);_2b.hideEvent.subscribe(this._onSubmenuHide,_2b,true);}};YAHOO.widget.MenuModule.prototype._subscribeToItemEvents=function(_2c){var _2d=[this,_2c];_2c.focusEvent.subscribe(this._onItemFocus,_2d);_2c.blurEvent.subscribe(this._onItemBlur,_2d);_2c.cfg.configChangedEvent.subscribe(this._onItemConfigChange,_2d);};YAHOO.widget.MenuModule.prototype._getOffsetWidth=function(){var _2e=this.element.cloneNode(true);this._oDom.setStyle(_2e,"width","");document.body.appendChild(_2e);var _2f=_2e.offsetWidth;document.body.removeChild(_2e);return _2f;};YAHOO.widget.MenuModule.prototype._fireItemEvent=function(_30,_31,_32){var me=this;function getItemElement(_34){if(_34==me.element){return;}else{if(_34.tagName=="LI"){return _34;}else{if(_34.parentNode){return getItemElement(_34.parentNode);}}}}var _35=getItemElement(_30);if(_35){var _36=parseInt(_35.getAttribute("groupindex"),10),nIndex=parseInt(_35.getAttribute("index"),10),oItem=this._aItemGroups[_36][nIndex];if(!oItem.cfg.getProperty("disabled")){oItem[_31].fire(_32);return oItem;}}};YAHOO.widget.MenuModule.prototype._onDOMEvent=function(_37,_38){var _39={"mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent"},sCustomEventType=_39[_37.type],oTarget=this._oEventUtil.getTarget(_37,true);this._fireItemEvent(oTarget,sCustomEventType,_37);this[sCustomEventType].fire(_37);this._oEventUtil.stopPropagation(_37);};YAHOO.widget.MenuModule.prototype._onElementMouseOver=function(_3a,_3b){var _3c=this._oEventUtil.getTarget(_3a,true);if((_3c==this.element||this._oDom.isAncestor(this.element,_3c))&&!this._bFiredMouseOverEvent){this.mouseOverEvent.fire(_3a);this._bFiredMouseOverEvent=true;this._bFiredMouseOutEvent=false;}if(!this._oCurrentItem){this._oCurrentItem=this._fireItemEvent(_3c,"mouseOverEvent",_3a);}this._oEventUtil.stopPropagation(_3a);};YAHOO.widget.MenuModule.prototype._onElementMouseOut=function(_3d,_3e){var _3f=this._oEventUtil.getRelatedTarget(_3d),bLIMouseOut=true,bMovingToSubmenu=false;if(this._oCurrentItem&&_3f){if(_3f==this._oCurrentItem.element||this._oDom.isAncestor(this._oCurrentItem.element,_3f)){bLIMouseOut=false;}var _40=this._oCurrentItem.cfg.getProperty("submenu");if(_40&&(_3f==_40.element||this._oDom.isAncestor(_40.element,_3f))){bMovingToSubmenu=true;}}if(this._oCurrentItem&&(bLIMouseOut||bMovingToSubmenu)){this._oCurrentItem.mouseOutEvent.fire(_3d);this._oCurrentItem=null;}if(!this._bFiredMouseOutEvent&&(!this._oDom.isAncestor(this.element,_3f)||bMovingToSubmenu)){this.mouseOutEvent.fire(_3d);this._bFiredMouseOutEvent=true;this._bFiredMouseOverEvent=false;}this._oEventUtil.stopPropagation(_3d);};YAHOO.widget.MenuModule.prototype._onElementClick=function(_41,_42){var _43=this._oEventUtil.getTarget(_41,true),oItem=this._fireItemEvent(_43,"clickEvent",_41),bCurrentPageURL;if(oItem){var _44=oItem.cfg.getProperty("url"),oSubmenu=oItem.cfg.getProperty("submenu");bCurrentPageURL=(_44.substr((_44.length-1),1)=="#");if(_43==oItem.subMenuIndicator&&oSubmenu){if(oSubmenu.cfg.getProperty("visible")){oSubmenu.hide();}else{var _45=this.activeItem;if(_45&&_45!=this){this.clearActiveItem();}this.activeItem=oItem;oItem.cfg.setProperty("selected",true);oSubmenu.show();}}else{if(!bCurrentPageURL){document.location=_44;}}}switch(_43.tagName){case "A":if(bCurrentPageURL){this._oEventUtil.preventDefault(_41);}else{break;}default:this._oEventUtil.stopPropagation(_41);break;}this.clickEvent.fire(_41);};YAHOO.widget.MenuModule.prototype._initSubTree=function(){var _46;switch(this.srcElement.tagName){case "DIV":if(this._aListElements.length>0){var i=this._aListElements.length-1;do{_46=this._aListElements[i].firstChild;do{switch(_46.tagName){case "LI":this.addItem(new this.ITEM_TYPE(_46),i);break;}}while((_46=_46.nextSibling));}while(i--);}break;case "SELECT":_46=this.srcElement.firstChild;do{switch(_46.tagName){case "OPTGROUP":case "OPTION":this.addItem(new this.ITEM_TYPE(_46));break;}}while((_46=_46.nextSibling));break;}};YAHOO.widget.MenuModule.prototype._onBeforeRender=function(_48,_49,_4a){if(this.cfg.getProperty("position")=="static"){this.cfg.queueProperty("iframe",false);this.cfg.queueProperty("visible",true);}var _4b=this._aListElements.length;if(_4b>0){var i=0,bFirstList=true,oUL,oGroupTitle;do{oUL=this._aListElements[i];if(oUL){if(bFirstList){this._oDom.addClass(oUL,"first");bFirstList=false;}if(!this._oDom.isAncestor(this.element,oUL)){this.appendToBody(oUL);}oGroupTitle=this._aGroupTitleElements[i];if(oGroupTitle){if(!this._oDom.isAncestor(this.element,oGroupTitle)){oUL.parentNode.insertBefore(oGroupTitle,oUL);}this._oDom.addClass(oUL,"hastitle");}}i++;}while(i<_4b);}};YAHOO.widget.MenuModule.prototype._onRender=function(_4d,_4e,_4f){if(this.cfg.getProperty("position")=="dynamic"){var _50=this.element.parentNode.tagName=="BODY"?this.element.offsetWidth:this._getOffsetWidth();this.cfg.setProperty("width",(_50+"px"));}};YAHOO.widget.MenuModule.prototype._onShow=function(_51,_52,_53){this.setInitialFocus();};YAHOO.widget.MenuModule.prototype._onHide=function(_54,_55,_56){if(this.activeItem){if(this.activeItem.cfg.getProperty("selected")){this.activeItem.cfg.setProperty("selected",false);this.activeItem.blur();}var _57=this.activeItem.cfg.getProperty("submenu");if(_57&&_57.cfg.getProperty("visible")){_57.hide();}}};YAHOO.widget.MenuModule.prototype._onParentMenuModuleConfigChange=function(_58,_59,_5a){var _5b=_59[0][0],oPropertyValue=_59[0][1];switch(_5b){case "iframe":case "constraintoviewport":case "submenualignment":_5a.cfg.setProperty(_5b,oPropertyValue);break;}};YAHOO.widget.MenuModule.prototype._onParentMenuModuleRender=function(_5c,_5d,_5e){var _5f=_5e.parent.parent;_5e.cfg.applyConfig({constraintoviewport:_5f.cfg.getProperty("constraintoviewport"),xy:[0,0],iframe:_5f.cfg.getProperty("iframe")});if(this._oDom.inDocument(this.element)){this.render();}else{this.render(this.parent.element);}};YAHOO.widget.MenuModule.prototype._onSubmenuBeforeShow=function(_60,_61,_62){var _63=this.parent.parent.cfg.getProperty("submenualignment");this.cfg.setProperty("submenualignment",[_63[0],_63[1]]);this.cfg.setProperty("context",[this.parent.element,_63[0],_63[1]]);this.parent.subMenuIndicator.alt=this.parent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onSubmenuShow=function(_64,_65,_66){this.parent.subMenuIndicator.alt=this.parent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onSubmenuHide=function(_67,_68,_69){if(this.parent.parent.cfg.getProperty("visible")){this.parent.cfg.setProperty("selected",false);this.parent.focus();}this.parent.subMenuIndicator.alt=this.parent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onItemFocus=function(_6a,_6b,_6c){var me=_6c[0],oItem=_6c[1];me.activeItem=oItem;};YAHOO.widget.MenuModule.prototype._onItemBlur=function(_6e,_6f,_70){var me=_70[0],oItem=_70[1],oSubmenu=oItem.cfg.getProperty("submenu");if(!oSubmenu||(oSubmenu&&!oSubmenu.cfg.getProperty("visible"))){me.activeItem=null;}};YAHOO.widget.MenuModule.prototype._onItemConfigChange=function(_72,_73,_74){var _75=_73[0][0],me=_74[0],oItem=_74[1];switch(_75){case "submenu":var _76=_73[0][1];if(_76){me._configureItemSubmenuModule(oItem);}break;case "text":case "helptext":if(me.element.style.width){var _77=me._getOffsetWidth()+"px";me._oDom.setStyle(me.element,"width",_77);}break;}};YAHOO.widget.MenuModule.prototype.enforceConstraints=function(_78,_79,obj){var pos=_79[0],x=pos[0],y=pos[1],bod=document.getElementsByTagName("body")[0],htm=document.getElementsByTagName("html")[0],bodyOverflow=YAHOO.util.Dom.getStyle(bod,"overflow"),htmOverflow=YAHOO.util.Dom.getStyle(htm,"overflow"),offsetHeight=this.element.offsetHeight,offsetWidth=this.element.offsetWidth,viewPortWidth=YAHOO.util.Dom.getClientWidth(),viewPortHeight=YAHOO.util.Dom.getClientHeight(),scrollX=window.scrollX||document.body.scrollLeft,scrollY=window.scrollY||document.body.scrollTop,topConstraint=scrollY+10,leftConstraint=scrollX+10,bottomConstraint=scrollY+viewPortHeight-offsetHeight-10,rightConstraint=scrollX+viewPortWidth-offsetWidth-10,aContext=this.cfg.getProperty("context"),oContextElement=aContext?aContext[0]:null;if(x<10){x=leftConstraint;}else{if((x+offsetWidth)>viewPortWidth){if(oContextElement&&((x-oContextElement.offsetWidth)>offsetWidth)){x=(x-(oContextElement.offsetWidth+offsetWidth));}else{x=rightConstraint;}}}if(y<10){y=topConstraint;}else{if(y>bottomConstraint){if(oContextElement&&(y>offsetHeight)){y=((y+oContextElement.offsetHeight)-offsetHeight);}else{y=bottomConstraint;}}}this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);};YAHOO.widget.MenuModule.prototype.configPosition=function(_7c,_7d,_7e){var _7f=_7d[0]=="static"?"static":"absolute";this._oDom.setStyle(this.element,"position",_7f);};YAHOO.widget.MenuModule.prototype.setItemGroupTitle=function(_80,_81){if(typeof _80=="string"&&_80.length>0){var _82=typeof _81=="number"?_81:0,oTitle=this._aGroupTitleElements[_82];if(oTitle){oTitle.innerHTML=_80;}else{oTitle=document.createElement(this.GROUP_TITLE_TAG_NAME);oTitle.innerHTML=_80;this._aGroupTitleElements[_82]=oTitle;}var i=this._aGroupTitleElements.length-1,nFirstIndex;do{if(this._aGroupTitleElements[i]){this._oDom.removeClass(this._aGroupTitleElements[i],"first");nFirstIndex=i;}}while(i--);if(nFirstIndex!==null){this._oDom.addClass(this._aGroupTitleElements[nFirstIndex],"first");}}};YAHOO.widget.MenuModule.prototype.addItem=function(_84,_85){if(_84&&_84 instanceof YAHOO.widget.MenuModuleItem){return this._addItemToGroup(_85,_84);}};YAHOO.widget.MenuModule.prototype.insertItem=function(_86,_87,_88){if(_86&&_86 instanceof YAHOO.widget.MenuModuleItem){return this._addItemToGroup(_88,_86,_87);}};YAHOO.widget.MenuModule.prototype.removeItem=function(_89,_8a){if(typeof _89!="undefined"){var _8b;if(_89 instanceof YAHOO.widget.MenuModuleItem){_8b=this._removeItemFromGroupByValue(_8a,_89);}else{if(typeof _89=="number"){_8b=this._removeItemFromGroupByIndex(_8a,_89);}}if(_8b){_8b.destroy();return _8b;}}};YAHOO.widget.MenuModule.prototype.getItemGroups=function(){return this._aItemGroups;};YAHOO.widget.MenuModule.prototype.getItem=function(_8c,_8d){if(typeof _8c=="number"){var _8e=this._getItemGroup(_8d);if(_8e){return _8e[_8c];}}};YAHOO.widget.MenuModule.prototype.destroy=function(){this._oEventUtil.removeListener(this.element,"mouseover",this._onElementMouseOver);this._oEventUtil.removeListener(this.element,"mouseout",this._onElementMouseOut);this._oEventUtil.removeListener(this.element,"click",this._onElementClick);this._oEventUtil.removeListener(this.element,"mousedown",this._onDOMEvent);this._oEventUtil.removeListener(this.element,"mouseup",this._onDOMEvent);this._oEventUtil.removeListener(this.element,"keydown",this._onDOMEvent);this._oEventUtil.removeListener(this.element,"keyup",this._onDOMEvent);this._oEventUtil.removeListener(this.element,"keypress",this._onDOMEvent);this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.beforeMoveEvent.unsubscribeAll();var _8f=this._aItemGroups.length,nItems,i,n;if(_8f>0){i=_8f-1;do{if(this._aItemGroups[i]){nItems=this._aItemGroups[i].length;if(nItems>0){n=nItems-1;do{if(this._aItemGroups[i][n]){this._aItemGroups[i][n].destroy();}}while(n--);}}}while(i--);}YAHOO.widget.MenuModule.superclass.destroy.call(this);};YAHOO.widget.MenuModule.prototype.setInitialFocus=function(){var _90=this._getFirstEnabledItem();if(_90){_90.focus();}};YAHOO.widget.MenuModule.prototype.setInitialSelection=function(){var _91=this._getFirstEnabledItem();if(_91){_91.cfg.setProperty("selected",true);}};YAHOO.widget.MenuModule.prototype.clearActiveItem=function(){var _92=this.activeItem;if(_92){_92.cfg.setProperty("selected",false);var _93=_92.cfg.getProperty("submenu");if(_93){_93.hide();}}};YAHOO.widget.MenuModule.prototype.initDefaultConfig=function(){YAHOO.widget.MenuModule.superclass.initDefaultConfig.call(this);this.cfg.addProperty("position",{value:"dynamic",handler:this.configPosition,validator:this._checkPosition});this.cfg.refireEvent("position");this.cfg.addProperty("submenualignment",{value:["tl","tr"]});};YAHOO.widget.MenuModuleItem=function(_94,_95){if(_94){this.init(_94,_95);}};YAHOO.widget.MenuModuleItem.prototype={SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght9_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght9_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght9_dim_1.gif",COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT:"Collapsed. Click to expand.",EXPANDED_SUBMENU_INDICATOR_ALT_TEXT:"Expanded. Click to collapse.",DISABLED_SUBMENU_INDICATOR_ALT_TEXT:"Disabled.",CSS_CLASS_NAME:"yuimenuitem",SUBMENU_TYPE:null,SUBMENU_ITEM_TYPE:null,_oAnchor:null,_oText:null,_oHelpTextEM:null,_oSubmenu:null,_oDom:YAHOO.util.Dom,_sUserAgent:window.navigator.userAgent.toLowerCase(),constructor:YAHOO.widget.MenuModuleItem,imageRoot:YAHOO.widget.Module.IMG_ROOT,isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;return true;}else{return false;}}(),index:null,groupIndex:null,parent:null,element:null,srcElement:null,value:null,subMenuIndicator:null,browser:function(){var _96=navigator.userAgent.toLowerCase();if(_96.indexOf("opera")!=-1){return "opera";}else{if(_96.indexOf("msie 7")!=-1){return "ie7";}else{if(_96.indexOf("msie")!=-1){return "ie";}else{if(_96.indexOf("safari")!=-1){return "safari";}else{if(_96.indexOf("gecko")!=-1){return "gecko";}else{return false;}}}}}}(),destroyEvent:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,focusEvent:null,blurEvent:null,init:function(_97,_98){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.MenuModule;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuModuleItem;}this.cfg=new YAHOO.util.Config(this);this.cfg.addProperty("text",{value:"",handler:this.configText,validator:this._checkString,suppressEvent:true});this.cfg.addProperty("helptext",{handler:this.configHelpText});this.cfg.addProperty("url",{value:"#",handler:this.configURL,suppressEvent:true});this.cfg.addProperty("emphasis",{value:false,handler:this.configEmphasis,validator:this.cfg.checkBoolean,suppressEvent:true});this.cfg.addProperty("strongemphasis",{value:false,handler:this.configStrongEmphasis,validator:this.cfg.checkBoolean,suppressEvent:true});this.cfg.addProperty("disabled",{value:false,handler:this.configDisabled,validator:this.cfg.checkBoolean,suppressEvent:true});this.cfg.addProperty("selected",{value:false,handler:this.configSelected,validator:this.cfg.checkBoolean,suppressEvent:true});this.cfg.addProperty("submenu",{handler:this.configSubmenu});if(this._checkString(_97)){this._createRootNodeStructure();this.cfg.setProperty("text",_97);}else{if(this._checkDOMNode(_97)){switch(_97.tagName){case "OPTION":this._createRootNodeStructure();this.cfg.setProperty("text",_97.text);this.srcElement=_97;break;case "OPTGROUP":this._createRootNodeStructure();this.cfg.setProperty("text",_97.label);this.srcElement=_97;this._initSubTree();break;case "LI":var _99=this._getFirstElement(_97,"A"),sURL=null,sText=null;if(_99){sURL=_99.getAttribute("href");if(_99.innerText){sText=_99.innerText;}else{var _9a=_99.ownerDocument.createRange();_9a.selectNodeContents(_99);sText=_9a.toString();}}else{var _9b=_97.firstChild;sText=_9b.nodeValue;_99=document.createElement("a");_97.replaceChild(_99,_9b);_99.appendChild(_9b);}this.srcElement=_97;this.element=_97;this._oAnchor=_99;var _9c=this._getFirstElement(_99),bEmphasis=false,bStrongEmphasis=false;if(_9c){this._oText=_9c.firstChild;switch(_9c.tagName){case "EM":bEmphasis=true;break;case "STRONG":bStrongEmphasis=true;break;}}else{this._oText=_99.firstChild;}this.cfg.setProperty("text",sText,true);this.cfg.setProperty("url",sURL,true);this.cfg.setProperty("emphasis",bEmphasis,true);this.cfg.setProperty("strongemphasis",bStrongEmphasis,true);this._initSubTree();break;}}}if(this.element){this._oDom.addClass(this.element,this.CSS_CLASS_NAME);var _9d=YAHOO.util.CustomEvent;this.destroyEvent=new _9d("destroyEvent",this);this.mouseOverEvent=new _9d("mouseOverEvent",this);this.mouseOutEvent=new _9d("mouseOutEvent",this);this.mouseDownEvent=new _9d("mouseDownEvent",this);this.mouseUpEvent=new _9d("mouseUpEvent",this);this.clickEvent=new _9d("clickEvent",this);this.keyPressEvent=new _9d("keyPressEvent",this);this.keyDownEvent=new _9d("keyDownEvent",this);this.keyUpEvent=new _9d("keyUpEvent",this);this.focusEvent=new _9d("focusEvent",this);this.blurEvent=new _9d("blurEvent",this);if(_98){this.cfg.applyConfig(_98);}this.cfg.fireQueue();}},_getFirstElement:function(_9e,_9f){var _a0;if(_9e.firstChild&&_9e.firstChild.nodeType==1){_a0=_9e.firstChild;}else{if(_9e.firstChild&&_9e.firstChild.nextSibling&&_9e.firstChild.nextSibling.nodeType==1){_a0=_9e.firstChild.nextSibling;}}if(_9f){return (_a0&&_a0.tagName==_9f)?_a0:false;}return _a0;},_checkString:function(_a1){return (typeof _a1=="string");},_checkDOMNode:function(_a2){return (_a2&&_a2.tagName);},_createRootNodeStructure:function(){this.element=document.createElement("li");this._oText=document.createTextNode("");this._oAnchor=document.createElement("a");this._oAnchor.appendChild(this._oText);this.cfg.refireEvent("url");this.element.appendChild(this._oAnchor);},_initSubTree:function(){var _a3=this.SUBMENU_TYPE,MenuModuleItem=this.SUBMENU_ITEM_TYPE;if(this.srcElement.childNodes.length>0){var _a4=this.srcElement.firstChild,aOptions=[];do{switch(_a4.tagName){case "DIV":this.cfg.setProperty("submenu",(new _a3(_a4)));break;case "OPTION":aOptions[aOptions.length]=_a4;break;}}while((_a4=_a4.nextSibling));var _a5=aOptions.length;if(_a5>0){this.cfg.setProperty("submenu",(new _a3(this._oDom.generateId())));for(var n=0;n<_a5;n++){this._oSubmenu.addItem((new MenuModuleItem(aOptions[n])));}}}},configText:function(_a7,_a8,_a9){var _aa=_a8[0];if(this._oText){this._oText.nodeValue=_aa;}},configHelpText:function(_ab,_ac,_ad){var _ae=_ac[0],aNodes=[this.element,this._oAnchor],me=this;function initHelpText(){me._oDom.addClass(aNodes,"hashelptext");if(me.cfg.getProperty("disabled")){me.cfg.refireEvent("disabled");}if(me.cfg.getProperty("selected")){me.cfg.refireEvent("selected");}}function removeHelpText(){me._oDom.removeClass(aNodes,"hashelptext");me.element.removeChild(me._oHelpTextEM);me._oHelpTextEM=null;}if(this._checkDOMNode(_ae)){if(this._oHelpTextEM){var _af=this._oHelpTextEM.parentNode;_af.replaceChild(_ae,this._oHelpTextEM);}else{this._oHelpTextEM=_ae;this.element.insertBefore(this._oHelpTextEM,this.subMenuIndicator);}initHelpText();}else{if(this._checkString(_ae)){if(_ae.length===0){removeHelpText();}else{if(!this._oHelpTextEM){this._oHelpTextEM=document.createElement("em");this.element.insertBefore(this._oHelpTextEM,this.subMenuIndicator);}this._oHelpTextEM.innerHTML=_ae;initHelpText();}}else{if(!_ae&&this._oHelpTextEM){removeHelpText();}}}},configURL:function(_b0,_b1,_b2){var _b3=_b1[0];if(!_b3){_b3="#";}this._oAnchor.setAttribute("href",_b3);},configEmphasis:function(_b4,_b5,_b6){var _b7=_b5[0];if(_b7&&this.cfg.getProperty("strongemphasis")){this.cfg.setProperty("strongemphasis",false);}if(this._oAnchor){var oEM;if(_b7){oEM=document.createElement("em");oEM.appendChild(this._oText);this._oAnchor.appendChild(oEM);}else{oEM=this._getFirstElement(this._oAnchor,"EM");this._oAnchor.removeChild(oEM);this._oAnchor.appendChild(this._oText);}}},configStrongEmphasis:function(_b9,_ba,_bb){var _bc=_ba[0];if(_bc&&this.cfg.getProperty("emphasis")){this.cfg.setProperty("emphasis",false);}if(this._oAnchor){var _bd;if(_bc){_bd=document.createElement("strong");_bd.appendChild(this._oText);this._oAnchor.appendChild(_bd);}else{_bd=this._getFirstElement(this._oAnchor,"STRONG");this._oAnchor.removeChild(_bd);this._oAnchor.appendChild(this._oText);}}},configDisabled:function(_be,_bf,_c0){var _c1=_bf[0],aNodes=[this.element,this._oAnchor],sImageId,sImageAlt;if(this._oHelpTextEM){aNodes[2]=this._oHelpTextEM;}if(_c1){if(this.cfg.getProperty("selected")){this.cfg.setProperty("selected",false);}this._oAnchor.removeAttribute("href");this._oDom.addClass(aNodes,"disabled");sImageId="yuidisabledsubmenuindicator";sImageAlt=this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;}else{this._oAnchor.setAttribute("href",this.cfg.getProperty("url"));this._oDom.removeClass(aNodes,"disabled");sImageId="yuisubmenuindicator";sImageAlt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;}if(this.subMenuIndicator){this.subMenuIndicator.src=document.getElementById(sImageId).src;this.subMenuIndicator.alt=sImageAlt;}},configSelected:function(_c2,_c3,_c4){var _c5=_c3[0],aNodes=[this.element,this._oAnchor],sImageId;if(this._oHelpTextEM){aNodes[2]=this._oHelpTextEM;}if(_c5){this._oDom.addClass(aNodes,"selected");sImageId="yuiselectedsubmenuindicator";}else{this._oDom.removeClass(aNodes,"selected");sImageId="yuisubmenuindicator";}if(this.subMenuIndicator){this.subMenuIndicator.src=document.getElementById(sImageId).src;}},configSubmenu:function(_c6,_c7,_c8){var _c9=_c7[0],aNodes=[this.element,this._oAnchor];if(_c9){_c9.parent=this;this._oSubmenu=_c9;if(!this.subMenuIndicator){var _ca=document.getElementById("yuisubmenuindicator");if(!_ca){_ca=document.createElement("img");_ca.src=(this.imageRoot+this.SUBMENU_INDICATOR_IMAGE_PATH);_ca.alt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;_ca.id="yuisubmenuindicator";var _cb=document.createElement("img");_cb.src=(this.imageRoot+this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);_cb.id="yuiselectedsubmenuindicator";var _cc=document.createElement("img");_cc.src=(this.imageRoot+this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);_cc.id="yuidisabledsubmenuindicator";var _cd=document.createElement("div");_cd.style.position="absolute";_cd.style.left="-1000px";_cd.appendChild(_ca);_cd.appendChild(_cb);_cd.appendChild(_cc);document.body.appendChild(_cd);}var _ce=_ca.cloneNode(false);_ce.removeAttribute("id");this.subMenuIndicator=_ce;this.element.appendChild(this.subMenuIndicator);this._oDom.addClass(aNodes,"hassubmenu");if(this.cfg.getProperty("disabled")){this.cfg.refireEvent("disabled");}if(this.cfg.getProperty("selected")){this.cfg.refireEvent("selected");}}}else{this._oDom.removeClass(aNodes,"hassubmenu");if(this.subMenuIndicator){this.element.removeChild(this.subMenuIndicator);}if(this._oSubmenu){this._oSubmenu.destroy();}}},getNextEnabledSibling:function(){if(this.parent instanceof YAHOO.widget.MenuModule){function getNextArrayItem(_cf,_d0){return _cf[_d0]||getNextArrayItem(_cf,(_d0+1));}var _d1=this.parent.getItemGroups(),oNextItem;if(this.index<(_d1[this.groupIndex].length-1)){oNextItem=getNextArrayItem(_d1[this.groupIndex],(this.index+1));}else{var _d2;if(this.groupIndex<(_d1.length-1)){_d2=this.groupIndex+1;}else{_d2=0;}var _d3=getNextArrayItem(_d1,_d2);oNextItem=getNextArrayItem(_d3,0);}return oNextItem.cfg.getProperty("disabled")?oNextItem.getNextEnabledSibling():oNextItem;}},getPreviousEnabledSibling:function(){if(this.parent instanceof YAHOO.widget.MenuModule){function getPreviousArrayItem(_d4,_d5){return _d4[_d5]||getPreviousArrayItem(_d4,(_d5-1));}function getFirstItemIndex(_d6,_d7){return _d6[_d7]?_d7:getFirstItemIndex(_d6,(_d7+1));}var _d8=this.parent.getItemGroups(),oPreviousItem;if(this.index>getFirstItemIndex(_d8[this.groupIndex],0)){oPreviousItem=getPreviousArrayItem(_d8[this.groupIndex],(this.index-1));}else{var _d9;if(this.groupIndex>getFirstItemIndex(_d8,0)){_d9=this.groupIndex-1;}else{_d9=_d8.length-1;}var _da=getPreviousArrayItem(_d8,_d9);oPreviousItem=getPreviousArrayItem(_da,(_da.length-1));}return oPreviousItem.cfg.getProperty("disabled")?oPreviousItem.getPreviousEnabledSibling():oPreviousItem;}},focus:function(){if(!this.cfg.getProperty("disabled")&&this.parent&&this.parent.cfg.getProperty("visible")){var _db=this.parent.activeItem;if(_db){_db.blur();}this._oAnchor.focus();if(this.parent&&this.parent.browser=="opera"&&this._oSubmenu){this._oAnchor.focus();}this.focusEvent.fire();}},blur:function(){if(!this.cfg.getProperty("disabled")&&this.parent&&this.parent.cfg.getProperty("visible")){this._oAnchor.blur();this.blurEvent.fire();}},destroy:function(){if(this.element){this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.focusEvent.unsubscribeAll();this.blurEvent.unsubscribeAll();this.cfg.configChangedEvent.unsubscribeAll();var _dc=this.element.parentNode;if(_dc){_dc.removeChild(this.element);this.destroyEvent.fire();}this.destroyEvent.unsubscribeAll();}}};YAHOO.widget.Menu=function(_dd,_de){if(arguments.length>0){YAHOO.widget.Menu.superclass.constructor.call(this,_dd,_de);}};YAHOO.widget.Menu.prototype=new YAHOO.widget.MenuModule();YAHOO.widget.Menu.prototype.constructor=YAHOO.widget.Menu;YAHOO.widget.Menu.superclass=YAHOO.widget.MenuModule.prototype;YAHOO.widget.Menu.prototype.init=function(_df,_e0){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.Menu.superclass.init.call(this,_df);this.beforeInitEvent.fire(YAHOO.widget.Menu);this.mouseOverEvent.subscribe(this._onMouseOver,this,true);this.keyDownEvent.subscribe(this._onKeyDown,this,true);if(_e0){this.cfg.applyConfig(_e0,true);}this.initEvent.fire(YAHOO.widget.Menu);};YAHOO.widget.Menu.prototype._onMouseOver=function(_e1,_e2,_e3){if(this.parent){this.parent.cfg.setProperty("selected",true);}};YAHOO.widget.Menu.prototype._onKeyDown=function(_e4,_e5,_e6){if(this.cfg.getProperty("position")=="dynamic"){var _e7=_e5[0];if(_e7.keyCode==27){this.hide();if(this.parent){this.parent.focus();if(this.parent.parent instanceof YAHOO.widget.Menu){this.parent.cfg.setProperty("selected",true);}}}}};YAHOO.widget.MenuItem=function(_e8,_e9){if(_e8){YAHOO.widget.MenuItem.superclass.constructor.call(this,_e8,_e9);}};YAHOO.widget.MenuItem.prototype=new YAHOO.widget.MenuModuleItem();YAHOO.widget.MenuItem.prototype.constructor=YAHOO.widget.MenuItem;YAHOO.widget.MenuItem.superclass=YAHOO.widget.MenuModuleItem.prototype;YAHOO.widget.MenuItem.prototype.init=function(_ea,_eb){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.MenuItem.superclass.init.call(this,_ea);this.keyDownEvent.subscribe(this._onKeyDown,this,true);this.mouseOverEvent.subscribe(this._onMouseOver,this,true);this.mouseOutEvent.subscribe(this._onMouseOut,this,true);if(_eb){this.cfg.applyConfig(_eb,true);}this.cfg.fireQueue();};YAHOO.widget.MenuItem.prototype._onKeyDown=function(_ec,_ed,_ee){var _ef=_ed[0];switch(_ef.keyCode){case 38:case 40:var _f0=this.parent.activeItem;if(this==_f0&&!this.cfg.getProperty("selected")){this.cfg.setProperty("selected",true);}else{var _f1=(_ef.keyCode==38)?this.getPreviousEnabledSibling():this.getNextEnabledSibling();if(_f1){this.parent.clearActiveItem();_f1.cfg.setProperty("selected",true);_f1.focus();}}YAHOO.util.Event.preventDefault(_ef);break;case 39:this.parent.clearActiveItem();this.cfg.setProperty("selected",true);this.focus();var _f2=this.cfg.getProperty("submenu");if(_f2){_f2.show();_f2.setInitialSelection();}else{if(YAHOO.widget.MenuBarItem&&this.parent.parent&&this.parent.parent instanceof YAHOO.widget.MenuBarItem){this.parent.hide();var _f3=this.parent.parent;if(_f3){_f3.focus();_f3.cfg.setProperty("selected",true);}}}YAHOO.util.Event.preventDefault(_ef);break;case 37:if(this.parent.parent){this.parent.hide();var _f3=this.parent.parent;if(_f3){_f3.focus();_f3.cfg.setProperty("selected",true);}}YAHOO.util.Event.preventDefault(_ef);break;}};YAHOO.widget.MenuItem.prototype._onMouseOver=function(_f4,_f5,_f6){var _f7=this.parent.activeItem;if(_f7&&_f7!=this){this.parent.clearActiveItem();}this.cfg.setProperty("selected",true);this.focus();var _f8=this.cfg.getProperty("submenu");if(_f8){_f8.show();}};YAHOO.widget.MenuItem.prototype._onMouseOut=function(_f9,_fa,_fb){this.cfg.setProperty("selected",false);var _fc=this.cfg.getProperty("submenu");if(_fc){var _fd=_fa[0],oRelatedTarget=YAHOO.util.Event.getRelatedTarget(_fd);if(!(oRelatedTarget==_fc.element||this._oDom.isAncestor(_fc.element,oRelatedTarget))){_fc.hide();}}};YAHOO.widget.ContextMenu=function(_fe,_ff){if(arguments.length>0){YAHOO.widget.ContextMenu.superclass.constructor.call(this,_fe,_ff);}};YAHOO.widget.ContextMenu.prototype=new YAHOO.widget.Menu();YAHOO.widget.ContextMenu.prototype.constructor=YAHOO.widget.ContextMenu;YAHOO.widget.ContextMenu.superclass=YAHOO.widget.Menu.prototype;YAHOO.widget.ContextMenu.prototype.init=function(_100,_101){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.ContextMenuItem;}YAHOO.widget.ContextMenu.superclass.init.call(this,_100);this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);if(_101){this.cfg.applyConfig(_101,true);}this.initEvent.fire(YAHOO.widget.ContextMenu);};YAHOO.widget.ContextMenu.prototype._onDocumentMouseDown=function(_102,_103){var _104=this._oEventUtil.getTarget(_102,true);if(_104!=this._oTargetElement||!this._oDom.isAncestor(this._oTargetElement,_104)){this.hide();}};YAHOO.widget.ContextMenu.prototype._onTriggerClick=function(_105,_106){if(_105.ctrlKey){this._oEventUtil.stopEvent(_105);}};YAHOO.widget.ContextMenu.prototype._onTriggerContextMenu=function(_107,_108){if(_107.type=="mousedown"){if(!_107.ctrlKey){return;}this._oEventUtil.stopEvent(_107);}this.contextEventTarget=this._oEventUtil.getTarget(_107,true);var nX=this._oEventUtil.getPageX(_107),nY=this._oEventUtil.getPageY(_107);this.cfg.applyConfig({x:nX,y:nY,visible:true});this.cfg.fireQueue();this._oEventUtil.preventDefault(_107);};YAHOO.widget.ContextMenu.prototype.contextEventTarget=null;YAHOO.widget.ContextMenu.prototype.initDefaultConfig=function(){YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);this.cfg.addProperty("trigger",{handler:this.configTrigger});};YAHOO.widget.ContextMenu.prototype.configTrigger=function(_10a,_10b,_10c){var _10d=_10b[0];if(_10d){var _10e=(this.browser=="opera");var _10f=_10e?"mousedown":"contextmenu";this._oEventUtil.addListener(_10d,_10f,this._onTriggerContextMenu,this,true);if(_10e){this._oEventUtil.addListener(_10d,"click",this._onTriggerClick,this,true);}this._oEventUtil.addListener(document,"mousedown",this._onDocumentMouseDown,this,true);}};YAHOO.widget.ContextMenuItem=function(_110,_111){if(_110){YAHOO.widget.ContextMenuItem.superclass.constructor.call(this,_110,_111);}};YAHOO.widget.ContextMenuItem.prototype=new YAHOO.widget.MenuItem();YAHOO.widget.ContextMenuItem.prototype.constructor=YAHOO.widget.ContextMenuItem;YAHOO.widget.ContextMenuItem.superclass=YAHOO.widget.MenuItem.prototype;YAHOO.widget.ContextMenuItem.prototype.init=function(_112,_113){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.ContextMenu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.ContextMenuItem;}YAHOO.widget.ContextMenuItem.superclass.init.call(this,_112);if(_113){this.cfg.applyConfig(_113,true);}this.cfg.fireQueue();};YAHOO.widget.MenuBar=function(_114,_115){if(arguments.length>0){YAHOO.widget.MenuBar.superclass.constructor.call(this,_114,_115);}};YAHOO.widget.MenuBar.prototype=new YAHOO.widget.MenuModule();YAHOO.widget.MenuBar.prototype.constructor=YAHOO.widget.MenuBar;YAHOO.widget.MenuBar.superclass=YAHOO.widget.MenuModule.prototype;YAHOO.widget.MenuBar.prototype.init=function(_116,_117){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuBarItem;}YAHOO.widget.MenuBar.superclass.init.call(this,_116);this.beforeInitEvent.fire(YAHOO.widget.MenuBar);if(!_117||(_117&&!_117.position)){this.cfg.queueProperty("position","static");}if(!_117||(_117&&!_117.submenualignment)){this.cfg.queueProperty("submenualignment",["tl","bl"]);}if(_117){this.cfg.applyConfig(_117,true);}this.initEvent.fire(YAHOO.widget.MenuBar);};YAHOO.widget.MenuBar.prototype.CSS_CLASS_NAME="yuimenubar";YAHOO.widget.MenuBarItem=function(_118,_119){if(_118){YAHOO.widget.MenuBarItem.superclass.constructor.call(this,_118,_119);}};YAHOO.widget.MenuBarItem.prototype=new YAHOO.widget.MenuModuleItem();YAHOO.widget.MenuBarItem.prototype.constructor=YAHOO.widget.MenuBarItem;YAHOO.widget.MenuBarItem.superclass=YAHOO.widget.MenuModuleItem.prototype;YAHOO.widget.MenuBarItem.prototype.init=function(_11a,_11b){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.MenuBarItem.superclass.init.call(this,_11a);this.keyDownEvent.subscribe(this._onKeyDown,this,true);if(_11b){this.cfg.applyConfig(_11b,true);}this.cfg.fireQueue();};YAHOO.widget.MenuBarItem.prototype.CSS_CLASS_NAME="yuimenubaritem";YAHOO.widget.MenuBarItem.prototype.SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/bsc/menuarodwn9_nrm_1.gif";YAHOO.widget.MenuBarItem.prototype.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/bsc/menuarodwn9_clk_1.gif";YAHOO.widget.MenuBarItem.prototype.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/bsc/menuarodwn9_dim_1.gif";YAHOO.widget.MenuBarItem.prototype._onKeyDown=function(_11c,_11d,_11e){var _11f=_11d[0];switch(_11f.keyCode){case 37:case 39:var _120=this.parent.activeItem;if(this==_120&&!this.cfg.getProperty("selected")){this.cfg.setProperty("selected",true);}else{var _121=(_11f.keyCode==37)?this.getPreviousEnabledSibling():this.getNextEnabledSibling();if(_121){this.parent.clearActiveItem();_121.cfg.setProperty("selected",true);_121.focus();}}YAHOO.util.Event.preventDefault(_11f);break;case 40:this.parent.clearActiveItem();this.cfg.setProperty("selected",true);this.focus();var _122=this.cfg.getProperty("submenu");if(_122){_122.show();_122.setInitialSelection();}YAHOO.util.Event.preventDefault(_11f);break;}}; \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/slider-min.js b/projekte/MDB/web-app/js/yahoo/slider-min.js new file mode 100644 index 0000000..2090f79 --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/slider-min.js @@ -0,0 +1 @@ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ YAHOO.widget.Slider=function(_1,_2,_3){if(_1){this.init(_1,_2,true);var _4=this;this.thumb=_3;_3.onChange=function(){_4.onThumbChange();};this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.tickPause=40;if(_3._isHoriz&&_3.xTicks&&_3.xTicks.length){this.tickPause=Math.round(360/_3.xTicks.length);}else{if(_3.yTicks&&_3.yTicks.length){this.tickPause=Math.round(360/_3.yTicks.length);}}_3.onMouseDown=function(){return _4.focus();};_3.b4MouseDown=function(){return _4.b4MouseDown();};_3.onMouseUp=function(){_4.onMouseUp();};_3.onDrag=function(){_4.fireEvents();};_3.onAvailable=function(){return _4.setStartSliderState();};}};YAHOO.widget.Slider.prototype=new YAHOO.util.DragDrop();YAHOO.widget.Slider.getHorizSlider=function(_5,_6,_7,_8,_9){return new YAHOO.widget.Slider(_5,_5,new YAHOO.widget.SliderThumb(_6,_5,_7,_8,0,0,_9));};YAHOO.widget.Slider.getVertSlider=function(_10,_11,iUp,_13,_14){return new YAHOO.widget.Slider(_10,_10,new YAHOO.widget.SliderThumb(_11,_10,0,0,iUp,_13,_14));};YAHOO.widget.Slider.getSliderRegion=function(_15,_16,_17,_18,iUp,_19,_20){return new YAHOO.widget.Slider(_15,_15,new YAHOO.widget.SliderThumb(_16,_15,_17,_18,iUp,_19,_20));};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.widget.Slider.prototype.setStartSliderState=function(){var el=this.thumb.getEl();this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};this.thumb.startOffset=this.thumb.getOffsetFromParent();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);}else{this.setValue(0,true,true);}}};YAHOO.widget.Slider.prototype.lock=function(){this.thumb.lock();this.locked=true;};YAHOO.widget.Slider.prototype.unlock=function(){this.thumb.unlock();this.locked=false;};YAHOO.widget.Slider.prototype.onMouseUp=function(){this._deferSlideEnd=true;this.fireEvents();};YAHOO.widget.Slider.prototype.focus=function(){var el=this.getEl();if(el.focus){el.focus();}this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}};YAHOO.widget.Slider.prototype.onChange=function(_22,_23){};YAHOO.widget.Slider.prototype.onSlideStart=function(){};YAHOO.widget.Slider.prototype.onSlideEnd=function(){};YAHOO.widget.Slider.prototype.getValue=function(){return this.thumb.getValue();};YAHOO.widget.Slider.prototype.getXValue=function(){return this.thumb.getXValue();};YAHOO.widget.Slider.prototype.getYValue=function(){return this.thumb.getYValue();};YAHOO.widget.Slider.prototype.onThumbChange=function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());}else{t.onChange(t.getValue());}};YAHOO.widget.Slider.prototype.setValue=function(_25,_26,_27){if(!this.thumb.available){this.deferredSetValue=arguments;return false;}if(this.isLocked()&&!_27){return false;}if(isNaN(_25)){return false;}var t=this.thumb;var _28,newY;if(t._isRegion){return false;}else{if(t._isHoriz){_28=t.initPageX+_25+this.thumbCenterPoint.x;this.moveThumb(_28,t.initPageY,_26);}else{newY=t.initPageY+_25+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,_26);}}return true;};YAHOO.widget.Slider.prototype.setRegionValue=function(_29,_30,_31){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;}if(this.isLocked()&&!force){return false;}if(isNaN(_29)){return false;}var t=this.thumb;if(t._isRegion){var _32=t.initPageX+_29+this.thumbCenterPoint.x;var _33=t.initPageY+_30+this.thumbCenterPoint.y;this.moveThumb(_32,_33,_31);return true;}return false;};YAHOO.widget.Slider.prototype.verifyOffset=function(){var _34=YAHOO.util.Dom.getXY(this.getEl());if(_34[0]!=this.baselinePos[0]||_34[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=_34;return false;}return true;};YAHOO.widget.Slider.prototype.moveThumb=function(x,y,_37){if(!this.thumb.available){return;}this.verifyOffset();var _38=this;var t=this.thumb;t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!_37){this.lock();setTimeout(function(){_38.moveOneTick(p);},this.tickPause);}else{if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!_37){this.lock();var _41=new YAHOO.util.Motion(t.id,{points:{to:p}},0.4,YAHOO.util.Easing.easeOut);_41.onComplete.subscribe(function(){_38.endAnim();});_41.animate();}else{t.setDragElPos(x,y);this.fireEvents();}}};YAHOO.widget.Slider.prototype.moveOneTick=function(_42){var t=this.thumb;var _43=YAHOO.util.Dom.getXY(t.getEl());var tmp;var _45=null;if(t._isRegion){_45=this._getNextX(_43,_42);var _46=(_45)?_45[0]:_43[0];_45=this._getNextY([_46,_43[1]],_42);}else{if(t._isHoriz){_45=this._getNextX(_43,_42);}else{_45=this._getNextY(_43,_42);}}if(_45){YAHOO.util.Dom.setXY(t.getEl(),_45);if(!(_45[0]==_42[0]&&_45[1]==_42[1])){var _47=this;setTimeout(function(){_47.moveOneTick(_42);},this.tickPause);}else{this.unlock();this.fireEvents();}}else{this.unlock();this.fireEvents();}};YAHOO.widget.Slider.prototype._getNextX=function(_48,_49){var t=this.thumb;var _50;var tmp=[];var _51=null;if(_48[0]>_49[0]){_50=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(_48[0]-_50,_48[1]);_51=[tmp.x,tmp.y];}else{if(_48[0]<_49[0]){_50=t.tickSize+this.thumbCenterPoint.x;tmp=t.getTargetCoord(_48[0]+_50,_48[1]);_51=[tmp.x,tmp.y];}else{}}return _51;};YAHOO.widget.Slider.prototype._getNextY=function(_52,_53){var t=this.thumb;var _54;var tmp=[];var _55=null;if(_52[1]>_53[1]){_54=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(_52[0],_52[1]-_54);_55=[tmp.x,tmp.y];}else{if(_52[1]<_53[1]){_54=t.tickSize+this.thumbCenterPoint.y;tmp=t.getTargetCoord(_52[0],_52[1]+_54);_55=[tmp.x,tmp.y];}else{}}return _55;};YAHOO.widget.Slider.prototype.b4MouseDown=function(e){this.thumb.resetConstraints();};YAHOO.widget.Slider.prototype.onMouseDown=function(e){if(!this.isLocked()){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.moveThumb(x,y);this.focus();}};YAHOO.widget.Slider.prototype.onDrag=function(e){if(!this.isLocked()){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.moveThumb(x,y,true);}};YAHOO.widget.Slider.prototype.endAnim=function(){this.unlock();this.fireEvents();};YAHOO.widget.Slider.prototype.fireEvents=function(){var t=this.thumb;t.cachePosition();if(!this.isLocked()){if(t._isRegion){var _57=t.getXValue();var _58=t.getYValue();if(_57!=this.previousX||_58!=this.previousY){this.onChange(_57,_58);}this.previousX=_57;this.previousY=_58;}else{var _59=t.getValue();if(_59!=this.previousVal){this.onChange(_59);}this.previousVal=_59;}if(this._deferSlideEnd){this.onSlideEnd();this._deferSlideEnd=false;}}};YAHOO.widget.SliderThumb=function(id,_61,_62,_63,iUp,_64,_65){if(id){this.init(id,_61);this.parentElId=_61;}this.isTarget=false;this.tickSize=_65;this.maintainOffset=true;this.initSlider(_62,_63,iUp,_64,_65);this.scroll=false;};YAHOO.widget.SliderThumb.prototype=new YAHOO.util.DD();YAHOO.widget.SliderThumb.prototype.getOffsetFromParent=function(){var _66=YAHOO.util.Dom.getXY(this.getEl());var _67=YAHOO.util.Dom.getXY(this.parentElId);return [(_66[0]-_67[0]),(_66[1]-_67[1])];};YAHOO.widget.SliderThumb.prototype.startOffset=null;YAHOO.widget.SliderThumb.prototype._isHoriz=false;YAHOO.widget.SliderThumb.prototype._prevVal=0;YAHOO.widget.SliderThumb.prototype._graduated=false;YAHOO.widget.SliderThumb.prototype.initSlider=function(_68,_69,iUp,_70,_71){this.setXConstraint(_68,_69,_71);this.setYConstraint(iUp,_70,_71);if(_71&&_71>1){this._graduated=true;}this._isHoriz=(_68>0||_69>0);this._isVert=(iUp>0||_70>0);this._isRegion=(this._isHoriz&&this._isVert);};YAHOO.widget.SliderThumb.prototype.getValue=function(){if(!this.available){return 0;}var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;};YAHOO.widget.SliderThumb.prototype.getXValue=function(){if(!this.available){return 0;}var _73=this.getOffsetFromParent();return (_73[0]-this.startOffset[0]);};YAHOO.widget.SliderThumb.prototype.getYValue=function(){if(!this.available){return 0;}var _74=this.getOffsetFromParent();return (_74[1]-this.startOffset[1]);};YAHOO.widget.SliderThumb.prototype.onChange=function(x,y){};if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;} \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/treeview-min.js b/projekte/MDB/web-app/js/yahoo/treeview-min.js new file mode 100644 index 0000000..b2037fa --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/treeview-min.js @@ -0,0 +1 @@ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ YAHOO.widget.TreeView=function(id){if(id){this.init(id);}};YAHOO.widget.TreeView.nodeCount=0;YAHOO.widget.TreeView.prototype={id:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,setExpandAnim:function(_2){if(YAHOO.widget.TVAnim.isValid(_2)){this._expandAnim=_2;}},setCollapseAnim:function(_3){if(YAHOO.widget.TVAnim.isValid(_3)){this._collapseAnim=_3;}},animateExpand:function(el){if(this._expandAnim&&this._animCount ";}var f=document.createElement("div");var s=f.style;s.position="absolute";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(_35,_36,_37){if(_36){this.init(_35,_36,_37);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,_type:"Node",init:function(_38,_39,_40){this.data=_38;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=_40;if(_39){this.tree=_39.tree;this.parent=_39;this.href="javascript:"+this.getToggleLink();this.depth=_39.depth+1;this.multiExpand=_39.multiExpand;_39.appendChild(this);}},appendChild:function(_41){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=_41;_41.previousSibling=sib;}this.tree.regNode(_41);this.children[this.children.length]=_41;this.childrenRendered=false;return _41;},getSiblings:function(){return this.parent.children;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl())){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl())){this.getChildrenEl().style.display="none";}},getElId:function(){return "ygtv"+this.index;},getChildrenElId:function(){return "ygtvc"+this.index;},getToggleElId:function(){return "ygtvt"+this.index;},getEl:function(){return document.getElementById(this.getElId());},getChildrenEl:function(){return document.getElementById(this.getChildrenElId());},getToggleEl:function(){return document.getElementById(this.getToggleElId());},getToggleLink:function(){return "YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").toggle()";},collapse:function(){if(!this.expanded){return;}var ret=this.tree.onCollapse(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=false;return;}this.hideChildren();this.expanded=false;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}},expand:function(){if(this.expanded){return;}var ret=this.tree.onExpand(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=true;return;}if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}this.expanded=true;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}if(this.isLoading){this.expanded=false;return;}if(!this.multiExpand){var _44=this.getSiblings();for(var i=0;i<_44.length;++i){if(_44[i]!=this&&_44[i].expanded){_44[i].collapse();}}}this.showChildren();},getStyle:function(){if(this.isLoading){return "ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var _46="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){_46=(this.expanded)?"m":"p";}return "ygtv"+loc+_46;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}return s;},expandAll:function(){for(var i=0;i0||(_51&&this.isDynamic()&&!this.dynamicLoadComplete));},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){var sb=[];sb[sb.length]="
    ";sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]="
    ";return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]="
    ";if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}sb[sb.length]="
    ";return sb.join("");},renderChildren:function(){var _52=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){_52.dataLoader(_52,function(){_52.loadComplete();});},10);}else{if(this.tree.root.dataLoader){setTimeout(function(){_52.tree.root.dataLoader(_52,function(){_52.loadComplete();});},10);}else{return "Error: data loader not found or not specified.";}}return "";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i=this.depth||_53<0){return null;}var p=this.parent;while(p.depth>_53){p=p.parent;}return p;},getDepthStyle:function(_54){return (this.getAncestor(_54).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){return "";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}}};YAHOO.widget.RootNode=function(_55){this.init(null,null,true);this.tree=_55;};YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node();YAHOO.widget.RootNode.prototype.getNodeHtml=function(){return "";};YAHOO.widget.TextNode=function(_56,_57,_58){this.type="TextNode";if(_57){this.init(_56,_57,_58);this.setUpLabel(_56);}};YAHOO.widget.TextNode.prototype=new YAHOO.widget.Node();YAHOO.widget.TextNode.prototype.labelStyle="ygtvlabel";YAHOO.widget.TextNode.prototype.labelElId=null;YAHOO.widget.TextNode.prototype.label=null;YAHOO.widget.TextNode.prototype.setUpLabel=function(_59){if(typeof _59=="string"){_59={label:_59};}this.label=_59.label;if(_59.href){this.href=_59.href;}if(_59.target){this.target=_59.target;}if(_59.style){this.labelStyle=_59.style;}this.labelElId="ygtvlabelel"+this.index;};YAHOO.widget.TextNode.prototype.getLabelEl=function(){return document.getElementById(this.labelElId);};YAHOO.widget.TextNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="";sb[sb.length]="";for(i=0;i ";}var _60="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";sb[sb.length]="";sb[sb.length]=" ";sb[sb.length]="";sb[sb.length]="";sb[sb.length]="";sb[sb.length]="
    ";sb[sb.length]="";sb[sb.length]=this.label;sb[sb.length]="";sb[sb.length]="
    ";return sb.join("");};YAHOO.widget.TextNode.prototype.onLabelClick=function(me){};YAHOO.widget.MenuNode=function(_62,_63,_64){if(_63){this.init(_62,_63,_64);this.setUpLabel(_62);}this.multiExpand=false;};YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode();YAHOO.widget.HTMLNode=function(_65,_66,_67,_68){if(_66){this.init(_65,_66,_67);this.initContent(_65,_68);}};YAHOO.widget.HTMLNode.prototype=new YAHOO.widget.Node();YAHOO.widget.HTMLNode.prototype.contentStyle="ygtvhtml";YAHOO.widget.HTMLNode.prototype.contentElId=null;YAHOO.widget.HTMLNode.prototype.content=null;YAHOO.widget.HTMLNode.prototype.initContent=function(_69,_70){if(typeof _69=="string"){_69={html:_69};}this.html=_69.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=_70;};YAHOO.widget.HTMLNode.prototype.getContentEl=function(){return document.getElementById(this.contentElId);};YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="";sb[sb.length]="";for(i=0;i ";}if(this.hasIcon){sb[sb.length]=" ";}sb[sb.length]="";sb[sb.length]=this.html;sb[sb.length]="";sb[sb.length]="";sb[sb.length]="
    ";return sb.join("");};YAHOO.widget.TVAnim=function(){return {FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(_71,el,_72){if(YAHOO.widget[_71]){return new YAHOO.widget[_71](el,_72);}else{return null;}},isValid:function(_73){return (YAHOO.widget[_73]);}};}();YAHOO.widget.TVFadeIn=function(el,_74){this.el=el;this.callback=_74;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var _75=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){_75.onComplete();});a.animate();},onComplete:function(){this.callback();}};YAHOO.widget.TVFadeOut=function(el,_77){this.el=el;this.callback=_77;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var _78=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){_78.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();}}; \ No newline at end of file diff --git a/projekte/MDB/web-app/js/yahoo/yahoo-min.js b/projekte/MDB/web-app/js/yahoo/yahoo-min.js new file mode 100644 index 0000000..2fced0d --- /dev/null +++ b/projekte/MDB/web-app/js/yahoo/yahoo-min.js @@ -0,0 +1 @@ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ var YAHOO=window.YAHOO||{};YAHOO.namespace=function(_1){if(!_1||!_1.length){return null;}var _2=_1.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6){if(YAHOO.widget.Logger){YAHOO.widget.Logger.log(null,_5,_6);}else{return false;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example"); \ No newline at end of file