details: /erp/devel/pi/rev/6a274a07ebbd
changeset: 11036:6a274a07ebbd
user: Asier Galdos <asier.galdos <at> almis.com>
date: Fri Mar 04 18:10:59 2011 +0100
summary: Initial commit
details: /erp/devel/pi/rev/cbf101e59f72
changeset: 11037:cbf101e59f72
user: Asier Galdos <asier.galdos <at> almis.com>
date: Fri Mar 04 18:11:36 2011 +0100
summary: Adding a Link type field
details: /erp/devel/pi/rev/3df47d728b0d
changeset: 11038:3df47d728b0d
user: Asier Galdos <asier.galdos <at> almis.com>
date: Fri Mar 04 18:11:54 2011 +0100
summary: Adding a Link type field
details: /erp/devel/pi/rev/68eedc82708c
changeset: 11039:68eedc82708c
user: Asier Galdos <asier.galdos <at> almis.com>
date: Fri Mar 04 18:14:10 2011 +0100
summary: Cleanning up
details: /erp/devel/pi/rev/329854993f0a
changeset: 11040:329854993f0a
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Sun Mar 06 19:53:48 2011 +0100
summary: Small fixes in LinkUIDefinition
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
| 26 ++++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
| 13 ++
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
| 20 +++
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
| 2 +-
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/LinkUIDefinition.java
| 63 ++++++++++
5 files changed, 123 insertions(+), 1 deletions(-)
diffs (180 lines):
diff -r d677420bb5d0 -r 329854993f0a
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Sun Mar 06 10:02:00 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Sun Mar 06 19:53:48 2011 +0100
@@ -22,6 +22,7 @@
// * OBSearchItem: item used for search fields.
// * OBFormButton: button used in forms.
// * OBTextItem: string/text item
+// * OBLinkItem: string/text/link item
// * OBTextAreaItem: string/text-area item
// * OBDateItem: FormItem for dates
// * OBDateTimeItem: FormItem for DateTime
@@ -340,6 +341,31 @@
validateOnExit: true
});
+//== OBLinkItem ==
+//Input for normal strings (links) with an added icon to navigate to the link
+isc.ClassFactory.defineClass('OBLinkItem', TextItem);
+
+isc.OBLinkItem.addProperties({
+ validateOnExit: true,
+ icons: [{
+ src :
'[SKIN]/../../org.openbravo.client.application/images/form/search_picker.png',
+ click: function(form, item) {
+ var url = item.getValue();
+ if(!url || url.indexOf('://') == -1) {
+ return;
+ }
+ window.open(url);
+ }
+ }],
+ validate: function() {
+ var url = this.getValue();
+ if(!url) {
+ return true;
+ }
+ return OB.Utilities.isValidURL(url);
+ }
+});
+
//== OBFKFilterTextItem ==
//Input used for filtering on FK fields.
isc.ClassFactory.defineClass('OBFKFilterTextItem', TextItem);
diff -r d677420bb5d0 -r 329854993f0a
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
Sun Mar 06 10:02:00 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
Sun Mar 06 19:53:48 2011 +0100
@@ -562,3 +562,16 @@
}
};
+// ** {{{ OB.Utilities.isValidURL}}} **
+// Checks if a String is a valid URL
+//
+// Parameters:
+// * {{{url}}}: String url
+OB.Utilities.isValidURL = function(url) {
+ // Validation based on:
http://view.jquery.com/trunk/plugins/validate/jquery.validate.js
+ // Note: http://localhost is not a valid URL, http://localhost.localdomain
is a valid one
+ if(!url) {
+ return false;
+ }
+ return
(/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i).test(url);
+};
\ No newline at end of file
diff -r d677420bb5d0 -r 329854993f0a
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
Sun Mar 06 10:02:00 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
Sun Mar 06 19:53:48 2011 +0100
@@ -49,6 +49,7 @@
textBoxStyle: 'OBFormFieldInput'
});
+
isc.OBTimeItem.addProperties({
errorOrientation: 'left',
height: 21,
@@ -148,6 +149,25 @@
newTabIconSize: 8
});
+isc.OBLinkItem.addProperties({
+ cellStyle: 'OBFormField',
+ titleStyle: 'OBFormFieldLabel',
+ textBoxStyle: 'OBFormFieldInput',
+ pickerIconHeight: 21,
+ pickerIconWidth: 21,
+ height: 21,
+ pickerIconSrc:
'[SKINIMG]../../org.openbravo.client.application/images/form/search_picker.png',
+ clearIcon: {
+ showHover: true,
+ height: 15,
+ width: 15,
+ src:
'[SKINIMG]../../org.openbravo.client.application/images/form/clear-field.png',
+ prompt: OB.I18N.getLabel('OBUIAPP_ClearIconPrompt')
+ },
+ newTabIconSrc:
'[SKINIMG]../../org.openbravo.client.application/images/form/ico-to-new-tab.png',
+ newTabIconSize: 8
+});
+
isc.OBDateChooser.addProperties({
headerStyle: 'OBDateChooserButton',
diff -r d677420bb5d0 -r 329854993f0a
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
---
a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
Sun Mar 06 10:02:00 2011 +0100
+++
b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
Sun Mar 06 19:53:48 2011 +0100
@@ -66,7 +66,7 @@
<!--30ABBB2416964B3CB1C4E1608974843B--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--30ABBB2416964B3CB1C4E1608974843B-->
<AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
<!--30ABBB2416964B3CB1C4E1608974843B-->
<AD_REFERENCE_ID><![CDATA[800101]]></AD_REFERENCE_ID>
-<!--30ABBB2416964B3CB1C4E1608974843B-->
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.StringUIDefinition]]></CLASSNAME>
+<!--30ABBB2416964B3CB1C4E1608974843B-->
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.LinkUIDefinition]]></CLASSNAME>
<!--30ABBB2416964B3CB1C4E1608974843B--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--30ABBB2416964B3CB1C4E1608974843B--></OBCLKER_UIDEFINITION>
diff -r d677420bb5d0 -r 329854993f0a
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/LinkUIDefinition.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/LinkUIDefinition.java
Sun Mar 06 19:53:48 2011 +0100
@@ -0,0 +1,63 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.1 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel.reference;
+
+import org.openbravo.model.ad.ui.Field;
+
+/**
+ * Implementation of the Link UI definition.
+ *
+ */
+public class LinkUIDefinition extends UIDefinition {
+
+ @Override
+ public String getParentType() {
+ return "link";
+ }
+
+ @Override
+ public String getFormEditorType() {
+ return "OBLinkItem";
+ }
+
+ @Override
+ public String getFilterEditorType() {
+ return "OBTextItem";
+ }
+
+ @Override
+ public String getGridFieldProperties(Field field) {
+ Long length = field.getDisplayedLength();
+ if (length == null || length == 0) {
+ length = field.getColumn().getLength();
+ }
+ // custom override
+ if (field.getColumn().getDBColumnName().compareToIgnoreCase("documentno")
== 0) {
+ length = new Long(20);
+ }
+ return getShowHoverGridFieldSettings(field) + ", width:
isc.OBGrid.getDefaultColumnWidth("
+ + length + ")" + super.getGridFieldProperties(field);
+ }
+
+ @Override
+ public String getFilterEditorProperties(Field field) {
+ return ", filterOnKeypress: true" + super.getFilterEditorProperties(field);
+ }
+
+}
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits