You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2010/09/03 22:03:14 UTC
svn commit: r992446 - in /ofbiz/branches/jquery/framework:
common/webcommon/includes/ common/widget/ example/config/
example/widget/example/ images/webapp/images/jquery/plugins/
images/webapp/images/jquery/plugins/asmselect/
Author: jleroux
Date: Fri Sep 3 20:03:14 2010
New Revision: 992446
URL: http://svn.apache.org/viewvc?rev=992446&view=rev
Log:
Add asmselect (http://code.google.com/p/jquery-asmselect/) and show and example of use in Example component
Added:
ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl (with props)
ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/
ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt (with props)
ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css (with props)
ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js (with props)
ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js (with props)
Modified:
ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml
ofbiz/branches/jquery/framework/example/config/ExampleUiLabels.xml
ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleForms.xml
ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleScreens.xml
Added: ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl?rev=992446&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl (added)
+++ ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl Fri Sep 3 20:03:14 2010
@@ -0,0 +1,46 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<script type="text/javascript">
+ jQuery(document).ready(function() {
+
+ jQuery("#${multipleSelectForm}_${multipleSelect}").asmSelect({
+ addItemTarget: 'top',
+ sortable: true
+ });
+
+ // track changes with our own event
+ jQuery("#${multipleSelect}").change(function(e, data) {
+ // if it's a sort or an add, then give it a little color animation to highlight it
+ if(data.type != 'drop') data.item.animate({ 'backgroundColor': '#ffffcc' }, 20, 'linear', function() {
+ data.item.animate({ 'backgroundColor': '#dddddd' }, 500);
+ });
+ });
+
+ });
+</script>
+
+<style type="text/css">
+ #${multipleSelectForm} {
+ width: ${formSize}px;
+ position: relative;
+ }
+.asmListItem {
+ width: ${asmListItemPercentOfForm}%;
+}
+</style>
Propchange: ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml?rev=992446&r1=992445&r2=992446&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml Fri Sep 3 20:03:14 2010
@@ -114,6 +114,8 @@ under the License.
<section>
<actions>
<!-- The default (global) java scripts -->
+ <!-- jQuery part -->
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/js/jquery-ui-1.8.2.custom.min.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-0.5.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jeditable/jquery.jeditable.js" global="true"/>
@@ -122,6 +124,9 @@ under the License.
<set field="initialLocale" type="String" value="${parameters.userLogin.lastLocale}" default-value="${groovy:locale.toString()}"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/i18n/jquery.ui.datepicker-${initialLocale}.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.js" global="true"/>
+ <!-- jQuery CSSs -->
+ <set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect.css" global="true"/>
+
<set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/>
<set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>
<set field="layoutSettings.javaScripts[]" value="/images/GooglemapMarkers.js" global="true"/>
@@ -318,13 +323,19 @@ under the License.
<set field="layoutSettings.styleSheets[+0]" value="/images/maincss.css" global="true"/>
<set field="layoutSettings.rtlStyleSheets[+0]" value="/images/mainrtl.css" global="true"/>
<!-- The default (global) java scripts -->
- <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/jquery-ui-1.8.2.custom.min.js" global="true"/>
+ <!-- jQuery part -->
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/js/jquery-ui-1.8.2.custom.min.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-0.5.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jeditable/jquery.jeditable.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/fjTimer/jquerytimer-min.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js" global="true"/>
<set field="initialLocale" type="String" value="${parameters.userLogin.lastLocale}" default-value="${groovy:locale.toString()}"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/i18n/jquery.ui.datepicker-${initialLocale}.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.js" global="true"/>
+ <!-- jQuery CSSs -->
+ <set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect.css" global="true"/>
+
<set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/>
<set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>
<set field="layoutSettings.javaScripts[]" value="/images/GooglemapSimple.js" global="true"/>
Modified: ofbiz/branches/jquery/framework/example/config/ExampleUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/example/config/ExampleUiLabels.xml?rev=992446&r1=992445&r2=992446&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/example/config/ExampleUiLabels.xml (original)
+++ ofbiz/branches/jquery/framework/example/config/ExampleUiLabels.xml Fri Sep 3 20:03:14 2010
@@ -486,6 +486,14 @@
<value xml:lang="th">สำหรัà¸à¸à¹à¸²à¸à¸à¸µà¹à¸ªà¸à¹à¸à¸ªà¸²à¸¡à¸²à¸£à¸à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¹à¸à¹, à¹à¸à¸¢à¹à¸à¹ à¸à¸·à¹à¸à¸à¸¹à¹à¹à¸à¹:admin, รหัสà¸à¹à¸²à¸:ofbiz</value>
<value xml:lang="zh">å¦æ对æé¨åæå
´è¶£ï¼è¯·å
ç¡®ä¿¡ä½ å·²ç»å½ï¼å¯ä»¥å°è¯ç¨ ç¨æ·å:adminãå¯ç :ofbizç»å½ã</value>
</property>
+ <property key="ExampleMultipleDropDowns">
+ <value xml:lang="en">Multiple drop-downs</value>
+ <value xml:lang="fr">liste déroulante avec choix multiples</value>
+ </property>
+ <property key="ExampleMultipleDropDownTooltip">
+ <value xml:lang="en">Needs some fields to be set, see in FormWidgetExampleScreens.xml (begins with multipleSelect)</value>
+ <value xml:lang="fr">Nécessite de définir certains champs, voir dans FormWidgetExampleScreens.xml (commence avec multipleSelect)</value>
+ </property>
<property key="ExampleNewExample">
<value xml:lang="en">New Example</value>
<value xml:lang="fr">Nouvel exemple</value>
Modified: ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleForms.xml?rev=992446&r1=992445&r2=992446&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleForms.xml (original)
+++ ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleForms.xml Fri Sep 3 20:03:14 2010
@@ -245,6 +245,25 @@ under the License.
</drop-down>
</field>
</form>
+
+ <!-- ****************************** -->
+ <!-- *** Multiple Dropdown *** -->
+ <!-- ****************************** -->
+ <!-- See why this is used here http://www.ryancramer.com/journal/entries/select_multiple/ -->
+ <form name="DropDownMultipleFieldExampleForm" type="single" title="">
+ <field name="emptyField1" title="${uiLabelMap.CommonEmptyHeader}"><display/></field>
+ <field name="multipleDropDownFields" title="${uiLabelMap.ExampleMultipleDropDowns}">
+ <display description="${uiLabelMap.ExampleMultipleDropDownTooltip}"/>
+ </field>
+ <field name="countryGeoIdMultiple" title="${uiLabelMap.CommonCountry}">
+ <drop-down no-current-selected-key="USA">
+ <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}">
+ <entity-constraint name="geoTypeId" value="COUNTRY"/>
+ <entity-order-by field-name="geoName"/>
+ </entity-options>
+ </drop-down>
+ </field>
+ </form>
<!-- Simple form to print a FOP PDF file with the fonts available in OFBiz Project -->
<form name="FOPFontsExampleForm" type="single" target="printExampleFOPFonts">
Modified: ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleScreens.xml?rev=992446&r1=992445&r2=992446&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleScreens.xml (original)
+++ ofbiz/branches/jquery/framework/example/widget/example/FormWidgetExampleScreens.xml Fri Sep 3 20:03:14 2010
@@ -64,11 +64,19 @@ under the License.
<set field="dependentKeyName" value="geoId"/>
<set field="descName" value="geoName"/>
<set field="selectedDependentOption" from-field="postalAddress.stateProvinceGeoId" default-value="_none_"/><!-- postalAddress.stateProvinceGeoId does not make much sense here, only to get the idea -->
+
+ <!-- fields for setMutipleSelectJs.ftl -->
+ <set field="multipleSelect" value="countryGeoIdMultiple"/>
+ <set field="multipleSelectForm" value="DropDownMultipleFieldExampleForm"/>
+ <set field="formSize" value="500"/>
+ <set field="asmListItemPercentOfForm" value="100"/>
</actions>
<widgets>
<!--platform-specific><html><html-template location="component://common/webcommon/includes/setCountryStatesEventJs.ftl"/></html></platform-specific-->
<platform-specific><html><html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/></html></platform-specific>
+ <platform-specific><html><html-template location="component://common/webcommon/includes/setMutipleSelectJs.ftl"/></html></platform-specific>
<include-form name="DropDownFieldsExampleForm" location="component://example/widget/example/FormWidgetExampleForms.xml"/>
+ <include-form name="DropDownMultipleFieldExampleForm" location="component://example/widget/example/FormWidgetExampleForms.xml"/>
</widgets>
</section>
</container>
Added: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt?rev=992446&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt (added)
+++ ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt Fri Sep 3 20:03:14 2010
@@ -0,0 +1,102 @@
+asmSelect - Alternate Select Multiple
+
+Documentation and more information at:
+http://code.google.com/p/jquery-asmselect/
+
+See related article at:
+http://www.ryancramer.com/journal/entries/select_multiple/
+
+VERSION 1.0.4a beta - June 3rd, 2009
+
+- Minor update to correct IE8 issue.
+ Thanks to Matthew Hutton for this fix.
+
+
+VERSION 1.0.4 beta - December 1, 2008
+
+- Fixed issue that interfered with multiple asmSelects
+ on the same page. This also solves an issue with
+ dynamically rendered (ajax) asmSelects on 1 page.
+
+- Changed options so that "animate" and "highlight"
+ now default to "false". These are just a bit too
+ slow on older computers, so I thought it would be
+ better not to make them active defaults.
+
+- Added code that triggers a change() event on the
+ original <select multiple> whenever a change is
+ made on the asmSelect. This means that other bits
+ of javascript don't need to know about asmSelect
+ if they happen to be monitoring the original
+ <select multiple> for changes.
+
+- Added some additional logic for dealing with IE and
+ determining whether a click preceded an item being
+ added to the list. This was necessary because IE
+ triggers change events when you are scrolling around
+ in a select. Thankfully not an issue with other browsers.
+
+- Added "optionDisabledClass" in program options.
+ This is a class assigned to <option> items that
+ are disabled. This was necessary because only
+ Safari allows the "disabled" attribute with
+ option tags (as far as I can tell). This is
+ mostly for internal use with asmSelect, so you can
+ ignore this unless you want to come up with your own
+ styles for disabled option items.
+
+- Added logic to detect Opera and force a redraw of
+ the html list when original select is modified.
+ Previously, opera would not draw the new list items...
+ They were in the DOM, just not on Opera's screen.
+
+- Updated documentation with note about the Firefox
+ autocomplete issue, which can be a factor on some
+ asmSelect implementations
+
+
+VERSION 1.0.3 beta
+
+- This version was released in the issues section
+ of the Google code site, but never released as
+ a full package. It fixed the issue with multiple
+ asmSelects on a single page.
+
+
+VERSION 1.0.2 beta - July 15, 2008
+
+- Updated license to consistent with jQuery and
+ jQuery UI: Dual MIT and GNU license.
+
+- Fixed issue with IE6 where original select multiple
+ would reappear when sorting was enabled.
+
+- Put in a partial fix for when IE6 select is being
+ scrolled without being focused. (ieClick)
+
+- Updated for some other minor IE6 fixes, but still
+ not 100% on IE6, see 'Known Issues' in docs.
+
+- Changed 'animate' and 'highlight' to be false by
+ default. These are too slow on old computers.
+
+- Added new class to CSS 'optionDisabledClass' that
+ is applied to disabled options. This was necessary
+ becase Firefox and IE don't fade disabled options
+ like Safari does.
+
+- Removed some extraneous code.
+
+
+VERSION 1.0.1 beta - July 7, 2008
+
+- Corrected an issue with IE where asmSelect didn't work if option values were blank.
+
+
+VERSION 1.0.0 beta - July 5, 2008
+
+Initial release
+
+
+Copyright 2008 by Ryan Cramer
+
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css?rev=992446&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css (added)
+++ ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css Fri Sep 3 20:03:14 2010
@@ -0,0 +1,63 @@
+.asmContainer {
+ /* container that surrounds entire asmSelect widget */
+}
+
+.asmSelect {
+ /* the newly created regular 'select' */
+ display: inline;
+}
+
+.asmOptionDisabled {
+ /* disabled options in new select */
+ color: #999;
+}
+
+.asmHighlight {
+ /* the highlight span */
+ padding: 0;
+ margin: 0 0 0 1em;
+}
+
+.asmList {
+ /* html list that contains selected items */
+ margin: 0.25em 0 1em 0;
+ position: relative;
+ display: block;
+ padding-left: 0;
+ list-style: none;
+}
+
+.asmListItem {
+ /* li item from the html list above */
+ position: relative;
+ margin-left: 0;
+ padding-left: 0;
+ list-style: none;
+ background: #ddd;
+ border: 1px solid #bbb;
+ width: 100%;
+ margin: 0 0 -1px 0;
+ line-height: 1em;
+}
+
+.asmListItem:hover {
+ background-color: #e5e5e5;
+}
+
+.asmListItemLabel {
+ /* this is a span that surrounds the text in the item, except for the remove link */
+ padding: 5px;
+ display: block;
+}
+
+.asmListSortable .asmListItemLabel {
+ cursor: move;
+}
+
+.asmListItemRemove {
+ /* the remove link in each list item */
+ position: absolute;
+ right: 0;
+ top: 0;
+ padding: 5px;
+}
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.css
------------------------------------------------------------------------------
svn:mime-type = text/css
Added: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js?rev=992446&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js (added)
+++ ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js Fri Sep 3 20:03:14 2010
@@ -0,0 +1,407 @@
+/*
+ * Alternate Select Multiple (asmSelect) 1.0.4a beta - jQuery Plugin
+ * http://www.ryancramer.com/projects/asmselect/
+ *
+ * Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com
+ *
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ */
+
+(function($) {
+
+ $.fn.asmSelect = function(customOptions) {
+
+ var options = {
+
+ listType: 'ol', // Ordered list 'ol', or unordered list 'ul'
+ sortable: false, // Should the list be sortable?
+ highlight: false, // Use the highlight feature?
+ animate: false, // Animate the the adding/removing of items in the list?
+ addItemTarget: 'bottom', // Where to place new selected items in list: top or bottom
+ hideWhenAdded: false, // Hide the option when added to the list? works only in FF
+ debugMode: false, // Debug mode keeps original select visible
+
+ removeLabel: 'remove', // Text used in the "remove" link
+ highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item
+ highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item
+
+ containerClass: 'asmContainer', // Class for container that wraps this widget
+ selectClass: 'asmSelect', // Class for the newly created <select>
+ optionDisabledClass: 'asmOptionDisabled', // Class for items that are already selected / disabled
+ listClass: 'asmList', // Class for the list ($ol)
+ listSortableClass: 'asmListSortable', // Another class given to the list when it is sortable
+ listItemClass: 'asmListItem', // Class for the <li> list items
+ listItemLabelClass: 'asmListItemLabel', // Class for the label text that appears in list items
+ removeClass: 'asmListItemRemove', // Class given to the "remove" link
+ highlightClass: 'asmHighlight' // Class given to the highlight <span>
+
+ };
+
+ $.extend(options, customOptions);
+
+ return this.each(function(index) {
+
+ var $original = $(this); // the original select multiple
+ var $container; // a container that is wrapped around our widget
+ var $select; // the new select we have created
+ var $ol; // the list that we are manipulating
+ var buildingSelect = false; // is the new select being constructed right now?
+ var ieClick = false; // in IE, has a click event occurred? ignore if not
+ var ignoreOriginalChangeEvent = false; // originalChangeEvent bypassed when this is true
+
+ function init() {
+
+ // initialize the alternate select multiple
+
+ // this loop ensures uniqueness, in case of existing asmSelects placed by ajax (1.0.3)
+ while($("#" + options.containerClass + index).size() > 0) index++;
+
+ $select = $("<select></select>")
+ .addClass(options.selectClass)
+ .attr('name', options.selectClass + index)
+ .attr('id', options.selectClass + index);
+
+ $selectRemoved = $("<select></select>");
+
+ $ol = $("<" + options.listType + "></" + options.listType + ">")
+ .addClass(options.listClass)
+ .attr('id', options.listClass + index);
+
+ $container = $("<div></div>")
+ .addClass(options.containerClass)
+ .attr('id', options.containerClass + index);
+
+ buildSelect();
+
+ $select.change(selectChangeEvent)
+ .click(selectClickEvent);
+
+ $original.change(originalChangeEvent)
+ .wrap($container).before($select).before($ol);
+
+ if(options.sortable) makeSortable();
+
+ if($.browser.msie && $.browser.version < 8) $ol.css('display', 'inline-block'); // Thanks Matthew Hutton
+ }
+
+ function makeSortable() {
+
+ // make any items in the selected list sortable
+ // requires jQuery UI sortables, draggables, droppables
+
+ $ol.sortable({
+ items: 'li.' + options.listItemClass,
+ handle: '.' + options.listItemLabelClass,
+ axis: 'y',
+ update: function(e, data) {
+
+ var updatedOptionId;
+
+ $(this).children("li").each(function(n) {
+
+ $option = $('#' + $(this).attr('rel'));
+
+ if($(this).is(".ui-sortable-helper")) {
+ updatedOptionId = $option.attr('id');
+ return;
+ }
+
+ $original.append($option);
+ });
+
+ if(updatedOptionId) triggerOriginalChange(updatedOptionId, 'sort');
+ }
+
+ }).addClass(options.listSortableClass);
+ }
+
+ function selectChangeEvent(e) {
+
+ // an item has been selected on the regular select we created
+ // check to make sure it's not an IE screwup, and add it to the list
+
+ if($.browser.msie && $.browser.version < 7 && !ieClick) return;
+ var id = $(this).children("option:selected").slice(0,1).attr('rel');
+ addListItem(id);
+ ieClick = false;
+ triggerOriginalChange(id, 'add'); // for use by user-defined callbacks
+ }
+
+ function selectClickEvent() {
+
+ // IE6 lets you scroll around in a select without it being pulled down
+ // making sure a click preceded the change() event reduces the chance
+ // if unintended items being added. there may be a better solution?
+
+ ieClick = true;
+ }
+
+ function originalChangeEvent(e) {
+
+ // select or option change event manually triggered
+ // on the original <select multiple>, so rebuild ours
+
+ if(ignoreOriginalChangeEvent) {
+ ignoreOriginalChangeEvent = false;
+ return;
+ }
+
+ $select.empty();
+ $ol.empty();
+ buildSelect();
+
+ // opera has an issue where it needs a force redraw, otherwise
+ // the items won't appear until something else forces a redraw
+ if($.browser.opera) $ol.hide().fadeIn("fast");
+ }
+
+ function buildSelect() {
+
+ // build or rebuild the new select that the user
+ // will select items from
+
+ buildingSelect = true;
+
+ // add a first option to be the home option / default selectLabel
+ $select.prepend("<option>" + $original.attr('title') + "</option>");
+
+ $original.children("option").each(function(n) {
+
+ var $t = $(this);
+ var id;
+
+ if(!$t.attr('id')) $t.attr('id', 'asm' + index + 'option' + n);
+ id = $t.attr('id');
+
+ if($t.is(":selected")) {
+ addListItem(id);
+ addSelectOption(id, true);
+ } else {
+ addSelectOption(id);
+ }
+ });
+
+ if(!options.debugMode) $original.hide(); // IE6 requires this on every buildSelect()
+ selectFirstItem();
+ buildingSelect = false;
+ }
+
+ function addSelectOption(optionId, disabled) {
+
+ // add an <option> to the <select>
+ // used only by buildSelect()
+
+ if(disabled == undefined) var disabled = false;
+
+ var $O = $('#' + optionId);
+ var $option = $("<option>" + $O.text() + "</option>")
+ .val($O.val())
+ .attr('rel', optionId);
+
+ if(disabled) disableSelectOption($option);
+
+ $select.append($option);
+ }
+
+ function selectFirstItem() {
+
+ // select the firm item from the regular select that we created
+
+ $select.children(":eq(0)").attr("selected", true);
+ }
+
+ function disableSelectOption($option) {
+
+ // make an option disabled, indicating that it's already been selected
+ // because safari is the only browser that makes disabled items look 'disabled'
+ // we apply a class that reproduces the disabled look in other browsers
+
+ $option.addClass(options.optionDisabledClass)
+ .attr("selected", false)
+ .attr("disabled", true);
+
+ if(options.hideWhenAdded) $option.hide();
+ if($.browser.msie) $select.hide().show(); // this forces IE to update display
+ }
+
+ function enableSelectOption($option) {
+
+ // given an already disabled select option, enable it
+
+ $option.removeClass(options.optionDisabledClass)
+ .attr("disabled", false);
+
+ if(options.hideWhenAdded) $option.show();
+ if($.browser.msie) $select.hide().show(); // this forces IE to update display
+ }
+
+ function addListItem(optionId) {
+
+ // add a new item to the html list
+
+ var $O = $('#' + optionId);
+
+ if(!$O) return; // this is the first item, selectLabel
+
+ var $removeLink = $("<a></a>")
+ .attr("href", "#")
+ .addClass(options.removeClass)
+ .prepend(options.removeLabel)
+ .click(function() {
+ dropListItem($(this).parent('li').attr('rel'));
+ return false;
+ });
+
+ var $itemLabel = $("<span></span>")
+ .addClass(options.listItemLabelClass)
+ .html($O.html());
+
+ var $item = $("<li></li>")
+ .attr('rel', optionId)
+ .addClass(options.listItemClass)
+ .append($itemLabel)
+ .append($removeLink)
+ .hide();
+
+ if(!buildingSelect) {
+ if($O.is(":selected")) return; // already have it
+ $O.attr('selected', true);
+ }
+
+ if(options.addItemTarget == 'top' && !buildingSelect) {
+ $ol.prepend($item);
+ if(options.sortable) $original.prepend($O);
+ } else {
+ $ol.append($item);
+ if(options.sortable) $original.append($O);
+ }
+
+ addListItemShow($item);
+
+ disableSelectOption($("[rel=" + optionId + "]", $select));
+
+ if(!buildingSelect) {
+ setHighlight($item, options.highlightAddedLabel);
+ selectFirstItem();
+ if(options.sortable) $ol.sortable("refresh");
+ }
+
+ }
+
+ function addListItemShow($item) {
+
+ // reveal the currently hidden item with optional animation
+ // used only by addListItem()
+
+ if(options.animate && !buildingSelect) {
+ $item.animate({
+ opacity: "show",
+ height: "show"
+ }, 100, "swing", function() {
+ $item.animate({
+ height: "+=2px"
+ }, 50, "swing", function() {
+ $item.animate({
+ height: "-=2px"
+ }, 25, "swing");
+ });
+ });
+ } else {
+ $item.show();
+ }
+ }
+
+ function dropListItem(optionId, highlightItem) {
+
+ // remove an item from the html list
+
+ if(highlightItem == undefined) var highlightItem = true;
+ var $O = $('#' + optionId);
+
+ $O.attr('selected', false);
+ $item = $ol.children("li[rel=" + optionId + "]");
+
+ dropListItemHide($item);
+ enableSelectOption($("[rel=" + optionId + "]", options.removeWhenAdded ? $selectRemoved : $select));
+
+ if(highlightItem) setHighlight($item, options.highlightRemovedLabel);
+
+ triggerOriginalChange(optionId, 'drop');
+
+ }
+
+ function dropListItemHide($item) {
+
+ // remove the currently visible item with optional animation
+ // used only by dropListItem()
+
+ if(options.animate && !buildingSelect) {
+
+ $prevItem = $item.prev("li");
+
+ $item.animate({
+ opacity: "hide",
+ height: "hide"
+ }, 100, "linear", function() {
+ $prevItem.animate({
+ height: "-=2px"
+ }, 50, "swing", function() {
+ $prevItem.animate({
+ height: "+=2px"
+ }, 100, "swing");
+ });
+ $item.remove();
+ });
+
+ } else {
+ $item.remove();
+ }
+ }
+
+ function setHighlight($item, label) {
+
+ // set the contents of the highlight area that appears
+ // directly after the <select> single
+ // fade it in quickly, then fade it out
+
+ if(!options.highlight) return;
+
+ $select.next("#" + options.highlightClass + index).remove();
+
+ var $highlight = $("<span></span>")
+ .hide()
+ .addClass(options.highlightClass)
+ .attr('id', options.highlightClass + index)
+ .html(label + $item.children("." + options.listItemLabelClass).slice(0,1).text());
+
+ $select.after($highlight);
+
+ $highlight.fadeIn("fast", function() {
+ setTimeout(function() { $highlight.fadeOut("slow"); }, 50);
+ });
+ }
+
+ function triggerOriginalChange(optionId, type) {
+
+ // trigger a change event on the original select multiple
+ // so that other scripts can pick them up
+
+ ignoreOriginalChangeEvent = true;
+ $option = $("#" + optionId);
+
+ $original.trigger('change', [{
+ 'option': $option,
+ 'value': $option.val(),
+ 'id': optionId,
+ 'item': $ol.children("[rel=" + optionId + "]"),
+ 'type': type
+ }]);
+ }
+
+ init();
+ });
+ };
+
+})(jQuery);
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/asmselect/jquery.asmselect.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js?rev=992446&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js (added)
+++ ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js Fri Sep 3 20:03:14 2010
@@ -0,0 +1,124 @@
+/*
+ * jQuery Color Animations
+ * Copyright 2007 John Resig
+ * Released under the MIT and GPL licenses.
+ */
+
+(function(jQuery){
+
+ // We override the animation for all of these color styles
+ jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+ jQuery.fx.step[attr] = function(fx){
+ if ( fx.state == 0 ) {
+ fx.start = getColor( fx.elem, attr );
+ fx.end = getRGB( fx.end );
+ }
+
+ fx.elem.style[attr] = "rgb(" + [
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+ ].join(",") + ")";
+ }
+ });
+
+ // Color Conversion functions from highlightFade
+ // By Blair Mitchelmore
+ // http://jquery.offput.ca/highlightFade/
+
+ // Parse strings looking for color tuples [255,255,255]
+ function getRGB(color) {
+ var result;
+
+ // Check if we're already dealing with an array of colors
+ if ( color && color.constructor == Array && color.length == 3 )
+ return color;
+
+ // Look for rgb(num,num,num)
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+ return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+ // Look for rgb(num%,num%,num%)
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+ // Look for #a0b1c2
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+ // Look for #fff
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+ // Otherwise, we're most likely dealing with a named color
+ return colors[jQuery.trim(color).toLowerCase()];
+ }
+
+ function getColor(elem, attr) {
+ var color;
+
+ do {
+ color = jQuery.curCSS(elem, attr);
+
+ // Keep going until we find an element that has color, or we hit the body
+ if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+ break;
+
+ attr = "backgroundColor";
+ } while ( elem = elem.parentNode );
+
+ return getRGB(color);
+ };
+
+ // Some named colors to work with
+ // From Interface by Stefan Petre
+ // http://interface.eyecon.ro/
+
+ var colors = {
+ aqua:[0,255,255],
+ azure:[240,255,255],
+ beige:[245,245,220],
+ black:[0,0,0],
+ blue:[0,0,255],
+ brown:[165,42,42],
+ cyan:[0,255,255],
+ darkblue:[0,0,139],
+ darkcyan:[0,139,139],
+ darkgrey:[169,169,169],
+ darkgreen:[0,100,0],
+ darkkhaki:[189,183,107],
+ darkmagenta:[139,0,139],
+ darkolivegreen:[85,107,47],
+ darkorange:[255,140,0],
+ darkorchid:[153,50,204],
+ darkred:[139,0,0],
+ darksalmon:[233,150,122],
+ darkviolet:[148,0,211],
+ fuchsia:[255,0,255],
+ gold:[255,215,0],
+ green:[0,128,0],
+ indigo:[75,0,130],
+ khaki:[240,230,140],
+ lightblue:[173,216,230],
+ lightcyan:[224,255,255],
+ lightgreen:[144,238,144],
+ lightgrey:[211,211,211],
+ lightpink:[255,182,193],
+ lightyellow:[255,255,224],
+ lime:[0,255,0],
+ magenta:[255,0,255],
+ maroon:[128,0,0],
+ navy:[0,0,128],
+ olive:[128,128,0],
+ orange:[255,165,0],
+ pink:[255,192,203],
+ purple:[128,0,128],
+ violet:[128,0,128],
+ red:[255,0,0],
+ silver:[192,192,192],
+ white:[255,255,255],
+ yellow:[255,255,0]
+ };
+
+})(jQuery);
+
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/branches/jquery/framework/images/webapp/images/jquery/plugins/jquery.color.js
------------------------------------------------------------------------------
svn:mime-type = text/plain