public override void ApplyChanges() { SimpleListView simpleListView = (SimpleListView)this.ParentToolPane.SelectedWebPart; simpleListView.ListToDisplay = ddlList.SelectedValue; if (rdButtons.SelectedValue == "Yes") { simpleListView.IsExternalList = true; } else { simpleListView.IsExternalList = false; } }
protected override void CreateChildControls() { try { Table table = new Table(); this.webPart = (SimpleListView)this.ParentToolPane.SelectedWebPart; lblListToDisplay = new Label(); lblViewerPageUrl = new Label(); if (SPContext.Current.Web.Url.ToLower().Contains("/eng/")) { lblListToDisplay.Text = "List to Display:"; lblViewerPageUrl.Text = "Url of the Item Viewer Page:"; } else { lblListToDisplay.Text = "Liste à afficher:"; lblViewerPageUrl.Text = "Url de la page de visionneur d'item:"; } try { if (webPart.ListId != null) { using (SPSite site = new SPSite(SPContext.Current.Site.Url)) { using (SPWeb web = site.OpenWeb(webPart.ListWebId)) { SPList selList = web.Lists[webPart.ListId]; txtListTitle.Text = selList.Title; ddlViews = new DropDownList(); foreach (SPView view in selList.Views) { ListItem item = new ListItem(view.Title); if (webPart.ViewName != string.Empty && view.Title.Equals(webPart.ViewName)) { item.Selected = true; } ddlViews.Items.Add(item); } } } } } catch (Exception ex) { LogEngine.Log(ex, "Accessible Lists"); } lblListToDisplay.Font.Bold = true; lblViewerPageUrl.Font.Bold = true; toolPartPanel = new Panel(); this.txtListTitle.ID = "txtEntityPath"; this.txtListTitle.CssClass = "UserInput"; this.txtListTitle.Style.Add("margin", "4px 0 0 0"); btnList = new Button(); btnList.CssClass = "UserButton"; btnList.OnClientClick = String.Format("LaunchPickerTreeDialog('CbqPickerSelectListTitle','CbqPickerSelectListText','{0}','', '{1}', null,'','','/_layouts/images/smt_icon.gif','', callback, ''); return false;", "listsOnly", SPContext.Current.Web.Url); btnList.Text = "..."; txtItemViewerUrl = new TextBox(); if (webPart.ItemViewerUrl != null) { txtItemViewerUrl.Text = webPart.ItemViewerUrl; } TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(lblListToDisplay); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(txtListTitle); cell.Controls.Add(btnList); row.Cells.Add(cell); table.Rows.Add(row); if (ddlViews != null) { row = new TableRow(); cell = new TableCell(); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(ddlViews); row.Cells.Add(cell); table.Rows.Add(row); } row = new TableRow(); cell = new TableCell(); cell.Controls.Add(lblViewerPageUrl); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(txtItemViewerUrl); row.Cells.Add(cell); table.Rows.Add(row); toolPartPanel.Controls.Add(hdnListIdentifier); toolPartPanel.Controls.Add(table); Controls.Add(toolPartPanel); base.CreateChildControls(); } catch (Exception ex) { LogEngine.Log(ex, "Accessible Lists"); } }
protected override void CreateChildControls() { try { Table table = new Table(); this.webPart = (SimpleListView)this.ParentToolPane.SelectedWebPart; lblListToDisplay = new Label(); lblViewerPageUrl = new Label(); if (SPContext.Current.Web.Url.ToLower().Contains("/eng/")) { lblListToDisplay.Text = "List to Display:"; lblViewerPageUrl.Text = "Url of the Item Viewer Page:"; } else { lblListToDisplay.Text = "Liste à afficher:"; lblViewerPageUrl.Text = "Url de la page de visionneur d'item:"; } try { if (webPart.ListId != null) { using (SPSite site = new SPSite(SPContext.Current.Site.Url)) { using (SPWeb web = site.OpenWeb(webPart.ListWebId)) { SPList selList = web.Lists[webPart.ListId]; txtListTitle.Text = selList.Title; ddlViews = new DropDownList(); foreach (SPView view in selList.Views) { ListItem item = new ListItem(view.Title); if (webPart.ViewName != string.Empty && view.Title.Equals(webPart.ViewName)) item.Selected = true; ddlViews.Items.Add(item); } } } } } catch (Exception ex) { LogEngine.Log(ex, "Accessible Lists"); } lblListToDisplay.Font.Bold = true; lblViewerPageUrl.Font.Bold = true; toolPartPanel = new Panel(); this.txtListTitle.ID = "txtEntityPath"; this.txtListTitle.CssClass = "UserInput"; this.txtListTitle.Style.Add("margin", "4px 0 0 0"); btnList = new Button(); btnList.CssClass = "UserButton"; btnList.OnClientClick = String.Format("LaunchPickerTreeDialog('CbqPickerSelectListTitle','CbqPickerSelectListText','{0}','', '{1}', null,'','','/_layouts/images/smt_icon.gif','', callback, ''); return false;", "listsOnly", SPContext.Current.Web.Url); btnList.Text = "..."; txtItemViewerUrl = new TextBox(); if (webPart.ItemViewerUrl != null) txtItemViewerUrl.Text = webPart.ItemViewerUrl; TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(lblListToDisplay); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(txtListTitle); cell.Controls.Add(btnList); row.Cells.Add(cell); table.Rows.Add(row); if (ddlViews != null) { row = new TableRow(); cell = new TableCell(); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(ddlViews); row.Cells.Add(cell); table.Rows.Add(row); } row = new TableRow(); cell = new TableCell(); cell.Controls.Add(lblViewerPageUrl); row.Cells.Add(cell); cell = new TableCell(); cell.Controls.Add(txtItemViewerUrl); row.Cells.Add(cell); table.Rows.Add(row); toolPartPanel.Controls.Add(hdnListIdentifier); toolPartPanel.Controls.Add(table); Controls.Add(toolPartPanel); base.CreateChildControls(); } catch (Exception ex) { LogEngine.Log(ex, "Accessible Lists"); } }