Exemplo n.º 1
0
		/// <summary>
		/// Gets a script option defining the Position options (this is exposed as the Position control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Position object</returns>
		protected Core.ScriptOption GetPositionScriptOption(bool asChild) {
			Core.ScriptOption posParent = new Core.ScriptOption() { 
				Key = "position",
				IsChild = asChild
			};
			Core.ScriptOptions posOptions = posParent.ChildOptions;
			string myPositions = Core.Position.PositionsToString(this.My);
			string atPositions = Core.Position.PositionsToString(this.At);
			string offsets = "";
			string collisions = Core.Collision.CollisionsToString(this.Collision);

			posOptions.Add(!string.IsNullOrEmpty(myPositions), "my", myPositions.InDoubleQuotes());
			posOptions.Add(!string.IsNullOrEmpty(atPositions), "at", atPositions.InDoubleQuotes());
			if (this.IsSelector(this.Of)) 
				posOptions.Add("of", this.Of.InDoubleQuotes());
			else 
				posOptions.Add(!this.IsNullOrEmpty(this.Of), "of", this.Of);
			if (this.Offset.Count > 0) {
				if (this.Offset[0] != 0) offsets += this.Offset[0];
				if (this.Offset.Count > 1 && this.Offset[1] != 0)
					offsets += " " + this.Offset[1];
				offsets = offsets.Trim();
				posOptions.Add(!string.IsNullOrEmpty(offsets), "offset", offsets.InDoubleQuotes());
			}
			posOptions.Add(!string.IsNullOrEmpty(collisions), "collision", collisions.InDoubleQuotes());
			posOptions.Add(!this.IsNullOrEmpty(this.UsingFunction), "using", this.UsingFunction);

			// Any of the above actually going to render?
			posParent.Condition = posOptions.Where(x=>x.Condition).Any();
			return posParent;
		}
Exemplo n.º 2
0
		/// <summary>
		/// Gets a script option defining the Animation options (this is exposed as the Animation control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Animation object</returns>
		protected Core.ScriptOption GetAnimationScriptOption(bool asChild) {
			Core.ScriptOption parentOpts = new Core.ScriptOption() { 
				Key = this.Caller,
				IsChild = asChild
			};
			Core.ScriptOptions childOpts = parentOpts.ChildOptions;

			if (this.Disable) {
				parentOpts.Value = "false";
				parentOpts.Condition = true;
				return parentOpts;
			}
			
			if (!string.IsNullOrEmpty(this.JSON)) {
				// JSON supercedes any other settings
				childOpts.Add(this.Caller, this.JSON);
			} else {
				string durationString = (this.IsNumeric(this.Duration) ? this.Duration.ToString() : this.Duration.InDoubleQuotes());

				childOpts.Add(!this.IsNullOrEmpty(this.Effect), "effect", this.Effect.InDoubleQuotes());
				childOpts.Add(!this.IsNullOrEmpty(this.Easing), "easing", this.Easing.InDoubleQuotes());
				childOpts.Add(!this.IsNullEmptyOrDefault(this.Duration, DEFAULT_DURATION), "duration", durationString);				
			}
		
			// Any of the above actually going to render?
			parentOpts.Condition = childOpts.Where(x=>x.Condition).Any();
			return parentOpts;
		}
Exemplo n.º 3
0
		/// <summary>
		/// Gets a script option defining the Position options (this is exposed as the Position control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Position object</returns>
		protected Core.ScriptOption GetPositionScriptOption(bool asChild) {
			Core.ScriptOption posParent = new Core.ScriptOption() { 
				Key = "position",
				IsChild = asChild
			};
			Core.ScriptOptions posOptions = posParent.ChildOptions;
			string collisions = Core.Collision.CollisionsToString(this.Collision);

			posOptions.Add(!this.IsNullEmptyOrDefault(this.My, this.MyDefault), "my", this.My.ToLower().InDoubleQuotes());
			posOptions.Add(!this.IsNullEmptyOrDefault(this.At, this.AtDefault), "at", this.At.ToLower().InDoubleQuotes());
			if (this.IsSelector(this.Of)) 
				posOptions.Add(!this.IsNullEmptyOrDefault(this.Of, this.OfDefault), "of", this.Of.InDoubleQuotes());
			else 
				posOptions.Add(!this.IsNullEmptyOrDefault(this.Of, this.OfDefault), "of", this.Of);
			if (this.IsSelector(this.Within))
				posOptions.Add(!this.IsNullEmptyOrDefault(this.Within, this.WithinDefault), "within", this.Within.InDoubleQuotes());
			else 
				posOptions.Add(!this.IsNullEmptyOrDefault(this.Within, this.WithinDefault), "within", this.Within);
			posOptions.Add(!this.IsNullEmptyOrDefault(collisions, this.CollisionDefault), "collision", collisions.InDoubleQuotes());
			posOptions.Add(!this.IsNullEmptyOrDefault(this.UsingFunction, this.UsingFunctionDefault), "using", this.UsingFunction);

			// Any of the above actually going to render?
			posParent.Condition = posOptions.Where(x=>x.Condition).Any();
			return posParent;
		}
