Beispiel #1
0
        /// <summary>
        /// Binds the forms.
        /// </summary>
        private void BindForms()
        {
            string className = MetaClassName;

            if (CanAddNewForm)
            {
                ddFormName.Items.Clear();
                FormDocument[] mas = FormDocument.GetFormDocuments(className);
                foreach (FormDocument fd in mas)
                {
                    ddFormName.Items.Add(new ListItem(CHelper.GetFormName(fd.Name), fd.Name));
                }

                if (!String.IsNullOrEmpty(FormName))
                {
                    CHelper.SafeSelect(ddFormName, FormName);
                }

                FormName = (ddFormName.SelectedItem != null) ? ddFormName.SelectedValue : "";
            }
            else
            {
                lblTempFormName.Text = FormName;
            }

            ddFormName.Visible      = CanAddNewForm;
            lblTempFormName.Visible = !CanAddNewForm;

            BindRenderer();
        }
Beispiel #2
0
        private void BindGrid()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));
            dt.Columns.Add("CanDelete", typeof(bool));
            dt.Columns.Add("CanReset", typeof(bool));
            dt.Columns.Add("PublicFormName", typeof(string));

            bool isBaseFormAdded        = false;
            bool isGeneralViewFormAdded = false;
            bool isShortViewFormAdded   = false;

            //ListApp Fix: we don't use ShortViewForm for lists
            bool isList = ListManager.MetaClassIsList(mc.Name);

            if (isList)
            {
                isShortViewFormAdded = true;
            }

            FormDocument[] mas;

            #region Forms
            mas = FormDocument.GetFormDocuments(mc.Name);
            foreach (FormDocument fd in mas)
            {
                DataRow row = dt.NewRow();
                row["Id"] = fd.Name;
                string name = "";
                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId) ||
                    fd.MetaUITypeId == FormController.BaseFormType ||
                    fd.MetaUITypeId == FormController.CreateFormType ||
                    fd.MetaUITypeId == FormController.GeneralViewFormType ||
                    fd.MetaUITypeId == FormController.GeneralViewHistoryFormType ||
                    fd.MetaUITypeId == FormController.ShortViewFormType)
                {
                    name = CHelper.GetFormName(fd.MetaUITypeId);
                }
                else
                {
                    name = String.Format("{0} ({1})", CHelper.GetFormName(fd.Name), CHelper.GetFormName(fd.MetaUITypeId));
                }

                row["PublicFormName"] = "-1";

                //ListApp Fix
                if (ListManager.MetaClassIsList(mc.Name) && fd.MetaUITypeId == FormController.PublicEditFormType)
                {
                    row["PublicFormName"] = fd.Name;
                }

                row["Name"]     = name;
                row["EditLink"] = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                mc.Name, btnRefresh.UniqueID,
                                                fd.Name, dialogWidth, dialogHeight,
                                                ResolveClientUrl("~/Apps/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));
                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId))
                {
                    row["CanDelete"] = false;
                    row["CanReset"]  = !isList;
                }
                else
                {
                    row["CanDelete"] = true;
                    row["CanReset"]  = false;
                }

                if (fd.MetaUITypeId == FormController.BaseFormType)
                {
                    isBaseFormAdded = true;
                }
                if (fd.MetaUITypeId == FormController.GeneralViewFormType)
                {
                    isGeneralViewFormAdded = true;
                }
                if (fd.MetaUITypeId == FormController.ShortViewFormType)
                {
                    isShortViewFormAdded = true;
                }

                dt.Rows.Add(row);
            }

            // Edit Form
            if (!isBaseFormAdded)
            {
                DataRow row      = dt.NewRow();
                string  formType = FormController.BaseFormType;
                row["Id"]             = formType;
                row["Name"]           = CHelper.GetFormName(formType);
                row["PublicFormName"] = "-1";
                row["EditLink"]       = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                      mc.Name, btnRefresh.UniqueID,
                                                      formType, dialogWidth, dialogHeight,
                                                      ResolveClientUrl("~/Apps/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));
                row["CanDelete"] = false;
                row["CanReset"]  = false;
                dt.Rows.Add(row);
            }

            // View Form
            if (!isGeneralViewFormAdded)
            {
                DataRow row      = dt.NewRow();
                string  formType = FormController.GeneralViewFormType;
                row["Id"]             = formType;
                row["Name"]           = CHelper.GetFormName(formType);
                row["PublicFormName"] = "-1";
                row["EditLink"]       = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                      mc.Name, btnRefresh.UniqueID,
                                                      formType, dialogWidth, dialogHeight,
                                                      ResolveClientUrl("~/Apps/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));
                row["CanDelete"] = false;
                row["CanReset"]  = false;
                dt.Rows.Add(row);
            }

            // Short View Form
            if (!isShortViewFormAdded)
            {
                DataRow row      = dt.NewRow();
                string  formType = FormController.ShortViewFormType;
                row["Id"]             = formType;
                row["Name"]           = CHelper.GetFormName(formType);
                row["PublicFormName"] = "-1";
                row["EditLink"]       = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                      mc.Name, btnRefresh.UniqueID,
                                                      formType, dialogWidth, dialogHeight,
                                                      ResolveClientUrl("~/Apps/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));
                row["CanDelete"] = false;
                row["CanReset"]  = false;
                dt.Rows.Add(row);
            }
            #endregion

            #region History Forms
            string historyClassName = HistoryManager.GetHistoryMetaClassName(mc.Name);
            mas = FormDocument.GetFormDocuments(historyClassName);
            foreach (FormDocument fd in mas)
            {
                DataRow row = dt.NewRow();
                row["Id"] = String.Format(CultureInfo.InvariantCulture, "{0}{1}", fd.Name, historyPostfix);
                string name = "";
                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId) ||
                    fd.MetaUITypeId == FormController.BaseFormType ||
                    fd.MetaUITypeId == FormController.CreateFormType ||
                    fd.MetaUITypeId == FormController.GeneralViewFormType ||
                    fd.MetaUITypeId == FormController.GeneralViewHistoryFormType ||
                    fd.MetaUITypeId == FormController.ShortViewFormType)
                {
                    name = CHelper.GetFormName(fd.MetaUITypeId);
                }
                else
                {
                    name = String.Format("{0} ({1})", CHelper.GetFormName(fd.Name), CHelper.GetFormName(fd.MetaUITypeId));
                }

                row["PublicFormName"] = "-1";

                row["Name"]     = name;
                row["EditLink"] = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                historyClassName, btnRefresh.UniqueID,
                                                fd.Name, dialogWidth, dialogHeight,
                                                ResolveClientUrl("~/Apps/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));

                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId))
                {
                    row["CanDelete"] = false;
                }
                else
                {
                    row["CanDelete"] = true;
                }
                row["CanReset"] = false;

                dt.Rows.Add(row);
            }
            #endregion

            DataView dv = dt.DefaultView;
            dv.Sort = "Name";

            grdMain.DataSource = dv;
            grdMain.DataBind();

            foreach (DataGridItem row in grdMain.Items)
            {
                ImageButton ib;
                ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                }

                ib = (ImageButton)row.FindControl("ibReset");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "ResetToDefault").ToString() + "?')");
                }

                ib = (ImageButton)row.FindControl("ibRecreate");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.MetaForm", "RecreateFormWarning").ToString() + "')");
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));
            dt.Columns.Add("CanDelete", typeof(bool));
            dt.Columns.Add("PublicFormName", typeof(string));

            FormDocument[] mas = FormDocument.GetFormDocuments(mc.Name);
            foreach (FormDocument fd in mas)
            {
                DataRow row = dt.NewRow();
                row["Id"] = fd.Name;
                string name = "";
                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId))
                {
                    name = CHelper.GetFormName(fd.MetaUITypeId);
                }
                else
                {
                    name = String.Format("{0} ({1})", CHelper.GetFormName(fd.Name), CHelper.GetFormName(fd.MetaUITypeId));
                }

                row["PublicFormName"] = "-1";

                row["Name"]     = name;
                row["EditLink"] = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                mc.Name, btnRefresh.UniqueID,
                                                fd.Name, dialogWidth, dialogHeight,
                                                ResolveClientUrl("~/Apps/MetaDataBase/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));

                //if (MetaUIManager.MetaUITypeIsSystem(fd.MetaUITypeId))
                //    row["CanDelete"] = false;
                //else
                row["CanDelete"] = true;

                dt.Rows.Add(row);
            }

            // History
            string historyClassName = HistoryManager.GetHistoryMetaClassName(mc.Name);

            mas = FormDocument.GetFormDocuments(historyClassName);
            foreach (FormDocument fd in mas)
            {
                DataRow row = dt.NewRow();
                row["Id"] = String.Format(CultureInfo.InvariantCulture, "{0}{1}", fd.Name, historyPostfix);
                string name = "";
                if (MetaUIManager.MetaUITypeIsSystem(fd.MetaClassName, fd.MetaUITypeId))
                {
                    name = CHelper.GetFormName(fd.MetaUITypeId);
                }
                else
                {
                    name = String.Format("{0} ({1})", CHelper.GetFormName(fd.Name), CHelper.GetFormName(fd.MetaUITypeId));
                }

                row["PublicFormName"] = "-1";

                row["Name"]     = name;
                row["EditLink"] = String.Format("javascript:OpenSizableWindow(\"{5}?ClassName={0}&btn={1}&FormName={2}\", {3}, {4});",
                                                historyClassName, btnRefresh.UniqueID,
                                                fd.Name, dialogWidth, dialogHeight,
                                                ResolveClientUrl("~/Apps/MetaDataBase/MetaUI/Pages/Admin/CustomizeObjectView2.aspx"));

                //if (MetaUIManager.MetaUITypeIsSystem(fd.MetaUITypeId))
                //    row["CanDelete"] = false;
                //else
                row["CanDelete"] = true;

                dt.Rows.Add(row);
            }

            grdMain.DataSource = dt;
            grdMain.DataBind();

            foreach (DataGridItem row in grdMain.Items)
            {
                ImageButton ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("GlobalMetaInfo", "Delete").ToString() + "?')");
                }
            }
        }