예제 #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>");
     }
 }
예제 #2
0
    void UpdateDataView()
    {
        using (HyperCatalog.Business.Container container = HyperCatalog.Business.Container.GetByKey(containerId))
        {
            //HyperCatalog.Business.ChunkList chunks = container.Chunks(HyperCatalog.Shared.SessionState.Culture.Code);
            using (HyperCatalog.Business.ChunkList chunks = container.Chunks(CultureList.SelectedValue.ToString()))
            {
                if (chunks != null)
                {
                    if (chunks.Count > 0)
                    {
                        dg.DataSource = chunks;
                        Utils.InitGridSort(ref dg);
                        dg.DataBind();

                        UITools.RefreshTab(this.Page, "Usage", dg.Rows.Count);

                        dg.Visible          = true;
                        lbNoresults.Visible = false;
                    }
                    else
                    {
                        dg.Visible          = false;
                        lbNoresults.Visible = true;
                    }
                }
            }
        }
    }
예제 #3
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (SessionState.User.IsReadOnly)
        {
            uwToolbar.Items.FromKeyButton("Save").Enabled   = false;
            uwToolbar.Items.FromKeyButton("Delete").Enabled = false;
        }

        if (Request["c"] != null)
        {
            containerId = Convert.ToInt32(Request["c"]);
        }

        if (SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_ITEM_PDB_REPUBLISH) && containerId != -999)

        {
            uwToolbar.Items.FromKeyButton("RePublish").Visible = true;
        }

        else
        {
            uwToolbar.Items.FromKeyButton("RePublish").Visible = false;
            UITools.HideToolBarSeparator(uwToolbar, "RePublishSep");
        }


        if (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_DICTIONARY))
        {
            UITools.HideToolBarButton(uwToolbar, "Save");
            UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
            UITools.HideToolBarButton(uwToolbar, "Delete");
            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");
        }

        try
        {
            using (container = HyperCatalog.Business.Container.GetByKey(containerId))
            {
                if (Request["u"] != null && Request["u"].ToString() == "1")
                {
                    lbError.CssClass = "hc_success";
                    lbError.Text     = "Data saved!";
                    lbError.Visible  = true;
                }

                ShowHintInfo();

                if (!Page.IsPostBack)
                {
                    UpdateDataEdit();
                }
            }
        }
        catch (Exception ex)
        {
            //				Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"clientScript", "<script>UpdateTabs(-1);</script>");
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>alert('" + UITools.CleanJSString(ex.ToString()) + "')</script>");
        }
    }
예제 #4
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();
            }
        }
예제 #5
0
    private void uwToolbar_ButtonClicked(object sender, Infragistics.WebUI.UltraWebToolbar.ButtonEvent be)
    {
        string btn = be.Button.Key.ToLower();

        if (btn == "export")
        {
            using (HyperCatalog.Business.Container container = HyperCatalog.Business.Container.GetByKey(Convert.ToInt32(containerId)))
            {
                if (container != null)
                {
                    Utils.ExportToExcel(dg, "[" + container.Tag + "] " + container.Name + " - InputForms", "[" + container.Tag + "] " + container.Name + " - InputForms");
                }
            }
        }
    }
    private void CheckDependency()
    {
        InputForm inputForm = InputForm.GetByKey(InputFormId);

        if (inputForm != null)
        {
            if (refContainer.ContainerTypeCode == 'F') // feature container
            {
                // Retrieve all container dependencies for this feature container
                string filter = " FeatureContainerId=" + refContainer.Id;
                using (ContainerDependencyList dependencies = ContainerDependency.GetAll(filter))
                {
                    if ((dependencies != null) && (dependencies.Count > 0))
                    {
                        // Create list of tech spec containers (in container dependencies)
                        string techSpecsList = string.Empty;
                        foreach (HyperCatalog.Business.ContainerDependency d in dependencies)
                        {
                            // Current tech spec container
                            HyperCatalog.Business.Container techSpecContainer = d.TechspecContainer;

                            // tech spec container is or not attached to this input form
                            int i = 0;
                            using (InputFormContainerList ifcList = InputFormContainer.GetAll("InputFormId=" + InputFormId + " AND ContainerId=" + techSpecContainer.Id))
                            {
                                if ((ifcList == null) || (ifcList.Count == 0))
                                {
                                    i++;
                                    if (techSpecsList.Length > 0)
                                    {
                                        techSpecsList += "\\n";
                                    }
                                    techSpecsList += " " + i.ToString() + " - " + techSpecContainer.Name + " [" + techSpecContainer.Tag + "]";
                                }
                            }
                        }

                        // Tech specs (in container dependencies) are not attached to this input form
                        if (techSpecsList.Length > 0)
                        {
                            string msg = "REMINDER - are the following tech spec containers in your tech specs input forms?\\n";
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "warning", "<script>alert('" + msg + techSpecsList + "');</script>");
                        }
                    }
                }
            }
        }
    }
    private void uwToolbar_ButtonClicked(object sender, Infragistics.WebUI.UltraWebToolbar.ButtonEvent be)
    {
        string btn = be.Button.Key.ToLower();

        if (btn == "export")
        {
            HyperCatalog.Business.Container container = HyperCatalog.Business.Container.GetByKey(featureContainerId);
            if (container != null)
            {
                Utils.ExportToExcel(dg, "[" + container.Tag + "] " + container.Name + "- Dependencies", "[" + container.Tag + "] " + container.Name + "- Dependencies");
            }
        }
        else if (btn == "delete")
        {
            Delete();
        }
    }
