Esempio n. 1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         if (Request["m"] != null)
         {
             isMandatory = Convert.ToBoolean(Request["m"]);
         }
         containerId = Convert.ToInt32(Request["d"]);
         culture     = QDEUtils.UpdateCultureCodeFromRequest();
         item        = QDEUtils.GetItemIdFromRequest();
         itemId      = item.Id;
         chunk       = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
         container   = SessionState.QDEContainer;
         if (!Page.IsPostBack)
         {
             lbResult.Text = HyperCatalog.Business.Chunk.LastError;
             UpdateDataView();
         }
     }
     catch (Exception ex)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('" + UITools.CleanJSString(ex.ToString()) + "');top.window.close();</script>");
     }
 }
Esempio n. 2
0
 protected void wBtAccept_Click(object sender, Infragistics.WebUI.WebDataInput.ButtonEventArgs e)
 {
     if (chunk.Delete(SessionState.User.Id))
     {
         try
         {
             chunk = HyperCatalog.Business.Chunk.GetByKey(itemId, containerId, culture.FallbackCode);
             // Updating the session- 3.5 Release Start
             SessionState.QDEChunk = chunk;
             // Updating the session- 3.5 Release End
             if (chunk.Status == ChunkStatus.Final)
             {
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>if (top.opener){if (top.opener.document.getElementById('action')){top.opener.document.getElementById('action').value = 'reload';top.opener.document.forms[0].submit();}}top.window.close();</script>");
             }
             else
             {
                 chunk = null;
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(ChunkStatus.Missing) + "', '');</script>");
             }
         }
         catch (Exception ex)
         {
             lbResult.Text     = "<br/>Error: " + ex.ToString();
             lbResult.CssClass = "hc_error";
             //chunk = null;
             //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(ChunkStatus.Missing) + "', '');</script>");
         }
     }
     else
     {
         lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
         lbResult.CssClass = "hc_error";
     }
 }
Esempio n. 3
0
        private void SaveChunk(ChunkStatus status, bool lockTranslations)
        {
            string error = string.Empty;
            string Value = txtValue.Text;

            if (uwToolbar.Items.FromKeyButton("ilb").Selected)
            {
                Value = HyperCatalog.Business.Chunk.BlankValue;
            }
            //ACQ10.0 Starts
            if (Value.Length <= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, enter a value!');</script>");
                return;
            }
            //ACQ10.0 Ends

            if (chunk != null)
            // Test if user has made a change that allows database update
            {
                if (txtValue.Text != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status)
                {
                    chunk.Text    = Value;
                    chunk.Comment = ChunkComment1.Comment;
                    chunk.Status  = status;
                }
            }
            else
            {
                chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id);
            }
            if (chunk.Save(SessionState.User.Id))
            {
                lbResult.Text     = "<br/>Chunk saved!";
                lbResult.CssClass = "hc_success";
                if (Value == HyperCatalog.Business.Chunk.BlankValue)
                {
                    Value = HyperCatalog.Business.Chunk.BlankText;
                }
                if (!lockTranslations)
                {
                    chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft);
                }
                SessionState.QDEChunk = chunk;
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + UITools.CleanJSString(Value) + "');</script>");
            }
            else
            {
                lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
                lbResult.CssClass = "hc_error";
            }
            lbResult.Visible = true;
        }
Esempio n. 4
0
        private void SaveChunk(ChunkStatus status, bool lockTranslations)
        {
            string error = string.Empty;
            string Value = txtValue.Text;

            if (uwToolbar.Items.FromKeyButton("ilb").Selected)
            {
                Value = HyperCatalog.Business.Chunk.BlankValue;
            }
            if (chunk != null)
            // Test if user has made a change that allows database update
            {
                if (txtValue.Text != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status)
                {
                    chunk.Text    = Value;
                    chunk.Comment = ChunkComment1.Comment;
                    chunk.Status  = status;
                }
            }
            else
            {
                chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id);
            }
            if (chunk.Save(SessionState.User.Id))
            {
                //Added this line for QCs# 839 and 1028
                chunk.ModifyDate = DateTime.UtcNow;
                //Added this line for QCs# 839 and 1028

                lbResult.Text     = "<br/>Chunk saved!";
                lbResult.CssClass = "hc_success";
                if (Value == HyperCatalog.Business.Chunk.BlankValue)
                {
                    Value = HyperCatalog.Business.Chunk.BlankText;
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + Value.Replace("'", "\\\'") + "');</script>");
                if (!lockTranslations)
                {
                    chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft);
                    SessionState.QDEChunk = chunk;
                }

                //Added this line for QCs# 839 and 1028
                ChunkModifier1.Chunk = chunk;
                //Added this line for QCs# 839 and 1028
            }
            else
            {
                lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
                lbResult.CssClass = "hc_error";
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                /*#ACQ10.0 Starts
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 * #ACQ10.0 Ends
                 */
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('Chunk not found!');window.close()</script>");
            }

            //Modified this line for QCs# 839 and 1028
            ChunkButtonBar.Chunk = chunk;
            //Modified this line for QCs# 839 and 1028



            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Item      = item;
            ChunkButtonBar.Container = container;
            ChunkButtonBar.Culture   = culture;
            if (!Page.IsPostBack)
            {
                //Added these lines for QCs# 839 and 1028
                ChunkComment1.Chunk  = chunk;
                ChunkModifier1.Chunk = chunk;
                //Added these lines for QCs# 839 and 1028


                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }
