success = false;
resultMap.put(REASON, "Insufficient access to administer portal permissions");
return success;
}
int count = 0;
BaseFragmentsElement page = null;
String path = getActionParameter(requestContext, "path");
if (path == null)
{
page = requestContext.getPage().getPageOrTemplate();
}
else
{
if (!method.equals("add"))
{
if (path.endsWith(Page.DOCUMENT_TYPE))
{
page = pageManager.getPage(path);
}
else if (path.endsWith(DynamicPage.DOCUMENT_TYPE))
{
page = pageManager.getDynamicPage(path);
}
else
{
success = false;
resultMap.put(REASON, "Can't lookup page by document type: " + path);
return success;
}
}
else
{
if (pageManager.pageExists(path) || pageManager.dynamicPageExists(path))
{
success = false;
resultMap.put(REASON, "Can't create: Page already exists: " + path);
return success;
}
}
}
if (page == null)
{
throw new AJAXException("Missing current page or 'path' parameter");
}
if (method.equals("info"))
{
count = updateInformation(requestContext, resultMap, page, path);
}
else if (method.equals("add-meta"))
{
count = insertMetadata(requestContext, resultMap, page);
}
else if (method.equals("update-meta"))
{
count = updateMetadata(requestContext, resultMap, page);
}
else if (method.equals("remove-meta"))
{
count = removeMetadata(requestContext, resultMap, page);
}
else if (method.equals("add-secref"))
{
count = insertSecurityReference(requestContext, resultMap, page);
}
else if (method.equals("update-secref"))
{
count = updateSecurityReference(requestContext, resultMap, page);
}
else if (method.equals("remove-secref"))
{
count = removeSecurityReference(requestContext, resultMap, page);
}
else if (method.equals("remove-secdef"))
{
count = removeSecurityDef(requestContext, resultMap, page);
}
else if (method.equals("add"))
{
page = pageManager.newPage(path);
page.setTitle(getActionParameter(requestContext, TITLE));
String s = getActionParameter(requestContext, SHORT_TITLE );
if (!isBlank(s))
page.setShortTitle(s);
String l = getActionParameter(requestContext, DEFAULT_LAYOUT);
if (!isBlank(l) && (page.getRootFragment() instanceof Fragment))
{
Fragment rootFragment = (Fragment)page.getRootFragment();
rootFragment.setName(getActionParameter(requestContext, DEFAULT_LAYOUT));
}
count++;
}
else if (method.equals("copy"))