Fix to "save to alfresco" link not appearing. Better handling of invalid nodeRefs.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7763 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2008-01-07 15:11:26 +00:00
parent 139726aeaa
commit 9bd769e023
2 changed files with 19 additions and 14 deletions

View File

@@ -200,7 +200,6 @@
</div> </div>
<div id="nonStatusText"> <div id="nonStatusText">
<ul> <ul>
<#if (path?length != 0)>
<li> <li>
<a href="#" onclick="OfficeNavigation.saveToAlfresco('${currentPath}')"> <a href="#" onclick="OfficeNavigation.saveToAlfresco('${currentPath}')">
<img src="${url.context}/images/office/save_to_alfresco.gif" alt="Save to Alfresco" /> <img src="${url.context}/images/office/save_to_alfresco.gif" alt="Save to Alfresco" />
@@ -208,7 +207,6 @@
</a> </a>
<br />Save the document to the current Space. <br />Save the document to the current Space.
</li> </li>
</#if>
<#if args.search?exists> <#if args.search?exists>
<li> <li>
<a href="${url.serviceContext}/office/search${defaultQuery?html}&amp;searchagain=${args.search?url}&amp;maxresults=${args.maxresults}"> <a href="${url.serviceContext}/office/search${defaultQuery?html}&amp;searchagain=${args.search?url}&amp;maxresults=${args.maxresults}">

View File

@@ -3,27 +3,34 @@ if ((args.n) && (args.n != ""))
{ {
model.node = search.findNode("workspace://SpacesStore/" + args.n); model.node = search.findNode("workspace://SpacesStore/" + args.n);
} }
else if ((args.p) && (args.p != ""))
// Check here in case invalid nodeRef passed-in
if (model.node == null)
{ {
var path = args.p; if ((args.p) && (args.p != ""))
if (path == "/" + companyhome.name)
{ {
model.node = companyhome; var path = args.p;
} if (path == "/" + companyhome.name)
else
{
var node = companyhome.childByNamePath(path.substring(companyhome.name.length));
if (node != null)
{ {
model.node = node; model.node = companyhome;
} }
else else
{ {
model.node = userhome; var node = companyhome.childByNamePath(path.substring(companyhome.name.length));
if (node != null)
{
model.node = node;
}
else
{
model.node = userhome;
}
} }
} }
} }
else
// Last chance - default to userhome
if (model.node == null)
{ {
model.node = userhome; model.node = userhome;
} }