protected void Page_Load(object sender, EventArgs e) { UIContext.PropertyTab = PropertyTabEnum.LinkedDocs; if (Node != null) { // Check modify permissions if (!CheckDocumentPermissions(Node, PermissionsEnum.Modify)) { pnlContainer.Enabled = false; } } currentSiteName = CMSContext.CurrentSiteName.ToLowerCSafe(); gridDocs.OnExternalDataBound += gridDocuments_OnExternalDataBound; gridDocs.OnAction += gridDocs_OnAction; gridDocs.OnDataReload += gridDocs_OnDataReload; gridDocs.ShowActionsMenu = true; gridDocs.Columns = "NodeAliasPath, SiteName, NodeParentID, DocumentName, DocumentNamePath, ClassDisplayName"; // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); gridDocs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames), SqlHelperClass.MergeColumns(nodeClass.ColumnNames)); pnlContainer.Enabled = !DocumentManager.ProcessingAction; }
protected void SetupControl() { // In design mode is pocessing of control stoped if (this.StopProcessing) { // Do nothing } else { if (CMSContext.CurrentUser.UserID == this.UserID) { this.gridElem.ZeroRowsText = GetString("blogsubscripitons.userhasnosubscriptions"); } else { this.gridElem.ZeroRowsText = GetString("blogsubscripitons.NoDataUser"); } this.gridElem.IsLiveSite = this.IsLiveSite; this.gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); this.gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); this.gridElem.OnDataReload += new OnDataReloadEventHandler(gridElem_OnDataReload); gridElem.ShowActionsMenu = true; gridElem.Columns = "SubscriptionID, SubscriptionEmail, DocumentName, NodeAliasPath, DocumentCulture"; // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); BlogPostSubscriptionInfo bpsi = new BlogPostSubscriptionInfo(); gridElem.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bpsi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); mSiteName = SiteInfoProvider.GetSiteName(SiteID); } }
protected void Page_Load(object sender, EventArgs e) { // Check the current user currentUser = CMSContext.CurrentUser; if (currentUser == null) { return; } // Check 'Read' permission if (currentUser.IsAuthorizedPerResource("cms.blog", "Read")) { readBlogs = true; } if (!RequestHelper.IsPostBack()) { this.drpBlogs.Items.Add(new ListItem(GetString("general.selectall"), "##ALL##")); this.drpBlogs.Items.Add(new ListItem(GetString("blog.selectmyblogs"), "##MYBLOGS##")); } // No cms.blog doc. type if (DataClassInfoProvider.GetDataClass("cms.blog") == null) { RedirectToInformation(GetString("blog.noblogdoctype")); } this.CurrentMaster.DisplaySiteSelectorPanel = true; gridBlogs.OnDataReload += gridBlogs_OnDataReload; gridBlogs.ZeroRowsText = GetString("general.nodatafound"); gridBlogs.ShowActionsMenu = true; gridBlogs.Columns = "BlogID, BlogName, NodeID, DocumentCulture"; // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); BlogInfo bi = new BlogInfo(); gridBlogs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.blogpost"); string classId = ""; StringBuilder script = new StringBuilder(); if (dci != null) { classId = dci.ClassID.ToString(); } // Get script to redirect to new blog post page script.Append("function NewPost(parentId, culture) {", " if (parentId != 0) {", " parent.parent.parent.location.href = \"", ResolveUrl("~/CMSDesk/default.aspx"), "?section=content&action=new&nodeid=\" + parentId + \"&classid=", classId, " &culture=\" + culture;", "}}"); // Generate javascript code ltlScript.Text = ScriptHelper.GetScript(script.ToString()); }
/// <summary> /// Load Columns names into listbox. /// </summary> protected void LoadFromDataClass() { // Get selected classes from hiddenfield. ArrayList classesList = new ArrayList(); ArrayList columnList = new ArrayList(); if (!string.IsNullOrEmpty(hdnClassNames.Value)) { classesList = new ArrayList(hdnClassNames.Value.Split(';')); } classesList.Add("CMS.Tree"); classesList.Add("CMS.Document"); // Fill columnList with column names from all classes. foreach (string className in classesList) { try { if (!String.IsNullOrEmpty(className)) { IDataClass dc = DataClassFactory.NewDataClass(className); DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(className); // Get columns only from couplet classes. if (dci.ClassIsCoupledClass) { foreach (string columnName in dc.StructureInfo.ColumnNames) { columnList.Add(columnName); } } } } catch { } } // Move columns from array list to string array and add indexes. string[,] columns = new string[columnList.Count, 2]; int index = 0; foreach (string columnName in columnList) { columns[index, 0] = index.ToString(); columns[index, 1] = columnName; index += 1; } ItemSelection1.LeftItems = columns; ItemSelection1.fill(); }
protected void Page_Load(object sender, EventArgs e) { currentUser = CMSContext.CurrentUser; if (currentUser == null) { return; } // No cms.blog doc. type if (DataClassInfoProvider.GetDataClass("cms.blog") == null) { RedirectToInformation(GetString("blog.noblogdoctype")); } // Check if user is authorized to manage isAuthorized = currentUser.IsAuthorizedPerResource("CMS.Blog", "Manage") || (currentUser.IsAuthorizedPerClassName("cms.blog", "Manage", CMSContext.CurrentSiteName) && currentUser.IsAuthorizedPerClassName("cms.blogpost", "Manage", CMSContext.CurrentSiteName)); gridBlogs.OnExternalDataBound += gridBlogs_OnExternalDataBound; gridBlogs.OnDataReload += gridBlogs_OnDataReload; gridBlogs.ShowActionsMenu = true; gridBlogs.Columns = "BlogID, ClassName, BlogName, NodeID, DocumentCulture, NodeOwner, BlogModerators"; // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); BlogInfo bi = new BlogInfo(); gridBlogs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); // Get ClassID of the 'cms.blogpost' class DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.blogpost"); string classId = ""; string script = ""; if (dci != null) { classId = dci.ClassID.ToString(); } // Get scritp to redirect to new blog post page script += "function NewPost(parentId, culture) { \n"; script += " if (parentId != 0) { \n"; script += " parent.parent.parent.location.href = \"" + ResolveUrl("~/CMSDesk/default.aspx") + "?section=content&action=new&nodeid=\" + parentId + \"&classid=" + classId + "&culture=\" + culture;"; script += "}} \n"; // Generate javascript code ltlScript.Text = ScriptHelper.GetScript(script); }
protected void Page_Load(object sender, EventArgs e) { gridLanguages.FilteredZeroRowsText = GetString("transman.nodocumentculture"); gridLanguages.OnDataReload += gridDocuments_OnDataReload; gridLanguages.OnExternalDataBound += gridLanguages_OnExternalDataBound; gridLanguages.ShowActionsMenu = true; gridLanguages.Columns = "DocumentName, Published"; IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); gridLanguages.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames), SqlHelperClass.MergeColumns(nodeClass.ColumnNames)); pnlContainer.Enabled = !DocumentManager.ProcessingAction; }
protected void Page_Load(object sender, EventArgs e) { // Get ID of node nodeId = QueryHelper.GetInteger("nodeid", 0); gridLanguages.FilteredZeroRowsText = GetString("transman.nodocumentculture"); gridLanguages.OnDataReload += gridDocuments_OnDataReload; gridLanguages.OnExternalDataBound += gridLanguages_OnExternalDataBound; gridLanguages.ShowActionsMenu = true; gridLanguages.Columns = "DocumentModifiedWhen, DocumentLastPublished, DocumentName, VersionNumber, Published"; IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); gridLanguages.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); }
protected void Page_Load(object sender, EventArgs e) { uniGrid.OnDataReload += uniGrid_OnDataReload; uniGrid.OnExternalDataBound += uniGrid_OnExternalDataBound; uniGrid.ShowActionsMenu = true; uniGrid.Columns = "NodeID, DocumentName, DocumentNamePath, DocumentCulture, DocumentModifiedWhen, ClassDisplayName, NodeChildNodesCount"; uniGrid.OnBeforeDataReload += uniGrid_OnBeforeDataReload; IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); uniGrid.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames), SqlHelperClass.MergeColumns(nodeClass.ColumnNames)); nodeId = QueryHelper.GetInteger("nodeid", 0); serverId = QueryHelper.GetInteger("serverid", 0); if (nodeId > 0) { TreeNode node = TreeProvider.SelectSingleNode(nodeId); if (node != null) { if (node.NodeParentID > 0) { lnkUpperDoc.Attributes["onclick"] = "parent.frames['tasksTree'].RefreshNode(" + node.NodeParentID + "," + node.NodeParentID + ");window.location.href='" + ResolveUrl("~/CMSModules/Staging/Tools/Tasks/DocumentsList.aspx?serverid=") + serverId + "&nodeid=" + node.NodeParentID + "'; return false;"; imgUpperDoc.ImageUrl = GetImageUrl("Design/Controls/Tree/folderup.png"); } else { lnkUpperDoc.Attributes["onclick"] = "return false"; imgUpperDoc.ImageUrl = GetImageUrl("Design/Controls/Tree/folderupdisabled.png"); } string closeLink = "<a href=\"#\"><span class=\"ListingClose\" style=\"cursor: pointer;\" " + "onclick=\"parent.frames['tasksHeader'].selectDocuments = false; window.location.href='" + ResolveUrl("~/CMSModules/Staging/Tools/Tasks/Tasks.aspx?serverid=") + serverId + "&nodeid=" + nodeId + "';" + "var completeObj = parent.frames['tasksHeader'].document.getElementById('pnlComplete');" + "if (completeObj != null){ completeObj.style.display = 'block'; }" + "return false;\">" + GetString("general.close") + "</span></a>"; string docNamePath = "<span class=\"ListingPath\">" + node.DocumentNamePath + "</span>"; lblListingInfo.Text = String.Format(GetString("synchronization.listinginfo"), docNamePath, closeLink); } } }
/// <summary> /// Load Columns names from Tree. /// </summary> protected void LoadFromDataClass(string classNames) { List <string> columnList = new List <string>(); List <string> classesList = new List <string>(); if (!string.IsNullOrEmpty(classNames)) { classesList = new List <string>(classNames.Split(';')); } // If more than 1 DataClasses are in classesList, get columns only from CMS.Tree and CMS.Document. //if (classesList.Count > 1) //{ // classesList = new List<string>(); //} classesList.Add("CMS.Tree"); classesList.Add("CMS.Document"); classesList.Add("CMS.Category"); // Fill columnList with column names from all classes. foreach (string className in classesList) { try { if (className != "") { IDataClass dc = DataClassFactory.NewDataClass(className); DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(className); // Get columns only from couplet classes. if (dci.ClassIsCoupledClass) { foreach (string columnName in dc.StructureInfo.ColumnNames) { columnList.Add(columnName); } } } } catch { } } // Set string array. mColumnList = columnList.ToArray(); }
public void RefreshDomain() { string cmd0 = "SELECT RDB$FIELDS.RDB$FIELD_NAME,RDB$FIELDS.RDB$CHARACTER_LENGTH,RDB$FIELDS.RDB$FIELD_SCALE,RDB$FIELD_PRECISION,RDB$FIELDS.RDB$FIELD_TYPE,RDB$FIELDS.RDB$DESCRIPTION,RDB$TYPES.RDB$TYPE_NAME FROM RDB$FIELDS"; string cmd1 = "LEFT JOIN RDB$TYPES ON RDB$TYPES.RDB$TYPE = RDB$FIELDS.RDB$FIELD_TYPE"; string where = "WHERE RDB$FIELDS.RDB$FIELD_NAME = '" + FieldObject.Domain + "' AND RDB$TYPES.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'"; string cmd = cmd0 + " " + cmd1 + " " + where + ";"; ConnectionClass cc = ConnectionPoolClass.Instance().GetConnection("C1"); cc.ShowExceptionMode = MessageLibrary.ShowError.no; DbDataReader dr = cc.ExecuteQuery(cmd, false); if (dr != null) { if (cc.HasRows()) { int n = 0; while (cc.Read()) { DomainObject = DataClassFactory.GetDataClass(StaticVariablesClass.DomainsKeyStr) as DomainClass; DomainObject.Name = cc.GetValue(0).ToString().Trim(); DomainObject.Length = StaticFunctionsClass.ToIntDef(cc.GetValue(1).ToString().Trim(), 0); DomainObject.Scale = StaticFunctionsClass.ToIntDef(cc.GetValue(2).ToString().Trim(), 0); DomainObject.Precision = StaticFunctionsClass.ToIntDef(cc.GetValue(3).ToString().Trim(), 0); DomainObject.TypeNumber = StaticFunctionsClass.ToIntDef(cc.GetValue(4).ToString().Trim(), 0); DomainObject.FieldType = cc.GetValue(6).ToString().Trim(); DomainObject.RawType = StaticVariablesClass.ConvertINTERNALType_TO_SQLType(DomainObject.FieldType, DomainObject.Length); object ob = cc.GetValue(5); DomainObject.Description = cc.GetValue(5).ToString().Trim(); /* * if (!string.IsNullOrEmpty(ob.ToString())) * { * byte[] bytetext = (byte[])cc.DBProvider.DataReader[3]; * DomainObject.Description = System.Text.Encoding.UTF8.GetString(bytetext); * } */ n++; } } cc.CloseConnection(); } }
protected void gridData_OnAction(string actionName, object actionArgument) { switch (actionName.ToLower()) { case "delete": CheckPermissions("DeleteData"); // Get record ID int formRecordID = ValidationHelper.GetInteger(actionArgument, 0); // Get BizFormInfo object if (bfi != null) { // Get class object if (dci != null) { // Get record object IDataClass formRecord = DataClassFactory.NewDataClass(dci.ClassName, formRecordID); if (!formRecord.IsEmpty()) { // Delete all files of the record BizFormInfoProvider.DeleteBizFormRecordFiles(dci.ClassFormDefinition, formRecord, CMSContext.CurrentSiteName); // Delete the form record formRecord.Delete(); // Update number of entries in BizFormInfo if (bfi != null) { BizFormInfoProvider.RefreshDataCount(bfi.FormName, bfi.FormSiteID); } } } } break; } }
/// <summary> /// Initializes the controls on the page. /// </summary> private void SetupControls() { lblBoardName.Text = GetString("board.boardlist.boardname"); btnFilter.Text = GetString("general.show"); gridBoards.IsLiveSite = IsLiveSite; gridBoards.GridName = (!string.IsNullOrEmpty(GridName)) ? GridName : "~/CMSModules/MessageBoards/Tools/Boards/Board_List.xml"; gridBoards.OrderBy = "BoardDisplayName ASC"; gridBoards.IsLiveSite = IsLiveSite; gridBoards.OnAction += gridBoards_OnAction; gridBoards.OnExternalDataBound += gridBoards_OnExternalDataBound; gridBoards.OnDataReload += gridBoards_OnDataReload; gridBoards.OnBeforeDataReload += gridBoards_OnBeforeDataReload; gridBoards.ZeroRowsText = GetString("general.nodatafound"); gridBoards.ShowActionsMenu = true; gridBoards.Columns = "BoardID, BoardDisplayName, BoardEnabled, BoardModerated, BoardMessages, BoardLastMessageTime, BoardDocumentID, BoardOpened, NodeID, NodeSiteID, DocumentNamePath, DocumentCulture, ClassName"; // Get all possible column names. IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); BoardInfo bi = new BoardInfo(); DocumentInfo di = new DocumentInfo(); gridBoards.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames), SqlHelperClass.MergeColumns(di.ColumnNames)), SqlHelperClass.MergeColumns(nodeClass.ColumnNames)); }
protected void Page_Load(object sender, EventArgs e) { UIContext.PropertyTab = PropertyTabEnum.LinkedDocs; nodeId = QueryHelper.GetInteger("nodeid", 0); currentSiteName = CMSContext.CurrentSiteName.ToLower(); tree = new TreeProvider(currentUser); node = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES, tree.CombineWithDefaultCulture, false); // Set edited document EditedDocument = node; gridDocs.OnExternalDataBound += gridDocuments_OnExternalDataBound; gridDocs.OnAction += gridDocs_OnAction; gridDocs.OnDataReload += gridDocs_OnDataReload; gridDocs.ShowActionsMenu = true; gridDocs.Columns = "NodeAliasPath, SiteName, NodeParentID, DocumentName, DocumentNamePath, ClassDisplayName"; // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); gridDocs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); }
public string CreateUpdateLoginUserinKentico(string username, string firstname, string lastname, string email, string groupNames, bool memberflag, bool orgflag, string customerIdentifier, string customerToken) { string UserCreated = ""; try { UserInfo userUpdate = CMS.Membership.UserInfoProvider.GetUserInfo(username); if (!(userUpdate != null)) { UserInfo user = new UserInfo(); user.UserName = username; user.FirstName = firstname; user.LastName = lastname; user.FullName = firstname + " " + lastname; user.Email = email; user.SetPersonifyIdentifier(customerIdentifier); user.SetLastCustomerToken(customerToken); // user.IsEditor = false; user.PreferredCultureCode = "en-us"; user.PasswordFormat = "SHA1"; user.Enabled = true; //user.IsExternal = true; CMS.Membership.UserInfoProvider.SetUserInfo(user); CMS.Membership.UserInfoProvider.SetPassword(username, username); UserInfoProvider.AddUserToSite(username, CMS.SiteProvider.SiteContext.CurrentSiteName); UserCreated = "UserName: "******"<br/> " + "Password: "******": "; } else { //UpdateUserinKentico(userUpdate); //string shaPass = CalculateSHA1("", Encoding.ASCII); //string kenticoPass = userUpdate.GetValue("UserPassword").ToString(); // if (kenticoPass != shaPass) // { IDataClass userObj = DataClassFactory.NewDataClass("cms.user", userUpdate.UserID); string userName = (string)userObj.GetValue("username"); userObj.SetValue("UserName", userUpdate.UserName.ToString()); // userObj.SetValue("UserPassword", GenerateSHA1(username.ToString())); userObj.SetValue("FirstName", firstname); userObj.SetValue("LastName", lastname); userObj.SetValue("FullName", firstname + " " + lastname); userObj.SetValue("Email", email); userObj.SetValue("PersonifyIdentifier", customerIdentifier); userObj.SetValue("LastCustomerToken", customerToken); userObj.Update(); UserCreated = "UserName: "******"<br/> " + "Password: "******": "; //} } UserInfo userNew = CMS.Membership.UserInfoProvider.GetUserInfo(username); // groups(userNew, groupNames); ///add user to roles for protection purposes AddUserToRole(userNew, groupNames, memberflag, orgflag); //login User too UserCreated = LoginUserinKentico(userNew.UserName); return(UserCreated); } catch (Exception ex) { //delete user if created EventLogProvider.LogException("CreateUpdateUserinKentico", "Get", ex); return(null); } }
/// <summary> /// Page load. /// </summary> protected void Page_Load(object sender, EventArgs e) { ScriptHelper.RegisterScriptFile(this, @"~/CMSModules/Content/CMSDesk/View/Listing.js"); currentSiteName = CMSContext.CurrentSiteName; currentUserInfo = CMSContext.CurrentUser; // Current Node ID nodeId = QueryHelper.GetInteger("nodeid", 0); // Setup page title text and image CurrentMaster.Title.TitleText = GetString("Content.ListingTitle"); CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Content/Menu/Listing.png"); CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.Title.HelpTopicName = "list_tab"; string[,] actions = new string[1, 6]; actions[0, 0] = HeaderActions.TYPE_HYPERLINK; actions[0, 1] = GetString("Listing.ParentDirectory"); actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/Listing/parent.png"); CurrentMaster.HeaderActions.Actions = actions; if (nodeId > 0) { tree = new TreeProvider(currentUserInfo); checkPermissions = tree.CheckDocumentUIPermissions(currentSiteName); node = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES); // Set edited document EditedDocument = node; if (node != null) { if (currentUserInfo.IsAuthorizedPerDocument(node, NodePermissionsEnum.ExploreTree) != AuthorizationResultEnum.Allowed) { RedirectToCMSDeskAccessDenied("CMS.Content", "exploretree"); } aliasPath = node.NodeAliasPath; // Setup the link to the parent document if ((node.NodeClassName.ToLower() != "cms.root") && (currentUserInfo.UserStartingAliasPath.ToLower() != node.NodeAliasPath.ToLower())) { CurrentMaster.HeaderActions.Actions[0, 3] = "javascript:SelectItem(" + node.NodeParentID + ");"; } else { CurrentMaster.HeaderActions.Visible = false; CurrentMaster.PanelBody.FindControl("pnlActions").Visible = false; } } ScriptHelper.RegisterProgress(this); ScriptHelper.RegisterDialogScript(this); ScriptHelper.RegisterJQuery(this); InitDropdowLists(); cultureElem.DropDownCultures.Width = 222; // Prepare JavaScript for actions StringBuilder actionScript = new StringBuilder(); actionScript.Append( @"function PerformAction(selectionFunction, selectionField, dropId){ var label = document.getElementById('" + lblInfo.ClientID + @"'); var whatDrp = document.getElementById('" + drpWhat.ClientID + @"'); var action = document.getElementById(dropId).value; var selectionFieldElem = document.getElementById(selectionField); var allSelected = " + (int)What.SelectedDocuments + @"; if (action == '" + (int)Action.SelectAction + @"'){ label.innerHTML = '" + GetString("massaction.selectsomeaction") + @"'; return false; } if(whatDrp.value == '" + (int)What.AllDocuments + @"'){ allSelected = " + (int)What.AllDocuments + @"; } var items = selectionFieldElem.value; if(!eval(selectionFunction) || whatDrp.value == '" + (int)What.AllDocuments + @"'){ var argument = '|' + allSelected + '|' + items; switch(action){ case '" + (int)Action.Move + @"': argument = '" + Action.Move + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @"; break; case '" + (int)Action.Copy + @"': argument = '" + Action.Copy + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @"; break; case '" + (int)Action.Link + @"': argument = '" + Action.Link + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @"; break; case '" + (int)Action.Delete + @"': argument = '" + Action.Delete + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @"; break; case '" + (int)Action.Publish + @"': argument = '" + Action.Publish + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @"; break; case '" + (int)Action.Archive + @"': argument = '" + Action.Archive + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @"; break; default: return false; } } else{ label.innerHTML = '" + GetString("documents.selectdocuments") + @"'; } return false; } function OpenModal(arg, context){ modalDialog(arg,'actionDialog','90%', '85%'); } function Redirect(arg, context){ document.location.replace(arg); }"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "actionScript", ScriptHelper.GetScript(actionScript.ToString())); // Add action to button btnOk.OnClientClick = "return PerformAction('" + gridDocuments.GetCheckSelectionScript() + "','" + gridDocuments.GetSelectionFieldClientID() + "','" + drpAction.ClientID + "');"; // Initialize dropdown lists if (!RequestHelper.IsPostBack()) { drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString())); drpAction.Items.Add(new ListItem(GetString("general." + Action.Move), Convert.ToInt32(Action.Move).ToString())); drpAction.Items.Add(new ListItem(GetString("general." + Action.Copy), Convert.ToInt32(Action.Copy).ToString())); drpAction.Items.Add(new ListItem(GetString("general." + Action.Link), Convert.ToInt32(Action.Link).ToString())); drpAction.Items.Add(new ListItem(GetString("general." + Action.Delete), Convert.ToInt32(Action.Delete).ToString())); if (currentUserInfo.IsGlobalAdministrator || currentUserInfo.IsAuthorizedPerResource("CMS.Content", "ManageWorkflow")) { drpAction.Items.Add(new ListItem(GetString("general." + Action.Publish), Convert.ToInt32(Action.Publish).ToString())); drpAction.Items.Add(new ListItem(GetString("general." + Action.Archive), Convert.ToInt32(Action.Archive).ToString())); } drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.SelectedDocuments), Convert.ToInt32(What.SelectedDocuments).ToString())); drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.AllDocuments), Convert.ToInt32(What.AllDocuments).ToString())); } // Setup the grid gridDocuments.OnExternalDataBound += gridDocuments_OnExternalDataBound; gridDocuments.OnBeforeDataReload += gridDocuments_OnBeforeDataReload; gridDocuments.OnDataReload += gridDocuments_OnDataReload; gridDocuments.ZeroRowsText = GetString("content.nochilddocumentsfound"); gridDocuments.ShowActionsMenu = true; if (node != null) { gridDocuments.WhereCondition = "NodeParentID = " + node.NodeID + " AND NodeLevel = " + (node.NodeLevel + 1); } // Initialize columns string columns = @"DocumentLastVersionName, DocumentName, NodeParentID, ClassDisplayName, DocumentModifiedWhen, Published, DocumentLastVersionNumber, DocumentMenuRedirectURL, DocumentLastVersionMenuRedirectUrl, DocumentIsArchived, DocumentCheckedOutByUserID, DocumentPublishedVersionHistoryID, DocumentWorkflowStepID, DocumentCheckedOutVersionHistoryID, DocumentNamePath, DocumentPublishFrom, DocumentType, DocumentLastVersionType, NodeAliasPath"; if (checkPermissions) { columns = SqlHelperClass.MergeColumns(columns, TreeProvider.SECURITYCHECK_REQUIRED_COLUMNS); } gridDocuments.Columns = columns; StringBuilder refreshScripts = new StringBuilder(); refreshScripts.Append( @"function RefreshTree() { if((parent != null) && (parent.parent != null) && (parent.parent.frames['contenttree'] != null) && (parent.parent.frames['contenttree'].RefreshNode != null)) { parent.parent.frames['contenttree'].RefreshNode(", nodeId, @",", nodeId, @"); } } function ClearSelection() { ", gridDocuments.GetClearSelectionScript(), @" } function RefreshGrid() { ClearSelection(); RefreshTree();", ClientScript.GetPostBackEventReference(btnShow, "null"), @" }"); // Register refresh scripts string refreshScript = ScriptHelper.GetScript(refreshScripts.ToString()); ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "refreshListing", refreshScript); // Get all possible columns to retrieve IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree"); DocumentInfo di = new DocumentInfo(); gridDocuments.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray())); } }
/// <summary> /// Reloads control with new data. /// </summary> private void ReloadData() { tblDocument.Rows.Clear(); DataClassInfo ci = DataClassInfoProvider.GetDataClass(Node.NodeClassName); if (ci != null) { fi = FormHelper.GetFormInfo(ci.ClassName, false); TableHeaderCell labelCell = new TableHeaderCell(); TableHeaderCell valueCell = null; TableHeaderCell valueCompare = null; // Add header column with version number if (CompareNode == null) { labelCell.Text = GetString("General.FieldName"); labelCell.EnableViewState = false; valueCell = new TableHeaderCell(); valueCell.EnableViewState = false; valueCell.Text = GetString("General.Value"); // Add table header AddRow(labelCell, valueCell, "UniGridHead", false); } else { labelCell.Text = GetString("lock.versionnumber"); valueCell = GetRollbackTableHeaderCell("source", Node.DocumentID, versionHistoryId); valueCompare = GetRollbackTableHeaderCell("compare", CompareNode.DocumentID, versionCompare); // Add table header AddRow(labelCell, valueCell, valueCompare, true, "UniGridHead", false); } if (ci.ClassIsCoupledClass) { // Add coupled class fields IDataClass coupleClass = DataClassFactory.NewDataClass(Node.NodeClassName); if (coupleClass != null) { foreach (string col in coupleClass.StructureInfo.ColumnNames) { // If comparing with other version and current coupled column is not versioned do not display it if (!((CompareNode != null) && !(VersionManager.IsVersionedCoupledColumn(Node.NodeClassName, col)))) { AddField(Node, CompareNode, col); } } } } // Add versioned document class fields IDataClass docClass = DataClassFactory.NewDataClass("cms.document"); if (docClass != null) { foreach (string col in docClass.StructureInfo.ColumnNames) { // If comparing with other version and current document column is not versioned do not display it // One exception is DocumentNamePath column which will be displayed even if it is not marked as a versioned column if (!((CompareNode != null) && (!(VersionManager.IsVersionedDocumentColumn(col) || (col.ToLower() == "documentnamepath"))))) { AddField(Node, CompareNode, col); } } } // Add versioned document class fields IDataClass treeClass = DataClassFactory.NewDataClass("cms.tree"); if (treeClass != null) { foreach (string col in treeClass.StructureInfo.ColumnNames) { // Do not display cms_tree columns when comparing with other version // cms_tree columns are not versioned if (CompareNode == null) { AddField(Node, CompareNode, col); } } } // Add unsorted attachments to the table AddField(Node, CompareNode, UNSORTED); } }