Esempio n. 6
0
 private void DeleteChunk()
 {
     if (chunk.Delete(SessionState.User.Id))
     {
         chunk = null;
         uwToolbar.Items.FromKeyButton("ilb").Pressed(false);
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(ChunkStatus.Missing) + "', '');</script>");
     }
     else
     {
         lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
         lbResult.CssClass = "hc_error";
     }
 }
Esempio n. 7
0
 private void Chunk_CopyClick(object sender, ChunkButtonBarEventArgs e)
 {
     HyperCatalog.Business.Chunk c = HyperCatalog.Business.Chunk.GetByKey(itemId, containerId, culture.FallbackCode);
     if (c != null)
     {
         txtValue.Text     = c.Text;
         lbResult.Text     = "Valued copied from master";
         lbResult.CssClass = "hc_success";
         lbResult.Visible  = true;
     }
     else
     {
         lbResult.Text     = "No master value found";
         lbResult.CssClass = "hc_error";
         lbResult.Visible  = true;
     }
 }
Esempio n. 8
0
        private object GetExistingMasterPublishingDate()
        {
            Item curItem = item;

            if (item.GetRoll() != null && rdSoftRoll.Checked)
            {
                curItem = item.GetRoll();
            }

            using (HyperCatalog.Business.Chunk mpd = HyperCatalog.Business.Chunk.GetByKey(curItem.Id, 3, SessionState.Culture.Code))
            {
                if (mpd != null)
                {
                    System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
                    return(Convert.ToDateTime(mpd.Text, ci.DateTimeFormat));
                }
            }
            return(null);
        }
Esempio n. 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                cultureCode = QDEUtils.UpdateCultureCodeFromRequest().Code;
                itemId      = QDEUtils.GetQueryItemIdFromRequest();
                chunk       = ChunkWindow.GetChunk(itemId, containerId, cultureCode);

                if (!Page.IsPostBack)
                {
                    ShowHistory();
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('Error: " + UITools.CleanJSString(ex.ToString()) + "'");
            }
        }
Esempio n. 10
0
 private void Chunk_CopyClick(object sender, ChunkButtonBarEventArgs e)
 {
     HyperCatalog.Business.Chunk c = HyperCatalog.Business.Chunk.GetByKey(itemId, containerId, culture.FallbackCode);
     if (c != null)
     {
         string[] parts = c.Text.Split(Convert.ToChar("/"));
         dateValue.Value = new DateTime(Convert.ToInt32(parts[2]), Convert.ToInt32(parts[0]), Convert.ToInt32(parts[1]));
         //dateValue.Value = Convert.ToDateTime(c.Text);
         lbResult.Text     = "Valued copied from master";
         lbResult.CssClass = "hc_success";
         lbResult.Visible  = true;
     }
     else
     {
         lbResult.Text     = "No master value found";
         lbResult.CssClass = "hc_error";
         lbResult.Visible  = true;
     }
 }
Esempio n. 11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                containerId       = Convert.ToInt32(Request["d"]);
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                /*
                 * #ACQ10.0 Starts
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * uwToolbar.Visible = false;
                 * }
                 #ACQ10.0 Ends
                 */
                rdNo.Attributes.Add("onClick", "dc()");
                rdYes.Attributes.Add("onClick", "dc()");
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>window.close()</script>");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");
            if (!Page.IsPostBack)
            {
                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }
