X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/023f6f1e5465d565189031ead1aaef7351476f73..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 edd6191..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,19 +141,38 @@ 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"); generalTable.setText(2, 0, "Owner"); generalTable.setText(3, 0, "Last modified"); generalTable.setText(4, 0, "Tags"); + 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. @@ -158,6 +185,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { if (tagsBuffer.length() > 1) tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1); initialTagText = tagsBuffer.toString(); + tags.setWidth("100%"); tags.setText(initialTagText); generalTable.setWidget(4, 1, tags); generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); @@ -177,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); @@ -209,6 +242,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { DisclosurePanel allTags = new DisclosurePanel("All tags"); allTagsContent = new FlowPanel(); + allTagsContent.setWidth("100%"); allTags.setContent(allTagsContent); generalPanel.add(allTags); generalPanel.setSpacing(4); @@ -257,7 +291,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { permPanel.add(permButtons); // Only show the read for all permission if the user is the owner. if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) { - permForAll.add(new Label("Make Public")); + permForAll.add(new Label("Public")); permForAll.add(readForAll); permForAll.setSpacing(8); permForAll.addStyleName("gss-TabPanelBottom"); @@ -491,5 +525,4 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { DeferredCommand.addCommand(cf); } - }