예제 #8
0
 private void Delete()
 {
     lbError.Visible = false;
     using (HyperCatalog.Business.Container container = HyperCatalog.Business.Container.GetByKey(containerId))
     {
         if (container.Delete(HyperCatalog.Shared.SessionState.User.Id))
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>UpdateTabs(-1)</script>");
         }
         else
         {
             lbError.CssClass = "hc_error";
             lbError.Text     = HyperCatalog.Business.Container.LastError;
             lbError.Visible  = true;
         }
     }
 }
예제 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Placer ici le code utilisateur pour initialiser la page

            if (Request["d"] != null)
            {
                containerId = Convert.ToInt32(Request["d"]);
                culture     = QDEUtils.UpdateCultureCodeFromRequest();
                item        = QDEUtils.GetItemIdFromRequest();
                container   = SessionState.QDEContainer;
                itemId      = item.Id;
                if (!Page.IsPostBack)
                {
                    ShowChunk();
                }
            }
        }
예제 #10
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();
            }
        }
예제 #11
0
    private void UpdateDataView()
    {
        System.Int64 refItemId                = -1;
        int          possibleValuesCount      = 0;                                                                           // Possible value count
        ChunkList    possibleValues           = null;                                                                        // Possible values list
        int          chunkPossibleValuesCount = Convert.ToInt32(SessionState.CacheParams["ChunkPossibleValuesCount"].Value); // Retrieve possible values count
        string       cultureCode              = SessionState.Culture.Code;                                                   // current culture code

        // Get ref item for search possible values
        if ((uwDDL_Filters != null) && (uwDDL_Filters.SelectedRow != null))
        {
            refItemId = Convert.ToInt64(uwDDL_Filters.SelectedRow.Cells.FromKey("Id").Value);
        }
        HyperCatalog.Business.Container container = SessionState.QDEContainer;

        if (container != null)
        {
            possibleValues      = container.PossibleValues(cultureCode, chunkPossibleValuesCount, refItemId, inputformId);
            possibleValuesCount = container.PossibleValuesCount(cultureCode, refItemId, inputformId);

            // If too much values are available, we will only show a certain limit
            LbSubSet.Visible = possibleValuesCount > chunkPossibleValuesCount;
        }
        UITools.RefreshTab(Page, "PossibleValues", possibleValuesCount);

        if (possibleValues != null && possibleValues.Count > 0)
        {
            panelGrid.Visible           = true;
            dgPossibleValues.DataSource = possibleValues;
            Utils.InitGridSort(ref dgPossibleValues);
            dgPossibleValues.DataBind();
            dgPossibleValues.DisplayLayout.CellClickActionDefault = Infragistics.WebUI.UltraWebGrid.CellClickAction.CellSelect;
        }
        else
        {
            panelGrid.Visible = false;
        }
    }
    /// <summary>
    /// Save IFContainer data
    /// </summary>
    private void Save()
    {
        if (cbContainers.Value == null)
        {
            cbContainers.Value = txtContainer.Text;
        }

        refContainer = HyperCatalog.Business.Container.GetByTag(cbContainers.Value);
        if (refContainer != null)
        {
            bool canSave = false;

            InputFormContainer ifc = InputFormContainer.GetByKey(InputFormContainerId);
            if (ifc == null)             // attach new container
            {
                CheckDependency();       // check container dependencies

                ifc = new InputFormContainer(InputFormContainerId, refContainer.Id,
                                             InputFormId, string.Empty,
                                             0,
                                             refContainer.Tag,
                                             refContainer.Name,
                                             refContainer.Regionalizable,
                                             txtComment.Text,
                                             chkMandatory.Checked,
                                             (InputFormContainerType)Enum.Parse(typeof(InputFormContainerType),
                                                                                DDL_InputType.SelectedValue, false),
                                             SessionState.User.Id,
                                             DateTime.UtcNow, -1, null);
                canSave = true;
            }
            else             // modify comment, mandatory or sort
            {
                ifc.ModifierId = SessionState.User.Id;
                ifc.ModifyDate = DateTime.UtcNow;
                ifc.Mandatory  = chkMandatory.Checked;
                ifc.Comment    = txtComment.Text.Trim();
                ifc.Type       = (InputFormContainerType)Enum.Parse(typeof(InputFormContainerType), DDL_InputType.SelectedValue, false);
                canSave        = true;
            }

            // save in database
            if (canSave)
            {
                if (!ifc.Save())
                {
                    // Error
                    lbError.CssClass = "hc_error";
                    lbError.Text     = InputFormContainer.LastError;
                    lbError.Visible  = true;
                }
                else
                {
                    lbError.CssClass     = "hc_success";
                    lbError.Text         = "Data saved!";
                    lbError.Visible      = true;
                    InputFormContainerId = ifc.Id;

                    if (((InputFormContainerType)Enum.Parse(typeof(InputFormContainerType), DDL_InputType.SelectedValue, false) == InputFormContainerType.SingleChoiceList) ||
                        ((InputFormContainerType)Enum.Parse(typeof(InputFormContainerType), DDL_InputType.SelectedValue, false) == InputFormContainerType.MultiChoiceList))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadWindow", "<script>ReloadParent();DisplayTab(" + ifc.Id + ", " + ifc.InputFormId + ", 1);</script>");                // display new tab
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadWindow", "<script>ReloadParent();DisplayTab(" + ifc.Id + ", " + ifc.InputFormId + ", 0);</script>"); // reload tab
                    }
                }
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: the container [" + cbContainers.Value + "] doesn't exist.";
            lbError.Visible  = true;
        }
    }
예제 #13
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();
            }
        }
예제 #14
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
        }
예제 #15
0
    void UpdateDataView()
    {
        string filter = txtFilter.Text;

        if (isPopup)
        {
            pnlTitle.Visible = true;
            UITools.HideToolBarSeparator(uwToolbar, "ListSep");
            UITools.HideToolBarButton(uwToolbar, "List");

            if (containerId.Length > 0)
            {
                using (HyperCatalog.Business.Container container = HyperCatalog.Business.Container.GetByKey(Convert.ToInt32(containerId)))
                {
                    if (container != null)
                    {
                        uwtoolbarTitle.Items.FromKeyLabel("Action").Text = "[" + container.Tag + "] - " + container.Name;
                    }
                }
            }
        }
        else
        {
            pnlTitle.Visible = false;
            UITools.ShowToolBarSeparator(uwToolbar, "ListSep");
            UITools.ShowToolBarButton(uwToolbar, "List");
        }

        string sqlFilter = string.Empty;

        if (filter != string.Empty)
        {
            string cleanFilter = filter.Replace("'", "''").ToLower();
            cleanFilter = cleanFilter.Replace("[", "[[]");
            cleanFilter = cleanFilter.Replace("_", "[_]");
            cleanFilter = cleanFilter.Replace("%", "[%]");

            sqlFilter += " (LOWER(Name) like '%" + cleanFilter + "%'";
            sqlFilter += " OR LOWER(Description) like '%" + cleanFilter + "%')";
        }

        using (Database dbObj = Utils.GetMainDB())
        {
            using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._Container_GetInputForms", "InputForms",
                                                         new SqlParameter("@ContainerId", containerId),
                                                         new SqlParameter("@Filter", sqlFilter)))
            {
                dbObj.CloseConnection();

                if (dbObj.LastError.Length == 0)
                {
                    if (ds != null)
                    {
                        if (ds.Tables["InputForms"] != null && ds.Tables["InputForms"].Rows.Count > 0)
                        {
                            dg.DataSource = ds.Tables["InputForms"];
                            Utils.InitGridSort(ref dg);
                            dg.DataBind();

                            UITools.RefreshTab(this.Page, "InputForms", dg.Rows.Count);

                            dg.Visible          = true;
                            lbNoresults.Visible = false;
                        }
                        else
                        {
                            if (txtFilter.Text.Length > 0)
                            {
                                lbNoresults.Text = "No record match your search (" + txtFilter.Text + ")";
                            }

                            dg.Visible          = false;
                            lbNoresults.Visible = true;
                        }
                    }
                }
            }
        }
    }
