Office Addin - web scripts updated to support "Create new space"

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5988 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-06-15 17:05:36 +00:00
parent a557d4abf3
commit 2d878e8273
11 changed files with 409 additions and 124 deletions

View File

@@ -1,97 +1,158 @@
// Client has requested certain actions on the current document // Client has requested server-side action
/* Inputs */ /* Inputs */
var docId = args.d, var runAction = args.a;
runAction = args.a;
/* Outputs */ /* Outputs */
var resultString = "Action failed.", var resultString = "Action failed",
resultCode = false; resultCode = false;
var doc = search.findNode("workspace://SpacesStore/" + docId); // Is this action targetting a document?
var docId = args.d;
if ((docId != "") && (docId != null))
{
var doc = search.findNode("workspace://SpacesStore/" + docId);
if (doc != null && doc.isDocument) if (doc != null && doc.isDocument)
{
try
{
if (runAction == "makepdf")
{
resultString = "Could not convert document";
var nodeTrans = doc.transformDocument("application/pdf");
if (nodeTrans != null)
{
resultString = "Document converted";
resultCode = true;
}
}
else if (runAction == "delete")
{
resultString = "Could not delete document";
if (doc.remove())
{
resultString = "Document deleted";
resultCode = true;
}
}
else if (runAction == "checkout")
{
var workingCopy = doc.checkout();
if (workingCopy != null)
{
resultString = "Document checked out";
resultCode = true;
}
}
else if (runAction == "checkin")
{
var originalDoc = doc.checkin();
if (originalDoc != null)
{
resultString = "Document checked in";
resultCode = true;
}
}
else if (runAction == "makeversion")
{
resultString = "Could not version document";
if (doc.addAspect("cm:versionable"))
{
resultString = "Document versioned";
resultCode = true;
}
}
else if (runAction == "workflow")
{
var workflowType = "jbpm$wf:" + args.wt;
var assignTo = people.getPerson(args.at);
var dueDate = new Date(args.dd);
var description = args.desc;
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = workflowType;
workflow.parameters["bpm:workflowDescription"] = description;
workflow.parameters["bpm:assignee"] = assignTo;
if ((args.dd) && (args.dd != ""))
{
workflow.parameters["bpm:workflowDueDate"] = dueDate;
}
workflow.execute(doc);
resultString = "New workflow started";
resultCode = true;
}
else if (runAction == "test")
{
resultString = "Test complete.";
resultCode = true;
}
else
{
resultString = "Unknown action";
}
}
catch(e)
{
resultString = "Action failed due to exception";
}
}
}
else // Non document-based actions
{ {
try try
{ {
if (runAction == "makepdf") if (runAction == "newspace")
{ {
resultString = "Could not convert document"; resultString = "Could not create space";
var nodeTrans = doc.transformDocument("application/pdf"); var nodeId = args.n,
if (nodeTrans != null) spaceName = args.sn,
spaceTitle = (args.st == "undefined") ? "" : args.st,
spaceDescription = (args.sd == "undefined") ? "" : args.sd,
templateId = args.t;
var nodeNew;
if ((spaceName == null) || (spaceName == ""))
{ {
resultString = "Document converted"; resultString = "Space must have a Name";
resultCode = true;
} }
} else
else if (runAction == "delete")
{
resultString = "Could not delete document";
if (doc.remove())
{ {
resultString = "Document deleted"; var nodeParent = search.findNode("workspace://SpacesStore/" + nodeId);
resultCode = true; // Copy from template?
if ((templateId != null) && (templateId != ""))
{
nodeTemplate = search.findNode("workspace://SpacesStore/" + templateId);
nodeNew = nodeTemplate.copy(nodeParent, true);
nodeNew.name = spaceName;
}
else
{
nodeNew = nodeParent.createFolder(spaceName);
}
// Always add title & description, default icon
nodeNew.properties["cm:title"] = spaceTitle;
nodeNew.properties["cm:description"] = spaceDescription;
nodeNew.properties["app:icon"] = "space-icon-default";
nodeNew.save();
// Add uifacets aspect for the web client
nodeNew.addAspect("app:uifacets");
if (nodeNew != null)
{
resultString = "New space created";
resultCode = true;
}
} }
} }
else if (runAction == "checkout")
{
var workingCopy = doc.checkout();
if (workingCopy != null)
{
resultString = "Document checked out";
resultCode = true;
}
}
else if (runAction == "checkin")
{
var originalDoc = doc.checkin();
if (originalDoc != null)
{
resultString = "Document checked in";
resultCode = true;
}
}
else if (runAction == "makeversion")
{
resultString = "Could not version document";
if (doc.addAspect("cm:versionable"))
{
resultString = "Document versioned";
resultCode = true;
}
}
else if (runAction == "workflow")
{
var workflowType = "jbpm$wf:" + args.wt;
var assignTo = people.getPerson(args.at);
var dueDate = new Date(args.dd);
var description = args.desc;
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = workflowType;
workflow.parameters["bpm:workflowDescription"] = description;
workflow.parameters["bpm:assignee"] = assignTo;
if ((args.dd) && (args.dd != ""))
{
workflow.parameters["bpm:workflowDueDate"] = dueDate;
}
workflow.execute(doc);
resultString = "New workflow started.";
resultCode = true;
}
else if (runAction == "test")
{
resultString = "Test complete.";
resultCode = true;
}
else else
{ {
resultString = "Unknown action."; resultString = "Unknown action";
} }
} }
catch(e) catch(e)
{ {
resultString = "Action failed due to exception"; resultString = "Action failed due to exception";
resultString = e.toString();
} }
} }
model.resultString = resultString; model.resultString = resultString;