Esempio n. 12
0
        private void SaveChunk(ChunkStatus status, bool lockTranslations)
        {
            string error    = string.Empty;
            string imgValue = txtImagePath.Value;

            if (uwToolbar.Items.FromKeyButton("ilb").Selected)
            {
                imgValue = HyperCatalog.Business.Chunk.BlankValue;
            }
            //ACQ10.0 Starts
            if (imgValue.Length <= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, enter a value!');</script>");
                return;
            }
            //ACQ10.0 Ends
            if (chunk != null)
            // Test if user has made a change that allows database update
            {
                if (imgValue != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status)
                {
                    chunk.Text    = imgValue;
                    chunk.Comment = ChunkComment1.Comment;
                    chunk.Status  = status;
                }
            }
            else
            {
                chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, imgValue, ChunkComment1.Comment, status, SessionState.User.Id);
            }
            if (chunk.Save(SessionState.User.Id))
            {
                //Added this line for QCs# 839 and 1028
                chunk.ModifyDate = DateTime.UtcNow;
                //Added this line for QCs# 839 and 1028

                lbResult.Text     = "<br/>Chunk saved!";
                lbResult.CssClass = "hc_success";
                if (imgValue == HyperCatalog.Business.Chunk.BlankValue)
                {
                    imgValue = HyperCatalog.Business.Chunk.BlankText;
                }
                else
                {
                    XmlDocument xmlInfo = new XmlDocument();
                    xmlInfo.LoadXml(HCPage.WSDam.ResourceGetByPath(imgValue));
                    System.Xml.XmlNode node     = xmlInfo.DocumentElement;
                    string             fullPath = node.Attributes["uri"].InnerText;
                    if (fullPath.ToLower().IndexOf("notfound") > 0 || fullPath == string.Empty)
                    {
                        fullPath = "/hc_v4/img/ed_notfound.gif";
                    }
                    imgValue = "<img src='" + fullPath + "?thumbnail=1&size=40' title='" + imgValue + "' border=0/>";
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + imgValue.Replace("'", "\\\'") + "');</script>");
                if (!lockTranslations)
                {
                    chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft);
                    SessionState.QDEChunk = chunk;
                }

                //Added this line for QCs# 839 and 1028
                ChunkModifier1.Chunk = chunk;
                //Added this line for QCs# 839 and 1028
            }
            else
            {
                lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
                lbResult.CssClass = "hc_error";
            }
            lbResult.Visible = true;
        }
Esempio n. 13
0
        private void ShowChunk()
        {
            // *************************************************************************
            // Retrieve information about the current container
            // *************************************************************************
            string Value = string.Empty, comment = string.Empty;
            string cultureCode = culture.FallbackCode;

            while (cultureCode != null && cultureCode != string.Empty)
            {
                chunk = HyperCatalog.Business.Chunk.GetByKey(itemId, containerId, cultureCode);
                if (chunk != null)
                {
                    cultureCode = string.Empty;
                }
                else
                {
                    cultureCode = HyperCatalog.Business.Culture.GetByKey(cultureCode).FallbackCode;
                }
            }

            if (chunk != null)
            {
                txtValue.Text = chunk.Text;
                if (chunk.Text == HyperCatalog.Business.Chunk.BlankValue)
                {
                    txtValue.Text = HyperCatalog.Business.Chunk.BlankText;
                }
                imgStatus.ImageUrl     = "/hc_v4/img/S" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + ".gif";
                lbStatus.Text          = "[" + chunk.Status.ToString() + "]";
                ChunkComment1.Chunk    = ChunkModifier1.Chunk = chunk;
                ChunkModifier1.Visible = true;

                if (chunk.Text != HyperCatalog.Business.Chunk.BlankValue && (chunk.Container.DataTypeCode == 'P' || chunk.Container.ContainerTypeCode == 'P'))
                {
                    System.Xml.XmlDocument xmlInfo = new System.Xml.XmlDocument();
                    string imgPath = HCPage.WSDam.ResourceGetByPath(chunk.Text);
                    if (imgPath != string.Empty)
                    {
                        try
                        {
                            xmlInfo.LoadXml(imgPath);
                            System.Xml.XmlNode node     = xmlInfo.DocumentElement;
                            System.Xml.XmlNode fileNode = node.FirstChild;
                            string             fullPath = node.Attributes["uri"].InnerText;
                            imgPreview.ImageUrl = fullPath + "?thumbnail=1&size=40&culture=" + cultureCode;
                            imgPreview.ToolTip  = chunk.Text;
                        }
                        catch (Exception ex)
                        {
                            imgPreview.ImageUrl = "/hc_v4/img/ed_notfound.gif";
                            imgPreview.ToolTip  = "An exception occurred: " + ex.Message;
                            Trace.Warn("DAM", "Exception processing DAM: " + ex.Message);
                        }
                    }
                }
                else
                {
                    imgPreview.Visible = false;
                }
            }
            else
            {
                //Response.Write("<script>top.window.close();</script>");
                Response.Write("culture.Code=" + culture.Code);
                Response.Write("containerId=" + containerId.ToString());
                Response.Write("ItemId=" + itemId.ToString());
                Response.End();
            }
        }
