Ejemplo n.º 1
0
        protected void grdMain_RowDataBound(object sender, DataGridItemEventArgs e)
        {
            TextBox tb = (TextBox)e.Item.FindControl("txtLink");

            if (tb == null)
            {
                return;
            }

            if (!String.IsNullOrEmpty(e.Item.Cells[0].Text) && e.Item.Cells[0].Text != "-1")
            {
                tb.Visible = true;
                string fName = e.Item.Cells[0].Text;
                string sPath = CHelper.GetAbsolutePath("/YourPublicPage.aspx");                 // see IBN47 realization
                string ss    = "ClassName=" + mc.Name + "&FormName=" + fName;
                ss = HttpUtility.UrlEncode(ss);
                string sc = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(ss));
                sPath  += "?uid=" + sc;
                tb.Text = String.Format("<iframe src='{0}' style='border: 0' width='100%' height='100%' frameborder='0' scrolling='auto'></iframe>", sPath);
                tb.Style.Add("margin-top", "10px");
            }
            else
            {
                tb.Visible = false;
            }
        }
Ejemplo n.º 2
0
        private void BindToolbar()
        {
            if (TypeName == string.Empty)
            {
                secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "MReferenceTypeCreate").ToString();
            }
            else
            {
                secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "MReferenceTypeEdit").ToString();
            }

            if (BackMode == "view" && TypeName != string.Empty)
            {
                secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToEnumInfo").ToString(), "~/Apps/MetaDataBase/Pages/Admin/MultiReferenceTypeView.aspx?type=" + TypeName);
            }
            else
            {
                secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToList").ToString(), "~/Apps/MetaDataBase/Pages/Admin/MultiReferenceTypeList.aspx");
            }

            imbtnSave.CustomImage   = CHelper.GetAbsolutePath("/images/IbnFramework/saveitem.gif");
            imbtnCancel.CustomImage = CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif");

            txtMRTName.Attributes.Add("onblur", "SetName('" + txtMRTName.ClientID + "','" + txtFriendlyName.ClientID + "','" + vldFriendlyName_Required.ClientID + "')");
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _mc = DataContext.Current.MetaModel.MetaClasses[className];
            if (!String.IsNullOrEmpty(fieldName))
            {
                _mf = _mc.Fields[fieldName];
            }

            //CHelper.AddToContext(NavigationBlock.KeyContextMenu, "MetaClassView");
            //CHelper.AddToContext(NavigationBlock.KeyContextMenuTitle, CHelper.GetResFileString(_mc.FriendlyName));

            if (!IsPostBack)
            {
                lblOwnerMetaClass.Text = _mc.FriendlyName;
                BindMetaClasses();
                BindMetaFields();

                if (_mf != null)
                {
                    BindEditData();
                }
                else
                {
                    trEdit1.Visible = false;
                    trEdit2.Visible = false;
                }
            }

            imbtnSave.Attributes.Add("onclick", "if(!SaveFunc()) return;");
            imbtnSave.CustomImage   = CHelper.GetAbsolutePath("/images/IbnFramework/saveitem.gif");
            imbtnCancel.CustomImage = CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif");
            imbtnCancel.Attributes.Add("onclick", String.Format("window.location.href='MetaClassView.aspx?class={0}'; return false;", _mc.Name));
        }
Ejemplo n.º 4
0
        private void BindInfo()
        {
            if (mc != null)
            {
                secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BridgeEdit").ToString();
            }
            else
            {
                secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BridgeCreate").ToString();
            }

            if (Back == "view" && mc != null)
            {
                secHeader.AddLink(
                    String.Format("<img src='{0}' border='0' align='absmiddle' width='16px' height='16px' />&nbsp;{1}", CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif"), GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToTableInfo").ToString()),
                    String.Format(CultureInfo.InvariantCulture, "{0}?class={1}", CHelper.MetaClassAdminPage, mc.Name));

                imbtnCancel.Attributes.Add("onclick", String.Format("window.location.href='MetaClassView.aspx?class={0}'; return false;", mc.Name));
            }
            else              // Back to List by default
            {
                secHeader.AddLink(
                    String.Format("<img src='{0}' border='0' align='absmiddle' width='16px' height='16px' />&nbsp;{1}", CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif"), GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToList").ToString()),
                    "~/Apps/MetaDataBase/Pages/Admin/MetaClassList.aspx");

                imbtnCancel.Attributes.Add("onclick", "window.location.href='MetaClassList.aspx'; return false;");
            }

            imbtnSave.CustomImage   = CHelper.GetAbsolutePath("/images/IbnFramework/saveitem.gif");
            imbtnCancel.CustomImage = CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif");

            lgdClass.InnerText  = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "TableInfo").ToString();
            lgdField1.InnerText = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Field1Info").ToString();
            lgdField2.InnerText = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Field2Info").ToString();
        }