Exemplo n.º 4
0
		/// <summary>
		/// Gets a script option defining the Ajax options (this is exposed as the Ajax control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Ajax object</returns>
		protected Core.ScriptOption GetAjaxScriptOption(bool asChild) {
			Core.ScriptOption parentOpts = new Core.ScriptOption() { 
				Key = "ajax",
				IsChild = asChild
			};
			Core.ScriptOptions childOpts = parentOpts.ChildOptions;

			
			// Any of the above actually going to render?
			parentOpts.Condition = childOpts.Where(x=>x.Condition).Any();
			return parentOpts;
		}
Exemplo n.º 5
0
		/// <summary>
		/// Gets a script option defining the Cookie options (this is exposed as the Cookie control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Cookie object</returns>
		protected Core.ScriptOption GetCookieScriptOption(bool asChild) {
			Core.ScriptOption parentOpts = new Core.ScriptOption() { 
				Key = "cookie",
				IsChild = asChild
			};
			Core.ScriptOptions childOpts = parentOpts.ChildOptions;
			
			childOpts.Add(this.Expires != DEFAULT_EXPIRY, "expires", this.Expires.ToString());
			childOpts.Add(!this.IsNullOrEmpty(this.Path), "path", this.Path.InSingleQuotes());
			childOpts.Add(!this.IsNullOrEmpty(this.Domain), "domain", this.Domain.InSingleQuotes());
			childOpts.Add(this.Secure, "secure", this.Secure.JsBool());
			
			// Any of the above actually going to render?
			parentOpts.Condition = childOpts.Where(x=>x.Condition).Any();
			return parentOpts;
		}
Exemplo n.º 6
0
		/// <summary>
		/// Gets a script option defining the Animation options (this is exposed as the Animation control
		/// is used in other controls).
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Animation object</returns>
		protected Core.ScriptOption GetAnimationScriptOption(bool asChild) {
			Core.ScriptOption parentOpts = new Core.ScriptOption() { 
				Key = this.Caller,
				IsChild = asChild
			};
			Core.ScriptOptions childOpts = parentOpts.ChildOptions;
			
			string durationString = (this.IsNumeric(this.Duration) ? this.Duration.ToString() : this.Duration.InDoubleQuotes());

			childOpts.Add(!this.IsNullOrEmpty(this.Effect), "effect", this.Effect.InDoubleQuotes());
			childOpts.Add(!this.IsNullOrEmpty(this.Easing), "easing", this.Easing.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.Duration, DEFAULT_DURATION), "duration", durationString);				

			// Any of the above actually going to render?
			parentOpts.Condition = childOpts.Where(x=>x.Condition).Any();
			return parentOpts;
		}