Esempio n. 14
0
        private void SaveChunk(ChunkStatus status, bool lockTranslations)
        {
            string error = string.Empty;
            string Value = string.Empty;

            if (Request["rd"] != null || !dg.Columns.FromKey("InScope").ServerOnly || uwToolbar.Items.FromKeyButton("ilb").Selected)
            {
                //#ACQ10.0 Starts
                if (Request["rd"] == HyperCatalog.Business.Chunk.BlankText)
                {
                    uwToolbar.Items.FromKeyButton("ilb").Pressed(true);
                    uwToolbar.Items.FromKeyButton("ilb").Selected = true;
                }
                //#ACQ10.0 Ends
                if (uwToolbar.Items.FromKeyButton("ilb").Selected)
                {
                    Value = HyperCatalog.Business.Chunk.BlankValue;
                }
                else if (Request["rd"] != null) // --> radion button (single choice)
                {
                    if (ViewState["Source"].ToString() == "Lookup")
                    {
                        LookupValue lValue = LookupValue.GetByKey(Convert.ToInt32(Request["rd"]));
                        Value = lValue.Text;
                    }
                    else
                    {
                        InputFormValue lValue = InputFormValue.GetByKey(Convert.ToInt32(Request["rd"]));
                        Value = lValue.Text;
                    }
                }
                else // (multi choice)
                {
                    string separator = "; ";
                    bool   success   = true;
                    string curText   = string.Empty;
                    if (dg != null && dg.Rows != null && dg.Rows.Count > 0)
                    {
                        foreach (UltraGridRow r in dg.Rows)
                        {
                            if (Convert.ToBoolean(r.Cells.FromKey("InScope").Value))
                            {
                                //#ACQ10.0 Stats  Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scrollview", "<script>rowIndex = " + e.Row.Index.ToString() + ";</script>");
                                if ((Convert.ToInt32(r.Cells.FromKey("Id").Value) != 0) && (Value.IndexOf(HyperCatalog.Business.Chunk.BlankValue) < 0))
                                {
                                    //#ACQ10.0 Ends
                                    if (ViewState["Source"].ToString() == "Lookup")
                                    {
                                        LookupValue lValue = LookupValue.GetByKey(Convert.ToInt32(r.Cells.FromKey("Id").Value));
                                        curText = lValue.Text;
                                    }
                                    else
                                    {
                                        InputFormValue lValue = InputFormValue.GetByKey(Convert.ToInt32(r.Cells.FromKey("Id").Value));
                                        curText = lValue.Text;
                                    }
                                    if (Value.Length > 0)
                                    {
                                        Value += separator.ToString();
                                    }
                                    Value += curText;
                                }
                                else
                                {
                                    Value = HyperCatalog.Business.Chunk.BlankValue;
                                }
                            }
                        }
                    }
                }
                //ACQ10.0 Starts
                //If the value is empty the user will get a message asking the select a value and no value will be saved into application
                if (Value.Length <= 0)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, select a value!');</script>");
                    return;
                }
                //ACQ10.0 Ends

                if (chunk != null)
                // Test if user has made a change that allows database update
                {
                    if (Value != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status)
                    {
                        chunk.Text    = Value;
                        chunk.Comment = ChunkComment1.Comment;
                        chunk.Status  = status;
                    }
                }
                else
                {
                    chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id);
                }
                if (chunk.Save(SessionState.User.Id))
                {
                    //Added this line for QCs# 839 and 1028
                    chunk.ModifyDate = DateTime.UtcNow;
                    //Added this line for QCs# 839 and 1028

                    lbResult.Text     = "<br/>Chunk saved!";
                    lbResult.CssClass = "hc_success";
                    lbResult.Visible  = true;
                    if (chunk.Text == HyperCatalog.Business.Chunk.BlankValue)
                    {
                        chunk.Text = HyperCatalog.Business.Chunk.BlankText;
                    }
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + UITools.CleanJSString(chunk.Text) + "');</script>");
                    if (!lockTranslations)
                    {
                        chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft);
                        SessionState.QDEChunk = chunk;
                    }

                    //Added this line for QCs# 839 and 1028
                    ChunkModifier1.Chunk = chunk;
                    //Added this line for QCs# 839 and 1028
                }
                else
                {
                    lbResult.Text     = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError;
                    lbResult.CssClass = "hc_error";
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, select a value!');</script>");
            }
        }
