From e7eb98194cc37f9db80eea2cd94a76bf5c48e3b2 Mon Sep 17 00:00:00 2001 From: Mike Hatfield Date: Wed, 20 Jun 2007 21:23:51 +0000 Subject: [PATCH] Doclist Webscript - main document list now separate ajax panel. New PortletActionsBean to perform server-side actions from portlets. DeleteItem moved out of MySpacesBean into PortletActionsBean. TemplateNode addition of downloadUrl method for non-inline document downloads. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6044 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../client/doclist_preview_panel.ftl | 15 +- .../alfresco/portlets/doclist.get.html.ftl | 98 +++++------ .../portlets/doclistpanel.get.desc.xml | 7 + .../portlets/doclistpanel.get.html.ftl | 53 ++++++ .../alfresco/portlets/myspaces.get.html.ftl | 3 +- .../alfresco/web/bean/ajax/MySpacesBean.java | 22 --- .../web/bean/ajax/PortletActionsBean.java | 131 +++++++++++++++ source/web/WEB-INF/faces-config-beans.xml | 9 + source/web/css/office.css | 2 +- .../images/icons/doclist_action_checkin.png | Bin 0 -> 1538 bytes .../images/icons/doclist_action_locked.png | Bin 0 -> 1551 bytes source/web/scripts/ajax/doclist.js | 158 +++++++++++++++++- source/web/scripts/ajax/myspaces.js | 7 +- 13 files changed, 418 insertions(+), 87 deletions(-) create mode 100644 config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.desc.xml create mode 100644 config/alfresco/templates/webscripts/org/alfresco/portlets/doclistpanel.get.html.ftl create mode 100644 source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java create mode 100644 source/web/images/icons/doclist_action_checkin.png create mode 100644 source/web/images/icons/doclist_action_locked.png 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 0000000000000000000000000000000000000000..69efa49e32f67624eb5c8ffaf9157ce33d786d6b GIT binary patch literal 1538 zcmeHF>r>JR6#c2$mX6IXHlw9kV~(r4Zd%i>W{(Y%%GO*n%g0g{ZtD6#O}DIE*Kn$_ zL@Ud%P*4#R#K%GoK|aDw%oG$56d$~N3!#Y0o2CC?KkkP;Gv}PSGxx)tb8c~D#3?6- zoels1IE9@Kjk5Zl&)i~X)ll5SUI4HIBEzF0*3n|IDArbfCgek#@BjAtanZZF$9?1~ zb~|yT`@M{R9Ge+Zb3KbzeuGg-o9O4xPl{D@TBCj+>QV^{-z(>NJ&*9Nh>RrWC^V|@ z#`H>d)1GH1^E%6RJUO=KS?J!1Q(wOb3&C9tZ%py52-#Z!`2ll22z%jBO$@mH5(Izc zC*rl(mTVNO9zQ~%j(0hi9rUaK`@af5jJ1nxK zE|bZmQmI5D5sSrBQ&W?ZlM@pY@bK`^ z&=7~iVYAtTgM$MD1O5H|A3l6wu~}YPNh;Q6iQoL zTWf18nM`hKY9f(HL?W@Vv9Y0{fj}VO@%Z}sdK?Z{S65eCTU%38gT-Po7)*6_byZar z8jUV3Ew#33?eu^A%LGy=Pf6BQbZ%6{d24k4RRCSd32xRqw`QG=%K-pK&}Z6kCku=K zU<-tWf}?|wNS-c%o8`{RW>5{CD&Cooeo46r6^g=)fa8yxZnWJEIe`l}JW#hC8BLdC zlm;C_6GPI;0s+meZAeU z>Qd5S2VNiP8}{1a@WcygyUjjPK&AP);(S5K+R81DY^7({XYLH|-tPJm@3ZrA_w`{^ z!1wx8ytf_!LxHyz?fL`Uz!A9pm=tyS3WS+g%0j08o}2HhvhVS811H9@w}DJ{WhCTN zmy#^^kD`*J#fW6&UoO#k)u;Lm#$q?h1U)3Jjnsq>b zEKlSVyzUO363{IJ7i7zqWnZC-lFwk2*bbB6&144o7a{o)<(6=Pp>>D0qp=Lqtp&xq z@A?9jjuQ{k&e^`e1cO~}d(fPNvW>A4PoLS6CLefV;J)HK5ceSZTVlNCi%cHK!>6@2 zHD3D2AJs=I-%py4foc~Wy|3NGcE=_5?GE>4AHPeve@Hv%5}x)=^=5~3RFawDpGUBG z_`rArx}x`SZ{suI@B;G*lbp$vMac;>_6YcM%gg$}81tNIqrm1%*jp6T+-v{&=ffZo Kq0J#z5dQ#^5dHK3 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..1f122bf904a1117a08e959860099003f4cba4e0c GIT binary patch literal 1551 zcmds$`!^E`0LRDGP40EOx06meDZR9$r(7xJ5!E_!6%{JQHM&K~BPy>bil)5t8fG4w z&2!i#_Ogv_Hrv?PY;0z1%xfNN#C3nT|HS>C^ZkC#_xJDjgPZFWLjz+2003YJy6SXu zgQovl|A&oqf~Qb6uq)izGu-`IKzO8YC>Y@2|I80;3JUfO1m6Vv`oDbM4YmaUbfeu| zJe)Zk&dA7!TCJX&o0CeVGMQ|2bX23!NFhkjPw{PF(=jSIT zCMG8*$HvAM7Z-!0|NsL2BWX9Z)j*JHxpM? zRdu(9X_-&ta=H0AcsLv`5D3_8HU@)fZf-Wu#?fdrBofJDvCc!u?d|P@gM-Dz#ny!+ zCX>nI@v5t<%gf7olWG!)R99E$Q_HHTs3&B6QC_o8{@Yiny=6wxIZwY9Ys zi^T?FI9&GVo}XgU($d_cFxm8xxVYw+XpBQCrLC<^CY$Y&O{djx(viJOOIj!tdILdE zB@g*Guyg1m_4V~cf)IzpMSbOi8`-IpA^Q@F8-h+C5D*9iyo`1_kJzuAPkx65X5m~a zXk{E3dt#1ECi~U1AHQx1`@8>37A`xzBNWMWETv8?Xik11w2G8(2!ix(F_lV1@#GDI z6P1;fB#Fu!&4d<^eCk+owdNVN4+80^MfKdS?r}#lBHDO%C6qs^Xz7rzrLN39jjd zb7Zl&K?;QeV~@6f9lTyid)m?$(=lL?gHNN1&`1VucnXiludlBc+r-}37;9hnO;`7g z`hOE3F+SnK#?L??CkKxxK^C_^Qs4%lKJOxD0=8t>0~=tZrgCx9{Wh)gT;zYsjeBHm z`;q>FDO=I56c((69MG)g>aFYfJMP=FcuVigd;Ehj;FgO`tGXeUil8T983EZIN34C7 z%;U~x@3$RPgl8Pod9x$I)cq#|59-$Qi4L1e3Iom(UZ2p<|(kP~)?`o+PA^i$U)J5O^MOYtbkp#InONJUc*d>}8u9{_nsw3{dN+!t7PBE^9?J7yxdy-*P90973t)72mdZ)-nq-O>p1_4 z(<2fd^=dKWY}Sc56WlZ{j9OF8i_fzPyniu?c+&Z^K|t8@*G2UMrv8V~W3&TgCr0CIM9s&Ran@DCA#(;@%> literal 0 HcmV?d00001 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) {