diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js index 3ca0d1e519..9cd350e70d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js @@ -1,97 +1,158 @@ -// Client has requested certain actions on the current document +// Client has requested server-side action /* Inputs */ -var docId = args.d, - runAction = args.a; +var runAction = args.a; /* Outputs */ -var resultString = "Action failed.", +var resultString = "Action failed", 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 { - if (runAction == "makepdf") + if (runAction == "newspace") { - resultString = "Could not convert document"; - var nodeTrans = doc.transformDocument("application/pdf"); - if (nodeTrans != null) + resultString = "Could not create space"; + var nodeId = args.n, + 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"; - resultCode = true; + resultString = "Space must have a Name"; } - } - else if (runAction == "delete") - { - resultString = "Could not delete document"; - if (doc.remove()) + else { - resultString = "Document deleted"; - resultCode = true; + var nodeParent = search.findNode("workspace://SpacesStore/" + nodeId); + // 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 { - resultString = "Unknown action."; + resultString = "Unknown action"; } } catch(e) { resultString = "Action failed due to exception"; + resultString = e.toString(); } } model.resultString = resultString; diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl index b4d7ea7996..37fb61a5c0 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl @@ -43,10 +43,11 @@ ${d.name} - ${d.name} + <#if d.isLocked > Locked + ${d.name}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl index 9271ab13ef..3200e211f8 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl @@ -21,7 +21,6 @@ - @@ -38,7 +37,7 @@
My Checked Out Documents 
-
+
<#assign rowNum=0> <#assign query="@cm\\:workingCopyOwner:${person.properties.userName}"> <#list companyhome.childrenByLuceneSearch[query] as child> @@ -65,6 +64,11 @@ + <#if rowNum = 0> + + + +
(No documents)
@@ -101,14 +105,20 @@ +<#if taskNum = 0> + + (No tasks) + + -
Other Actions
+
Actions
    +<#if d.isDocument>
  • Save to Alfresco @@ -116,19 +126,13 @@
    Allows you to place the current document under Alfresco management.
  • +
  • - - Browse Alfresco - Browse Alfresco + + Create Collaboration Space + Create Collaboration Space -
    Navigate around the Alfresco repository for documents. -
  • -
  • - - Search - Find Documents - -
    Search Alfresco for documents by name and content. +
    Create a new Collaboration Space in the Alfresco Repository
  • diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl index df11247085..949aff325e 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl @@ -71,7 +71,7 @@ <#if taskNum = 0> - (No tasks) + (No tasks) diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl index b2d78c6d32..5d54f9f892 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl @@ -12,6 +12,7 @@ + @@ -53,63 +54,99 @@
    Spaces in ${thisSpace.name} 
    - +
    +
    + Create new space + Create New <#if args.cc?exists>Collaboration Space... +
    +
    +
    +
    Name:
    +
    + +
    +
    Title:
    +
    + +
    +
    Description:
    +
    + +
    +<#assign xpath="app:dictionary/app:space_templates/*"> +<#assign templates = companyhome.childrenByXPath[xpath]> +<#if (templates?size > 0)> +
    Template:
    +
    + +
    + +
     
    + +
    +
    +
    <#assign spacesFound = 0> <#list thisSpace.children as child> <#if child.isContainer> <#assign spacesFound = spacesFound + 1> - - - - + + <#if spacesFound = 0> - - - +
    (No subspaces)
    -
    +
    + Open ${child.name} -
    + + ${child.name} <#if child.properties.description?exists>
    ${child.properties.description} -
    (No subspaces)
    Documents in ${thisSpace.name} 
    - <#assign documentsFound = 0> <#list thisSpace.children as child> <#if child.isDocument> <#assign documentsFound = documentsFound + 1> <#assign webdavPath = (child.displayPath?substring(13) + '/' + child.name)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') /> - - - - + + <#if documentsFound = 0> - - - +
    (No documents)
    -
    +
    + <#if child.name?ends_with(".doc")> Open ${child.name} <#else> Open ${child.name} -
    + + <#if child.name?ends_with(".doc")> - - ${child.name} -
    + ${child.name} <#else> - - ${child.name} -
    + ${child.name} +
    <#if child.properties.description?exists> - ${child.properties.description}
    + ${child.properties.description}
    Modified: ${child.properties.modified?datetime}, Size: ${(child.size / 1024)?int}Kb
    <#if child.isLocked > @@ -123,25 +160,23 @@ <#if !child.isLocked > Delete... -
    (No documents)
    -
    Document Actions
    +
    Actions
    <#assign currentPath = thisSpace.displayPath + '/' + thisSpace.name /> <#assign webdavPath = currentPath?substring(13)?url('ISO-8859-1')?replace('%2F', '/')?replace('\'', '\\\'') />
      +<#if node.isDocument>
    • Save to Alfresco @@ -149,7 +184,8 @@
      Allows you to place the current document under Alfresco management.
    • - <#if args.search?exists> + +<#if args.search?exists>
    • Back to results @@ -157,7 +193,7 @@
      Return to the search tab.
    • - +
    diff --git a/source/web/css/office.css b/source/web/css/office.css index c7c9b511ec..bc49d650a0 100644 --- a/source/web/css/office.css +++ b/source/web/css/office.css @@ -48,6 +48,7 @@ input.button { .bold { font-weight: bold; + overflow-x: hidden; } #tabBar { @@ -186,6 +187,14 @@ input.button { .even { background-color: #ffffff !important; } +.new { + background-color: #ffffcc !important; + cursor: pointer; +} +.noItems { + text-align: center; + padding-top: 20px; +} #currentSpaceInfo { background: #fff; @@ -199,6 +208,77 @@ input.button { 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 { clear: both; background-color: #ffffcc; diff --git a/source/web/images/office/create_space.gif b/source/web/images/office/create_space.gif new file mode 100644 index 0000000000..acb4beac34 Binary files /dev/null and b/source/web/images/office/create_space.gif differ diff --git a/source/web/images/office/create_space_large.gif b/source/web/images/office/create_space_large.gif new file mode 100644 index 0000000000..60dfc1d99a Binary files /dev/null and b/source/web/images/office/create_space_large.gif differ diff --git a/source/web/scripts/office/my_alfresco.js b/source/web/scripts/office/my_alfresco.js index 6738861a30..62bc8175b3 100644 --- a/source/web/scripts/office/my_alfresco.js +++ b/source/web/scripts/office/my_alfresco.js @@ -46,7 +46,7 @@ var OfficeMyAlfresco = // register 'click' event for each task 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; }); }); diff --git a/source/web/scripts/office/my_tasks.js b/source/web/scripts/office/my_tasks.js index 095b3c410b..2ebef4bc47 100644 --- a/source/web/scripts/office/my_tasks.js +++ b/source/web/scripts/office/my_tasks.js @@ -179,10 +179,8 @@ var OfficeMyTasks = myAjax.request(); }, - startWorkflow: function(useTemplate, Doc) + startWorkflow: function(commandURL, Doc) { -// OfficeAddin.runAction('${doc_actions}','makepdf','${d.id}', '');" - var wrkType=$('wrkType').value; // wrkAssignTo should be "First Last (Username)" var wrkAssignTo=$('wrkAssignTo').value; @@ -195,7 +193,7 @@ var OfficeMyTasks = var wrkDescription=$('wrkDescription').value; 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 += "&at=" + wrkAssignTo; // Date supplied? diff --git a/source/web/scripts/office/navigation.js b/source/web/scripts/office/navigation.js index 5f0911ae3e..21620eabd3 100644 --- a/source/web/scripts/office/navigation.js +++ b/source/web/scripts/office/navigation.js @@ -6,10 +6,20 @@ var OfficeNavigation = { TOGGLE_AMOUNT: 150, ANIM_LENGTH: 800, + CREATE_SPACE_HEIGHT: 108, + CREATE_SPACE_TEMPLATE: 16, init: function() { OfficeNavigation.setupToggles(); + OfficeNavigation.setupCreateSpace(); + + // Did we arrive here from the "Create collaboration space" shortcut? + if (window.queryObject.cc) + { + OfficeNavigation.showCreateSpace(); + } + }, setupToggles: function() @@ -83,6 +93,101 @@ var OfficeNavigation = 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(); } };