public override void ToUControl(UControl container, WC.CommandEventHandler handler, string navigateUrl = null) { // see Controls TreeNavigatorControl tn = new TreeNavigatorControl(storedHierarchyData, actions); tn.ActionChosen += handler; container.Controls.Add(tn); }
private void AddSubmenuForItem(HierarchyRow row, WC.MenuItem item) { DataRow[] children = row.GetChildRows("Hierarchy"); WC.MenuItem childItem; foreach (HierarchyRow child in children) { childItem = new WC.MenuItem(child.Caption, null, null, "/" + ((CE.GlobalState == GlobalState.Administer) ? "admin/" : "architect/show/") + CE.project.Name + "/" + child.NavId.ToString()); item.ChildItems.Add(childItem); AddSubmenuForItem(child, childItem); } }
// when creating the main project menu, the control is passed a MenuHandler // instead of Event handler and is created specially for this puropose public void ToUControl(UControl container, WC.MenuEventHandler handler, string navigateUrl = null) { if(panel.type != PanelTypes.MenuDrop) throw new ArgumentException( "MenuEventHandler can operate only on a Menu - within a MenuDrop panel"); WC.Menu res = new CssMenu(); res.RenderingMode = MenuRenderingMode.Table; //res.CssClass = "inMenu"; res.StaticEnableDefaultPopOutImage = false; res.DynamicEnableDefaultPopOutImage = false; res.Orientation = WC.Orientation.Horizontal; res.StaticSubMenuIndent = 0; WC.MenuItem item; foreach (HierarchyRow r in storedHierarchyData.Rows) { if (r.ParentId == null) // root nodes first { item = new WC.MenuItem(r.Caption, null, null, "/" + ((CE.GlobalState == GlobalState.Administer) ? "admin/" : "architect/show/") + CE.project.Name + "/" + r.NavId.ToString()); AddSubmenuForItem(r, item); res.Items.Add(item); } } res.MenuItemClick += handler; res.ID = "Control" + controlId; res.CssClass = "inMenu"; WC.Panel cleaner = new WC.Panel(); container.Controls.Add(res); cleaner.CssClass = "clear"; container.Controls.Add(cleaner); }
public virtual void ToUControl(UControl container, WC.GridViewCommandEventHandler handler, WC.GridViewPageEventHandler pagingHandler, WC.GridViewSortEventHandler sortingHandler, string navigateUrl = null) { // take care of all the dependant controls as well WC.GridView grid = new WC.GridView(); string[] DataKeyNames = PKColNames.ToArray(); if (CE.GlobalState == GlobalState.Administer) { // one of our datakeys may have been a FK and its value is now the representative field of the // foreign table, not our key, but in such cases the key will be stored in a prefixed column. for (int i = 0; i < DataKeyNames.Length; i++) { FK fk = FKs.Where(x => x.myColumn == DataKeyNames[i]).FirstOrDefault(); if (fk is FK) { DataKeyNames[i] = CC.TABLE_COLUMN_REAL_VALUE_PREFIX + DataKeyNames[i]; } } } grid.DataKeyNames = DataKeyNames; grid.AutoGenerateColumns = false; WC.TemplateField tf = new WC.TemplateField(); tf.HeaderTemplate = new SummaryGridCommandColumn(WC.ListItemType.Header); tf.FooterTemplate = new SummaryGridCommandColumn(WC.ListItemType.Footer); tf.ItemTemplate = new SummaryGridCommandColumn(WC.ListItemType.Item, actions); grid.Columns.Add(tf); foreach (string col in displayColumns) { WC.BoundField bf = new WC.BoundField(); bf.DataField = col; bf.HeaderText = col + " [-]"; bf.SortExpression = col; grid.Columns.Add(bf); } // must contain the whole PK even if it is not displayed - for the navigator // DataKeyNames are the real ones - including "_" prefixing foreach (string col in DataKeyNames) { if (displayColumns.Contains(col)) continue; WC.BoundField bf = new WC.BoundField(); bf.DataField = col; bf.Visible = false; grid.Columns.Add(bf); bf.HeaderText = col; } grid.AllowSorting = true; //grid.EnableSortingAndPagingCallbacks = true; //grid.PageSize = 15; //grid.PageIndex = 0; container.Controls.Add(grid); grid.PagerStyle.CssClass = "navTablePaging"; grid.CssClass = "navTable"; grid.AllowPaging = true; grid.PageSize = 25; grid.PageIndexChanging += pagingHandler; grid.Sorting += sortingHandler; grid.DataSource = data.DefaultView; grid.DataBind(); /* foreach(WC.DataControlField f in grid.Columns){ if (f is WC.BoundField) { WC.BoundField bf = (WC.BoundField)f; if (!displayColumns.Contains(bf.DataField)) f.Visible = false; } }*/ grid.RowCommand += handler; grid.ID = "Control" + controlId; }
public virtual void ToUControl(UControl container, WC.CommandEventHandler handler, string navigateUrl = null) { WC.Button button = new WC.Button(); button.Text = this.action.ToString(); button.CommandName = "_" + action.ToString(); button.Command += (WC.CommandEventHandler)handler; if (action == UserAction.Delete) button.OnClientClick = "return confirm('Really?')"; button.ID = "Control" + controlId; container.Controls.Add(button); }
public void ShowForm(WC.Panel panel) { WC.Table formTbl = new WC.Table(); WC.TableCell mainPathLabel = new WC.TableCell(); mainPathLabel.Text = "Full size image directory"; WC.TableCell thumbPathLabel = new WC.TableCell(); thumbPathLabel.Text = "Thumbnail image directory"; WC.TableCell mainWidthLabel = new WC.TableCell(); mainWidthLabel.Text = "Maximum width for the main image"; WC.TableCell thumbWidthLabel = new WC.TableCell(); thumbWidthLabel.Text = "Maximum width for the thumbnail"; WC.TableCell useThumbsLabel = new WC.TableCell(); useThumbsLabel.Text = "Use thumbnails"; WC.TableCell targetFormatLabel = new WC.TableCell(); targetFormatLabel.Text = "Convert images to format"; WC.TableCell mainPathCell = new WC.TableCell(); mainPathCell.Controls.Add(mainPathBox); WC.TableCell thumbPathCell = new WC.TableCell(); thumbPathCell.Controls.Add(thumbPathBox); WC.TableCell mainWidthCell = new WC.TableCell(); mainWidthCell.Controls.Add(fullWidthBox); WC.TableCell thumbWidthCell = new WC.TableCell(); thumbWidthCell.Controls.Add(thumbWidthBox); WC.TableCell useThumbsCell = new WC.TableCell(); useThumbsCell.Controls.Add(useThumbsCheck); WC.TableCell targetFormatCell = new WC.TableCell(); targetFormatCell.Controls.Add(targetFormatRadios); WC.TableRow r1 = new WC.TableRow(); r1.Cells.Add(mainPathLabel); r1.Cells.Add(mainPathCell); formTbl.Rows.Add(r1); WC.TableRow r2 = new WC.TableRow(); r2.Cells.Add(thumbPathLabel); r2.Cells.Add(thumbPathCell); formTbl.Rows.Add(r2); WC.TableRow r3 = new WC.TableRow(); r3.Cells.Add(mainWidthLabel); r3.Cells.Add(mainWidthCell); formTbl.Rows.Add(r3); WC.TableRow r4 = new WC.TableRow(); r4.Cells.Add(thumbWidthLabel); r4.Cells.Add(thumbWidthCell); formTbl.Rows.Add(r4); WC.TableRow r5 = new WC.TableRow(); r5.Cells.Add(useThumbsLabel); r5.Cells.Add(useThumbsCell); formTbl.Rows.Add(r5); WC.TableRow r6 = new WC.TableRow(); r6.Cells.Add(targetFormatLabel); r6.Cells.Add(targetFormatCell); formTbl.Rows.Add(r6); targetFormatRadios.DataSource = Enum.GetValues(typeof(TargetImageFormat)); targetFormatRadios.DataBind(); panel.Controls.Add(formTbl); }
private IEnumerable<Column> GetSelectedColumns(WebControls.ListView listView) { var cols = new List<Column>(); if (listView == null) return cols; foreach (var c in listView.Items) { var cb = c.FindControl("cbField") as CheckBox; var tb = c.FindControl("tbWidth") as TextBox; var ha = c.FindControl("ddHAlign") as DropDownList; var wm = c.FindControl("ddWrap") as DropDownList; var lblFullName = c.FindControl("lblColumnFullName") as Label; var ind = c.FindControl("ddIndex") as DropDownList; if ((cb == null) || !cb.Checked || lblFullName == null) continue; var query = from FieldSetting f in AvailableFields where f.FullName == lblFullName.Text select f; if (query.Count() <= 0) continue; var fs = query.First(); var newcol = new Column { Title = (string.IsNullOrEmpty(fs.DisplayName) ? fs.Name : fs.DisplayName), FullName = fs.FullName, BindingName = fs.BindingName, Index = ind != null ? Convert.ToInt32(ind.SelectedValue) : 1 }; if (tb != null) { var colWidth = 0; if (int.TryParse(tb.Text, out colWidth)) newcol.Width = colWidth; } if (ha != null) { newcol.HorizontalAlign = ha.SelectedValue; } if (wm != null) { newcol.Wrap = wm.SelectedValue; } //TODO: refactor this if (fs.BindingName == "GenericContent_DisplayName" || fs.BindingName == "GenericContent_Title" || fs.BindingName == "GenericContent_Name" || fs.BindingName == "ContentType_DisplayName" || fs.BindingName == "ContentType_Title" || fs.BindingName == "ContentType_Name") { newcol.IsLeadColumn = true; newcol.Icon = fs.Icon; } cols.Add(newcol); } return cols; }