Ejemplo n.º 5
0
        public static string GetDocumentTitle(string Title, int DocumentId, int ReasonId)
        {
            string img = "document_active.gif";

            switch (ReasonId)
            {
            case 1:
            case 2:
                img = "document_completed.gif";
                break;

            case 3:
            case 4:
                img = "document_suspensed.gif";
                break;
            }

            if (!Security.CurrentUser.IsExternal)
            {
                return(String.Format(
                           @"<a href='{4}{0}{3}'><img alt='' src='{2}'/> {1}</a>"
                           , DocumentId, Title, CHelper.GetAbsolutePath("/Layouts/Images/icons/" + img), "", CHelper.GetAbsolutePath("/Documents/DocumentView.aspx?DocumentId=")));
            }
            else
            {
                return(String.Format(
                           @"<img alt='' src='{1}'/>{0}", Title, CHelper.GetAbsolutePath("/Layouts/Images/icons/" + img)));
            }
        }
Ejemplo n.º 6
0
        public ArrayList DeleteAttachment(string _guid, string _id)
        {
            string    sFiles         = "";
            ArrayList values         = new ArrayList();
            string    _containerName = "FileLibrary";
            string    _containerKey  = "EMailAttach";

            CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(_containerName, _containerKey);
            CS.FileStorage      fs  = (CS.FileStorage)bic.LoadControl("FileStorage");
            fs.DeleteFile(int.Parse(_id));
            CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, _guid, false);
            if (di != null)
            {
                CS.FileInfo[] _fi = fs.GetFiles(di);
                foreach (CS.FileInfo fi in _fi)
                {
                    sFiles += String.Format(CultureInfo.InvariantCulture,
                                            "<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'>&nbsp;{1}&nbsp;&nbsp;<img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>",
                                            CHelper.GetAbsolutePath("/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId),
                                            Util.CommonHelper.GetShortFileName(fi.Name, 40),
                                            CHelper.GetAbsolutePath("/Layouts/Images/delete.gif"),
                                            fi.Id,
                                            LocRM.GetString("Delete"));
                }
            }
            values.Add(sFiles);
            return(values);
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (BlockId <= 0)
            {
                throw new ArgumentException("BlockId is wrong or not specified");
            }

            block = MetaObjectActivator.CreateInstance <TimeTrackingBlock>(TimeTrackingBlock.GetAssignedMetaClass(), BlockId);
//			block = new TimeTrackingBlock(BlockId);

            SecurityService ss = block.GetService <SecurityService>();

            if (ss == null || !ss.CheckUserRight(TimeTrackingManager.Right_RegFinances))
            {
                throw new AccessDeniedException();
            }

            btnApprove.Text = LocRM.GetString("tApprove");
            btnCancel.Text  = LocRM.GetString("tCancel");
            if (!Page.IsPostBack)
            {
                BindAccounts();
                dtcDate.SelectedDate = Mediachase.IBN.Business.User.GetLocalDate(DateTime.UtcNow).Date;
            }

            btnApprove.CustomImage = CHelper.GetAbsolutePath("/layouts/images/accept.gif");
            btnCancel.CustomImage  = CHelper.GetAbsolutePath("/layouts/images/cancel.gif");
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Registers the script tags.
        /// </summary>
        private void RegisterScriptTags()
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/Apps/MetaDataBase/styles/mcBlockMenu.css")));
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/Apps/MetaDataBase/styles/ibn.css")));
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/Apps/MetaDataBase/styles/Theme.css")));
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/Apps/MetaDataBase/styles/windows.css")));
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/Apps/MetaDataBase/styles/menuStyle.css")));

            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/yui-utilities.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/ext-yui-adapter.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/ext8.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/ext-lang-ru.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/List2List.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/jquery-1.2.1.min.js"));
            Page.ClientScript.RegisterClientScriptInclude(Guid.NewGuid().ToString("N"),
                                                          CHelper.GetAbsolutePath("/Apps/MetaDataBase/Scripts/common.js"));
        }
