String pageComponentsString = getPageComponentsString(db, siteNodeId, languageId, contentId, principal);
if(pageComponentsString != null && pageComponentsString.length() != 0)
{
Document document = domBuilder.getDocument(pageComponentsString);
List pageComponents = getPageComponents(db, pageComponentsString, document.getRootElement(), "base", null, null, siteNodeId, languageId, principal);
InfoGlueComponent component = (InfoGlueComponent)pageComponents.get(0);
if(!component.getId().equals(componentId))
component = getComponentWithId(component, componentId);
boolean hasAccessToAccessRights = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.ChangeSlotAccess", "");
boolean hasAccessToAddComponent = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.AddComponent", "" + (component.getParentComponent() == null ? component.getContentId() : component.getParentComponent().getContentId()) + "_" + component.getSlotName());
boolean hasAccessToDeleteComponent = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.DeleteComponent", "" + (component.getParentComponent() == null ? component.getContentId() : component.getParentComponent().getContentId()) + "_" + component.getSlotName());
boolean hasAccessToChangeComponent = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.ChangeComponent", "" + (component.getParentComponent() == null ? component.getContentId() : component.getParentComponent().getContentId()) + "_" + component.getSlotName());
boolean hasSaveTemplateAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "StructureTool.SaveTemplate", "");
boolean hasSavePagePartTemplateAccess = hasSaveTemplateAccess;
if(slotClicked != null && slotClicked.equalsIgnoreCase("true"))
hasAccessToAddComponent = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.AddComponent", "" + component.getContentId() + "_" + slotId);
boolean hasSubmitToPublishAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.SubmitToPublish", "");
boolean hasPageStructureAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.PageStructure", "");
boolean hasOpenInNewWindowAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.OpenInNewWindow", "");
boolean hasViewSourceAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.ViewSource", "");
boolean hasMySettingsAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.MySettings", "");
boolean showNotifyUserOfPage = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.NotifyUserOfPage", "");
boolean showContentNotifications = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.ContentNotifications", "");
boolean showPageNotifications = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "ComponentEditor.PageNotifications", "");
boolean hasMaxComponents = false;
if(component.getParentComponent() != null && component.getParentComponent().getSlotList() != null)
{
Iterator slotListIterator = component.getParentComponent().getSlotList().iterator();
while(slotListIterator.hasNext())
{
Slot slot = (Slot)slotListIterator.next();
if(slot.getId().equalsIgnoreCase(slotName))
{
if(slot.getAllowedNumberOfComponents() != -1 && slot.getComponents().size() >= slot.getAllowedNumberOfComponents())
{
hasMaxComponents = true;
}
}
}
}
if(component.getContainerSlot() != null && component.getContainerSlot().getDisableAccessControl())
{
hasAccessToAddComponent = true;
hasAccessToDeleteComponent = true;
}
if(hasMaxComponents)
hasAccessToAddComponent = false;
if(component.getIsInherited())
{
StringBuilder sb2 = new StringBuilder();
return sb2.toString();
}
sb.append("<div id=\"componentMenu\" class=\"skin0 editOnSightMenuDiv\">");
Document componentTasksDocument = getComponentTasksDOM4JDocument(masterLanguageVO.getId(), metaInfoContentVO.getId(), db);
Collection componentTasks = getComponentTasks(componentId, componentTasksDocument);
int taskIndex = 0;
Iterator componentTasksIterator = componentTasks.iterator();
while(componentTasksIterator.hasNext())
{
ComponentTask componentTask = (ComponentTask)componentTasksIterator.next();
String view = componentTask.getView();
boolean openInPopup = componentTask.getOpenInPopup();
String icon = componentTask.getIcon();
view = view.replaceAll("\\$componentEditorUrl", componentEditorUrl);
view = view.replaceAll("\\$originalFullURL", originalFullURL);
view = view.replaceAll("\\$componentRendererUrl", componentRendererUrl);
view = view.replaceAll("\\$repositoryId", repositoryId.toString());
view = view.replaceAll("\\$siteNodeId", siteNodeId.toString());
view = view.replaceAll("\\$languageId", languageId.toString());
view = view.replaceAll("\\$componentId", componentId.toString());
sb.append("<div class=\"igmenuitems linkComponentTask\" " + ((icon != null && !icon.equals("")) ? "style=\"background-image:url(" + icon + ")\"" : "") + " onclick=\"executeTask('" + view + "', " + openInPopup + ");\"><a href='#'>" + componentTask.getName() + "</a></div>");
}
String editHTML = getLocalizedString(locale, "deliver.editOnSight.editHTML");
String editInlineHTML = getLocalizedString(locale, "deliver.editOnSight.editContentInlineLabel");
String submitToPublishHTML = getLocalizedString(locale, "deliver.editOnSight.submitToPublish");
String addComponentHTML = getLocalizedString(locale, "deliver.editOnSight.addComponentHTML");
String deleteComponentHTML = getLocalizedString(locale, "deliver.editOnSight.deleteComponentHTML");
String changeComponentHTML = getLocalizedString(locale, "deliver.editOnSight.changeComponentHTML");
String moveComponentUpHTML = getLocalizedString(locale, "deliver.editOnSight.moveComponentUpHTML");
String moveComponentDownHTML = getLocalizedString(locale, "deliver.editOnSight.moveComponentDownHTML");
String propertiesHTML = getLocalizedString(locale, "deliver.editOnSight.propertiesHTML");
String accessRightsHTML = getLocalizedString(locale, "deliver.editOnSight.accessRightsHTML");
String pageComponentsHTML = getLocalizedString(locale, "deliver.editOnSight.pageComponentsHTML");
String viewSourceHTML = getLocalizedString(locale, "deliver.editOnSight.viewSourceHTML");
String componentEditorInNewWindowHTML = getLocalizedString(locale, "deliver.editOnSight.componentEditorInNewWindowHTML");
String savePageTemplateHTML = getLocalizedString(locale, "deliver.editOnSight.savePageTemplateHTML");
String savePagePartTemplateHTML = getLocalizedString(locale, "deliver.editOnSight.savePagePartTemplateHTML");
String changePageMetaDataLabel = getLocalizedString(locale, "deliver.editOnSight.changePageMetaDataLabel");
String createSubPageToCurrentLabel = getLocalizedString(locale, "deliver.editOnSight.createSubPageToCurrentLabel");
String mySettingsLabel = getLocalizedString(locale, "deliver.editOnSight.mySettingsLabel");
String notifyLabel = getLocalizedString(locale, "deliver.editOnSight.notifyLabel");
String subscribeToContentLabel = getLocalizedString(locale, "deliver.editOnSight.subscribeToContentLabel");
String subscribeToPageLabel = getLocalizedString(locale, "deliver.editOnSight.subscribeToPageLabel");
String translateContentLabel = getLocalizedString(locale, "deliver.editOnSight.translateContentLabel");
Slot slot = null;
InfoGlueComponent parentComponent = null;
if(slotClicked == null || slotClicked.equalsIgnoreCase("true"))
{
slot = component.getSlot(slotId);
parentComponent = component;
}
else
{
slot = component.getContainerSlot();
parentComponent = component.getParentComponent();
}
String allowedComponentNamesAsEncodedString = "";
String disallowedComponentNamesAsEncodedString = "";
String allowedComponentGroupNamesAsEncodedString = "";
if(slot != null)
{
allowedComponentNamesAsEncodedString = slot.getAllowedComponentsArrayAsUrlEncodedString();
disallowedComponentNamesAsEncodedString = slot.getDisallowedComponentsArrayAsUrlEncodedString();
allowedComponentGroupNamesAsEncodedString = slot.getAllowedComponentGroupsArrayAsUrlEncodedString();
}
String addComponentUrl = "";
String deleteComponentUrl = "";
String changeComponentUrl = "";
String savePartTemplateUrl = "";
if(parentComponent != null)
{
//logger.info("slot:" + slot.getId());
//logger.info("parentComponent:" + parentComponent.getId());
//logger.info("allowedComponentNamesAsEncodedString:" + allowedComponentNamesAsEncodedString);
//logger.info("disallowedComponentNamesAsEncodedString:" + disallowedComponentNamesAsEncodedString);
//logger.info("allowedComponentGroupNamesAsEncodedString:" + allowedComponentGroupNamesAsEncodedString);
addComponentUrl = "" + componentEditorUrl + "ViewSiteNodePageComponents!listComponents.action?siteNodeId=" + siteNodeId + "&languageId=" + languageId + "&contentId=" + (contentId == null ? "-1" : contentId) + "&parentComponentId=" + parentComponent.getId() + "&slotId=" + slotId + "&showSimple=" + showSimple + ((allowedComponentNamesAsEncodedString != null) ? "&" + allowedComponentNamesAsEncodedString : "") + ((disallowedComponentNamesAsEncodedString != null) ? "&" + disallowedComponentNamesAsEncodedString : "") + ((allowedComponentGroupNamesAsEncodedString != null) ? "&" + allowedComponentGroupNamesAsEncodedString : "");
deleteComponentUrl = "" + componentEditorUrl + "ViewSiteNodePageComponents!deleteComponent.action?siteNodeId=" + siteNodeId + "&languageId=" + languageId + "&contentId=" + (contentId == null ? "-1" : contentId) + "&componentId=" + component.getId() + "&slotId=" + slotId + "&showSimple=" + showSimple;
changeComponentUrl = "" + componentEditorUrl + "ViewSiteNodePageComponents!listComponentsForChange.action?siteNodeId=" + siteNodeId + "&languageId=" + languageId + "&contentId=" + (contentId == null ? "-1" : contentId) + "&componentId=" + component.getId() + "&slotId=" + slotId + "&showSimple=" + showSimple + ((allowedComponentNamesAsEncodedString != null) ? "&" + allowedComponentNamesAsEncodedString : "") + ((disallowedComponentNamesAsEncodedString != null) ? "&" + disallowedComponentNamesAsEncodedString : "") + ((allowedComponentGroupNamesAsEncodedString != null) ? "&" + allowedComponentGroupNamesAsEncodedString : "");
savePartTemplateUrl = "savePartComponentStructure('" + componentEditorUrl + "CreatePageTemplate!input.action?contentId=" + metaInfoContentVO.getId() + "', '" + component.getId() + "');";
//logger.info("addComponentUrl:" + addComponentUrl);