← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5600: Visualizer gui usability improved.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5600 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-12-25 20:32:14 +0100
message:
  Visualizer gui usability improved.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-12-25 15:40:58 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-12-25 19:29:08 +0000
@@ -2709,24 +2709,41 @@
                                                                                             }
                                                                                         ],
                                                                                         bbar: [
+																							{
+																								xtype: 'label',
+																								style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%',
+																								listeners: {
+																									added: function() {
+																										DV.cmp.favorite.rename.label = this;
+																									}
+																								}
+																							},
+																							'->',
                                                                                             {
                                                                                                 text: 'Cancel',
                                                                                                 handler: function() {
                                                                                                     this.up('window').close();
                                                                                                 }
                                                                                             },
-                                                                                            '->',
                                                                                             {
                                                                                                 text: 'Rename',
                                                                                                 disabled: true,
                                                                                                 xable: function() {
                                                                                                     var value = this.up('window').cmp.name.getValue();
-                                                                                                    if (value && value != DV.cmp.favorite.name.getValue()) {
-                                                                                                        this.enable();
-                                                                                                    }
-                                                                                                    else {
-                                                                                                        this.disable();
-                                                                                                    }
+                                                                                                    if (value) {
+																										if (DV.store.favorite.findExact('name', value) == -1) {
+																											this.enable();
+																											DV.cmp.favorite.rename.label.setText('');
+																											return;
+																										}
+																										else {
+																											DV.cmp.favorite.rename.label.setText('* Name already in use');
+																										}
+																									}
+																									else {
+																										DV.cmp.favorite.rename.label.setText('* No name entered');
+																									}
+																									this.disable();
                                                                                                 },
                                                                                                 handler: function() {
                                                                                                     DV.util.crud.favorite.updateName(this.up('window').cmp.name.getValue());
@@ -2846,17 +2863,39 @@
                                                                     height: 24
                                                                 },
                                                                 items: [
+																	{
+																		xtype: 'label',
+																		style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%',
+																		listeners: {
+																			added: function() {
+																				DV.cmp.favorite.label = this;
+																			}
+																		}
+																	},																
                                                                     '->',
                                                                     {
                                                                         text: 'Save',
                                                                         disabled: true,
                                                                         xable: function() {
-                                                                            if (DV.state.isRendered && DV.cmp.favorite.name.getValue()) {
-                                                                                this.enable();
-                                                                            }
-                                                                            else {
-                                                                                this.disable();
-                                                                            }
+                                                                            if (DV.state.isRendered) {
+																				if (DV.cmp.favorite.name.getValue()) {
+																					this.enable();
+																					DV.cmp.favorite.label.setText('');
+																					return;
+																				}
+																				else {
+																					DV.cmp.favorite.label.setText('');
+																				}
+																			}
+																			else {
+																				if (DV.cmp.favorite.name.getValue()) {
+																					DV.cmp.favorite.label.setText('* No active chart');
+																				}
+																				else {
+																					DV.cmp.favorite.label.setText('');
+																				}																				
+                                                                            }
+																			this.disable();
                                                                         },
                                                                         handler: function() {
                                                                             var value = DV.cmp.favorite.name.getValue();