Ejemplo n.º 9
0
 private void BindToolbar()
 {
     secHeader.Title = GetGlobalResourceObject("IbnFramework.TimeTracking", "BlockTypes").ToString();
     secHeader.AddLink(
         "<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/newitem.gif") + "' border='0' align='absmiddle' />&nbsp;" +
         GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "NewItem").ToString(),
         String.Format("javascript:ShowWizard(&quot;TimeTrackingBlockTypeEdit.aspx?btn={0}&quot;, {1}, {2})", Page.ClientScript.GetPostBackEventReference(btnRefresh, ""), dialogWidth, dialogHeight));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        /// <param name="field">The field.</param>
        public void BindData(MetaField field)
        {
            string sReferencedClass = field.Attributes[McDataTypeAttribute.ReferenceMetaClassName].ToString();

            ViewState["ReferencedClass"] = sReferencedClass;

            string url = CHelper.GetAbsolutePath(String.Format("/Apps/MetaDataBase/MetaUI/Pages/Public/SelectItem.aspx?class={0}&btn={1}", sReferencedClass, Page.ClientScript.GetPostBackEventReference(btnRefresh, "xxx")));

            ibSelect.OnClientClick = String.Format("OpenWindow(\"{0}\", 640, 480, 1); return false;", url);
        }
Ejemplo n.º 11
0
        private void BindToolbar()
        {
            secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "NewIdentifier").ToString();
            secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToList").ToString(), "~/Apps/MetaDataBase/Pages/Admin/IdentifierList.aspx");

            imbtnSave.CustomImage   = CHelper.GetAbsolutePath("/images/IbnFramework/saveitem.gif");
            imbtnCancel.CustomImage = CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif");

            txtName.Attributes.Add("onblur", "SetName('" + txtName.ClientID + "','" + txtFriendlyName.ClientID + "','" + rfvFriendlyName.ClientID + "')");
        }
Ejemplo n.º 12
0
        private void BindToolbar()
        {
            secHeader.Title = "Select Item";

            if (RefreshButton != String.Empty)                  // Dialog Mode
            {
                string url = "javascript:window.close();";
                secHeader.AddImageLink(CHelper.GetAbsolutePath("/images/IbnFramework/close.gif"), "Close", url);
            }
        }