예제 #16
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        string cultureCode = string.Empty;
        int    containerId = -1;
        long   itemId      = -1;
        bool   isMandatory = false;
        int    inputformId = -1;
        string extraParam  = string.Empty;
        bool   isRegion    = false;

        try
        {
            #region try
            itemId      = QDEUtils.GetQueryItemIdFromRequest();
            containerId = Convert.ToInt32(Request["d"]);
            if (Request["m"] != null)
            {
                isMandatory = Convert.ToBoolean(Request["m"]);
            }
            using (Culture curCulture = QDEUtils.UpdateCultureCodeFromRequest())
            {
                cultureCode = curCulture.Code;
                if (Request["ifcid"] != null && Request["ifcid"].ToString() != "-1")
                {
                    using (InputFormContainer ifc = InputFormContainer.GetByKey(Convert.ToInt32(Request["ifcid"])))
                    {
                        if (ifc != null)
                        {
                            inputformId = ifc.InputFormId;
                        }
                    }
                }
                bool simpleView = SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_SIMPLIFIED_CHUNK_WINDOW).Value;
                Tab
                    tabChunk           = webTab.Tabs.FromKeyTab("Chunk"),
                    tabMaster          = webTab.Tabs.FromKeyTab("Master"),
                    tabContainer       = webTab.Tabs.FromKeyTab("Container"),
                    tabHistory         = webTab.Tabs.FromKeyTab("History"),
                    tabRegionalization = webTab.Tabs.FromKeyTab("Regionalization"),
                    tabTranslation     = webTab.Tabs.FromKeyTab("Translation"),
                    tabPossibleValues  = webTab.Tabs.FromKeyTab("PossibleValues"),
                    tabInheritance     = webTab.Tabs.FromKeyTab("Inheritance"),
                    tabImage           = webTab.Tabs.FromKeyTab("Image");
                if (curCulture.CountryCode != string.Empty)
                {
                    uwToolbar.Items.FromKeyLabel("Culture").Image = "/hc_v4/img/flags/" + curCulture.CountryCode + ".gif";
                }
                GetChunk(itemId, containerId, cultureCode);
                uwToolbar.Items.FromKeyLabel("Culture").Text = curCulture.Name;
                container = SessionState.QDEContainer;
                if (container == null)
                {
                    throw new Exception("An error occurred when retrieving data. Container is null[id = " + containerId.ToString() + "]");
                }
                // *************************************************************************
                // Only show master tab if culture code is not master
                // *************************************************************************
                if ((curCulture.Type != CultureType.Master))
                {
                    tabMaster.ContentPane.TargetUrl = tabMaster.ContentPane.TargetUrl + "?d=" + containerId.ToString() + "&i=" + itemId.ToString() + "&c=" + curCulture.Code;
                    using (Chunk masterChunk = Chunk.GetByKey(itemId, containerId, curCulture.FallbackCode))
                    {
                        tabMaster.Visible = masterChunk != null;
                        if (masterChunk != null && !masterChunk.Text.Equals(HyperCatalog.Business.Chunk.BlankValue))
                        {
                            extraParam = "&hf=1"; // Has Fallback = 1. This will be used in the Chunk button bar to accelerate the code.
                        }
                    }
                }

                // Change Tab height according to hidden field (to avoid recompiling)
                webTab.Height = Unit.Pixel(Convert.ToInt16(chunkHeight.Value));
                // *************************************************************************
                // Determine what we are currently doing: New or Update
                // *************************************************************************
                // SHOW/HIdE Possible values tab
                using (Item item = QDEUtils.GetItemIdFromRequest())
                {
                    if (!simpleView && container != null && curCulture.Type == CultureType.Master)
                    {
                        // Get count of possible values from parent
                        //int possibleValueCount = container.PossibleValuesCount(cultureCode, item.ParentId, inputformId);
                        tabPossibleValues.Visible = true;
                        //(phil - performances)tabPossibleValues.Text = tabPossibleValues.Text + " (" + possibleValueCount + ")";
                        tabPossibleValues.ContentPane.TargetUrl = tabPossibleValues.ContentPane.TargetUrl + "?d=" + container.Id.ToString() + "&i=" + itemId.ToString() + "&c=" + cultureCode + "&f=" + inputformId.ToString();
                    }

                    // SHOW Inheritance tab
                    if (item != null && item.Level.Id <= ItemLevel.GetSkuLevel().Id)
                    {
                        tabInheritance.Visible = (!simpleView && (container.InheritanceMethodId > 0));
                        tabInheritance.ContentPane.TargetUrl = tabInheritance.ContentPane.TargetUrl + "?i=" + itemId.ToString() + "&d=" + container.Id.ToString() + "&c=" + cultureCode;
                    }
                }
                if (SessionState.QDEChunk != null)
                {
                    uwToolbar.Items.FromKeyLabel("Action").Text = container.Group.Path + container.Group.Name + "/" + container.Tag;
                    tabHistory.Visible = SessionState.QDEChunk.HistoryCount > 0 && !simpleView;
                    tabHistory.Text    = tabHistory.Text + " (" + SessionState.QDEChunk.HistoryCount.ToString() + ")";
                    tabHistory.ContentPane.TargetUrl = tabHistory.ContentPane.TargetUrl + "?d=" + container.Id.ToString() + "&i=" + SessionState.QDEChunk.ItemId.ToString() + "&c=" + cultureCode;
                    uwToolbar.Items.FromKeyLabel("Action").ToolTip = container.Group.Path + container.Group.Name + "/" + container.Tag + " [" + container.Name + "]";
                }
                else // Create
                {
                    uwToolbar.Items.FromKeyLabel("Action").Text = container.Group.Path + container.Group.Name + "/" + container.Tag;
                    tabHistory.Visible = false;
                }

                if (!simpleView)
                {
                    // SHOW/HIDE Regionalization Tab
                    int nbRegionalization = HyperCatalog.Business.Chunk.GetRegionalizationsCount(itemId, container.Id, cultureCode);
                    tabRegionalization.Visible = nbRegionalization > 0;
                    tabRegionalization.ContentPane.TargetUrl = tabRegionalization.ContentPane.TargetUrl + "?d=" + containerId.ToString() + "&i=" + itemId.ToString() + "&c=" + cultureCode;
                    tabRegionalization.Text = tabRegionalization.Text + " (" + nbRegionalization + ")";

                    // SHOW/HIDE Translation Tab
                    int nbTranslation = HyperCatalog.Business.Chunk.GetTranslationsCount(itemId, container.Id, cultureCode);
                    tabTranslation.Visible = nbTranslation > 0;
                    tabTranslation.ContentPane.TargetUrl = tabTranslation.ContentPane.TargetUrl + "?d=" + containerId.ToString() + "&i=" + itemId.ToString() + "&c=" + cultureCode;
                    tabTranslation.Text = tabTranslation.Text + " (" + nbTranslation + ")";
                }
                /////////////////////////////////////////////////////////////
                //Determine which kind of interface we should show
                /////////////////////////////////////////////////////////////
                string masterCultureCode = HyperCatalog.Shared.SessionState.MasterCulture.Code;
                //get code for regions and master culture
                HyperCatalog.Business.CultureList allCultures = HyperCatalog.Business.Culture.GetAll("CultureTypeId IN (0,1)");
                foreach (HyperCatalog.Business.Culture culcode in allCultures)
                {
                    if (curCulture.Code == culcode.Code)
                    {
                        isRegion = true;
                    }
                }

                switch (Convert.ToChar(container.DataType.Code))
                {
                case 'D': tabChunk.ContentPane.TargetUrl = "Chunk_Date.aspx";
                    break;

                case 'L':// List is not supported
                    tabChunk.ContentPane.TargetUrl = "Chunk_Text.aspx";
                    break;

                case 'N': tabChunk.ContentPane.TargetUrl = "Chunk_Number.aspx";
                    break;

                case 'B': tabChunk.ContentPane.TargetUrl = "Chunk_Boolean.aspx";
                    break;

                // A MODIFIER ICI POUR PHOTOS
                case 'U': goto case 'S';

                case 'P': goto case 'S';

                case 'R':
                case 'S': goto case 'T';

                case 'T': tabChunk.ContentPane.TargetUrl = "Chunk_Text.aspx";
                    break;
                }
                // IF containe type is Photo, override dataTyping
                //2007/01/19 - modif greg - old : if (container.ContainerTypeCode == 'P' || container.ContainerTypeCode == 'L')
                if (container.ContainerTypeCode == 'P' || container.DataTypeCode == 'P')
                {
                    tabChunk.ContentPane.TargetUrl = "Chunk_Resource.aspx";
                    if (SessionState.QDEChunk != null && SessionState.QDEChunk.Text != HyperCatalog.Business.Chunk.BlankValue)
                    {
                        // SHOW Image preview tab
                        /************ Ref QC#871 (Making Image preview tab visible) ********************/
                        tabImage.Visible = true;
                        tabImage.ContentPane.TargetUrl = tabImage.ContentPane.TargetUrl + "?d=" + container.Id.ToString() + "&i=" + SessionState.QDEChunk.ItemId.ToString() + "&c=" + cultureCode;
                    }
                }
                if (container.InputMask != string.Empty && masterCultureCode == curCulture.Code)
                {
                    tabChunk.ContentPane.TargetUrl = "Chunk_InputMask.aspx";
                }

                //if (container.LookupId >= 0 && masterCultureCode == curCulture.Code)
                if (container.LookupId >= 0 && isRegion) // Prabhu Fix for HPeZilla Bug 69251 - LUT not showing up in regions for editing
                {
                    tabChunk.ContentPane.TargetUrl = "Chunk_Lookup.aspx";
                    if (Request["ifcid"] != null && Request["ifcid"].ToString() != "-1")
                    {
                        using (InputFormContainer inputFormContainer = InputFormContainer.GetByKey(Convert.ToInt32(Request["ifcid"])))
                        {
                            if (inputFormContainer != null)
                            {
                                extraParam += "&t=" + InputFormContainer.GetTypeFromEnum(inputFormContainer.Type);
                            }
                        }
                    }
                }

                /* Alternate for CR 5096(Removal of rejections)
                 * if (SessionState.QDEChunk != null && SessionState.QDEChunk.Status == ChunkStatus.Rejected)
                 * {
                 * tabChunk.ContentPane.TargetUrl = "Chunk_Rejected.aspx";
                 * tabMaster.Visible = tabHistory.Visible = tabRegionalization.Visible = tabTranslation.Visible =
                 * tabPossibleValues.Visible = tabInheritance.Visible = tabImage.Visible = false;
                 * }
                 */
                tabChunk.ContentPane.TargetUrl = tabChunk.ContentPane.TargetUrl + "?d=" + container.Id.ToString() + "&c=" + cultureCode + "&i=" + itemId.ToString() + "&m=" + isMandatory.ToString() + extraParam;

                // If chunk is coming from List in Input Form, force type to list
                if (Request["ifcid"] != null && Request["ifcid"].ToString() != "-1")
                {
                    InputFormContainer inputFormContainer = InputFormContainer.GetByKey(Convert.ToInt32(Request["ifcid"]));
                    if (inputFormContainer != null)
                    {
                        //if (inputFormContainer.Type != InputFormContainerType.Normal && masterCultureCode == curCulture.Code)
                        if (inputFormContainer.Type != InputFormContainerType.Normal && isRegion)// Prabhu Fix for HPeZilla Bug 69251 - LUT not showing up in regions for editing
                        {
                            tabChunk.ContentPane.TargetUrl = "Chunk_Lookup.aspx?d=" + container.Id.ToString() + "&c=" + cultureCode + "&i=" + itemId.ToString() + "&m=" + isMandatory.ToString() + "&t=" + InputFormContainer.GetTypeFromEnum(inputFormContainer.Type) + "&ifid=" + Request["ifcid"].ToString() + extraParam;
                        }
                    }
                }

                if (tabTranslation.Visible)
                {
                    tabChunk.ContentPane.TargetUrl = tabChunk.ContentPane.TargetUrl + "&ht=1"; // HasTranslations
                }
                if (SessionState.CurrentItemIsUserItem)
                {
                    tabChunk.ContentPane.TargetUrl = tabChunk.ContentPane.TargetUrl + "&ui=1"; // HasItemInScope
                }

                tabContainer.ContentPane.TargetUrl = tabContainer.ContentPane.TargetUrl + "?d=" + container.Id.ToString();
                tabContainer.Visible = !simpleView;
                Page.DataBind();
            }
            #endregion
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
            Response.End();
        }
    }
