mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Improves and fixes to Create Space in MySpaces webscript portlet.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5778 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -59,19 +59,19 @@
|
||||
<div class="spaceAction spaceActionUpload" title="Upload a new document" onclick="MySpaces.upload(this);">Upload</div>
|
||||
<div class="spaceUploadPanel">
|
||||
<#-- Url encode the path value, and encode any single quotes to generate valid string -->
|
||||
<input style="margin:4px" type="submit" value="OK" onclick='MySpaces.uploadOK(this, "${path?url?replace("'","_%_")}");'>
|
||||
<input style="margin:4px" type="button" value="Cancel" onclick="MySpaces.closePanel(this);">
|
||||
<input class="spaceFormItem" type="submit" value="OK" onclick='MySpaces.uploadOK(this, "${path?url?replace("'","_%_")}");'>
|
||||
<input class="spaceFormItem" type="button" value="Cancel" onclick="MySpaces.closePopupPanel();">
|
||||
</div>
|
||||
<#-- Create Space action -->
|
||||
<div class="spaceAction spaceActionCreateSpace" title="Create a new Space" onclick="MySpaces.createSpace(this);">Create Space</div>
|
||||
<div class="spaceCreateSpacePanel">
|
||||
<table cellspacing="2" cellpadding="2" border="0">
|
||||
<tr><td>Name:</td><td><input style="margin:4px" type="text" size="32" maxlength="1024" id="space-name"></td></tr>
|
||||
<tr><td>Title:</td><td><input style="margin:4px" type="text" size="32" maxlength="1024" id="space-title"></td></tr>
|
||||
<tr><td>Description:</td><td><input style="margin:4px" type="text" size="32" maxlength="1024" id="space-description"></td></tr>
|
||||
<tr><td class="spaceFormLabel">Name:</td><td><input class="spaceFormItem" type="text" size="32" maxlength="1024" id="space-name"></td></tr>
|
||||
<tr><td class="spaceFormLabel">Title:</td><td><input class="spaceFormItem" type="text" size="32" maxlength="1024" id="space-title"></td></tr>
|
||||
<tr><td class="spaceFormLabel">Description:</td><td><input class="spaceFormItem" type="text" size="32" maxlength="1024" id="space-description"></td></tr>
|
||||
</table>
|
||||
<input style="margin:4px" type="button" value="OK" onclick='MySpaces.createSpaceOK(this, "${path?url?replace("'","_%_")}");'>
|
||||
<input style="margin:4px" type="button" value="Cancel" onclick="MySpaces.closePanel(this);">
|
||||
<input class="spaceFormItem" type="button" value="OK" onclick='MySpaces.createSpaceOK(this, "${path?url?replace("'","_%_")}");'>
|
||||
<input class="spaceFormItem" type="button" value="Cancel" onclick="MySpaces.closePopupPanel();">
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
@@ -248,6 +248,21 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.spaceFormLabel
|
||||
{
|
||||
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
color: #515D6B;
|
||||
}
|
||||
|
||||
.spaceFormItem
|
||||
{
|
||||
margin: 4px;
|
||||
padding: 2px;
|
||||
background-color: #F8FCFD;
|
||||
border: 1px solid #CCD4DB;
|
||||
}
|
||||
|
||||
.spaceActions
|
||||
{
|
||||
background-color: #EEF7FB;
|
||||
@@ -287,7 +302,7 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
|
||||
border: 1px solid #CCD4DB;
|
||||
background-color: #EEF7FB;
|
||||
width: 24em;
|
||||
height: 4em;
|
||||
height: 5em;
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
display: none;
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.ajax;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -31,15 +33,18 @@ 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.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.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;
|
||||
|
||||
@@ -80,6 +85,14 @@ public class MySpacesBean
|
||||
FileInfo folderInfo = ffService.create(containerRef, name, ContentModel.TYPE_FOLDER);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created new folder: " + folderInfo.getNodeRef().toString());
|
||||
|
||||
// apply the uifacets aspect - icon, title and description properties
|
||||
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME);
|
||||
uiFacetsProps.put(ContentModel.PROP_TITLE, title);
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, description);
|
||||
nodeService.addAspect(folderInfo.getNodeRef(), ApplicationModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
out.write("OK: " + folderInfo.getNodeRef().toString());
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ var MySpaces = {
|
||||
Path: null,
|
||||
Filter: null,
|
||||
Home: null,
|
||||
popupPanel: null,
|
||||
|
||||
start: function()
|
||||
{
|
||||
@@ -246,12 +247,26 @@ var MySpaces = {
|
||||
*/
|
||||
createSpace: function(actionEl)
|
||||
{
|
||||
if (this.popupPanel != null) return;
|
||||
|
||||
var panel = $E(".spaceCreateSpacePanel", $(actionEl).getParent());
|
||||
panel.setStyle("opacity", 0);
|
||||
panel.setStyle("display", "inline");
|
||||
panel.getElementById("space-name").focus();
|
||||
var anim = new Fx.Styles(panel, {duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
var anim = new Fx.Styles(
|
||||
panel,
|
||||
{
|
||||
duration: MySpaces.ANIM_LENGTH,
|
||||
transition: Fx.Transitions.linear,
|
||||
onComplete: function()
|
||||
{
|
||||
var nameInput = this.element.getElementById("space-name");
|
||||
nameInput.focus();
|
||||
nameInput.select();
|
||||
}
|
||||
});
|
||||
anim.start({'opacity': 1});
|
||||
|
||||
this.popupPanel = panel;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -282,12 +297,12 @@ var MySpaces = {
|
||||
{
|
||||
alert("Error during creation of new space: " + response.responseText);
|
||||
}
|
||||
MySpaces.closePanel(actionEl);
|
||||
MySpaces.closePopupPanel();
|
||||
},
|
||||
failure: function(response)
|
||||
{
|
||||
alert("Error during creation of new space: " + response.responseText);
|
||||
MySpaces.closePanel(actionEl);
|
||||
MySpaces.closePopupPanel();
|
||||
}
|
||||
},
|
||||
"path=" + path.replace("_%_", "'") +
|
||||
@@ -301,10 +316,13 @@ var MySpaces = {
|
||||
/**
|
||||
* Cancel button click handler for various pop-up panels
|
||||
*/
|
||||
closePanel: function(actionEl)
|
||||
closePopupPanel: function()
|
||||
{
|
||||
var panel = $(actionEl).getParent();
|
||||
panel.setStyle("display", "none");
|
||||
if (this.popupPanel != null)
|
||||
{
|
||||
this.popupPanel.setStyle("display", "none");
|
||||
this.popupPanel = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -312,6 +330,8 @@ var MySpaces = {
|
||||
*/
|
||||
upload: function(actionEl)
|
||||
{
|
||||
if (this.popupPanel != null) return;
|
||||
|
||||
var panel = $E(".spaceUploadPanel", $(actionEl).getParent());
|
||||
panel.setStyle("opacity", 0);
|
||||
panel.setStyle("display", "inline");
|
||||
@@ -328,12 +348,15 @@ var MySpaces = {
|
||||
fileInput.name = "_upload";
|
||||
fileInput.size = "35";
|
||||
fileInput.setStyle("width", "100%");
|
||||
fileInput.addClass("spaceFormItem");
|
||||
fileInput.injectTop(panel);
|
||||
this.fileInput = fileInput;
|
||||
}
|
||||
|
||||
var anim = new Fx.Styles(panel, {duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
anim.start({'opacity': 1});
|
||||
|
||||
this.popupPanel = panel;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -349,7 +372,7 @@ var MySpaces = {
|
||||
"/ajax/invoke/FileUploadBean.uploadFile",
|
||||
{currentPath: path.replace("_%_", "'")}); // decode path
|
||||
this.fileInput = null;
|
||||
this.closePanel(actionEl);
|
||||
this.closePopupPanel();
|
||||
},
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user