Ejemplo n.º 13
0
        private void BindGrid(DataTable dt)
        {
            DataView dv = dt.DefaultView;

            dv.Sort            = "OrderId";
            grdMain.DataSource = dv;
            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() + "?')");
                }
                TextBox   tb = (TextBox)row.FindControl("txtName");
                HtmlImage im = (HtmlImage)row.FindControl("imResourceTemplate");
                if (im != null)
                {
                    im.Src = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/resource.gif");
                    im.Attributes.Add("title", GetGlobalResourceObject("GlobalMetaInfo", "ResourceTooltip").ToString());
                    if (tb != null)
                    {
                        im.Attributes.Add("onclick", "SetText('" + tb.ClientID + "','{ResourceName:ResourceKey}','')");
                    }
                }
            }

            if (grdMain.EditItemIndex >= 0)
            {
                DataGridItem dgi = grdMain.Items[grdMain.EditItemIndex];

                //ordering dropdownlist
                DropDownList ddl = (DropDownList)dgi.FindControl("ddlOrder");
                if (ddl != null)
                {
                    for (int i = 1; i <= grdMain.Items.Count; i++)
                    {
                        ddl.Items.Add(i.ToString());
                    }
                    ddl.SelectedIndex = grdMain.EditItemIndex;
                }

                //IsDefault Value
                CheckBox cb  = (CheckBox)dgi.FindControl("cbDefault");
                Label    lbl = (Label)dgi.FindControl("lblDefault");
                if (cb != null)
                {
                    cb.Checked = (lbl.Text.ToLower() == "true");
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Binds the DG.
        /// </summary>
        private void BindDG()
        {
            dgClasses.Columns[1].HeaderText = "MetaClass Name";
            if (TypeName == String.Empty)
            {
                dgClasses.Columns[2].HeaderText = String.Format("<a href='#' onclick=\"{0}\"><img alt='' align='absmiddle' border='0' src='{1}' />&nbsp;New</a>",
                                                                Page.ClientScript.GetPostBackClientHyperlink(lbNewClass, ""),
                                                                CHelper.GetAbsolutePath("/images/newitem.gif"));
            }
            DataTable dt = (DataTable)ViewState["DT_Source"];

            dgClasses.DataSource = dt.DefaultView;
            dgClasses.DataBind();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Binds the toolbar.
 /// </summary>
 private void BindToolbar()
 {
     secHeader.Title = GetGlobalResourceObject("GlobalMetaInfo", "EnumInfo").ToString();
     secHeader.AddLink(
         String.Format("<img src='{0}' border='0' width=16 height=16 align='absmiddle'> {1}", CHelper.GetAbsolutePath("/Images/newitem.gif"), GetGlobalResourceObject("GlobalMetaInfo", "NewItem").ToString()),
         Page.ClientScript.GetPostBackClientHyperlink(btnAddNewItem, ""));
     if (RefreshButton == String.Empty)
     {
         secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/edit.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("GlobalMetaInfo", "EnumEdit").ToString(), "~/Apps/MetaDatabase/Pages/Admin/EnumEdit.aspx?type=" + TypeName + "&back=view");
         secHeader.AddLink("<img src='" + Page.ResolveClientUrl("../../images/cancel.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("GlobalMetaInfo", "BackToList").ToString(), "~/Apps/MetaDatabase/Pages/Admin/EnumList.aspx");
     }
     else              // Dialog Mode
     {
         string url = String.Format("javascript:try{{window.opener.{0}}} catch (e){{}} window.close();", RefreshButton);
         secHeader.AddImageLink(CHelper.GetAbsolutePath("/images/close.gif"), GetGlobalResourceObject("GlobalMetaInfo", "Close").ToString(), url);
     }
 }
Ejemplo n.º 16
0
        private DataTable GetTableFields()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("FriendlyName", typeof(string));
            dt.Columns.Add("IsSystem", typeof(bool));
            dt.Columns.Add("FieldTypeImageUrl", typeof(string));

            DataRow row = dt.NewRow();

            row["Name"]         = ddOwnerFields.SelectedValue;
            row["FriendlyName"] = CHelper.GetResFileString(ddOwnerFields.SelectedItem.Text);
            MetaField field = _mc.Fields[ddOwnerFields.SelectedValue];

            row["IsSystem"] = field.Attributes.ContainsKey(MetaClassAttribute.IsSystem) || _mc.TitleFieldName == field.Name;
            string postfix = string.Empty;

            if ((bool)row["IsSystem"])
            {
                postfix = "_sys";
            }
            if (field.IsReferencedField)
            {
                row["FieldTypeImageUrl"] = CHelper.GetAbsolutePath("/images/IbnFramework/metainfo/referencedfield" + postfix + ".gif");
            }
            else if (field.IsReference)
            {
                row["FieldTypeImageUrl"] = CHelper.GetAbsolutePath("/images/IbnFramework/metainfo/reference" + postfix + ".gif");
            }
            else if (field.IsBackReference)
            {
                row["FieldTypeImageUrl"] = CHelper.GetAbsolutePath("/images/IbnFramework/metainfo/backreference" + postfix + ".gif");
            }
            else
            {
                row["FieldTypeImageUrl"] = CHelper.GetAbsolutePath("/images/IbnFramework/metainfo/metafield" + postfix + ".gif");
            }
            dt.Rows.Add(row);

            return(dt);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        /// <param name="field">The field.</param>
        public void BindData(MetaField field)
        {
            string sTypeName = field.TypeName;

            ViewState["FieldType"] = sTypeName;
            RebuildList(sTypeName);

            if (!ReadOnly && field.Attributes.ContainsKey(McDataTypeAttribute.EnumEditable) &&
                (bool)field.Attributes[McDataTypeAttribute.EnumEditable])
            {
                tdEdit.Visible = true;
                string url = CHelper.GetAbsolutePath(String.Format("/Common/EnumView.aspx?type={0}&btn={1}", sTypeName, Page.ClientScript.GetPostBackEventReference(btnRefresh, "")));

                btnEditItems.Attributes.Add("onclick", String.Format("OpenWindow(\"{0}\", 750, 500, 1)", url));
            }
            else
            {
                tdEdit.Visible = false;
            }
        }
Ejemplo n.º 18
0
        private void BindGrid(DataTable dt)
        {
            grdMain.DataSource = dt.DefaultView;
            grdMain.DataBind();

            foreach (DataGridItem row in grdMain.Items)
            {
                ImageButton ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                }
                TextBox   tb = (TextBox)row.FindControl("txtName");
                HtmlImage im = (HtmlImage)row.FindControl("imResourceTemplate");
                RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("rfName");
                if (im != null)
                {
                    im.Src = CHelper.GetAbsolutePath("/images/IbnFramework/resource.gif");
                    im.Attributes.Add("title", GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "ResourceTooltip").ToString());
                    if (tb != null && rfv != null)
                    {
                        im.Attributes.Add("onclick", "SetText('" + tb.ClientID + "','{ResourceName:ResourceKey}','" + rfv.ClientID + "')");
                    }
                }
            }

            if (grdMain.EditItemIndex >= 0)
            {
                DropDownList ddl = (DropDownList)grdMain.Items[grdMain.EditItemIndex].FindControl("ddlOrder");
                if (ddl != null)
                {
                    for (int i = 1; i <= grdMain.Items.Count; i++)
                    {
                        ddl.Items.Add(i.ToString());
                    }
                    ddl.SelectedIndex = grdMain.EditItemIndex;
                }
            }
        }
Ejemplo n.º 19
0
        protected override void OnPreRender(EventArgs e)
        {
            object needtoclearselector = CHelper.GetFromContext("NeedToClearSelector");

            if (needtoclearselector != null && needtoclearselector.ToString().ToLower() == "true")
            {
                ctrlUpdate.Value = "";
                xmlStruct.Controls.Clear();
                CHelper.UpdateParentPanel(this);
            }

            if (CHelper.NeedToDataBind())
            {
                xmlStruct.DataBind();
                CHelper.UpdateParentPanel(this);
            }
            base.OnPreRender(e);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString("N"),
                                                        String.Format("<link rel='stylesheet' type='text/css' href='{0}' />",
                                                                      CHelper.GetAbsolutePath("/styles/IbnFramework/FrameworkUtilTopTabs.css")));
        }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, PrimaryKeyId.Parse(Request["ObjectId"]));

            lblTitle.Text = String.Format("<a href=\"javascript:{{window.parent.location.href='{1}';}}\">{0}</a>",
                                          ceo.Subject, CHelper.GetAbsolutePath("/Apps/MetaUIEntity/Pages/EntityView.aspx?ClassName=CalendarEvent&ObjectId=" + ceo.PrimaryKeyId.Value.ToString()));
            if (ceo.Start.Date == ceo.End.Date)
            {
                lblTime.Text = ceo.Start.ToString("ddd, MMM dd") + ", " + ceo.Start.ToShortTimeString() + " - " + ceo.End.ToShortTimeString();
            }
            else
            {
                lblTime.Text = ceo.Start.ToShortDateString() + " " + ceo.Start.ToShortTimeString() + " - " +
                               ceo.End.ToShortDateString() + " " + ceo.End.ToShortTimeString();
            }

            divSeries.Visible   = false;
            spanDelete2.Visible = false;
            if (((VirtualEventId)ceo.PrimaryKeyId).RealEventId == ceo.PrimaryKeyId ||
                ceo.CalendarEventExceptionId.HasValue)
            {
                lbGoToEdit.Text = GetGlobalResourceObject("IbnFramework.Calendar", "EditEventDetails").ToString();
                lbDelete.Text   = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuick").ToString();
            }
            else
            {
                lbGoToEdit.Text     = GetGlobalResourceObject("IbnFramework.Calendar", "EditOnlyThisEventInstance").ToString();
                lbEditSeries.Text   = GetGlobalResourceObject("IbnFramework.Calendar", "EditAllEventInstances").ToString();
                lbDelete.Text       = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuickThisInstance").ToString();
                lbDeleteSeries.Text = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuickAllInstances").ToString();
                divSeries.Visible   = true;
                spanDelete2.Visible = true;
            }

            lbDelete.Click       += new EventHandler(lbDelete_Click);
            lbGoToEdit.Click     += new EventHandler(lbGoToEdit_Click);
            lbEditSeries.Click   += new EventHandler(lbEditSeries_Click);
            lbDeleteSeries.Click += new EventHandler(lbDeleteSeries_Click);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Gens the templates data source.
        /// </summary>
        /// <returns></returns>
        private DataTable GenTemplatesDataSource()
        {
            DataTable retVal = new DataTable();

            retVal.Columns.Add(new DataColumn("Id", typeof(string)));
            retVal.Columns.Add(new DataColumn("Title", typeof(string)));
            retVal.Columns.Add(new DataColumn("Description", typeof(string)));
            retVal.Columns.Add(new DataColumn("ImageUrl", typeof(string)));

            foreach (WorkspaceTemplateInfo wti in WorkspaceTemplateFactory.GetTemplateInfos())
            {
                DataRow row = retVal.NewRow();
                row["Id"]          = wti.Uid;
                row["Title"]       = CHelper.GetResFileString(wti.Title);
                row["Description"] = CHelper.GetResFileString(wti.Description);
                row["ImageUrl"]    = CHelper.GetAbsolutePath(wti.ImageUrl);

                retVal.Rows.Add(row);
            }

            return(retVal);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     ibClear.ImageUrl  = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/delete.gif");
     ibSelect.ImageUrl = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/search.gif");
 }
