X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/6735a2ab4c130bc441d9486cecbf559b6e2e56c2..4ac4dbef869b50377d81d5ac680432c2bbd3b52c:/src/gr/ebs/gss/client/FilePropertiesDialog.java diff --git a/src/gr/ebs/gss/client/FilePropertiesDialog.java b/src/gr/ebs/gss/client/FilePropertiesDialog.java index d217a35..68a1994 100644 --- a/src/gr/ebs/gss/client/FilePropertiesDialog.java +++ b/src/gr/ebs/gss/client/FilePropertiesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd. + * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd. * * This file is part of GSS. * @@ -29,8 +29,12 @@ import java.util.List; import java.util.Set; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONBoolean; @@ -96,6 +100,8 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { final FileResource file; + private String userFullName; + /** * The widget's constructor. * @@ -103,14 +109,16 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { * @param groups * @param bodies */ - public FilePropertiesDialog(final Images images, final List groups, List bodies) { + public FilePropertiesDialog(final Images images, final List groups, List bodies, String _userFullName) { // Set the dialog's caption. setText("File properties"); file = (FileResource) GSS.get().getCurrentSelection(); + userFullName = _userFullName; permList = new PermissionsList(images, file.getPermissions(), file.getOwner()); + // Outer contains inner and buttons. final VerticalPanel outer = new VerticalPanel(); final FocusPanel focusPanel = new FocusPanel(outer); @@ -133,6 +141,10 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { inner.add(verPanel, "Versions"); inner.selectTab(0); + final Label fileNameNote = new Label("Please note that slashes ('/') are not allowed in file names.", true); + fileNameNote.setVisible(false); + fileNameNote.setStylePrimaryName("gss-readForAllNote"); + final FlexTable generalTable = new FlexTable(); generalTable.setText(0, 0, "Name"); generalTable.setText(1, 0, "Folder"); @@ -142,11 +154,25 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { name.setWidth("100%"); name.setText(file.getName()); generalTable.setWidget(0, 1, name); + name.addChangeHandler(new ChangeHandler() { + + @Override + public void onChange(ChangeEvent event) { + if(name.getText().contains("/")) + fileNameNote.setVisible(true); + else + fileNameNote.setVisible(false); + + } + }); + if(file.getFolderName() != null) generalTable.setText(1, 1, file.getFolderName()); else generalTable.setText(1, 1, "-"); - generalTable.setText(2, 1, file.getOwner()); + generalTable.setWidget(0, 2, fileNameNote); + generalTable.setText(2, 1,userFullName); + final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); generalTable.setText(3, 1, formatter.format(file.getModificationDate())); // Get the tags. @@ -179,8 +205,13 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { final Button ok = new Button("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { - accept(); - closeDialog(); + if(name.getText().contains("/")) + fileNameNote.setVisible(true); + else{ + fileNameNote.setVisible(true); + accept(); + closeDialog(); + } } }); buttons.add(ok); @@ -494,5 +525,4 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { DeferredCommand.addCommand(cf); } - }