r888 - in trunk: img/nav-icons src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/platf/public/images/nav src/main/java/org/ourproject/kune/workspace/client/skel
Author: vjrj Date: 2008-09-27 13:14:37 +0200 (Sat, 27 Sep 2008) New Revision: 888 Added: trunk/img/nav-icons/download.png trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/download.png Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/skel/WorkspaceSkeleton.java Log: Complete - task 67: Root can be edited / make notVisible / add Folder Actions to menu of contents Action reorganization. Download button. Added: trunk/img/nav-icons/download.png =================================================================== (Binary files differ) Property changes on: trunk/img/nav-icons/download.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-09-27 03:22:43 UTC (rev 887) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-09-27 11:14:37 UTC (rev 888) @@ -13,6 +13,7 @@ import org.ourproject.kune.platf.client.actions.ActionEnableCondition; import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor; import org.ourproject.kune.platf.client.actions.ActionPosition; +import org.ourproject.kune.platf.client.actions.ContentActionRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.dto.AccessRolDTO; import org.ourproject.kune.platf.client.dto.ContentDTO; @@ -27,6 +28,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.calclab.suco.client.ioc.Provider; import com.calclab.suco.client.listener.Listener; @@ -38,20 +40,25 @@ private final Session session; private final StateManager stateManager; private final Provider<FileUploader> fileUploaderProvider; + private final ContentActionRegistry contentActionRegistry; private final ContextActionRegistry contextActionRegistry; private final Provider<ContentServiceAsync> contentServiceProvider; + private final WorkspaceSkeleton ws; public DocumentClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator, - final Session session, final StateManager stateManager, + final Session session, final StateManager stateManager, final WorkspaceSkeleton ws, final Provider<ContentServiceAsync> contentServiceProvider, - final Provider<FileUploader> fileUploaderProvider, final ContextActionRegistry contextActionRegistry) { + final Provider<FileUploader> fileUploaderProvider, final ContentActionRegistry contentActionRegistry, + final ContextActionRegistry contextActionRegistry) { this.i18n = i18n; this.contextNavigator = contextNavigator; this.session = session; this.stateManager = stateManager; + this.ws = ws; this.contentServiceProvider = contentServiceProvider; this.fileUploaderProvider = fileUploaderProvider; this.contextActionRegistry = contextActionRegistry; + this.contentActionRegistry = contentActionRegistry; createActions(); } @@ -107,8 +114,8 @@ }); } }); - delContent.setParentMenuTitle(i18n.t("Folder")); - delContent.setTextDescription(i18n.t("Delete document")); + delContent.setParentMenuTitle(i18n.t("File")); + delContent.setTextDescription(i18n.t("Delete")); delContent.setMustBeConfirmed(true); delContent.setConfirmationTitle(i18n.t("Please confirm")); delContent.setConfirmationText(i18n.t("Are you sure?")); @@ -127,14 +134,24 @@ } }); - final ActionDescriptor<StateToken> rename = new ActionDescriptor<StateToken>(AccessRolDTO.Editor, - ActionPosition.itemMenu, new Listener<StateToken>() { + final ActionMenuDescriptor<StateToken> rename = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, + ActionPosition.topbarAndItemMenu, new Listener<StateToken>() { public void onEvent(final StateToken stateToken) { contextNavigator.editItem(stateToken); } }); rename.setTextDescription(i18n.t("Rename")); + rename.setParentMenuTitle(i18n.t("File")); + final ActionMenuDescriptor<StateToken> renameCtx = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, + ActionPosition.topbarAndItemMenu, new Listener<StateToken>() { + public void onEvent(final StateToken stateToken) { + contextNavigator.editItem(stateToken); + } + }); + renameCtx.setTextDescription(i18n.t("Rename")); + renameCtx.setParentMenuTitle(i18n.t("Folder")); + final ActionButtonDescriptor<StateToken> goGroupHome = new ActionButtonDescriptor<StateToken>( AccessRolDTO.Viewer, ActionPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken token) { @@ -174,17 +191,28 @@ } }); - final ActionMenuDescriptor<StateToken> refresh = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Viewer, + final ActionMenuDescriptor<StateToken> refreshCtx = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Viewer, ActionPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken stateToken) { stateManager.reload(); contextNavigator.selectItem(stateToken); } }); - refresh.setParentMenuTitle(i18n.t("Folder")); - refresh.setTextDescription(i18n.t("Refresh")); - refresh.setIconUrl("images/nav/refresh.png"); + refreshCtx.setParentMenuTitle(i18n.t("Folder")); + refreshCtx.setTextDescription(i18n.t("Refresh")); + refreshCtx.setIconUrl("images/nav/refresh.png"); + final ActionMenuDescriptor<StateToken> refreshCnt = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Viewer, + ActionPosition.topbar, new Listener<StateToken>() { + public void onEvent(final StateToken stateToken) { + stateManager.reload(); + contextNavigator.selectItem(stateToken); + } + }); + refreshCnt.setParentMenuTitle(i18n.t("File")); + refreshCnt.setTextDescription(i18n.t("Refresh")); + refreshCnt.setIconUrl("images/nav/refresh.png"); + final ActionDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"), "images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null); @@ -197,49 +225,68 @@ } }); + final ActionButtonDescriptor<StateToken> download = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Viewer, + ActionPosition.topbar, new Listener<StateToken>() { + public void onEvent(final StateToken token) { + downloadContent(token); + } + }); + download.setTextDescription(i18n.t("Download")); + download.setToolTip(i18n.t("Download this file")); + download.setIconUrl("images/nav/download.png"); + + final ActionDescriptor<StateToken> downloadCtx = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer, + ActionPosition.itemMenu, new Listener<StateToken>() { + public void onEvent(final StateToken token) { + downloadContent(token); + } + }); + downloadCtx.setTextDescription(i18n.t("Download")); + downloadCtx.setIconUrl("images/nav/download.png"); + contextActionRegistry.addAction(TYPE_FOLDER, go); contextActionRegistry.addAction(TYPE_FOLDER, addDoc); contextActionRegistry.addAction(TYPE_FOLDER, addFolder); + contextActionRegistry.addAction(TYPE_FOLDER, renameCtx); + contextActionRegistry.addAction(TYPE_FOLDER, refreshCtx); contextActionRegistry.addAction(TYPE_FOLDER, delContainer); - contextActionRegistry.addAction(TYPE_FOLDER, refresh); - contextActionRegistry.addAction(TYPE_FOLDER, rename); contextActionRegistry.addAction(TYPE_FOLDER, goGroupHome); contextActionRegistry.addAction(TYPE_FOLDER, uploadFile); contextActionRegistry.addAction(TYPE_BLOG, go); contextActionRegistry.addAction(TYPE_BLOG, uploadFile); - contextActionRegistry.addAction(TYPE_BLOG, refresh); + contextActionRegistry.addAction(TYPE_BLOG, refreshCtx); contextActionRegistry.addAction(TYPE_BLOG, setAsDefGroupContent); contextActionRegistry.addAction(TYPE_GALLERY, go); contextActionRegistry.addAction(TYPE_GALLERY, goGroupHome); - contextActionRegistry.addAction(TYPE_GALLERY, refresh); + contextActionRegistry.addAction(TYPE_GALLERY, refreshCtx); contextActionRegistry.addAction(TYPE_UPLOADEDFILE, go); - contextActionRegistry.addAction(TYPE_UPLOADEDFILE, delContent); - contextActionRegistry.addAction(TYPE_UPLOADEDFILE, rename); - // contextActionRegistry.addAction(TYPE_UPLOADEDFILE, goGroupHome); - // contextActionRegistry.addAction(TYPE_UPLOADEDFILE, refresh); contextActionRegistry.addAction(TYPE_UPLOADEDFILE, setAsDefGroupContent); + contentActionRegistry.addAction(TYPE_UPLOADEDFILE, rename); + contentActionRegistry.addAction(TYPE_UPLOADEDFILE, refreshCnt); + contentActionRegistry.addAction(TYPE_UPLOADEDFILE, delContent); + contentActionRegistry.addAction(TYPE_UPLOADEDFILE, download); + contextActionRegistry.addAction(TYPE_UPLOADEDFILE, downloadCtx); contextActionRegistry.addAction(TYPE_WIKI, go); contextActionRegistry.addAction(TYPE_WIKI, goGroupHome); - contextActionRegistry.addAction(TYPE_WIKI, refresh); + contextActionRegistry.addAction(TYPE_WIKI, refreshCtx); contextActionRegistry.addAction(TYPE_ROOT, addDoc); contextActionRegistry.addAction(TYPE_ROOT, addFolder); contextActionRegistry.addAction(TYPE_ROOT, addGallery); contextActionRegistry.addAction(TYPE_ROOT, addWiki); - contextActionRegistry.addAction(TYPE_ROOT, refresh); + contextActionRegistry.addAction(TYPE_ROOT, refreshCtx); contextActionRegistry.addAction(TYPE_ROOT, goGroupHome); contextActionRegistry.addAction(TYPE_ROOT, uploadFile); contextActionRegistry.addAction(TYPE_DOCUMENT, go); - contextActionRegistry.addAction(TYPE_DOCUMENT, delContent); - contextActionRegistry.addAction(TYPE_DOCUMENT, rename); - // contextActionRegistry.addAction(TYPE_DOCUMENT, goGroupHome); - // contextActionRegistry.addAction(TYPE_DOCUMENT, refresh); contextActionRegistry.addAction(TYPE_DOCUMENT, setAsDefGroupContent); + contentActionRegistry.addAction(TYPE_DOCUMENT, rename); + contentActionRegistry.addAction(TYPE_DOCUMENT, refreshCnt); + contentActionRegistry.addAction(TYPE_DOCUMENT, delContent); } private ActionMenuDescriptor<StateToken> createFolderAction(final String contentTypeId, final String iconUrl, @@ -285,4 +332,9 @@ uploadFile.setToolTip(toolTip); return uploadFile; } + + private void downloadContent(final StateToken token) { + final String url = "/kune/servlets/FileDownloadManager?token=" + token + "&hash=" + session.getUserHash(); + ws.openUrl(url); + } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-27 03:22:43 UTC (rev 887) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-27 11:14:37 UTC (rev 888) @@ -112,7 +112,8 @@ register(ToolGroup.class, new Factory<DocumentClientActions>(DocumentClientActions.class) { public DocumentClientActions create() { return new DocumentClientActions($(I18nUITranslationService.class), $(ContextNavigator.class), - $(Session.class), $(StateManager.class), $$(ContentServiceAsync.class), $$(FileUploader.class), + $(Session.class), $(StateManager.class), $(WorkspaceSkeleton.class), + $$(ContentServiceAsync.class), $$(FileUploader.class), $(ContentActionRegistry.class), $(ContextActionRegistry.class)); } }); Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/download.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/download.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/WorkspaceSkeleton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/WorkspaceSkeleton.java 2008-09-27 03:22:43 UTC (rev 887) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/WorkspaceSkeleton.java 2008-09-27 11:14:37 UTC (rev 888) @@ -6,6 +6,7 @@ import com.calclab.suco.client.listener.Listener0; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DeferredCommand; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.core.ExtElement; @@ -41,7 +42,8 @@ entity.addToEntityMainHeader(widget); } - public void askConfirmation(final String title, final String message, final Listener0 onConfirmed, final Listener0 onCancel) { + public void askConfirmation(final String title, final String message, final Listener0 onConfirmed, + final Listener0 onCancel) { MessageBox.confirm(title, message, new MessageBox.ConfirmCallback() { public void execute(final String btnID) { if (btnID.equals("yes")) { @@ -81,6 +83,15 @@ extRootBody.mask(message, "x-mask-loading"); } + public void openUrl(final String url) { + // final Frame urlFrame = new Frame(url); + // final Window window = new Window(); + // window.add(urlFrame); + // window.show(); + // window.close(); + Window.open(url, "", "_blank"); + } + public void promptMessage(final String title, final String message, final Listener0 onEnter) { MessageBox.prompt(title, message, new MessageBox.PromptCallback() { public void execute(final String btnID, final String text) {
participants (1)
-
vjrj