protected void UpdateDataView() { DDL_Cultures.Visible = false; // retrieve all cultures for given user HyperCatalog.Business.CultureList cultures = SessionState.User.Cultures; if (cultures != null) { if (cultures.Count == 1) { // cultures contains only one culture DDL_Cultures.Visible = false; } else { CollectionView cv = new CollectionView(cultures); cv.Sort("Name"); DDL_Cultures.DataSource = cv; DDL_Cultures.DataBind(); DDL_Cultures.SelectedValue = SessionState.Culture.Code; DDL_Cultures.Visible = true; cv.Dispose(); } } }
protected void UpdateDataView() { DDL_Cultures.Visible = false; // retrieve all cultures for given user HyperCatalog.Business.CultureList cultureList = SessionState.User.ItemCulturesRelevant; // remove other culture type HyperCatalog.Business.CultureList cultures = new HyperCatalog.Business.CultureList(); bool masterOrRegion = (cultureType == CultureType.Master || cultureType == CultureType.Regionale); foreach (HyperCatalog.Business.Culture c in cultureList) { if (masterOrRegion) { if (c.Type == CultureType.Master || c.Type == CultureType.Regionale) { cultures.Add(c); } } else { if (c.Type == CultureType.Locale) { cultures.Add(c); } } } if (cultures != null) { if (cultures.Count == 1) { // cultures contains only one culture DDL_Cultures.Visible = false; } else { if (SessionState.Culture.Type != cultureType) { SessionState.Culture = cultures[0]; } CollectionView cv = new CollectionView(cultures); cv.Sort("Name"); DDL_Cultures.DataSource = cv; DDL_Cultures.DataBind(); DDL_Cultures.SelectedValue = SessionState.Culture.Code; DDL_Cultures.Visible = true; cv.Dispose(); } } }
private void loadCultureLIst(string selectedCulture) { CultureList.Items.Clear(); //add the "no-selection" culture at the top HyperCatalog.Business.CultureList CList = HyperCatalog.Shared.SessionState.User.Cultures; CultureList.DataSource = CList; CultureList.DataBind(); if (selectedCulture != null) { CultureList.Items.FindByValue(selectedCulture).Selected = true; } }
private void UpdateDataView() { string sSql = string.Empty; webTab.Visible = false; string filter = txtFilter.Text; if (filter != string.Empty) { string cleanFilter = filter.Replace("'", "''").ToLower(); cleanFilter = cleanFilter.Replace("[", "[[]"); cleanFilter = cleanFilter.Replace("_", "[_]"); cleanFilter = cleanFilter.Replace("%", "[%]"); sSql += " LOWER(CultureCode) like '%" + cleanFilter + "%'"; sSql += " OR LOWER(CultureName) like '%" + cleanFilter + "%'"; } panelGrid.Visible = dg.Visible = true; lbSpacer.Text = ""; using (HyperCatalog.Business.CultureList cultures = HyperCatalog.Business.Culture.GetAll(sSql)) { if (cultures != null) { if (cultures.Count > 0) { dg.DataSource = cultures; Utils.InitGridSort(ref dg); dg.DataBind(); lbNoresults.Visible = false; dg.Visible = true; } else { if (txtFilter.Text.Length > 0) { lbNoresults.Text = "No record match your search (" + txtFilter.Text + ")"; } lbNoresults.Visible = true; dg.Visible = false; } lbTitle.Text = UITools.GetTranslation("Cultures list"); } } }
private void UpdateClassRegions() { //Modified by Sateesh for Setting Scope and MTR Dates (PCF: ACQ 8.10) - 28/05/2009 #region Region Dropdown initialization ddClassRegions.Items.Clear(); using (HyperCatalog.Business.CultureList culturesList = HyperCatalog.Business.Culture.GetAll("CultureCode IN (SELECT DISTINCT FallbackCode FROM Cultures WHERE CultureTypeId= 2)")) { culturesList.Sort("Name"); //ddClassRegions.Items.Add("<--Select a Region-->"); foreach (HyperCatalog.Business.Culture c in culturesList) { ddClassRegions.Items.Add(c.Code); } } ddClassRegions.SelectedIndex = 0; GetLanguagesByRegion(ddClassRegions.SelectedValue.ToString()); #endregion //Modified by Sateesh for Setting Scope and MTR Dates (PCF: ACQ 8.10) - 28/05/2009 }
private void UpdateTermRegions() { //Modified by Sateesh for Setting Scope and MTR Dates (PCF: ACQ 8.10) - 28/05/2009 #region Region Dropdown initialization ddTermsRegions.Items.Clear(); //ddTermsRegions.Items.Add("<--Select a Region-->"); // Modified the cultureList filter as part of CR 5236 //using (HyperCatalog.Business.CultureList culturesList = HyperCatalog.Business.Culture.GetAll("CultureCode IN (SELECT DISTINCT FallbackCode FROM Cultures(NOLOCK) WHERE CountryCode IN (SELECT CountryCode FROM Countries(NOLOCK) WHERE PLCDrivenTranslation = 0))")) using (HyperCatalog.Business.CultureList culturesList = HyperCatalog.Business.Culture.GetAll("CultureCode IN (SELECT DISTINCT FallbackCode FROM Cultures WHERE CultureTypeId= 2)")) { culturesList.Sort("Name"); foreach (HyperCatalog.Business.Culture c in culturesList) { ddTermsRegions.Items.Add(c.Code); } } ddTermsRegions.SelectedIndex = 0; GetLanguagesByRegion(ddTermsRegions.SelectedValue.ToString()); #endregion //Modified by Sateesh for Setting Scope and MTR Dates (PCF: ACQ 8.10) - 28/05/2009 }
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(); } }
private void UpdateDataEdit(string selTRScopeId) { cblLanguageScope.ClearSelection(); TRScope trScope = null; if (selTRScopeId.Length > 0) { trScope = TRScope.GetByKey(Convert.ToInt32(selTRScopeId)); } if (trScope == null) { lbTitle.Text = "TR Scope: New"; wneScopeId.Value = "-1"; PanelRegionDDL.Visible = true; PanelRegionReadonly.Visible = false; PanelId.Visible = false; //RPM_Sateesh using (HyperCatalog.Business.CultureList culturesList = HyperCatalog.Business.Culture.GetAll("CultureCode IN (SELECT DISTINCT FallbackCode FROM Cultures(NOLOCK) WHERE CountryCode IN (SELECT CountryCode FROM Countries(NOLOCK) WHERE PLCDrivenTranslation = 0))")) { culturesList.Sort("Name"); ddRegions.Items.Add("<-- Select a Region -->"); foreach (HyperCatalog.Business.Culture c in culturesList) { ddRegions.Items.Add(c.Code); } } //RPM_Sateesh UITools.HideToolBarButton(uwToolBarEdit, "Delete"); UITools.HideToolBarSeparator(uwToolBarEdit, "DeleteSep"); } else { lbTitle.Text = "TR Scope: " + trScope.Name; wneScopeId.Value = trScope.Id; PanelRegionDDL.Visible = false; PanelRegionReadonly.Visible = true; wteRegionCode.Value = trScope.RegionCode; txtName.Text = trScope.Name; txtComment.Text = trScope.Comment; PanelId.Visible = true; //RPM_Sateesh //ddRegions.Text = trScope.Name; //RPM_Sateesh lbTRScopeId.Visible = true; wneScopeId.Visible = true; wneScopeId.Enabled = false; using (HyperCatalog.Business.LanguageList languageList = HyperCatalog.Business.Language.GetAll("LanguageCode NOT IN (Select LanguageCode FROM Cultures WHERE CultureTypeId = 0) AND LanguageCode IN (SELECT LanguageCode FROM Cultures(NOLOCK) WHERE FallbackCode ='" + trScope.RegionCode + "')")) { languageList.Sort("Name"); cblLanguageScope.DataSource = languageList; cblLanguageScope.DataBind(); } foreach (HyperCatalog.Business.TRScopeLanguage cul in trScope.Languages) { foreach (ListItem item in cblLanguageScope.Items) { if (item.Value == cul.LanguageCode) { item.Selected = true; } } } } panelEdit.Visible = true; panelGrid.Visible = false; }