Esempio n. 15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                //code added on 17th November 2011 for Chunk Edit Validation for XSS Vulnerability Fix - start
                if (SessionState.CacheParams.Exists("XSS_RestrictedHTMLTags"))
                {
                    keyword = SessionState.CacheParams["XSS_RestrictedHTMLTags"].Value.ToString();
                }
                //code added on 17th November 2011 for Chunk Edit Validation for XSS Vulnerability Fix - end

                #region Spell Checker
                string masterLanguage = string.Empty;
                masterLanguage = HyperCatalog.Shared.SessionState.MasterCulture.LanguageCode;
                if (culture.LanguageCode != masterLanguage)
                {
                    UITools.HideToolBarSeparator(uwToolbar, "spellsep");
                    UITools.HideToolBarButton(uwToolbar, "spell");
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "VarsForSpellChecker", "<script>var itemId=" + itemId.ToString() + ";var containerId=" + containerId + ";</script>");
                #endregion

                /*#ACQ10.0 Starts
                 * // Commented to bring out ILB for all catalogue irespective of mandatory status
                 * // Only allow ILB for mandatory chunks and only at sku level for push down
                 * if (!isMandatory  || culture.Type == CultureType.Regionale)
                 * {
                 *  UITools.HideToolBarSeparator(uwToolbar, "ilbSep");
                 *  UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 * #ACQ10.0 Ends
                 */
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('Chunk not found!');window.close()</script>");
            }

            ChunkComment1.Chunk      = ChunkModifier1.Chunk = ChunkButtonBar.Chunk = chunk;
            ChunkButtonBar.Container = container;
            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Culture   = culture;
            ChunkButtonBar.Item      = item;
            if (!Page.IsPostBack)
            {
                lbResult.Text = string.Empty;
                WebSpellChecker1.WebSpellCheckerDialogPage += "?i=" + itemId.ToString() + "&c=" + containerId.ToString();
                UpdateDataView();
            }
            #region Spell Checker
            WebSpellChecker1.SpellOptions.AllowCaseInsensitiveSuggestions = true;
            WebSpellChecker1.SpellOptions.AllowMixedCase       = false;
            WebSpellChecker1.SpellOptions.AllowWordsWithDigits = true;
            WebSpellChecker1.SpellOptions.AllowXML             = true;
            WebSpellChecker1.SpellOptions.CheckHyphenatedText  = true;
            WebSpellChecker1.SpellOptions.IncludeUserDictionaryInSuggestions       = true;
            WebSpellChecker1.SpellOptions.PerformanceOptions.AllowCapitalizedWords = true;
            WebSpellChecker1.SpellOptions.PerformanceOptions.CheckCompoundWords    = false;
            WebSpellChecker1.SpellOptions.PerformanceOptions.ConsiderationRange    = -1;
            WebSpellChecker1.SpellOptions.PerformanceOptions.SplitWordThreshold    = 3;
            WebSpellChecker1.SpellOptions.PerformanceOptions.SuggestSplitWords     = true;
            WebSpellChecker1.SpellOptions.SeparateHyphenWords = false;
            #endregion
        }
Esempio n. 16
0
 public static void ForceTranslationsTo(HyperCatalog.Business.Chunk chunk, int userId, ChunkStatus status)
 {
     chunk.ForceTranslationsTo(userId, status);
     //SessionState.QDEChunk = null;
 }