예제 #17
0
        void UpdateDataEdit(string selContainerId)
        {
            panelGrid.Visible = false;
            panelTab.Visible  = true;

            string updateParameter = string.Empty;

            if (Request["u"] != null)
            {
                updateParameter = "&u=1";
            }

            webTab.EnableViewState = false;
            webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./containers/container_properties.aspx?c=" + selContainerId + updateParameter;
            if (selContainerId == "-999")
            {
                // input forms
                webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "";
                webTab.Tabs[1].Visible = false;
                // usage
                webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "";
                webTab.Tabs[2].Visible = false;
                // container dependencies
                webTab.Tabs.GetTab(3).ContentPane.TargetUrl = "";
                webTab.Tabs[3].Visible = false;
                // possible values
                webTab.Tabs.GetTab(4).ContentPane.TargetUrl = "";
                webTab.Tabs[4].Visible = false;

                lbTitle.Text = "Container: New";
            }
            else
            {
                HyperCatalog.Business.Container HCContainer = HyperCatalog.Business.Container.GetByKey(Convert.ToInt32(selContainerId));

                if (HCContainer != null)
                {
                    lbTitle.Text = "Container: " + HCContainer.Name + " [" + HCContainer.Tag + "]";

                    // Display tab (Input forms, usage and container dependencies)
                    using (HyperCatalog.Business.InputFormContainerList contList = HyperCatalog.Business.InputFormContainer.GetAll(" ContainerId=" + selContainerId))
                    {
                        webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./containers/container_inputforms.aspx?c=" + selContainerId;
                        webTab.Tabs.GetTab(1).Text = webTab.Tabs.GetTab(1).Text + "(" + contList.Count.ToString() + ")";
                    }
                    string sSql = string.Empty;
                    sSql += "_Container_GetPossibleValuesCountAndDistinctCount " + HCContainer.Id.ToString();
                    int nbUsed           = 0;
                    int nbPossibleValues = 0;
                    using (Database db = Utils.GetMainDB())
                    {
                        using (IDataReader rs = db.RunSQLReturnRS(sSql))
                        {
                            rs.Read();
                            nbUsed           = (int)rs[0];
                            nbPossibleValues = (int)rs[1];
                            rs.Close();
                        }
                    }
                    webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "./containers/container_usage.aspx?c=" + selContainerId;
                    webTab.Tabs.GetTab(2).Text = webTab.Tabs.GetTab(2).Text + "(" + nbUsed.ToString() + ")";
                    if (HCContainer.ContainerTypeCode == 'F')
                    {
                        using (HyperCatalog.Business.ContainerDependencyList contDepList = HyperCatalog.Business.ContainerDependency.GetAll(" FeatureContainerId=" + selContainerId))
                        {
                            webTab.Tabs.GetTab(3).ContentPane.TargetUrl = "./containers/container_dependencies.aspx?c=" + selContainerId;
                            webTab.Tabs.GetTab(3).Text = webTab.Tabs.GetTab(3).Text + "(" + contDepList.Count.ToString() + ")";
                        }
                    }
                    else
                    {
                        webTab.Tabs.GetTab(3).ContentPane.TargetUrl = "";
                        webTab.Tabs[3].Visible = false;
                    }

                    webTab.Tabs.GetTab(4).ContentPane.TargetUrl = "./containers/container_possiblevalues.aspx?c=" + selContainerId;
                    webTab.Tabs.GetTab(4).Text = webTab.Tabs.GetTab(4).Text + "(" + nbPossibleValues.ToString() + ")";
                }
            }
            webTab.Visible = true;
        }