View File

@@ -43,10 +43,11 @@
<img src="${url.context}${d.icon32}" alt="${d.name}" /> <img src="${url.context}${d.icon32}" alt="${d.name}" />
</td> </td>
<td style="padding-top: 4px;"> <td style="padding-top: 4px;">
<span style="font-weight:bold; vertical-align: top;">${d.name} <span style="font-weight:bold; vertical-align: top;">
<#if d.isLocked > <#if d.isLocked >
<img src="${url.context}/images/office/lock.gif" alt="Locked" title="Locked" style="margin: -2px 0px;" /> <img src="${url.context}/images/office/lock.gif" alt="Locked" title="Locked" style="margin: -2px 0px;" />
</#if> </#if>
${d.name}
</span> </span>
<br /> <br />
<table style="margin-top: 4px;"> <table style="margin-top: 4px;">

View File

@@ -21,7 +21,6 @@
<script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script> <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/my_alfresco.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/my_alfresco.js"></script>
<script type="text/javascript" src="/firebug.js"></script>
</head> </head>
<body> <body>
@@ -38,7 +37,7 @@
<div class="header">My Checked Out Documents<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div> <div class="header">My Checked Out Documents<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div>
<div id="checkedoutList" class="containerMedium togglePanel"> <div id="checkedoutList" class="containerMedium togglePanel">
<table> <table width="265">
<#assign rowNum=0> <#assign rowNum=0>
<#assign query="@cm\\:workingCopyOwner:${person.properties.userName}"> <#assign query="@cm\\:workingCopyOwner:${person.properties.userName}">
<#list companyhome.childrenByLuceneSearch[query] as child> <#list companyhome.childrenByLuceneSearch[query] as child>
@@ -65,6 +64,11 @@
</tr> </tr>
</#if> </#if>
</#list> </#list>
<#if rowNum = 0>
<tr>
<td class="noItems">(No documents)</td>
</tr>
</#if>
</table> </table>
</div> </div>
@@ -101,14 +105,20 @@
</td> </td>
</tr> </tr>
</#list> </#list>
<#if taskNum = 0>
<tr>
<td class="noItems">(No tasks)</td>
</tr>
</#if>
</table> </table>
</div> </div>
<div class="header">Other Actions</div> <div class="header">Actions</div>
<div id="documentActions"> <div id="documentActions">
<div id="nonStatusText"> <div id="nonStatusText">
<ul> <ul>
<#if d.isDocument>
<li> <li>
<a title="Save to Alfresco" href="${url.serviceContext}/office/navigation?p=${path?url}"> <a title="Save to Alfresco" href="${url.serviceContext}/office/navigation?p=${path?url}">
<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" />
@@ -116,19 +126,13 @@
</a> </a>
<br />Allows you to place the current document under Alfresco management. <br />Allows you to place the current document under Alfresco management.
</li> </li>
</#if>
<li> <li>
<a title="Browse Alfresco" href="${url.serviceContext}/office/navigation?p=${path?url}"> <a title="Create Collaboration Space" href="${url.serviceContext}/office/navigation?p=${path?url}&amp;n=${d.id}&amp;cc=true">
<img src="${url.context}/images/office/navigator.gif" alt="Browse Alfresco" /> <img src="${url.context}/images/office/create_space.gif" alt="Create Collaboration Space" />
Browse Alfresco Create Collaboration Space
</a> </a>
<br />Navigate around the Alfresco repository for documents. <br />Create a new Collaboration Space in the Alfresco Repository
</li>
<li>
<a title="Search" href="${url.serviceContext}/office/search?p=${path?url}">
<img src="${url.context}/images/office/search.gif" alt="Search" />
Find Documents
</a>
<br />Search Alfresco for documents by name and content.
</li> </li>
<li> <li>
<a title="Launch Alfresco" href="${url.context}/navigate/browse?ticket=${session.ticket}" rel="_blank"> <a title="Launch Alfresco" href="${url.context}/navigate/browse?ticket=${session.ticket}" rel="_blank">