Esempio n. 17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                uwToolbar.Enabled = Request["ui"] != null;

                if (Request["ifid"] != null)
                {
                    ifContainer = InputFormContainer.GetByKey(Convert.ToInt32(Request["ifid"]));
                }

                /*#ACQ10.0 Starts --Commented
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 */
                UITools.HideToolBarButton(uwToolbar, "ilb");
                //#ACQ10.0 Ends

                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");

                //Modified this line for QCs# 839 and 1028
                ChunkButtonBar.Chunk = chunk;
                //Modified this line for QCs# 839 and 1028

                ChunkButtonBar.Container = SessionState.QDEContainer;
                ChunkButtonBar.User      = SessionState.User;
                ChunkButtonBar.Culture   = culture;
                ChunkButtonBar.Item      = item;
                if (!Page.IsPostBack)
                {
                    //Added these lines for QCs# 839 and 1028
                    ChunkComment1.Chunk  = chunk;
                    ChunkModifier1.Chunk = chunk;
                    //Added these lines for QCs# 839 and 1028

                    lbResult.Text = string.Empty;
                    UpdateDataView();
                }
                else
                {
                    if (Request["__EVENTTARGET"] != null) // Check if user is trying to sort a group
                    {
                        if (Request["__EVENTTARGET"].ToString() == "rowup" || Request["__EVENTTARGET"].ToString() == "rowdown")
                        {
                            SortRow(Request["__EVENTTARGET"].ToString() == "rowup", Convert.ToInt32(Request["__EVENTARGUMENT"]));
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('" + UITools.CleanJSString(ex.ToString()) + "');top.window.close();</script>");
            }
        }
Esempio n. 18
0
        private void ShowTabs()
        {
            webTab.Tabs.Clear();
            if (SessionState.CurrentItem != null)
            {
                HyperCatalog.Business.Chunk localizedProductNameChunk = null;
                try
                {
                    if (SessionState.Culture.Type != CultureType.Master && ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value))
                    {
                        localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                    }
                    if (localizedProductNameChunk == null)
                    {
                        lbItemName.Text = SessionState.CurrentItem.FullName;
                    }
                    else
                    {
                        if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                        {
                            lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] - " + localizedProductNameChunk.Text;
                        }
                        else
                        {
                            lbItemName.Text = localizedProductNameChunk.Text;
                        }
                    }
                }
                finally
                {
                    if (localizedProductNameChunk != null)
                    {
                        localizedProductNameChunk.Dispose();
                    }
                }
                if (lbItemName.Text.Length > 50)
                {
                    lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                }
                itemLevelName = SessionState.CurrentItem.Level.Name;

                InputForm defaultInputForm = InputForm.GetByKey(0);

                // Add input form tabs
                string tabTitle          = string.Empty;
                string tabDesc           = string.Empty;
                int    nbMandatoryChunks = 0;

                #region "Master or Region or Locale to create country specific"
                if (SessionState.Culture.Type == CultureType.Master ||
                    SessionState.Culture.Type == CultureType.Regionale ||
                    (SessionState.Culture.Type == CultureType.Locale && SessionState.CurrentItem.IsCountrySpecific))
                {
                    // Add information tab
                    AddTab("Information", "Information for item #" + SessionState.CurrentItem.Id.ToString(), "tb_info", "/hc_v4/img/ed_about.gif", "QDE_ItemAbout.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);

                    // Not other tab if item is for country specific (in master culture)
                    if (!(SessionState.CurrentItem.IsCountrySpecific && SessionState.Culture.Type == CultureType.Master))
                    {
                        InputFormList itemInputForms = SessionState.CurrentItem.GetInputForms(SessionState.Culture.Code);
                        if (itemInputForms != null)
                        {
                            if (itemInputForms.Count > 0)
                            {
                                foreach (InputForm inputForm in itemInputForms)
                                {
                                    if (inputForm.ShortName != string.Empty && inputForm.Id != 0)
                                    {
                                        nbMandatoryChunks = 0;
                                        foreach (InputFormContainer ifc in inputForm.Containers)
                                        {
                                            if (ifc.Mandatory)
                                            {
                                                nbMandatoryChunks++;
                                            }
                                        }
                                        tabTitle = inputForm.ShortName + " (" + nbMandatoryChunks.ToString() + "/" + inputForm.Containers.Count.ToString() + ")";
                                        tabDesc  = inputForm.Description + " (Mandatory/Total)";
                                        AddTab(tabTitle, tabDesc, "tb_" + inputForm.Id.ToString(), "/hc_v4/img/ed_inputforms.gif", "QDE_FormContent.aspx?i=" + SessionState.CurrentItem.Id + "&f=IF_" + inputForm.Id.ToString() + "&c=" + SessionState.Culture.Code);
                                    }
                                }
                            }
                            tabTitle = "Content";
                            tabDesc  = "Content attached to this product (Mandatory/Total)";
                            AddTab(tabTitle, tabDesc, "tb_all", "/hc_v4/img/ed_content.gif", "QDE_FormContent.aspx?i=" + SessionState.CurrentItem.Id + "&f=IF_-1" + "&c=" + SessionState.Culture.Code);

                            // Add link tab
                            if (Convert.ToInt32(SessionState.CacheParams["LinksStartLevel"].Value) <= SessionState.CurrentItem.LevelId &&
                                SessionState.CurrentItem.LevelId <= HyperCatalog.Shared.SessionState.SkuLevel.Id &&
                                !SessionState.CurrentItem.IsRoll)
                            {
                                AddTab("Links", "Product compatibilities and links", "tb_lnk", "/hc_v4/img/ed_links.gif", "../links/Links_main.aspx?i=" + SessionState.CurrentItem.Id.ToString() + "&c=" + SessionState.Culture.Code);
                            }
                        }

                        if (SessionState.CurrentItem.LevelId <= HyperCatalog.Shared.SessionState.SkuLevel.Id)
                        {
                            // Add Delivery tab
                            AddTab("Delivery", "Chunks to deliver", "tb_delivery", "/hc_v4/img/ed_delivery.gif", "QDE_Delivery.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);
                            //Added for Merging PDB view tab with 9.0
                            AddTab("PDBView", "Data Delivered to PDB", "tb_PDBVIew", "/hc_v4/img/ed_delivery.gif", "QDE_PDBView.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code);
                            //Added for Merging PDB view tab with 9.0
                        }
                        if (SessionState.QDETab != null)
                        {
                            if (webTab.Tabs.FromKeyTab(SessionState.QDETab) != null)
                            {
                                webTab.SelectedTabObject = webTab.Tabs.FromKeyTab(SessionState.QDETab);
                            }
                            else
                            {
                                webTab.SelectedTabIndex = 0;
                                SessionState.QDETab     = webTab.Tabs[0].Key;
                            }
                        }
                        else
                        {
                            webTab.SelectedTabIndex = 0;
                            SessionState.QDETab     = webTab.Tabs[0].Key;
                        }
                    }
                }
            }
            #endregion
        }
Esempio n. 19
0
        private void webTab_TabClick(object sender, Infragistics.WebUI.UltraWebTab.WebTabEvent e)
        {
            HyperCatalog.Business.Chunk localizedProductNameChunk = null;
            try
            {
                bool isRoll = false;
                if (SessionState.CurrentItem != null)
                {
                    if (e.Tab.Key == "tb_ori")
                    {
                        if (SessionState.Culture.Type != CultureType.Master)
                        {
                            localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                        }

                        // Update item name and level name
                        if (localizedProductNameChunk == null)
                        {
                            lbItemName.Text = SessionState.CurrentItem.FullName;
                        }
                        else
                        {
                            if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                            {
                                lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] " + localizedProductNameChunk.Text;
                            }
                            else
                            {
                                lbItemName.Text = localizedProductNameChunk.Text;
                            }
                        }

                        itemLevelName = SessionState.CurrentItem.Level.Name;
                    }
                    else // tb_roll
                    {
                        using (Item rollItem = SessionState.CurrentItem.GetRoll())
                        {
                            if (rollItem != null)
                            {
                                isRoll          = true;
                                lbItemName.Text = rollItem.FullName;
                                if (SessionState.Culture.Type != CultureType.Master)
                                {
                                    localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(rollItem.Id, 1, SessionState.Culture.Code);
                                }

                                // Update item name and level name
                                if (localizedProductNameChunk == null)
                                {
                                    lbItemName.Text = rollItem.FullName;
                                }
                                else
                                {
                                    if (rollItem.Sku != null && rollItem.Sku.Length > 0)
                                    {
                                        lbItemName.Text = "[" + rollItem.Sku + "] - " + localizedProductNameChunk.Text;
                                    }
                                    else
                                    {
                                        lbItemName.Text = localizedProductNameChunk.Text;
                                    }
                                }

                                itemLevelName = rollItem.Level.Name;
                            }
                        }
                    }

                    if (lbItemName.Text.Length > 50)
                    {
                        lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                    }

                    if (isRoll)
                    {
                        lbItemName.Text = "<img src='/hc_v4/img/ed_roll.gif'> " + lbItemName.Text;
                    }
                }
            }
            finally
            {
                if (localizedProductNameChunk != null)
                {
                    localizedProductNameChunk.Dispose();
                }
            }
        }
Esempio n. 20
0
        private void ShowTabs()
        {
            webTab.Tabs.Clear();
            HyperCatalog.Business.Chunk localizedProductNameChunk = null;
            try
            {
                if (SessionState.Culture.Type != CultureType.Master && ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value))
                {
                    localizedProductNameChunk = HyperCatalog.Business.Chunk.GetByKey(SessionState.CurrentItem.Id, 1, SessionState.Culture.Code);
                }

                // Update item name and level name
                if (localizedProductNameChunk == null)
                {
                    lbItemName.Text = SessionState.CurrentItem.FullName;
                }
                else
                {
                    if (SessionState.CurrentItem.Sku != null && SessionState.CurrentItem.Sku.Length > 0)
                    {
                        lbItemName.Text = "[" + SessionState.CurrentItem.Sku + "] - " + localizedProductNameChunk.Text;
                    }
                    else
                    {
                        lbItemName.Text = localizedProductNameChunk.Text;
                    }
                }
                if (lbItemName.Text.Length > 50)
                {
                    lbItemName.Text = lbItemName.Text.Substring(0, 49) + "...";
                }
                if (SessionState.CurrentItem.IsRoll)
                {
                    lbItemName.Text = "<img src='/hc_v4/img/ed_roll.gif'> " + lbItemName.Text;
                }

                itemLevelName = SessionState.CurrentItem.Level.Name;
                string url1, url2;
                if (SessionState.CurrentItem.IsRoll) // item is roll
                {
                    // Add tabs (original and roll)
                    url1 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.RefItemId;
                    url2 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.Id;
                    if (SessionState.Culture.Type == CultureType.Locale && !SessionState.CurrentItem.IsCountrySpecific)
                    {
                        url1 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.RefItemId + "&c=" + SessionState.Culture.Code;
                        url2 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code;
                    }
                    AddTab("Original", "Original item", "tb_ori", "/hc_v4/img/ed_content.gif", url1);
                    AddTab("Roll", "Roll item", "tb_roll", "/hc_v4/img/ed_roll.gif", url2);

                    webTab.SelectedTabIndex = 1; // roll is selected
                }
                else // item is original
                {
                    // Add tabs (original and roll)
                    url1 = "QDE_Forms.aspx?i=" + SessionState.CurrentItem.Id;
                    url2 = "QDE_Forms.aspx?i=" + itemRoll.Id;
                    if (SessionState.Culture.Type == CultureType.Locale && !SessionState.CurrentItem.IsCountrySpecific)
                    {
                        url1 = "QDE_CountryViewMain.aspx?i=" + SessionState.CurrentItem.Id + "&c=" + SessionState.Culture.Code;
                        url2 = "QDE_CountryViewMain.aspx?i=" + itemRoll.Id + "&c=" + SessionState.Culture.Code;
                    }
                    AddTab("Original", "Original item", "tb_ori", "/hc_v4/img/ed_content.gif", url1);
                    AddTab("Roll", "Roll item", "tb_roll", "/hc_v4/img/ed_roll.gif", url2);
                    webTab.SelectedTabIndex = 0; // original is selected
                }
            }
            finally
            {
                if (localizedProductNameChunk != null)
                {
                    localizedProductNameChunk.Dispose();
                }
            }
        }