Ejemplo n.º 23
0
 private void BindToolbar()
 {
     secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "MReferenceTypeInfo").ToString();
     secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/edit.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "MReferenceTypeEdit").ToString(), "~/Apps/MetaDataBase/Pages/Admin/MultiReferenceTypeEdit.aspx?type=" + TypeName + "&back=view");
     secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/cancel.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BackToList").ToString(), "~/Apps/MetaDataBase/Pages/Admin/MultiReferenceTypeList.aspx");
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Applies the actions.
        /// </summary>
        private void ApplyActions()
        {
            imgLeft.ImageUrl  = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/Arrows/Left.gif");
            imgUp.ImageUrl    = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/Arrows/Up.gif");
            imgRight.ImageUrl = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/Arrows/Right.gif");
            imgDown.ImageUrl  = CHelper.GetAbsolutePath("/Apps/MetaDataBase/Images/Arrows/Down.gif");

            imgLeft.Style.Add("cursor", "pointer");
            imgUp.Style.Add("cursor", "pointer");
            imgRight.Style.Add("cursor", "pointer");
            imgDown.Style.Add("cursor", "pointer");

            string clientID = fRenderer.TableContainer;

            imgLeft.Attributes.Add("onclick", String.Format("__doPostBack('{1}', $find('{0}').getSelection());", clientID, lbLeft.UniqueID));
            imgUp.Attributes.Add("onclick", String.Format("__doPostBack('{1}', $find('{0}').getSelection());", clientID, lbTop.UniqueID));
            imgRight.Attributes.Add("onclick", String.Format("__doPostBack('{1}', $find('{0}').getSelection());", clientID, lbRight.UniqueID));
            imgDown.Attributes.Add("onclick", String.Format("__doPostBack('{1}', $find('{0}').getSelection());", clientID, lbDown.UniqueID));

            lbRemoveField.Attributes.Add("onclick", String.Format("if(confirm('{2}')){{__doPostBack('{1}', $find('{0}').getSelection());}} else return false;", clientID, lbRemoveField.UniqueID, GetGlobalResourceObject("MetaForm", "WarningField").ToString()));
            lbRemoveSection.Attributes.Add("onclick", String.Format("if(confirm('{2}')){{__doPostBack('{1}', $find('{0}').getSelection());}} else return false;", clientID, lbRemoveSection.UniqueID, GetGlobalResourceObject("MetaForm", "WarningSection").ToString()));

            if (CanAddNewForm)
            {
                lblNewForm.Text = String.Format(scriptNewForm,
                                                String.Format("{2}?btn={0}&class={1}",
                                                              lbNewForm.UniqueID, ddClasses.SelectedItem != null ? ddClasses.SelectedValue : "",
                                                              CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormDocumentEdit.aspx")),
                                                GetGlobalResourceObject("MetaForm", "AddForm").ToString(),
                                                "null");
            }

            string uid = Guid.NewGuid().ToString("N");

            hFieldKey.Value  = uid;
            Session[uid]     = FormDocumentData;
            lblEditForm.Text = String.Format(scriptNewForm,
                                             String.Format("{0}?uid={1}&btn={2}",
                                                           CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormDocumentEdit.aspx"),
                                                           uid, lbNewForm.UniqueID),
                                             GetGlobalResourceObject("MetaForm", "EditForm").ToString(),
                                             "null");

            lblNewSection.Text = String.Format(scriptNewSection,
                                               String.Format("{0}?uid={1}&btn={2}",
                                                             CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormSectionEdit.aspx"),
                                                             uid, lbAddSection.UniqueID),
                                               GetGlobalResourceObject("MetaForm", "AddSection").ToString(),
                                               "null");

            lblEditSection.Text = String.Format(scriptNewSection,
                                                String.Format("{0}?uid={1}&btn={2}",
                                                              CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormSectionEdit.aspx"),
                                                              uid, lbAddSection.UniqueID),
                                                GetGlobalResourceObject("MetaForm", "EditSection").ToString(),
                                                "'" + clientID + "'");

            lblAddField.Text = String.Format(scriptNewItem,
                                             String.Format("{0}?add=1&uid={1}&btn={2}",
                                                           CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormItemEdit.aspx"),
                                                           uid, lbAddSection.UniqueID),
                                             GetGlobalResourceObject("MetaForm", "AddField").ToString(),
                                             "'" + clientID + "'");

            lblEditField.Text = String.Format(scriptNewItem,
                                              String.Format("{0}?uid={1}&btn={2}",
                                                            CHelper.GetAbsolutePath("/Apps/MetaDataBase/MetaUI/Pages/Public/FormItemEdit.aspx"),
                                                            uid, lbAddSection.UniqueID),
                                              GetGlobalResourceObject("MetaForm", "EditField").ToString(),
                                              "'" + clientID + "'");
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        /// <param name="field">The field.</param>
        public void BindData(MetaField field)
        {
            string url = CHelper.GetAbsolutePath(String.Format("/Apps/MetaDataBase/MetaUI/Pages/Public/SelectMultiReference.aspx?type={0}&btn={1}", field.GetMetaType().Name, Page.ClientScript.GetPostBackEventReference(btnRefresh, "xxx")));

            ibSelect.OnClientClick = String.Format("OpenWindow(\"{0}\", 640, 480, 1); return false;", url);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Binds the toolbar.
 /// </summary>
 private void BindToolbar()
 {
     secHeader.Title = GetGlobalResourceObject("GlobalMetaInfo", "MReferenceTypeList").ToString();
     secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/newitem.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("GlobalMetaInfo", "Create").ToString(), "~/Apps/MetaDataBase/Pages/Admin/MultiReferenceTypeEdit.aspx");
 }
Ejemplo n.º 27
0
        private void BindGrid()
        {
            if (sm == null)
            {
                sm = StateMachineManager.GetStateMachine(mc, int.Parse(ddlStateMachine.SelectedValue));
            }

            // DataTable definition
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add(idColumn, typeof(string));
            dt.Columns.Add(fromStateColumn, typeof(string));

            foreach (State state in sm.States)
            {
                dt.Columns.Add(state.Name, typeof(string));
            }
            dt.Columns.Add(editColumn, typeof(string));
            dt.Columns.Add(deleteColumn, typeof(string));

            // Fill data
            DataRow dr;

            foreach (State fromState in sm.States)
            {
                MetaObject mo = StateMachineManager.GetState(mc, fromState.Name);

                dr = dt.NewRow();

                dr[idColumn]        = fromState.Name;
                dr[fromStateColumn] = CHelper.GetResFileString(mo.Properties["FriendlyName"].Value.ToString());

                foreach (State toState in sm.States)
                {
                    if (fromState.Name == toState.Name)
                    {
                        continue;
                    }

                    StateTransition st = sm.FindTransition(fromState, toState);
                    if (st != null)
                    {
                        dr[toState.Name] = String.Format(CultureInfo.InvariantCulture,
                                                         "{0} {1}",
                                                         CHelper.GetPermissionImage((int)Security.Rights.Allow),
                                                         CHelper.GetResFileString(st.Name));
                    }
                    else
                    {
                        dr[toState.Name] = CHelper.GetPermissionImage((int)Security.Rights.Forbid);
                    }
                }

                string url = String.Format("javascript:ShowWizard(&quot;{6}?ClassName={0}&btn={1}&SMId={2}&FromState={3}&quot;, {4}, {5});",
                                           mc.Name, Page.ClientScript.GetPostBackEventReference(btnRefresh, ""),
                                           ddlStateMachine.SelectedValue, fromState.Name, dialogWidth, dialogHeight,
                                           ResolveClientUrl("~/Apps/StateMachine/Pages/Admin/TransitionEdit.aspx"));
                dr[editColumn] = String.Format("<a href=\"{0}\"><img src=\"{1}\" title=\"{2}\" width=\"16\" height=\"16\" border=\"0\" /></a>", url, CHelper.GetAbsolutePath("/Images/IbnFramework/edit.gif"), GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Edit").ToString());

                dt.Rows.Add(dr);
            }

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

            for (int i = 0; i < grdMain.Rows.Count; i++)
            {
                grdMain.Rows[i].Cells[i + 1].BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("FriendlyName", typeof(string));
            dt.Columns.Add("PluralName", typeof(string));
            dt.Columns.Add("Type", typeof(string));
            dt.Columns.Add("TypeString", typeof(string));
            dt.Columns.Add("ClassTypeImageUrl", typeof(string));
            dt.Columns.Add("IsSystem", typeof(bool));
            dt.Columns.Add("EditLink", typeof(string));

            foreach (MetaClass mc in DataContext.Current.MetaModel.MetaClasses)
            {
                DataRow row = dt.NewRow();
                row["Name"]         = mc.Name;
                row["FriendlyName"] = CHelper.GetResFileString(mc.FriendlyName);
                row["PluralName"]   = CHelper.GetResFileString(mc.PluralName);
                if (mc.Attributes.ContainsKey(MetaClassAttribute.IsBridge))
                {
                    row["TypeString"]        = CHelper.GetResFileString("Bridge");
                    row["Type"]              = "Bridge";
                    row["ClassTypeImageUrl"] = "../../images/metainfo/bridge.gif";
                    if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                    {
                        row["ClassTypeImageUrl"] = CHelper.GetAbsolutePath("/images/metainfo/bridge_sys.gif");
                    }
                    row["EditLink"] = String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaBridgeEdit.aspx?class={0}&back=list", mc.Name);
                }
                else if (mc.Attributes.ContainsKey(MetaClassAttribute.IsCard))
                {
                    row["TypeString"]        = CHelper.GetResFileString("Card");
                    row["Type"]              = "Card";
                    row["ClassTypeImageUrl"] = "../../images/metainfo/card.gif";
                    if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                    {
                        row["ClassTypeImageUrl"] = "../../images/metainfo/card_sys.gif";
                    }
                    row["EditLink"] = String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaCardEdit.aspx?class={0}&back=list", mc.Name);
                }
                else
                {
                    row["TypeString"]        = CHelper.GetResFileString("Info");
                    row["Type"]              = "Info";
                    row["ClassTypeImageUrl"] = "../../images/metainfo/metaclass.gif";
                    if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                    {
                        row["ClassTypeImageUrl"] = "../../images/metainfo/metaclass_sys.gif";
                    }
                    row["EditLink"] = String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaClassEdit.aspx?class={0}&back=list", mc.Name);
                }

                if (ddlFilter.SelectedValue != "All" && row["Type"].ToString() != ddlFilter.SelectedValue)
                {
                    continue;
                }

                dt.Rows.Add(row);
            }
            if (Session["MetaClassList_Sort"] == null)
            {
                Session["MetaClassList_Sort"] = "Name";
            }

            DataView dv = dt.DefaultView;

            dv.Sort = Session["MetaClassList_Sort"].ToString();

            grdMain.DataSource = dv;
            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() + "?')");
                }
            }
        }
Ejemplo n.º 29
0
 private void BindToolbar()
 {
     secHeader.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "IdentifierList").ToString();
     secHeader.AddLink("<img src='" + CHelper.GetAbsolutePath("/images/IbnFramework/newitem.gif") + "' border='0' align='absmiddle' />&nbsp;" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Create").ToString(), "~/Apps/MetaDataBase/Pages/Admin/IdentifierEdit.aspx");
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Handles the Click event of the SaveButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            EntityObject entity;

            if (ObjectId != PrimaryKeyId.Empty)
            {
                entity = BusinessManager.Load(ClassName, ObjectId);
            }
            else
            {
                entity = BusinessManager.InitializeEntity(ClassName);
            }
            PrimaryKeyId objectId = ObjectId;

            if (entity != null)
            {
                ProcessCollection(this.EditForm.Controls, entity);

                // Save container id
                if (!String.IsNullOrEmpty(ContainerFieldName) &&
                    entity.Properties[ContainerFieldName] != null &&
                    ContainerId != PrimaryKeyId.Empty)
                {
                    entity[ContainerFieldName] = ContainerId;
                }

                // Update/Create
                if (ObjectId != PrimaryKeyId.Empty)
                {
                    BusinessManager.Update(entity);
                }
                else
                {
                    objectId = BusinessManager.Create(entity);
                }
            }

            string command = String.Empty;

            if (!String.IsNullOrEmpty(CommandName))
            {
                CommandParameters cp = new CommandParameters(CommandName);
                command = cp.ToString();
            }
            if (cbGoToView.Checked)
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), Guid.NewGuid().ToString(),
                                                             String.Format("window.parent.location.href='{0}?ClassName={1}&ObjectId={2}';",
                                                                           CHelper.GetAbsolutePath("/Apps/MetaUIEntity/Pages/EntityView.aspx"),
                                                                           ClassName, objectId.ToString()), true);
            }
            else
            {
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, command);
            }
        }