예제 #18
0
    private void Save()
    {
        txtLabel.Text = cbLabel.Value;
        if ((container != null) || (container == null && ddlContainerGroups.SelectedIndex != 0))
        {
            Page.Validate();
            if (Page.IsValid)
            {
                // Retrieve the new text in the templated columns
                // Prepare the command text
                lbError.Text = "";
                int  lookupValueId          = -1;
                bool isContainerTypeChanged = false;
                if (dlLookupField.SelectedIndex > 0)
                {
                    lookupValueId = Convert.ToInt32(dlLookupField.SelectedValue);
                }

                if (ViewState["action"].ToString() == "update")
                {
                    container.Tag            = txtTag.Text;
                    container.Name           = txtContainerName.Text;
                    container.Definition     = txtDefinition.Text;
                    container.EntryRule      = txtEntryRule.Text;
                    container.DataTypeCode   = Convert.ToChar(dlDataType.SelectedValue);
                    container.MaxLength      = Convert.ToInt32(txtMaxLength.Value);
                    container.ValidationMask = string.Empty;
                    container.Sample         = txtSample.Text;
                    container.Mecd           = cbMECD.Checked;
                    container.Mmd            = cbMMD.Checked;
                    container.Cdm            = cbCDM.Checked;
                    container.GroupId        = Convert.ToInt32(ddlContainerGroups.SelectedValue);
                    container.InputMask      = txtInputMask.Text;
                    container.LookupId       = lookupValueId;
                    container.DataTypeCode   = Convert.ToChar(dlDataType.SelectedValue);

                    // Note: When the container type is changed from or to features, then we will reload the complete page
                    if (container.ContainerTypeCode != Convert.ToChar(dlContainerType.SelectedValue) && (dlContainerType.SelectedValue == "F" || container.ContainerTypeCode.ToString() == "F"))
                    {
                        isContainerTypeChanged = true;
                    }
                    container.ContainerTypeCode   = Convert.ToChar(dlContainerType.SelectedValue);
                    container.Translatable        = cbTranslatable.Checked;
                    container.ModifierId          = SessionState.User.Id;
                    container.InheritanceMethodId = Convert.ToInt32(dlInheritanceMethod.SelectedValue);
                    container.Publishable         = cbPublishable.Checked;
                    container.Regionalizable      = cbRegionalizable.Checked;
                    container.Localizable         = cbLocalizable.Checked;
                    container.ReadOnly            = cbReadOnly.Checked;
                    container.Sort           = Convert.ToInt32(txtSort.Value);
                    container.Label          = cbLabel.Value;
                    container.LabelId        = -1; // The label is Always recreate
                    container.WWXPath        = tbWWXPath.Text;
                    container.KeepIfObsolete = cbKeepIfObsolete.Checked;
                    container.SegmentId      = Convert.ToInt32(ddlSegments.SelectedValue);
                }
                else
                {
                    container = new HyperCatalog.Business.Container(-1,
                                                                    txtTag.Text,
                                                                    txtContainerName.Text,
                                                                    txtDefinition.Text,
                                                                    txtEntryRule.Text,
                                                                    string.Empty,
                                                                    txtSample.Text,
                                                                    txtInputMask.Text,
                                                                    Convert.ToChar(dlDataType.SelectedValue),
                                                                    cbTranslatable.Checked,
                                                                    Convert.ToChar(dlContainerType.SelectedValue),
                                                                    Convert.ToInt32(txtMaxLength.Value),
                                                                    lookupValueId,
                                                                    Convert.ToInt32(txtSort.Value),
                                                                    SessionState.User.Id,
                                                                    -1,
                                                                    Convert.ToInt32(ddlContainerGroups.SelectedValue),
                                                                    DateTime.UtcNow,
                                                                    null,
                                                                    cbPublishable.Checked, false,
                                                                    Convert.ToInt32(dlInheritanceMethod.SelectedValue),
                                                                    cbRegionalizable.Checked,
                                                                    cbLocalizable.Checked,
                                                                    cbReadOnly.Checked,
                                                                    cbLabel.Value.ToString(),
                                                                    -1,
                                                                    tbWWXPath.Text,
                                                                    cbKeepIfObsolete.Checked,
                                                                    Convert.ToInt32(ddlSegments.SelectedValue),
                                                                    dlDataType.Text,
                                                                    dlContainerType.Text,
                                                                    cbMECD.Checked,
                                                                    cbMMD.Checked,
                                                                    cbCDM.Checked
                                                                    );
                }
                if (container.Save())
                {
                    SessionState.ClearAppContainers();
                    SessionState.ClearAppContainerGroups();
                    if (txtMaxLength.ValueDouble > 0)
                    {
                        txtMaxLength.MinValue = txtMaxLength.ValueDouble;
                    }

                    if (ViewState["action"].ToString() == "create")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript1", "<script>UpdateTabs(" + container.Id + ");</script>");
                    }
                    else if (isContainerTypeChanged)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript2", "<script>UpdateTabsAfterUpdate(" + container.Id + ");</script>");
                    }
                    else
                    {
                        container        = HyperCatalog.Business.Container.GetByKey(containerId);
                        lbError.CssClass = "hc_success";
                        lbError.Text     = "Data saved!";
                        lbError.Visible  = true;

                        if (container.Modifier != null && container.ModifyDate.HasValue)
                        {
                            hlModifier.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(container.Modifier.Email);
                            hlModifier.Text        = "Modified by " + container.Modifier.FullName + " on " + SessionState.User.FormatUtcDate(container.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime) + "<br/><br/>";
                            hlModifier.Visible     = true;
                        }
                    }
                }
                else
                {
                    lbError.CssClass = "hc_error";
                    lbError.Text     = HyperCatalog.Business.Container.LastError;
                    lbError.Visible  = true;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alertmissing", "<script>alert('Label is mandatory');</script>");
            }
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alertmissing", "<script>alert('Please choose a container group');</script>");
        }
        chianti();
    }