diff --git a/config/alfresco/templates/client/doclist_preview_panel.ftl b/config/alfresco/templates/client/doclist_preview_panel.ftl index 028de52351..69385131f1 100644 --- a/config/alfresco/templates/client/doclist_preview_panel.ftl +++ b/config/alfresco/templates/client/doclist_preview_panel.ftl @@ -17,16 +17,23 @@ - +<#if node.isLocked > + +<#elseif hasAspect(node, "cm:workingcopy") == 1> + +<#else> + + - + - - + +<#assign navurl='/navigate/showDocDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id> +
Checkout(Locked)onclick='event.cancelBubble=true;MyDocs.checkinItem("${node.name}", "${node.nodeRef}");'>Check Inonclick='event.cancelBubble=true;MyDocs.checkoutItem("${node.name}", "${node.nodeRef}");'>Check Out Edit Details
UpdateView ContentView Content
DeleteMore Actions...onclick='event.cancelBubble=true;MyDocs.deleteItem("${node.name}", "${node.nodeRef}");'>DeleteMore Actions...
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.html.ftl index 6bf8360ba8..e78c1b1cbe 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.html.ftl @@ -45,75 +45,36 @@ - - - - - + + + + +
All ItemsWord DocumentsHTML DocumentsPDF DocumentsRecently ModifiedAll ItemsWord DocumentsHTML DocumentsPDF DocumentsRecently Modified - Refresh + Refresh
+
- <#assign weekms=1000*60*60*24*7> - <#assign count=0> - <#if home?exists> - <#assign docs=home.children?sort_by('name')> - <#else> - <#assign docs=companyhome.childrenByLuceneSearch[args.q]?sort_by('name')> - - <#list docs as d> - <#if d.isDocument> - <#if (filter=0) || - (filter=1 && d.mimetype="application/msword") || - (filter=2 && d.mimetype="text/html") || - (filter=3 && d.mimetype="application/pdf") || - (filter=4 && (dateCompare(d.properties["cm:modified"],date,weekms) == 1 || dateCompare(d.properties["cm:created"], date, weekms) == 1))> - <#assign count=count+1> -
-
- -
-
-
- ${d.name?html} - - - -
-
- - - - - - -
- Description: 
- Modified: 
- Modified By:  -
  - Created: 
- Created By: 
- Size:  -
-
-
-
- - - + <#-- populated via an AJAX call to 'doclistpanel' webscript --> + <#-- resolved path, filter and home.noderef required as arguments --> +
- Showing ${count} items(s) + Showing 0 items(s)
@@ -160,6 +121,18 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited visibility: hidden; } +#docPanelOverlay +{ + background-color: #fff; + background-image: url(${url.context}/images/icons/ajax_anim.gif); + background-position: center; + background-repeat: no-repeat; + position: absolute; + height: 320px; + width: 716px; + overflow: hidden; +} + .docRow { padding-top: 4px; @@ -277,6 +250,21 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited border-right: none; } +.docActionCheckin +{ + background-image: url(${url.context}/images/icons/doclist_action_checkin.png); + border-bottom: none; + border-right: none; +} + +.docActionLocked +{ + background-image: url(${url.context}/images/icons/doclist_action_locked.png); + border-bottom: none; + border-right: none; + cursor: default !important; +} + .docActionEditDetails { background-image: url(${url.context}/images/icons/doclist_action_edit.png); diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.desc.xml new file mode 100644 index 0000000000..94852cd952 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.desc.xml @@ -0,0 +1,7 @@ + + Document List Panel + Generate the inner panel for the Document List portlet page + /doclistpanel?f={filter}&p={path}&h={home};q={query?} + user + required + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.html.ftl new file mode 100644 index 0000000000..3d537c885c --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.html.ftl @@ -0,0 +1,53 @@ +<#assign weekms=1000*60*60*24*7> +<#assign count=0> +<#-- get the filter mode from the passed in args --> +<#-- filters: 0=all, 1=word, 2=html, 3=pdf, 4=recent --> +<#if args.f?exists && args.f?length!=0><#assign filter=args.f?number><#else><#assign filter=0> +<#if args.h?exists> + <#assign docs=companyhome.nodeByReference[args.h].children?sort_by('name')> +<#else> + <#assign docs=companyhome.childrenByLuceneSearch[args.q]?sort_by('name')> + +<#list docs as d> + <#if d.isDocument> + <#if (filter=0) || + (filter=1 && d.mimetype="application/msword") || + (filter=2 && d.mimetype="text/html") || + (filter=3 && d.mimetype="application/pdf") || + (filter=4 && (dateCompare(d.properties["cm:modified"],date,weekms) == 1 || dateCompare(d.properties["cm:created"], date, weekms) == 1))> + <#assign count=count+1> +
+
+ +
+
+
+ ${d.name?html} + + + +
+
+ + + + + + +
+ Description: 
+ Modified: 
+ Modified By:  +
  + Created: 