Esempio n. 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        using (item = QDEUtils.GetItemIdFromRequest())
        {
            levelId = item.LevelId;
            QDEUtils.UpdateCultureCodeFromRequest();
            #region retrieve translated product name
            string itemName = item.Name;
            if ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_TRANSLATED_NAMES).Value)
            {
                using (HyperCatalog.Business.Chunk localizedItemNameChunk = HyperCatalog.Business.Chunk.GetByKey(item.Id, 1, SessionState.Culture.Code))
                {
                    if (localizedItemNameChunk != null)
                    {
                        itemName = localizedItemNameChunk.Text;
                    }
                }
            }
            #endregion
            if (item.Sku != string.Empty)
            {
                lTitle.Text = "[" + item.Sku + "] " + itemName;
            }
            else
            {
                lTitle.Text = itemName;
            }
            if (item.IsRoll)
            {
                lTitle.Text = "<img src='/hc_v4/img/ed_roll.gif' align='middle' title='Soft roll' border=0/> " + lTitle.Text;
            }
            lLevel.Text = item.Level.Name;

            //Modification for the Enhancement BUG# 70135


            for (int i = 0; i < webTab.Tabs.Count; i++)
            {
                string strTargetUrl = ((Tab)webTab.Tabs[i]).ContentPane.TargetUrl;

                if (strTargetUrl == "./qde_countryview.aspx?view=content")
                {
                    ((Tab)webTab.Tabs[i]).ContentPane.TargetUrl += "&i=" + item.Id + "&f=IF_-1" + "&c=" + SessionState.Culture.Code;
                }//added for Merge of 8.5.01 with 9.0
                else if (strTargetUrl == "./qde_PDBView.aspx")
                {
                    ((Tab)webTab.Tabs[i]).ContentPane.TargetUrl = ((Tab)webTab.Tabs[i]).ContentPane.TargetUrl;
                }//added for Merge of 8.5.01 with 9.0
                else
                {
                    ((Tab)webTab.Tabs[i]).ContentPane.TargetUrl += "&i=" + item.Id + "&c=" + SessionState.Culture.Code;
                }
            }

            //Modification for the Enhancement
        }
        string linksStartLevel = HyperCatalog.Business.ApplicationSettings.Parameters["LinksStartLevel"].Value.ToString();

        //Kalai code start here
        //if (item.Level.Id < Convert.ToInt32(linksStartLevel))
        //{
        //  webTab.Tabs.FromKey("links").Visible = webTab.Tabs.FromKey("cross").Visible = false;
        //}
        //else
        //{
        //  webTab.Tabs.FromKey("links").Visible = webTab.Tabs.FromKey("cross").Visible = true;
        //}
        //Kalai code ends here
        if (SessionState.QDETab != null)
        {
            if (webTab.Tabs.FromKeyTab(SessionState.QDETab) != null)
            {
                webTab.SelectedTabObject = webTab.Tabs.FromKeyTab(SessionState.QDETab);
            }
            else
            {
                webTab.SelectedTabIndex = 0;
                SessionState.QDETab     = webTab.Tabs[0].Key;
            }
        }
        else
        {
            webTab.SelectedTabIndex = 0;
            SessionState.QDETab     = webTab.Tabs[0].Key;
        }
    }