Exemplo n.º 7
0
		/// <summary>
		/// Gets a script option defining the DatePicker options.
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the DatePicker object</returns>
		protected internal Core.ScriptOption GetDatePickerScriptOption(bool asChild) {
			Core.ScriptOption parentOpts = new Core.ScriptOption() {
				Key = "datePicker",
				IsChild = asChild
			};
			Core.ScriptOptions childOpts = parentOpts.ChildOptions;

			childOpts.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			childOpts.Add(!this.IsNullOrEmpty(this.AltField), "altField", this.AltField.InDoubleQuotes());
			childOpts.Add(!this.IsNullOrEmpty(this.AltFormat), "altFormat", this.AltFormat.InDoubleQuotes());
			childOpts.Add(!this.IsNullOrEmpty(this.AppendText), "appendText", this.AppendText.InDoubleQuotes());
			childOpts.Add(this.AutoSize, "autoSize", this.AutoSize.JsBool());
			childOpts.Add(!this.IsNullOrEmpty(this.ButtonImage), "buttonImage", this.ButtonImage.InDoubleQuotes());
			childOpts.Add(this.ButtonImageOnly, "buttonImageOnly", this.ButtonImageOnly.JsBool());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.ButtonText, DEFAULT_BUTTON_TEXT), "buttonText", this.ButtonText.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.CalculateWeek, DEFAULT_CALCULATE_WEEK), "calculateWeek", this.CalculateWeek);
			childOpts.Add(this.ChangeMonth, "changeMonth", this.ChangeMonth.JsBool());
			childOpts.Add(this.ChangeYear, "changeYear", this.ChangeYear.JsBool());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.CloseText, DEFAULT_CLOSE_TEXT), "closeText", this.CloseText.InDoubleQuotes());
			childOpts.Add(!this.ConstrainInput, "constrainInput", this.ConstrainInput.JsBool());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.CurrentText, DEFAULT_CURRENT_TEXT), "currentText", this.CurrentText.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.DateFormat, DEFAULT_DATE_FORMAT), "dateFormat", this.DateFormat.InDoubleQuotes());
			if (!this.IsNullOrEmpty(this.DayNames))
				childOpts.Add("dayNames", this.DayNames);
			else
				childOpts.Add(!this.IsNullEmptyOrDefault(this.DayNamesList, DEFAULT_DAY_NAMES), "dayNames", this.DayNamesList.JsArray(false/*singleQuotes*/));
			if (!this.IsNullOrEmpty(this.DayNamesMin))
				childOpts.Add("dayNamesMin", this.DayNamesMin);
			else
				childOpts.Add(!this.IsNullEmptyOrDefault(this.DayNamesMinList, DEFAULT_DAY_NAMES_MIN), "dayNamesMin", this.DayNamesMinList.JsArray(false/*singleQuotes*/));
			if (!this.IsNullOrEmpty(this.DayNamesShort))
				childOpts.Add("dayNamesShort", this.DayNamesShort);
			else
				childOpts.Add(!this.IsNullEmptyOrDefault(this.DayNamesShortList, DEFAULT_DAY_NAMES_SHORT), "dayNamesShort", this.DayNamesShortList.JsArray(false/*singleQuotes*/));
			
			if (this.DefaultDate.HasValue)
				childOpts.AddDate("defaultDate", this.DefaultDate);
			else
				childOpts.AddDate("defaultDate", this.DefaultDateString);

			if (IsNumeric(this.Duration))
				childOpts.Add(!this.IsNullEmptyOrDefault(this.Duration, DEFAULT_DURATION), "duration", this.Duration);
			else 
				childOpts.Add(!this.IsNullEmptyOrDefault(this.Duration, DEFAULT_DURATION), "duration", this.Duration.InDoubleQuotes());
			childOpts.Add(this.FirstDay != DEFAULT_FIRST_DAY, "firstDay", this.FirstDay.ToString());
			childOpts.Add(this.GotoCurrent, "gotoCurrent", this.GotoCurrent.JsBool());
			childOpts.Add(this.HideIfNoPrevNext, "hideIfNoPrevNext", this.HideIfNoPrevNext.JsBool());
			childOpts.Add(this.IsRTL, "isRTL", this.IsRTL.JsBool());
			if (this.MinDate.HasValue)
				childOpts.AddDate("minDate", this.MinDate);
			else 
				childOpts.AddDate("minDate", this.MinDateString);
			if (this.MaxDate.HasValue)
				childOpts.AddDate("maxDate", this.MaxDate);
			else 
				childOpts.AddDate("maxDate", this.MaxDateString);
			if (!this.IsNullOrEmpty(this.MonthNames))
				childOpts.Add("monthNames", this.MonthNames);
			else 
				childOpts.Add(!this.IsNullEmptyOrDefault(this.MonthNamesList, DEFAULT_MONTH_NAMES), "monthNames", this.MonthNamesList.JsArray(false/*singleQuotes*/));
			if (!this.IsNullOrEmpty(this.MonthNamesShort))
				childOpts.Add("monthNamesShort", this.MonthNamesShort);
			else 
				childOpts.Add(!this.IsNullEmptyOrDefault(this.MonthNamesShortList, DEFAULT_MONTH_NAMES_SHORT), "monthNamesShort", this.MonthNamesShortList.JsArray(false/*singleQuotes*/));
			childOpts.Add(this.NavigationAsDateFormat, "navigationAsDateFormat", this.NavigationAsDateFormat.JsBool());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.NextText, DEFAULT_NEXT_TEXT), "nextText", this.NextText.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.PrevText, DEFAULT_PREV_TEXT), "prevText", this.PrevText.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.NumberOfMonths, DEFAULT_NUMBER_OF_MONTHS.ToString()), "numberOfMonths", this.NumberOfMonths.ToString());
			childOpts.Add(this.SelectOtherMonths, "selectOtherMonths", this.SelectOtherMonths.JsBool());
			if (IsRelativeDateSpec(this.ShortYearCutoff))
				childOpts.Add(!this.IsNullEmptyOrDefault(this.ShortYearCutoff, DEFAULT_SHORT_YEAR_CUTOFF), "shortYearCutoff", this.ShortYearCutoff.InDoubleQuotes());
			else 
				childOpts.Add(!this.IsNullEmptyOrDefault(this.ShortYearCutoff, DEFAULT_SHORT_YEAR_CUTOFF), "shortYearCutoff", this.ShortYearCutoff);
			childOpts.Add(!this.IsNullEmptyOrDefault(this.ShowAnim, DEFAULT_SHOW_ANIM), "showAnim", this.ShowAnim.InDoubleQuotes());
			childOpts.Add(this.ShowButtonPanel, "showButtonPanel", this.ShowButtonPanel.JsBool());
			childOpts.Add(this.ShowCurrentAtPos != DEFAULT_SHOW_CURRENT_AT_POS, "showCurrentAtPos", this.ShowCurrentAtPos.ToString());
			childOpts.Add(this.ShowMonthAfterYear, "showMonthAfterYear", this.ShowMonthAfterYear.JsBool());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.ShowOn, DEFAULT_SHOW_ON), "showOn", this.ShowOn.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.ShowOptions, DEFAULT_SHOW_OPTIONS), "showOptions", this.ShowOptions);
			childOpts.Add(this.ShowOtherMonths, "showOtherMonths", this.ShowOtherMonths.JsBool());
			childOpts.Add(this.ShowWeek, "showWeek", this.ShowWeek.JsBool());
			childOpts.Add(this.StepMonths != DEFAULT_STEP_MONTHS, "stepMonths", this.StepMonths.ToString());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.WeekHeader, DEFAULT_WEEK_HEADER), "weekHeader", this.WeekHeader.InDoubleQuotes());
			childOpts.Add(!this.IsNullEmptyOrDefault(this.YearRange, DEFAULT_YEAR_RANGE), "yearRange", this.YearRange.InDoubleQuotes());
			childOpts.Add(!this.IsNullOrEmpty(this.YearSuffix), "yearSuffix", this.YearSuffix.InDoubleQuotes());

			// Any of the above actually going to render?
			parentOpts.Condition = childOpts.Where(x=>x.Condition).Any();
			return parentOpts;
		}
Exemplo n.º 8
0
		/// <summary>
		/// Gets a script option defining the Button options to use for the Dialog control.
		/// </summary>
		/// <param name="asChild">Flags that this option should be added a child</param>
		/// <returns>Script option for the Buttons</returns>
		protected internal Core.ScriptOption GetButtonsScriptOption(bool asChild) {
			Core.ScriptOption scriptParent = new Core.ScriptOption() {
				Key = "buttons",
				IsChild = asChild, Condition = true
			};
			Core.ScriptOptions scriptOptions = scriptParent.ChildOptions;
			 
			foreach (Button btn in this.Buttons) {
				string label = string.Format("\"{0}\"", btn.Label);

				scriptOptions.AddEventHandler(label, ""/*no params for event*/, btn.ClickEvent);
			}

			return scriptParent;
		}