details: https://code.openbravo.com/erp/devel/pi/rev/9251cad76bb3
changeset: 13309:9251cad76bb3
user: David Baz Fayos <david.baz <at> openbravo.com>
date: Wed Jul 27 20:19:54 2011 +0200
summary: [imageBLOB] fixed and splitted some styles
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
| 142 +++++----
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
| 70 +----
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.js
| 39 ++-
3 files changed, 125 insertions(+), 126 deletions(-)
diffs (truncated from 330 to 300 lines):
diff -r 42e0ebfeecb7 -r 9251cad76bb3
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
Wed Jul 27 18:28:44 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
Wed Jul 27 20:19:54 2011 +0200
@@ -17,19 +17,76 @@
************************************************************************
*/
+//== OBImageItemSmallImage ==
+//This class is used for the small image shown within the
OBImageItemSmallImageContainer
+isc.ClassFactory.defineClass('OBImageItemSmallImage', isc.Img);
+
+isc.OBImageItemSmallImage.addProperties({
+ imageType: "stretch"
+});
+
+//== OBImageItemSmallImageContainer ==
+//This class is used for the small image container box
+isc.ClassFactory.defineClass('OBImageItemSmallImageContainer', isc.HLayout);
+
+isc.OBImageItemSmallImageContainer.addProperties({
+ imageItem: null,
+ click: function() {
+ var imageId=this.imageItem.getValue();
+ if (!imageId) {
+ return;
+ }
+ var d = {
+ inpimageId: imageId,
+ command: 'GETSIZE'
+ };
+
OB.RemoteCallManager.call('org.openbravo.client.application.window.ImagesActionHandler',
{}, d, function(response, data, request){
+ var pageHeight = Page.getHeight()-100;
+ var pageWidth = Page.getWidth()-100;
+ var height;
+ var width;
+ var ratio = data.width/data.height;
+ if (ratio > pageWidth/pageHeight) {
+ width = data.width > pageWidth?pageWidth:data.width;
+ height = width/ratio;
+ } else {
+ height = data.height > pageHeight?pageHeight:data.height;
+ width = height*ratio;
+ }
+ var imagePopup = isc.OBPopup.create({
+ height: height,
+ width: width,
+ showMinimizeButton : false,
+ showMaximizeButton : false
+ });
+ var image = isc.OBImageItemBigImage.create({
+ popupContainer: imagePopup,
+ height: height,
+ width: width,
+ click: function() { this.popupContainer.closeClick(); },
+ cursor: 'pointer',
+ src: "../utility/ShowImage?id=" + imageId + '&nocache=' +
Math.random(),
+ align: 'center'
+ });
+ image.setImageType('stretch');
+ imagePopup.addItem(image);
+ imagePopup.show();
+ });
+ }
+});
+
+//== OBImageItemBigImage ==
+//This class is used for the big image shown within the popup
+isc.ClassFactory.defineClass('OBImageItemBigImage', isc.Img);
+
//== OBImageItemButton ==
//This class is used for the buttons shown in the OBImageItem
-isc.ClassFactory.defineClass('OBImageItemButton', isc.OBToolbarIconButton);
+isc.ClassFactory.defineClass('OBImageItemButton', isc.ImgButton);
isc.OBImageItemButton.addProperties({
- buttonType: 'selector',
- customState: '',
- initWidget: function(){
- this.Super('initWidget', arguments);
- this.resetBaseStyle();
- },
- resetBaseStyle: function(){
- this.setBaseStyle('OBImageItemButton_' + this.buttonType +
this.customState);
+ initWidget: function() {
+ this.initWidgetStyle();
+ return this.Super('initWidget', arguments);
}
});
@@ -41,64 +98,17 @@
OBImageCanvas.addProperties({
height: '0px',
initWidget: function(){
- var imageLayout = isc.HLayout.create({
- width:'100%',
- height: '100%',
- border: '1px solid #CDD7BB',
- align: 'center',
- cursor: 'pointer',
- defaultLayoutAlign: 'center',
- imageItem: this.creator,
- click: function(){
- var imageId=this.imageItem.getValue();
- if(!imageId){
- return;
- }
- var d = {
- inpimageId: imageId,
- command: 'GETSIZE'
- };
-
OB.RemoteCallManager.call('org.openbravo.client.application.window.ImagesActionHandler',
{}, d, function(response, data, request){
- var pageHeight = Page.getHeight()-100;
- var pageWidth = Page.getWidth()-100;
- var height;
- var width;
- var ratio = data.width/data.height;
- if(ratio>pageWidth/pageHeight){
- width = data.width>pageWidth?pageWidth:data.width;
- height = width/ratio;
- }else{
- height = data.height>pageHeight?pageHeight:data.height;
- width = height*ratio;
- }
- var imagePopup = isc.OBPopup.create({
- height: height,
- width: width,
- showMinimizeButton : false,
- showMaximizeButton : false
- });
- var image = isc.Img.create({
- height: height,
- width: width,
- src:
"../utility/ShowImage?id="+imageId+'&nocache='+Math.random(),
- align: 'center'
- });
- image.setImageType('stretch');
- imagePopup.addItem(image);
- imagePopup.show();
- });
- }
+ var imageLayout = isc.OBImageItemSmallImageContainer.create({
+ imageItem: this.creator
});
- if(this.creator.required){
- imageLayout.setBackgroundColor('#FFFFCC');
- }else{
- imageLayout.setBackgroundColor('#F5F7F1');
+ if (this.creator.required) {
+ imageLayout.setStyleName(imageLayout.styleName + 'Required');
+ } else {
+ imageLayout.setStyleName(imageLayout.styleName);
}
this.addMember(imageLayout);
- this.image=isc.Img.create({
- width: '100%',
- cursor: 'pointer',
- imageType: "stretch"
+ this.image=isc.OBImageItemSmallImage.create({
+ width: '100%'
});
imageLayout.addMember(this.image);
this.image.setSrc('../web/skins/ltr/Default/Common/Image/imageNotAvailable_medium.png');
@@ -106,7 +116,7 @@
width: '1%'
});
var selectorButton = isc.OBImageItemButton.create({
- buttonType: 'selector',
+ buttonType: 'upload',
imageItem: this.creator,
action: function(){
var selector = isc.OBImageSelector.create({
@@ -118,7 +128,7 @@
}
});
var deleteButton = isc.OBImageItemButton.create({
- buttonType: 'delete',
+ buttonType: 'erase',
imageItem: this.creator,
deleteFunction: function(){
var imageId = this.imageItem.getValue();
diff -r 42e0ebfeecb7 -r 9251cad76bb3
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
---
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
Wed Jul 27 18:28:44 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
Wed Jul 27 20:19:54 2011 +0200
@@ -23,6 +23,7 @@
* Form Fields/Items
* Date Picker
* Form Buttons
+ * Image Item
* LinkButton Item
* SectionItem Button
* Dialog
@@ -724,72 +725,23 @@
color: #777;
}
+/*=======================================================================
+ * Image Item
+=======================================================================*/
-.OBImageItemButton_selector {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/upload_icon.png);
+.OBImageItemSmallImageContainer,
+.OBImageItemSmallImageContainerRequired {
+ border: #CDD7BB 1px solid;
}
-.OBImageItemButton_selectorDown,
-.OBImageItemButton_selectorFocusedDown,
-.OBImageItemButton_selectorSelected,
-.OBImageItemButton_selectorFocused,
-.OBImageItemButton_selectorSelectedDown,
-.OBImageItemButton_selectorSelectedFocusedDown {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/upload_icon_Down.png);
+.OBImageItemSmallImageContainer {
+ background-color: #F5F7F1;
}
-.OBImageItemButton_selectorDisabled,
-.OBImageItemButton_selectorSelectedDisabled {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/upload_icon_Disabled.png);
+.OBImageItemSmallImageContainerRequired {
+ background-color: #FFFFCC;
}
-.OBImageItemButton_selectorOver,
-.OBImageItemButton_selectorFocusedOver,
-.OBImageItemButton_selectorSelectedFocused,
-.OBImageItemButton_selectorSelectedFocusedOver {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/upload_icon_Over.png);
-}
-
-.OBImageItemButton_delete {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/erase_icon.png);
-}
-
-.OBImageItemButton_deleteDown,
-.OBImageItemButton_deleteFocusedDown,
-.OBImageItemButton_deleteSelected,
-.OBImageItemButton_deleteFocused,
-.OBImageItemButton_deleteSelectedDown,
-.OBImageItemButton_deleteSelectedFocusedDown {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/erase_icon_Down.png);
-}
-
-.OBImageItemButton_deleteDisabled,
-.OBImageItemButton_deleteSelectedDisabled {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/erase_icon_Disabled.png);
-}
-
-.OBImageItemButton_deleteOver,
-.OBImageItemButton_deleteFocusedOver,
-.OBImageItemButton_deleteSelectedFocused,
-.OBImageItemButton_deleteSelectedFocusedOver {
- background-position:right top;
- background-repeat: no-repeat;
- background-image: url(./images/form/erase_icon_Over.png);
-}
/*=======================================================================
* LinkButton Item
=======================================================================*/
diff -r 42e0ebfeecb7 -r 9251cad76bb3
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.js
Wed Jul 27 18:28:44 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.js
Wed Jul 27 20:19:54 2011 +0200
@@ -20,7 +20,8 @@
/* =====================================================================
* Styling properties for:
* 1) OB Form items
- * 2) SectionItem Button Styles
+ * 2) OBImageItem
+ * 3) SectionItem Button Styles
* 3) Attachments Styles
=======================================================================*/
@@ -394,6 +395,42 @@
});
/* =====================================================================
+ * OBImageItem
+ =======================================================================*/
+
+isc.OBImageItemSmallImage.addProperties({
+ styleName: 'OBImageItemSmallImage',
+ cursor: 'pointer'
+});
+
+isc.OBImageItemSmallImageContainer.addProperties({
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits