From 1569120ff44fd4edcea772b8199ff39a58ce8a9d Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Fri, 12 Jun 2009 11:15:05 +0200 Subject: [PATCH] Kill web interface files --- Makefile.am | 2 +- admin-root/CREDITS | 150 - admin-root/Makefile.am | 24 - admin-root/about.html | 56 - admin-root/config-update.html | 19 - admin-root/config.css | 51 - admin-root/config.html | 9 - admin-root/config.js | 611 ---- admin-root/config.xml | 345 -- admin-root/favicon.ico | Bin 35670 -> 0 bytes admin-root/feedback.html | 105 - admin-root/ff_logo_sm.gif | Bin 1215 -> 0 bytes admin-root/firefly.css | 167 - admin-root/firefly.js | 46 - admin-root/ftr.html | 3 - admin-root/gpl-license.html | 9 - admin-root/gpl-license.txt | 340 -- admin-root/hdr.html | 71 - admin-root/index.css | 31 - admin-root/index.html | 84 - admin-root/lib-js/Makefile.am | 7 - admin-root/lib-js/prototype.js | 1785 ----------- admin-root/lib-js/rico.js | 2851 ----------------- admin-root/lib-js/script.aculo.us/Makefile.am | 8 - admin-root/lib-js/script.aculo.us/builder.js | 101 - admin-root/lib-js/script.aculo.us/controls.js | 815 ----- admin-root/lib-js/script.aculo.us/dragdrop.js | 674 ---- admin-root/lib-js/script.aculo.us/effects.js | 910 ------ .../lib-js/script.aculo.us/scriptaculous.js | 45 - admin-root/lib-js/script.aculo.us/slider.js | 283 -- admin-root/lib-js/script.aculo.us/unittest.js | 372 --- admin-root/linkOpaque.gif | Bin 102 -> 0 bytes admin-root/linkTransparent.gif | Bin 102 -> 0 bytes admin-root/no_access.html | 26 - admin-root/playlist.html | 141 - admin-root/playlist.js | 706 ---- admin-root/pngfix.js | 39 - admin-root/required.gif | Bin 47 -> 0 bytes admin-root/smart.html | 44 - admin-root/smart.js | 265 -- admin-root/smartpopup.html | 386 --- admin-root/spinner.gif | Bin 842 -> 0 bytes admin-root/spinner_stopped.gif | Bin 911 -> 0 bytes admin-root/status.js | 115 - admin-root/thanks.html | 13 - admin-root/upnp-basic.xml | 46 - admin-root/upnp-cd.xml | 178 - admin-root/upnp-cm.xml | 132 - admin-root/upnp/ff_logo_16.png | Bin 362 -> 0 bytes admin-root/upnp/ff_logo_32.png | Bin 606 -> 0 bytes admin-root/upnp/ff_logo_48.png | Bin 838 -> 0 bytes admin-root/util.js | 81 - admin-root/xiph-license.html | 9 - admin-root/xiph-license.txt | 28 - admin-root/zlib-license.html | 9 - admin-root/zlib-license.txt | 25 - configure.in | 2 +- 57 files changed, 2 insertions(+), 12217 deletions(-) delete mode 100644 admin-root/CREDITS delete mode 100644 admin-root/Makefile.am delete mode 100644 admin-root/about.html delete mode 100644 admin-root/config-update.html delete mode 100644 admin-root/config.css delete mode 100644 admin-root/config.html delete mode 100644 admin-root/config.js delete mode 100644 admin-root/config.xml delete mode 100644 admin-root/favicon.ico delete mode 100644 admin-root/feedback.html delete mode 100644 admin-root/ff_logo_sm.gif delete mode 100644 admin-root/firefly.css delete mode 100644 admin-root/firefly.js delete mode 100644 admin-root/ftr.html delete mode 100644 admin-root/gpl-license.html delete mode 100644 admin-root/gpl-license.txt delete mode 100644 admin-root/hdr.html delete mode 100644 admin-root/index.css delete mode 100644 admin-root/index.html delete mode 100644 admin-root/lib-js/Makefile.am delete mode 100644 admin-root/lib-js/prototype.js delete mode 100644 admin-root/lib-js/rico.js delete mode 100644 admin-root/lib-js/script.aculo.us/Makefile.am delete mode 100644 admin-root/lib-js/script.aculo.us/builder.js delete mode 100644 admin-root/lib-js/script.aculo.us/controls.js delete mode 100644 admin-root/lib-js/script.aculo.us/dragdrop.js delete mode 100644 admin-root/lib-js/script.aculo.us/effects.js delete mode 100644 admin-root/lib-js/script.aculo.us/scriptaculous.js delete mode 100644 admin-root/lib-js/script.aculo.us/slider.js delete mode 100644 admin-root/lib-js/script.aculo.us/unittest.js delete mode 100644 admin-root/linkOpaque.gif delete mode 100644 admin-root/linkTransparent.gif delete mode 100644 admin-root/no_access.html delete mode 100644 admin-root/playlist.html delete mode 100644 admin-root/playlist.js delete mode 100644 admin-root/pngfix.js delete mode 100644 admin-root/required.gif delete mode 100644 admin-root/smart.html delete mode 100644 admin-root/smart.js delete mode 100644 admin-root/smartpopup.html delete mode 100644 admin-root/spinner.gif delete mode 100644 admin-root/spinner_stopped.gif delete mode 100644 admin-root/status.js delete mode 100644 admin-root/thanks.html delete mode 100644 admin-root/upnp-basic.xml delete mode 100644 admin-root/upnp-cd.xml delete mode 100644 admin-root/upnp-cm.xml delete mode 100644 admin-root/upnp/ff_logo_16.png delete mode 100644 admin-root/upnp/ff_logo_32.png delete mode 100644 admin-root/upnp/ff_logo_48.png delete mode 100644 admin-root/util.js delete mode 100644 admin-root/xiph-license.html delete mode 100644 admin-root/xiph-license.txt delete mode 100644 admin-root/zlib-license.html delete mode 100644 admin-root/zlib-license.txt diff --git a/Makefile.am b/Makefile.am index e70aeadb..638d820d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = configure CREDITS -SUBDIRS = src tools admin-root contrib +SUBDIRS = src tools contrib diff --git a/admin-root/CREDITS b/admin-root/CREDITS deleted file mode 100644 index 926b1835..00000000 --- a/admin-root/CREDITS +++ /dev/null @@ -1,150 +0,0 @@ - -I've received lots of help from people on this project. - -These are the people who have contributed to whatever -small success this project enjoys (in order of contribution). -If I've forgotten anyone, I apologize -- email me and I'll -make it right. - -The Plone project - * css files for the admin interface - -Aubin Paul - * Patches for Debian package generation - * Precompiled Debian binaries - -Paul Forgey - * Tons of troubleshooting on Solaris - * Fixes for readdir_r - * Fixes for alignment problems in XING header parsing - -Paul Hubbard - * T/S and patch testing to resolve scanning bugs - -David Buttrick - * Webmastering, FAQ maintenance, Doc maintenance - -Hans-Christoph Steiner - * Webmastering, FAQ maintenance, Doc maintenance - * Amazing amounts of troubleshooting, testing on OSX 10.2 - -David Imhoff - * Code cleanup patches (_XOPEN_SOURCE, declaration problems) - -James Turner - * Fixes for OSX 10.2 - * configure.in suggestions - -Hiren Joshi - * Dynamic art code - -David W. Berry - * Tons of protocol compliance fixes. - * Browse, query, and index support - -Paul Kim - * Dynamic art code for AAC - * Various AAC meta-info cleanups - * Compilation tag support (aac and mp3) - * ogg/vorbis tag handling - -Stephen Lee - * Patches for proper url decoding - -Rob Nunn - * gentoo rc script - -Frank Schwichtenberg - * patches for static playlist bug - -Gavin Shelley - * patches for Solaris strftime - -Stephen Rubner - * fixes for ulong ino_t - -Ciamac Moallemi - * gzip content-encoding - -Roger Mundt - * troubleshooting and debugging help - -dirkthedaring2 (?) - * fixes for inverted playlist - * speedups on connect - -Adrian Schroeter - * fixes for AMD64 - * -Wall cleanups - -Timo J. Rinne - * Server-side format conversion (on-the-fly transcoding) - -Herman I. May - * Web wrangling and forums question answering - * HTML interface fixes - -North Overby - * Patches for disc number - * alac speedups for nslu2 - -Joe Holt - * Fixes for web config stupidness - -Mark Woehrer - * Patches for "Date Added" in iTunes xml scanner - -Stefan Bruns - * Speedups for javascript in playlist page, konq fixes, css fixes - * Fixes for mlit -> xml serialization when block len = 0 - -blech (from the forums) - * Fixes for iTunes 5 view persistence - -Phil Packer - * Patches for returning static playlists in order - -Diego Penneno - * Patches for multiple PID files to facilitate gentoo init scripts - * configure patches - -Patrick Kolla - * Popup "wizard" for smart playlists - * Stylish new web interface look.. woohoo! - -slomo (from the forums) - * Musepack tag parsing support. - -Anders Betner - * Web interface mojo -- ajaxy web config and playlist editor - -MikeC - * Win32 panel configurator - -MikeK - * OSX Preference pane/helper, and OSX packaging - -Eddie Bindt - * Dutch Translations - -Julien Richefeu - * French Translations - -Helmut Wieser - * German Translations - -Luca Paolini - * Italian Translations - -Gareth Potter - * Japanese Translations - -Anton Johansson - * Swedish Translations - -Ian Burrell - * configure patches to put plugins in libdir - * RH/Centos/Fedora specfiles - -Stephane Moreau - * admin page updates to make apache rewrites easier diff --git a/admin-root/Makefile.am b/admin-root/Makefile.am deleted file mode 100644 index 398572e1..00000000 --- a/admin-root/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ - -SUBDIRS=lib-js - -adminrootdir = ${pkgdatadir}/admin-root -adminroot_DATA = ftr.html linkOpaque.gif about.html \ - gpl-license.txt linkTransparent.gif config-update.html hdr.html \ - firefly.css ff_logo_sm.gif config.html index.html required.gif \ - gpl-license.html thanks.html feedback.html \ - playlist.html playlist.js smart.html smart.js \ - smartpopup.html firefly.js CREDITS status.js \ - config.js config.xml spinner.gif spinner_stopped.gif util.js \ - pngfix.js no_access.html index.css config.css \ - xiph-license.html xiph-license.txt zlib-license.html zlib-license.txt - -EXTRA_DIST = ftr.html linkOpaque.gif about.html \ - gpl-license.txt linkTransparent.gif config-update.html hdr.html \ - firefly.css ff_logo_sm.gif config.html index.html required.gif \ - gpl-license.html thanks.html feedback.html \ - playlist.html playlist.js smart.html smart.js \ - smartpopup.html firefly.js CREDITS status.js \ - config.js config.xml spinner.gif spinner_stopped.gif util.js \ - pngfix.js no_access.html index.css config.css \ - xiph-license.html xiph-license.txt zlib-license.html zlib-license.txt - diff --git a/admin-root/about.html b/admin-root/about.html deleted file mode 100644 index cbe0991d..00000000 --- a/admin-root/about.html +++ /dev/null @@ -1,56 +0,0 @@ -@include hdr.html@ -
-

About Firefly

-

-This is the administrative web interface for the Firefly Media Server, -version @version@. -

- -

About

-

-Firefly is an open-source media server for the Roku SoundBridge and -Apple iTunes. It runs on POSIX platforms as well as Win32. It supports -server-side transcoding and other advanced features. While every effort -is taken to ensure quality, this software is released without warranty as -described by the GNU General Public License. See the section below -titled "No Warranty". This work, -although released under the GNU General Public License, is Copyright -© 2003-2006 Ron Pedde and others. See source file headers for -more information. See the link named -GPL License for more details on the -licensing of this software. -

- -

-The project homepage is located at - -http://www.fireflymediaserver.org. - - -

Legal Info

-

-This program makes use of the following libraries and packages: -

-

- -

No Warranty

-

-BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. -

-
-@include ftr.html@ diff --git a/admin-root/config-update.html b/admin-root/config-update.html deleted file mode 100644 index 884140ab..00000000 --- a/admin-root/config-update.html +++ /dev/null @@ -1,19 +0,0 @@ -@include hdr.html@ - -

Configuration Updated

- -
- - - - -
Admin Password@admin_pw@
MP3 Password@password@
- -
- -@SERVICE-STATUS@ - -
- -@include ftr.html@ - diff --git a/admin-root/config.css b/admin-root/config.css deleted file mode 100644 index 9abc975c..00000000 --- a/admin-root/config.css +++ /dev/null @@ -1,51 +0,0 @@ -label { - float: left; - width: 11em; - font: icon; - padding-top: .3em; - padding-left: 1em; -} -input { - font: icon; -} -select { - font: icon; -} -#config_path_label { - float: left; - width: 11em; - font:icon; - padding: .3em 0 .5em 1em; -} -#config_path { - float: left; - width: 40em; - font: icon; - padding: .3em 0 .5em 0; -} -.addItemHref { - float: left; - margin-left: 11em; - font: icon; - padding-left: 1.5em; - margin-bottom: .5em; -} -.message_div { - background-color: yellow; - padding: 1em; - border: 1px solid #8CACBB; -} -#messages { - background-color: yellow; - padding: .5em; - border: 1px solid #8CACBB; - width: 40em; - float: left; - margin-left: 1em; -} -#buttons { - float: left; -} -#buttons input { - width: 7em; -} diff --git a/admin-root/config.html b/admin-root/config.html deleted file mode 100644 index 1f657ce0..00000000 --- a/admin-root/config.html +++ /dev/null @@ -1,9 +0,0 @@ -@include hdr.html@ -

Configuration

- -
-
-
- -



-@include ftr.html@ diff --git a/admin-root/config.js b/admin-root/config.js deleted file mode 100644 index 4b13fae6..00000000 --- a/admin-root/config.js +++ /dev/null @@ -1,611 +0,0 @@ -Event.observe(window,'load',init); -//###TODO -// * Disable/enable save/cancel, Add key and onchange listeners keep a note on changed items -// * create the path/file browser -// * better errormessage for non writable config -// * make tabs? -// * add warning if leaving page without saving - -// Config isn't defined until after the Event.observe above -// I could have put it below Config = ... but I want all window.load events -// at the start of the file -var DEBUG = window.location.toString().match(/debug.*/); -var g_messageTimeout; -if ('debug=validate' == DEBUG) { - DEBUG = 'validate'; -} -function init() { - Config.init(); -} -var ConfigXML = { - config: {}, - advancedSections: [], - getItem: function (id) { - return this.config[id]; - }, - getAllItems: function () { - return $H(this.config).pluck('value'); - }, - addAdvancedSection: function (sectionName) { - this.advancedSections.push(sectionName); - }, - isAdvancedSection: function (sectionName) { - return this.advancedSections.find(function (name) { - return name == sectionName - }); - }, - getAllAdvancedSections: function () { - return this.advancedSections; - }, - getSectionId: function (sectionName) { - return 'firefly_'+sectionName.replace(/\ /g,'').toLowerCase(); - }, - parseXML: function(xmlDoc) { - $A(xmlDoc.getElementsByTagName('section')).each(function (section) { - if ('true' == section.getAttribute('advanced')) { - // Only used by Config._showAdvancedConfig, Config._showBasicConfig - ConfigXML.addAdvancedSection(section.getAttribute('name')); - } - $A(section.getElementsByTagName('item')).each(function (item) { - var returnItem = {}; - $A(item.attributes).each(function (attr) { - returnItem[attr.name] = attr.value; - }); - Element.cleanWhitespace(item); - $A(item.childNodes).each(function (node) { - if (Element.textContent(node) == '') { - return; - } - if ('options' == node.nodeName) { - var options = []; - $A(item.getElementsByTagName('option')).each(function (option) { - options.push({value: option.getAttribute('value'), - label: Element.textContent(option)}); - }); - returnItem['options'] = options; - } else { - returnItem[node.nodeName] = Element.textContent(node); - } - $A(node.attributes).each(function (attr) { - returnItem[attr.name] = attr.value; - }); - }); - ConfigXML.config[returnItem.id] = returnItem; - }); - }); - } -}; -var ConfigInitialValues = { - values: {}, - getValue: function (id) { - return ConfigInitialValues.values[id]; - }, - setValue: function (id,value) { - this.values[id] = value; - }, - parseXML: function (xmldoc) { - // IE and w3c treat xmldoc differently make shore firstChild is firstchild of - if (xmldoc.childNodes[1] && xmldoc.childNodes[1].nodeName == 'config') { - sections = $A(xmldoc.childNodes[1].childNodes); - } else { - sections = $A(xmldoc.firstChild.childNodes); - } - var missingItems = []; - sections.each(function (section) { - var sectionName = section.nodeName; - $A(section.childNodes).each(function (node) { - var itemId = sectionName + ':' + node.nodeName; - if (node.firstChild && node.firstChild.hasChildNodes()) { - var values = []; - $A(node.childNodes).each(function (n) { - values.push(Element.textContent(n)); - }); - ConfigInitialValues.values[itemId] = values; - } else { - ConfigInitialValues.values[itemId] = Element.textContent(node); - } - if (!ConfigXML.getItem(itemId)) { - missingItems.push(itemId); - } - }); - }); - if (missingItems.length > 0) { - //###FIXME A bit ugly, but add a section with values from mt-daapd.conf that aren't - // in config.xml - ConfigXML.addAdvancedSection('missing_items'); - var frag = document.createDocumentFragment(); - missingItems.each(function (el){ - frag.appendChild(document.createTextNode(el)); - frag.appendChild(document.createElement('br')); - }); - var outerDiv = Builder.node('div',{id: ConfigXML.getSectionId('missing_items')}); - outerDiv.appendChild(Builder.node('div',{className: 'naviheader'},'Options missing from config.xml')); - var contentDiv = Builder.node('div',{className: 'navibox'}); - contentDiv.appendChild(document.createTextNode('The options below are in your mt-daapd.conf and Firefly uses them,')); - contentDiv.appendChild(document.createElement('br')); - contentDiv.appendChild(document.createTextNode("but this web page can't handle them until they are added to config.xml")); - contentDiv.appendChild(document.createElement('br')); - contentDiv.appendChild(document.createElement('br')); - contentDiv.style.paddingLeft = '1em'; - contentDiv.appendChild(frag); - outerDiv.appendChild(contentDiv); - if (!Cookie.getVar('show_advanced_config')) { - outerDiv.style.display = 'none'; - } - $('theform').appendChild(outerDiv); - } - } -}; -var Config ={ - configPath: '', - init: function () { - new Ajax.Request('config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); - }, - storeConfigLayout: function (request) { - // Need to store this until showConfig is run - Config.tmpConfigXML = request.responseXML; - ConfigXML.parseXML(request.responseXML); - ConfigXML.getAllItems().each(function (item) { - if (item.multiple) { - //###FIXME default values on item.multiple="true" not possible - ConfigInitialValues.setValue(item.id,[]); - } else { - ConfigInitialValues.setValue(item.id,item.default_value || ''); - } - }); - new Ajax.Request('xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus}); - }, - updateStatus: function (request) { - Config.configPath = Element.textContent(request.responseXML.getElementsByTagName('config_path')[0]); - Config.isWritable = Element.textContent(request.responseXML.getElementsByTagName('writable_config')[0]) == '1'; - new Ajax.Request('xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig}); - }, - showConfig: function (request) { - ConfigInitialValues.parseXML(request.responseXML); - $A(Config.tmpConfigXML.getElementsByTagName('section')).each(function (section) { - var head = document.createElement('div'); - head.className= 'naviheader'; - var sectionName = section.getAttribute('name'); - head.appendChild(document.createTextNode(sectionName)); - var body = document.createElement('div'); - body.className = 'navibox'; - if ('Server' == sectionName) { - body.appendChild(Builder.node('span',{id:'config_path_label'},'Config File Location')); - var span = Builder.node('span',{id:'config_path'}); - span.appendChild(document.createTextNode(Config.configPath)); - body.appendChild(span); - body.appendChild(Builder.node('br')); - body.appendChild(Builder.node('div',{style: 'clear: both;'})); - } - $A(section.getElementsByTagName('item')).each(function (item) { - body.appendChild(Config._buildItem(item.getAttribute('id'))); - }); - var div = document.createElement('div'); - div.id = ConfigXML.getSectionId(sectionName); - if (!Cookie.getVar('show_advanced_config') && ConfigXML.isAdvancedSection(sectionName)) { - div.style.display = 'none'; - } - div.appendChild(head); - div.appendChild(body); - $('theform').appendChild(div); - }); - // Won't be using the config.xml XML doc anymore get rid of it - Config.tmpConfigXML = ''; - if (!Config.isWritable) { - Effect.Appear('config_not_writable_warning'); - } else { - // Create save and cancel buttons -// var save = Builder.node('button',{id: 'button_save', disabled: 'disabled'},'Save'); - var save = Builder.node('input',{id: 'button_save',type: 'button', value:'Save', - style: 'font: 1.2em Verdana, Helvetica, Arial, sans-serif'}); - Event.observe(save,'click',saveForm); - var cancel = Builder.node('input',{id: 'button_cancel',type: 'button',value:'Cancel', - style: 'font: 1.2em Verdana, Helvetica, Arial, sans-serif'}); - Event.observe(cancel,'click',cancelForm); - var spacer = document.createTextNode('\u00a0\u00a0'); - var buttons = $('buttons'); - if (navigator.platform.toLowerCase().indexOf('mac') != -1) { - // We're on mac - buttons.appendChild(cancel); - buttons.appendChild(spacer); - buttons.appendChild(save); - } else { - //###TODO What about all them unix variants? - buttons.appendChild(save); - buttons.appendChild(spacer); - buttons.appendChild(cancel); - } - } - var advanced = Builder.node('a',{href: 'javascript://',id:'basic_config_button'},'Show basic config'); - Event.observe(advanced,'click',Config._showBasicConfig); - var basic = Builder.node('a',{href: 'javascript://',id:'advanced_config_button'},'Show advanced config'); - Event.observe(basic,'click',Config._showAdvancedConfig); - if (Cookie.getVar('show_advanced_config')) { - basic.style.display = 'none'; - } else { - advanced.style.display = 'none'; - } - var div = $('toggle_basic_advanced'); - div.appendChild(advanced); - div.appendChild(basic); - }, - _buildItem: function(itemId) { - var frag = document.createElement('div'); - var href; - var item = ConfigXML.getItem(itemId); - switch(item.type) { - case 'text': - if (item.multiple) { - var values = ConfigInitialValues.getValue(itemId); - if (!values || values.length === 0) { - values = ['']; - } -// var parentSpan = Builder.node('span'); - values.each(function (val,i) { - var div = document.createElement('div'); - // Crappy IE wants a width on floated elements (or maybe it was w3c requiring it) - div.style.width = '60em'; - div.appendChild(BuildElement.input(itemId+i,itemId, - item.name, - val || item.default_value || '', - item.size || 20, - item.short_description, - '')); -// if (item.browse) { -// href = Builder.node('a',{href: 'javascript://'},'Browse'); -// Event.observe(href,'click',Config._browse); -// div.appendChild(href); -// } - div.appendChild(document.createTextNode('\u00a0\u00a0')); - href = Builder.node('a',{style: 'width: 6em;',href: 'javascript://'},'Remove'); - Event.observe(href,'click',Config._removeItemEvent); - div.appendChild(href); - div.appendChild(Builder.node('br')); - frag.appendChild(div); - }); - // This is used by cancelForm to find out how - // many options a multiple group has -// frag.appendChild(parentSpan); - href = Builder.node('a',{href:'javascript://',className:'addItemHref'},item.add_item_label); - frag.appendChild(href); - Event.observe(href,'click',Config._addItemEvent); - frag.appendChild(Builder.node('div',{style:'clear: both'})); - } else { - frag.appendChild(BuildElement.input(itemId,itemId, - item.name, - ConfigInitialValues.getValue(itemId) || item.default_value || '', - item.size || 20, - item.short_description, - '')); -// if (item.browse) { -// href = Builder.node('a',{href: 'javascript://'},'Browse'); -// Event.observe(href,'click',Config._browse); -// frag.appendChild(href); -// } - // frag.appendChild(Builder.node('br')); - } - break; - case 'select': - frag.appendChild(BuildElement.select(itemId, - item.name, - item.options, - ConfigInitialValues.getValue(itemId) || item.default_value, - item.short_description)); -// frag.appendChild(Builder.node('br')); - break; - default: - alert('This should not happen (1)'); - break; - } - if (!Cookie.getVar('show_advanced_config') && item.advanced) { - frag.style.display = 'none'; - } - frag.style.clear = 'both'; - return frag; - }, - _addItemEvent: function (e) { - var div = Event.element(e).previousSibling; - Config._addItem(div); - }, - _addItem: function(div) { - var newSpan = div.cloneNode(true); - var id = newSpan.getElementsByTagName('input')[0].id; - var num = parseInt(id.match(/\d+$/)); - num++; - id = id.replace(/\d+$/,'') + num; - - newSpan.getElementsByTagName('label')[0].setAttribute('for',id); - newSpan.getElementsByTagName('input')[0].id = id; - newSpan.getElementsByTagName('input')[0].value = ''; - newSpan.style.display = 'none'; - var hrefs = newSpan.getElementsByTagName('a'); - if ('Netscape' == navigator.appName) { - // Firefox et al doesn't copy registered events on an element deep clone - // Don't know if that is w3c or if IE has it right - if (hrefs.length == 1) { - Event.observe(hrefs[0],'click',Config._removeItemEvent); - } else { - Event.observe(hrefs[0],'click',Config._browse); - Event.observe(hrefs[1],'click',Config._removeItemEvent); - } - } - div.parentNode.insertBefore(newSpan,div.nextSibling); - Effect.BlindDown(newSpan,{duration: 0.2}); - }, - _removeItemEvent: function (e) { - var div = Event.element(e).parentNode; - Config._removeItem(div); - }, - _removeItem: function(div,noAnimation) { - if (div.parentNode.getElementsByTagName('input').length > 1) { - if (noAnimation) { - // cancelForm uses a loop to delete elements, the loop can't wait - // for Effect.BlindUp to finish - Element.remove(div); - } else { - Effect.BlindUp(div,{duration: 0.2, afterFinish: function (){Element.remove(div);}}); - } - } else { - div.getElementsByTagName('input')[0].value=''; - } - }, - _browse: function(e) { - alert('Here goes UI to browse for files and dirs'); - }, - _showAdvancedConfig: function (e) { - Element.toggle('advanced_config_button'); - Element.toggle('basic_config_button'); - Cookie.setVar('show_advanced_config','true',30); - ConfigXML.getAllAdvancedSections().each(function (sectionName) { - Effect.BlindDown(ConfigXML.getSectionId(sectionName)); - }); - ConfigXML.getAllItems().each(function (item) { - if (item.advanced) { - var element = $(item.id); - if (!element) { - // Handle options with multiple values - $A(document.getElementsByName(item.id)).each(function (el) { - Effect.BlindDown(el.parentNode.parentNode); - }); - } else { - Effect.BlindDown(element.parentNode); - } - } - }); - }, - _showBasicConfig: function (e) { - Element.toggle('advanced_config_button'); - Element.toggle('basic_config_button'); - Cookie.removeVar('show_advanced_config'); - ConfigXML.getAllAdvancedSections().each(function (sectionName) { - Effect.BlindUp(ConfigXML.getSectionId(sectionName)); - }); - ConfigXML.getAllItems().each(function (item) { - if (item.advanced) { - var element = $(item.id); - if (!element) { - // Handle options with multiple values - $A(document.getElementsByName(item.id)).each(function (el) { - Effect.BlindUp(el.parentNode.parentNode); - }); - } else { - Effect.BlindUp(element.parentNode); - } - } - }); - } -}; -var BuildElement = { - input: function(id,name,displayName,value,size,short_description,long_description) { - - var frag = document.createDocumentFragment(); - var label = document.createElement('label'); - - label.setAttribute('for',id); - label.appendChild(document.createTextNode(displayName)); - frag.appendChild(label); - var input; - if (/KHTML/.test(navigator.userAgent) && (80 == size)) { - // Safari & Konqueror input fields gets to long - // This is a runner up in the ugly bug fix contest - size = 60; - } - - if (Config.isWritable) { - input = Builder.node('input',{id: id,name: name,className: 'text', - value: value,size: size}); - } else { - input = Builder.node('input',{id: id,name: name,className: 'text', - value: value,size: size, disabled: 'disabled'}); - } - if (/KHTML/.test(navigator.userAgent)) { - // Safari & Konqueror doesn't do font: icon on inputs and selects - input.style.fontSize = 'x-small'; - } - frag.appendChild(input); - frag.appendChild(document.createTextNode('\u00a0')); - if (short_description) { - frag.appendChild(document.createTextNode(short_description)); - } - - return frag; - }, - select: function(id,displayName,options,value,short_description,long_description) { - var frag = document.createDocumentFragment(); - var label = document.createElement('label'); - label.setAttribute('for',id); - label.appendChild(document.createTextNode(displayName)); - frag.appendChild(label); - - var select = Builder.node('select',{id: id,name: id,size: 1}); - if (!Config.isWritable) { - select.disabled = 'disabled'; - } - $A(options).each(function (option) { - select.appendChild(Builder.node('option',{value: option.value}, - option.label)); - }); - select.value = value; - if (/KHTML/.test(navigator.userAgent)) { - // Safari & Konqueror doesn't do font: icon on inputs and selects - select.style.fontSize = 'x-small'; - } - - frag.appendChild(select); - frag.appendChild(document.createTextNode('\u00a0')); - if (short_description) { - frag.appendChild(document.createTextNode(short_description)); - } - - return frag; - } -}; - -function saved(req) { - if (g_messageTimeout) { - window.clearTimeout(g_messageTimeout); - } - if ('200' == Element.textContent(req.responseXML.getElementsByTagName('status')[0])) { - $('messages').innerHTML = 'Saved'; - Effect.Appear('messages',{duration: 0.2}); - g_messageTimeout = window.setTimeout(function(){ - Effect.Fade('messages',{duration: 0.2}); - },3000); - } else { - $('messages').innerHTML = 'Error: ' + req.responseText; - Effect.Appear('messages',{duration: 0.2}); - } -} -function saveForm() { - var postVars = []; - var multiple = {}; - - $A($('theform').getElementsByTagName('select')).each(function (select) { - if (DEBUG) { - debug(select.id,select.value); - } else { - if (select.value != ConfigInitialValues.getValue(select.id)) { - postVars.push(Form.Element.serialize(select.id)); - } - } - }); - - $A($('theform').getElementsByTagName('input')).each(function (input) { - if (ConfigXML.getItem(input.name).multiple) { - var value = encodeURIComponent(input.value.replace(/,/g,',,')); - if (multiple[input.name]) { - multiple[input.name].push(value); - } else { - multiple[input.name] = [value]; - } - } else { - if (DEBUG) { - debug(input.id,input.value); - } else { - if (input.value != ConfigInitialValues.getValue(input.id)) { - postVars.push(Form.Element.serialize(input.id)); - ConfigInitialValues.setValue(input.id,input.value); - } - } - } - }); - - $H(multiple).each(function (item) { - if (DEBUG) { - debug(item.key,item.value.join(',')); - } else { - var currentValue = item.value.join(','); - var initialValue = ConfigInitialValues.getValue(item.key).collect(function (value) { - return encodeURIComponent(value.replace(/,/g,',,')); - }); - if (currentValue != initialValue) { - postVars.push(item.key + '=' + currentValue); - ConfigInitialValues.setValue(item.key,item.value.collect(function (value) { - return decodeURIComponent(value).replace(/,,/g,','); - })); - } - } - }); - if (DEBUG) { - return; - } - if (postVars.length > 0 ) { - new Ajax.Request('xml-rpc?method=updateconfig', - {method: 'post', - parameters: postVars.join('&'), - onComplete: saved}); - } - - function debug(id,value) { - var getArr = []; - var getString; - if ('validate' == DEBUG) { - var a = id.split(':'); - getArr.push('section='+encodeURIComponent(a[0])); - getArr.push('key='+encodeURIComponent(a[1])); - getArr.push('value='+encodeURIComponent(value)); - getArr.push('verify_only=1'); - getString = 'xml-rpc?method=setconfig&' + getArr.join('&'); - - } else { - getString = 'xml-rpc?method=updateconfig&' + Form.Element.serialize(id); - } - var output = id + '=' + value; - new Ajax.Request(getString, - {method: 'get', - onComplete: function(req){ - var errorString = Element.textContent(req.responseXML.getElementsByTagName('statusstring')[0]); - if (errorString != 'Success') { - console.log(output + ' => ' + errorString); - } - }}); - - - } -} -function cancelForm() { - ConfigXML.getAllItems().each(function (item) { - if (item.multiple) { - var values = ConfigInitialValues.getValue(item.id); - if (!values || values.length === 0) { - values = ['']; - } - var initialValuesCount = values.length; - var currentElements = document.getElementsByName(item.id); -var i=0; - while (initialValuesCount < currentElements.length) { - i++; - if (i > 10) { - alert('Getting dizzy; too many turns in this loop (silly errormessage 1)'); - return; - } - Config._removeItem(currentElements[0].parentNode,'noAnimation'); - } - while (initialValuesCount > currentElements.length) { - i++; - if (i > 10) { - alert('An important part came off (silly errormessage 2)'); - return; - } - Config._addItem(currentElements[currentElements.length-1].parentNode); - } - values.each(function (val,i){ - currentElements[i].value = val; - }); - } else { - //###TODO potential error a select without a default value - $(item.id).value = ConfigInitialValues.getValue(item.id) || item.default_value || ''; - } - $('messages').innerHTML = 'Cancelled'; - if (g_messageTimeout) { - window.clearTimeout(g_messageTimeout); - } - Effect.Appear('messages',{duration: 0.2}); - g_messageTimeout = window.setTimeout(function(){ - Effect.Fade('messages',{duration: 0.2}); - },3000); - - - }); - return; -} diff --git a/admin-root/config.xml b/admin-root/config.xml deleted file mode 100644 index 8d617fbf..00000000 --- a/admin-root/config.xml +++ /dev/null @@ -1,345 +0,0 @@ - - -
- - Server Name - - The name iTunes and other daap clients should see - - - This is both the name of the server as advertised via Bonjour, and the - name of the database exported via DAAP. Also know as "What shows up in - iTunes". - - text - - - Web Root - - text - - - Port - - The port the server should run at; default is 3689 - - text - - - Logfile - - text - - - Run As - - text - - - Admin password - - The password for this administration interface. - - text - - - Music Password - - The password clients need to access this server. - - text - - - Compress - - Should browsing data be compressed on the way to the client? - - select - - - - - - - Truncate Logfile - - Should the logfile get truncated on startup? - - select - - - - - - - - Debug Level - - Possible values are 0 to 9, 9 being the most detailed debug level. - - select - - - - - - - - - - - - - -
- -
- - Music Folder - - text - - - Extensions - - text - - - Playlist File - - text - - - Compilation Directories - - text - -
-
- - MP3 Tag Codepage - - What codepage non-utf mp3 tags should be converted from (default: ISO-8859-1) - - text - - - Process Playlists - - Should static playlists (.m3u, etc) be processed? - - select - - - - - - - Process iTunes files - - Should iTunes xml-files be processed? - - select - - - - - - - Process .m3u files - - Should .m3u playlists be processed? - - select - - - - - - - Case Sensitive - - Is the filesystem case sensitive? - - select - - - - - - - Ignore appledouble - - Skip appledouble files when scanning - - select - - - - - - - Ignore dotfiles - - Ignore unix hidden dot files - - select - - - - - - - Group compilations - - Compilations are grouped under "Various artist" - - select - - - - - - - Follow Symlinks - - Should symlinks be followed when scanning directories? - - select - - - - - - - Skip First Scan - - Should the initial boot-up scan be skipped? - - select - - - - - -
-
- - Database Type - - select - - - - - - - Database Directory - - text - - - Scan Type - - select - - - - - - - - Rescan Interval - - How often should Firefly look for new files? In seconds. - - text - - - Always Scan - - select - - - - - -
- -
- - Ordered Playlists - - Should playlists be returned in the order specified in the playlist? - - select - - - - - - - Empty strings - - select - - - - - - - Supports update - - select - - - - - - - Supports browse - - select - - - - - - -
- -
- - Plugin Directory - - text - -
- -
- - SSC Program - - text - - - SSC Codec Types - - text - - - Never Transcode - - Codecs to not transcode, even if plugins are available - - text - - - Always Transcode - - Codecs to always transcode, even if client plays it - - text - -
-
diff --git a/admin-root/favicon.ico b/admin-root/favicon.ico deleted file mode 100644 index eeb5a025080c41cabcb83c2346da4648b53c7251..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35670 zcmeI5ZHQdgdB@LsZLi&ijG%7QG)5z^+RCCZvid?wh3?`HLj6#-A1o-eVj2o*3{p2~ z!MGqiqq<5;OEUt8Qc%@fN9>{$Q!&7U>qZ-3L+_(SGR;!eGy@rTUk9yjKDUo_?j znxrtuqm*HPC z&%i$j{|Nl!@K3-$1^*2E^YAahzY704{M+!4!jIs;1pj6Dufcx<{#)>Gz`q6m4*YxY z@54U{|1A6q@UOtX3I8tqb@&PV1bzZPfu9KfDEtWiOYmQY|5`R4liYxR3;rGW_u$`$ zpFbXxoQHo2{#E$b;opYOD00SQlEd&%!#@ZAGW=`8e+K?R#(9Ks9%q~<80RU*c?SM@ z_?O^cg?}CXZTLswNAO>Q|1$j7;J*R?E%-O!--3S!{yq5j;h%(m7XAhJSK!}-e;58b z`~*HY2QGta3F;?NKa2VW)UTj^6ZN~OubUh2Z^6F<{~rAN@SlNy5dIPP$KjuVe+vE? z_~+qYf`1kMb@;d8%k}u`SC-9F7oRs9%vO%mYm~X^T90uBUoOvG`($@-lC|n-y{D;H zUXy4|5~F$F{fT~F_vbi0m%HEBkLfE|sBWfqh%vCsK}P7W{Oyb&8*qpBtwOpH+E#_3 z$V|+Z;1R^zciDZ8)Puk8^a%YBVWmt}Pyr)R>6R6;gh%_S?4v?tBg>Vo(|y@U#Zqe( zWJhUE4R-fY(mp5EvE}qB>ak3F*cVM1O6XhXr%mB_vZZv8mL;6b`)JX3T7h9gKT5ZU z6drBp>XCAmRky5FhUebXLw@%Uzt$I$WOa_G0+W2hm3-&3#MMs>skz~LK-IejZJ=k6rt^1Z}dyAOZF1HfT) zPlI#dGPnjtJpjy}k9Z!LJs<7q^N~Et%kTXkG@m!0mmA2wQ|8STPOyFHE%-}3^?en%uLJ*d)Cj&?G3FC&JPX8r68tpy z8EZdz>rN?$5@BAqt|%6WyeS?$M2oV?F2f+moESEjEQ`)2lYHi6j$W)qlAU^ao- z1a@x%b81n3a6 z40y8r=)9=60^~gQz$AT#Vq&!R{T!&VKIOjsS+vmKclUQ24rnyVt$z944LtJxK2zpju+<<7Nt{ z26|qctFhbb#<-e8`_#XZ(?jkI;8#F5CvLawP~JBI7W?!|HB_c`jAehSS1UVR69 zm$@#3s@5uN&;aAkPXfoqifRV|*X5yK%jvNryb=3(b&T>C?pRwl4%G#VB8>*ADuX)wV z^(xnkpbONmwsh}K{y3ngx~{EiOj(P*e;q`wMquB~E4^p;v#dcEC?~gfI1y-wb@Taa z_G6%WdA9Dyl{rS=ok7-*YIyrv!$9v2w_)oY)qCvql*<)exISNNP}|V_lUmzjH!t4q z_iWw4-X+%7n%j@v*ScMs8{_D@e0SZ>tGkS!+8Usq7sH-hCo5p+8nHFj*^|0zAr1Vo z-4{*>lg?n8{YzcBGYIwN^)B&poea!?;~0c`c6}rJw|PQ3)9zntDm(+>26~ejh(7{y z&2&Knv_TTU*xq&a#KvCyPV_G|j-7#UyjnuNb>L+83~Rss!oBCrV5j;YI|F)=^Bn3~ zeFMD*>d);R-I4Qm<~XhXmvVZ^tpk1ysL#t=b_OfNw{88wdf2NwIfl-gjrH@& zaqbMPUhce$_AWfMr2bHT_2pg%-^I-3Ey-GKIXXV4C4 zhUytR19a*IwLYQ+bnMxQ^;WV;nhvp#Xe0jSy?nXRyE=_R`U9=jYvKzHeGY2(Sf!r5z%_b!vJ;z|* z+~eDw3%yi81eQS~2eQ8}@9pjOUnZUz$g|r3%Ea#nu3!J8$NQm|Sq-xZ%qB3Kz-$8l zza}vB1uexLYkXsjyqYFTt$d4&y!ZwgF?=ITRqVPk>BbsgU?9h<3{b4hv5|E6(ipyO zCV4%z)kMBXMgq--*h*qv6}yl$kM->;rh?EKHsU*G*7^R529<2^+{I*L zF4;Oc|MtU85=9H&THC_5TbGB%h~ASi_6N7h7dFUz*6h3xNasgDRs0ZBlWgd>>ugrV z!G1$*xtDxTgpBrgfqqX!lkXgyy=D`bO<*>G*#!3A1o(Gk4aol?tbjJ?g2Y-m7QgJ* z_Dl8DQUML1wMxB3Ap8c{v;X_D`FjQH&Fe|x8@qWv$X5lOZPxAgBYM@H?t>gPAT#sx zPvcm0OWzyBM4$mi_AlCCr)t;!OZ7lKbucz|mueqdhkt!JwU3O2*9mYnW+!aNuQha> zQ`5jXgwx33?L^(K=GgZo>Z<3|miEA270BAvopjwrrwzmw(U81je?P#f=jciNO3q%9 z{K{#gG4Q^^aRfRAw8x$UxvtQu=V)!W{y22q+ME?~#yNQt>+j{o`+oSL9wbM|ull2G zZtZSv^kZ9Vp4O7fAGP*sZ7bLFyLsdqkREHG2XwDc?T-Ga9vaFkVyU5S>llc0{90pL zyK1r@*|?$FZLId!(iqpm$?Ku*@`|i&zGa_l{Zjux?ZU&i1oCRvp4ATVtVXDZu3txy zV``Ck)qJk4v*P-NXZZtt;j06!*|&99L)Y+!deFTx*5(cN;OfBB+OYWujQY!1Cthk8IuD{Hejxi=musc&^gLmg9nQ$wwMO_^59%vpoqST0)Hu`w zzPiWL`m@?KC%gt2s@-a|l;>LEgP!Xvx+bm-v>vfVdkEEDv+?Qq&>Ha7og72G36K32 z7>LvOQI?q4(bhildRT(nwlM>_@M-O$QP-TZ2CA!es0TQ0&;bLws*`8ohx8>+u!oQi zT(@?uv4LNp$G#ot!Qqwafw+nj>*pBT1F@mneVx4HvUv3ZEtX*?R z?sg!5;U0*M0`aOZR(fbzo^S;*kiBU@Y7Oa>>0z4nglft2N!|*`>tQ8y&-p&9(aV`b zUheJsC13h}WAg`l@N3OGMq_E0>yO-8a(d{voN;S3>bulKJyeU=gPf02zYj!n7kUWR z9_nXOA3eym)C1eS#@%?)Tbi_{vT@|9f|V)tAUdV5g|an=_~ebY(TCJMaG!>9?1qmz zVI-eKC@K(SUwgeeEHZC zmX9e#V$+X@VflEIe3Gim=cN{~l{NX;6YEv^7!>O!4P)o5#hf$^V^;aJli0PUNt)R8 z)z9z|E&f){+6Qm1VK*OqcyS%OmAr5GJ7xSGom+F8Vx#8UTVkto@5f>*ulFi#?85u+ zEX3IPq&eRrCCTR&BsB%kW1F9r4@hB6`bTx-V{CIE{g~F8wGXhikE}oKSNrFKV& zllK3<>mehr=7H4Ae#|DY?Fqy zNV%>S>k8;Ods!~K*TrVJSucxU^RSLVPml8~95;WKL-_2~L<9K#I=;|3>EL&3Xt~ED zYS0{#$In&4SJPP5l3RJptYha`{2h?iVAt8PYWNnOuOT|wY?UuQAbaB=IcpAYWDW2l zhwExL?4In$IUJWiYCW!o_BQqX+)<$Bj?U7za4VoUr5akQ@72&%f5^hEO`(SDzR(;(C7^JZbR+mj880e^&<;*q7hqg2$Y-`qXB7Dgt-T ziIKH(e~tBL!5@Ir;K#s#zSd*?^VYtA4c*7z!T&p!QIe;w|jqv{WjPF|7(2`^B>^r;J>Z!huEJ7+RM|d{~r7&_!^Ly{{o_W7aTnP z7vC4|i{Se}_WuNkPtK3nr+~~#)_(&QfxMrc0AB>(1qZ<|gH7-bkoqM~=lVyi{{e`G z#7UkjKy+?^p94P$ejQu~npfk08=u5{8Hn!-;HSVVKx+6aAay(o&Vye8qM_&Q6Rf3g z(fA5D0{+|{i%;<$YnhE`{VEU*Jr|#6tvt1I4h0)_@2l8F@ICOaK;m7ECddB+G~Tsx z9uHXlbJ*v+Yf!bMF6sAQfLs%Afipn&L-)bZp2OEYvD&NH^qzF?CFRL^707)nSO8DM z8@h+(Zy%d&tJ8i1|VP@1g%6 DnHjPq diff --git a/admin-root/feedback.html b/admin-root/feedback.html deleted file mode 100644 index a21e923c..00000000 --- a/admin-root/feedback.html +++ /dev/null @@ -1,105 +0,0 @@ -@include hdr.html@ - -

Feedback

- -

-Here you can send feedback on your mt-daapd installation to the developer. -

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Feedback
Works? - The most important question. Did this version work for you? - If not, uncheck the box, and put an explanation in the NOTES - entry below. -
Version - This is the version of mt-daapd you are running. If you are using a - public release, use the version number (0.1.0, 0.1.1, etc). If it is - manually checked out of cvs, use 'cvs', if it is a nightly snapshot, - use the snapshot name, for example: 'cvs-20040328'. -
System - This is the operating system and version you are running. - Use something like "Sparc Solaris 9" or "x86 Linux 2.6.3" or - "Mac OSX 10.3" or something to help identify what platform and - version you are running. -
Compile arguments - If you used any compile flags, that would be helpful. Examples might include - '--with-gdbm', or '--enable-howl' or something else. -
Notes - If it didn't work for you, or if you just want to make a - suggestion, leave those notes here. Remember that these - notes are publicly viewable. -
Rating - Just for fun, give this release a rating from 1 to 10, 1 being - so bad it started your computer on fire, 10 meaning works so - well, it even made your breath fresher. -
- -
-
- -@include ftr.html@ - diff --git a/admin-root/ff_logo_sm.gif b/admin-root/ff_logo_sm.gif deleted file mode 100644 index 5b210aeefa2739d85bd23a43bbe6ab81242c8a84..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1215 zcmZ?wbhEHb>|jt~xT?T#;J|^u&#(Xc{>j0?;oDT-udPNOK79DGuI#~s2Lb{Dzt68- zuwcQjeUm0km|$RFuwlc7uf6tvuJ68Z;X*<}f`Wp=_j%C;1qI)iW&YgO^5_1^fPjF1 z@1OiSwxFS*;Y+Ow0|UeV|Nns`?SSG>7DfgJ1qL0E6(Bz`u>E(KP~f4{B*Na2zEdSZ z>DY=AueDL@Z>$khNf4QlVBoS*clP-gTMRz&?w;AwaBIVh8}At&F1{SF`Zaf*8&7_# z4{Ja=H>Z4WpS-LBLtkxED)*FWPV8-Sy;EGcM0rB_`XGn68?!`DZsFPC(;0Y8o-bHP zmj7nt?Iy`Q(QS<4_wyD6J!5`5?S0+112P7OP6jtJc-e&-K4)lf=5*y@SP;g-a72+$ z-R%qq!weA?8Cj;^>`W@6y>2Wmk`hZ7uye2+l3{T?;k-}tnO~$tQ^Q5}|7Ff>Ca08h zRtPZgRRuCwxinpfTiMgN;X+3G6wY2I(M|;e5$0$G3&DhEMQR)==7ryiOj=Yp;-wZe z8EpL~_l+*j7F5XBu~2J}{gSqBt@AcHxhVCfQXp9Uhc^Xn35ma)wl( zL6PNV!Te=AkHj!BIG$equiwjkZMvwx;rPKO>1bvxjU#FDJ`OA`QG$vGSY2ccuGOBtWBxz3 zZ0**Icau5V+#V>in_UWU6WG+0)coq~Q*PJyrjr~hFWCmqV3%$xaP0r>D4--EIpN22 zk;jq|d}(~wOlL)(&Ai&6EEHvNx6hZO!Mk5UWar!t@0^4u>;QYSJ|A-mhkLT zdZ&xZPsgs5u#YDg7Gxcm60KnKHMl6p?w4YJjA}3go21JGb%~_D$h2im%OVArx$V)A zYgAZZqkj?KLY@9IbGGIv%Eo!E zo!J@HednUGY)i`WT^&WA6ZCx=FT9%fsOPjxeK-S`uHXl*#&G>qHXkhxp*fQp1bbV( zS=fFVO$^(==NR{g1#SzxJ{;W@H~WP^Nu9whQJELr9g=K6OpF9M(_N3GPx9P&BI;sN zj@$+(pO+rF5h)V_j6|<=ZE_B2NKxkyT38a~QCYBOrHD|62y5)~85dob=Ji}We=U$D zhqX2H#I9BBq8pBVz3E!v>w3!UQOCF2M^@OjZYa2Zx9?8Sj9Xjo)^Im%7woaR_5DF+ ijM|Q!D}~nWkmR^=&{&L( - - \ No newline at end of file diff --git a/admin-root/gpl-license.html b/admin-root/gpl-license.html deleted file mode 100644 index 7adb4d0f..00000000 --- a/admin-root/gpl-license.html +++ /dev/null @@ -1,9 +0,0 @@ -@include hdr.html@ - -

GPL License

- -

-@include gpl-license.txt@
-

- -@include ftr.html@ diff --git a/admin-root/gpl-license.txt b/admin-root/gpl-license.txt deleted file mode 100644 index 5b6e7c66..00000000 --- a/admin-root/gpl-license.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/admin-root/hdr.html b/admin-root/hdr.html deleted file mode 100644 index a5accdda..00000000 --- a/admin-root/hdr.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - Firefly Media Server - - - @ispage index.html::@ - @ispage index.html::@ - @ispage index.html::@ - @ispage index.html::@ - @ispage index.html::@ - @ispage config.html::@ - @ispage config.html::@ - @ispage config.html::@ - @ispage config.html::@ - @ispage config.html::@ - @ispage smart.html::@ - @ispage smart.html::@ - @ispage smart.html::@ - @ispage playlist.html::@ - @ispage playlist.html::@ - @ispage playlist.html::@ - @ispage playlist.html::@ - @ispage playlist.html::@ - - - - - - -
- -firefly logo - - -
- -
-The best open-source media server for the Roku SoundBridge and iTunes -
- - - -
- - - - - - diff --git a/admin-root/index.css b/admin-root/index.css deleted file mode 100644 index f877cbc2..00000000 --- a/admin-root/index.css +++ /dev/null @@ -1,31 +0,0 @@ -#service, #stat { - width: 70ex; -} -#thread { - width: 80ex; -} -#server_stopped_message { - position: absolute; - background-color: yellow; - padding: 1em; -/* border: 1px solid #8CACBB;*/ - font-size: 120%; - margin-bottom: 1em; - z-index: 100; - -} -#grey_screen { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 1000px; - background-color: #000; - filter:alpha(opacity=60); - opacity: 0.6; - z-index: 10; -} -#button_stop_server, #button_start_scan, #button_start_full_scan { - width: 10em; - margin-bottom: .2em; -} diff --git a/admin-root/index.html b/admin-root/index.html deleted file mode 100644 index 3faec37a..00000000 --- a/admin-root/index.html +++ /dev/null @@ -1,84 +0,0 @@ -@include hdr.html@ - -

Server Status

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceStatusControl
BonjourRunning
Firefly Media ServerRunning
File scannerIdle
-
- - - - - - - - - -
PluginVersion
-
- - - - - - - - - - - - - - - - - - - -
Uptime 
Songs 
Songs Served 
DB Version2
-
- - - - - - - - - - - - -
Client IPAction
- -@include ftr.html@ diff --git a/admin-root/lib-js/Makefile.am b/admin-root/lib-js/Makefile.am deleted file mode 100644 index 415af0de..00000000 --- a/admin-root/lib-js/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ - -SUBDIRS=script.aculo.us - -jslibdir = ${pkgdatadir}/admin-root/lib-js -jslib_DATA = prototype.js rico.js -EXTRA_DIST = prototype.js rico.js - diff --git a/admin-root/lib-js/prototype.js b/admin-root/lib-js/prototype.js deleted file mode 100644 index 19a577cc..00000000 --- a/admin-root/lib-js/prototype.js +++ /dev/null @@ -1,1785 +0,0 @@ -/* Prototype JavaScript framework, version 1.4.0 - * (c) 2005 Sam Stephenson - * - * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff - * against the source tree, available from the Prototype darcs repository. - * - * 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.4.0', - 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 (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; - } - } - } -} - -/*--------------------------------------------------------------------------*/ - -function $() { - var elements = new Array(); - - for (var i = 0; i < arguments.length; i++) { - var element = arguments[i]; - if (typeof element == 'string') - element = document.getElementById(element); - - if (arguments.length == 1) - return element; - - elements.push(element); - } - - return elements; -} -Object.extend(String.prototype, { - 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(eval); - }, - - 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('\\', '\\\\').replace("'", '\\\'') + "'"; - } -}); - -String.prototype.parseQuery = String.prototype.toQueryParams; - -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 (value >= (result || value)) - result = value; - }); - return result; - }, - - min: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (value <= (result || value)) - 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) { - iterator(value = collections.pluck(index)); - return value; - }); - }, - - 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); - -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.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(); - }, - - shift: function() { - var result = this[0]; - for (var i = 0; i < this.length - 1; i++) - this[i] = this[i + 1]; - this.length--; - return result; - }, - - inspect: function() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } -}); -var Hash = { - _each: function(iterator) { - for (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, - 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]; - - if (this.options.method == 'post') { - requestHeaders.push('Content-type', - 'application/x-www-form-urlencoded'); - - /* 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); - } -}); -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(child); - return elements; - }); -} - -/*--------------------------------------------------------------------------*/ - -if (!window.Element) { - var Element = new Object(); -} - -Object.extend(Element, { - 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); - }, - - 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*$/); - }, - - 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 (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; - } -}); - -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) { - if (this.element.tagName.toLowerCase() == 'tbody') { - 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 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 (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; - if (!value && !('value' in opt)) - value = opt.text; - } - return [element.name, value]; - }, - - selectMany: function(element) { - var value = new Array(); - for (var i = 0; i < element.length; i++) { - var opt = element.options[i]; - if (opt.selected) { - var optValue = opt.value; - if (!optValue && !('value' in opt)) - optValue = opt.text; - value.push(optValue); - } - } - 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 */ -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/admin-root/lib-js/rico.js b/admin-root/lib-js/rico.js deleted file mode 100644 index 27d51f19..00000000 --- a/admin-root/lib-js/rico.js +++ /dev/null @@ -1,2851 +0,0 @@ -/** - * - * 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.2', - prototypeVersion: parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1]) -} - -if((typeof Prototype=='undefined') || Rico.prototypeVersion < 1.3) - throw("Rico requires the Prototype JavaScript framework >= 1.3"); - -Rico.ArrayExtensions = new Array(); - -if (Object.prototype.extend) { - Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend; -}else{ - Object.prototype.extend = function(object) { - return Object.extend.apply(this, [this, object]); - } - Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend; -} - -if (Array.prototype.push) { - 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= this.accordionTabs.length) - this.options.onLoadShowTab = 0; - - // set the initial visual state... - for ( var i=0 ; i < this.accordionTabs.length ; i++ ) - { - if (i != this.options.onLoadShowTab){ - this.accordionTabs[i].collapse(); - this.accordionTabs[i].content.style.display = 'none'; - } - } - this.lastExpandedTab = this.accordionTabs[this.options.onLoadShowTab]; - if (this.options.panelHeight == 'auto'){ - var tabToCheck = (this.options.onloadShowTab === 0)? 1 : 0; - var titleBarSize = parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[tabToCheck].titleBar, 'height')); - if (isNaN(titleBarSize)) - titleBarSize = this.accordionTabs[tabToCheck].titleBar.offsetHeight; - - var totalTitleBarSize = this.accordionTabs.length * titleBarSize; - var parentHeight = parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode, 'height')); - if (isNaN(parentHeight)) - parentHeight = this.container.parentNode.offsetHeight; - - this.options.panelHeight = parentHeight - totalTitleBarSize-2; - } - - this.lastExpandedTab.content.style.height = this.options.panelHeight + "px"; - this.lastExpandedTab.showExpanded(); - this.lastExpandedTab.titleBar.style.fontWeight = this.options.expandedFontWeight; - - }, - - setOptions: function(options) { - this.options = { - expandedBg : '#63699c', - hoverBg : '#63699c', - collapsedBg : '#6b79a5', - expandedTextColor : '#ffffff', - expandedFontWeight : 'bold', - hoverTextColor : '#ffffff', - collapsedTextColor : '#ced7ef', - collapsedFontWeight : 'normal', - hoverTextColor : '#ffffff', - borderColor : '#1f669b', - panelHeight : 200, - onHideTab : null, - onShowTab : null, - onLoadShowTab : 0 - } - Object.extend(this.options, options || {}); - }, - - showTabByIndex: function( anIndex, animate ) { - var doAnimate = arguments.length == 1 ? true : animate; - this.showTab( this.accordionTabs[anIndex], doAnimate ); - }, - - showTab: function( accordionTab, animate ) { - if ( this.lastExpandedTab == accordionTab ) - return; - - var doAnimate = arguments.length == 1 ? true : animate; - - if ( this.options.onHideTab ) - this.options.onHideTab(this.lastExpandedTab); - - this.lastExpandedTab.showCollapsed(); - var accordion = this; - var lastExpandedTab = this.lastExpandedTab; - - this.lastExpandedTab.content.style.height = (this.options.panelHeight - 1) + 'px'; - accordionTab.content.style.display = ''; - - accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight; - - if ( doAnimate ) { - new Rico.Effect.AccordionSize( this.lastExpandedTab.content, - accordionTab.content, - 1, - this.options.panelHeight, - 50, 7, - { complete: function() {accordion.showTabDone(lastExpandedTab)} } ); - this.lastExpandedTab = accordionTab; - } - else { - this.lastExpandedTab.content.style.height = "1px"; - accordionTab.content.style.height = this.options.panelHeight + "px"; - this.lastExpandedTab = accordionTab; - this.showTabDone(lastExpandedTab); - } - }, - - showTabDone: function(collapsedTab) { - collapsedTab.content.style.display = 'none'; - this.lastExpandedTab.showExpanded(); - if ( this.options.onShowTab ) - this.options.onShowTab(this.lastExpandedTab); - }, - - _attachBehaviors: function() { - var panels = this._getDirectChildrenByTag(this.container, 'DIV'); - for ( var i = 0 ; i < panels.length ; i++ ) { - - var tabChildren = this._getDirectChildrenByTag(panels[i],'DIV'); - if ( tabChildren.length != 2 ) - continue; // unexpected - - var tabTitleBar = tabChildren[0]; - var tabContentBox = tabChildren[1]; - this.accordionTabs.push( new Rico.Accordion.Tab(this,tabTitleBar,tabContentBox) ); - } - }, - - _getDirectChildrenByTag: function(e, tagName) { - var kids = new Array(); - var allKids = e.childNodes; - for( var i = 0 ; i < allKids.length ; i++ ) - if ( allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName ) - kids.push(allKids[i]); - return kids; - } - -}; - -Rico.Accordion.Tab = Class.create(); - -Rico.Accordion.Tab.prototype = { - - initialize: function(accordion, titleBar, content) { - this.accordion = accordion; - this.titleBar = titleBar; - this.content = content; - this._attachBehaviors(); - }, - - collapse: function() { - this.showCollapsed(); - this.content.style.height = "1px"; - }, - - showCollapsed: function() { - this.expanded = false; - this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg; - this.titleBar.style.color = this.accordion.options.collapsedTextColor; - this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight; - this.content.style.overflow = "hidden"; - }, - - showExpanded: function() { - this.expanded = true; - this.titleBar.style.backgroundColor = this.accordion.options.expandedBg; - this.titleBar.style.color = this.accordion.options.expandedTextColor; - this.content.style.overflow = "auto"; - }, - - titleBarClicked: function(e) { - if ( this.accordion.lastExpandedTab == this ) - return; - this.accordion.showTab(this); - }, - - hover: function(e) { - this.titleBar.style.backgroundColor = this.accordion.options.hoverBg; - this.titleBar.style.color = this.accordion.options.hoverTextColor; - this.titleBar.style.cursor = 'pointer'; - }, - - unhover: function(e) { - if ( this.expanded ) { - this.titleBar.style.backgroundColor = this.accordion.options.expandedBg; - this.titleBar.style.color = this.accordion.options.expandedTextColor; - } - else { - this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg; - this.titleBar.style.color = this.accordion.options.collapsedTextColor; - } - this.titleBar.style.cursor = ''; - }, - - _attachBehaviors: function() { - this.content.style.border = "1px solid " + this.accordion.options.borderColor; - this.content.style.borderTopWidth = "0px"; - this.content.style.borderBottomWidth = "0px"; - this.content.style.margin = "0px"; - - this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this); - this.titleBar.onmouseover = this.hover.bindAsEventListener(this); - this.titleBar.onmouseout = this.unhover.bindAsEventListener(this); - } - -}; - - -//-------------------- ricoAjaxEngine.js -Rico.AjaxEngine = Class.create(); - -Rico.AjaxEngine.prototype = { - - initialize: function() { - this.ajaxElements = new Array(); - this.ajaxObjects = new Array(); - this.requestURLS = new Array(); - this.options = {}; - }, - - registerAjaxElement: function( anId, anElement ) { - if ( !anElement ) - anElement = $(anId); - this.ajaxElements[anId] = anElement; - }, - - registerAjaxObject: function( anId, anObject ) { - this.ajaxObjects[anId] = anObject; - }, - - registerRequest: function (requestLogicalName, requestURL) { - this.requestURLS[requestLogicalName] = requestURL; - }, - - sendRequest: function(requestName, options) { - // Allow for backwards Compatibility - if ( arguments.length >= 2 ) - if (typeof arguments[1] == 'string') - options = {parameters: this._createQueryString(arguments, 1)}; - this.sendRequestWithData(requestName, null, options); - }, - - sendRequestWithData: function(requestName, xmlDocument, options) { - var requestURL = this.requestURLS[requestName]; - if ( requestURL == null ) - return; - - // Allow for backwards Compatibility - if ( arguments.length >= 3 ) - if (typeof arguments[2] == 'string') - options.parameters = this._createQueryString(arguments, 2); - - new Ajax.Request(requestURL, this._requestOptions(options,xmlDocument)); - }, - - sendRequestAndUpdate: function(requestName,container,options) { - // Allow for backwards Compatibility - if ( arguments.length >= 3 ) - if (typeof arguments[2] == 'string') - options.parameters = this._createQueryString(arguments, 2); - - this.sendRequestWithDataAndUpdate(requestName, null, container, options); - }, - - sendRequestWithDataAndUpdate: function(requestName,xmlDocument,container,options) { - var requestURL = this.requestURLS[requestName]; - if ( requestURL == null ) - return; - - // Allow for backwards Compatibility - if ( arguments.length >= 4 ) - if (typeof arguments[3] == 'string') - options.parameters = this._createQueryString(arguments, 3); - - var updaterOptions = this._requestOptions(options,xmlDocument); - - new Ajax.Updater(container, requestURL, updaterOptions); - }, - - // Private -- not part of intended engine API -------------------------------------------------------------------- - - _requestOptions: function(options,xmlDoc) { - var requestHeaders = ['X-Rico-Version', Rico.Version ]; - var sendMethod = 'post'; - if ( xmlDoc == null ) - if (Rico.prototypeVersion < 1.4) - requestHeaders.push( 'Content-type', 'text/xml' ); - else - sendMethod = 'get'; - (!options) ? options = {} : ''; - - if (!options._RicoOptionsProcessed){ - // Check and keep any user onComplete functions - if (options.onComplete) - options.onRicoComplete = options.onComplete; - // Fix onComplete - if (options.overrideOnComplete) - options.onComplete = options.overrideOnComplete; - else - options.onComplete = this._onRequestComplete.bind(this); - options._RicoOptionsProcessed = true; - } - - // Set the default options and extend with any user options - this.options = { - requestHeaders: requestHeaders, - parameters: options.parameters, - postBody: xmlDoc, - method: sendMethod, - onComplete: options.onComplete - }; - // Set any user options: - Object.extend(this.options, options); - return this.options; - }, - - _createQueryString: function( theArgs, offset ) { - 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) { - if(!request) - return; - // User can set an onFailure option - which will be called by prototype - if (request.status != 200) - return; - - var response = request.responseXML.getElementsByTagName("ajax-response"); - if (response == null || response.length != 1) - return; - this._processAjaxResponse( response[0].childNodes ); - - // Check if user has set a onComplete function - var onRicoComplete = this.options.onRicoComplete; - if (onRicoComplete != null) - onRicoComplete(); - }, - - _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.length==4) { - var shortHexCode = hexCode; - var hexCode = '#'; - for(var i=1;i<4;i++) hexCode += (shortHexCode.charAt(i) + -shortHexCode.charAt(i)); - } - 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.parentNode ) - return Rico.Color.createColorFromBackground(elem.parentNode); - - 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 ) { - return Rico.Color.createFromHex(actualColor); - } - 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 saturation; - 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 - } - Object.extend(this.options, 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"; - } - if (this.options.border != false) - 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; - this._mouseDown = this._mouseDownHandler.bindAsEventListener(this); - this._mouseMove = this._mouseMoveHandler.bindAsEventListener(this); - this._mouseUp = this._mouseUpHandler.bindAsEventListener(this); - }, - - 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; - }, - **/ - - _leftOffset: function(e) { - return e.offsetX ? document.body.scrollLeft : 0 - }, - - _topOffset: function(e) { - return e.offsetY ? document.body.scrollTop:0 - }, - - - _updateDraggableLocation: function(e) { - var dragObjectStyle = this.dragElement.style; - dragObjectStyle.left = (e.screenX + this._leftOffset(e) - this.startx) + "px" - dragObjectStyle.top = (e.screenY + this._topOffset(e) - 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 Rico.Effect.Position( this.dragElement, - this.origPos.x, - this.origPos.y, - 200, - 20, - { complete : this._doCancelDragProcessing.bind(this) } ); - } - - Event.stopObserving(document.body, "mousemove", this._mouseMove); - Event.stopObserving(document.body, "mouseup", this._mouseUp); - }, - - _retTrue: function () { - return true; - }, - - _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() && this.dragElement) - 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 + this._leftOffset(e) && - e.clientX < absoluteRect.right + this._leftOffset(e) && - e.clientY > absoluteRect.top + this._topOffset(e) && - e.clientY < absoluteRect.bottom + this._topOffset(e); - }, - - _addMouseDownHandler: function( aDraggable ) - { - htmlElement = aDraggable.getMouseDownHTMLElement(); - if ( htmlElement != null ) { - htmlElement.draggable = aDraggable; - Event.observe(htmlElement , "mousedown", this._onmousedown.bindAsEventListener(this)); - Event.observe(htmlElement, "mousedown", this._mouseDown); - } - }, - - _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; - }, - - _onmousedown: function () { - Event.observe(document.body, "mousemove", this._mouseMove); - Event.observe(document.body, "mouseup", this._mouseUp); - }, - - _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 - -Rico.Effect = {}; - -Rico.Effect.SizeAndPosition = Class.create(); -Rico.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"; - } -} - -Rico.Effect.Size = Class.create(); -Rico.Effect.Size.prototype = { - - initialize: function(element, w, h, duration, steps, options) { - new Rico.Effect.SizeAndPosition(element, null, null, w, h, duration, steps, options); - } -} - -Rico.Effect.Position = Class.create(); -Rico.Effect.Position.prototype = { - - initialize: function(element, x, y, duration, steps, options) { - new Rico.Effect.SizeAndPosition(element, x, y, null, null, duration, steps, options); - } -} - -Rico.Effect.Round = Class.create(); -Rico.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 ); - } -}; - -Rico.Effect.FadeTo = Class.create(); -Rico.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 = RicoUtil.getElementsComputedStyle(this.element, 'opacity'); - this.element.ricoOpacity = opacity != undefined ? opacity : 1.0; - } - return parseFloat(this.element.ricoOpacity); - } -} - -Rico.Effect.AccordionSize = Class.create(); - -Rico.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.ArrowHeight = 16; - this.columnCount = columnCount; - }, - - setOptions: function(options) { - this.options = { - largeBufferSize : 7.0, // 7 pages - nearLimitFactor : 0.2 // 20% of buffer - }; - Object.extend(this.options, 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 = this.liveGrid.options.scrollerBorderRight; - 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 ); - var eventName = this.isIE ? "mousewheel" : "DOMMouseScroll"; - Event.observe(table, eventName, - function(evt) { - if (evt.wheelDelta>=0 || evt.detail < 0) //wheel-up - this.scrollerDiv.scrollTop -= (2*this.viewPort.rowHeight); - else - this.scrollerDiv.scrollTop += (2*this.viewPort.rowHeight); - this.handleScroll(false); - }.bindAsEventListener(this), - false); - }, - - 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 scrollDiff = this.lastScrollPos-this.scrollerDiv.scrollTop; - if (scrollDiff != 0.00) { - var r = this.scrollerDiv.scrollTop % this.viewPort.rowHeight; - if (r != 0) { - this.unplug(); - if ( scrollDiff < 0 ) { - this.scrollerDiv.scrollTop += (this.viewPort.rowHeight-r); - } else { - this.scrollerDiv.scrollTop -= r; - } - this.plugin(); - } - } - 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 ); - this.lastScrollPos = this.scrollerDiv.scrollTop; - - }, - - 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(); - this.blankRow[0] = {name: ' ',id: ''}; - for ( var i=1; i < this.metaData.columnCount ; i++ ) - this.blankRow[i] = " "; - } - return this.blankRow; - }, - - loadRows: function(ajaxResponse) { - var newRows = []; - $A(ajaxResponse.responseXML.getElementsByTagName('item')).each(function (el) { - var row = []; - row.push({id:Element.textContent(el.getElementsByTagName('id')[0]), - name: Element.textContent(el.getElementsByTagName('title')[0])}); - ['disc','artist','album'].each(function (name) { - if ('disc' == name) { - var time = parseInt(Element.textContent(el.getElementsByTagName(name)[0])); - time = Math.round(time / 1000); - var seconds = time % 60; - seconds = (seconds < 10) ? '0'+seconds : seconds; - row.push(Math.floor(time/60)+ ':' + seconds); - } else { - row.push(Element.textContent(el.getElementsByTagName(name)[0])); - } - }); - newRows.push(row); - }); - return newRows; - - 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; - if(adjustedOffset == 0 && adjustedSize < this.maxFetchSize){ - adjustedSize = this.maxFetchSize; - } - } 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) + "px"; - 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) { - htmlRow.cells[0].innerHTML = row[0].name; - for (var j=1; j < row.length; j++) { - htmlRow.cells[j].innerHTML = row[j] - } - }, - - bufferChanged: function() { - this.refreshContents( parseInt(this.lastPixelOffset / this.rowHeight)); - }, - - clearRows: function() { - if (!this.isBlank) { - this.liveGrid.table.className = this.liveGrid.options.loadingClass; - for (var i=0; i < this.visibleRows; i++) { - SelectedRows.updateState(this.table.rows[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 - SelectedRows.updateState(this.table.rows[i + contentOffset],rows[i][0].id,startPos+i); - this.populateRow(this.table.rows[i + contentOffset], rows[i]); - } - for (var i=0; i < blankSize; i++) {// blank out the rest - SelectedRows.updateState(this.table.rows[i + blankOffset]); - this.populateRow(this.table.rows[i + blankOffset], this.buffer.getBlankRow()); - } - this.isPartialBlank = blankSize > 0; - this.lastRowPos = startPos; - - this.liveGrid.table.className = this.liveGrid.options.tableClass; - // Check if user has set a onRefreshComplete function - var onRefreshComplete = this.liveGrid.options.onRefreshComplete; - if (onRefreshComplete != null) - onRefreshComplete(); - }, - - 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(RicoUtil.getElementsComputedStyle(this.div, '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, ajaxOptions ) { - - this.options = { - tableClass: $(tableId).className, - loadingClass: $(tableId).className, - scrollerBorderRight: '1px solid #ababab', - bufferTimeout: 20000, - sortAscendImg: 'images/sort_asc.gif', - sortDescendImg: 'images/sort_desc.gif', - sortImageWidth: 9, - sortImageHeight: 5, - ajaxSortURLParms: [], - onRefreshComplete: null, - requestParameters: null, - inlineStyles: true - }; - Object.extend(this.options, options || {}); - - this.ajaxOptions = {parameters: null}; - Object.extend(this.ajaxOptions, ajaxOptions || {}); - - this.tableId = tableId; - this.table = $(tableId); - - this.addLiveGridHtml(); - - 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.options.sortHandler = this.sortHandler.bind(this); - - if ( $(tableId + '_header') ) - this.sort = new Rico.LiveGridSort(tableId + '_header', this.options) - - this.processingRequest = null; - this.unprocessedRequest = null; - - this.initAjax(url); - if ( this.options.prefetchBuffer || this.options.prefetchOffset > 0) { - var offset = 0; - if (this.options.offset ) { - offset = this.options.offset; - this.scroller.moveScroll(offset); - this.viewPort.scrollTo(this.scroller.rowToPixel(offset)); - } - if (this.options.sortCol) { - this.sortCol = options.sortCol; - this.sortDir = options.sortDir; - } - this.requestContentRefresh(offset); - } - }, - - addLiveGridHtml: function() { - // Check to see if need to create a header table. - if (this.table.getElementsByTagName("thead").length > 0){ - // Create Table this.tableId+'_header' - var tableHeader = this.table.cloneNode(true); - tableHeader.setAttribute('id', this.tableId+'_header'); - tableHeader.setAttribute('class', this.table.className+'_header'); - - // Clean up and insert - for( var i = 0; i < tableHeader.tBodies.length; i++ ) - tableHeader.removeChild(tableHeader.tBodies[i]); - this.table.deleteTHead(); - this.table.parentNode.insertBefore(tableHeader,this.table); - } - - new Insertion.Before(this.table, "
"); - this.table.previousSibling.appendChild(this.table); - new Insertion.Before(this.table,"
"); - this.table.previousSibling.appendChild(this.table); - }, - - - resetContents: function() { - this.scroller.moveScroll(0); - this.buffer.clear(); - this.viewPort.clearContents(); - }, - - sortHandler: function(column) { - if(!column) return ; - this.sortCol = column.name; - this.sortDir = column.currentSort; - - this.resetContents(); - this.requestContentRefresh(0) - }, - - adjustRowSize: function() { - - }, - - 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 queryString - if (this.options.requestParameters) - queryString = this._createQueryString(this.options.requestParameters, 0); - - queryString = (queryString == null) ? '' : queryString+'&'; - queryString = queryString+'id='+this.tableId+'&page_size='+fetchSize+'&offset='+bufferStartPos; - if (this.sortCol) - queryString = queryString+'&sort_col='+escape(this.sortCol)+'&sort_dir='+this.sortDir; - - this.ajaxOptions.parameters = queryString; - var end = bufferStartPos+fetchSize; - new Ajax.Request(Query.getFullUrl('songs')+'&offset='+bufferStartPos+'&limit='+fetchSize,{method: 'get',onComplete: this.ajaxUpdate.bind(this)}); -// ajaxEngine.sendRequest( this.tableId + '_request', this.ajaxOptions ); - - this.timeoutHandler = setTimeout( this.handleTimedOut.bind(this), this.options.bufferTimeout); - - }, - - setRequestParams: function() { - this.options.requestParameters = []; - for ( var i=0 ; i < arguments.length ; i++ ) - this.options.requestParameters[i] = arguments[i]; - }, - - requestContentRefresh: function(contentOffset) { - this.fetchBuffer(contentOffset); - }, - - ajaxUpdate: function(ajaxResponse) { - try { - clearTimeout( this.timeoutHandler ); - var totalRows = ajaxResponse.responseXML.getElementsByTagName('totalrecords')[0].firstChild.nodeValue; - if (this.metaData.getTotalRows() != totalRows) { - this.setTotalRows(totalRows); - } - this.buffer.update(ajaxResponse,this.processingRequest.bufferOffset); - this.viewPort.bufferChanged(); - } - catch(err) {} - finally {this.processingRequest = null; } - this.processQueuedRequest(); - }, - - _createQueryString: function( theArgs, offset ) { - var queryString = "" - if (!theArgs) - return 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; - }, - - 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.options = options; - this.setOptions(); - 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() { - // preload the images... - new Image().src = this.options.sortAscendImg; - new Image().src = this.options.sortDescendImg; - - this.sort = this.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) { - if(isNaN(n)) return ; - 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] ) ); - return columns; - }, - - 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 .SORT_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++ ) { - var n = parentNode.childNodes[i]; - if (n.nodeType == 4) { - contentStr += n.nodeValue; - } - else { - contentStr += n.xml; - } - } - return contentStr; - }, - - _getContentAsStringMozilla: function(parentNode) { - var xmlSerializer = new XMLSerializer(); - var contentStr = ""; - for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) { - var n = parentNode.childNodes[i]; - if (n.nodeType == 4) { // CDATA node - contentStr += n.nodeValue; - } - else { - contentStr += xmlSerializer.serializeToString(n); - } - } - 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/admin-root/lib-js/script.aculo.us/Makefile.am b/admin-root/lib-js/script.aculo.us/Makefile.am deleted file mode 100644 index efb8d3ce..00000000 --- a/admin-root/lib-js/script.aculo.us/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ - -scriptaculousdir = ${pkgdatadir}/admin-root/lib-js/script.aculo.us -scriptaculous_DATA = builder.js controls.js dragdrop.js effects.js \ - scriptaculous.js slider.js unittest.js - -EXTRA_DIST = builder.js controls.js dragdrop.js effects.js \ - scriptaculous.js slider.js unittest.js - diff --git a/admin-root/lib-js/script.aculo.us/builder.js b/admin-root/lib-js/script.aculo.us/builder.js deleted file mode 100644 index 5b15ba93..00000000 --- a/admin-root/lib-js/script.aculo.us/builder.js +++ /dev/null @@ -1,101 +0,0 @@ -// 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/admin-root/lib-js/script.aculo.us/controls.js b/admin-root/lib-js/script.aculo.us/controls.js deleted file mode 100644 index 82857c44..00000000 --- a/admin-root/lib-js/script.aculo.us/controls.js +++ /dev/null @@ -1,815 +0,0 @@ -// 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) - 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/admin-root/lib-js/script.aculo.us/dragdrop.js b/admin-root/lib-js/script.aculo.us/dragdrop.js deleted file mode 100644 index b44afe48..00000000 --- a/admin-root/lib-js/script.aculo.us/dragdrop.js +++ /dev/null @@ -1,674 +0,0 @@ -// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// -// 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 - }, 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); - }, - - isContained: function(element, drop) { - var parentNode = element.parentNode; - return drop._containers.detect(function(c) { return parentNode == 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; - - if(this.last_active) this.deactivate(this.last_active); - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) { - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - if(drop.greedy) { - Droppables.activate(drop); - throw $break; - } - } - }); - }, - - 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) { - new Effect.Opacity(element, {duration:0.2, from:1.0, 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) { - new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0}); - }, - 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')) - this.handle = Element.childrenWithClassName(this.element, options.handle)[0]; - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll) 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) { - 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) { - //if(this.scrollInterval) this.scroll(); - this.stopScrolling(); - var 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) { - 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]); - } 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; - } - }, - - 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; - 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); - this.draw(Draggables._lastPointer); - - if(this.options.change) this.options.change(this); - } -} - -/*--------------------------------------------------------------------------*/ - -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: new Array(), - - options: function(element){ - element = $(element); - return this.sortables.detect(function(s) { return s.element == element }); - }, - - destroy: function(element){ - element = $(element); - this.sortables.findAll(function(s) { return s.element == element }).each(function(s){ - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - }); - this.sortables = this.sortables.reject(function(s) { return s.element == element }); - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, // fixme: unimplemented - 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, - 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, - 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, - hoverclass: options.hoverclass, - onHover: Sortable.onHover, - greedy: !options.dropOnEmpty - } - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // make it so - - // drop on empty handling - if(options.dropOnEmpty) { - Droppables.add(element, - {containment: options.containment, onHover: Sortable.onEmptyHover, greedy: false}); - 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); - options.droppables.push(e); - }); - - // keep reference - this.sortables.push(options); - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - if(!element.hasChildNodes()) return null; - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==options.tag.toUpperCase() && - (!options.only || (Element.hasClassName(e, options.only)))) - elements.push(e); - if(options.tree) { - var grandchildren = this.findElements(e, options); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : null); - }, - - onHover: function(element, dropon, overlap) { - 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) { - if(element.parentNode!=dropon) { - var oldParentNode = element.parentNode; - dropon.appendChild(element); - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon).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); - }, - - 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 name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } -} diff --git a/admin-root/lib-js/script.aculo.us/effects.js b/admin-root/lib-js/script.aculo.us/effects.js deleted file mode 100644 index 91d5348a..00000000 --- a/admin-root/lib-js/script.aculo.us/effects.js +++ /dev/null @@ -1,910 +0,0 @@ -// 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. - -/* ------------- element ext -------------- */ - -// 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.setStyle = function(element, style) { - element = $(element); - for(k in style) element.style[k.camelize()] = style[k]; -} - -Element.setContentZoom = function(element, percent) { - 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) { - return $A($(element).getElementsByTagName('*')).select( - function(c) { return Element.hasClassName(c, className) }); -} - -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(element) ? - 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)) - Element.setStyle(this.element, {zoom: 1}); - var options = Object.extend({ - from: Element.getOpacity(this.element) || 0.0, - to: 1.0 - }, arguments[1] || {}); - this.start(options); - }, - update: function(position) { - Element.setOpacity(this.element, 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) - Element.makePositioned(this.element); - this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0'); - this.originalTop = parseFloat(Element.getStyle(this.element,'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) { - Element.setStyle(this.element, { - 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 = Element.getStyle(this.element,'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 = Element.getStyle(this.element,'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) - Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if (this.restoreAfterFinish) Element.setStyle(this.element, 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'; - } - } - Element.setStyle(this.element, 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(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { - backgroundImage: Element.getStyle(this.element, 'background-image') }; - Element.setStyle(this.element, {backgroundImage: 'none'}); - if(!this.options.endcolor) - this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff'); - if(!this.options.restorecolor) - this.options.restorecolor = Element.getStyle(this.element, '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) { - Element.setStyle(this.element,{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() { - Element.setStyle(this.element, 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) { - var oldOpacity = Element.getInlineOpacity(element); - var options = Object.extend({ - from: Element.getOpacity(element) || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { with(Element) { - if(effect.options.to!=0) return; - hide(effect.element); - setStyle(effect.element, {opacity: oldOpacity}); }} - }, arguments[1] || {}); - return new Effect.Opacity(element,options); -} - -Effect.Appear = function(element) { - var options = Object.extend({ - from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0), - to: 1.0, - beforeSetup: function(effect) { with(Element) { - setOpacity(effect.element, effect.options.from); - show(effect.element); }} - }, arguments[1] || {}); - return new Effect.Opacity(element,options); -} - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, '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) { with(Element) { - setStyle(effect.effects[0].element, {position: 'absolute'}); }}, - afterFinishInternal: function(effect) { with(Element) { - hide(effect.effects[0].element); - setStyle(effect.effects[0].element, oldStyle); }} - }, arguments[1] || {}) - ); -} - -Effect.BlindUp = function(element) { - element = $(element); - Element.makeClipping(element); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { with(Element) { - [hide, undoClipping].call(effect.element); }} - }, arguments[1] || {}) - ); -} - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = Element.getDimensions(element); - 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) { with(Element) { - makeClipping(effect.element); - setStyle(effect.element, {height: '0px'}); - show(effect.element); - }}, - afterFinishInternal: function(effect) { - Element.undoClipping(effect.element); - } - }, arguments[1] || {}) - ); -} - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = Element.getInlineOpacity(element); - 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) { with(Element) { - [makePositioned,makeClipping].call(effect.element); - }}, - afterFinishInternal: function(effect) { with(Element) { - [hide,undoClipping,undoPositioned].call(effect.element); - setStyle(effect.element, {opacity: oldOpacity}); - }} - }) - } - }); -} - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: Element.getStyle(element, 'top'), - left: Element.getStyle(element, 'left'), - opacity: Element.getInlineOpacity(element) }; - 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) { with(Element) { - makePositioned(effect.effects[0].element); }}, - afterFinishInternal: function(effect) { with(Element) { - [hide, undoPositioned].call(effect.effects[0].element); - setStyle(effect.effects[0].element, oldStyle); }} - }, arguments[1] || {})); -} - -Effect.Shake = function(element) { - element = $(element); - var oldStyle = { - top: Element.getStyle(element, 'top'), - left: Element.getStyle(element, '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) { with(Element) { - undoPositioned(effect.element); - setStyle(effect.element, oldStyle); - }}}) }}) }}) }}) }}) }}); -} - -Effect.SlideDown = function(element) { - element = $(element); - Element.cleanWhitespace(element); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom'); - var elementDimensions = Element.getDimensions(element); - 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) { with(Element) { - makePositioned(effect.element); - makePositioned(effect.element.firstChild); - if(window.opera) setStyle(effect.element, {top: ''}); - makeClipping(effect.element); - setStyle(effect.element, {height: '0px'}); - show(element); }}, - afterUpdateInternal: function(effect) { with(Element) { - setStyle(effect.element.firstChild, {bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); }}, - afterFinishInternal: function(effect) { with(Element) { - undoClipping(effect.element); - // IE will crash if child is undoPositioned first - if(/MSIE/.test(navigator.userAgent)){ - undoPositioned(effect.element); - undoPositioned(effect.element.firstChild); - }else{ - undoPositioned(effect.element.firstChild); - undoPositioned(effect.element); - } - setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }} - }, arguments[1] || {}) - ); -} - -Effect.SlideUp = function(element) { - element = $(element); - Element.cleanWhitespace(element); - var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom'); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - restoreAfterFinish: true, - beforeStartInternal: function(effect) { with(Element) { - makePositioned(effect.element); - makePositioned(effect.element.firstChild); - if(window.opera) setStyle(effect.element, {top: ''}); - makeClipping(effect.element); - show(element); }}, - afterUpdateInternal: function(effect) { with(Element) { - setStyle(effect.element.firstChild, {bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); }}, - afterFinishInternal: function(effect) { with(Element) { - [hide, undoClipping].call(effect.element); - undoPositioned(effect.element.firstChild); - undoPositioned(effect.element); - setStyle(effect.element.firstChild, {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) { with(Element) { - makeClipping(effect.element); }}, - afterFinishInternal: function(effect) { with(Element) { - hide(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(element) }; - - var dims = Element.getDimensions(element); - 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) { with(Element) { - hide(effect.element); - makeClipping(effect.element); - makePositioned(effect.element); - }}, - 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) { with(Element) { - setStyle(effect.effects[0].element, {height: '0px'}); - show(effect.effects[0].element); }}, - afterFinishInternal: function(effect) { with(Element) { - [undoClipping, undoPositioned].call(effect.effects[0].element); - setStyle(effect.effects[0].element, 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(element) }; - - var dims = Element.getDimensions(element); - 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) { with(Element) { - [makePositioned, makeClipping].call(effect.effects[0].element) }}, - afterFinishInternal: function(effect) { with(Element) { - [hide, undoClipping, undoPositioned].call(effect.effects[0].element); - setStyle(effect.effects[0].element, oldStyle); }} - }, options) - ); -} - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || {}; - var oldOpacity = Element.getInlineOpacity(element); - 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) { Element.setStyle(effect.element, {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) { with(Element) { - [hide, undoClipping].call(effect.element); - setStyle(effect.element, oldStyle); - }} }); - }}, arguments[1] || {})); -} diff --git a/admin-root/lib-js/script.aculo.us/scriptaculous.js b/admin-root/lib-js/script.aculo.us/scriptaculous.js deleted file mode 100644 index d3fe9e53..00000000 --- a/admin-root/lib-js/script.aculo.us/scriptaculous.js +++ /dev/null @@ -1,45 +0,0 @@ -// 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.5.3', - require: function(libraryName) { - // inserting via DOM fails in Safari 2.0, so brute force approach - document.write(''); - }, - load: function() { - if((typeof Prototype=='undefined') || - parseFloat(Prototype.Version.split(".")[0] + "." + - Prototype.Version.split(".")[1]) < 1.4) - throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.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/admin-root/lib-js/script.aculo.us/slider.js b/admin-root/lib-js/script.aculo.us/slider.js deleted file mode 100644 index c0f1fc01..00000000 --- a/admin-root/lib-js/script.aculo.us/slider.js +++ /dev/null @@ -1,283 +0,0 @@ -// 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/admin-root/lib-js/script.aculo.us/unittest.js b/admin-root/lib-js/script.aculo.us/unittest.js deleted file mode 100644 index 7c6d2f84..00000000 --- a/admin-root/lib-js/script.aculo.us/unittest.js +++ /dev/null @@ -1,372 +0,0 @@ -// 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])); - } -} - -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/admin-root/linkOpaque.gif b/admin-root/linkOpaque.gif deleted file mode 100644 index 24010ecddfd6a56c379e24f41be4159f3a9b30d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102 zcmZ?wbhEHbWMklF*v!C?+%sqEv2*|b|7Rc$DE?$&WME)o&;cn2nZdv!9B{%@b;swX Tp6nl&#ared%MDX^VXy`O+7A?w diff --git a/admin-root/linkTransparent.gif b/admin-root/linkTransparent.gif deleted file mode 100644 index c2dd10f556fb58e987719d2e1b9f1eff94dce5f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102 zcmZ?wbhEHbWMklF*v!E2e<{QNbJhR<|7Rc$DE?$&WME)o&;cn2nZdv!9B{%@b;swX Tp6nl&#ared%MDX^VXy`O - - - Firefly Media Server - -No access - - -

    No access

    -You have no password set in your config file.
    -Without a password access is only permitted from the computer where
    Firefly Media Server is running.
    -
    -To enable Firefly remote administration open your config file:
    -
    -@CONFFILE@

    -Find the section marked [general] and add the following line after the mark:
    -
    - -admin_pw = your_password - -
    -
    -You will need to restart Firefly for the change to take effect. - - \ No newline at end of file diff --git a/admin-root/playlist.html b/admin-root/playlist.html deleted file mode 100644 index 42f5e9ec..00000000 --- a/admin-root/playlist.html +++ /dev/null @@ -1,141 +0,0 @@ -@include hdr.html@ - -
    - - -
    - -
    -
    - -
    - - -Add static playlist -

    -Things that work:
    -* Browse Library and playlists
    -* Search Library and playlists
    -* Dblclick playlist = rename
    -* Add static playlist
    -* Delete playlist (hit delete)
    -
    -Broken stuff
    -* Truncated song info
    -* IE no playlist rename
    -* IE no add playlist
    -* IE scrollbar misaligned
    -
    -
    - Genre
    - - -
    -
    -Artist
    - -
    -
    -Album
    - -
    -
    - - - - - - - -
    SongTimeArtistAlbum
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    -
    -@include ftr.html@ \ No newline at end of file diff --git a/admin-root/playlist.js b/admin-root/playlist.js deleted file mode 100644 index b924f21c..00000000 --- a/admin-root/playlist.js +++ /dev/null @@ -1,706 +0,0 @@ -// TODO -// move stuff to responsehandler -// handle source change events (keyPress etc) -// If playlist is empty don't confirm delete -var CustomDraggable = Class.create(); -CustomDraggable.removeOnDrop = false; -CustomDraggable.revereNamesOnDrop = true; - -CustomDraggable.prototype = (new Rico.Draggable()).extend( { - - initialize: function( htmlElement, name ) { - this.type = 'Custom'; - this.htmlElement = htmlElement; - this.name = name; - }, - - log: function(str) { -// alert(str); - }, - - select: function() { - this.selected = true; - }, - - deselect: function() { - this.selected = false; - }, - - startDrag: function() { - var el = this.htmlElement; - this.log("startDrag: [" + this.name +"]"); - }, - - cancelDrag: function() { - var el = this.htmlElement; - this.log("cancelDrag: [" + this.name +"]"); - }, - - endDrag: function() { - var el = this.htmlElement; - this.log("endDrag: [" + this.name +"]"); - if ( CustomDraggable.removeOnDrop ) - this.htmlElement.style.display = 'none'; - - }, - - getSingleObjectDragGUI: function() { - var el = this.htmlElement; - - var div = document.createElement("div"); - div.className = 'customDraggable'; - div.style.width = (this.htmlElement.offsetWidth - 10) + "px"; - new Insertion.Top( div, "some songs" ); - return div; - }, - - getMultiObjectDragGUI: function( draggables ) { - var el = this.htmlElement; - - var names = ""; - names = "some song(s)"; - - var div = document.createElement("div"); - div.className = 'customDraggable'; - div.style.width = (this.htmlElement.offsetWidth - 10) + "px"; - new Insertion.Top( div, names ); - return div; - }, - - getDroppedGUI: function() { - var el = this.htmlElement; - - var div = document.createElement("div"); - var names = this.name.split(","); - if ( CustomDraggable.revereNamesOnDrop ) - new Insertion.Top( div, "[" + names[1].substring(1) + " " + names[0]+ "]" ); - else - new Insertion.Top( div, "[" + this.name + "]" ); - return div; - }, - - toString: function() { - return this.name; - } -} ); - - -var CustomDropzone = Class.create(); -CustomDropzone.prototype = (new Rico.Dropzone()).extend( { - initialize: function( htmlElement, header) { - this.htmlElement = htmlElement; - this.header = header; - this.absoluteRect = null; - this.acceptedObjects = []; - - this.offset = navigator.userAgent.toLowerCase().indexOf("msie") >= 0 ? 0 : 1; - }, - - activate: function() { - }, - - deactivate: function() { - }, - - showHover: function() { - if ( this.showingHover ) - return; - this.header.style.color = "#1111bb"; - this.showingHover = true; - }, - - hideHover: function() { - if ( !this.showingHover ) - return; - this.header.style.color = "#000000"; - this.showingHover = false; - }, - - accept: function(draggableObjects) { - var songids = ''; - for (var i = SelectedRows.songId.length - 1; i >= 0; --i) { - if (SelectedRows.songId[i]) { - if (songids != '') { - songids += ","; - } - songids += i; - } - } - - this._insert(songids); - }, - - _insert: function(songids) { - var url = 'databases/1/containers/' + this.htmlElement.value + "/items/add?output=xml&dmap.itemid=" + songids; - new Ajax.Request(url ,{method: 'get',onComplete:this.responseAdd}); - }, - - responseAdd: function(request) { - var status = Element.textContent(request.responseXML.getElementsByTagName('dmap.status')[0]); - if ('200' != status) { - alert("Couldn't add songs to playlist"); - return; - } - alert("Added songs to playlist"); - }, - - canAccept: function(draggableObjects) { - return true; - } -} ); - - -Event.observe(window,'load',initPlaylist); - -var SEARCH_DELAY = 500; // # ms without typing before the search box searches -var BROWSE_TEXT_LEN = 30; // genres/artists/albums select options longer than this will have - // a title attribute (to show a tool tip for items that doesn't fit the box -var g_myLiveGrid; // the live grid; -function initPlaylist() { -Ajax.Responders.register({ onCreate: Spinner.incRequestCount, - onComplete: Spinner.decRequestCount}); - - new Ajax.Request('databases/1/containers?output=xml',{method: 'get',onComplete:rsSource}); - Query.send('genres'); - Event.observe('search','keypress',EventHandler.searchKeyPress); - Event.observe('source','change',EventHandler.sourceChange); - Event.observe('source','click',EventHandler.sourceClick); - Event.observe('source','keypress',EventHandler.sourceKeyPress); - Event.observe('genres','change',EventHandler.genresChange); - Event.observe('artists','change',EventHandler.artistsChange); - Event.observe('albums','change',EventHandler.albumsChange); - Event.observe('add_playlist_href','click',EventHandler.addPlaylistHrefClick); - - Event.observe(document,'click',GlobalEvents.click); - Event.observe('edit_playlist_name','keypress',EventHandler.editPlaylistNameKeyPress); - Event.observe('songs_data','click',SelectedRows.click); - // Firefox remebers the search box value on page reload - Field.clear('search'); - g_myLiveGrid = new Rico.LiveGrid('songs_data',20,1000,'',{prefetchBuffer: false}); - - for (var i = $('songs_data').rows.length - 1; i >= 0; --i) { - dndMgr.registerDraggable(new CustomDraggable($('songs_data').rows[i], "bob " + i)); - } -} -var Spinner = { - count: 0, - incRequestCount: function (ca) { - Spinner.count++; - $('spinner').style.visibility = 'visible'; - }, - decRequestCount: function (caller) { - Spinner.count--; - if (/type=browse/.test(caller.url)) { - Spinner.count = 0; - $('spinner').style.visibility = 'hidden'; - } - } -}; -var GlobalEvents = { - _clickListeners: [], - click: function (e) { - GlobalEvents._clickListeners.each(function (name) { - name.click(e); - }); - }, - addClickListener: function (el) { - this._clickListeners.push(el); - }, - removeClickListener: function (el) { - this._clickListeners = this._clickListeners.findAll(function (element) { - return (element != el); - }); - } -}; - -var Source = { - playlistId: '', - playlistName: '', - _getOptionElement: function (id) { - return option = $A($('source').getElementsByTagName('option')).find(function (el) { - return (el.value == id); - }); - }, - addPlaylist: function () { - var url = 'databases/1/containers/add?output=xml'; - var name= 'untitled playlist'; - if (this._playlistExists(name)) { - var i=1; - while (this._playlistExists(name +' ' + i)) { - i++; - } - name += ' ' +i; - } - this.playlistName = name; - url += '&org.mt-daapd.playlist-type=0&dmap.itemname=' + encodeURIComponent(name); - new Ajax.Request(url ,{method: 'get',onComplete:this.responseAdd}); - }, - _playlistExists: function (name) { - return $A($('source').getElementsByTagName('option')).pluck('firstChild').find(function (el) { - return el.nodeValue == name; - }); - }, - removePlaylist: function () { - if (window.confirm('Really delete playlist?')) { - var url = 'databases/1/containers/del?output=xml'; - url += '&dmap.itemid=' + $('source').value; - new Ajax.Request(url ,{method: 'get',onComplete:this.response}); - var option = this._getOptionElement($('source').value); - Element.remove(option); - } - }, - savePlaylistName: function () { - input = $('edit_playlist_name'); - var url = 'databases/1/containers/edit?output=xml'; - url += '&dmap.itemid=' + Source.playlistId; - url += '&dmap.itemname=' + encodeURIComponent(input.value); - new Ajax.Request(url ,{method: 'get',onComplete:this.response}); - var option = this._getOptionElement(Source.playlistId); - option.text = input.value; - this.hideEditPlaylistName(); - }, - editPlaylistName: function () { - input = $('edit_playlist_name'); - Source.playlistId = $('source').value; - playlistName = Element.textContent(this._getOptionElement(Source.playlistId)); - //###FIXME use prototype Position instead - input.style.top = RicoUtil.toDocumentPosition(this._getOptionElement(Source.playlistId)).y + 'px'; - input.value = playlistName; - input.style.display = 'block'; - Field.activate(input); - GlobalEvents.addClickListener(this); - }, - hideEditPlaylistName: function () { - $('edit_playlist_name').style.display = 'none'; - Field.activate('source'); - Source.playlistId = ''; - GlobalEvents.removeClickListener(this); - }, - response: function (request) { - // Check that the save gave response 200 OK - }, - responseAdd: function(request) { - var status = Element.textContent(request.responseXML.getElementsByTagName('dmap.status')[0]); - if ('200' != status) { -//###FIXME if someone else adds a playlist with the same name -// as mine, (before My page is refreshed) won't happen that often - alert('There is a playlist with that name, write some code to handle this'); - return; - } - Source.playlistId = Element.textContent(request.responseXML.getElementsByTagName('dmap.itemid')[0]); - var o = document.createElement('option'); - o.value = Source.playlistId; - o.text = Source.playlistName; - $('static_playlists').appendChild(o); - $('source').value = Source.playlistId; - Source.editPlaylistName(); - Query.setSource(Source.playlistId); - Query.send('genres'); - }, - click: function (e) { - //###FIXME use prototype Position instead - var x = Event.pointerX(e); - var y = Event.pointerY(e); - var el = $('edit_playlist_name'); - var pos = RicoUtil.toViewportPosition(el); - if ((x > pos.x) && (x < pos.x + el.offsetWidth) && - (y > pos.y) && (y < pos.y + el.offsetHeight)) { - // Click was in input box - return; - } - Source.savePlaylistName(); - } -}; - -var EventHandler = { - searchTimeOut: '', - sourceClickCount: [], - sourceClick: function (e) { - var playlistId = Event.element(e).value; - if (1 == playlistId) { - // do nothing for Library - return; - } - if (EventHandler.sourceClickCount[playlistId]) { - EventHandler.sourceClickCount[playlistId]++; - } else { - EventHandler.sourceClickCount[playlistId] = 1; - } - if (EventHandler.sourceClickCount[playlistId] > 1) { - el = Event.element(e); - if (!document.all && !el.text) { - // IE sends the select in the event, not the option - // Firefox generates and event when clicking in and empty area - // of the select box - return; - } - Source.editPlaylistName(); - } - }, - sourceChange: function (e) { - EventHandler.sourceClickCount = []; - Field.clear('search'); - var playlistId = $('source').value; - Query.setSource(playlistId); - Query.send('genres'); - }, - sourceKeyPress: function (e) { - if (e.keyCode == Event.KEY_DELETE) { - Source.removePlaylist(); - } - if (113 == e.keyCode) { - // F2 -//TODO edit playist, what is the key on a mac? - } - }, - editPlaylistNameKeyPress: function (e) { - input = $('edit_playlist_name'); - if (e.keyCode == Event.KEY_ESC) { - Source.hideEditPlaylistName(); - } - if (e.keyCode == Event.KEY_RETURN) { - Source.savePlaylistName(); - } - }, - addPlaylistHrefClick: function (e) { - Source.addPlaylist(); - }, - searchKeyPress: function (e) { - if (EventHandler.searchTimeOut) { - window.clearTimeout(EventHandler.searchTimeOut); - } - if (e.keyCode == Event.KEY_RETURN) { - EventHandler._search(); - } else { - EventHandler.searchTimeOut = window.setTimeout(EventHandler._search,SEARCH_DELAY); - } - }, - _search: function () { - Query.setSearchString($('search').value); - Query.send('genres'); - }, - genresChange: function (e) { - EventHandler._setSelected('genres'); - Query.send('artists'); - }, - artistsChange: function (e) { - EventHandler._setSelected('artists'); - Query.send('albums'); - }, - albumsChange: function (e) { - EventHandler._setSelected('albums'); - SelectedRows.clearAll(); - g_myLiveGrid.resetContents(); - g_myLiveGrid.requestContentRefresh(0); -// Query.send('songs'); - }, - _setSelected: function (type) { - var options = $A($(type).options); - Query.clearSelection(type); - if ($(type).value != 'all') { - options.each(function (option) { - if (option.selected) { - Query.addSelection(type,option.value); - } - }); - } - } -}; - -var Query = { - baseUrl: '/rsp/db/', - playlistId: '1', - genres: [], - artists:[], - albums: [], - busy: '', - searchString: '', - clearSelection: function (type) { - this[type] = []; - }, - addSelection: function (type,value){ - this[type].push(value); - }, - setSearchString: function (string) { - this.searchString = string; - }, - setSource: function (playlistId) { - Query.clearSelection('genres'); - Query.clearSelection('artists'); - Query.clearSelection('albums'); - Query.setSearchString(''); - Query.playlistId = playlistId; - }, - getUrl: function (type) { - var query=[]; - switch (type) { - case 'artists': - if (this.genres.length > 0) { - query = this.genres.collect(function(value){return 'genre%3D"'+value.encode()+'"';}); - } - break; - case 'albums': - if (this.artists.length > 0) { - query = this.artists.collect(function(value){return 'artist%3D"'+value.encode()+'"';}); - } else if (this.genres.length > 0) { - query = this.genres.collect(function(value){return 'genre%3D"'+value.encode()+'"';}); - } - break; - case 'songs': - if (this.albums.length > 0) { - query = this.albums.collect(function(value){return 'album%3D"'+value.encode()+'"';}); - } else if (this.artists.length > 0) { - query = this.artists.collect(function(value){return 'artist%3D"'+value.encode()+'"';}); - } else if (this.genres.length > 0) { - query = this.genres.collect(function(value){return 'genre%3D"'+value.encode()+'"';}); - } - break; - default: - // Do nothing - break; - } - if (this.searchString) { - var search = []; - var string = this.searchString.encode(); - ['genre','artist','album','title'].each(function (item) { - search.push(item +' includes "' + string + '"'); - }); - if (query.length > 0) { - return '&query=(' + search.join(' or ') + ') and ('.encode() + query.join(' or ')+ ')'; - } else { - return '&query=' + search.join(' or '); - } - } else { - if (query.length > 0) { - return '&query=' + query.join(' or '); - } else { - return ''; - } - } - }, - getFullUrl: function (type) { - this.busy = true; - var url; - var handler; - var meta = ''; - switch (type) { - case 'genres': - url = '/genre'; - break; - case 'artists': - url = '/artist'; - break; - case 'albums': - url = '/album'; - break; - case 'songs': - url = ''; - meta = '&type=browse'; - break; - default: - alert("Shouldn't happen 2"); - break; - } - return this.baseUrl + this.playlistId + url + '?dummy=' + meta + this.getUrl(type); - }, - send: function(type) { - if (('genres' == type) || ('artists' == type) || ('albums' == type)) { - handler = ResponseHandler[type]; - } else { - return; - // handler = rsSongs; - } - new Ajax.Request(this.getFullUrl(type), {method: 'get',onComplete:handler}); - } -}; -var ResponseHandler = { - genres: function (request) { - ResponseHandler._genreAlbumArtist(request,'genres'); - }, - artists: function (request) { - ResponseHandler._genreAlbumArtist(request,'artists'); - }, - albums: function (request) { - ResponseHandler._genreAlbumArtist(request,'albums'); - }, - _genreAlbumArtist: function (request,type) { - var items = $A(request.responseXML.getElementsByTagName('item')); - items = items.collect(function (el) { - return Element.textContent(el); - }).sort(); - var select = $(type); - Element.removeChildren(select); - - var o = document.createElement('option'); - o.value = 'all'; - o.appendChild(document.createTextNode('All (' + items.length + ' ' + type + ')')); - select.appendChild(o); - var selected = {}; - Query[type].each(function(item) { - selected[item] = true; - }); - Query.clearSelection(type); - if (ResponseHandler._addOptions(type,items,selected)) { - select.value='all'; - } - switch (type) { - case 'genres': - Query.send('artists'); - break; - case 'artists': - Query.send('albums'); - break; - case 'albums': - SelectedRows.clearAll(); - g_myLiveGrid.resetContents(); - g_myLiveGrid.requestContentRefresh(0); -// Query.send('songs'); - break; - default: - alert("Shouldn't happen 3"); - break; - } - }, - _addOptions: function (type,options,selected) { - el = $(type); - var nothingSelected = true; - options.each(function (option) { - var node; - //###FIXME I have no idea why the Builder.node can't create options - // with the selected state I want. - var o = document.createElement('option'); - o.value = option; - if (option.length >= BROWSE_TEXT_LEN) { - o.title = option; - } - o.appendChild(document.createTextNode(option)); - if (selected[option]) { - o.selected = true; - nothingSelected = false; - Query.addSelection(type,option); - } else { - o.selected = false; - } - el.appendChild(o); - }); - return nothingSelected; - } -}; - -function rsSource(request) { - var items = $A(request.responseXML.getElementsByTagName('dmap.listingitem')); - var sourceSelect = $('source'); - var smartPlaylists = []; - var staticPlaylists = []; - Element.removeChildren(sourceSelect); - - items.each(function (item,index) { - if (0 === index) { - // Skip Library - return; - } - - if (item.getElementsByTagName('com.apple.itunes.smart-playlist').length > 0) { - smartPlaylists.push({name: Element.textContent(item.getElementsByTagName('dmap.itemname')[0]), - id: Element.textContent(item.getElementsByTagName('dmap.itemid')[0])}); - } else { - staticPlaylists.push({name: Element.textContent(item.getElementsByTagName('dmap.itemname')[0]), - id: Element.textContent(item.getElementsByTagName('dmap.itemid')[0])}); - } - }); - sourceSelect.appendChild(Builder.node('option',{value: '1'},'Library')); - if (smartPlaylists.length > 0) { - optgroup = Builder.node('optgroup',{label: 'Smart playlists'}); - smartPlaylists.each(function (item) { - var option = document.createElement('option'); - optgroup.appendChild(Builder.node('option',{value: item.id},item.name)); - }); - sourceSelect.appendChild(optgroup); - } - if (staticPlaylists.length > 0) { - optgroup = Builder.node('optgroup',{label: 'Static playlists',id: 'static_playlists'}); - staticPlaylists.each(function (item) { - var option = document.createElement('option'); - optgroup.appendChild(Builder.node('option',{value: item.id},item.name)); - }); - sourceSelect.appendChild(optgroup); - - - var options = $('static_playlists').getElementsByTagName("option"); - for (var j = 0; j < options.length; j++) { - dndMgr.registerDropZone(new CustomDropzone(options[j], $('static_playlists'))); - } - } - // Select Library - sourceSelect.value = 1; -} - -SelectedRows = { - songId: [], - click: function(e) { - var tr = Event.findElement(e,'tr'); - var id = tr.getAttribute('songid'); - if (!id) { - return; - } - if (e.ctrlKey) { - if (SelectedRows.isSelected(tr)) { - SelectedRows.unsetSelected(tr); - } else { - SelectedRows.setSelected(tr); - } - return; - } - if (e.shiftKey) { - return; - } - if (SelectedRows.isSelected(tr)) { - SelectedRows.clearAll(); - } else { - SelectedRows.clearAll(); - SelectedRows.setSelected(tr); - } - }, - isSelected: function (tr) { - return SelectedRows.songId[tr.getAttribute('songid')]; - }, - setSelected: function (tr) { - SelectedRows.songId[tr.getAttribute('songid')] = tr.getAttribute('index'); - tr.style.backgroundColor = '#8CACBB'; - }, - unsetSelected: function (tr) { - SelectedRows.songId[tr.getAttribute('songid')] = ''; - tr.style.backgroundColor = ''; - }, - clearAll: function () { - SelectedRows.songId = []; - $A($('songs_data').getElementsByTagName('tr')).each(SelectedRows.unsetSelected); - }, - updateState: function (tr,songId,index) { - if (songId && (index || 0 === index)) { - // 0 == false but we want to catch index == 0 - tr.setAttribute('songid',songId); - tr.setAttribute('index',index); - if (SelectedRows.isSelected(tr)) { - SelectedRows.setSelected(tr); - } else { - SelectedRows.unsetSelected(tr); - } - } else { - tr.setAttribute('songid',''); - tr.setAttribute('index',''); - SelectedRows.unsetSelected(tr); - } - } -}; - -String.prototype.encode = function () { - return encodeURIComponent(this).replace(/\'/g,"\\'"); -}; -// Stolen from prototype 1.5 -String.prototype.truncate = function(length, truncation) { - length = length || 30; - truncation = truncation === undefined ? '...' : truncation; - var ret = (this.length > length) ? this.slice(0, length - truncation.length) + truncation : this; - return '' + ret; -}; diff --git a/admin-root/pngfix.js b/admin-root/pngfix.js deleted file mode 100644 index ac3947ff..00000000 --- a/admin-root/pngfix.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - -Correctly handle PNG transparency in Win IE 5.5 & 6. -http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006. - -Use in with DEFER keyword wrapped in conditional comments: - - -*/ - -var arVersion = navigator.appVersion.split("MSIE") -var version = parseFloat(arVersion[1]) - -if ((version >= 5.5) && (document.body.filters)) -{ - for(var i=0; i" - img.outerHTML = strNewHTML - i = i-1 - } - } -} diff --git a/admin-root/required.gif b/admin-root/required.gif deleted file mode 100644 index bd7197698e1cb85d97ddc5f047f44b22cd3a3b43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47 xcmZ?wbhEHbWMyDyXkcLY4@Cd}EB<6*WME)q&|v@qkPHJ8TTlOj({E!KtN{^=3!4A{ diff --git a/admin-root/smart.html b/admin-root/smart.html deleted file mode 100644 index 5efb0273..00000000 --- a/admin-root/smart.html +++ /dev/null @@ -1,44 +0,0 @@ -@include hdr.html@ - -

    Smart Playlists

    - - - - - -
    IDPlaylist NameTypeCountAction
    -Add new playlist - -
    -
    - - -
    - - -@include ftr.html@ diff --git a/admin-root/smart.js b/admin-root/smart.js deleted file mode 100644 index fbe561ee..00000000 --- a/admin-root/smart.js +++ /dev/null @@ -1,265 +0,0 @@ -var req; -var playlist_info={}; -var g_messageTimeout; - -function pl_editor_state(state) { - var pleditor = document.getElementById("pl_editor"); - if(!pleditor) - return; - - if(state) { - pleditor.style.display="block"; - } else { - pleditor.style.display="none"; - } - - return; -} - -function pl_errormsg(msg) { - if (g_messageTimeout) { - window.clearTimeout(g_messageTimeout); - } - var msgdiv = document.getElementById("pl_warning"); - - if(!msgdiv) - return; - - msgdiv.innerHTML = msg + "\n"; - - if(msg == "") { - msgdiv.style.display="none"; - } else { - Effect.Appear(msgdiv,{duration: 0.2}); - if (('Success' == msg) || 'Cancelled' == msg) { - g_messageTimeout = window.setTimeout(function(){ - Effect.Fade(msgdiv,{duration: 0.2}); - },3000); - } - } -} - -function pl_displayresults(xmldoc,query) { - var status_string; - var status; - - if(!xmldoc) { - pl_errormsg("No xmldoc!"); - return; - } - - if(!xmldoc.getElementsByTagName("dmap.status")) { - pl_errormsg("No dmap.status??"); - return; - } - - status = xmldoc.getElementsByTagName("dmap.status")[0].firstChild.nodeValue; - - if(!status) - return; - - status = status * 1; - - if(status != 200) { - status_string = "Error " + status + ": "; - - if(xmldoc.getElementsByTagName("dmap.statusstring")) { - status_string = status_string + xmldoc.getElementsByTagName("dmap.statusstring")[0].firstChild.nodeValue; - } else { - status_string = status_string + "Unspecified error"; - } - - pl_errormsg(status_string); - } else { - pl_editor_state(false); - pl_errormsg("Success"); - } -} - -function pl_update() { - /* this is either update or create, depending... */ - pl_errormsg(''); - var id, name, spec; - - id = document.getElementById('playlist_id').value; - name = encodeURIComponent(document.getElementById('playlist_name').value); - spec = encodeURIComponent(document.getElementById('playlist_spec').value); - - if(id == '0') { - /* new playlist... post it! */ - var url = 'databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; - result = pl_exec(url,false); - } else { - var url='databases/1/containers/edit?output=xml&dmap.itemid=' + id + '&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; - result = pl_exec(url,false); - } - - pl_displayresults(req.responseXML); - - init(); -// pl_editor_state(false); -} - -function pl_cancel() { - pl_errormsg("Cancelled"); - pl_editor_state(false); -} - -function pl_new() { - var msgdiv = document.getElementById("pl_warning"); - var pleditor=document.getElementById("pl_editor"); - - pl_errormsg(""); - - document.forms['pl_form']['playlist_id'].value='0'; - document.forms['pl_form']['playlist_name'].value = 'New Playlist'; - document.forms['pl_form']['playlist_spec'].value = ''; - document.forms['pl_form']['submit_button'].value = 'Create'; - - pl_editor_state(true); -} - -function pl_delete(pl_id) { - if(confirm('Are you sure you want to delete playlist "' + playlist_info[pl_id]['name'] + '"?')) { - result=pl_exec("databases/1/containers/del?output=xml&dmap.itemid=" + pl_id,false); - init(); - } -} - - -function pl_edit(pl_id) { - var msgdiv = document.getElementById("pl_warning"); - var pleditor=document.getElementById("pl_editor"); - - if((!msgdiv)||(!pleditor)) - return; - - msgdiv.style.display="none"; - pleditor.style.display="none"; - - if(pl_id == 1) { - msgdiv.innerHTML="Cannot edit library playlist"; - msgdiv.style.display="block"; - return; - } - - if(playlist_info[pl_id]['type'] != 1) { - msgdiv.innerHTML="Can only edit smart playlists"; - msgdiv.style.display="block"; - return; - } - - document.forms['pl_form']['playlist_id'].value = pl_id; - document.forms['pl_form']['playlist_name'].value = playlist_info[pl_id]['name']; - document.forms['pl_form']['playlist_spec'].value = playlist_info[pl_id]['spec']; - document.forms['pl_form']['submit_button'].value = 'Update'; - - pleditor.style.display="block"; - - //alert(playlist_info[pl_id]['name']); -} - -function pl_process() { - var xmldoc = req.responseXML; - var playlists = xmldoc.getElementsByTagName("dmap.listingitem"); - var pl_table = document.getElementById("playlists"); - playlist_info = {}; - - while(pl_table.childNodes.length > 0) { - pl_table.removeChild(pl_table.lastChild); - } - for(var x=0; x < playlists.length; x++) { - var pl_id; - var pl_name; - var pl_type; - var pl_count; - - pl_id=playlists[x].getElementsByTagName("dmap.itemid")[0].firstChild.nodeValue; - if(playlists[x].getElementsByTagName("dmap.itemname")[0].firstChild) { - pl_name=playlists[x].getElementsByTagName("dmap.itemname")[0].firstChild.nodeValue; - } else { - pl_name = ""; - } - pl_type=playlists[x].getElementsByTagName("org.mt-daapd.playlist-type")[0].firstChild.nodeValue; - pl_count=playlists[x].getElementsByTagName("dmap.itemcount")[0].firstChild.nodeValue; - - - playlist_info[String(pl_id)] = { 'name': pl_name, 'type': pl_type }; - if(pl_type == 1) { - var pl_spec=playlists[x].getElementsByTagName("org.mt-daapd.smart-playlist-spec")[0].firstChild.nodeValue; - playlist_info[String(pl_id)]['spec'] = pl_spec; - } - - switch(pl_type) { - case "0": - pl_type = "Static (Web Edited)"; - break; - case "1": - pl_type = "Smart"; - break; - case "2": - pl_type = "Static (m3u/pls file)"; - break; - case "3": - pl_type = "Static (iTunes xml)"; - break; - } - - - var row = document.createElement("tr"); - var td1 = document.createElement("td"); - var td2 = document.createElement("td"); - var td3 = document.createElement("td"); - var td4 = document.createElement("td"); - var td5 = document.createElement("td"); - - td1.innerHTML=pl_id + '\n'; - td2.innerHTML=pl_name + '\n'; - td3.innerHTML=pl_type + '\n'; - td4.innerHTML=pl_count + '\n'; - if((pl_id != 1) && (playlist_info[pl_id]['type'] == 1)) { - td5.innerHTML='Edit'; - td5.innerHTML = td5.innerHTML + ' Delete'; - } else { - td5.innerHTML=" "; - } - - row.appendChild(td1); - row.appendChild(td2); - row.appendChild(td3); - row.appendChild(td4); - row.appendChild(td5); - pl_table.appendChild(row); - } -} - - -function pl_state_change() { - if(req.readyState == 4) { - if(req.status == 200) { - pl_process(); - } - } -} - -function init() { - pl_exec("databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec",true); -} - -function pl_exec(url, async) { - // branch for native XMLHttpRequest object - if (window.XMLHttpRequest) { - req = new XMLHttpRequest(); - req.onreadystatechange = pl_state_change; - req.open("GET", url, async); - return req.send(null); - // branch for IE/Windows ActiveX version - } else if (window.ActiveXObject) { - req = new ActiveXObject("Microsoft.XMLHTTP"); - if (req) { - req.onreadystatechange = pl_state_change; - req.open("GET", url, async); - return req.send(); - } - } -} diff --git a/admin-root/smartpopup.html b/admin-root/smartpopup.html deleted file mode 100644 index 6180b003..00000000 --- a/admin-root/smartpopup.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - Firefly playlist wizard - - - - - - -
    - - - - - - - - - - - -
    Wizard
    Template:
    Combine: - match all - match some -
    -
    - - - -
    Check out the Firefly Wiki for details.
    - - diff --git a/admin-root/spinner.gif b/admin-root/spinner.gif deleted file mode 100644 index b7a21abb769610314d2e349edf181c15e1265f29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 842 zcmZ?wbhEHb6krfw_`<-j_}~i$28IQDpClA^R!&&!A6FQeRX=6J<<@z7LsBYAx|Zd) z%$v3CcEj{-{j1KTR!qpMn+{Y@JW%{6>YJF7s*qHv;Fy(I;gg@3qL-PMmd~L0lZAl` zXpZ84Za>$MU}whwS0gkk-VBwS8!H(&1omA#!+Il&Tdy(P#o-QLB*P*D4^FXG9fLlnD_niq0$$JF z@`T!(mNT=|sATiTX!7%P!z^V+wloM5tPKiNm<&aZI;?1RmSbBZek{AYX%3^J(~|^y zhQ{qo`z9#6Hd$0T1x7R^@6KIR#x10@P~qjF#R-iGZM>mw%Os2LNb)T$c&+(4?SBKz z8Wv=0Kz;+p-UIxI#Y7K=h~OC< zjk%^vwlXHUcx+)~ShX`TNr$UXwV}XREcuA?2K67jZ<2q_OPaNs znq8$t1eP4uy_m3~BjEtkPXWVD4v7uZ9s2p4%`-Uk4O!AyV>G*a)D#)4LCF&g0Qm|6 AHvj+t diff --git a/admin-root/spinner_stopped.gif b/admin-root/spinner_stopped.gif deleted file mode 100644 index b375b4240c8aa4c7d4119136d51d5de1ba4a38ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 911 zcmZ?wbhEHb6krfw_|Cwv_}~i$28IQDpClA^R!&&!A6FQeRX=6J<<@z7LsBYAx|Zd) z%$v3CcEj{-{j1KTR!qpMn+{Yz3PwX0SQe^YThanks - -

    -Special thanks to the following people: -

    - -
    -@include CREDITS@
    -
    - -@include ftr.html@ diff --git a/admin-root/upnp-basic.xml b/admin-root/upnp-basic.xml deleted file mode 100644 index 431ebe98..00000000 --- a/admin-root/upnp-basic.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 1 - 0 - - - urn:schemas-upnp-org:device:MediaServer:1 - UPnP: @servername@ - Firefly Media Services - http://www.fireflymediaserver.org/ - Firefly Media Server (version @version@) - Firefly - 1 - http://www.fireflymediaserver.org/ - SERIAL-001 - uuid:@upnp@ - - - image/png - 32 - 32 - 32 - /upnp/ff_logo_32.png - - - - - urn:schemas-upnp-org:service:ConnectionManager:1 - urn:upnp-org:serviceId:ConnectionManager - /upnp-cm.xml - /upnp/cm/control - /upnp/cm/event - - - urn:schemas-upnp-org:service:ContentDirectory:1 - urn:upnp-org:serviceId:ContentDirectory - /upnp-cd.xml - /upnp/cd/control - /upnp/cd/event - - - /index.html - - http://@host@:@config general/port@/ - \ No newline at end of file diff --git a/admin-root/upnp-cd.xml b/admin-root/upnp-cd.xml deleted file mode 100644 index 255022e2..00000000 --- a/admin-root/upnp-cd.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - 1 - 0 - - - - Browse - - - ObjectID - in - A_ARG_TYPE_ObjectID - - - BrowseFlag - in - A_ARG_TYPE_BrowseFlag - - - Filter - in - A_ARG_TYPE_Filter - - - StartingIndex - in - A_ARG_TYPE_Index - - - RequestedCount - in - A_ARG_TYPE_Count - - - SortCriteria - in - A_ARG_TYPE_SortCriteria - - - Result - out - A_ARG_TYPE_Result - - - NumberReturned - out - A_ARG_TYPE_Count - - - TotalMatches - out - A_ARG_TYPE_Count - - - UpdateID - out - A_ARG_TYPE_UpdateID - - - - - DestroyObject - - - ObjectID - in - A_ARG_TYPE_ObjectID - - - - - GetSystemUpdateID - - - Id - out - SystemUpdateID - - - - - GetSearchCapabilities - - - SearchCaps - out - SearchCapabilities - - - - - GetSortCapabilities - - - SortCaps - out - SortCapabilities - - - - - UpdateObject - - - ObjectID - in - A_ARG_TYPE_ObjectID - - - CurrentTagValue - in - A_ARG_TYPE_TagValueList - - - NewTagValue - in - A_ARG_TYPE_TagValueList - - - - - - - A_ARG_TYPE_BrowseFlag - string - - BrowseMetadata - BrowseDirectChildren - - - - SystemUpdateID - ui4 - - - A_ARG_TYPE_Count - ui4 - - - A_ARG_TYPE_SortCriteria - string - - - SortCapabilities - string - - - A_ARG_TYPE_Index - ui4 - - - A_ARG_TYPE_ObjectID - string - - - A_ARG_TYPE_UpdateID - ui4 - - - A_ARG_TYPE_TagValueList - string - - - A_ARG_TYPE_Result - string - - - SearchCapabilities - string - - - A_ARG_TYPE_Filter - string - - - \ No newline at end of file diff --git a/admin-root/upnp-cm.xml b/admin-root/upnp-cm.xml deleted file mode 100644 index cf34ed86..00000000 --- a/admin-root/upnp-cm.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - 1 - 0 - - - - GetCurrentConnectionInfo - - - ConnectionID - in - A_ARG_TYPE_ConnectionID - - - RcsID - out - A_ARG_TYPE_RcsID - - - AVTransportID - out - A_ARG_TYPE_AVTransportID - - - ProtocolInfo - out - A_ARG_TYPE_ProtocolInfo - - - PeerConnectionManager - out - A_ARG_TYPE_ConnectionManager - - - PeerConnectionID - out - A_ARG_TYPE_ConnectionID - - - Direction - out - A_ARG_TYPE_Direction - - - Status - out - A_ARG_TYPE_ConnectionStatus - - - - - GetProtocolInfo - - - Source - out - SourceProtocolInfo - - - Sink - out - SinkProtocolInfo - - - - - GetCurrentConnectionIDs - - - ConnectionIDs - out - CurrentConnectionIDs - - - - - - - A_ARG_TYPE_ProtocolInfo - string - - - A_ARG_TYPE_ConnectionStatus - string - - OK - ContentFormatMismatch - InsufficientBandwidth - UnreliableChannel - Unknown - - - - A_ARG_TYPE_AVTransportID - i4 - - - A_ARG_TYPE_RcsID - i4 - - - A_ARG_TYPE_ConnectionID - i4 - - - A_ARG_TYPE_ConnectionManager - string - - - SourceProtocolInfo - string - - - SinkProtocolInfo - string - - - A_ARG_TYPE_Direction - string - - Input - Output - - - - CurrentConnectionIDs - string - - - \ No newline at end of file diff --git a/admin-root/upnp/ff_logo_16.png b/admin-root/upnp/ff_logo_16.png deleted file mode 100644 index 6ca818e4a815eeea854ff79ecf51b394e1e3a276..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 362 zcmV-w0hRuVP){zqgyX5%zt1c|kt~c}Bhx%N==5z6*Z#@bMM1XA%i~PCpg7kK`K2ltkj` z&jbj3iOA+|yoK-bp=>1o2;N&0O2$dhzIP~NF*{N3zk)mT%9ebMeVtukyD_Blt z9{ce=>JkI|3eig|+4~$5;YKv(Ts&u13ABwp)$xTrzY);}>5b`wK)B`LwBLJbe2`n< zVIn6Bl&=ys4{6^D68lCKjo5JQP{3PLiiPaC zME9AAO#4p0m>CC7H{uKkBr*W@+4F`H?zA4LmC;+Ho?~>rzl>OShDtk@(*e2lZaQlq zQ0f$9V4m}af?!NRqEn=O)QxBpdEi)wkeBLrN{9{&Sy>s!^N>|i_kVpUW!bn!S*(<{ sC})M!Z<<^2zbPcDhb^Wp>$ahVC+MWiDlZ;KEh@E_=BOWsuF>9bIAGw-qDzyF~CO z!*hZ6vcS_AkB+K$2G7yJeGYgAi6?jrd}Wo>f52;trI6r)N15HAT5ZNj^n3K5Fw*H< znco21Bq(WFuMVM_g55E}4@m?J zVKxE5{wLJ2DY4VTATg#{P_Uj}n%56lAon!UU8EOKNT1dcGfSw`ZmXZzxO+(;{bcOGNZ-E?Y9IjqSWP#riJ#anT*vfSwUNP|I0D`* zjU^hI0p5C!$=d(*J~dT*_E&%b0JaCBL;f|3 Q5&!@I07*qoM6N<$f{vDelmGw# diff --git a/admin-root/util.js b/admin-root/util.js deleted file mode 100644 index 5dd43116..00000000 --- a/admin-root/util.js +++ /dev/null @@ -1,81 +0,0 @@ -Object.extend(Element, { - removeChildren: function(element) { - while(element.hasChildNodes()) { - element.removeChild(element.firstChild); - } - }, - textContent: function(node) { - if ((!node) || !node.hasChildNodes()) { - // Empty text node - return ''; - } - if (node.textContent) { - // W3C ? - return node.textContent; - } else if (node.text) { - // IE - return node.text; - } else if (node.firstChild) { - // Safari - return node.firstChild.nodeValue; - } - // We shouldn't end up here; - return ''; - } -}); -/* Detta script finns att hamta pa http://www.jojoxx.net och - far anvandas fritt sa lange som dessa rader star kvar. */ -function DataDumper(obj,n,prefix){ - var str=""; prefix=(prefix)?prefix:""; n=(n)?n+1:1; var ind=""; for(var i=0;i"); } - } else { - for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); } - } - str+=ind+"]\n"; - } - return str; -} -var Cookie = { - getVar: function(name) { - var cookie = document.cookie; - if (cookie.length > 0) { - cookie += ';'; - } - re = new RegExp(name + '\=(.*?);' ); - if (cookie.match(re)) { - return RegExp.$1; - } else { - return ''; - } - }, - setVar: function(name,value,days) { - days = days || 30; - var expire = new Date(new Date().getTime() + days*86400); - document.cookie = name + '=' + value +';expires=' + expire.toUTCString(); - }, - removeVar: function(name) { - var date = new Date(12); - document.cookie = name + '=;expires=' + date.toUTCString(); - } -}; -var Util = { - startSpinner: function () { - $('spinner').src = 'spinner.gif'; - }, - stopSpinner: function () { - $('spinner').src = 'spinner_stopped.gif'; - } -} \ No newline at end of file diff --git a/admin-root/xiph-license.html b/admin-root/xiph-license.html deleted file mode 100644 index f21aeeb9..00000000 --- a/admin-root/xiph-license.html +++ /dev/null @@ -1,9 +0,0 @@ -@include hdr.html@ - -

    Xiph License

    - -

    -@include xiph-license.txt@
    -

    - -@include ftr.html@ diff --git a/admin-root/xiph-license.txt b/admin-root/xiph-license.txt deleted file mode 100644 index 0a104a9c..00000000 --- a/admin-root/xiph-license.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -- Neither the name of the Xiph.org Foundation nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/admin-root/zlib-license.html b/admin-root/zlib-license.html deleted file mode 100644 index 5bb55744..00000000 --- a/admin-root/zlib-license.html +++ /dev/null @@ -1,9 +0,0 @@ -@include hdr.html@ - -

    zlib License

    - -

    -@include zlib-license.txt@
    -

    - -@include ftr.html@ diff --git a/admin-root/zlib-license.txt b/admin-root/zlib-license.txt deleted file mode 100644 index b2b90734..00000000 --- a/admin-root/zlib-license.txt +++ /dev/null @@ -1,25 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly jloup@@gzip.org - Mark Adler madler@@alumni.caltech.edu - -*/ \ No newline at end of file diff --git a/configure.in b/configure.in index 46140a78..c1aee926 100644 --- a/configure.in +++ b/configure.in @@ -93,4 +93,4 @@ dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_OUTPUT(src/Makefile tools/Makefile admin-root/Makefile admin-root/lib-js/Makefile admin-root/lib-js/script.aculo.us/Makefile contrib/Makefile contrib/init.d/Makefile Makefile) +AC_OUTPUT(src/Makefile tools/Makefile contrib/Makefile contrib/init.d/Makefile Makefile)