Changeset 1092
- Timestamp:
- 07/14/09 12:21:08 (4 years ago)
- Location:
- trunk/mpdb-client/src/edu/rpi/metpetdb/client/ui/objects/details
- Files:
-
- 2 modified
-
SampleDetails.java (modified) (4 diffs)
-
SubsampleDetails.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mpdb-client/src/edu/rpi/metpetdb/client/ui/objects/details/SampleDetails.java
r1088 r1092 43 43 import edu.rpi.metpetdb.client.ui.commands.ServerOp; 44 44 import edu.rpi.metpetdb.client.ui.dialogs.ConfirmationDialogBox; 45 import edu.rpi.metpetdb.client.ui.dialogs.MDialogBox; 45 46 import edu.rpi.metpetdb.client.ui.input.ObjectEditorPanel; 46 47 import edu.rpi.metpetdb.client.ui.input.OnEnterPanel; … … 138 139 139 140 protected boolean canEdit() { 140 // TODO temporary while testing permissions 141 // final Sample s = (Sample) getBean(); 142 // if (s.isPublicData()) 143 // return false; 144 // if (MpDb.isCurrentUser(s.getOwner())) 145 // return true; 146 // return false; 147 return true; 141 final Sample s = (Sample) getBean(); 142 if (MpDb.isCurrentUser(s.getOwner())) 143 return true; 144 return false; 148 145 } 149 146 … … 202 199 @Override 203 200 public void command() { 204 History.newItem(TokenSpace.createNewSubsample(p_sample 201 if(canEdit()){ 202 History.newItem(TokenSpace.createNewSubsample(p_sample 205 203 .getBean())); 204 } else { 205 noPermissionWarning(); 206 } 206 207 } 207 208 }.begin(); … … 512 513 } 513 514 515 private boolean canEdit(){ 516 final Sample s = (Sample) p_sample.getBean(); 517 return MpDb.isCurrentUser(s.getOwner()); 518 } 519 520 private void noPermissionWarning(){ 521 final MDialogBox noPermissionBox = new MDialogBox(); 522 final FlowPanel container = new FlowPanel(); 523 container.add(new Label("You do not have the correct permissions to add a subsample.")); 524 Button ok = new Button("Ok"); 525 ok.addClickListener(new ClickListener(){ 526 public void onClick(final Widget sender){ 527 noPermissionBox.hide(); 528 } 529 }); 530 container.add(ok); 531 noPermissionBox.setWidget(container); 532 noPermissionBox.show(); 533 } 534 514 535 private void makeImagesPublicIfPublic(Sample sample) { 515 536 //If it's private, just return, images default to private -
trunk/mpdb-client/src/edu/rpi/metpetdb/client/ui/objects/details/SubsampleDetails.java
r1088 r1092 5 5 import com.google.gwt.user.client.History; 6 6 import com.google.gwt.user.client.rpc.AsyncCallback; 7 import com.google.gwt.user.client.ui.Button; 7 8 import com.google.gwt.user.client.ui.ClickListener; 8 9 import com.google.gwt.user.client.ui.FlexTable; 10 import com.google.gwt.user.client.ui.FlowPanel; 9 11 import com.google.gwt.user.client.ui.HasHorizontalAlignment; 10 12 import com.google.gwt.user.client.ui.HasVerticalAlignment; … … 26 28 import edu.rpi.metpetdb.client.ui.commands.VoidLoggedInOp; 27 29 import edu.rpi.metpetdb.client.ui.dialogs.ConfirmationDialogBox; 30 import edu.rpi.metpetdb.client.ui.dialogs.MDialogBox; 28 31 import edu.rpi.metpetdb.client.ui.input.ObjectEditorPanel; 29 32 import edu.rpi.metpetdb.client.ui.input.OnEnterPanel; … … 95 98 96 99 protected boolean canEdit() { 97 // TODO temporary while testing permissions 98 // final Sample s = ((Subsample) getBean()).getSample(); 99 // if (s.isPublicData()) 100 // return false; 101 // if (MpDb.isCurrentUser(s.getOwner())) 102 // return true; 103 // return false; 104 return true; 100 final Subsample s = ((Subsample) getBean()); 101 if (MpDb.isCurrentUser(s.getOwner())) 102 return true; 103 return false; 105 104 } 106 105 … … 171 170 new VoidLoggedInOp() { 172 171 public void command() { 173 History.newItem(TokenSpace 172 if(canEdit()){ 173 History.newItem(TokenSpace 174 174 .createNewChemicalAnalysis(p_subsample 175 175 .getBean())); 176 } else { 177 noPermissionWarning(); 178 } 176 179 } 177 180 }.begin(); … … 233 236 } 234 237 238 private boolean canEdit(){ 239 final Subsample s = ((Subsample) p_subsample.getBean()); 240 return MpDb.isCurrentUser(s.getOwner()); 241 } 242 243 private void noPermissionWarning(){ 244 final MDialogBox noPermissionBox = new MDialogBox(); 245 final FlowPanel container = new FlowPanel(); 246 container.add(new Label("You do not have the correct permissions to add a chemical analysis.")); 247 Button ok = new Button("Ok"); 248 ok.addClickListener(new ClickListener(){ 249 public void onClick(final Widget sender){ 250 noPermissionBox.hide(); 251 } 252 }); 253 container.add(ok); 254 noPermissionBox.setWidget(container); 255 noPermissionBox.show(); 256 } 257 235 258 private void makeImagesPublicIfPublic(Subsample subsample){ 236 259 //If it's private, just return, images default to private
