/// <inheritdoc /> public void FrameUpdate(RenderFrameEventArgs e) { // Try to get current map. var map = MapId.Nullspace; var ent = PlayerManager.LocalPlayer.ControlledEntity; if (ent != null && ent.TryGetComponent <IGodotTransformComponent>(out var component)) { map = component.MapID; } if (map == MapId.Nullspace || CurrentPermission == null || CurrentMode == null) { return; } var mouseScreen = new ScreenCoordinates(inputManager.MouseScreenPosition, map); ValidPosition = CurrentMode.FrameUpdate(e, mouseScreen); // purge old unapproved tile changes _pendingTileChanges.RemoveAll(c => c.Item2 < _time.RealTime); // continues tile placement but placement of entities only occurs on mouseup if (_tileMouseDown && CurrentPermission.IsTile) { HandlePlacement(); } drawNode.Update(); }
/// <summary> /// Override sharepoint save method. /// Create and temporary save a "create account request". /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomSaveHandler(object sender, EventArgs e) { SPContext.Current.Web.AllowUnsafeUpdates = true; if (CurrentMode == SPControlMode.New) { CurrentItem[FieldsName.CategoryList.InternalName.CategoryID] = Guid.NewGuid(); } //set category level if (!string.IsNullOrEmpty(ddlCategory.SelectedValue)) { CurrentItem[FieldsName.CategoryList.InternalName.CategoryLevel] = Utilities.GetMenuLevel(CurrentWeb, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, ddlCategory.SelectedValue, FieldsName.CategoryList.InternalName.CategoryLevel); } //set category parent CurrentItem[FieldsName.CategoryList.InternalName.ParentID] = ddlCategory.SelectedValue; CurrentItem[FieldsName.CategoryList.InternalName.ParentName] = Utilities.GetValueByField(CurrentWeb, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, ddlCategory.SelectedValue, "Text", FieldsName.CategoryList.InternalName.Title); //update category level for all children var newLevel = Utilities.ConvertToInt(Utilities.GetValueByField(CurrentWeb, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, ddlCategory.SelectedValue, "Text", FieldsName.CategoryList.InternalName.CategoryLevel)) + 1; if (CurrentMode.Equals(SPControlMode.Edit) && !newLevel.ToString().Equals(hidLevel.Value)) { Utilities.UpdateChildrenLevel(CurrentWeb, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, FieldsName.CategoryList.InternalName.ParentID, Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.CategoryID]), newLevel + 1, FieldsName.CategoryList.InternalName.CategoryLevel); } //Save item to list SaveButton.SaveItem(SPContext.Current, false, string.Empty); }
public void ProcessThrustParallel(bool hasWaypoint) { if (!hasWaypoint) { //Logger.MsgDebug("No Waypoint", DebugTypeEnum.AutoPilot); StopAllThrust(); return; } if (CurrentMode.HasFlag(NewAutoPilotMode.ThrustForward)) { if (InGravity() && CurrentMode.HasFlag(NewAutoPilotMode.LevelWithGravity)) { CalculateHoverThrust(); } else { CalculateDirectForwardThrust(); } } if (CurrentMode.HasFlag(NewAutoPilotMode.Ram)) { CalculateRamThrust(); } //Logger.MsgDebug("Allow Strafe: " + this.Data.AllowStrafing, DebugTypeEnum.AutoPilot); //Logger.MsgDebug("Is Strafe: " + CurrentMode.HasFlag(NewAutoPilotMode.Strafe), DebugTypeEnum.AutoPilot); if (this.Data.AllowStrafing && CurrentMode.HasFlag(NewAutoPilotMode.Strafe)) { //Logger.MsgDebug("Calc Strafe: ", DebugTypeEnum.AutoPilot); CalculateStrafeThrust(); } }
private void BindData() { try { if (CurrentMode.Equals(SPControlMode.New)) { Utilities.BindToDropDown(CurrentWeb, ddlCategory, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, FieldsName.CategoryList.InternalName.ParentID, FieldsName.CategoryList.InternalName.Order, FieldsName.CategoryList.InternalName.CategoryLevel); } if (CurrentMode.Equals(SPControlMode.Edit)) { Utilities.BindToDropDown(CurrentWeb, ddlCategory, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, FieldsName.CategoryList.InternalName.ParentID, FieldsName.CategoryList.InternalName.CategoryLevel, FieldsName.CategoryList.InternalName.CategoryLevel, Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.CategoryID]) , Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.ParentID])); hidLevel.Value = Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.CategoryLevel]); } if (CurrentMode.Equals(SPControlMode.Display)) { ddlCategory.Visible = false; lblCatDisplay.Visible = true; lblCatDisplay.Text = Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.ParentName]); hidType.Value = Convert.ToString(CurrentItem[FieldsName.CategoryList.InternalName.Type]); } } catch (Exception ex) { Utilities.LogToULS(ex); } }
private void BindData() { //Bind ddlCategory try { if (CurrentMode.Equals(SPControlMode.New) || CurrentMode.Equals(SPControlMode.Edit)) { Utilities.BindToDropDown(CurrentWeb, ddlCategory, ListsName.InternalName.CategoryList, FieldsName.CategoryList.InternalName.CategoryID, FieldsName.CategoryList.InternalName.ParentID, FieldsName.CategoryList.InternalName.Order, FieldsName.CategoryList.InternalName.CategoryLevel); } if (CurrentMode.Equals(SPControlMode.Edit) || CurrentMode.Equals(SPControlMode.Display)) { ddlCategory.SelectedValue = Convert.ToString(CurrentItem[FieldsName.DocumentsList.InternalName.CategoryId]); } if (CurrentMode.Equals(SPControlMode.Display)) { ddlCategory.Visible = false; lblCatDisplay.Visible = true; lblCatDisplay.Text = Convert.ToString(CurrentItem[FieldsName.DocumentsList.InternalName.CategoryName]); } } catch (Exception ex) { Utilities.LogToULS(ex); } }
/// <summary> /// Load default value to control and other initialize. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (CurrentMode.Equals(Constants.DisplayForm)) { fuFile.Visible = false; linkFile.Visible = true; linkFile.Text = Convert.ToString(CurrentItem[FieldsName.AdvList.InternalName.AdvFile]); linkFile.NavigateUrl = WebUrl + "/" + Convert.ToString(CurrentItem[FieldsName.AdvList.InternalName.AdvFile]); linkFile.Target = "_blank"; ltrBr.Text = "<br /><br />"; } else if (CurrentMode.Equals(Constants.NewForm)) { fuFile.Visible = true; linkFile.Visible = false; } else if (CurrentMode.Equals(Constants.EditForm)) { fuFile.Visible = true; linkFile.Visible = true; linkFile.Text = Convert.ToString(CurrentItem[FieldsName.AdvList.InternalName.AdvFile]); linkFile.NavigateUrl = WebUrl + "/" + Convert.ToString(CurrentItem[FieldsName.AdvList.InternalName.AdvFile]); linkFile.Target = "_blank"; ltrBr.Text = "<br /><br />"; } } }
public void Rotate() { switch (Direction) { case Direction.North: Direction = Direction.East; break; case Direction.East: Direction = Direction.South; break; case Direction.South: Direction = Direction.West; break; case Direction.West: Direction = Direction.North; break; } if (CurrentMode != null) { CurrentMode.SetSprite(); } }
public void Update(object source) { if (!ReferenceEquals(source, CurrentMode)) { CurrentMode.Refresh(); } }
private void NextMode(TimeSpan duration) { var currentMode = _modes.Dequeue(); currentMode.OnEnd(Buttons); _modes.Enqueue(currentMode); CurrentMode.OnStart(Buttons); }
private void Start() { _tempTools = new List <VRTK_InteractableObject>(); _mode = CurrentMode.Build; GetComponent <VRTK_ControllerEvents>().GripPressed += DoGrabPressed; GetComponent <VRTK_ControllerEvents>().GripReleased += DoGrabReleased; GetComponent <VRTK_ControllerEvents>().ButtonTwoPressed += DoButtonTwoPressed; }
/// <summary> Stream to which to write the HTML for this subwriter </summary> /// <param name="Output"> Response stream for the item viewer to write directly to </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer) { // Replace item URL in the restricted message CurrentMode.ViewerCode = string.Empty; string msg = restrictedMessage.Replace("<%ITEMURL%>", CurrentMode.Redirect_URL()); Output.WriteLine("<td style=\"text-align:left;\" id=\"sbkRes_MainArea\">" + msg + "</td>"); }
private string compute_text_redirect_stem() { // Split the parts List <string> terms = new List <string>(); List <string> fields = new List <string>(); // Split the terms correctly SobekCM_Assistant.Split_Clean_Search_Terms_Fields(CurrentMode.Search_String, CurrentMode.Search_Fields, CurrentMode.Search_Type, terms, fields, SobekCM_Library_Settings.Search_Stop_Words, CurrentMode.Search_Precision, ','); // See about a text search string StringBuilder textSearcher = new StringBuilder(); // Step through each term and field bool text_included_in_search = false; for (int i = 0; (i < terms.Count) && (i < fields.Count); i++) { if ((fields[i].Length > 1) && (terms[i].Length > 1)) { // If this is either for ANYWHERE or for TEXT, include it if (((fields[i].IndexOf("TX") >= 0) || (fields[i].IndexOf("ZZ") >= 0)) && (fields[i][0] != '-')) { if (textSearcher.Length > 0) { textSearcher.Append("+=" + terms[i].Replace("\"", "%22")); } else { textSearcher.Append(terms[i].Replace("\"", "%22")); } } // See if this was explicitly a search against full text if (fields[i].IndexOf("TX") >= 0) { text_included_in_search = true; } } } string url_options = CurrentMode.URL_Options(); if (CurrentMode.Coordinates.Length > 0) { return((url_options.Length > 0) ? "?coord=" + CurrentMode.Coordinates + "&" + url_options : "?coord=" + CurrentMode.Coordinates); } if (textSearcher.Length > 0) { if ((CurrentMode.Search_Type == Search_Type_Enum.Full_Text) || (text_included_in_search)) { return((url_options.Length > 0) ? "/search?search=" + textSearcher + "&" + url_options : "/search?search=" + textSearcher); } return((url_options.Length > 0) ? "?search=" + textSearcher + "&" + url_options : "?search=" + textSearcher); } return((url_options.Length > 0) ? "?" + url_options : String.Empty); }
private void Update() { float percent; switch (currentMode) { case CurrentMode.Show: count += Time.deltaTime; if (count >= TransitionSpeed) { textBGColor.a = BGAlpha; textColor.a = 1; count = 0; currentMode = CurrentMode.Wait; break; } percent = count / TransitionSpeed; textBGColor.a = BGAlpha * percent; textColor.a = 1 * percent; break; case CurrentMode.Wait: count += Time.deltaTime; if (count >= Lifespan) { count = 0; currentMode = CurrentMode.Hide; break; } break; case CurrentMode.Hide: count += Time.deltaTime; if (count >= TransitionSpeed) { textBGColor.a = 0; textColor.a = 0; Text.color = textColor; TextBG.color = textBGColor; count = 0; currentMode = CurrentMode.Sleep; if (origin != null) { origin.Done = true; } break; } percent = 1 - count / TransitionSpeed; textBGColor.a = BGAlpha * percent; textColor.a = 1 * percent; break; default: return; } Text.color = textColor; TextBG.color = textBGColor; }
// Use this for initialization void Start() { //ARCamera = GameObject.FindGameObjectWithTag("ARCamera"); portsList = new List <GameObject>(); myMode = CurrentMode.EDITING; nclParser = GameObject.FindGameObjectWithTag("GameController").GetComponent <NCLParser>(); linksController = GameObject.FindGameObjectWithTag("LinksController").GetComponent <LinksControllerScript>(); structural = GameObject.FindGameObjectWithTag("StructuralView").GetComponent <StructuralViewScript>(); }
/// <summary> /// Override sharepoint save method. /// Create and temporary save a "create account request". /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomSaveHandler(object sender, EventArgs e) { CurrentWeb.AllowUnsafeUpdates = true; if (CurrentMode.Equals(Constants.NewForm)) { CurrentItem[FieldsName.ExternalNewsLink.InternalName.NewsGroup] = Request.QueryString["CatID"]; } SaveButton.SaveItem(SPContext.Current, false, string.Empty); }
public void Destroy() { CurrentMode.Destroy(); if (null != _coroutinePool) { _coroutinePool.Destroy(); _coroutinePool = null; } }
private void UpdateSource() { if (CurrentSource == null) { return; } CurrentMode.ChangeSource(CurrentSource); TileLayer.TileSources.Clear(); TileLayer.TileSources.Add(CurrentSource); }
public async void StopAsync() { try { await CurrentMode.StopAsync(); _State = SequencerState.Stopped; } catch (Exception ex) { // Enable logging } }
public InventoryTransferMenu(int x, int y, int width, int height, IList <Item> OtherItems, int OtherCapacity, int OtherRows = 6, int OtherCollumns = 6) : base(x, y, width, height, true) { this.playerInventory = new InventoryMenu(x, y, width, height, 6, 6, true, Game1.player.Items, Game1.player.MaxItems, Color.SandyBrown); this.otherItems = OtherItems; this.otherInventory = new InventoryMenu(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 128, y, width, height, OtherRows, OtherCollumns, true, this.otherItems, OtherCapacity, Color.SandyBrown); this.isPlayerInventory = true; this.currentMode = CurrentMode.TransferItems; this.transferButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Transfer Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemTransferButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f); this.trashButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Trash Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 96), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "TrashButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f); this.trashedItem = new ItemDisplayButton(null, new StardustCore.Animations.AnimatedSprite("ItemBackground", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemBackground"), new Animation(0, 0, 32, 32)), Color.White), new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new Rectangle(0, 0, 32, 32), 2f, true, Color.White); }
private void HandleUnitRemoved(UnitRemovedEvent e) { if (CurrentMode.Equals(GameMode.PlayerOne) || CurrentMode.Equals(GameMode.PlayerOneSetup)) { PlayerOne.Pieces.Remove(e.Unit); } else if (CurrentMode.Equals(GameMode.PlayerTwo) || CurrentMode.Equals(GameMode.PlayerTwoSetup)) { PlayerTwo.Pieces.Remove(e.Unit); } }
private string compute_image_redirect_stem() { string url_options = CurrentMode.URL_Options(); if (CurrentMode.Coordinates.Length > 0) { return((url_options.Length > 0) ? "?coord=" + CurrentMode.Coordinates + "&" + url_options : "?coord=" + CurrentMode.Coordinates); } return((url_options.Length > 0) ? "?" + url_options : String.Empty); }
/// <summary> /// Handles what happens when the menu is left clicked. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="playSound"></param> public override void receiveLeftClick(int x, int y, bool playSound = true) { if (this.currentMode == CurrentMode.TransferItems) { if (this.otherInventory.isFull == false) { this.playerInventory.receiveLeftClick(x, y); if (this.playerInventory.activeItem != null) { this.transferItem(ref this.playerInventory, ref this.otherInventory); } } if (this.playerInventory.isFull == false) { this.otherInventory.receiveLeftClick(x, y); if (this.otherInventory.activeItem != null) { this.transferItem(ref this.otherInventory, ref this.playerInventory); } } } if (this.currentMode == CurrentMode.TrashItem) { this.playerInventory.receiveLeftClick(x, y); this.otherInventory.receiveLeftClick(x, y); if (this.playerInventory.activeItem != null) { this.trashItem(ref this.playerInventory); } if (this.otherInventory.activeItem != null) { this.trashItem(ref this.otherInventory); } } if (this.transferButton.receiveLeftClick(x, y)) { this.currentMode = CurrentMode.TransferItems; Game1.playSound("shwip"); } if (this.trashButton.receiveLeftClick(x, y)) { this.currentMode = CurrentMode.TrashItem; Game1.playSound("shwip"); } if (this.trashedItem.receiveLeftClick(x, y)) { this.recoverTrashedItem(); this.playerInventory.populateClickableItems(); this.otherInventory.populateClickableItems(); } }
Vector3 rotateVector; //вектор, на который необходимо повернуть объект, которому прикреплены направляющие void OnMouseDown() { //если зажат "пробел", то объект будет масштабироваться if (Input.GetKey(KeyCode.Space)) { currentMode = CurrentMode.scale; } //если зажать "левый Ctrl", то объект будет вращаться else if (Input.GetKey(KeyCode.LeftControl)) { currentMode = CurrentMode.rotate; } //если не зажато ничего, то объект будет перемещаться else { currentMode = CurrentMode.move; } try { attachedInstance = axisController.GetAttachedInstance(); objLogic = attachedInstance.GetComponent <ObjectLogic>(); } catch (System.Exception e) { //errEngine.SetError(e.Message); errEngine.SetError("Error. There is no attached object"); } Debug.Log(gameObject.name); //для каждой оси смещение относительно центра родительского элемента рассчитывается отдельно if (currentAxis == CurrentAxis.xAxis) { centerShift = new Vector3(thisCollider.bounds.size.x / 2, 0, 0); } else if (currentAxis == CurrentAxis.yAxis) { centerShift = new Vector3(0, thisCollider.bounds.size.y / 2, 0); } else if (currentAxis == CurrentAxis.zAxis) { centerShift = new Vector3(0, 0, thisCollider.bounds.size.z / 2); } savedPosition = gameObject.transform.position; screenPoint = Camera.main.WorldToScreenPoint(transform.position); offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z)); curScreenPoint.x = Input.mousePosition.x; curScreenPoint.y = Input.mousePosition.y; curScreenPoint.z = screenPoint.z; prevPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset; rotateVector = attachedInstance.transform.eulerAngles; }
public static MvcHtmlString AdminBackup(this HtmlHelper helper, string linkText, CurrentMode mode, object htmlAttributes = null) { return(helper.ActionLink(linkText, ActionNames.Backup, ControllerNames.Admin, null, htmlAttributes, mode)); }
public static MvcHtmlString Search(this HtmlHelper helper, string linkText, CurrentMode mode, object htmlAttributes = null) { return(helper.ActionLink(linkText, ActionNames.Index, ControllerNames.Search, null, htmlAttributes, mode)); }
public static MvcHtmlString Subscrib(this HtmlHelper helper, string linkText, CurrentMode mode, object htmlAttributes = null) { return(helper.ActionLink(linkText, ActionNames.Subscrib, ControllerNames.Newsletters, null, htmlAttributes, mode)); }
/// <summary> Adds the main view section to the page turner </summary> /// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("HTML_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } // Build the value StringBuilder builder = new StringBuilder(2000); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; // Start the citation table builder.AppendLine("\t\t<!-- HTML VIEWER OUTPUT -->"); builder.AppendLine("\t\t<td align=\"left\"><span class=\"SobekViewerTitle\"><b>" + title + "</b></span></td></tr>"); builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">"); builder.AppendLine("\t\t\t<div class=\"SobekCitation\">"); // Determine the string for the item URL string itemURL = SobekCM_Library_Settings.Image_URL + CurrentItem.Web.File_Root + "/"; // Try to get the HTML for this string map = Get_Html_Page(CurrentItem.Web.Source_URL + "/" + htmlFile, Tracer); string url_options = CurrentMode.URL_Options(); string urlOptions1 = String.Empty; string urlOptions2 = String.Empty; if (url_options.Length > 0) { urlOptions1 = "?" + url_options; urlOptions2 = "&" + url_options; } builder.AppendLine(map.Replace("<%URLOPTS%>", url_options).Replace("<%?URLOPTS%>", urlOptions1).Replace("<%&URLOPTS%>", urlOptions2).Replace("<%ITEMURL%>", itemURL)); builder.AppendLine("\t\t\t</div>"); // Finish the table builder.AppendLine("\t\t</td>"); builder.AppendLine("\t\t<!-- END HTML VIEWER OUTPUT -->"); // Restore the mode CurrentMode.ViewerCode = current_view_code; // Add the HTML for the image Literal mainLiteral = new Literal { Text = builder.ToString() }; placeHolder.Controls.Add(mainLiteral); }
public bool LoadView(string filename) { if (CurrentViewMode == ViewMode.ShowNone) { DebugUtility.LogWarning("Must open a snapshot before loading a view file"); MemoryProfilerAnalytics.AddMetaDatatoEvent <MemoryProfilerAnalytics.LoadViewXMLEvent>(1); return(false); } if (String.IsNullOrEmpty(filename)) { return(false); } using (ScopeDebugContext.Func(() => { return("File '" + filename + "'"); })) { var builder = Database.View.ViewSchema.Builder.LoadFromXMLFile(filename); if (builder == null) { return(false); } BaseMode newMode = CurrentMode.BuildViewSchemaClone(builder); if (newMode == null) { return(false); } switch (CurrentViewMode) { case ViewMode.ShowFirst: FirstMode = newMode; break; case ViewMode.ShowSecond: SecondMode = newMode; break; case ViewMode.ShowDiff: diffMode = newMode as DiffMode; FirstMode = diffMode.modeFirst; SecondMode = diffMode.modeSecond; break; default: break; } history.Clear(); ModeChanged(CurrentMode, CurrentViewMode); } return(true); }
private void RemoveSityMode(object sender, RoutedEventArgs e) { if (currMode != CurrentMode.RemoveSity) { currMode = CurrentMode.RemoveSity; this.Cursor = Cursors.No; } else { currMode = CurrentMode.None; this.Cursor = Cursors.Arrow; } }
public override void KeyPress(Keys key) { if (Game.Player.Character.CurrentVehicle != Vehicle) { return; } if (key == Keys.O) { ToggleModes(); Utils.DisplayHelpText("Time Travel Mode now set to " + CurrentMode.ToString() + " Mode."); } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); Utilities.ValidateUserLogin(); m_SelectedEditControl = Utilities.GetEditorPreference(Request); objCookieObject = Ektron.Cms.CommonApi.GetEcmCookie(); if (objCookieObject != null && !(objCookieObject.Values["editoroptions"] == null)) { m_SelectedEditControl = objCookieObject.Values["editoroptions"].ToLower(); } if (m_SelectedEditControl.ToLower() == "jseditor") { cdContent_teaser.Visible = false; } bool bPermissions = true; m_refContentApi = new Ektron.Cms.ContentAPI(); iNewLang = m_refContentApi.ContentLanguage; if (!String.IsNullOrEmpty(Request.QueryString["dynamicbox"])) { bDynamicBox = Convert.ToBoolean(Request.QueryString["dynamicbox"]); } if (!String.IsNullOrEmpty(Request.QueryString["forum"])) { try { IsForum = Convert.ToBoolean(Convert.ToInt32(Request.QueryString["forum"])); } catch (Exception) { IsForum = false; } } setlabels(); if (!IsForum && m_SelectedEditControl.ToLower() == "jseditor") { AddEkDoPostBack(); } this.dialog_publish.Attributes.Add("onclick", "return publish_handler();"); this.dialog_publish_top.Attributes.Add("onclick", "return publish_handler();"); this.dialog_publish_asset.Attributes.Add("onclick", "return publish_handler();"); if (!String.IsNullOrEmpty(Request.QueryString["mode"])) { if (Request.QueryString["mode"].Trim().ToLower() == "edit") { Mode = CurrentMode.Edit; } else if (Request.QueryString["mode"].Trim().ToLower() == "addlang") { Mode = CurrentMode.Edit; bWithLang = true; if (!String.IsNullOrEmpty(Request.QueryString["Lang"])) iOrigLang = Convert.ToInt32(Request.QueryString["Lang"]); } else { Mode = CurrentMode.Add; } } SetCSS(); if (!String.IsNullOrEmpty(Request.QueryString["mode_id"])) { try { ModeID = Convert.ToInt64(Request.QueryString["mode_id"]); } catch (Exception) { ModeID = 0; } } if (!String.IsNullOrEmpty(Request.QueryString["lang_id"])) { try { LangID = Convert.ToInt32(Request.QueryString["lang_id"]); } catch (Exception) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } } if (!String.IsNullOrEmpty(Request.QueryString["langtype"])) { try { LangID = Convert.ToInt32(Request.QueryString["langtype"]); } catch (Exception) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } } if (LangID == -1 || LangID == 0) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } m_refContentApi.RequestInformationRef.ContentLanguage = LangID; m_refContentApi.ContentLanguage = LangID; if (!Page.IsPostBack) { if (m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator, m_refContentApi.RequestInformationRef.UserId, false)) { TaxonomyRoleExists = true; } switch (Mode) { case CurrentMode.Add: auto_generate_summary.Visible = false; content_id.Value = "0"; security_data = m_refContentApi.LoadPermissions(ModeID, "folder", 0); if (!security_data.CanAdd) { title_label.Text = "You do not have rights to add content in FolderID=" + ModeID; bPermissions = false; } else { Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder(); folder_data = folderApi.GetFolder(ModeID); if (folder_data != null) { if (cssFilesPath == "") //apply stylesheet from folderdata { cssFilesPath = this.m_refContentApi.RequestInformationRef.SitePath + folder_data.StyleSheet; } if (cssFilesPath.Length > 0) { cdContent_teaser.Stylesheet = cssFilesPath; } } cdContent_teaser.FolderId = ModeID; if (!IsForum && m_SelectedEditControl.ToLower() == "jseditor") { InnerEditor.ToolbarLayout = SetToolbar(); ftb_control.Text = InnerEditor.ToString(); ftb_control.Visible = true; cdContent_teaser.Visible = false; } else if (!IsForum) { ftb_control.Visible = false; cdContent_teaser.Visible = true; } SetTaxonomy(0, ModeID); } break; case CurrentMode.Edit: auto_generate_summary.Visible = true; content_id.Value = ModeID.ToString(); if (!String.IsNullOrEmpty(Request.QueryString["mode"]) && Request.QueryString["mode"].Trim().ToLower() == "addlang") { long folderid = 0; if (!String.IsNullOrEmpty(Request.QueryString["folder"])) { long.TryParse(Request.QueryString["folder"], out folderid); } security_data = m_refContentApi.LoadPermissions(folderid, "folder", 0); if (!security_data.CanAdd) { title_label.Text = "You do not have rights to add language content block ID=" + ModeID; bPermissions = false; } } else { security_data = m_refContentApi.LoadPermissions(ModeID, "content", 0); if (!security_data.CanEdit && !IsForum) { title_label.Text = "You do not have rights to edit content block ID=" + ModeID; bPermissions = false; } else { Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder(); folder_data = folderApi.GetFolder(ModeID); if (folder_data != null) { if (cssFilesPath == "") //apply stylesheet from folderdata { cssFilesPath = this.m_refContentApi.RequestInformationRef.SitePath + folder_data.StyleSheet; } if (cssFilesPath.Length > 0) { cdContent_teaser.Stylesheet = cssFilesPath; } } } } if (bPermissions) { if (Request.QueryString["ctlupdateid"] != "") { commparams = (string)("&ctlupdateid=" + Request.QueryString["ctlupdateid"] + "&ctlmarkup=" + Request.QueryString["ctlmarkup"] + "&cltid=" + Request.QueryString["cltid"] + "&ctltype=" + Request.QueryString["ctltype"]); updateFieldId = Request.QueryString["ctlupdateid"]; Page.ClientScript.RegisterHiddenField("ctlupdateid", updateFieldId); } if (Request.QueryString["ctlmarkup"] != "") { Page.ClientScript.RegisterHiddenField("ctlmarkup", Request.QueryString["ctlmarkup"]); } if (Request.QueryString["ctltype"] != "") { Page.ClientScript.RegisterHiddenField("ctltype", Request.QueryString["ctltype"]); } if (Request.QueryString["cltid"] != "") { Page.ClientScript.RegisterHiddenField("cltid", Request.QueryString["cltid"]); } SetContentBlock(); } break; } if (!bPermissions) { ftb_control.Visible = false; title_value.Visible = false; dialog_publish.Visible = false; dialog_publish_top.Visible = false; dialog_publish_asset.Visible = false; cdContent_teaser.Visible = false; return; } ltr_js.Text = this.EditorJS(); if (m_SelectedEditControl.ToLower() != "jseditor") { ftb_control.Visible = false; //set the equavalent SetToolbar() to contentdesigner if (cdContent_teaser != null) { string ToolsOption = ""; if (security_data.CanAdd) { ToolsOption = "Wiki=1"; } bool bLibraryAllowed = false; if (security_data.IsReadOnlyLib) { bLibraryAllowed = true; } ToolsOption = ToolsOption + ("&LibraryAllowed=" + bLibraryAllowed.ToString()); bool bCanModifyImg = false; if (security_data.CanAddToImageLib) { bCanModifyImg = true; } ToolsOption = ToolsOption + ("&CanModifyImg=" + bCanModifyImg.ToString()); if (ToolsOption.Length > 0) { ToolsOption = (string)("?" + ToolsOption); } cdContent_teaser.SetPermissions(security_data); cdContent_teaser.ToolsFile = this.m_refContentApi.RequestInformationRef.ApplicationPath + "ContentDesigner/configurations/InterfaceBlog.aspx" + ToolsOption; if (!(Request.QueryString["editorVisible"] == null)) { //To avoid the editor's onbeforeunload checks being called cdContent_teaser.Visible = System.Convert.ToBoolean(Request.QueryString["editorVisible"]); } } } } if (dialog_publish.Visible == true) { tr_pub.Visible = true; tr_asset.Visible = false; } else { tr_pub.Visible = false; tr_asset.Visible = true; } string _helpUrl = string.Empty; if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ek_helpDomainPrefix"])) { string helpDomain = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; Uri _uri = new Uri(helpDomain); if (_uri != null && !_uri.IsFile) { if ((helpDomain.IndexOf("[ek_cmsversion]") > 1)) { //defect # 64951 - This help file (It had been its own help project in previous releases as well). _helpUrl = " http://documentation.ektron.com/current/memberhelp/wwhelp/wwhimpl/js/html/wwhelp.htm"; } } else { _helpUrl = this.m_refContentApi.RequestInformationRef.ApplicationPath + "/helpmessage.aspx?error=isfile"; } } else { _helpUrl = this.m_refContentApi.RequestInformationRef.ApplicationPath + "/help/memberhelp/index.html"; } help_button.Text = "<a href=\"#\"><img id=\"DeskTopHelp\" title=\"" + this.m_refMsg.GetMessage("alt help button text") + "\" border=\"0\" src=\"" + this.m_refContentApi.RequestInformationRef.ApplicationPath + "/images/application/menu/help.gif\" onclick=\"javascript:PopUpWindow(\'" + _helpUrl + "\', \'SitePreview\', 600, 500, 1, 1);return false;\"></a>"; if (IsForum) { SetForumMode(); } }
protected void click_handler() { string strContent = ""; string strSearchText = ""; string strContentTeaser = ""; bool bUpdateField = false; //If (Request.QueryString("TaxonomyId") IsNot Nothing AndAlso Request.QueryString("TaxonomyId") <> "") Then // TaxonomyOverrideId = Convert.ToInt32(Request.QueryString("TaxonomyId")) //End If if ((Request.QueryString["SelTaxonomyId"] != null) && Request.QueryString["SelTaxonomyId"] != "") { TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]); } switch (Mode) { case CurrentMode.Add: try { if (m_SelectedEditControl.ToLower() == "jseditor") { strContent = Page.Server.HtmlDecode((string)(Request.Form["EkInnerEditor"].ToString())); } else { strContent = (string)cdContent_teaser.Content; } strContent = Utilities.WikiQLink(strContent, ModeID); strContentTeaser = Utilities.AutoSummary(strContent); if (strContentTeaser != "") { strContentTeaser = "<p>" + strContentTeaser + "</p>"; } Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder(); folder_data = folderApi.GetFolder(ModeID); if (folder_data != null) { ModeID = m_refContentApi.AddContent((string)this.title_value.Text, "", strContent, "", strContentTeaser, m_refContentApi.RequestInformationRef.ContentLanguage.ToString(), ModeID, "", "", "", 0, folder_data.TemplateId); } else { ModeID = m_refContentApi.AddContent((string)this.title_value.Text, "", strContent, "", strContentTeaser, m_refContentApi.RequestInformationRef.ContentLanguage.ToString(), ModeID, "", "", ""); } if (TaxonomyOverrideId > 0) { TaxonomyTreeIdList = TaxonomyOverrideId.ToString(); } if ((Request.Form[taxonomyselectedtree.UniqueID] != null) && Request.Form[taxonomyselectedtree.UniqueID] != "") { TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID]; if (TaxonomyTreeIdList.Trim().EndsWith(",")) { TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1); } } TaxonomyContentRequest cotnent_request = new TaxonomyContentRequest(); cotnent_request.ContentId = ModeID; cotnent_request.TaxonomyList = TaxonomyTreeIdList; m_refContentApi.AddTaxonomyItem(cotnent_request); Mode = CurrentMode.Edit; ftb_control.Visible = false; cdContent_teaser.Visible = false; this.title_value.Visible = false; this.title_label.Text = ""; this.change_notification.Text = "Content Added"; this.change_notification.ToolTip = this.change_notification.Text; if (this.TaxonomySelectId > 0) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__EkReloadTop", "RefreshPage(\'" + TaxonomySelectId.ToString() + "\', " + bDynamicBox.ToString().ToLower() + ");self.close()", true); } else if (this.TaxonomyOverrideId > 0) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__EkReloadTop", "RefreshPage(\'" + TaxonomyOverrideId.ToString() + "\', " + bDynamicBox.ToString().ToLower() + ");self.close()", true); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__EkReloadTop", "RefreshPage(\'\', " + bDynamicBox.ToString().ToLower() + ");self.close()", true); } } catch (Exception ex) { ftb_control.Visible = false; title_value.Visible = false; cdContent_teaser.Visible = false; if (ex.Message.IndexOf("Invalid License") == 0) { title_label.Text = ex.Message.ToString(); } else { title_label.Text = "You do not have rights to add content in FolderID=" + ModeID; } } break; case CurrentMode.Edit: if (bWithLang == true) { Ektron.Cms.Content.EkContent brContent; Collection page_content_data = new Collection(); m_refContentApi.ContentLanguage = iOrigLang; brContent = m_refContentApi.EkContentRef; page_content_data = brContent.GetContentByIDv2_0(ModeID); m_refContentApi.ContentLanguage = iNewLang; brContent = m_refContentApi.EkContentRef; if (m_SelectedEditControl.ToLower() == "jseditor") { strContent = Page.Server.HtmlDecode((string)(Page.Request.Form["EkInnerEditor"].ToString())); } else { strContent = (string)cdContent_teaser.Content; } strSearchText = Utilities.StripHTML(strContent); page_content_data.Remove("ContentHtml"); strContent = Utilities.WikiQLink(strContent, Convert.ToInt64(page_content_data["FolderID"])); page_content_data.Add(strContent, "ContentHtml", null, null); page_content_data.Remove("ContentLanguage"); page_content_data.Add(iNewLang, "ContentLanguage", null, null); if (page_content_data.Contains("ContentTeaser") && (page_content_data["ContentTeaser"].ToString() == "")) { strContentTeaser = Utilities.AutoSummary(strContent); if (strContentTeaser != "") { strContentTeaser = "<p>" + strContentTeaser + "</p>"; } page_content_data.Remove("ContentTeaser"); page_content_data.Add(strContentTeaser, "ContentTeaser", null, null); } else { if (auto_generate_summary.Checked == true) { // strContentTeaser = Utilities.WikiQLink(strContent, ModeID) strContentTeaser = Utilities.AutoSummary(strContent); if (strContentTeaser != "") { strContentTeaser = "<p>" + strContentTeaser + "</p>"; } page_content_data.Remove("ContentTeaser"); page_content_data.Add(strContentTeaser, "ContentTeaser", null, null); } } if (page_content_data.Contains("SearchText")) { page_content_data.Remove("SearchText"); } page_content_data.Add(strSearchText, "SearchText", null, null); if (page_content_data.Contains("ContentTitle")) { page_content_data.Remove("ContentTitle"); } page_content_data.Add(title_value.Text, "ContentTitle", null, null); if (page_content_data.Contains("IsSearchable")) { page_content_data.Remove("IsSearchable"); } page_content_data.Add(false, "IsSearchable", null, null); page_content_data.Add(true, "AddToQlink", null, null); if (page_content_data.Contains("Taxonomy")) { page_content_data.Remove("Taxonomy"); } if (TaxonomyOverrideId > 0) { TaxonomyTreeIdList = TaxonomyOverrideId.ToString(); } if ((Request.Form[taxonomyselectedtree.UniqueID] != null) && Request.Form[taxonomyselectedtree.UniqueID] != "") { TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID]; if (TaxonomyTreeIdList.Trim().EndsWith(",")) { TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1); } } page_content_data.Add(TaxonomyTreeIdList, "Taxonomy", null, null); ModeID = brContent.AddNewContentv2_0(page_content_data); brContent.SaveContentv2_0(page_content_data); brContent.CheckIn(ModeID, ""); brContent.SubmitForPublicationv2_0(ModeID, Convert.ToInt64(page_content_data["FolderID"]), ""); Mode = CurrentMode.Edit; ftb_control.Visible = false; cdContent_teaser.Visible = false; this.title_value.Visible = false; this.title_label.Text = ""; this.change_notification.Text = "Content Added"; this.change_notification.ToolTip = this.change_notification.Text; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__EkReloadTop", "top.opener.location.reload();self.close()", true); } else { ContentData cData = m_refContentApi.GetContentById(ModeID, ContentAPI.ContentResultType.Published); Collection page_content_data; bool bError = false; if ((cData != null) && (cData.Status != "O")) { try { m_refContentApi.CheckOutContentById(ModeID); ContentEditData data = m_refContentApi.GetContentForEditing(ModeID); if (m_SelectedEditControl.ToLower() == "jseditor") { data.Html = Page.Server.HtmlDecode((string)(Page.Request.Form["EkInnerEditor"].ToString())); } else { data.Html = (string)cdContent_teaser.Content; } data.Html = Utilities.WikiQLink(data.Html, data.FolderId); data.Title = (string)title_value.Text; if (data.Teaser == "" || data.Teaser.ToLower() == "<br /><!-- wiki summary -->") { //data.Teaser = Utilities.WikiQLink(data.Html, ModeID) data.Teaser = Utilities.AutoSummary(data.Html); if (data.Teaser != "") { data.Teaser = "<p>" + data.Teaser + "</p>"; } } else { if (auto_generate_summary.Checked == true) { //data.Teaser = Utilities.WikiQLink(data.Html, ModeID) data.Teaser = Utilities.AutoSummary(data.Html); if (data.Teaser != "") { data.Teaser = "<p>" + data.Teaser + "</p>"; } } } page_content_data = StepConvert(data, cData); if (TaxonomyOverrideId > 0) { TaxonomyTreeIdList = TaxonomyOverrideId.ToString(); } if ((Request.Form[taxonomyselectedtree.UniqueID] != null) && Request.Form[taxonomyselectedtree.UniqueID] != "") { TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID]; if (TaxonomyTreeIdList.Trim().EndsWith(",")) { TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1); } } page_content_data.Add(TaxonomyTreeIdList, "Taxonomy", null, null); // m_refContentApi.SaveContent(data) m_refContentApi.EkContentRef.SaveContentv2_0(page_content_data); m_refContentApi.PublishContentById(ModeID, data.FolderId, data.LanguageId, "", m_refContentApi.UserId, ""); string markupPath = ""; string updateContent = ""; markupPath = Request.Form["ctlmarkup"]; if ((markupPath != null) && markupPath.Length > 0) { markupPath = Request.PhysicalApplicationPath + markupPath; } object ekml = null; if ((markupPath != null) && (HttpContext.Current.Cache[markupPath] != null)) { ekml = HttpContext.Current.Cache[markupPath]; ContentBase results = m_refContentApi.EkContentRef.LoadContent(ModeID, false); updateContent = this.m_refContentApi.FormatOutput((string)ekml.GetType().GetProperty("ContentFormat").GetValue(ekml, null), Request.Form["ctltype"], results); updateContent = this.m_refContentApi.WrapAjaxToolBar(updateContent, results, commparams); } else { updateContent = data.Html; } if ((Request.Form["ctlupdateid"] != null) && Request.Form["ctlupdateid"] != "") { Page.ClientScript.RegisterHiddenField("updatefieldcontent", updateContent); StringBuilder strJs = new StringBuilder(); strJs.Append("<script language=\"JavaScript1.2\" type=\"text/javascript\"> ").Append("\r\n"); strJs.Append(" if (top.opener != null) { ").Append("\r\n"); strJs.Append(" var objUpdateField = top.opener.document.getElementById(\'" + Request.Form["ctlupdateid"] + "\');").Append("\r\n"); strJs.Append(" if (objUpdateField != null) { objUpdateField.innerHTML = document.getElementById(\"updatefieldcontent\").value; }").Append("\r\n"); strJs.Append(" }").Append("\r\n"); strJs.Append("self.close();").Append("\r\n"); strJs.Append("</script>").Append("\r\n"); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "objUpdateField", strJs.ToString(), false); bUpdateField = true; } this.change_notification.Text = "Changes Published"; this.change_notification.ToolTip = this.change_notification.Text; } catch { this.change_notification.Text = "Another user is editing this content - Your changes could not be saved."; this.change_notification.ToolTip = this.change_notification.Text; bError = true; } } else { this.change_notification.Text = "Content is checked out - no changes made."; this.change_notification.ToolTip = this.change_notification.Text; } if (!bUpdateField) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__EkReloadTop", (string)((bError ? "alert(\'" + this.change_notification.Text + "\');" : "") + "RefreshPage(\'\', " + bDynamicBox.ToString().ToLower() + ");self.close()"), true); } SetContentBlock(); } break; } }