예제 #1
0
        internal JsonDialog Render()
        {
            var result = new JsonDialog();
            var writer = new HtmlTextWriter();

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            //writer.AddStyleAttribute(HtmlTextWriterStyle.Width, (fGrid.fHierarchyEditorStyle.Width + 4).ToString() + "px");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            result.title = RadarUtils.GetResStr("repHierarhyEditor") + ": " + fHierarchy.DisplayName;

            // context filter
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "2px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("<b>" + RadarUtils.GetResStr("rsContextFilterSettings") + "</b>");
            writer.RenderEndTag(); //div

            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "2px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write(RadarUtils.GetResStr("repHierarhyEditorLevel"));
            writer.RenderEndTag(); //div
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "heditor_selectlevel");
            writer.RenderBeginTag(HtmlTextWriterTag.Select);
            if (fHierarchy.Origin == HierarchyOrigin.hoParentChild)
            {
                for (var i = 0; i < fHierarchy.CubeHierarchy.FMDXLevelNames.Count; i++)
                {
                    var s = fHierarchy.CubeHierarchy.FMDXLevelNames[i];

                    if (fContextLevelName == null && i == 0)
                    {
                        writer.AddAttribute("selected", "selected");
                    }

                    if (s == fContextLevelName)
                    {
                        writer.AddAttribute("selected", "selected");
                    }

                    writer.AddAttribute(HtmlTextWriterAttribute.Value, s);
                    writer.RenderBeginTag(HtmlTextWriterTag.Option);
                    writer.Write(s);
                    writer.RenderEndTag(); //option
                }
            }
            if (fHierarchy.CubeHierarchy.FMDXLevelNames.Count == 0)
            {
                for (var i = 0; i < fHierarchy.Levels.Count; i++)
                {
                    var l = fHierarchy.Levels[i];

                    if (fContextLevelName == null && i == 0)
                    {
                        writer.AddAttribute("selected", "selected");
                    }

                    if (l.UniqueName == fContextLevelName)
                    {
                        writer.AddAttribute("selected", "selected");
                    }

                    writer.AddAttribute(HtmlTextWriterAttribute.Value, l.UniqueName);
                    writer.RenderBeginTag(HtmlTextWriterTag.Option);
                    writer.Write(l.DisplayName);
                    writer.RenderEndTag(); //option
                }
            }

            writer.RenderEndTag(); //select

            writer.RenderEndTag(); //div

            var lv  = fHierarchy.Levels.Find(fContextLevelName) ?? fHierarchy.Levels[0];
            var mnu = new GenericMenu();

            fGrid.FillFilterMenu(mnu, lv, fContextLevelName, null,
                                 "RadarSoft.$('#" + fGrid.ClientID + "').data('grid').heditor.cancel2('" +
                                 RadarUtils.GetResStr("rsLoading") + "')");
//            fGrid.FillFilterMenu(mnu, lv, fContextLevelName, null, "");
            fGrid.mnu_cf.Embedded = true;
            fGrid.ConvertGenericMenu(mnu, fGrid.mnu_cf);

            if (fGrid.mnu_cf.Items.Count > 0)
            {
                fGrid.mnu_cf.RenderControl(writer);
            }

            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "5px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("<b>" + RadarUtils.GetResStr("rsMemberFilterSettings") + "</b>");
            writer.RenderEndTag(); //div

            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-widget-content");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "olapgrid_HFilter");
            writer.AddAttribute(HtmlTextWriterAttribute.Rows, "2");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Textarea);
            if (FFilterString != "")
            {
                writer.Write(FFilterString);
            }
            writer.RenderEndTag(); // textarea
            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "heditor_exactmatching");
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
            writer.AddAttribute("checked", "checked");
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag(); // input

            writer.Write(RadarUtils.GetResStr("rshExactMatching"));

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "olapgrid_HFilter_btn");
            writer.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, "20px");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write(RadarUtils.GetResStr("rsFind"));
            //HtmlImage img = new HtmlImage();
            //img.Src = OlapGrid.images.ImageUrl("FilterHierarchy.png", fGrid.Page);
            //img.Alt = RadarUtils.GetResStr("rsFilterTree");
            //img.RenderControl(writer);
            writer.RenderEndTag(); // filter button

            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "auto");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Height, fGrid.fHierarchyEditorStyle.TreeHeight + "px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-widget ui-widget-content");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "heditor_TREE");
            writer.AddStyleAttribute(HtmlTextWriterStyle.MarginBottom, "5px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            DoRenderTree(writer);

            writer.RenderEndTag(); // div

            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr 2 filter box


            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "btnApplyFilter");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write(RadarUtils.GetResStr("rsApply"));
            writer.RenderEndTag(); // button
            writer.RenderEndTag(); //td

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "btnResetFilter");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write("Confirm");
            writer.RenderEndTag(); // button
            writer.RenderEndTag(); //td


            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, "20px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.MarginRight, "20px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "btnCancelFilter");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write(RadarUtils.GetResStr("rsCancel"));
            writer.RenderEndTag(); // filter button

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "btnCancelResetFilter");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write("Cancel");
            writer.RenderEndTag(); // button
            writer.RenderEndTag(); // div
            writer.RenderEndTag(); //td

            writer.RenderEndTag(); // tr
            writer.RenderEndTag(); // table

            writer.RenderEndTag(); //td
            writer.RenderEndTag(); // tr 2 filter box

            writer.RenderEndTag(); // table

            result.buttons = new JsonDialogButton[0];
            result.data    = writer.ToString();
            return(result);
        }