View File

@@ -71,7 +71,7 @@
</#list> </#list>
<#if taskNum = 0> <#if taskNum = 0>
<tr> <tr>
<td>(No tasks)</td> <td class="noItems">(No tasks)</td>
</tr> </tr>
</#if> </#if>
</table> </table>

View File

@@ -12,6 +12,7 @@
<script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script> <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/navigation.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/navigation.js"></script>
<script type="text/javascript" src="/firebug.js"></script>
</head> </head>
<body> <body>
@@ -53,63 +54,99 @@
<div class="header">Spaces in ${thisSpace.name}<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div> <div class="header">Spaces in ${thisSpace.name}<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div>
<div id="spaceList" class="containerMedium togglePanel"> <div id="spaceList" class="containerMedium togglePanel">
<table width="265"> <div id="createSpaceContainer">
<div id="createSpace" onclick="OfficeNavigation.showCreateSpace();">
<img src="${url.context}/images/office/create_space.gif" alt="Create new space" />
<span style="vertical-align: top;">Create New <#if args.cc?exists>Collaboration </#if>Space...</span>
</div>
<div id="createSpacePanel">
<div id="createSpaceParameters">
<div class="spaceParam">Name:</div>
<div class="spaceValue">
<input id="spaceName" type="text" value="" />
</div>
<div class="spaceParam">Title:</div>
<div class="spaceValue">
<input id="spacetitle" type="text" value="" />
</div>
<div class="spaceParam">Description:</div>
<div class="spaceValue">
<input id="spaceDescription" type="text" value="" />
</div>
<#assign xpath="app:dictionary/app:space_templates/*">
<#assign templates = companyhome.childrenByXPath[xpath]>
<#if (templates?size > 0)>
<div class="spaceParam">Template:</div>
<div class="spaceValue">
<select id="spaceTemplate" style="width: 172px;">
<option selected="selected" value="">(None)</option>
<#list templates as template>
<option value="${template.id}">${template.name}</option>
</#list>
</select>
</div>
</#if>
<div class="spaceParam">&nbsp;</div>
<div class="spaceValue">
<a class="spaceAction" href="#" onclick="OfficeNavigation.submitCreateSpace('${url.serviceContext}/office/docActions', '${thisSpace.id}');">
Submit
</a>
<a class="spaceAction" href="#" onclick="OfficeNavigation.hideCreateSpace();">
Cancel
</a>
</div>
</div>
</div>
</div>
<#assign spacesFound = 0> <#assign spacesFound = 0>
<#list thisSpace.children as child> <#list thisSpace.children as child>
<#if child.isContainer> <#if child.isContainer>
<#assign spacesFound = spacesFound + 1> <#assign spacesFound = spacesFound + 1>
<tr class="${(spacesFound % 2 = 0)?string("odd", "even")}"> <div class="spaceItem ${(spacesFound % 2 = 0)?string("even", "odd")}">
<td style="width: 32px;"> <span style="float: left; width: 36px;">
<a href="${url.serviceContext}/office/navigation?p=${path?url}&amp;n=${child.id}"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a> <a href="${url.serviceContext}/office/navigation?p=${path?url}&amp;n=${child.id}"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a>
</td> </span>
<td> <span>
<a href="${url.serviceContext}/office/navigation?p=${path?url}&amp;n=${child.id}" title="Open ${child.name}"> <a href="${url.serviceContext}/office/navigation?p=${path?url}&amp;n=${child.id}" title="Open ${child.name}">
<span class="bold">${child.name}</span> <span class="bold">${child.name}</span>
</a> </a>
<#if child.properties.description?exists> <#if child.properties.description?exists>
<br/>${child.properties.description} <br/>${child.properties.description}
</#if> </#if>
</td> </span>
</tr> </div>
</#if> </#if>
</#list> </#list>
<#if spacesFound = 0> <#if spacesFound = 0>
<tr> <div class="noItems">(No subspaces)</div>
<td>(No subspaces)</td>
</tr>
</#if> </#if>
</table>
</div> </div>
<div class="header">Documents in ${thisSpace.name}<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div> <div class="header">Documents in ${thisSpace.name}<span class="headerExtra"><span class="toggle">&nbsp;</span></span></div>
<div id="documentList" class="containerMedium togglePanel"> <div id="documentList" class="containerMedium togglePanel">
<table width="265">
<#assign documentsFound = 0> <#assign documentsFound = 0>
<#list thisSpace.children as child> <#list thisSpace.children as child>
<#if child.isDocument> <#if child.isDocument>
<#assign documentsFound = documentsFound + 1> <#assign documentsFound = documentsFound + 1>
<#assign webdavPath = (child.displayPath?substring(13) + '/' + child.name)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') /> <#assign webdavPath = (child.displayPath?substring(13) + '/' + child.name)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') />
<tr class="${(documentsFound % 2 = 0)?string("odd", "even")}"> <div class="documentItem ${(documentsFound % 2 = 0)?string("even", "odd")}">
<td valign="top" style="width: 32px;"> <span style="float: left; width: 36px;">
<#if child.name?ends_with(".doc")> <#if child.name?ends_with(".doc")>
<a href="#" onclick="window.external.openDocument('${webdavPath}')"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a> <a href="#" onclick="window.external.openDocument('${webdavPath}')"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a>
<#else> <#else>
<a href="${url.context}${child.url}?ticket=${session.ticket}" rel="_blank"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a> <a href="${url.context}${child.url}?ticket=${session.ticket}" rel="_blank"><img src="${url.context}${child.icon32}" alt="Open ${child.name}" /></a>
</#if> </#if>
</td> </span>
<td> <span>
<#if child.name?ends_with(".doc")> <#if child.name?ends_with(".doc")>
<a href="#" onclick="window.external.openDocument('${webdavPath}')" title="Open ${child.name}"> <a href="#" onclick="window.external.openDocument('${webdavPath}')"><span class="bold">${child.name}</span></a>
<span class="bold">${child.name}</span>
</a><br/>
<#else> <#else>
<a href="${url.context}${child.url}?ticket=${session.ticket}" rel="_blank" title="Open ${child.name}"> <a href="${url.context}${child.url}?ticket=${session.ticket}" rel="_blank"><span class="bold">${child.name}</span></a>
<span class="bold">${child.name}</span>
</a><br/>
</#if> </#if>
<br />
<#if child.properties.description?exists> <#if child.properties.description?exists>
${child.properties.description}<br/> ${child.properties.description}<br />
</#if> </#if>
Modified: ${child.properties.modified?datetime}, Size: ${(child.size / 1024)?int}Kb<br/> Modified: ${child.properties.modified?datetime}, Size: ${(child.size / 1024)?int}Kb<br/>
<#if child.isLocked > <#if child.isLocked >
@@ -123,25 +160,23 @@
<#if !child.isLocked > <#if !child.isLocked >
<a href="#" onclick="OfficeAddin.runAction('${doc_actions}','delete','${child.id}', 'Are you sure you want to delete this document?');"><img src="${url.context}/images/office/delete.gif" style="padding:3px 6px 2px 0px;" alt="Delete..." title="Delete" /></a> <a href="#" onclick="OfficeAddin.runAction('${doc_actions}','delete','${child.id}', 'Are you sure you want to delete this document?');"><img src="${url.context}/images/office/delete.gif" style="padding:3px 6px 2px 0px;" alt="Delete..." title="Delete" /></a>
</#if> </#if>
</td> </span>
</tr> </div>
</#if> </#if>
</#list> </#list>
<#if documentsFound = 0> <#if documentsFound = 0>
<tr> <div class="noItems">(No documents)</div>
<td>(No documents)</td>
</tr>
</#if> </#if>
</table>
</div> </div>
<div class="header">Document Actions</div> <div class="header">Actions</div>
<#assign currentPath = thisSpace.displayPath + '/' + thisSpace.name /> <#assign currentPath = thisSpace.displayPath + '/' + thisSpace.name />
<#assign webdavPath = currentPath?substring(13)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') /> <#assign webdavPath = currentPath?substring(13)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') />
<div id="documentActionsNavigation"> <div id="documentActionsNavigation">
<div id="nonStatusText"> <div id="nonStatusText">
<ul> <ul>
<#if node.isDocument>
<li> <li>
<a href="#" onclick="window.external.saveToAlfresco('${webdavPath}')"> <a href="#" onclick="window.external.saveToAlfresco('${webdavPath}')">
<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" />
@@ -149,7 +184,8 @@
</a> </a>
<br />Allows you to place the current document under Alfresco management. <br />Allows you to place the current document under Alfresco management.
</li> </li>
<#if args.search?exists> </#if>
<#if args.search?exists>
<li> <li>
<a href="${url.serviceContext}/office/search?p=${path?url}&amp;searchagain=${args.search?url}&amp;maxresults=${args.maxresults}"> <a href="${url.serviceContext}/office/search?p=${path?url}&amp;searchagain=${args.search?url}&amp;maxresults=${args.maxresults}">
<img src="${url.context}/images/office/search_again.gif" alt="Back to results" /> <img src="${url.context}/images/office/search_again.gif" alt="Back to results" />
@@ -157,7 +193,7 @@
</a> </a>
<br />Return to the search tab. <br />Return to the search tab.
</li> </li>
</#if> </#if>
</ul> </ul>
</div> </div>

