mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.1 to HEAD
6374: AR-1639 Web Script Content Upload Patch merge: Schema target 71 changed to 101 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6404 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
79
config/alfresco/bootstrap/webScripts2.xml
Normal file
79
config/alfresco/bootstrap/webScripts2.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0">
|
||||
<view:reference xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:wf="http://www.alfresco.org/model/workflow/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:wcm="http://www.alfresco.org/model/wcmmodel/1.0" xmlns:wca="http://www.alfresco.org/model/wcmappmodel/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:wcmwf="http://www.alfresco.org/model/wcmworkflow/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:bpm="http://www.alfresco.org/model/bpm/1.0" xmlns:custom="custom.model" xmlns="" view:pathref="/app:company_home/app:dictionary/cm:webscripts/cm:org/cm:alfresco/cm:sample">
|
||||
<view:associations>
|
||||
<cm:contains>
|
||||
<cm:content view:childName="cm:upload.get.desc.xml">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/upload.get.desc.xml|mimetype=text/xml|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title></cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>upload.get.desc.xml</cm:name>
|
||||
</view:properties>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:upload.get.html.ftl">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/upload.get.html.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title></cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>upload.get.html.ftl</cm:name>
|
||||
</view:properties>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:upload.post.desc.xml">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/upload.post.desc.xml|mimetype=text/xml|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title></cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>upload.post.desc.xml</cm:name>
|
||||
</view:properties>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:upload.post.js">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/upload.post.js|mimetype=application/x-javascript|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title></cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>upload.post.js</cm:name>
|
||||
</view:properties>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:upload.post.html.ftl">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/upload.post.html.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title></cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>upload.post.html.ftl</cm:name>
|
||||
</view:properties>
|
||||
</cm:content>
|
||||
</cm:contains>
|
||||
</view:associations>
|
||||
</view:reference>
|
||||
</view:view>
|
6
config/alfresco/bootstrap/webscripts/upload.get.desc.xml
Normal file
6
config/alfresco/bootstrap/webscripts/upload.get.desc.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<webscript>
|
||||
<shortname>File Upload Form Sample</shortname>
|
||||
<description>Form for uploading file content and meta-data into Repository</description>
|
||||
<url>/sample/upload</url>
|
||||
<authentication>user</authentication>
|
||||
</webscript>
|
27
config/alfresco/bootstrap/webscripts/upload.get.html.ftl
Normal file
27
config/alfresco/bootstrap/webscripts/upload.get.html.ftl
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Upload Web Script Sample</title>
|
||||
<link rel="stylesheet" href="${url.context}/css/main.css" TYPE="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="${url.context}/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
|
||||
<td><nobr><span class="mainTitle">Upload Web Script Sample</span></nobr></td>
|
||||
</tr>
|
||||
<tr><td><td>Alfresco ${server.edition} v${server.version}
|
||||
</table>
|
||||
<p>
|
||||
<table>
|
||||
<form action="${url.service}" method="post" enctype="multipart/form-data" charset="utf-8">
|
||||
<tr><td>File:<td><input type="file" name="file">
|
||||
<tr><td>Title:<td><input name="title">
|
||||
<tr><td>Description:<td><input name="desc">
|
||||
<tr><td><td>
|
||||
<tr><td><td><input type="submit" name="submit" value="Upload">
|
||||
</form>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,6 @@
|
||||
<webscript>
|
||||
<shortname>File Upload Sample</shortname>
|
||||
<description>Upload file content and meta-data into Repository</description>
|
||||
<url>/sample/upload</url>
|
||||
<authentication>user</authentication>
|
||||
</webscript>
|
19
config/alfresco/bootstrap/webscripts/upload.post.html.ftl
Normal file
19
config/alfresco/bootstrap/webscripts/upload.post.html.ftl
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Upload Web Script Sample</title>
|
||||
<link rel="stylesheet" href="${url.context}/css/main.css" TYPE="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="${url.context}/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
|
||||
<td><nobr><span class="mainTitle">Upload Web Script Sample</span></nobr></td>
|
||||
</tr>
|
||||
<tr><td><td>Alfresco ${server.edition} v${server.version}
|
||||
<tr><td><td>
|
||||
<tr><td><td>Uploaded <a href="${url.serviceContext}/sample/folder${upload.displayPath}">${upload.name}</a> of size ${upload.properties.content.size}.
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
43
config/alfresco/bootstrap/webscripts/upload.post.js
Normal file
43
config/alfresco/bootstrap/webscripts/upload.post.js
Normal file
@@ -0,0 +1,43 @@
|
||||
var filename = null;
|
||||
var content = null;
|
||||
var title = "";
|
||||
var description = "";
|
||||
|
||||
// locate file attributes
|
||||
for each (field in formdata.fields)
|
||||
{
|
||||
if (field.name == "title")
|
||||
{
|
||||
title = field.value;
|
||||
}
|
||||
else if (field.name == "desc")
|
||||
{
|
||||
description = field.value;
|
||||
}
|
||||
else if (field.name == "file" && field.isFile)
|
||||
{
|
||||
filename = field.filename;
|
||||
content = field.content;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure mandatory file attributes have been located
|
||||
if (filename == undefined || content == undefined)
|
||||
{
|
||||
status.code = 400;
|
||||
status.message = "Uploaded file cannot be located in request";
|
||||
status.redirect = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create document in company home for uploaded file
|
||||
upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ;
|
||||
upload.properties.content.write(content);
|
||||
upload.properties.content.mimetype = "UTF-8";
|
||||
upload.properties.title = title;
|
||||
upload.properties.description = description;
|
||||
upload.save();
|
||||
|
||||
// setup model for response template
|
||||
model.upload = upload;
|
||||
}
|
@@ -147,6 +147,7 @@ patch.AVMGuidPatch.description=Set GUIDs on AVM nodes.
|
||||
patch.AVMGuidPatch.result=AVM GUIDS set.
|
||||
|
||||
patch.webscripts.description=Adds Web Scripts to Data Dictionary.
|
||||
patch.webscripts2.description=Adds Web Scripts (second set) to Data Dictionary.
|
||||
patch.webscriptsExtension.description=Adds Web Scripts Extension to Data Dictionary.
|
||||
|
||||
patch.AVMLayeredSnapshot.description=Set indirectionVersion on Layered Nodes.
|
||||
|
@@ -890,5 +890,22 @@
|
||||
<value>classpath:alfresco/dbscripts/upgrade/2.1/${db.script.dialect}/AlfrescoSchemaUpdate-2.1-VersionColumns.sql</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.webscripts2" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.webscripts2</value></property>
|
||||
<property name="description"><value>patch.webscripts2.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>100</value></property>
|
||||
<property name="targetSchema"><value>101</value></property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="bootstrapView">
|
||||
<props>
|
||||
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}</prop>
|
||||
<prop key="location">alfresco/bootstrap/webScripts2.xml</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
@@ -19,4 +19,4 @@ version.build=@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
version.schema=100
|
||||
version.schema=101
|
||||
|
Reference in New Issue
Block a user