03-02-2012 06:55 AM
05-09-2012 05:36 AM
05-09-2012 06:45 AM
07-18-2012 07:42 AM
<bean id="webscript.com.someco.site.SomecoSiteService" class="com.someco.site.SomecoSiteService"
parent="webscript">
<property name="siteService">
<ref bean="SiteService" />
</property>
</bean>
…07-18-2012 07:50 AM
var site = null;
if (sitetype == null)
{
site = siteService.createSite(sitePreset, shortName, title, description, visibility);
}
else
{
site = siteService.createSite(sitePreset, shortName, title, description, visibility, sitetype);
}
site.node.properties["some:prop"] = "someValue";
site.node.save();
07-18-2012 09:20 AM
<type name="st:site">
<title>Site</title>
<parent>cm:folder</parent>
<properties>
<property name="st:sitePreset">
<title>Site Preset</title>
<type>d:text</type>
</property>
<property name="st:siteVisibility">
<title>Site Visibility</title>
<type>d:text</type>
</property>
</properties>
<mandatory-aspects>
<aspect>cm:titled</aspect>
<!– Sites are by default undeletable. Only deletable through the SiteService. –>
<aspect>sys:undeletable</aspect>
<aspect>st:customSiteProperties</aspect>
</mandatory-aspects>
</type>
<!– Site Root Folder: –>
<!– - all sites are stored beneath the site root folder –>
<type name="st:sites">
<title>Sites</title>
<parent>cm:folder</parent>
</type>
</types>
<aspects>
<!– Site Container Aspect –>
<aspect name="st:siteContainer">
<title>Site Container</title>
<properties>
<property name="st:componentId">
<title>Component Id</title>
<type>d:text</type>
</property>
</properties>
</aspect>
<!– Example Custom Site Properties Aspect –>
<aspect name="st:customSiteProperties">
<title>Custom Site Properties</title>
<properties>
<property name="stcp:siteComment">
<title>Site Comment</title>
<type>d:text</type>
</property>
<property name="stcp:matureOnly">
<title>For mature only</title>
<type>d:text</type>
</property>
</properties>
</aspect>
</aspects>
site.node.properties["stcp:siteComment"] = json.get("siteComment");
site.node.save();
07-18-2012 11:25 AM
07-19-2012 04:07 AM
<@script type="text/javascript" src="${page.url.context}/extension/modules/edit-site.js"></@script>
<script type="text/javascript">//<![CDATA[
var profile = new SomeCo.UserSite("${args.htmlid}").setOptions(
{
userId: "${user.name}",
profile: {
shortName: "<#if profile.shortName??>${profile.shortName?js_string}</#if>",
title: "<#if profile.title??>${profile.title?js_string}</#if>",
description: "<#if profile.description??>${profile.description?js_string}</#if>",
visibility: "<#if profile.visibility??>${profile.visibility?js_string}</#if>",
siteComment: "<#if profile.properties.siteComment??>${profile.properties.siteComment?js_string}</#if>",
matureOnly: "<#if profile.properties.matureOnly??>${profile.properties.matureOnly?js_string}</#if>"
}
}).setMessages(
${messages}
);
//]]></script>
#assign el=args.htmlid?html>
…
The file is in C:\Alfresco\tomcat\webapps\share\extension\modules\edit-site.js<div class="yui-u">
<input id="${el}-siteComment" type="text" name="siteComment" tabindex="0" maxlength="255" value="${(profile.siteComment)?html}" /><br>
</div>
Do I have to modify edit-site.js?07-19-2012 04:36 AM
07-19-2012 06:05 AM
07-23-2012 05:35 AM
Hello,There is no error in logs. In NodeBrowser I see that there is st:customSiteProperties aspect in the site and I can edit and save my custom properties via Share->Repository, but it looks like sites.post.json.js and site.put.json.js doesn't work properly, there's the whole codes:
the usage is correct. Are any errors reported? What is the state of the node in the NodeBrowser?
By the way - what kind of site needs a "matureOnly" flag / text? :wink:
Regards
Axel
function main()
{
// Get the site
var shortName = url.extension;
var site = siteService.getSite(shortName);
if (site != null)
{
// Updafte the sites details
if (json.has("title") == true)
{
site.title = json.get("title");
}
if (json.has("description") == true)
{
site.description = json.get("description");
}
if (json.has("siteComment"))
{
site.node.properties["stcp:siteComment"] = json.get("siteComment");
}
if (json.has("matureOnly"))
{
site.node.properties["stcp:matureOnly"] = json.get("matureOnly");
}
// Use the visibility flag before the isPublic flag
if (json.has("visibility") == true)
{
site.visibility = json.get("visibility");
}
else if (json.has("isPublic") == true)
{
// Deal with deprecated isPublic flag accordingly
var isPublic = json.getBoolean("isPublic");
if (isPublic == true)
{
site.visibility = siteService.PUBLIC_SITE;
}
else
{
site.visibility = siteService.PRIVATE_SITE;
}
}
site.node.save();
// Save the site
site.save();
// Pass the model to the template
model.site = site;
}
else
{
// Return 404
status.setCode(status.STATUS_NOT_FOUND, "Site " + shortName + " does not exist");
return;
}
}
main();
function main()
{
// The commented out code below checks if the current user has the necessary permissions to
// create a site and retrns a 401 status if they do not.
//
// However, the presentation tier currently handles 500 errors, but not 400 errors.
// Therefore the UNAUTHORIZED status is not currently returned.
// If a user who does not have permission to create a site tries to do so, a dialog
// appears in Share telling them AccessDenied. You do not have the appropriate permissions
// to perform this operation.
// TODO If we can fix up create-site.js in Slingshot to handle 401s, we can comment this back in.
// Irrespective of the checks below, the currently authenticated user needs to have
// permission to create a site.
// if (siteService.hasCreateSitePermissions() == false)
// {
// status.setCode(status.STATUS_UNAUTHORIZED, "User does not have permission to create sites.");
// return;
// }
// Get the details of the site
if (json.has("shortName") == false || json.get("shortName").length == 0)
{
status.setCode(status.STATUS_BAD_REQUEST, "Short name missing when creating site");
return;
}
var shortName = json.get("shortName");
// See if the shortName is available
var site = siteService.getSite(shortName);
if (site != null)
{
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "error.duplicateShortName");
return;
}
if (json.has("sitePreset") == false || json.get("sitePreset").length == 0)
{
status.setCode(status.STATUS_BAD_REQUEST, "Site preset missing when creating site");
return;
}
var sitePreset = json.get("sitePreset");
var title = null;
if (json.has("title"))
{
title = json.get("title");
}
var description = null;
if (json.has("description"))
{
description = json.get("description");
}
var siteComment = null;
if (json.has("siteComment"))
{
siteComment = json.get("siteComment");
}
var matureOnly = null;
if (json.has("matureOnly"))
{
matureOnly = json.get("matureOnly");
}
var sitetype = null;
if (json.has("type") == true)
{
sitetype = json.get("type");
}
// Use the visibility flag before the isPublic flag
var visibility = siteService.PUBLIC_SITE;
if (json.has("visibility"))
{
visibility = json.get("visibility");
}
else if (json.has("isPublic"))
{
var isPublic = json.getBoolean("isPublic");
if (isPublic == true)
{
visibility = siteService.PUBLIC_SITE;
}
else
{
visibility = siteService.PRIVATE_SITE;
}
}
// Create the site
var site = null;
if (sitetype == null)
{
site = siteService.createSite(sitePreset, shortName, title, description, visibility);
}
else
{
site = siteService.createSite(sitePreset, shortName, title, description, visibility, sitetype);
}
site.node.properties["stcp:siteComment"] = siteComment;
site.node.properties["stcp:matureOnly"] = matureOnly;
site.node.save();
// Put the created site into the model
model.site = site;
}
main();
<div class="yui-gd">
<div class="yui-u first"><label for="${el}-siteComment">${msg("label.siteComment")}:</label></div>
<div class="yui-u">
<input id="${el}-siteComment" type="text" name="siteComment" tabindex="0" maxlength="255" /><br>
</div>
</div>
<div class="yui-gd">
<div class="yui-u first"><label for="${el}-matureOnly">${msg("label.matureOnly")}:</label></div>
<div class="yui-u">
<select id="${el}-matureOnly" name="matureOnly" tabindex="0">
<option value="no">no</option>
<option value="yes">yes</option>
</select>
</div>
</div>
Please help
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.