protected void Page_Load(object sender, System.EventArgs e)
    {
        #region Check Capabilities
        if ((SessionState.User.IsReadOnly) || (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_TRANSLATION_MEMORY)))
        {
            uwToolbar.Items.FromKeyButton("Save").Enabled   = false;
            uwToolbar.Items.FromKeyButton("Delete").Enabled = false;

            txtTMValue.Enabled = txtComment.Enabled = !SessionState.User.IsReadOnly;
        }
        #endregion
        if (Request["e"] != null)
        {
            expressionId = Convert.ToInt64(Request["e"]);
            if (!Page.IsPostBack)
            {
                try
                {
                    using (t = TMExpression.GetByKey(expressionId))
                    {
                        ShowExpression();
                    }
                }
                catch
                {
                    UITools.DenyAccess(DenyMode.Standard);
                }
            }
        }
    }
 /// <summary>
 /// Delete the TM expression
 /// </summary>
 private void BtnDelete()
 {
     using (t = TMExpression.GetByKey(expressionId))
     {
         if (t != null)
         {
             #region Delete result
             if (t.Delete(HyperCatalog.Shared.SessionState.User.Id))
             {
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
             }
             else
             {
                 lbMessage.Text     = TMExpression.LastError;
                 lbMessage.CssClass = "hc_error";
                 lbMessage.Visible  = true;
             }
             #endregion
         }
         else
         {
             lbMessage.Text     = "Error: TM Expression can't be deleted - Expression not found";
             lbMessage.CssClass = "hc_error";
             lbMessage.Visible  = true;
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Show the list of translations for the selected TM Expression
 /// </summary>
 private void ShowTMTranslations()
 {
     using (HCExpression = TMExpression.GetByKey(Convert.ToInt32(expressionId)))
     {
         int TranslationsCount = HCExpression.Translations.Count - HCExpression.TranslationsMissingCount;
         UITools.RefreshTab(Page, "Translations", "'" + TranslationsCount.ToString() + "/" + HCExpression.Translations.Count.ToString() + "'");
         using (TMExpressionTranslationList list = TMExpressionTranslation.GetAll(expressionId, string.Empty))
         {
             dg.DataSource = list;
             Utils.InitGridSort(ref dg, false);
             dg.DisplayLayout.CellClickActionDefault           = CellClickAction.NotSet;
             dg.DisplayLayout.ActivationObject.AllowActivation = false;
             dg.DataBind();
         }
     }
 }
예제 #4
0
파일: TM.aspx.cs 프로젝트: GitJayanth/test3
 /// <summary>
 /// Display the selected expression properties
 /// </summary>
 /// <param name="selTermId">ExpressionId</param>
 void UpdateDataEdit(string selExpressionId)
 {
     SessionState.tmPageIndexExpression = dg.DisplayLayout.Pager.CurrentPageIndex.ToString();
     panelgrid.Visible      = false;
     webTab.EnableViewState = false;
     webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./TM/Expression_Properties.aspx?e=" + selExpressionId;
     if (selExpressionId == "-1")
     {
         #region New TM Expression
         webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "";
         webTab.Tabs[1].Visible = false;
         lbTitle.Text           = "Expression: New";
         #endregion
     }
     else
     {
         #region TM Expression selected
         using (TMExpression exp = TMExpression.GetByKey(Convert.ToInt32(selExpressionId)))
         {
             string expValue = exp.Value.ToString();
             if (expValue.Length > 50)
             {
                 expValue = expValue.Substring(0, 50) + "...";
             }
             lbTitle.Text = "Expression: " + expValue;
             webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./TM/Expression_Translations.aspx?e=" + selExpressionId;
             #region Translation Count
             using (HyperCatalog.Business.LanguageList c = HyperCatalog.Business.Language.GetAll())
             {
                 int LanguagesCount    = c.Count;
                 int TranslationsCount = LanguagesCount - exp.TranslationsMissingCount;
                 webTab.Tabs.GetTab(1).Text = "Translations (" + TranslationsCount.ToString() + "/" + LanguagesCount.ToString() + ")";
             }
             #endregion
             #endregion
         }
     }
     webTab.Visible = true;
 }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     #region Check Capabilities
     if ((SessionState.User.IsReadOnly) || (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_TRANSLATION_MEMORY)))
     {
         uwToolbar.Items.FromKeyButton("Save").Enabled   = false;
         uwToolbar.Items.FromKeyButton("Delete").Enabled = false;
     }
     #endregion
     if (Request["e"] != null)
     {
         expressionId = Convert.ToInt64(Request["e"]);
         languageCode = Request["l"];
         if (!Page.IsPostBack)
         {
             try
             {
                 using (HyperCatalog.Business.Language l = HyperCatalog.Business.Language.GetByKey(languageCode))
                 {
                     string languageName = l.Name;
                     lbLanguage.Text = "[" + languageCode + "] " + languageName;
                 }
                 using (TMExpression t = TMExpression.GetByKey(expressionId))
                 {
                     if (t != null)
                     {
                         txtTMExpressionValueMaster.Text = t.Value;
                         using (TMExpressionTranslation tt = TMExpressionTranslation.GetByKey(expressionId, languageCode))
                         {
                             if (tt == null)
                             {
                                 #region New translation
                                 uwToolbarTitle.Items.FromKeyLabel("Action").Text = "Creating";
                                 hlCreator.Text         = UITools.GetDisplayName(t.User.FullName);
                                 hlCreator.NavigateUrl  = "mailto:" + UITools.GetDisplayEmail(t.User.Email) + Server.HtmlEncode("?subject=TMTranslation[#" + t.Id.ToString() + " - " + t.LanguageCode + "]");;
                                 lbOrganization.Text    = t.User.OrgName;
                                 lbOrganization.Visible = hlCreator.Text == t.User.FullName;
                                 lbCreatedOn.Text       = SessionState.User.FormatUtcDate(t.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime);
                                 #endregion
                             }
                             else
                             {
                                 #region Update translation
                                 uwToolbarTitle.Items.FromKeyLabel("Action").Text = "Updating";
                                 txtTMExpressionValue.Text = tt.Value;
                                 hlCreator.Text            = tt.User.FullName;
                                 hlCreator.NavigateUrl     = "mailto:" + UITools.GetDisplayEmail(tt.User.Email) + Server.HtmlEncode("?subject=TMExpressionTranslation");;
                                 lbOrganization.Text       = tt.User.OrgName;
                                 lbCreatedOn.Text          = SessionState.User.FormatUtcDate(tt.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime);
                                 #endregion
                             }
                         }
                     }
                     else
                     {
                         Response.Write("<script>alert('An error occurred when retrieving translation expression [" + Request["t"] + "]' );window.close();</script>");
                         Response.End();
                     }
                 }
             }
             catch (Exception ex)
             {
                 Response.Write("<script>alert('An error occurred when retrieving translation expression:" + ex.Message + " [" + Request["t"] + "]' );window.close();</script>");
                 Response.End();
             }
         }
     }
 }