Esempio n. 22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture = QDEUtils.UpdateCultureCodeFromRequest();
                item    = QDEUtils.GetItemIdFromRequest();
                // Fix for QC#7852 - Assigned the correct item Id to the itemID variable before retrieving the Chunk..
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;
                System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
                ci.DateTimeFormat.ShortDatePattern = SessionState.User.FormatDate;
                ci.DateTimeFormat.LongDatePattern  = SessionState.User.FormatDate;
                dateValue.CalendarLayout.Culture   = ci;
                System.Threading.Thread.CurrentThread.CurrentCulture = ci;
                //ACQ10.0 Starts
                //if (!isMandatory || culture.Type == CultureType.Regionale)
                //{
                //  UITools.HideToolBarButton(uwToolbar, "ilb");
                //}
                //ACQ10.0 Ends
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>window.close()</script>");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");


            //Modified this line for QCs# 839 and 1028
            ChunkButtonBar.Chunk = chunk;
            //Modified this line for QCs# 839 and 1028


            ChunkButtonBar.Container = container;
            ChunkButtonBar.Item      = item;
            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Culture   = culture;

            //#ACQ10.0 Starts
            if (chunk != null)
            {
                if (chunk.Text == HyperCatalog.Business.Chunk.BlankValue)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "VarBlankChunk", "<script>var isBlankChunk = true;</script>");
                    //dateValue.Enabled = false;
                    dateValue.Value = HyperCatalog.Business.Chunk.BlankText;
                }
            }
            //#ACQ10.0 Ends
            if (!Page.IsPostBack)
            {
                //Added these line for QCs# 839 and 1028
                ChunkComment1.Chunk  = chunk;
                ChunkModifier1.Chunk = chunk;
                //Added this line for QCs# 839 and 1028

                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }