protected string GetVersionEditUrl(object row) { var view = (DataRowView)row; var qsp = new QueryStringParameters(); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", view["adminType"]); qsp.Add("versionid", view["ItemVersionId"]); // todo: why would we need modid on the URL for editing a version? // qsp.Add("modid", view["ModuleId"]); return this.BuildLinkUrl(qsp.ToString()); }
private string BuildSortUrl() { var qsp = new QueryStringParameters(); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "categorysort"); qsp.Add("windowClose", "true"); qsp.Add("itemid", this.ddlCategory.SelectedValue); return Globals.NavigateURL(this.TabId, string.Empty, qsp.ToString()); }
private void BindData() { int itemId = Convert.ToInt32(this.cboItemType.SelectedValue, CultureInfo.InvariantCulture); if (this.CategoryId > -1) { // user clicked on a subcategory. itemId = this.CategoryId; } // set the approval status ID to approved by default, if we're using approvals look for the selected value int approvalStatusId = ApprovalStatus.Approved.GetId(); if (this.UseApprovals) { approvalStatusId = Convert.ToInt32(this.cboWorkflow.SelectedValue, CultureInfo.InvariantCulture); } var qsp = new QueryStringParameters(); DataSet ds; if (this.txtArticleSearch.Text.Trim() != string.Empty) { var objSecurity = new PortalSecurity(); string searchKey = objSecurity.InputFilter(this.txtArticleSearch.Text.Trim(), PortalSecurity.FilterFlag.NoSQL); ds = itemId == -1 ? DataProvider.Instance().GetAdminItemListingSearchKey( TopLevelCategoryItemType.Category.GetId(), ItemType.Category.GetId(), RelationshipType.CategoryToTopLevelCategory.GetId(), RelationshipType.ItemToRelatedCategory.GetId(), approvalStatusId, " vi.createddate desc ", searchKey, this.PortalId) : DataProvider.Instance().GetAdminItemListingSearchKey( itemId, ItemType.Category.GetId(), RelationshipType.ItemToParentCategory.GetId(), RelationshipType.ItemToRelatedCategory.GetId(), approvalStatusId, " vi.createddate desc ", searchKey, this.PortalId); } else { ds = itemId == -1 ? DataProvider.Instance().GetAdminItemListing( TopLevelCategoryItemType.Category.GetId(), ItemType.Category.GetId(), RelationshipType.CategoryToTopLevelCategory.GetId(), approvalStatusId, this.PortalId) : DataProvider.Instance().GetAdminItemListing( itemId, ItemType.Category.GetId(), RelationshipType.ItemToParentCategory.GetId(), RelationshipType.ItemToRelatedCategory.GetId(), approvalStatusId, this.PortalId); } DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { var t = new Table { Width = Unit.Percentage(100), CssClass = "Normal", CellPadding = 4, CellSpacing = 0, GridLines = GridLines.Horizontal, BorderColor = Color.Gray, BorderStyle = BorderStyle.Solid, BorderWidth = Unit.Pixel(1) }; var row = new TableRow { CssClass = "listing_table_head_row" }; t.Rows.Add(row); var cell = new TableCell(); row.Cells.Add(cell); cell.Text = Localization.GetString("ID", this.LocalResourceFile); cell = new TableCell(); row.Cells.Add(cell); cell.Text = Localization.GetString("Name", this.LocalResourceFile); cell = new TableCell(); row.Cells.Add(cell); cell.Text = Localization.GetString("Description", this.LocalResourceFile); cell = new TableCell(); row.Cells.Add(cell); cell.Text = " "; cell = new TableCell(); row.Cells.Add(cell); cell.Text = " "; cell = new TableCell(); row.Cells.Add(cell); cell.Text = " "; cell = new TableCell(); row.Cells.Add(cell); cell.Text = " "; cell = new TableCell(); row.Cells.Add(cell); cell.Text = " "; for (int i = 0; i < dt.Rows.Count; i++) { DataRow r = dt.Rows[i]; row = new TableRow { CssClass = i % 2 == 0 ? "adminItemSearchDarkRow" : "adminItemSearchLightRow", VerticalAlign = VerticalAlign.Top }; t.Rows.Add(row); cell = new TableCell(); row.Cells.Add(cell); cell.Text = r["ItemID"].ToString(); cell = new TableCell(); row.Cells.Add(cell); cell.Text = r["Name"].ToString(); cell = new TableCell(); row.Cells.Add(cell); cell.Text = HtmlUtils.Shorten(HtmlUtils.Clean(r["Description"].ToString(), true), 200, string.Empty) + " "; cell = new TableCell(); row.Cells.Add(cell); // check if the category has any sub categories, if not don't display link var hl = new HyperLink(); if (Convert.ToInt32(r["ChildCount"], CultureInfo.InvariantCulture) > 0) { cell.Controls.Add(hl); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "categorylist"); qsp.Add("itemId", r["ItemId"]); // qsp.Add("category", r["Name"]); qsp.Add("parentId", itemId); if (this.TopLevelId == -1) { qsp.Add("topLevelId", this.cboItemType.SelectedValue); } else { qsp.Add("topLevelId", this.TopLevelId); } hl.NavigateUrl = this.BuildLinkUrl(qsp.ToString()); hl.Text = Localization.GetString("SubCategories", this.LocalResourceFile); } else { var l1 = new Label { Text = " <br /> " }; cell.Controls.Add(l1); } // Add the CategorySort link cell = new TableCell(); row.Cells.Add(cell); hl = new HyperLink(); cell.Controls.Add(hl); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "categorysort"); qsp.Add("itemid", r["ItemId"]); hl.NavigateUrl = this.BuildLinkUrl(qsp.ToString()); hl.Text = Localization.GetString("CategorySort", this.LocalResourceFile); cell = new TableCell(); row.Cells.Add(cell); cell = new TableCell(); row.Cells.Add(cell); hl = new HyperLink(); cell.Controls.Add(hl); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "versionslist"); qsp.Add("itemid", r["ItemId"]); hl.NavigateUrl = this.BuildLinkUrl(qsp.ToString()); hl.Text = Localization.GetString("Versions", this.LocalSharedResourceFile); cell = new TableCell(); row.Cells.Add(cell); hl = new HyperLink(); cell.Controls.Add(hl); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "categoryEdit"); qsp.Add("versionid", r["ItemVersionId"]); // qsp.Add("modid", r["ModuleId"]); qsp.Add("parentId", itemId); if (this.TopLevelId == -1) { qsp.Add("topLevelId", this.cboItemType.SelectedValue); } else { qsp.Add("topLevelId", this.TopLevelId); } hl.NavigateUrl = this.BuildLinkUrl(qsp.ToString()); hl.Text = Localization.GetString("Edit", this.LocalResourceFile); } this.phList.Controls.Add(t); if (!this.cboItemType.SelectedValue.Equals("-1")) { this.lblMessage.Text = Localization.GetString("SubCategoriesFor", this.LocalResourceFile) + " " + this.cboItemType.SelectedItem; } } else { if (!this.cboItemType.SelectedValue.Equals("-1")) { this.lblMessage.Text = Localization.GetString("NoSubcategoriesFor", this.LocalResourceFile) + " " + this.cboItemType.SelectedItem; } } }
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { // there is no parent category to display for Top Level items - BD if (this.ddlCategory.SelectedValue == "-1") { this.lblShowParent.Visible = false; this.chkShowParent.Visible = false; this.chkShowParentDescription.Visible = false; this.lblShowParentDescription.Visible = false; } else { this.lblShowParent.Visible = true; this.chkShowParent.Visible = true; this.chkShowParentDescription.Visible = true; this.lblShowParentDescription.Visible = true; } var qsp = new QueryStringParameters(); qsp.ClearKeys(); qsp.Add("ctl", Utility.AdminContainer); qsp.Add("mid", this.ModuleId.ToString(CultureInfo.InvariantCulture)); qsp.Add("adminType", "categorysort"); qsp.Add("itemid", this.ddlCategory.SelectedValue); this.lnkSortCategory.NavigateUrl = this.BuildSortUrl(); }