private static Window getParentWindow(DependencyObject s) { Window window = UITools.FindAncestor <Window>(s); return(window); }
protected void Page_Load(object sender, System.EventArgs e) { // Get current culture culture = SessionState.Culture; user = SessionState.User; try { // Get parameters item = QDEUtils.GetItemIdFromRequest(); culture = QDEUtils.UpdateCultureCodeFromRequest(); if (Request["f"] != null) { inputformId = Convert.ToInt32(Request["f"]); } } catch { UITools.DenyAccess(DenyMode.Popup); return; } // Check // - user is valid // - culture is valid // - item is valid // - user has the current culture in its scope // - user has the item in its scope if (user != null && culture != null && item != null && user.HasCultureInScope(culture.Code) && user.HasItemInScope(item.Id)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "initVars", "var cultureCode='" + culture.Code + "';", true); if (!Page.IsPostBack) { lbError.Visible = false; dg.Visible = false; lbResult.Visible = false; // Update title (current item name) if (item != null) { lbTitle.Text = item.FullName; if (lbTitle.Text.Length > 50) { lbTitle.Text = lbTitle.Text.Substring(0, 49) + "..."; } if (inputformId > -1) { pnlChildren.Visible = false; UITools.HideToolBarSeparator(uwToolbar, "AnalyzeSep"); UITools.HideToolBarButton(uwToolbar, "Analyze"); Analyze(); // analyse the content for this input form // Retrieve input form name string inputFormName = HyperCatalog.Business.InputForm.GetByKey(Convert.ToInt32(inputformId)).Name; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitFormName", "<script>inputFormName='" + inputFormName + "';</script>"); } else { pnlChildren.Visible = true; UITools.ShowToolBarSeparator(uwToolbar, "AnalyzeSep"); UITools.ShowToolBarButton(uwToolbar, "Analyze"); } } else { UITools.DenyAccess(DenyMode.Popup); } } } else { UITools.DenyAccess(DenyMode.Popup); } }
private void UpdateDataView() { ChunkModifier1.Chunk = chunk; lbChunkValue.Text = chunk.Text == HyperCatalog.Business.Chunk.BlankValue ? HyperCatalog.Business.Chunk.BlankText : UITools.HtmlEncode(chunk.Text); }
private void OnClickSetting() { UITools.OpenWindow <UISetting>(); }
private void Analyze() { dg.Visible = false; lbResult.Visible = false; lbError.Visible = false; if (item != null) { try { DataSet ds = item.GetContent(culture.Code, inputformId, cbWithChildren.Checked); if (ds != null) { if (ds.Tables != null && ds.Tables[0].Rows.Count > 0) { // Add column containing the count of error ds.Tables[0].Columns.Add("Error", Type.GetType("System.String")); try { HyperComponents.WebUI.CustomSpellChecker.SpellChecker c = UITools.GetSpellChecker(); #region debugging /* Trace.Warn("c.AllowCaseInsensitiveSuggestions =" + c.AllowCaseInsensitiveSuggestions.ToString()); * Trace.Warn("c.AllowMixedCase =" + c.AllowMixedCase.ToString()); * Trace.Warn("c.AllowWordsWithDigits =" + c.AllowWordsWithDigits.ToString()); * Trace.Warn("c.AllowXML =" + c.AllowXML.ToString()); * Trace.Warn("c.CheckHyphenatedText =" + c.CheckHyphenatedText.ToString()); * Trace.Warn("c.SetIncludeUserDictionaryInSuggestions= " + c.GetIncludeUserDictionaryInSuggestions().ToString()); * Trace.Warn("c.LanguageParser" + c.LanguageParser.ToString()); * Trace.Warn("c.SetAllowCapitalizedWords = " + c.GetAllowCapitalizedWords().ToString()); * Trace.Warn("c.CheckCompoundWords =" + c.CheckCompoundWords.ToString()); * Trace.Warn("c.SetConsiderationRange=" + c.GetConsiderationRange().ToString()); * Trace.Warn("c.SplitWordThreshold = " + c.SplitWordThreshold.ToString()); * Trace.Warn("c.SuggestSplitWords = " + c.SuggestSplitWords.ToString()); * Trace.Warn("c.SetSeparateHyphenWords=" + c.GetSeparateHyphenWords().ToString()); * Trace.Warn("c.SetSuggestionsMethod=" + c.GetSuggestionsMethod().ToString()); * Trace.Warn("c.userDictionary.dictFile=" + c.userDictionary.dictFile); */ /* * c.AllowCaseInsensitiveSuggestions = true; * c.AllowMixedCase = false; * c.AllowWordsWithDigits = true; * c.AllowXML = true; * c.CheckHyphenatedText = true; * c.SetIncludeUserDictionaryInSuggestions(true); * c.LanguageParser = LanguageType.English; * c.SetAllowCapitalizedWords(true); * c.CheckCompoundWords = false; * c.SetConsiderationRange(-1); * c.SplitWordThreshold = 3; * c.SuggestSplitWords = true; * c.SetSeparateHyphenWords(false);*/ #endregion foreach (DataRow dr in ds.Tables[0].Rows) { //spellTest.HasErrors(dr["ChunkValue"].ToString(), true); Trace.Warn(dr["ChunkValue"].ToString()); dr["Error"] = UITools.TextHasErrors(ref c, dr["ChunkValue"].ToString()); } dg.DataSource = ds.Tables[0].DefaultView; Utils.InitGridSort(ref dg, true); dg.DataBind(); dg.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.No; InitializeGridGrouping(); //dg.DisplayLayout.Pager.AllowPaging = true; if (dg.Rows.Count > 0) { dg.Visible = true; lbResult.Visible = false; } else { dg.Visible = false; lbResult.Text = "No errors found."; lbResult.Visible = true; } } catch (Exception e) { lbError.CssClass = "hc_error"; lbError.Text = e.ToString(); lbError.Visible = true; } finally { if (ds != null) { ds.Dispose(); } } } else // chunks count equals 0 { lbResult.Visible = true; if (ds != null) { ds.Dispose(); } } } else // ds is null { lbError.CssClass = "hc_error"; lbError.Text = "DataSet is null"; lbError.Visible = true; } } catch (DataException de) { lbError.CssClass = "hc_error"; lbError.Text = de.ToString(); lbError.Visible = true; } } }
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>"); } }
protected override void CreateChildControls() { var uploadDialog = this.UploadDialog; if (uploadDialog != null) { uploadDialog.CssClass = "sn-du-uploaddialog sn-du-uploaddialog-" + this.ClientID; } var container = this.Container; if (container != null) { container.CssClass = "sn-du-container sn-du-container-" + this.ClientID; } var clientIdControl = this.ClientIdControl; if (clientIdControl != null) { clientIdControl.Text = this.ClientID; } var dialogClientIdControl = this.DialogClientIdControl; if (dialogClientIdControl != null) { dialogClientIdControl.Text = this.ClientID; } // set the current date for checking user's upload list - but do not set it at postbacks, therefore it is stored in controlstate if (this._startUploadDate == DateTime.MinValue && DateLimitMinutes != 0) { this._startUploadDate = DateTime.UtcNow.AddMinutes(-DateLimitMinutes); } var startUploadDateControl = this.StartUploadDateControl; if (startUploadDateControl != null) { startUploadDateControl.Text = this._startUploadDate.ToString(); } var uploadButtonControl = this.UploadButtonControl; if (!string.IsNullOrEmpty(this.ButtonText) && uploadButtonControl != null) { uploadButtonControl.Text = this.ButtonText; } var uploadPathControl = this.UploadPathControl; if (uploadPathControl != null) { string containerPath = string.Empty; // if a contextinfo is present, it controls the context var contextInfo = UITools.FindContextInfo(this, ContextInfoID); if (contextInfo != null) { containerPath = contextInfo.Path; } else { // in add scenario, the content does not exist, so container for Uploads folder should be the parent. // set containerpath to parent, to use consistent containers for both new and existing content var contentView = UITools.FindFirstContainerOfType <ContentView>(this); var contextNode = contentView.Content.ContentHandler; containerPath = contextNode.ParentPath; } uploadPathControl.Text = containerPath; var targetFolderControl = this.TargetFolderControl; if (targetFolderControl != null) { targetFolderControl.Text = this.TargetFolderName; } } this.ChildControlsCreated = true; base.CreateChildControls(); }
protected virtual void InitImagePickerParams() { var script = string.Format("SN.tinymceimagepickerparams = {{ DefaultPath:'{0}' }};", this.ContentHandler.ParentPath); UITools.RegisterStartupScript("tinymceimagepickerparams", script, this.Page); }
protected override IScriptCommand executeInner(ParameterDic pm, UIElement sender, RoutedEventArgs evnt, IUIInput input, IList <IUIInputProcessor> inpProcs) { Point position = input.Position; //Console.WriteLine(input.IsDragging.ToString() + position.ToString()); switch (PositionRelativeTo) { case PositionRelativeToType.Sender: position = input.PositionRelativeTo(sender); break; case PositionRelativeToType.Scp: var scp = ControlUtils.GetScrollContentPresenter(sender is Control ? (Control)sender : UITools.FindAncestor <Control>(sender)); position = input.PositionRelativeTo(scp); break; case PositionRelativeToType.Panel: var parentPanel = UITools.FindAncestor <Panel>(sender); position = input.PositionRelativeTo(parentPanel); break; case PositionRelativeToType.Window: var parentWindow = Window.GetWindow(sender); position = input.PositionRelativeTo(parentWindow); break; } //Console.WriteLine(position); return(ScriptCommands.Assign(DestinationKey, position, SkipIfExists, NextCommand)); }
protected void Page_Load(object sender, EventArgs e) { UITools.AddScript("$skin/scripts/sn/SN.TagCloud.js"); }
protected override void OnLoad(EventArgs e) { if (this.Visible) { if (DisplayMode == Mode.Complete && !SessionState.User.HasCapability(Business.CapabilitiesEnum.MANAGE_RESOURCES)) { UITools.DenyAccess(DenyMode.Frame); } #region init grids Utils.InitGridSort(ref rGd); //Utils.InitGridSort(ref variantsGrid); #endregion propertiesMsgLbl.Visible = false; mTb.Items.FromKeyButton("Add").Visible = completePanel.Visible = (DisplayMode == Mode.Complete); minimalCell.ColSpan = (DisplayMode == Mode.Complete ? 1 : 3); if (!IsPostBack) { HyperCatalog.Business.CultureList cultures = HyperCatalog.Business.Culture.GetAll(); _currentCultureCode = HyperCatalog.Shared.SessionState.MasterCulture.Code; if (cultures != null) { cultures.Sort("Name ASC"); } txtVariantCultureValue.DataSource = cultures; txtVariantCultureValue.DataBind(); _currentResourceId = -1; _currentLibrary = null; _resourceTypes = null; if (Request["l"] != null) { try { _currentLibraryId = Convert.ToInt32(Request["l"]); } catch { } } else if (Request["resource"] != null) { try { string[] splitted = Request["resource"].Split('/'); if (splitted.Length == 2) { _currentLibrary = Library.GetByKey(splitted[0]); if (_currentLibrary != null) { _currentResource = _currentLibrary.Resources[splitted[1].Split('.')[0]]; } } } catch { } } if (Request["culture"] != null) { CurrentCultureCode = Request["culture"]; } if (_currentLibraryId < 0 && Session["DAM_currentLibraryId"] is int) { _currentLibraryId = (int)Session["DAM_currentLibraryId"]; } BindDAM(); } } base.OnLoad(e); //Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "ChgLib", "function ChgLib(libId){window.location='" + Request.Url.PathAndQuery.Substring(0, Request.Url.PathAndQuery.Length - Request.Url.Query.Length) + "?w=" + WorkspaceId.ToString() + "&l=' + libId;}", true); //libraryList.Attributes.Add("onchange", "ChgLib(this.value)"); }
public static string GetFriendlyDate(DateTime date) { return(UITools.GetFriendlyDate(date)); }
public static string GetPostMarkup(string markupStr, string commentSectionStr, PostInfo postInfo, string contextPath, string hiddenCommentsMarkup, string commentsMarkup, int commentCount, LikeInfo likeInfo, bool drawBoundary) { if (markupStr == null) { return(null); } if (commentSectionStr == null) { return(null); } markupStr = ReplaceResources(markupStr); markupStr = markupStr.Replace("{{commentsection}}", commentSectionStr); markupStr = markupStr.Replace("{{postid}}", postInfo.ClientId.ToString()); markupStr = markupStr.Replace("{{avatar}}", UITools.GetAvatarUrl(postInfo.CreatedBy)); markupStr = markupStr.Replace("{{username}}", postInfo.CreatedBy.FullName); markupStr = markupStr.Replace("{{userlink}}", Actions.ActionUrl(Content.Create(postInfo.CreatedBy), "Profile")); var text = postInfo.Text; if (text != null) { text = text.Replace("{{path}}", postInfo.LastPath ?? string.Empty); } var haspermission = WallHelper.HasWallPermission(contextPath); markupStr = markupStr.Replace("{{text}}", text); markupStr = markupStr.Replace("{{date}}", postInfo.CreationDate.ToString()); markupStr = markupStr.Replace("{{friendlydate}}", UITools.GetFriendlyDate(postInfo.CreationDate)); markupStr = markupStr.Replace("{{hiddencomments}}", hiddenCommentsMarkup); markupStr = markupStr.Replace("{{comments}}", commentsMarkup); markupStr = markupStr.Replace("{{commentboxdisplay}}", (commentCount > 0) && haspermission ? "block" : "none"); markupStr = markupStr.Replace("{{hiddencommentboxdisplay}}", commentCount > 2 ? "block" : "none"); markupStr = markupStr.Replace("{{commentcount}}", commentCount.ToString()); markupStr = markupStr.Replace("{{likeboxdisplay}}", likeInfo.Count > 0 ? "block" : "none"); markupStr = markupStr.Replace("{{likes}}", likeInfo.GetLongMarkup()); markupStr = markupStr.Replace("{{ilikedisplay}}", !likeInfo.iLike ? "inline" : "none"); markupStr = markupStr.Replace("{{iunlikedisplay}}", likeInfo.iLike ? "inline" : "none"); // content card - only manualposts count here, journals don't have this markup if (postInfo.Type == PostType.BigPost && postInfo.SharedContent != null) { markupStr = markupStr.Replace("{{contentcard}}", WallHelper.GetContentCardMarkup(postInfo.SharedContent, contextPath)); } else { markupStr = markupStr.Replace("{{contentcard}}", string.Empty); } // small post icon var smallposticon = "/Root/Global/images/icons/16/add.png"; if (postInfo.Type == PostType.JournalModified) { smallposticon = "/Root/Global/images/icons/16/edit.png"; } if (postInfo.Type == PostType.JournalDeletedPhysically) { smallposticon = "/Root/Global/images/icons/16/delete.png"; } if (postInfo.Type == PostType.JournalMoved) { smallposticon = "/Root/Global/images/icons/16/move.png"; } if (postInfo.Type == PostType.JournalCopied) { smallposticon = "/Root/Global/images/icons/16/copy.png"; } markupStr = markupStr.Replace("{{smallposticon}}", smallposticon); markupStr = markupStr.Replace("{{postboundaryclass}}", drawBoundary ? "sn-post-boundary" : string.Empty); markupStr = markupStr.Replace("{{action}}", postInfo.Action); // small post details markupStr = markupStr.Replace("{{detailsdisplay}}", string.IsNullOrEmpty(postInfo.Details) ? "none" : "inline"); markupStr = markupStr.Replace("{{detailssection}}", ReplaceResources(postInfo.Details)); // user interaction allowed markupStr = markupStr.Replace("{{interactdisplay}}", haspermission ? "inline" : "none"); return(markupStr); }
/// <summary> /// Save translations /// </summary> private void Save() { bool canUpdate; for (int i = 0; i < dg.Rows.Count; i++) { string languageCode = dg.Rows[i].Cells.FromKey("LanguageCode").Text; TemplatedColumn col = (TemplatedColumn)dg.Rows[i].Cells.FromKey("Value").Column; TextBox tb = (TextBox)((CellItem)col.CellItems[i]).FindControl("TXTChangedValue"); string newTMExpressionValue = tb.Text; TMExpressionTranslation tt; using (tt = TMExpressionTranslation.GetByKey(expressionId, languageCode)) { if (tt == null) { canUpdate = newTMExpressionValue != null; if (canUpdate) { canUpdate = newTMExpressionValue.Trim() != string.Empty; } #region New Translation if (canUpdate) { tt = new TMExpressionTranslation(expressionId, newTMExpressionValue, languageCode, dg.Rows[i].Cells.FromKey("Rtl").Text.ToLower() == "true", SessionState.User.Id, DateTime.UtcNow); int r = tt.Save(); if (r < 0) { lbMessage.Text = "Error: Translation [" + languageCode + "] can't be created"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } } #endregion } #region Translation already exist else { if (tt.Value != newTMExpressionValue) { tt.LanguageCode = languageCode; tt.Value = newTMExpressionValue; tt.Rtl = dg.Rows[i].Cells.FromKey("Rtl").Text.ToLower() == "true"; canUpdate = newTMExpressionValue != null; if (canUpdate) { canUpdate = newTMExpressionValue.Trim() != string.Empty; } #region Value modified if (canUpdate) { int r = tt.Save(); if (r < 0) { lbMessage.Text = "Error: Translation [" + languageCode + "] can't be updated"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } } #endregion #region Value deleted else { if (!tt.Delete(HyperCatalog.Shared.SessionState.User.Id)) { lbMessage.Text = "Error: localization [" + languageCode + "] can't be deleted"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } } #endregion } } #endregion } } ShowTMTranslations(); lbMessage.Text = "Data saved"; lbMessage.CssClass = "hc_success"; lbMessage.Visible = true; using (Database dbObj = Utils.GetMainDB()) { UITools.RefreshTab(Page, "Translations", Utils.GetCount(dbObj, String.Format("SELECT COUNT(*) FROM TMTranslations WHERE TMExpressionId = {0}", expressionId))); } }
public static XslTransformExecutionContext GetXslt(string nodePath, bool resolveScripts) { string nodeKey = "xslt:" + nodePath; XslTransformExecutionContext context = (XslTransformExecutionContext)(DistributedApplication.Cache.Get(nodeKey)); if (context == null) { context = new XslTransformExecutionContext(); context.XslCompiledTransform = new XslCompiledTransform(Debugger.IsAttached); RepositoryPathResolver resolver = new RepositoryPathResolver(); try { context.XslCompiledTransform.Load(nodePath, XsltSettings.Default, resolver); } catch (NullReferenceException e) // rethrow { throw new NullReferenceException(e.Message + "<br/>" + nodePath + " (or include)"); } AggregateCacheDependency aggregatedDependency = new AggregateCacheDependency(); context.NamespaceExtensions = resolver.ImportNamespaceCollection.Distinct().ToArray(); context.ImportScriptCollection = resolver.ImportScriptCollection; context.ImportCssCollection = resolver.ImportCssCollection; foreach (var dependencyPath in resolver.DependencyPathCollection) { // Create an aggregate cache dependeny that includes NodeId, Path, NodeTypeId // Our cache item will be invalidated if the dependency node is invalidated // - by node id // - by path // - by nodeType string fsFilePath = null; if (HttpContext.Current != null && WebApplication.DiskFSSupportMode == DiskFSSupportMode.Prefer) { fsFilePath = HttpContext.Current.Server.MapPath(dependencyPath); } if (!string.IsNullOrEmpty(fsFilePath) && System.IO.File.Exists(fsFilePath)) { aggregatedDependency.Add(new CacheDependency(fsFilePath)); } else { var nodeHead = NodeHead.Get(dependencyPath); aggregatedDependency.Add( new PathDependency(nodeHead.Path), new NodeIdDependency(nodeHead.Id), new NodeTypeDependency(nodeHead.NodeTypeId) ); } } DistributedApplication.Cache.Insert(nodeKey, context, aggregatedDependency); } if (resolveScripts) { foreach (var script in context.ImportScriptCollection) { UITools.AddScript(script); } foreach (var css in context.ImportCssCollection) { UITools.AddStyleSheetToHeader(UITools.GetHeader(), css); } } return(context); }
protected void Page_Load(object sender, System.EventArgs e) { System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); ci.DateTimeFormat.ShortDatePattern = SessionState.User.FormatDate; ci.DateTimeFormat.LongDatePattern = SessionState.User.FormatDate; wdMasterPublishing.CalendarLayout.Culture = ci; wdMasterPublishing.MinDate = DateTime.UtcNow; warningMessage = "<font color='red' size='2'><b>Error:</b> Regional MATF is not possible.</font><br><br>" + "This item has project with BOR date in future. Hence this item cannot be region validated. <br>" + "Requesting user to try again after BOR date has reached."; if (SessionState.User.IsReadOnly) { uwToolbar.Items.FromKeyButton("Save").Enabled = false; } // Hide or show button switch capabilities if (!SessionState.User.HasCapability(CapabilitiesEnum.EDIT_DELETE_FINAL_CHUNKS_MARKET_SEGMENT)) { UITools.HideToolBarButton(uwToolbar, "Save"); UITools.HideToolBarSeparator(uwToolbar, "SaveSep"); } // Retrieve current user and current culture user = SessionState.User; culture = SessionState.Culture; try { // Get parameters if (Request["i"] != null) { item = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(Request["i"])); } else if (QDEUtils.GetItemIdFromRequest() != null) { item = QDEUtils.GetItemIdFromRequest(); } if (Request["l"] != null) { culture = QDEUtils.UpdateCultureCodeFromRequest("l"); } if (Request["f"] != null) { inputFormId = Convert.ToInt32(Request["f"]); } //Added by Prabhu for CR 5160 & ACQ 8.12 (PCF1: Auto TR Redesign)-- 21/May/09 if (Request["isATRButton"] != null) { isAutoTRButton = Convert.ToBoolean(Request["isATRButton"]); } if (inputFormId > 0) { containerMATFList = Request["c"].ToString(); if (culture.Type == CultureType.Regionale && isAutoTRButton) { lblChkBoxAlert.Visible = true; lblChkBoxAlert.Text = "<font color='red'><b>Note:</b> Move status to will be performed on locally authored content only.</font>"; } } // Check // - user is valid // - culture is valid // - item is valid // - user has the current culture in its scope // - user has the item in its scope if (user != null && culture != null && item != null && user.HasCultureInScope(culture.Code) && user.HasItemInScope(item.Id)) { if (!Page.IsPostBack) { DateTime today = DateTime.UtcNow; item.RegionCode = culture.Code; // check if this item or its inherited item has BOR date in future. if (item.Milestones != null && culture.Type == CultureType.Regionale && inputFormId < 0) { if (!item.Milestones.Inherited) { if ((item.Milestones.BeginningOfRegionalization != null && item.Milestones.BeginningOfRegionalization.Value > today)) { panelMATF.Visible = false; lblWarningMessage.Visible = true; lblWarningMessage.Text = warningMessage; } else { UpdateDataView(); } } else { item.Milestones.InheritedItem.RegionCode = culture.Code; if ((item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization != null && item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization.Value > today)) { panelMATF.Visible = false; lblWarningMessage.Visible = true; lblWarningMessage.Text = warningMessage; } else { UpdateDataView(); } } } else { UpdateDataView(); } } } else { UITools.DenyAccess(DenyMode.Popup); return; } } catch (Exception excep) { //Response.Write(excep.ToString()); UITools.DenyAccess(DenyMode.Popup); } }
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>"); } }
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; }
private void DoTranslation() { lbError.Visible = dg.Visible = false; threshholdLimit = Convert.ToInt32(ApplicationSettings.Parameters["AutoTR_UIThresholdLimit"].Value.ToString()); int TotalTRChunksCount; dgContainer.Visible = false; //QC 1646 : Cannot Auto-translate -> The time-out parameter is extended to 1 hr using (Database dbObj = new Database(SessionState.CacheComponents["Crystal_DB"].ConnectionString, 3600)) { //Modified by Prabhu for CR 5160 & ACQ 8.12 (PCF1: Auto TR Redesign)-- 21/May/09 using (DataSet ds = dbObj.RunSPReturnDataSet("_TM_TranslateItem", new SqlParameter("@ItemId", itemId), new SqlParameter("@ContainerList", containerList), new SqlParameter("@RegionCode", cultureCode), new SqlParameter("@UserId", SessionState.User.Id))) { dbObj.CloseConnection(); if (dbObj.LastError != string.Empty) { lbError.Text = dbObj.LastError; lbError.Visible = true; dg.Visible = false; dgContainer.Visible = false; UITools.HideToolBarSeparator(Ultrawebtoolbar1, "CloseSep"); UITools.HideToolBarButton(Ultrawebtoolbar1, "Export"); } else if (ds.Tables.Count > 0 && ds.Tables[0].Rows[0][0].ToString() != "") { TotalTRChunksCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); if (TotalTRChunksCount > threshholdLimit) { warningMessage = "<font color='red' size='2'><b>Error:</b> Selected containers cannot be auto translated.</font><br><br>" + "Translatable Chunk Count: " + TotalTRChunksCount + "<br>" + "IT Threshold Limit: " + threshholdLimit + "<br><br>" + "Total number of chunks to be auto translated is more than IT recommended threshold limit. <br>" + "Requesting user to uncheck few containers and try again."; lblWarningMessage.Text = warningMessage; lblWarningMessage.Visible = true; dg.Visible = false; dgContainer.Visible = true; dgContainer.DataSource = ds.Tables[1]; Utils.InitGridSort(ref dgContainer); dgContainer.DataBind(); UITools.HideToolBarSeparator(Ultrawebtoolbar1, "CloseSep"); UITools.HideToolBarButton(Ultrawebtoolbar1, "Export"); } else { dg.Visible = true; dgContainer.Visible = false; dg.DataSource = ds.Tables[1]; ds.Tables.Remove(ds.Tables[0]); ViewState["ds"] = ds; Utils.InitGridSort(ref dg); dg.DataBind(); //reset checkbox on success Page.ClientScript.RegisterStartupScript(Page.GetType(), "ResetParentCheckBox", "ResetParentCheckBox();", true); } } else { lbError.Visible = true; lbError.Text = "No content was eligible for Auto Translation."; dg.Visible = false; dgContainer.Visible = false; UITools.HideToolBarSeparator(Ultrawebtoolbar1, "CloseSep"); UITools.HideToolBarButton(Ultrawebtoolbar1, "Export"); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ResetParentCheckBox", "ResetParentCheckBox();", true); } } } }
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 }
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; } } } } } }
public override IEnumerable <GenericMetadataModel> GetMetadata(EntryModel <FileInfoEx, DirectoryInfoEx, FileSystemInfoEx>[] appliedModels) { if (appliedModels.Length == 1) { EntryModel <FileInfoEx, DirectoryInfoEx, FileSystemInfoEx> model = appliedModels[0]; FileSystemInfoEx entry = model.EmbeddedEntry; yield return(new EntryMetadataModel <string, FileInfoEx, DirectoryInfoEx, FileSystemInfoEx>(appliedModels, model.Label, "Key_Selected_0_Label")); if (entry is FileInfoEx) { yield return(new EntryMetadataModel <string, FileInfoEx, DirectoryInfoEx, FileSystemInfoEx>(appliedModels, UITools.SizeInK((ulong)model.Length), "Key_Selected_0_Size", "Selected size")); } yield return(new EntryMetadataModel <DateTime, FileInfoEx, DirectoryInfoEx, FileSystemInfoEx>(appliedModels, DateTime.Now, "DateTime_Test", "Now")); } }
private void dg_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { Infragistics.WebUI.UltraWebGrid.UltraGridRow r = e.Row; UITools.HiglightGridRowFilter(ref r, txtFilter.Text); }
private void RenderScriptReferences() { // Get scripts that are added by the framework var frameworkScriptPaths = GetFrameworkScripts(); // Construct smart list var smartList = new List <string>(); // Hard-code WebForms.js - it will be rendered here, and not in Page (like by default) smartList.Add(GetUrl(new ScriptReference(this.Page.ClientScript.GetWebResourceUrl(typeof(System.Web.UI.Page), "WebForms.js")))); // Add scripts needed by the framework smartList.AddRange(frameworkScriptPaths); // Add scripts previously added to this control smartList.AddRange(this.Scripts.Select(s => GetUrl(s))); // Add scripts from the smart loader smartList.AddRange(SmartLoader.GetScriptsToLoad()); // Clear previous scripts (they are now part of smartList) Scripts.Clear(); // Initialize bundling var allowJsBundling = PortalBundleOptions.Current.AllowJsBundling; var bundle = allowJsBundling ? new JsBundle() : null; // Go through all scripts foreach (var spath in smartList) { var lower = spath.ToLower(); if (lower.EndsWith(".css")) { UITools.AddStyleSheetToHeader(UITools.GetHeader(), spath); } else { var isPostponed = PortalBundleOptions.JsIsBlacklisted(spath); var isFrameworkScript = frameworkScriptPaths.Contains(spath); if (isPostponed) { _postponedList.Add(spath); } if (allowJsBundling && !isPostponed) { bundle.AddPath(spath); } if (!isPostponed && !isFrameworkScript) { Scripts.Add(new ScriptReference(spath)); } } } // Go through postponed scripts foreach (var spath in _postponedList) { Scripts.Add(new ScriptReference(spath)); } // NOTE: At this point, script order is the following: // 1) scripts added by the framework // 2) scripts added directly to this control // 3) scripts from SmartLoader (that are not blacklisted from bundling) // 4) scripts from SmartLoader (that are blacklisted from bundling) // Finalize bundling if (allowJsBundling) { // If bundling is allowed, close the bundle and process it bundle.Close(); BundleHandler.AddBundleIfNotThere(bundle); ThreadPool.QueueUserWorkItem(x => BundleHandler.AddBundleToCache(bundle)); if (BundleHandler.IsBundleInCache(bundle)) { // If the bundle is complete, use its path to replace the path of all the scripts that are not postponed _bundle = bundle; } } }
private void dg_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { System.Int64 itemId = Convert.ToInt64(e.Row.Cells.FromKey("ItemId").Value); int containerId = Convert.ToInt32(e.Row.Cells.FromKey("ContainerId").Value); bool keep = true; // Error field e.Row.Cells.FromKey("Error").Style.HorizontalAlign = HorizontalAlign.Center; if (e.Row.Cells.FromKey("Error").Text == "0") { e.Row.Delete(); keep = false; } else { if (e.Row.Cells.FromKey("Error").Text == "1") { e.Row.Cells.FromKey("Error").Text = e.Row.Cells.FromKey("Error").Text + " error"; } else { e.Row.Cells.FromKey("Error").Text = e.Row.Cells.FromKey("Error").Text + " errors"; } e.Row.Cells.FromKey("Error").Style.CssClass = "hc_error"; } if (keep) { // Index e.Row.Cells.FromKey("Index").Value = e.Row.Index; // Read only container if (Convert.ToBoolean(e.Row.Cells.FromKey("ReadOnly").Value)) { e.Row.Cells.FromKey("ContainerName").Text = e.Row.Cells.FromKey("ContainerName").Text + " <img src='/hc_v4/img/ed_glasses.gif'/>"; } //If RTL languages, ensure correct display if ((bool)e.Row.Cells.FromKey("Rtl").Value) { e.Row.Cells.FromKey("Value").Style.CustomRules = "direction: rtl;"; //unicode-bidi:bidi-override;"; } string rowItem = e.Row.Cells.FromKey("ItemId").Text; if (currentItem != rowItem) { currentItem = rowItem; itemCount++; } int index = e.Row.Index + itemCount; //Display Edit Link in Container Name e.Row.Cells.FromKey("ContainerName").Text = "<a href='javascript://' onclick=\"ed(" + index + ", " + e.Row.Cells.FromKey("ItemId").ToString() + ")\">" + e.Row.Cells.FromKey("ContainerName").Text + "</a>"; //Display Status logo if (e.Row.Cells.FromKey("Status").Text != null) { e.Row.Cells.FromKey("Status").Style.CssClass = "S" + e.Row.Cells.FromKey("Status").Text; e.Row.Cells.FromKey("Status").Value = string.Empty; } // BLANK Value is replace by Readable sentence if (e.Row.Cells.FromKey("Value").Text == HyperCatalog.Business.Chunk.BlankValue) { e.Row.Cells.FromKey("Value").Text = HyperCatalog.Business.Chunk.BlankText; e.Row.Cells.FromKey("Value").Style.CustomRules = string.Empty; } else { e.Row.Cells.FromKey("Value").Text = UITools.HtmlEncode(e.Row.Cells.FromKey("Value").Text); } } }
/// <summary> /// Sets the callback URL of the ActionMenu. It represents the service url with correct parameters for the actions. /// </summary> private void SetServiceUrl() { var scParams = GetReplacedScenarioParameters(); var context = UITools.FindContextInfo(this, ContextInfoID); var path = !String.IsNullOrEmpty(ContextInfoID) ? context.Path : NodePath; var encodedReturnUrl = Uri.EscapeDataString(PortalContext.Current.RequestedUri.PathAndQuery); var encodedParams = Uri.EscapeDataString(scParams ?? string.Empty); if (String.IsNullOrEmpty(path)) { path = GetPathFromContentView(this); } if (string.IsNullOrEmpty(path)) { this.Visible = false; return; } var head = NodeHead.Get(path); if (head == null || !SecurityHandler.HasPermission(head, PermissionType.See)) { this.Visible = false; return; } this.Content = Content.Load(path); //Pre-check action count. If empty, hide the action menu. if (CheckActionCount) { //var sc = ScenarioManager.GetScenario(Scenario, scParams); var actionCount = 0; if (!string.IsNullOrEmpty(Scenario)) { actionCount = ActionFramework.GetActions(this.Content, Scenario, scParams, null).Count(); } if (actionCount < 2 && string.Equals(Scenario, "new", StringComparison.CurrentCultureIgnoreCase)) { ClickDisabled = true; } else if (actionCount == 0) { this.Visible = false; return; } } //Pre-check required permissions var permissions = ActionFramework.GetRequiredPermissions(RequiredPermissions); if (permissions.Count > 0 && !SecurityHandler.HasPermission(head, permissions.ToArray())) { this.Visible = false; return; } var encodedPath = HttpUtility.UrlEncode(path); ServiceUrl = String.Format("/SmartAppHelper.mvc/GetActions?path={0}&scenario={1}&back={2}¶meters={3}", encodedPath, Scenario, encodedReturnUrl, encodedParams); }
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>"); } }
void Start() { speakerText = GameObject.Find("SpeakerText"); dialogueText = GameObject.Find("DialogueText"); dialogueBGSprite = Resources.Load <Sprite>("Graphics/UI/Dialogue Sprites/dialogue temp cropped 2") as Sprite; dialogueBGSpriteSpeakerless = Resources.Load <Sprite>("Graphics/UI/Dialogue Sprites/dialogue temp cropped 2 speakerless") as Sprite; textBG = new GameObject("DialogueBG"); Image dialogueBG = textBG.AddComponent <Image>(); textBG.transform.SetParent(targetCanvas.transform.Find("DialoguePanel")); dialogueBG.sprite = null; dialogueBG.color = new Color(1, 1, 1, 0); textBG.GetComponent <RectTransform>().pivot = new Vector2(0, 0); textBG.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 0); textBG.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 0); textBG.GetComponent <RectTransform>().anchoredPosition = new Vector2(-316, -126); textBG.GetComponent <RectTransform>().sizeDelta = new Vector2(632 * UITools.GetUIScalingFactor(), 104 * UITools.GetUIScalingFactor()); }
/* ========================================================================================= Methods */ protected override void OnInit(EventArgs e) { base.OnInit(e); UITools.AddScript("$skin/scripts/sn/SN.AllowedChildTypes.js"); UITools.AddStyleSheetToHeader(UITools.GetHeader(), "$skin/styles/icons.css"); }
private void UpdateDataView() { Item _item = Item.GetByKey(Convert.ToInt32(itemId)); lItemName.Text = _item.Name; lItemLevel.Text = _item.Level.Name; using (Database dbObj = Utils.GetMainDB()) { using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._Item_WhosWho", "Items", new SqlParameter("@ItemId", itemId), new SqlParameter("@CultureCode", cultureCode))) { dbObj.CloseConnection(); if (dbObj.LastError == string.Empty) { Label title; DataTable dt; DataRow dr; int i; string curRole; bool canSeeRealEmails = SessionState.User.HasCapability(HyperCatalog.Business.CapabilitiesEnum.SEE_REAL_EMAIL); Infragistics.WebUI.Misc.WebPanel wp; string userEmail; int nbUsers; #region Creator dt = ds.Tables[0]; if (dt.Rows.Count > 0) { #region title title = new Label(); title.Text = "Creator"; title.CssClass = "ptbgroup"; title.Width = Unit.Percentage(100); panelUsers.Controls.Add(title); #endregion panelUsers.Controls.Add(new LiteralControl("<table width='100%' cellspacing='0' cellpadding='0' border='0'>")); for (i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; Label creator = new Label(); creator.Controls.Add(new LiteralControl(Environment.NewLine + "<tr><td width='200'><a href='mailto:" + UITools.GetDisplayEmail(dr["eMail"].ToString()) + "'>" + dr["UserName"].ToString() + "</a></td><td align='right'>" + dr["Organization"].ToString() + "</td>")); panelUsers.Controls.Add(creator); } panelUsers.Controls.Add(new LiteralControl("</table>")); panelUsers.Controls.Add(new LiteralControl("<br/>")); } #endregion #region Modifier dt = ds.Tables[1]; if (dt.Rows.Count > 0) { #region title title = new Label(); title.Text = "Modifier"; title.CssClass = "ptbgroup"; title.Width = Unit.Percentage(100); panelUsers.Controls.Add(title); #endregion panelUsers.Controls.Add(new LiteralControl("<table width='100%' cellspacing='0' cellpadding='0' border='0'>")); for (i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; Label creator = new Label(); creator.Controls.Add(new LiteralControl(Environment.NewLine + "<tr><td width='200'><a href='mailto:" + UITools.GetDisplayEmail(dr["eMail"].ToString()) + "'>" + dr["UserName"].ToString() + "</a></td><td align='right'>" + dr["Organization"].ToString() + "</td>")); panelUsers.Controls.Add(creator); } panelUsers.Controls.Add(new LiteralControl("</table>")); panelUsers.Controls.Add(new LiteralControl("<br/>")); } #endregion #region Item users list dt = ds.Tables[2]; if (dt.Rows.Count > 0) { #region title title = new Label(); title.Text = "Item Users list"; title.CssClass = "ptbgroup"; title.Width = Unit.Percentage(100); panelUsers.Controls.Add(title); #endregion curRole = string.Empty; nbUsers = 0; wp = null; for (i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; if (dr["RoleName"].ToString() != curRole) { if (wp != null) { wp.Header.Text = curRole + " (" + nbUsers + ")"; wp.Controls.Add(new LiteralControl("</table>")); } wp = new Infragistics.WebUI.Misc.WebPanel(); curRole = dr["RoleName"].ToString(); wp.ID = "role" + i.ToString(); wp.Width = Unit.Percentage(100); wp.ImageDirectory = "/hc_v4/img"; wp.Header.ExpandedAppearance.Style.CssClass = "ptb5"; // "hc_webpanelexp"; wp.Header.ExpansionIndicator.AlternateText = "Expand/Collapse"; wp.Header.ExpansionIndicator.CollapsedImageUrl = "ed_dt.gif"; wp.Header.ExpansionIndicator.ExpandedImageUrl = "ed_upt.gif"; wp.Header.CollapsedAppearance.Style.CssClass = "ptb5"; // "hc_webpanelcol"; wp.Header.TextAlignment = Infragistics.WebUI.Misc.TextAlignment.Left; wp.Expanded = false; panelUsers.Controls.Add(wp); panelUsers.Controls.Add(new LiteralControl("<br/>")); wp.Controls.Add(new LiteralControl("<table width='100%' cellspacing='0' cellpadding='0' border='0'>")); } nbUsers++; wp.Controls.Add(new LiteralControl(Environment.NewLine + "<tr><td width='200'><a href='mailto:" + UITools.GetDisplayEmail(dr["eMail"].ToString()) + "'>" + dr["UserName"].ToString() + "</a></td><td align='right'>" + dr["Organization"].ToString() + "</td>")); } wp.Controls.Add(new LiteralControl("</table>")); wp.Header.Text = curRole + " (" + nbUsers + ")"; } #endregion #region Content contributors dt = ds.Tables[3]; if (dt.Rows.Count > 0) { #region title title = new Label(); title.Text = "Content contributors"; title.CssClass = "ptbgroup"; title.Width = Unit.Percentage(100); panelUsers.Controls.Add(title); #endregion curRole = string.Empty; nbUsers = 0; wp = null; for (i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; if (dr["RoleName"].ToString() != curRole) { if (wp != null) { wp.Header.Text = curRole + " (" + nbUsers + ")"; wp.Controls.Add(new LiteralControl("</table>")); } wp = new Infragistics.WebUI.Misc.WebPanel(); curRole = dr["RoleName"].ToString(); wp.ID = "contributorsrole" + i.ToString(); wp.Width = Unit.Percentage(100); wp.ImageDirectory = "/hc_v4/img"; wp.Header.ExpandedAppearance.Style.CssClass = "ptb5"; // "hc_webpanelexp"; wp.Header.ExpansionIndicator.AlternateText = "Expand/Collapse"; wp.Header.ExpansionIndicator.CollapsedImageUrl = "ed_dt.gif"; wp.Header.ExpansionIndicator.ExpandedImageUrl = "ed_upt.gif"; wp.Header.CollapsedAppearance.Style.CssClass = "ptb5"; // "hc_webpanelcol"; wp.Header.TextAlignment = Infragistics.WebUI.Misc.TextAlignment.Left; wp.Expanded = true; panelUsers.Controls.Add(wp); panelUsers.Controls.Add(new LiteralControl("<br/>")); wp.Controls.Add(new LiteralControl("<table width='100%' cellspacing='0' cellpadding='0' border='0'>")); } nbUsers++; wp.Controls.Add(new LiteralControl(Environment.NewLine + "<tr><td width='200'><a href='mailto:" + UITools.GetDisplayEmail(dr["eMail"].ToString()) + "'>" + dr["UserName"].ToString() + "</a></td><td><a href='javascript://' title='Click here to show the full list' onclick=\"OpenDetail(" + itemId + ",'" + cultureCode + "'," + dr["UserId"].ToString() + ");return false;\">" + dr["ChunkCount"].ToString() + (Convert.ToInt32(dr["ChunkCount"]) > 1 ? " chunks" : " chunk") + "</a></td><td align='right'>" + dr["Organization"].ToString() + "</td>")); } wp.Controls.Add(new LiteralControl("</table>")); wp.Header.Text = curRole + " (" + nbUsers + ")"; } #endregion } else { lbError.Text = "Error: " + dbObj.LastError.ToString(); lbError.CssClass = "hc_error"; lbError.Visible = true; } } } }