private string GetHeaderResourceString(WorkflowStepTypeEnum stepType) { if (CurrentWorkflow.IsAutomation) { return("workflowstep.contactmanagement"); } return(stepType == WorkflowStepTypeEnum.Condition ? "workflowstep.conditionsettings" : "workflowstep.advancedsettings"); }
/// <summary> /// External history binding. /// </summary> protected object gridHistory_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView drv = null; switch (sourceName.ToLowerCSafe()) { case "action": drv = (DataRowView)parameter; bool wasrejected = ValidationHelper.GetBoolean(drv["HistoryWasRejected"], false); // Get type of the steps WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "HistoryStepType"), 0); WorkflowStepTypeEnum targetStepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "HistoryTargetStepType"), 0); WorkflowTransitionTypeEnum transitionType = (WorkflowTransitionTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "HistoryTransitionType"), 0); if (!wasrejected) { bool isAutomatic = (transitionType == WorkflowTransitionTypeEnum.Automatic); string actionString = isAutomatic ? GetString("WorfklowProperties.Automatic") + " ({0})" : "{0}"; // Return correct step title switch (targetStepType) { case WorkflowStepTypeEnum.Finished: actionString = string.Format(actionString, GetString("ma.finished")); break; default: if (stepType == WorkflowStepTypeEnum.Start) { actionString = string.Format(actionString, GetString("ma.started")); } else { actionString = isAutomatic ? GetString("WorfklowProperties.Automatic") : GetString("ma.movedtonextstep"); } break; } return(actionString); } else { return(GetString("ma.movedtopreviousstep")); } case "stepname": drv = (DataRowView)parameter; string step = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "HistoryStepDisplayName"), String.Empty); string targetStep = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "HistoryTargetStepDisplayName"), String.Empty); if (!string.IsNullOrEmpty(targetStep)) { step += " -> " + targetStep; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(step))); } return(parameter); }
/// <summary> /// External step binding. /// </summary> protected object gridSteps_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerInvariant()) { case "currentstepinfo": DataRowView data = (DataRowView)parameter; if (currentStepId <= 0) { WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(data["StepType"], 1); if (stepType == WorkflowStepTypeEnum.DocumentEdit) { return(UIHelper.GetAccessibleIconTag("icon-arrow-right")); } } else { // Check if version history exists and node is published if (Node.IsPublished && (Node.DocumentCheckedOutVersionHistoryID <= 0)) { WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(data["StepType"], 1); if (stepType == WorkflowStepTypeEnum.DocumentPublished) { return(UIHelper.GetAccessibleIconTag("icon-arrow-right")); } } else { int stepId = ValidationHelper.GetInteger(data["StepID"], 0); if (stepId == currentStepId) { return(UIHelper.GetAccessibleIconTag("icon-arrow-right")); } } } return(string.Empty); case "steporder": if (sender != null) { // Get grid row GridViewRow row = (GridViewRow)((DataControlFieldCell)sender).Parent; int pageOffset = (gridSteps.Pager.CurrentPage - 1) * gridSteps.Pager.CurrentPageSize; // Return row index return((pageOffset + row.RowIndex + 1).ToString()); } return(string.Empty); } return(parameter); }
/// <summary> /// External step binding. /// </summary> protected object gridSteps_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "currentstepinfo": DataRowView data = (DataRowView)parameter; if (currentStepId <= 0) { WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(data["StepType"], 1); if (stepType == WorkflowStepTypeEnum.DocumentEdit) { return("<img src=\"" + GetImageUrl("CMSModules/CMS_Content/Properties/currentstep.png") + "\" alt=\"\" />"); } } else { // Check if version history exists and node is published if (Node.IsPublished && (Node.DocumentCheckedOutVersionHistoryID <= 0)) { WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(data["StepType"], 1); if (stepType == WorkflowStepTypeEnum.DocumentPublished) { return("<img src=\"" + GetImageUrl("CMSModules/CMS_Content/Properties/currentstep.png") + "\" alt=\"\" />"); } } else { int stepId = ValidationHelper.GetInteger(data["StepID"], 0); if (stepId == currentStepId) { return("<img src=\"" + GetImageUrl("CMSModules/CMS_Content/Properties/currentstep.png") + "\" alt=\"\" />"); } } } return(string.Empty); case "steporder": if (sender != null) { // Get grid row GridViewRow row = (GridViewRow)((DataControlFieldCell)sender).Parent; int pageOffset = (gridSteps.Pager.CurrentPage - 1) * gridSteps.Pager.CurrentPageSize; // Return row index return((pageOffset + row.RowIndex + 1).ToString()); } return(string.Empty); } return(parameter); }
protected static object stepsGrid_OnExternalDataBound(object sender, string sourceName, object parameter) { WorkflowStepTypeEnum stepType = WorkflowStepTypeEnum.Undefined; GridViewRow container = null; switch (sourceName.ToLowerCSafe()) { case "allowaction": container = (GridViewRow)parameter; stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue((DataRowView)container.DataItem, "StepType"), 3); switch (stepType) { case WorkflowStepTypeEnum.DocumentEdit: case WorkflowStepTypeEnum.DocumentPublished: case WorkflowStepTypeEnum.DocumentArchived: ((Control)sender).Visible = false; break; } break; case "steptype": stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(parameter, 3); WorkflowNode node = WorkflowNode.GetInstance(stepType); return(HTMLHelper.HTMLEncode(node.Name)); case "#objectmenu": container = (GridViewRow)parameter; WorkflowStepInfo step = new WorkflowStepInfo(((DataRowView)container.DataItem).Row); if (step.StepIsDefault) { ImageButton button = ((ImageButton)sender); button.Visible = false; } break; } return(parameter); }
/// <summary> /// External history binding. /// </summary> protected object gridHistory_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView drv; switch (sourceName.ToLowerInvariant()) { case "action": drv = (DataRowView)parameter; bool wasRejected = ValidationHelper.GetBoolean(drv["WasRejected"], false); // Get type of the steps WorkflowStepTypeEnum stepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "StepType"), 0); WorkflowStepTypeEnum targetStepType = (WorkflowStepTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "TargetStepType"), (int)stepType); WorkflowTransitionTypeEnum transitionType = (WorkflowTransitionTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(drv, "HistoryTransitionType"), 0); // Get name of steps string stepName = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "StepName"), String.Empty); string targetStepName = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "TargetStepName"), stepName); if (!wasRejected) { // If step type defined, use it for identification if (targetStepType != WorkflowStepTypeEnum.Undefined) { bool isAutomatic = (transitionType == WorkflowTransitionTypeEnum.Automatic); string actionString = isAutomatic ? GetString("WorfklowProperties.Automatic") + " ({0})" : "{0}"; // Return correct step title switch (targetStepType) { case WorkflowStepTypeEnum.DocumentArchived: actionString = string.Format(actionString, GetString("WorfklowProperties.Archived")); break; case WorkflowStepTypeEnum.DocumentPublished: actionString = string.Format(actionString, GetString("WorfklowProperties.Published")); break; case WorkflowStepTypeEnum.DocumentEdit: actionString = GetString("WorfklowProperties.NewVersion"); break; default: if (stepType == WorkflowStepTypeEnum.DocumentEdit) { actionString = GetString("WorfklowProperties.NewVersion"); } else { actionString = isAutomatic ? GetString("WorfklowProperties.Automatic") : GetString("WorfklowProperties.Approved"); } break; } return(actionString); } // Backward compatibility else { // Return correct step title switch (targetStepName.ToLowerInvariant()) { case "archived": return(GetString("WorfklowProperties.Archived")); case "published": return(GetString("WorfklowProperties.Published")); case "edit": return(GetString("WorfklowProperties.NewVersion")); default: if (CMSString.Equals(stepName, "edit", true)) { return(GetString("WorfklowProperties.NewVersion")); } return(GetString("WorfklowProperties.Approved")); } } } else { return(GetString("WorfklowProperties.Rejected")); } // Get approved time case "approvedwhen": case "approvedwhentooltip": if (string.IsNullOrEmpty(parameter.ToString())) { return(string.Empty); } else { if (currentUserInfo == null) { currentUserInfo = MembershipContext.AuthenticatedUser; } if (currentSiteInfo == null) { currentSiteInfo = SiteContext.CurrentSite; } if (sourceName.EqualsCSafe("approvedwhen", StringComparison.InvariantCultureIgnoreCase)) { DateTime time = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME); return(TimeZoneHelper.ConvertToUserTimeZone(time, true, currentUserInfo, currentSiteInfo)); } else { return(TimeZoneHelper.GetUTCLongStringOffset(currentUserInfo, currentSiteInfo)); } } case "stepname": drv = (DataRowView)parameter; string step = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "StepDisplayName"), String.Empty); string targetStep = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(drv, "TargetStepDisplayName"), String.Empty); if (!string.IsNullOrEmpty(targetStep)) { step += " -> " + targetStep; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(step))); } return(parameter); }
/// <summary> /// Creates the tree node. /// </summary> /// <param name="sourceNode">Source node</param> /// <param name="index">Node index</param> /// <param name="childNode">True if the node is child node</param> protected System.Web.UI.WebControls.TreeNode CreateNode(TreeSiteMapNode sourceNode, int index, bool childNode) { System.Web.UI.WebControls.TreeNode newNode = new System.Web.UI.WebControls.TreeNode(); ISimpleDataContainer container = sourceNode; int nodeId = (int)container.GetValue("NodeID"); int nodeLevel = (int)container.GetValue("NodeLevel"); if (nodeId < 0) { newNode.SelectAction = TreeNodeSelectAction.None; newNode.Text = GetString("ContentTree.ReadDocumentDenied"); newNode.NavigateUrl = (DeniedNodePostback ? mBasePath + "#" : string.Empty); return(newNode); } // Show complete node if index is lower than MaxTreeNodes or level is lower than RootNodeLevel if ((MaxTreeNodes <= 0) || (index < MaxTreeNodes) || (nodeLevel <= MapProvider.RootNodeLevel + 1)) { allNodes[nodeId] = newNode; // Set the base data newNode.Value = nodeId.ToString(); newNode.NavigateUrl = "javascript:void(0);"; int classId = ValidationHelper.GetInteger(container.GetValue("NodeClassID"), 0); DataClassInfo ci = DataClassInfoProvider.GetDataClassInfo(classId); if (ci == null) { throw new Exception("[ContentTree.CreateNode]: Node class not found."); } string className = ci.ClassName; // Use file type icons for file var sb = new StringBuilder(); if (UseCMSFileIcons && string.Equals(className, SystemDocumentTypes.File, StringComparison.InvariantCultureIgnoreCase)) { string extension = ValidationHelper.GetString(container.GetValue("DocumentType"), string.Empty); string image = UIHelper.GetFileIcon(Page, extension, FontIconSizeEnum.Standard, CMSFileIconSet); sb.Append(image); } // Use class icons else { var iconClass = ValidationHelper.GetString(ci.GetValue("ClassIconClass"), String.Empty); var icon = UIHelper.GetDocumentTypeIcon(Page, className, iconClass); sb.Append(icon); } string imageTag = sb.ToString(); string nodeName = HttpUtility.HtmlEncode(ValidationHelper.GetString(container.GetValue("DocumentName"), string.Empty)); string nodeNameJava = ScriptHelper.GetString(nodeName); string marks = ""; // Render special marks only if allowed if (AllowMarks) { int workflowStepId = ValidationHelper.GetInteger(container.GetValue("DocumentWorkflowStepID"), 0); WorkflowStepTypeEnum stepType = WorkflowStepTypeEnum.Undefined; if (workflowStepId > 0) { WorkflowStepInfo stepInfo = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId); if (stepInfo != null) { stepType = stepInfo.StepType; } } // Add icons marks = DocumentUIHelper.GetDocumentMarks(Page, SiteName, Culture, stepType, sourceNode, true); if (!string.IsNullOrEmpty(marks)) { marks = string.Format("<span class=\"tn-group\">{0}</span>", marks); } } string template; if ((SelectedNode != null) && (nodeId == SelectedNode.NodeID)) { template = SelectedNodeTextTemplate; selectedRendered = true; } else { template = NodeTextTemplate; } // Prepare the node text newNode.Text = ResolveNode(template, nodeName, imageTag, nodeNameJava, nodeId, marks); // Drag and drop envelope if (AllowDragAndDrop) { sb.Length = 0; if (childNode) { sb.Append("<span id=\"target_", nodeId, "\"><span class=\"DDItem\" id=\"node_", nodeId, "\"><span class=\"DDHandle\" id=\"handle_", nodeId, "\" onmousedown=\"return false;\" onclick=\"return false;\">", newNode.Text, "</span></span></span>"); } else { sb.Append("<span id=\"target_", nodeId, "\" class=\"RootNode\"><span class=\"DDItem\" id=\"node_", nodeId, "\">", newNode.Text, "</span></span>"); } newNode.Text = sb.ToString(); } bool nodeHasChildren = ValidationHelper.GetBoolean(container.GetValue("NodeHasChildren"), false); // Check if can expand if (!nodeHasChildren) { newNode.PopulateOnDemand = false; newNode.Expanded = true; } else { if ((sourceNode.ChildNodes.Count > 0) || !sourceNode.ChildNodesLoaded) { newNode.PopulateOnDemand = true; } } // Set expanded status string aliasPath = ValidationHelper.GetString(container.GetValue("NodeAliasPath"), string.Empty); newNode.Expanded = aliasPath.Equals(MapProvider.Path, StringComparison.InvariantCultureIgnoreCase) || expandNodes.Contains(nodeId); } else { string parentNodeId = ValidationHelper.GetString(container.GetValue("NodeParentID"), string.Empty); newNode.Value = nodeId.ToString(); newNode.Text = MaxTreeNodeText.Replace("##PARENTNODEID##", parentNodeId); newNode.NavigateUrl = "#"; } return(newNode); }
/// <summary> /// External data binding handler. /// </summary> protected object gridDocuments_OnExternalDataBound(object sender, string sourceName, object parameter) { int currentNodeId; sourceName = sourceName.ToLowerCSafe(); switch (sourceName) { case "view": { // Dialog view item DataRowView data = ((DataRowView)((GridViewRow)parameter).DataItem); CMSGridActionButton btn = ((CMSGridActionButton)sender); // Current row is the Root document isRootDocument = (ValidationHelper.GetInteger(data["NodeParentID"], 0) == 0); currentNodeId = ValidationHelper.GetInteger(data["NodeID"], 0); isCurrentDocument = (currentNodeId == WOpenerNodeID); string culture = ValidationHelper.GetString(data["DocumentCulture"], string.Empty); // Existing document culture if (culture.ToLowerCSafe() == CultureCode.ToLowerCSafe()) { string className = ValidationHelper.GetString(data["ClassName"], string.Empty); if (DataClassInfoProvider.GetDataClassInfo(className).ClassHasURL) { var relativeUrl = isRootDocument ? "~/" : DocumentUIHelper.GetPageHandlerPreviewPath(currentNodeId, culture, CurrentUser.UserName); string url = ResolveUrl(relativeUrl); btn.OnClientClick = "ViewItem(" + ScriptHelper.GetString(url) + "); return false;"; } else { btn.Enabled = false; btn.Style.Add(HtmlTextWriterStyle.Cursor, "default"); } } // New culture version else { btn.OnClientClick = "wopener.NewDocumentCulture(" + currentNodeId + ", '" + CultureCode + "'); CloseDialog(); return false;"; } } break; case "edit": { CMSGridActionButton btn = ((CMSGridActionButton)sender); if (IsEditVisible) { DataRowView data = ((DataRowView)((GridViewRow)parameter).DataItem); string culture = ValidationHelper.GetString(data["DocumentCulture"], string.Empty); currentNodeId = ValidationHelper.GetInteger(data["NodeID"], 0); int nodeParentId = ValidationHelper.GetInteger(data["NodeParentID"], 0); if (!RequiresDialog || (culture.ToLowerCSafe() == CultureCode.ToLowerCSafe())) { // Go to the selected document or create a new culture version when not used in a dialog btn.OnClientClick = "EditItem(" + currentNodeId + ", " + nodeParentId + "); return false;"; } else { // New culture version in a dialog btn.OnClientClick = "wopener.NewDocumentCulture(" + currentNodeId + ", '" + CultureCode + "'); CloseDialog(); return false;"; } } else { btn.Visible = false; } } break; case "delete": { // Delete button CMSGridActionButton btn = ((CMSGridActionButton)sender); // Hide the delete button for the root document btn.Visible = !isRootDocument; } break; case "contextmenu": { // Dialog context menu item CMSGridActionButton btn = ((CMSGridActionButton)sender); // Hide the context menu for the root document btn.Visible = !isRootDocument && !ShowAllLevels; } break; case "versionnumber": { // Version number if (parameter == DBNull.Value) { parameter = "-"; } parameter = HTMLHelper.HTMLEncode(parameter.ToString()); return(parameter); } case "documentname": { // Document name DataRowView data = (DataRowView)parameter; string className = ValidationHelper.GetString(data["ClassName"], string.Empty); string classDisplayName = ValidationHelper.GetString(data["classdisplayname"], null); string name = ValidationHelper.GetString(data["DocumentName"], string.Empty); string culture = ValidationHelper.GetString(data["DocumentCulture"], string.Empty); string cultureString = null; currentNodeId = ValidationHelper.GetInteger(data["NodeID"], 0); int nodeParentId = ValidationHelper.GetInteger(data["NodeParentID"], 0); if (isRootDocument) { // User site name for the root document name = SiteContext.CurrentSiteName; } // Default culture if (culture.ToLowerCSafe() != CultureCode.ToLowerCSafe()) { cultureString = " (" + culture + ")"; } StringBuilder sb = new StringBuilder(); if (ShowDocumentTypeIcon) { // Prepare tooltip for document type icon string iconTooltip = ""; if (ShowDocumentTypeIconTooltip && (classDisplayName != null)) { string safeClassName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(classDisplayName)); iconTooltip = string.Format("onmouseout=\"UnTip()\" onmouseover=\"Tip('{0}')\"", HTMLHelper.EncodeForHtmlAttribute(safeClassName)); } var dataClass = DataClassInfoProvider.GetDataClassInfo(className); if (dataClass != null) { var iconClass = (string)dataClass.GetValue("ClassIconClass"); sb.Append(UIHelper.GetDocumentTypeIcon(Page, className, iconClass, additionalAttributes: iconTooltip)); } } string safeName = HTMLHelper.HTMLEncode(TextHelper.LimitLength(name, 50)); if (DocumentNameAsLink && !isRootDocument) { string tooltip = UniGridFunctions.DocumentNameTooltip(data); string selectFunction = SelectItemJSFunction + "(" + currentNodeId + ", " + nodeParentId + ");"; sb.Append("<a href=\"javascript: ", selectFunction, "\""); sb.Append(" onmouseout=\"UnTip()\" onmouseover=\"Tip('", HTMLHelper.EncodeForHtmlAttribute(tooltip), "')\">", safeName, cultureString, "</a>"); } else { sb.Append(safeName, cultureString); } // Show document marks only if method is not called from grid export and document marks are allowed if ((sender != null) && ShowDocumentMarks) { // Prepare parameters int workflowStepId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(data, "DocumentWorkflowStepID"), 0); WorkflowStepTypeEnum stepType = WorkflowStepTypeEnum.Undefined; if (workflowStepId > 0) { WorkflowStepInfo stepInfo = WorkflowStepInfo.Provider.Get(workflowStepId); if (stepInfo != null) { stepType = stepInfo.StepType; } } // Create data container IDataContainer container = new DataRowContainer(data); // Add icons and use current culture of processed node because of 'Not translated document' icon sb.Append(" ", DocumentUIHelper.GetDocumentMarks(Page, currentSiteName, ValidationHelper.GetString(container.GetValue("DocumentCulture"), string.Empty), stepType, container)); } return(sb.ToString()); } case "documentculture": { DocumentFlagsControl ucDocFlags = null; if (OnDocumentFlagsCreating != null) { // Raise event for obtaining custom DocumentFlagControl object result = OnDocumentFlagsCreating(this, sourceName, parameter); ucDocFlags = result as DocumentFlagsControl; // Check if something other than DocumentFlagControl was returned if ((ucDocFlags == null) && (result != null)) { return(result); } } // Dynamically load document flags control when not created if (ucDocFlags == null) { ucDocFlags = LoadUserControl("~/CMSAdminControls/UI/DocumentFlags.ascx") as DocumentFlagsControl; } // Set document flags properties if (ucDocFlags != null) { DataRowView data = (DataRowView)parameter; // Get node ID currentNodeId = ValidationHelper.GetInteger(data["NodeID"], 0); if (!string.IsNullOrEmpty(SelectLanguageJSFunction)) { ucDocFlags.SelectJSFunction = SelectLanguageJSFunction; } ucDocFlags.ID = "docFlags" + currentNodeId; ucDocFlags.SiteCultures = SiteCultures; ucDocFlags.NodeID = currentNodeId; ucDocFlags.StopProcessing = true; // Keep the control for later usage FlagsControls.Add(ucDocFlags); return(ucDocFlags); } } break; case "modifiedwhen": case "modifiedwhentooltip": // Modified when if (string.IsNullOrEmpty(parameter.ToString())) { return(string.Empty); } DateTime modifiedWhen = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME); currentUserInfo = currentUserInfo ?? MembershipContext.AuthenticatedUser; currentSiteInfo = currentSiteInfo ?? SiteContext.CurrentSite; return(sourceName.EqualsCSafe("modifiedwhen", StringComparison.InvariantCultureIgnoreCase) ? TimeZoneHelper.ConvertToUserTimeZone(modifiedWhen, true, currentUserInfo, currentSiteInfo) : TimeZoneHelper.GetUTCLongStringOffset(currentUserInfo, currentSiteInfo)); default: if (OnExternalAdditionalDataBound != null) { return(OnExternalAdditionalDataBound(sender, sourceName, parameter)); } break; } return(parameter); }
/// <summary> /// Creates the tree node. /// </summary> /// <param name="sourceNode">Source node</param> /// <param name="index">Node index</param> /// <param name="childNode">True if the node is child node</param> protected System.Web.UI.WebControls.TreeNode CreateNode(TreeSiteMapNode sourceNode, int index, bool childNode) { System.Web.UI.WebControls.TreeNode newNode = new System.Web.UI.WebControls.TreeNode(); ISimpleDataContainer container = sourceNode; int nodeId = (int)container.GetValue("NodeID"); int nodeLevel = (int)container.GetValue("NodeLevel"); if (nodeId < 0) { newNode.SelectAction = TreeNodeSelectAction.None; newNode.Text = GetString("ContentTree.ReadDocumentDenied"); newNode.NavigateUrl = (DeniedNodePostback ? mBasePath + "#" : string.Empty); return(newNode); } if ((index < MaxTreeNodes) || (nodeLevel <= MapProvider.RootNodeLevel + 1)) { allNodes[nodeId] = newNode; // Set the base data newNode.Value = nodeId.ToString(); newNode.NavigateUrl = "javascript:void(0);"; int classId = ValidationHelper.GetInteger(container.GetValue("NodeClassID"), 0); DataClassInfo ci = DataClassInfoProvider.GetDataClass(classId); if (ci == null) { throw new Exception("[ContentTree.CreateNode]: Node class not found."); } string className = ci.ClassName.ToLowerCSafe(); string imageUrl = string.Empty; string tooltip = string.Empty; // Use file type icons for cms.file if (UseCMSFileIcons && (className == "cms.file")) { string extension = ValidationHelper.GetString(container.GetValue("DocumentType"), string.Empty); imageUrl = GetFileIconUrl(extension, CMSFileIconSet); tooltip = " title=\"" + extension.ToLowerCSafe().TrimStart('.') + "\" "; } // Use class icons else { imageUrl = GetDocumentTypeIconUrl(className); } StringBuilder sb = new StringBuilder(); sb.Append("<img src=\"", imageUrl, "\" alt=\"\" style=\"border:0px;vertical-align:middle;\" onclick=\"return false;\"", tooltip, " class=\"", (className == "cms.root" ? "Image20" : "Image16"), "\" />"); string imageTag = sb.ToString(); string nodeName = HttpUtility.HtmlEncode(ValidationHelper.GetString(container.GetValue("DocumentName"), string.Empty)); string nodeNameJava = ScriptHelper.GetString(nodeName); // Render special marks only if allowed if (AllowMarks) { int workflowStepId = ValidationHelper.GetInteger(container.GetValue("DocumentWorkflowStepID"), 0); WorkflowStepTypeEnum stepType = WorkflowStepTypeEnum.Undefined; if (workflowStepId > 0) { WorkflowStepInfo stepInfo = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId); if (stepInfo != null) { stepType = stepInfo.StepType; } } // Add icons nodeName += DocumentHelper.GetDocumentMarks(Page, SiteName, Culture, stepType, sourceNode); } string template = null; if ((SelectedNode != null) && (nodeId == SelectedNode.NodeID)) { template = SelectedNodeTextTemplate; selectedRendered = true; } else { template = NodeTextTemplate; } // Prepare the node text newNode.Text = ResolveNode(template, nodeName, imageTag, nodeNameJava, nodeId); int childNodesCount = ValidationHelper.GetInteger(container.GetValue("NodeChildNodesCount"), 0); newNode.Text = newNode.Text.Replace("##NODECHILDNODESCOUNT##", childNodesCount.ToString()); // Drag and drop envelope if (AllowDragAndDrop) { sb.Length = 0; if (childNode) { sb.Append("<span id=\"target_", nodeId, "\"><span class=\"DDItem\" id=\"node_", nodeId, "\"><span class=\"DDHandle\" id=\"handle_", nodeId, "\" onmousedown=\"return false;\" onclick=\"return false;\">", newNode.Text, "</span></span></span>"); } else { sb.Append("<span id=\"target_", nodeId, "\" class=\"RootNode\"><span class=\"DDItem\" id=\"node_", nodeId, "\">", newNode.Text, "</span></span>"); } newNode.Text = sb.ToString(); } // Check if can expand if (childNodesCount == 0) { newNode.PopulateOnDemand = false; newNode.Expanded = true; } else { if ((sourceNode.ChildNodes.Count > 0) || !sourceNode.ChildNodesLoaded) { newNode.PopulateOnDemand = true; } } // Set expanded status string aliasPath = ValidationHelper.GetString(container.GetValue("NodeAliasPath"), string.Empty); newNode.Expanded = (aliasPath.ToLowerCSafe() == MapProvider.UsedPath.ToLowerCSafe()) || (expandNodes.Contains(nodeId)); } else { string parentNodeId = ValidationHelper.GetString(container.GetValue("NodeParentID"), string.Empty); newNode.Value = nodeId.ToString(); newNode.Text = MaxTreeNodeText.Replace("##PARENTNODEID##", parentNodeId); newNode.NavigateUrl = "#"; } return(newNode); }