+ Created By: 
+ Size:  +
+
+
+
+ + + +<#-- hidden div with the count value for the page --> + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl index 915fce78d8..94b82adaa9 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl @@ -81,7 +81,7 @@ My Items Recently Modified - Refresh + Refresh @@ -160,6 +160,7 @@ a.spacefilterLinkSelected:link, a.spacefilterLinkSelected:visited #spacePanelOverlay { + background-color: #fff; background-image: url(${url.context}/images/icons/ajax_anim.gif); background-position: center; background-repeat: no-repeat; diff --git a/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java b/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java index e7b63618a3..5552f07e60 100644 --- a/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java +++ b/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java @@ -106,26 +106,4 @@ public class MySpacesBean out.write("ERROR: " + err.getMessage()); } } - - @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) - public void deleteItem() throws Exception - { - FacesContext fc = FacesContext.getCurrentInstance(); - ResponseWriter out = fc.getResponseWriter(); - - Map requestMap = fc.getExternalContext().getRequestParameterMap(); - String strNodeRef = (String)requestMap.get("noderef"); - if (strNodeRef != null && strNodeRef.length() != 0) - { - try - { - Repository.getServiceRegistry(fc).getFileFolderService().delete(new NodeRef(strNodeRef)); - out.write("OK: " + strNodeRef); - } - catch (Throwable err) - { - out.write("ERROR: " + err.getMessage()); - } - } - } } diff --git a/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java b/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java new file mode 100644 index 0000000000..272f5703fe --- /dev/null +++ b/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.bean.ajax; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.faces.context.FacesContext; +import javax.faces.context.ResponseWriter; + +import org.alfresco.filesys.server.filesys.FileExistsException; +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionType; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.app.servlet.BaseServlet; +import org.alfresco.web.app.servlet.ajax.InvokeCommand; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.spaces.CreateSpaceWizard; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean backing the ajax requests from various Portlet webscripts. + * + * @author Mike Hatfield + */ +public class PortletActionsBean +{ + private static Log logger = LogFactory.getLog(PortletActionsBean.class); + + @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) + public void deleteItem() throws Exception + { + FacesContext fc = FacesContext.getCurrentInstance(); + ResponseWriter out = fc.getResponseWriter(); + + Map requestMap = fc.getExternalContext().getRequestParameterMap(); + String strNodeRef = (String)requestMap.get("noderef"); + if (strNodeRef != null && strNodeRef.length() != 0) + { + try + { + Repository.getServiceRegistry(fc).getFileFolderService().delete(new NodeRef(strNodeRef)); + out.write("OK: " + strNodeRef); + } + catch (Throwable err) + { + out.write("ERROR: " + err.getMessage()); + } + } + } + + @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) + public void checkoutItem() throws Exception + { + FacesContext fc = FacesContext.getCurrentInstance(); + ResponseWriter out = fc.getResponseWriter(); + + Map requestMap = fc.getExternalContext().getRequestParameterMap(); + String strNodeRef = (String)requestMap.get("noderef"); + if (strNodeRef != null && strNodeRef.length() != 0) + { + try + { + Repository.getServiceRegistry(fc).getCheckOutCheckInService().checkout(new NodeRef(strNodeRef)); + out.write("OK: " + strNodeRef); + } + catch (Throwable err) + { + out.write("ERROR: " + err.getMessage()); + } + } + } + + @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) + public void checkinItem() throws Exception + { + FacesContext fc = FacesContext.getCurrentInstance(); + ResponseWriter out = fc.getResponseWriter(); + + Map requestMap = fc.getExternalContext().getRequestParameterMap(); + String strNodeRef = (String)requestMap.get("noderef"); + if (strNodeRef != null && strNodeRef.length() != 0) + { + try + { + Map props = new HashMap(2, 1.0f); + props.put(Version.PROP_DESCRIPTION, ""); + props.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + Repository.getServiceRegistry(fc).getCheckOutCheckInService().checkin(new NodeRef(strNodeRef), props); + out.write("OK: " + strNodeRef); + } + catch (Throwable err) + { + out.write("ERROR: " + err.getMessage()); + } + } + } +} \ No newline at end of file diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index a03cd5f097..f9fac1a143 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -3851,6 +3851,15 @@ request + + + Bean backing the ajax requests from various Portlet webscripts + + PortletActionsBean + org.alfresco.web.bean.ajax.PortletActionsBean + request + + Bean that returns manages the tree data for the navigator component diff --git a/source/web/css/office.css b/source/web/css/office.css index 51db5995c3..eca49b9b95 100644 --- a/source/web/css/office.css +++ b/source/web/css/office.css @@ -104,7 +104,7 @@ input.button { clear: both; font-weight: bold; float: left; - padding: 6px 0px 2px 4px; + padding: 6px 2px 2px 4px; height: 13px; width: 282px; overflow: hidden; diff --git a/source/web/images/icons/doclist_action_checkin.png b/source/web/images/icons/doclist_action_checkin.png new file mode 100644 index 0000000000..69efa49e32 Binary files /dev/null and b/source/web/images/icons/doclist_action_checkin.png differ diff --git a/source/web/images/icons/doclist_action_locked.png b/source/web/images/icons/doclist_action_locked.png new file mode 100644 index 0000000000..1f122bf904 Binary files /dev/null and b/source/web/images/icons/doclist_action_locked.png differ diff --git a/source/web/scripts/ajax/doclist.js b/source/web/scripts/ajax/doclist.js index 36a46f1486..9e968fd3bf 100644 --- a/source/web/scripts/ajax/doclist.js +++ b/source/web/scripts/ajax/doclist.js @@ -5,15 +5,56 @@ var MyDocs = { DETAIL_MARGIN: 56, TITLE_FONT_SIZE: 18, RESOURCE_PANEL_HEIGHT: 150, + ServiceContext: null, + Filter: null, + Home: null, + Query: null, start: function() { if ($('docPanel')) { - MyDocs.parseDocPanels(); - $('docPanel').setStyle('visibility', 'visible'); + // show AJAX loading overlay + $('docPanelOverlay').setStyle('visibility', 'visible'); + $('docPanel').setStyle('visibility', 'hidden'); + // fire off the ajax request to populate the doc list - the 'doclistpanel' webscript + // is responsible for rendering just the contents of the main panel div + YAHOO.util.Connect.asyncRequest( + "GET", + MyDocs.ServiceContext + '/doclistpanel?f='+MyDocs.Filter+'&h='+MyDocs.Home+'&q='+MyDocs.Query, + { + success: function(response) + { + // push the response into the doc panel div + $('docPanel').setHTML(response.responseText); + + // extract the count value from a hidden div and display it + $('docCount').setHTML($('docCountValue').innerHTML); + + // wire up all the events and animations + MyDocs.init(); + }, + failure: function(response) + { + // display the error + $('docPanel').setHTML("Sorry, data currently unavailable."); + + // hide the ajax wait panel and show the main doc panel + $('docPanelOverlay').setStyle('visibility', 'hidden'); + $('docPanel').setStyle('visibility', 'visible'); + } + } + ); } }, + + init: function() + { + MyDocs.parseDocPanels(); + // hide the ajax wait panel and show the main doc panel + $('docPanel').setStyle('visibility', 'visible'); + $('docPanelOverlay').setStyle('visibility', 'hidden'); + }, parseDocPanels: function() { @@ -404,6 +445,119 @@ var MyDocs = { fxInfo.start(animInfo); fxImage.start(animImage); }); + }, + + /** + * Update the view filter + */ + filter: function(filter) + { + $$('.docfilterLink').each(function(filterLink, i) + { + if (i == filter) + { + filterLink.addClass("docfilterLinkSelected"); + } + else + { + filterLink.removeClass("docfilterLinkSelected"); + } + }); + MyDocs.Filter = filter; + MyDocs.start(); + }, + + /** + * Delete a document item + */ + deleteItem: function(name, noderef) + { + if (confirm("Are you sure you want to delete: " + name)) + { + // ajax call to delete item + YAHOO.util.Connect.asyncRequest( + "POST", + getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem', + { + success: function(response) + { + if (response.responseText.indexOf("OK:") == 0) + { + MyDocs.start(); + } + else + { + alert("Error during delete of item: " + response.responseText); + } + }, + failure: function(response) + { + alert("Error during delete of item: " + response.responseText); + } + }, + "noderef=" + noderef + ); + } + }, + + /** + * Check Out a document item + */ + checkoutItem: function(name, noderef) + { + // ajax call to delete item + YAHOO.util.Connect.asyncRequest( + "POST", + getContextPath() + '/ajax/invoke/PortletActionsBean.checkoutItem', + { + success: function(response) + { + if (response.responseText.indexOf("OK:") == 0) + { + MyDocs.start(); + } + else + { + alert("Error during check out of item: " + response.responseText); + } + }, + failure: function(response) + { + alert("Error during check out of item: " + response.responseText); + } + }, + "noderef=" + noderef + ); + }, + + /** + * Check In a document item + */ + checkinItem: function(name, noderef) + { + // ajax call to delete item + YAHOO.util.Connect.asyncRequest( + "POST", + getContextPath() + '/ajax/invoke/PortletActionsBean.checkinItem', + { + success: function(response) + { + if (response.responseText.indexOf("OK:") == 0) + { + MyDocs.start(); + } + else + { + alert("Error during check in of item: " + response.responseText); + } + }, + failure: function(response) + { + alert("Error during check in of item: " + response.responseText); + } + }, + "noderef=" + noderef + ); } }; diff --git a/source/web/scripts/ajax/myspaces.js b/source/web/scripts/ajax/myspaces.js index e3629c1c10..86f5dfd827 100644 --- a/source/web/scripts/ajax/myspaces.js +++ b/source/web/scripts/ajax/myspaces.js @@ -17,6 +17,9 @@ var MySpaces = { { if ($('spacePanel')) { + // show AJAX loading overlay + $('spacePanelOverlay').setStyle('visibility', 'visible'); + $('spacePanel').setStyle('visibility', 'hidden'); // fire off the ajax request to populate the spaces list - the 'myspacespanel' webscript // is responsible for rendering just the contents of the main panel div YAHOO.util.Connect.asyncRequest( @@ -613,10 +616,10 @@ var MySpaces = { { if (confirm("Are you sure you want to delete: " + name)) { - // ajax call to create space + // ajax call to delete item YAHOO.util.Connect.asyncRequest( "POST", - getContextPath() + '/ajax/invoke/MySpacesBean.deleteItem', + getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem', { success: function(response) {