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/12/10 21:40:26 UTC
svn commit: r1044503 [8/15] - in /ofbiz/trunk: ./
applications/accounting/webapp/accounting/finaccounttrans/
applications/accounting/webapp/accounting/images/
applications/accounting/webapp/accounting/payment/
applications/accounting/webapp/ap/invoices...
Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Dec 10 20:40:08 2010
@@ -225,7 +225,7 @@ function confirmActionFormLink(msg, form
}
}
-// ===== Ajax Functions - based on protoype.js ===== //
+// ===== Ajax Functions - based on jQuery.js ===== //
/** Update an area (HTML container element).
* @param areaId The id of the HTML container to update
@@ -235,9 +235,15 @@ function confirmActionFormLink(msg, form
function ajaxUpdateArea(areaId, target, targetParams) {
waitSpinnerShow();
- new Ajax.Updater(areaId, target, {parameters: targetParams, evalScripts: true,
- onSuccess: function(transport) {waitSpinnerHide();},
- onFailure: function() {waitSpinnerHide();}
+ jQuery.ajax({
+ url: target,
+ type: "POST",
+ data: targetParams,
+ success: function(data) {
+ jQuery("#" + areaId).html(data);
+ waitSpinnerHide();
+ },
+ error: function(data) {waitSpinnerHide()}
});
}
@@ -247,21 +253,26 @@ function ajaxUpdateArea(areaId, target,
*/
function ajaxUpdateAreas(areaCsvString) {
waitSpinnerShow();
- responseFunction = function(transport) {
- // Uncomment the next two lines to see the HTTP responses
- //var response = transport.responseText || "no response text";
- //alert("Response: \n\n" + response);
- }
var areaArray = areaCsvString.split(",");
var numAreas = parseInt(areaArray.length / 3);
for (var i = 0; i < numAreas * 3; i = i + 3) {
- new Ajax.Updater(areaArray[i], areaArray[i + 1], {
- parameters: areaArray[i + 2],
- onComplete: responseFunction,
- evalScripts: true,
- onSuccess: function(transport) {waitSpinnerHide();},
- onFailure: function() {waitSpinnerHide();}
- });
+ var areaId = areaArray[i];
+ var target = areaArray[i + 1];
+ var targetParams = areaArray[i + 2];
+ // that was done by the prototype updater internally, remove the ? and the anchor flag from the parameters
+ // not nice but works
+ targetParams = targetParams.replace('#','');
+ targetParams = targetParams.replace('?','');
+ jQuery.ajax({
+ url: target,
+ type: "POST",
+ data: targetParams,
+ success: function(data) {
+ jQuery("#" + areaId).html(data);
+ waitSpinnerHide();
+ },
+ error: function(data) {waitSpinnerHide()}
+ });
}
}
@@ -272,7 +283,23 @@ function ajaxUpdateAreas(areaCsvString)
* @param interval The update interval, in seconds.
*/
function ajaxUpdateAreaPeriodic(areaId, target, targetParams, interval) {
- new Ajax.PeriodicalUpdater(areaId, target, {parameters: targetParams, frequency: interval});
+ jQuery.fjTimer({
+ interval: interval,
+ repeat: true,
+ tick: function(container, timerId){
+ jQuery.ajax({
+ url: target,
+ type: "POST",
+ data: targetParams,
+ success: function(data) {
+ jQuery("#" + areaId).html(data);
+ waitSpinnerHide();
+ },
+ error: function(data) {waitSpinnerHide()}
+ });
+
+ }
+ });
}
/** Submit request, update multiple areas (HTML container elements).
@@ -285,9 +312,12 @@ function ajaxSubmitRequestUpdateAreas(ta
updateFunction = function(transport) {
ajaxUpdateAreas(areaCsvString);
}
- new Ajax.Request(target, {
- parameters: targetParams,
- onComplete: updateFunction });
+ jQuery.ajax({
+ url: target,
+ type: "POST",
+ data: targetParams,
+ success: updateFunction()
+ });
}
/** Submit form, update an area (HTML container element).
@@ -298,207 +328,296 @@ function ajaxSubmitRequestUpdateAreas(ta
function submitFormInBackground(form, areaId, submitUrl) {
submitFormDisableSubmits(form);
updateFunction = function() {
- new Ajax.Updater(areaId, submitUrl);
+ jQuery("#" + areaId).load(submitUrl);
}
- new Ajax.Request(form.action, {
- parameters: form.serialize(true),
- onComplete: updateFunction });
+ jQuery.ajax({
+ url: jQuery(form).attr("action"),
+ data: jQuery(form).serialize(),
+ success: updateFunction()
+ });
}
/** Submit form, update multiple areas (HTML container elements).
- * @param form The form element
- * @param areaCsvString The area CSV string. The CSV string is a flat array in the
- * form of: areaId, target, target parameters [, areaId, target, target parameters...].
+ * @param form The form element
+ * @param areaCsvString The area CSV string. The CSV string is a flat array in the
+ * form of: areaId, target, target parameters [, areaId, target, target parameters...].
*/
function ajaxSubmitFormUpdateAreas(form, areaCsvString) {
- submitFormDisableSubmits($(form));
- waitSpinnerShow();
- hideErrorContainer = function() {
- $('content-messages').removeClassName('errorMessage');
- new Effect.Fade('content-messages',{duration: 0.0});
- }
- updateFunction = function(transport) {
- var data = transport.responseText.evalJSON(true);
- if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) {
- if(!$('content-messages')) {
- //add this div just after app-navigation
- if($('content-main-section')){
- $('content-main-section' ).insert({before: '<div id="content-messages" onclick="hideErrorContainer()"></div>'});
- }
- }
- $('content-messages').addClassName('errorMessage');
- if (data._ERROR_MESSAGE_LIST_ != undefined && data._ERROR_MESSAGE_ != undefined) {
- $('content-messages' ).update(data._ERROR_MESSAGE_LIST_ + " " + data._ERROR_MESSAGE_);
- } else if (data._ERROR_MESSAGE_LIST_ != undefined) {
- $('content-messages' ).update(data._ERROR_MESSAGE_LIST_);
- } else {
- $('content-messages' ).update(data._ERROR_MESSAGE_);
+ waitSpinnerShow();
+ hideErrorContainer = function() {
+ jQuery('#content-messages').removeClass('errorMessage').fadeIn('fast');
+ }
+ updateFunction = function(data) {
+ if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) {
+ if(!jQuery('#content-messages')) {
+ //add this div just after app-navigation
+ if(jQuery('#content-main-section')){
+ jQuery('#content-main-section' ).before('<div id="content-messages" onclick="hideErrorContainer()"></div>');
+ }
}
- new Effect.Appear('content-messages',{duration: 0.5});
- }else {
- if($('content-messages')) {
- $('content-messages').removeClassName('errorMessage');
- new Effect.Fade('content-messages',{duration: 0.0});
- }
- ajaxUpdateAreas(areaCsvString);
- }
- waitSpinnerHide();
- }
- new Ajax.Request($(form).action, {
- parameters: $(form).serialize(true),
- onComplete: updateFunction });
+ jQuery('#content-messages').addClass('errorMessage');
+ if (data._ERROR_MESSAGE_LIST_ != undefined && data._ERROR_MESSAGE_ != undefined) {
+ jQuery('#content-messages' ).html(data._ERROR_MESSAGE_LIST_ + " " + data._ERROR_MESSAGE_);
+ } else if (data._ERROR_MESSAGE_LIST_ != undefined) {
+ jQuery('#content-messages' ).html(data._ERROR_MESSAGE_LIST_);
+ } else {
+ jQuery('#content-messages' ).html(data._ERROR_MESSAGE_);
+ }
+ jQuery('#content-messages').fadeIn('fast');
+ }else {
+ if(jQuery('#content-messages')) {
+ jQuery('#content-messages').removeClass('errorMessage').fadeIn("fast");
+ }
+ ajaxUpdateAreas(areaCsvString);
+ }
+ waitSpinnerHide();
+ }
+
+ jQuery.ajax({
+ type: "POST",
+ url: jQuery("#" + form).attr("action"),
+ data: jQuery("#" + form).serialize(),
+ dataType: "json",
+ success: function(data) {
+ updateFunction(data);
+ }
+ });
}
/** Enable auto-completion for text elements.
- * @param areaCsvString The area CSV string. The CSV string is a flat array in the
- * form of: areaId, target, target parameters [, areaId, target, target parameters...].
+ * @param areaCsvString The area CSV string. The CSV string is a flat array in the
+ * form of: areaId, target, target parameters [, areaId, target, target parameters...].
*/
-function ajaxAutoCompleter(areaCsvString, showDescription) {
- var areaArray = areaCsvString.replace(/&/g,'&').split(",");
- var numAreas = parseInt(areaArray.length / 3);
- for (var i = 0; i < numAreas * 3; i = i + 3) {
- var optionsDivId = areaArray[i] + "_autoCompleterOptions";
- var indicatorId = areaArray[i] + "_indicator";
- $(areaArray[i]).next().insert('<span class="indicator" style="display: none"' + 'id=' + indicatorId + '><img src="/images/ajax-loader.gif" alt=""/></span>');
- $(areaArray[i]).insert({after: '<div class="autocomplete"' + 'id=' + optionsDivId + '></div>'});
- new Ajax.Autocompleter($(areaArray[i]), optionsDivId, areaArray[i + 1], {parameters: areaArray[i + 2], indicator: indicatorId, afterUpdateElement : setSelection});
+
+function ajaxAutoCompleter(areaCsvString, showDescription, formName) {
+ var areaArray = areaCsvString.replace(/&/g,'&').split(",");
+ var numAreas = parseInt(areaArray.length / 3);
+
+ for (var i = 0; i < numAreas * 3; i = i + 3) {
+ var url = areaArray[i + 1] + "?" + areaArray[i + 2];
+ var div = areaArray[i];
+ // create a seperate div where the result JSON Opbject will be placed
+ if ((jQuery("#" + div + "_auto")).length < 1) {
+ jQuery("<div id='" + div + "_auto'></div>").insertBefore("#" + areaArray[i]);
+ }
+
+ jQuery("#" + div).autocomplete({
+ source: function(request, response) {
+ jQuery.ajax({
+ url: url,
+ async: false,
+ data: {term : request.term},
+ success: function(data) {
+ //update the result div
+ jQuery("#" + div + "_auto").html(data)
+ // autocomp is the JSON Object which will be used for the autocomplete box
+ response(autocomp);
+ }
+ })
+ },
+ select: function(event, ui) {
+ jQuery("#" + areaArray[0]).html(ui.item)
+ if (showDescription) {
+ setLookDescription(areaArray[0] ,ui.item.label, areaArray[2], formName)
+ }
+ }
+ });
if (showDescription) {
- new lookupDescriptionLoaded(areaArray[i], areaArray[i + 1], areaArray[i + 2]);
+ var lookupDescriptionLoader = new lookupDescriptionLoaded(areaArray[i], areaArray[i + 1], areaArray[i + 2], formName);
+ lookupDescriptionLoader.update();
+ jQuery("#" + areaArray[i]).bind('change lookup:changed', function(){
+ lookupDescriptionLoader.update();
+ });
}
- }
-}
-
-function setSelection(text, li) {
- text.value = li.id;
- var delay = function() { text.fire("lookup:changed"); };
- setTimeout(delay, 100);
+ }
}
-function setLookDescription(textFieldId, description) {
+function setLookDescription(textFieldId, description, params, formName) {
if (description) {
var start = description.lastIndexOf(' [');
if (start != -1) {
- /* this breaks many existing fields, so commenting for now: assumes main field is the name field and id field is hidden, determines Name/Id fields based on name instead of using description-field-name attribute
- // To allow to set a dependent Id field when using a Name field as a lookup (the fields must have the same prefix, eg: partyName, partyId)
- // It uses the description (Id) shown with the Name. Hence the Lookup screen must be set in order to show a description in the autocomplete part.
- // It seems this is not always easy notably when you need to show at least 2 parts for the Name (eg Person).
- // At least it easy to set and it works well for simples case for now (eg PartyGroup)
- var dependentId = textFieldId.replace(/Name/, "Id"); // Raw but ok for now, needs safe navigation...
- // I did not find another way since Ajax.Autocompleter can't update another field
- // The alternative would be navigation to the next hidden field, at least it would avoid the mandatory Id/Name pair
- // But it's more difficult to demonstrate in Example component
- // dependentId = (textFieldId.next('div').down('input[type=hidden]');
- $(dependentId).clear();
- var dependentIdValue = (description.substring(start + 1, description.length).replace(/\[/g, "")).replace(/\]/g, "");
- if ($(dependentId)) {
- $(dependentId).value = dependentIdValue;
- }
- */
-
description = description.substring(0, start);
- /*
- $(dependentId).value = description;
- */
+
+ // This sets a (possibly hidden) dependent field if a description-field-name is provided
+ var dependentField = params.substring(params.indexOf("searchValueFieldName"));
+ dependentField = jQuery("#" + formName + "_" + dependentField.substring(dependentField.indexOf("=") + 1));
+ var dependentFieldValue = description.substring(0, description.lastIndexOf(' '))
+ if (dependentField.length) {
+ dependentField.val(dependentFieldValue);
+ }
}
}
- var lookupWrapperEl = $(textFieldId).up('.field-lookup');
- if (lookupWrapperEl) {
- var tooltipElement = $(textFieldId + '_lookupDescription');
- if (!tooltipElement) {
- tooltipElement = new Element('span', {id : textFieldId + '_lookupDescription', 'class' : 'tooltip'});
+ var lookupWrapperEl = jQuery("#" + textFieldId).closest('.field-lookup');
+ if (lookupWrapperEl.length) {
+ tooltipElement = jQuery("#" + textFieldId + '_lookupDescription')
+ if (!tooltipElement.length) {
+ tooltipElement = jQuery("<span id='" + textFieldId + "_lookupDescription' class='tooltip'></span>");
+ }
+ tooltipElement.html(description);
+ lookupWrapperEl.append(tooltipElement);
+ }
+}
+
+/** Enable auto-completion for drop-down elements.*/
+
+function ajaxAutoCompleteDropDown() {
+ jQuery.widget( "ui.combobox", {
+ _create: function() {
+ var self = this;
+ var select = this.element.hide(),
+ selected = select.children( ":selected" ),
+ value = selected.val() ? selected.text() : "";
+ var input = jQuery( "<input>" )
+ .insertAfter( select )
+ .val( value )
+ .autocomplete({
+ delay: 0,
+ minLength: 0,
+ source: function( request, response ) {
+ var matcher = new RegExp( jQuery.ui.autocomplete.escapeRegex(request.term), "i" );
+ response( select.children( "option" ).map(function() {
+ var text = jQuery( this ).text();
+ if ( this.value && ( !request.term || matcher.test(text) ) )
+ return {
+ label: text.replace(
+ new RegExp(
+ "(?![^&;]+;)(?!<[^<>]*)(" +
+ jQuery.ui.autocomplete.escapeRegex(request.term) +
+ ")(?![^<>]*>)(?![^&;]+;)", "gi"
+ ), "<strong>$1</strong>" ),
+ value: text,
+ option: this
+ };
+ }) );
+ },
+ select: function( event, ui ) {
+ ui.item.option.selected = true;
+ //select.val( ui.item.option.value );
+ self._trigger( "selected", event, {
+ item: ui.item.option
+ });
+ },
+ change: function( event, ui ) {
+ if ( !ui.item ) {
+ var matcher = new RegExp( "^" + jQuery.ui.autocomplete.escapeRegex( jQuery(this).val() ) + "$", "i" ),
+ valid = false;
+ select.children( "option" ).each(function() {
+ if ( this.value.match( matcher ) ) {
+ this.selected = valid = true;
+ return false;
+ }
+ });
+ if ( !valid ) {
+ // remove invalid value, as it didn't match anything
+ jQuery( this ).val( "" );
+ select.val( "" );
+ return false;
+ }
+ }
+ }
+ })
+ //.addClass( "ui-widget ui-widget-content ui-corner-left" );
+
+ input.data( "autocomplete" )._renderItem = function( ul, item ) {
+ return jQuery( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( "<a>" + item.label + "</a>" )
+ .appendTo( ul );
+ };
+
+ jQuery( "<a> </a>" )
+ .attr( "tabIndex", -1 )
+ .attr( "title", "Show All Items" )
+ .insertAfter( input )
+ .button({
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ },
+ text: false
+ })
+ .removeClass( "ui-corner-all" )
+ .addClass( "ui-corner-right ui-button-icon" )
+ .click(function() {
+ // close if already visible
+ if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
+ input.autocomplete( "close" );
+ return;
+ }
+
+ // pass empty string as value to search for, displaying all results
+ input.autocomplete( "search", "" );
+ input.focus();
+ });
}
- tooltipElement.update(description);
- lookupWrapperEl.appendChild(tooltipElement);
- }
-
- // after the description is set; the text field may have been updated
- // just in case, call onchange again
- if ($(textFieldId).onchange != null) {
- $(textFieldId).onchange();
- }
-}
-
-/** Enable auto-completion for drop-down elements.
- * @param descriptionElement The id of the text field
- * @param hiddenElement The id of the drop-down. Used as the id of hidden field inserted.
- * @param data Choices for Autocompleter.Local, form of: {key: 'description',.......}
- * @param options
-*/
-
-function ajaxAutoCompleteDropDown(descriptionElement, hiddenElement, data, options) {
- var update = hiddenElement + "_autoCompleterOptions";
- $(descriptionElement).insert({after: '<div class="autocomplete"' + 'id=' + update + '></div>'});
- new Autocompleter.Local($(descriptionElement), update, $H(data), {autoSelect: options.autoSelect, frequency: options.frequency, minChars: options.minChars, choices: options.choices, partialSearch: options.partialSearch, partialChars: options.partialChars, ignoreCase: options.ignoreCase, fullSearch: options.fullSearch, afterUpdateElement: setKeyAsParameter});
+ });
- function setKeyAsParameter(text, li) {
- $(hiddenElement).value = li.id;
- }
}
+
/** Toggle area visibility on/off.
- * @param link The <a> element calling this function
- * @param areaId The id of the HTML container to toggle
- * @param expandTxt Localized 'Expand' text
- * @param collapseTxt Localized 'Collapse' text
+ * @param link The <a> element calling this function
+ * @param areaId The id of the HTML container to toggle
+ * @param expandTxt Localized 'Expand' text
+ * @param collapseTxt Localized 'Collapse' text
*/
function toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt){
- var container = $(areaId);
- var liElement = $(link).up('li');
- if (liElement){
- if(container.visible()){
- liElement.removeClassName('expanded');
- liElement.addClassName('collapsed');
- link.title = expandTxt;
- } else {
- liElement.removeClassName('collapsed');
- liElement.addClassName('expanded');
- link.title = collapseTxt;
- }
- Effect.toggle(container, 'appear');
+ var container = jQuery("#" + areaId);
+ var liElement = jQuery(link).parents('li:first');
+ if (liElement) {
+ if (container.is(':visible')) {
+ liElement.removeClass('expanded');
+ liElement.addClass('collapsed');
+ link.title = expandTxt;
+ } else {
+ liElement.removeClass('collapsed');
+ liElement.addClass('expanded');
+ link.title = collapseTxt;
+ }
}
+ container.animate({opacity: 'toggle', height: 'toggle'}, "slow");
}
/** Toggle screenlet visibility on/off.
- * @param link The <a> element calling this function
- * @param areaId The id of the HTML container to toggle
- * @param expandTxt Localized 'Expand' text
- * @param collapseTxt Localized 'Collapse' text
+ * @param link The <a> element calling this function
+ * @param areaId The id of the HTML container to toggle
+ * @param expandTxt Localized 'Expand' text
+ * @param collapseTxt Localized 'Collapse' text
*/
function toggleScreenlet(link, areaId, saveCollapsed, expandTxt, collapseTxt){
- toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt);
- var container = $(areaId);
- var screenlet = container.up('div');
- if(container.visible()){
- var currentParam = screenlet.id + "_collapsed=false";
- var newParam = screenlet.id + "_collapsed=true";
- if(saveCollapsed=='true'){
- setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'true');
- }
- } else {
- var currentParam = screenlet.id + "_collapsed=true";
- var newParam = screenlet.id + "_collapsed=false";
- if(saveCollapsed=='true'){
- setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'false');
- }
- }
- var paginationMenus = $$('div.nav-pager');
- paginationMenus.each(function(menu) {
- if (menu) {
- var childElements = menu.getElementsByTagName('a');
- for (var i = 0; i < childElements.length; i++) {
- if (childElements[i].href.indexOf("http") == 0) {
- childElements[i].href = replaceQueryParam(childElements[i].href, currentParam, newParam);
- }
- }
- childElements = menu.getElementsByTagName('select');
- for (i = 0; i < childElements.length; i++) {
- if (childElements[i].href.indexOf("location.href") >= 0) {
- Element.extend(childElements[i]);
- childElements[i].writeAttribute("onchange", replaceQueryParam(childElements[i].readAttribute("onchange"), currentParam, newParam));
- }
- }
- }
- });
+ toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt);
+ var container = jQuery("#" + areaId);
+ var screenlet = jQuery(link).parents('div:first');;
+ if(container.is(':visible')){
+ var currentParam = screenlet.id + "_collapsed=false";
+ var newParam = screenlet.id + "_collapsed=true";
+ if(saveCollapsed=='true'){
+ setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'true');
+ }
+ } else {
+ var currentParam = screenlet.id + "_collapsed=true";
+ var newParam = screenlet.id + "_collapsed=false";
+ if(saveCollapsed=='true'){
+ setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'false');
+ }
+ }
+ var paginationMenus = jQuery('div.nav-pager');
+ jQuery.each(paginationMenus, function(menu) {
+ if (menu) {
+ var childElements = menu.getElementsByTagName('a');
+ for (var i = 0; i < childElements.length; i++) {
+ if (childElements[i].href.indexOf("http") == 0) {
+ childElements[i].href = replaceQueryParam(childElements[i].href, currentParam, newParam);
+ }
+ }
+ childElements = menu.getElementsByTagName('select');
+ for (i = 0; i < childElements.length; i++) {
+ if (childElements[i].href.indexOf("location.href") >= 0) {
+ Element.extend(childElements[i]);
+ childElements[i].writeAttribute("onchange", replaceQueryParam(childElements[i].readAttribute("onchange"), currentParam, newParam));
+ }
+ }
+ }
+ });
}
/** In Place Editor for display elements
@@ -508,8 +627,33 @@ function toggleScreenlet(link, areaId, s
*/
function ajaxInPlaceEditDisplayField(element, url, options) {
- new Ajax.InPlaceEditor($(element), url, options);
+ var jElement = jQuery("#" + element);
+ jElement.mouseover(function() {
+ jQuery(this).css('background-color', 'rgb(255, 255, 153)');
+ });
+
+ jElement.mouseout(function() {
+ jQuery(this).css('background-color', 'transparent');
+ });
+
+ jElement.editable(function(value, settings){
+ // removes all line breaks from the value param, because the parseJSON Function can't work with line breaks
+ value = value.replace("\n", " ");
+ var resultField = jQuery.parseJSON('{"' + settings.name + '":"' + value + '"}');
+ // merge both parameter objects together
+ jQuery.extend(settings.submitdata, resultField);
+ jQuery.ajax({
+ type : settings.method,
+ url : url,
+ data : settings.submitdata,
+ success : function(data) {
+ // adding the new value to the field and make the modified field 'blink' a little bit to show the user that somethink have changed
+ jElement.html(value).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).css('background-color', 'transparent');
+ }
+ });
+ }, options);
}
+
// ===== End of Ajax Functions ===== //
function replaceQueryParam(queryString, currentParam, newParam) {
@@ -543,7 +687,7 @@ function submitFormDisableSubmits(form)
// prevents doubleposts for <submit> inputs of type "button" or "image"
function submitFormDisableButton(button) {
- if (button.form.action != null && button.form.action.length > 0) {
+ if (button.form.action != null && button.form.action.length) {
button.disabled = true;
}
button.className = button.className + " disabled";
@@ -551,7 +695,6 @@ function submitFormDisableButton(button)
}
function submitFormEnableButtonByName(formName, buttonName) {
- // alert("formName=" + formName + " buttonName=" + buttonName);
var form = document[formName];
var button = form.elements[buttonName];
submitFormEnableButton(button);
@@ -576,7 +719,7 @@ function expandAll(expanded) {
groupbody=divs1[j];
}
}
- if($(groupbody).visible() != expanded) {
+ if(jQuery(groupbody).is(':visible') != expanded) {
toggleCollapsiblePanel(links[0], groupbody.id, 'expand', 'collapse');
}
}
@@ -586,49 +729,33 @@ function expandAll(expanded) {
//calls ajax request for storing user layout preferences
function setUserLayoutPreferences(userPrefGroupTypeId, userPrefTypeId, userPrefValue){
- new Ajax.Request('ajaxSetUserPreference',{
- method: "post",
- parameters: {userPrefGroupTypeId: userPrefGroupTypeId, userPrefTypeId: userPrefTypeId, userPrefValue: userPrefValue},
- onLoading: function(transport){
- },
-
- onSuccess: function(transport){
- },
-
- onComplete: function(transport){
- }
- });
+ jQuery.ajax({
+ url:'ajaxSetUserPreference',
+ type: "POST",
+ data: ({userPrefGroupTypeId: userPrefGroupTypeId, userPrefTypeId: userPrefTypeId, userPrefValue: userPrefValue}),
+ success: function(data) {}
+ });
}
function toggleLeftColumn(){
}
function waitSpinnerShow() {
- var spinner = document.getElementById("wait-spinner");
- if (spinner == null) {
- return;
- }
- spinner.style.display = 'block';
- var bdy = document.body;
-
- var dimensions = $(spinner).getDimensions();
- var lookupLeft = (bdy.offsetWidth / 2) - (dimensions.width / 2);
- var scrollOffY = document.viewport.getScrollOffsets().top;
- var winHeight = document.viewport.getHeight();
- var lookupTop = (scrollOffY + winHeight / 2) - (dimensions.height / 2);
-
- spinner.style.left = lookupLeft + "px";
- spinner.style.top = lookupTop + "px";
- Effect.Appear(spinner, {duration: 0.3});
+ jSpinner = jQuery("#wait-spinner");
+ if (!jSpinner.length) return
+
+ bdy = document.body;
+ lookupLeft = (bdy.offsetWidth / 2) - (jSpinner.width() / 2);
+ scrollOffY = jQuery(window).scrollTop();
+ winHeight = jQuery(window).height();
+ lookupTop = (scrollOffY + winHeight / 2) - (jSpinner.height() / 2);
+
+ jSpinner.css("display", "block");
+ jSpinner.css("left", lookupLeft + "px");
+ jSpinner.css("top", lookupTop + "px");
+ jSpinner.show();
}
function waitSpinnerHide() {
- var spinner = document.getElementById("wait-spinner");
- if (spinner == null) {
- return;
- }
- Effect.Fade(spinner, {duration: 0.3});
- window.setTimeout(function() {
- spinner.style.display = 'none';
- }, 400);
+ jQuery("#wait-spinner").hide()
}
Modified: ofbiz/trunk/framework/testtools/webapp/testtools/SeleniumTest.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/webapp/testtools/SeleniumTest.ftl?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/testtools/webapp/testtools/SeleniumTest.ftl (original)
+++ ofbiz/trunk/framework/testtools/webapp/testtools/SeleniumTest.ftl Fri Dec 10 20:40:08 2010
@@ -66,50 +66,50 @@ under the License.
</td>
</tr>
</table>
-<script type="text/javascript">
+<script type="text/javascript">
var progressBar;
// click start load call servlet & new progressBar
function clickDownLoad(url){
startDownLoad(url);
- $('progress_bar').style.display = "";
- $('filesize').style.display = "";
- progressBar = new Control.ProgressBar('progress_bar');
+ document.getElementById('progress_bar').style.display = "";
+ document.getElementById('filesize').style.display = "";
+ progressBar = jQuery("#progress_bar").progressbar({value: 0});
}
-
+
function startDownLoad(url){
- var pars = '';
- var myAjax = new Ajax.Request( url, {
- method: 'post',
- parameters: pars,
- onLoading:getProgressDownloadStatus,
- onComplete : $('download').innerHTML = 'loading....'
- } );
+ jQuery.ajax({
+ url: url,
+ type: "POST",
+ beforeSend: getProgressDownloadStatus,
+ complete: function(data) {document.getElementById('download').innerHTML = '${uiLabelMap.CommonLoading}'}
+ });
}
-
+
//function PeriodicalExecuter check download status
function getProgressDownloadStatus(){
- new PeriodicalExecuter(function(event){
- var pars = '';
- var myAjax = new Ajax.Request( '<@o...@ofbizUrl>', {
- method: 'get',
- parameters: pars,
- onSuccess:function check(transfer){
- var data = transfer.responseText.evalJSON(true);
- if( data != null ){
- if(data.contentLength != null && data.loadPercent != null){
- var loadPercent = data.loadPercent;
- $('loadpercent').innerHTML = ''+loadPercent+'%';
- var contentLength = data.contentLength;
- //$('filesize').innerHTML = '<b>'+contentLength/1000 + ' k</b>';
- progressBar.setProgress(loadPercent);
- if(loadPercent > 99){
- $('download').innerHTML = 'download';
- event.stop();
+ jQuery.fjTimer({
+ interval: 1000,
+ repeat: true,
+ tick: function(counter, timerId) {
+ jQuery.ajax({
+ url: "<@o...@ofbizUrl>",
+ type: "GET",
+ succuess: function(data) {
+ if( data != null ){
+ if(data.contentLength != null && data.loadPercent != null){
+ var loadPercent = data.loadPercent;
+ document.getElementById('loadpercent').innerHTML = ''+loadPercent+'%';
+ var contentLength = data.contentLength;
+ progressBar.progressbar("option", "value", loadPercent);
+ if(loadPercent > 99){
+ document.getElementById('download').innerHTML = '${uiLabelMap.CommonDownloaded}';
+ timerId.stop();
+ }
}
- }
- }
+ }
}
- } );
- },1);
+ });
+ }
+ });
}
</script>
\ No newline at end of file
Modified: ofbiz/trunk/framework/testtools/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/widget/CommonScreens.xml?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/testtools/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/testtools/widget/CommonScreens.xml Fri Dec 10 20:40:08 2010
@@ -62,14 +62,11 @@
</widgets>
</section>
</screen>
-
+
<screen name="selenium">
<section>
<actions>
- <set field="tabButtonItem" value="selenium"/>
- <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
- <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/control.progress_bar.js" global="true"/>
- <set field="layoutSettings.styleSheets[]" value="/images/prototypejs/progress_bar.css" global="true"/>
+ <set field="tabButtonItem" value="selenium"/>
<entity-one entity-name="SeleniumTestSuitePath" value-field="testSuitePath">
<field-map field-name="testSuiteId" value="${parameters.testSuiteId}"/>
</entity-one>
Modified: ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml Fri Dec 10 20:40:08 2010
@@ -19,12 +19,6 @@ under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
- <title></title>
- <description></description>
- <copyright></copyright>
- <author>Adam Heath</author>
- <version>0.0</version>
-
<entity entity-name="WebslingerServer"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Fri Dec 10 20:40:08 2010
@@ -1707,6 +1707,10 @@
<value xml:lang="en">Link Geos (associate Geos to a Geo)</value>
<value xml:lang="fr">Lier des zones géographiques (association d'une avec plusieurs)</value>
</property>
+ <property key="WebtoolsGeosSelect">
+ <value xml:lang="en">Select Geos to associate</value>
+ <value xml:lang="fr">Sélectionner les zones géographiques à associer</value>
+ </property>
<property key="WebtoolsHits">
<value xml:lang="de">Besuche</value>
<value xml:lang="en">Hits</value>
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl Fri Dec 10 20:40:08 2010
@@ -137,11 +137,9 @@ function ShowTab(lname) {
<td class="label">${field.name}</td>
<td>
<#if field.fieldType == 'DateTime'>
- DateTime(YYYY-MM-DD HH:mm:SS.sss):<input type="text" name="${field.name}" size="24" value="${field.value}" />
- <a href="javascript:call_cal(document.updateForm.${field.name}, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar' /></a>
+ DateTime(YYYY-MM-DD HH:mm:SS.sss):<@htmlTemplate.renderDateTimeField name="${field.name}" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="${field.value}" size="25" maxlength="30" id="${field.name}" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
<#elseif field.fieldType == 'Date'>
- Date(YYYY-MM-DD):<input type="text" name="${field.name}" size="11" value="${field.value}" />
- <a href="javascript:call_cal(document.updateForm.${field.name}, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar' /></a>
+ Date(YYYY-MM-DD):<@htmlTemplate.renderDateTimeField name="${field.name}" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="${field.value}" size="25" maxlength="30" id="${field.name}" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
<#elseif field.fieldType == 'Time'>
Time(HH:mm:SS.sss):<input type="text" size="6" maxlength="10" name="${field.name}" value="${field.value}" />
<#elseif field.fieldType == 'Integer'>
@@ -179,11 +177,9 @@ function ShowTab(lname) {
<td class="label">${field.name}</td>
<td>
<#if field.fieldType == 'DateTime'>
- DateTime(YYYY-MM-DD HH:mm:SS.sss):<input type="text" name="${field.name}" size="24" value="${field.value}" />
- <a href="javascript:call_cal(document.updateForm.${field.name}, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar' /></a>
+ DateTime(YYYY-MM-DD HH:mm:SS.sss):<@htmlTemplate.renderDateTimeField name="${field.name}" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="${field.value}" size="25" maxlength="30" id="${field.name}" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
<#elseif field.fieldType == 'Date'>
- Date(YYYY-MM-DD):<input type="text" name="${field.name}" size="11" value="${field.value}" />
- <a href="javascript:call_cal(document.updateForm.${field.name}, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar' /></a>
+ Date(YYYY-MM-DD):<@htmlTemplate.renderDateTimeField name="${field.name}" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="${field.value}" size="25" maxlength="30" id="${field.name}" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
<#elseif field.fieldType == 'Time'>
Time(HH:mm:SS.sss):<input type="text" size="6" maxlength="10" name="${field.name}" value="${field.value}" />
<#elseif field.fieldType == 'Integer'>
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/xmldsdump.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/xmldsdump.ftl?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/xmldsdump.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/xmldsdump.ftl Fri Dec 10 20:40:08 2010
@@ -72,13 +72,15 @@ under the License.
</tr>
<tr>
<td class="label">${uiLabelMap.WebtoolsRecordsUpdatedSince}</td>
- <td><input type="text" size="25" name="entityFrom" />
- <a href="javascript:call_cal(document.entityExport.entityFrom, null);" title="View Calendar"><img src="<@o...@ofbizContentUrl>" width="16" height="16" border="0" alt="View Calendar"/></a></td>
+ <td>
+ <@htmlTemplate.renderDateTimeField name="entityFrom" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="" size="25" maxlength="30" id="entityFrom1" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
+ </td>
</tr>
<tr>
<td class="label">${uiLabelMap.WebtoolsRecordsUpdatedBefore} </td>
- <td><input type="text" size="25" name="entityThru" />
- <a href="javascript:call_cal(document.entityExport.entityThru, null);" title="View Calendar"><img src="<@o...@ofbizContentUrl>" width="16" height="16" border="0" alt="View Calendar"/></a></td>
+ <td>
+ <@htmlTemplate.renderDateTimeField name="entityThru" event="" action="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="" size="25" maxlength="30" id="entityThru1" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
+ </td>
</tr>
<tr>
<td class="label">${uiLabelMap.WebtoolsOutToBrowser}</td>
Modified: ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml Fri Dec 10 20:40:08 2010
@@ -71,32 +71,30 @@
header-row-style="header-row" default-table-style="basic-table">
<field name="geoIds" title="${uiLabelMap.CommonGeos}">
<drop-down allow-multiple="true">
- <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}">
- <!--entity-constraint name="geoTypeId" operator="equals" value="COUNTRY"/--><!-- useful at least to test, else it's long... -->
- <entity-order-by field-name="geoName"/>
+ <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName} (${geoId})">
+<!-- <entity-constraint name="geoTypeId" operator="in" value="STATE,PROVINCE,REGIONS"/><!-\- useful to quickly test -\->-->
+ <entity-order-by field-name="geoId"/>
</entity-options>
</drop-down>
</field>
- <field name="dummy" title="${uiLabelMap.CommonEmptyHeader}" position="2"><display/></field>
- <field name="geoAssocTypeId" title="${uiLabelMap.CommonGeoAssocTypeId}" position="3"
+ <field name="dummy" title="${uiLabelMap.CommonEmptyHeader}"><display/></field>
+ <field name="geoAssocTypeId" title="${uiLabelMap.CommonGeoAssocTypeId}"
event="onChange"
- action="typeValue = $('${typeField}');selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', typeValue, '${responseName}');">
+ action="typeValue = jQuery('#${asm_typeField}').val(); selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}');">
<drop-down>
<entity-options key-field-name="geoAssocTypeId" entity-name="GeoAssocType" description="${description}">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
- <field name="geoId" title="${uiLabelMap.CommonGeo}"
- event="onFocus"
- action="typeValue = $('${typeField}');selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', typeValue, '${responseName}');">
- <drop-down>
- <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}">
- <entity-order-by field-name="geoName"/>
+ <field name="geoId" title="${uiLabelMap.CommonGeo}">
+ <drop-down current="selected">
+ <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName} (${geoId})">
+ <entity-order-by field-name="geoId"/>
</entity-options>
</drop-down>
</field>
- <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit" ><submit button-type="button"/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
</forms>
Modified: ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml Fri Dec 10 20:40:08 2010
@@ -101,15 +101,21 @@
<set field="noId" value="true"/><!-- see CommonGeoManagementDecorator -->
+ <!-- asmslect parameters, must be prefixed by asm_ for setMultipleSelectJs.ftl -->
+ <set field="asm_multipleSelectForm" value="LinkGeos"/>
+ <set field="asm_multipleSelect" value="LinkGeos_geoIds"/>
+ <set field="asm_formSize" value="700"/>
+ <set field="asm_asmListItemPercentOfForm" value="95"/>
+ <set field="asm_sortable" value="false"/>
+ <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
+ <set field="asm_title" value="${uiLabelMap.WebtoolsGeosSelect}"/>
<!-- selectMultipleRelatedValues parameters -->
- <set field="multipleSelectForm" value="LinkGeos"/>
- <set field="multipleSelect" value="LinkGeos_geoIds"/>
- <set field="relatedField" value="LinkGeos_geoId"/>
- <set field="requestName" value="getRelatedGeos"/>
- <set field="paramKey" value="geoId"/>
- <set field="type" value="geoAssocTypeId"/>
- <set field="typeField" value="LinkGeos_geoAssocTypeId"/>
- <set field="responseName" value="geoList"/>
+ <set field="asm_relatedField" value="LinkGeos_geoId"/>
+ <set field="asm_requestName" value="getRelatedGeos"/>
+ <set field="asm_paramKey" value="geoId"/>
+ <set field="asm_type" value="geoAssocTypeId"/>
+ <set field="asm_typeField" value="LinkGeos_geoAssocTypeId"/>
+ <set field="asm_responseName" value="geoList"/>
</actions>
<widgets>
<decorator-screen name="CommonGeoManagementDecorator" location="component://webtools/widget/CommonScreens.xml">
Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Fri Dec 10 20:40:08 2010
@@ -483,10 +483,10 @@ under the License.
</xs:simpleType>
</xs:attribute>
<xs:attribute type="xs:string" name="event">
- <xs:annotation><xs:documentation>Used to specify javascript events that should be attached to fields.</xs:documentation></xs:annotation>
+ <xs:annotation><xs:documentation>Used to specify a javascript event that may be attached to field.</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute type="xs:string" name="action">
- <xs:annotation><xs:documentation>Used to specify javascript actions that should be run based on events.</xs:documentation></xs:annotation>
+ <xs:annotation><xs:documentation>Used to specify a javascript action that should be run based on an existing specified event.</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute type="xs:string" name="id-name"/>
<xs:attribute name="separate-column" default="false">
@@ -972,10 +972,9 @@ under the License.
<xs:annotation><xs:documentation>Only layer width. I.e. 250px, 12%</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute name="position" default="topleft">
- <xs:annotation><xs:documentation>Only for layer position. Default to topleft, normal sets the layer just under the target field, like for the calendar.</xs:documentation></xs:annotation>
+ <xs:annotation><xs:documentation>Only for layer positionining. Default to topleft corner.</xs:documentation></xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
- <xs:enumeration value="normal"/>
<xs:enumeration value="center"/>
<xs:enumeration value="left"/>
<xs:enumeration value="right"/>
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Fri Dec 10 20:40:08 2010
@@ -230,81 +230,58 @@ public class MacroFormRenderer implement
if (ajaxEnabled) {
String url = inPlaceEditor.getUrl(context);
+ String extraParameter = "{";
Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context);
if (fieldMap != null) {
- url += '?';
Set<Entry<String, Object>> fieldSet = fieldMap.entrySet();
Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator();
int count = 0;
while (fieldIterator.hasNext()) {
count++;
Entry<String, Object> field = fieldIterator.next();
- url += (String) field.getKey() + '=' + (String) field.getValue();
+ extraParameter += (String) field.getKey() + ":'" + (String) field.getValue() + "'";
if (count < fieldSet.size()) {
- url += '&';
+ extraParameter += ',';
}
}
+
}
+ extraParameter += "}";
sr.append("\" inPlaceEditorUrl=\"");
sr.append(url);
sr.append("\" inPlaceEditorParams=\"");
StringWriter inPlaceEditorParams = new StringWriter();
- inPlaceEditorParams.append("{paramName: '");
+ inPlaceEditorParams.append("{name: '");
if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) {
inPlaceEditorParams.append(inPlaceEditor.getParamName());
} else {
inPlaceEditorParams.append(modelFormField.getFieldName());
}
inPlaceEditorParams.append("'");
- if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelControl())) {
- inPlaceEditorParams.append(", cancelControl: ");
- if (!"false".equals(inPlaceEditor.getCancelControl())) {
- inPlaceEditorParams.append("'");
- }
- inPlaceEditorParams.append(inPlaceEditor.getCancelControl());
- if (!"false".equals(inPlaceEditor.getCancelControl())) {
- inPlaceEditorParams.append("'");
- }
- }
+ inPlaceEditorParams.append(", method: 'POST'");
+ inPlaceEditorParams.append(", submitdata: " + extraParameter);
+ inPlaceEditorParams.append(", type: 'textarea'");
+ inPlaceEditorParams.append(", select: 'true'");
+ inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}");
+
if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) {
- inPlaceEditorParams.append(", cancelText: '" +inPlaceEditor.getCancelText()+ "'");
+ inPlaceEditorParams.append(", cancel: '" +inPlaceEditor.getCancelText()+ "'");
+ } else {
+ inPlaceEditorParams.append(", cancel: 'Cancel'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) {
- inPlaceEditorParams.append(", clickToEditText: '" +inPlaceEditor.getClickToEditText()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getFieldPostCreation())) {
- inPlaceEditorParams.append(", fieldPostCreation: ");
- if (!"false".equals(inPlaceEditor.getFieldPostCreation())) {
- inPlaceEditorParams.append("'");
- }
- inPlaceEditorParams.append(inPlaceEditor.getFieldPostCreation());
- if (!"false".equals(inPlaceEditor.getFieldPostCreation())) {
- inPlaceEditorParams.append("'");
- }
+ inPlaceEditorParams.append(", tooltip: '" +inPlaceEditor.getClickToEditText()+ "'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) {
- inPlaceEditorParams.append(", formClassName: '" +inPlaceEditor.getFormClassName()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getHighlightColor())) {
- inPlaceEditorParams.append(", highlightColor: '" +inPlaceEditor.getHighlightColor()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getHighlightEndColor())) {
- inPlaceEditorParams.append(", highlightEndColor: '" +inPlaceEditor.getHighlightEndColor()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getHoverClassName())) {
- inPlaceEditorParams.append(", hoverClassName: '" +inPlaceEditor.getHoverClassName()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getHtmlResponse())) {
- inPlaceEditorParams.append(", htmlResponse: " +inPlaceEditor.getHtmlResponse());
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingClassName())) {
- inPlaceEditorParams.append(", loadingClassName: '" +inPlaceEditor.getLoadingClassName()+ "'");
+ inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName()+ "'");
+ } else {
+ inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) {
- inPlaceEditorParams.append(", loadingText: '" +inPlaceEditor.getLoadingText()+ "'");
+ inPlaceEditorParams.append(", indicator: '" +inPlaceEditor.getLoadingText()+ "'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) {
- inPlaceEditorParams.append(", okControl: ");
+ inPlaceEditorParams.append(", submit: ");
if (!"false".equals(inPlaceEditor.getOkControl())) {
inPlaceEditorParams.append("'");
}
@@ -312,30 +289,8 @@ public class MacroFormRenderer implement
if (!"false".equals(inPlaceEditor.getOkControl())) {
inPlaceEditorParams.append("'");
}
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getOkText())) {
- inPlaceEditorParams.append(", okText: '" +inPlaceEditor.getOkText()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getSavingClassName())) {
- inPlaceEditorParams.append(", savingClassName: '" +inPlaceEditor.getSavingClassName()+ "', ");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getSavingText())) {
- inPlaceEditorParams.append(", savingText: '" +inPlaceEditor.getSavingText()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getSubmitOnBlur())) {
- inPlaceEditorParams.append(", submitOnBlur: " +inPlaceEditor.getSubmitOnBlur());
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getTextBeforeControls())) {
- inPlaceEditorParams.append(", textBeforeControls: '" +inPlaceEditor.getTextBeforeControls()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getTextAfterControls())) {
- inPlaceEditorParams.append(", textAfterControls: '" +inPlaceEditor.getTextAfterControls()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getTextBetweenControls())) {
- inPlaceEditorParams.append(", textBetweenControls: '" +inPlaceEditor.getTextBetweenControls()+ "'");
- }
- if (UtilValidate.isNotEmpty(inPlaceEditor.getUpdateAfterRequestCall())) {
- inPlaceEditorParams.append(", updateAfterRequestCall: " +inPlaceEditor.getUpdateAfterRequestCall());
+ } else {
+ inPlaceEditorParams.append(", submit: 'OK'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) {
inPlaceEditorParams.append(", rows: '" +inPlaceEditor.getRows()+ "'");
@@ -469,13 +424,18 @@ public class MacroFormRenderer implement
visualEdtiorEnalble = "true";
buttons = textareaField.getVisualEditorButtons(context);
if (UtilValidate.isEmpty(buttons)) {
- buttons = "all";
+ buttons = "maxi";
}
}
String readonly = "";
if (textareaField.isReadOnly()) {
readonly = "readonly";
}
+ Map<String, Object> userLogin = UtilGenerics.checkMap(context.get("userLogin"));
+ String language = "en";
+ if (userLogin != null) {
+ language = UtilValidate.isEmpty((String) userLogin.get("lastLocale")) ? "en" : (String) userLogin.get("lastLocale");
+ }
String value = modelFormField.getEntry(context, textareaField.getDefaultValue(context));
StringWriter sr = new StringWriter();
sr.append("<@renderTextareaField ");
@@ -497,6 +457,8 @@ public class MacroFormRenderer implement
sr.append(readonly);
sr.append("\" visualEdtiorEnalble=\"");
sr.append(visualEdtiorEnalble);
+ sr.append("\" language=\"");
+ sr.append(language);
sr.append("\" buttons=\"");
sr.append(buttons);
sr.append("\" />");
@@ -2013,7 +1975,7 @@ public class MacroFormRenderer implement
} else {
autoCompleterTarget = lookupFieldFormName + "&amp;";
}
- autoCompleterTarget = autoCompleterTarget + "ajaxLookup=Y&amp;searchValueField=" + lookupField.getModelFormField().getParameterName(context);
+ autoCompleterTarget = autoCompleterTarget + "ajaxLookup=Y";
updateAreas = FastList.newInstance();
updateAreas.add(new ModelForm.UpdateArea("change", id, autoCompleterTarget));
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Fri Dec 10 20:40:08 2010
@@ -172,7 +172,7 @@ public class HtmlFormRenderer extends Ht
str.append(modelFormField.getWidgetStyle());
// add a style of red if this is a date/time field and redWhen is true
if (modelFormField.shouldBeRed(context)) {
- str.append(" alert");
+ str.append(" alert");
}
str.append('"');
if (UtilValidate.isNotEmpty(idName)) {
@@ -221,9 +221,9 @@ public class HtmlFormRenderer extends Ht
writer.append("ajaxInPlaceEditDisplayField('");
writer.append(idName).append("', '").append(url).append("', {");
if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) {
- writer.append("paramName: '").append(inPlaceEditor.getParamName()).append("'");
+ writer.append("name: '").append(inPlaceEditor.getParamName()).append("'");
} else {
- writer.append("paramName: '").append(modelFormField.getFieldName()).append("'");
+ writer.append("name: '").append(modelFormField.getFieldName()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelControl())) {
writer.append(", cancelControl: ");
@@ -236,10 +236,10 @@ public class HtmlFormRenderer extends Ht
}
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) {
- writer.append(", cancelText: '").append(inPlaceEditor.getCancelText()).append("'");
+ writer.append(", cancel: '").append(inPlaceEditor.getCancelText()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) {
- writer.append(", clickToEditText: '").append(inPlaceEditor.getClickToEditText()).append("'");
+ writer.append(", tooltip: '").append(inPlaceEditor.getClickToEditText()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getFieldPostCreation())) {
writer.append(", fieldPostCreation: ");
@@ -252,7 +252,7 @@ public class HtmlFormRenderer extends Ht
}
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) {
- writer.append(", formClassName: '").append(inPlaceEditor.getFormClassName()).append("'");
+ writer.append(", cssclass: '").append(inPlaceEditor.getFormClassName()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getHighlightColor())) {
writer.append(", highlightColor: '").append(inPlaceEditor.getHighlightColor()).append("'");
@@ -270,10 +270,10 @@ public class HtmlFormRenderer extends Ht
writer.append(", loadingClassName: '").append(inPlaceEditor.getLoadingClassName()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) {
- writer.append(", loadingText: '").append(inPlaceEditor.getLoadingText()).append("'");
+ writer.append(", indicator: '").append(inPlaceEditor.getLoadingText()).append("'");
}
if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) {
- writer.append(", okControl: ");
+ writer.append(", submit: ");
if (!"false".equals(inPlaceEditor.getOkControl())) {
writer.append("'");
}
@@ -487,21 +487,28 @@ public class HtmlFormRenderer extends Ht
writer.append("</textarea>");
if (textareaField.getVisualEditorEnable()) {
- writer.append("<script language=\"javascript\" src=\"/images/htmledit/whizzywig.js\" type=\"text/javascript\"></script>");
- writer.append("<script language=\"javascript\" type=\"text/javascript\"> buttonPath = \"/images/htmledit/\"; cssFile=\"/images/htmledit/simple.css\";makeWhizzyWig(\"");
- if (UtilValidate.isNotEmpty(idName)) {
- writer.append(idName);
- } else {
- writer.append("htmlEditArea");
- }
- writer.append("\",\"");
+ writer.append("<script language=\"javascript\" src=\"/images/jquery/plugins/elrteEditor/elrte.min.js\" type=\"text/javascript\"></script>");
+ writer.append("<link href=\"/images/jquery/plugins/elrteEditor/css/elrte.full.css\" rel=\"stylesheet\" type=\"text/css\">");
+ writer.append("<script language=\"javascript\" type=\"text/javascript\"> var opts = { cssClass : 'el-rte', toolbar : ");
+ // define the toolsbar
String buttons = textareaField.getVisualEditorButtons(context);
if (UtilValidate.isNotEmpty(buttons)) {
writer.append(buttons);
} else {
- writer.append("all");
+ writer.append("maxi");
}
- writer.append("\") </script>");
+ writer.append(", doctype : '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">', //'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">'");
+ writer.append(", cssfiles : ['/images/jquery/plugins/elrteEditor/css/elrte-inner.css'] ");
+ writer.append("}");
+ // load the wysiwyg editor
+ writer.append("jQuery('#");
+ if (UtilValidate.isNotEmpty(idName)) {
+ writer.append(idName);
+ } else {
+ writer.append("htmlEditArea");
+ }
+ writer.append("').elrte(opts);");
+ writer.append("</script>");
}
this.addAsterisks(writer, context, modelFormField);
Modified: ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl Fri Dec 10 20:40:08 2010
@@ -26,7 +26,7 @@ under the License.
<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled><@renderField value /></#macro>
-<#macro renderTextareaField name className alert cols rows id readonly value visualEdtiorEnalble buttons><@renderField value /></#macro>
+<#macro renderTextareaField name className alert cols rows id readonly value visualEdtiorEnalble language buttons><@renderField value /></#macro>
<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName><@renderField value /></#macro>
Modified: ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl?rev=1044503&r1=1044502&r2=1044503&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl Fri Dec 10 20:40:08 2010
@@ -50,7 +50,7 @@ under the License.
<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled><@makeBlock className value /></#macro>
-<#macro renderTextareaField name className alert cols rows id readonly value visualEdtiorEnalble buttons><@makeBlock className value /></#macro>
+<#macro renderTextareaField name className alert cols rows id readonly value visualEdtiorEnalble language buttons><@makeBlock className value /></#macro>
<#macro renderDateTimeField name className alert title value size maxlength id event action dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName><@makeBlock className value /></#macro>