View File

@@ -48,6 +48,7 @@ input.button {
.bold { .bold {
font-weight: bold; font-weight: bold;
overflow-x: hidden;
} }
#tabBar { #tabBar {
@@ -186,6 +187,14 @@ input.button {
.even { .even {
background-color: #ffffff !important; background-color: #ffffff !important;
} }
.new {
background-color: #ffffcc !important;
cursor: pointer;
}
.noItems {
text-align: center;
padding-top: 20px;
}
#currentSpaceInfo { #currentSpaceInfo {
background: #fff; background: #fff;
@@ -199,6 +208,77 @@ input.button {
padding: 2px 0px 2px 2px; padding: 2px 0px 2px 2px;
} }
#createSpaceContainer {
border-bottom: 1px dashed #ccc;
overflow: hidden;
padding: 2px 2px 0px;
width: 261px;
}
#createSpace {
cursor: pointer;
}
#createSpacePanel {
display: none;
overflow: hidden;
}
#createSpaceParameters {
background-color: #ffffcc;
border: 1px solid #ccc;
margin: 2px;
padding: 2px 0px 4px 0px;
overflow: hidden;
}
.spaceParam {
clear: both;
float: left;
padding: 4px 4px 0px 0px;
text-align: right;
width: 64px;
}
.spaceValue {
float: left;
padding: 2px 0px 0px 0px;
width: 180px;
}
.spaceValue select, .spaceValue input, .spaceValue textarea {
font-family: tahoma, sans-serif;
font-size: 8pt;
margin: 0px 1px 1px 1px;
padding: 0px 0px 0px 0px;
width: 168px;
}
.spaceAction {
background-color: #cce6ff;
border: 1px solid #0073e6;
color: #0073e6;
float: left;
font-size: 11px;
font-weight: bold;
cursor: pointer;
margin: 0px 4px 0px 2px;
padding: 4px;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#ffffff', EndColorStr='#cce6ff');
}
.spaceItem {
border-bottom: 1px solid #eee;
padding: 2px 0px 6px 0px;
height: 26px;
width: 265px;
}
.documentItem {
border-bottom: 1px solid #eee;
padding: 2px 0px 6px 0px;
width: 265px;
}
#documentActions { #documentActions {
clear: both; clear: both;
background-color: #ffffcc; background-color: #ffffcc;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -46,7 +46,7 @@ var OfficeMyAlfresco =
// register 'click' event for each task // register 'click' event for each task
task.addEvent('click', function(e) task.addEvent('click', function(e)
{ {
window.location.href = window.serviceContextPath + "/office/myTasks?p=" + window.queryObject.p + "&t=" + task.id.replace(/\./, "$"); window.location.href = window.serviceContextPath + "/office/myTasks?p=" + window.queryObject.p + "&t=" + task.id;
}); });
}); });

View File

@@ -179,10 +179,8 @@ var OfficeMyTasks =
myAjax.request(); myAjax.request();
}, },
startWorkflow: function(useTemplate, Doc) startWorkflow: function(commandURL, Doc)
{ {
// OfficeAddin.runAction('${doc_actions}','makepdf','${d.id}', '');"
var wrkType=$('wrkType').value; var wrkType=$('wrkType').value;
// wrkAssignTo should be "First Last (Username)" // wrkAssignTo should be "First Last (Username)"
var wrkAssignTo=$('wrkAssignTo').value; var wrkAssignTo=$('wrkAssignTo').value;
@@ -195,7 +193,7 @@ var OfficeMyTasks =
var wrkDescription=$('wrkDescription').value; var wrkDescription=$('wrkDescription').value;
OfficeAddin.showStatusText("Starting workflow...", "ajax_anim.gif", false); OfficeAddin.showStatusText("Starting workflow...", "ajax_anim.gif", false);
var actionURL = useTemplate + "?a=workflow&d=" + Doc; var actionURL = commandURL + "?a=workflow&d=" + Doc;
actionURL += "&wt=" + wrkType; actionURL += "&wt=" + wrkType;
actionURL += "&at=" + wrkAssignTo; actionURL += "&at=" + wrkAssignTo;
// Date supplied? // Date supplied?

View File

@@ -6,10 +6,20 @@ var OfficeNavigation =
{ {
TOGGLE_AMOUNT: 150, TOGGLE_AMOUNT: 150,
ANIM_LENGTH: 800, ANIM_LENGTH: 800,
CREATE_SPACE_HEIGHT: 108,
CREATE_SPACE_TEMPLATE: 16,
init: function() init: function()
{ {
OfficeNavigation.setupToggles(); OfficeNavigation.setupToggles();
OfficeNavigation.setupCreateSpace();
// Did we arrive here from the "Create collaboration space" shortcut?
if (window.queryObject.cc)
{
OfficeNavigation.showCreateSpace();
}
}, },
setupToggles: function() setupToggles: function()
@@ -83,6 +93,101 @@ var OfficeNavigation =
fxPanel.start(animPanel); fxPanel.start(animPanel);
}); });
}); });
},
setupCreateSpace: function()
{
var panel = $('createSpacePanel');
panel.defaultHeight = 0;
panel.setStyle('display', 'block');
panel.setStyle('height', panel.defaultHeight);
},
showCreateSpace: function()
{
var panel = $('createSpacePanel');
// Animation
var fxPanel = new Fx.Style(panel, 'height',
{
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.Back.easeOut,
onComplete: function()
{
$('spaceName').focus();
}
});
if (!panel.isOpen)
{
panel.isOpen = true;
var openHeight = OfficeNavigation.CREATE_SPACE_HEIGHT;
if ($('spaceTemplate'))
{
openHeight += OfficeNavigation.CREATE_SPACE_TEMPLATE;
}
fxPanel.start(panel.getStyle('height').toInt(), openHeight);
}
else
{
OfficeNavigation.hideCreateSpace();
}
},
hideCreateSpace: function()
{
var panel = $('createSpacePanel');
// Animation
var fxPanel = new Fx.Style(panel, 'height',
{
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.Back.easeIn,
onComplete: function()
{
panel.isOpen = false;
}
});
fxPanel.start(panel.getStyle('height').toInt(), panel.defaultHeight);
},
submitCreateSpace: function(commandURL, nodeId)
{
var spcName = $('spaceName').value,
spcTitle = $('spaceTitle').value,
spcDescription = $('spaceDescription').value;
var spcTemplate;
if ($('spaceTemplate'))
{
spcTemplate = $('spaceTemplate').value;
}
OfficeAddin.showStatusText("Creating space...", "ajax_anim.gif", false);
var actionURL = commandURL + "?a=newspace&n=" + nodeId;
actionURL += "&sn=" + encodeURI(spcName);
actionURL += "&st=" + encodeURI(spcTitle);
actionURL += "&sd=" + encodeURI(spcDescription);
actionURL += "&t=" + encodeURI(spcTemplate);
var myAjax = new Ajax(actionURL, {
method: 'get',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
onComplete: function(textResponse, xmlResponse)
{
// Remove any trailing hash
var href = window.location.href.replace("#", "")
// Remove any previous "&st=" strings
href = href.replace(/[?&]st=([^&$]+)/g, "");
// Remove any previous "&cc=" strings
href = href.replace(/[?&]cc=([^&$]+)/g, "");
// Optionally add a status string
if (textResponse != "")
{
href += "&st=" + encodeURI(textResponse);
}
window.location.href = href;
}
});
myAjax.request();
} }
}; };