Inheritance: IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor, IUrlResolutionService, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor
        public static jquerybasic FindjQuery(Control control)
        {
            jquerybasic jquerybasic1 = null;

            if (control is Page) {
                Page thePage = (Page)control;
                foreach (Control c in thePage.Header.Controls) {
                    if (c is jquerybasic) {
                        jquerybasic1 = (jquerybasic)c;
                        break;
                    } else {
                        jquerybasic1 = FindjQuery(c);
                        if (jquerybasic1 != null) {
                            break;
                        }
                    }
                }
            } else {
                foreach (Control c in control.Controls) {
                    if (c is jquerybasic) {
                        jquerybasic1 = (jquerybasic)c;
                        break;
                    } else {
                        jquerybasic1 = FindjQuery(c);
                        if (jquerybasic1 != null) {
                            break;
                        }
                    }
                }
            }

            return jquerybasic1;
        }
Example #2
0
 public GridViewTemplate(DataControlRowType type, string colNameFr, string colNameDt, Control con)
 {
     templateType = type;
     columnNameFriendly = colNameFr;
     columnNameData = colNameDt;
     control = con;
 }
Example #3
0
        private static void BuildFromDirectory(string baseDir, Control level)
        {
            foreach (string idxDir in Directory.GetDirectories(baseDir))
            {
                string dir = idxDir.Replace(baseDir, "");

                // Skipping .svn and similar directories...
                if (dir.IndexOf(".") == 0)
                {
                    continue;
                }
                TreeNode n = new TreeNode {ID = level.ID + dir, Xtra = idxDir, Text = dir};
                level.Controls.Add(n);
                string[] childDirectories = Directory.GetDirectories(idxDir);
                if (childDirectories.Length > 0)
                {
                    // Skipping .svn and similar directories...
                    if (childDirectories.Length == 1)
                    {
                        string tmpDir = childDirectories[0];
                        tmpDir = tmpDir.Substring(tmpDir.LastIndexOf("\\") + 1);
                        if (tmpDir.IndexOf(".") == 0)
                        {
                            continue;
                        }
                    }
                    TreeNodes children = new TreeNodes {ID = "ch" + n.ID};
                    n.Controls.Add(children);
                    BuildFromDirectory(idxDir + "\\", children);
                }
            }
        }
		public override Control AddTo(Control container, PluginContext context)
		{
			var requiredPermission = context.Selected.State == ContentState.Published ? Permission.Publish : Permission.Write;
			if (!context.Engine.SecurityManager.IsAuthorized(context.HttpContext.User, context.Selected, requiredPermission))
				return null;

			if(!ActiveFor(container, context.State)) return null;
			
			if (!context.Selected.VersionOf.HasValue) 
				return base.AddTo(container, context);

			HyperLink hl = new HyperLink();
			hl.Text = GetInnerHtml(context, "{IconsUrl}/cross_orange.png", ToolTip, Title);
			hl.NavigateUrl = Url.Parse("{ManagementUrl}/Content/DiscardPreview.aspx").ResolveTokens()
				.AppendQuery("selectedUrl", context.Selected.Url)
				.AppendQuery(PathData.ItemQueryKey, context.Selected.VersionOf.ID)
				.AppendQuery(PathData.VersionIndexQueryKey, context.Selected.VersionIndex);
			hl.CssClass = "cancel";
			hl.Attributes["onclick"] = "return confirm('Are you certain?');";

			hl.ToolTip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? context.Format("Delete this version", false);

			container.Controls.Add(hl);

			return hl;
		}
 public MailMessage CreateMailMessage(string recipients, IDictionary replacements, Control owner)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("owner");
     }
     string body = string.Empty;
     string bodyFileName = this.BodyFileName;
     if (!string.IsNullOrEmpty(bodyFileName))
     {
         string path = bodyFileName;
         if (!UrlPath.IsAbsolutePhysicalPath(path))
         {
             path = UrlPath.Combine(owner.AppRelativeTemplateSourceDirectory, path);
         }
         TextReader reader = new StreamReader(owner.OpenFile(path));
         try
         {
             body = reader.ReadToEnd();
         }
         finally
         {
             reader.Close();
         }
     }
     return this.CreateMailMessage(recipients, replacements, body, owner);
 }
		public override Control AddTo(Control container, PluginContext context)
		{
			HtmlGenericControl hgc = new HtmlGenericControl("div");
			hgc.Attributes["class"] = "separator";
			container.Controls.Add(hgc);
			return hgc;
		}
        /// <summary>
        /// Reads new values entered by the user for the field
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues"></param>
        /// <returns></returns>
        public override string GetEditValue( Control control, Dictionary<string, ConfigurationValue> configurationValues )
        {
            if ( control != null && control is ListControl )
                return ( (ListControl)control ).SelectedValue;

            return null;
        }
Example #8
0
        public void addProperty(string Caption, Control C) {
            /*
            tr = new TableRow();
            td = new TableCell();
            td.Text = Caption;
            td.Attributes.Add("width", "15%");
            td.Attributes.Add("valign", "top");
            td.Attributes.Add("class", "propertyHeader");
            tr.Cells.Add(td);
                        
            td = new TableCell();
            td.Attributes.Add("class", "propertyContent");
            td.Controls.Add(C);
            tr.Cells.Add(td);

            tbl.Rows.Add(tr);
            if (!this.Controls.Contains(tbl)) {
                this.Controls.Add(tbl);
            }*/
            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
		public override Control AddTo(ContentItem item, string detailName, Control container)
		{
			Control displayer = (Control)Activator.CreateInstance(ControlType);
			Utility.SetProperty(displayer, ControlPropertyName, item[detailName]);
			container.Controls.Add(displayer);
			return displayer;
		}
		private static void TranslateControlText(Control control)
		{
			IEnumerable<IControlTranslator> translators = GetControlTranslators(control);

			foreach (IControlTranslator translator in translators)
				translator.Translate();
		}
Example #11
0
		internal RegisteredExpandoAttribute (Control control, string controlId, string name, string value, bool encode) {
			_control = control;
			_name = name;
			_value = value;
			_controlId = controlId;
			_encode = encode;
		}
Example #12
0
 private Control GetWebValidateBox(Control ct)
 {
     if (ct is WebValidate)
     {
         return ct;
     }
     else if (ct.HasControls())
     {
         foreach (Control ctchild in ct.Controls)
         {
             if (ctchild is WebValidate)
             {
                 return ctchild;
             }
             else
             {
                 GetWebValidateBox(ctchild);
             }
         }
         return null;
     }
     else
     {
         return null;
     }
 }
Example #13
0
 protected override Control AddEditor(Control container)
 {
     TimeRange range = new TimeRange {ID = Name + NameEndRange, StartTitle = StartTitle, StartRequired = StartRequired};
     container.Controls.Add(range);
     range.BetweenText = BetweenText;
     return range;
 }
        void GetModulePanel(string Panel, string lang)
        {
            ModulesFrontPanelBSO _module = new ModulesFrontPanelBSO();
            DataTable tb = _module.GetModulesFrontPanelbyPanel(Panel, lang);
            string _path = ResolveUrl("~/") + "Client/Modules/MainHome/";
            Control objControl = new Control();


            if (tb.Rows.Count > 0)
            {
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    //if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Left") || tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Right"))
                    //    _path += "Client/Modules/Panel/";
                    //else
                    //    if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Main"))
                    //        _path += "Client/Modules/MainHome/";

                    objControl = (Control)this.LoadControl(_path + tb.Rows[i]["ModulesFrontPanel_Url"].ToString());

                    AreaMainPanel.Controls.Add(objControl);
                    ControlParameter(objControl, tb.Rows[i]["ModulesFrontPanel_Title"].ToString(), tb.Rows[i]["ModulesFrontPanel_Icon"].ToString(), tb.Rows[i]["ModulesFrontPanel_Value"].ToString(), Convert.ToInt32(tb.Rows[i]["ModulesFrontPanel_Record"].ToString()));

                }
            }

        }
		protected override Label AddLabel(Control container)
		{
			if (string.IsNullOrEmpty(Title))
				return null;
			
			return base.AddLabel(container);
		}
        public override Control AddTo(Control container, PluginContext context)
        {
            var selector = context.Engine.Resolve<LanguageGatewaySelector>();
            if (!selector.Enabled || selector.LanguagesPerSite /*avoid showing options that might not be relevant */)
                return null;

            ILanguageGateway gateway = selector.GetAllLanguages();

            HtmlGenericControl div = new HtmlGenericControl("div");
            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "={selected}");

                HyperLink h = new HyperLink();
                h.ID = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass = "templatedurl language";
                h.ToolTip = language.LanguageTitle;
                h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                h.Attributes["data-url-template"] = context.Rebase(url);
                div.Controls.Add(h);
            }

            return div;
        }
Example #17
0
        public static bool ControlWasPostedBack(Page page, Control target)
        {
            bool result = false;

            string ctlName = page.Request.Params.Get("__EVENTTARGET");

            if (ctlName != null && ctlName != string.Empty)
            {
                if (ctlName.Contains(target.ID))
                {
                    result = true;
                }
            }
            else
            {
                foreach (string ctl in page.Request.Form)
                {
                    if (ctl.Contains(target.ID))
                    {
                        result = true;
                        break;
                    }
                }
            }

            return result;
        }
Example #18
0
 protected void AddEditable()
 {
     editable = GetEditable(CurrentItem);
     editor = editable.AddTo(this);
     if (!Page.IsPostBack)
         editable.UpdateEditor(CurrentItem, editor);
 }
Example #19
0
        public void LoadWidgets(IEnumerable<Widget> widgetModels, Control placeholder, TemplateControl page)
        {
            if (placeholder == null)
            {
                return;
            }

            if (page == null)
            {
                return;
            }

            if (widgetModels == null)
            {
                return;
            }

            var groups = widgetModels.OrderBy(x => x.RowNumber).ThenBy(x => x.ColumnNumber).GroupBy(x => new {x.RowNumber});

            foreach (var group in groups)
            {
                foreach (Widget item in group)
                {
                    using (MixERPWidgetBase widget = page.LoadControl(item.WidgetSource) as MixERPWidgetBase)
                    {
                        if (widget != null)
                        {
                            placeholder.Controls.Add(widget);
                            widget.OnControlLoad(widget, new EventArgs());
                        }
                    }
                }
            }
        }
Example #20
0
        protected override void CreateItems(Control container)
        {
            if (State.IsFlagSet(ControlPanelState.DragDrop) && (AllowExternalManipulation || CurrentItem == CurrentPage || Find.ClosestPage(CurrentItem) == CurrentPage))
            {
                if (ZoneName.IndexOfAny(new[] {'.', ',', ' ', '\'', '"', '\t', '\r', '\n'}) >= 0) throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");

                Panel zoneContainer = AddPanel(this, ZoneName + " dropZone");
				if (CurrentItem.ID != 0 && !CurrentItem.VersionOf.HasValue)
				{
					zoneContainer.Attributes["data-id"] = CurrentItem.ID.ToString();
					zoneContainer.Attributes[PartUtilities.PathAttribute] = CurrentItem.Path;
				}
				else
				{
					zoneContainer.Attributes[PartUtilities.PathAttribute] = Find.ClosestPage(CurrentItem).Path;
					zoneContainer.Attributes["data-versionKey"] = CurrentItem.GetVersionKey();
					zoneContainer.Attributes["data-versionIndex"] = CurrentItem.VersionIndex.ToString();
				}
                zoneContainer.Attributes[PartUtilities.ZoneAttribute] = ZoneName;
                zoneContainer.Attributes[PartUtilities.AllowedAttribute] = PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Page.User));
                
                zoneContainer.ToolTip = GetToolTip(GetDefinition(CurrentItem), ZoneName);
                base.CreateItems(zoneContainer);
            }
            else
            {
                base.CreateItems(this);
            }
        }
Example #21
0
			public void InstantiateIn(Control container)
			{
				Literal l = new Literal();
				l.Text = "<div>";
				l.DataBinding += new EventHandler(this.BindData);
				container.Controls.Add(l);
			}
		public override bool UpdateItem(ContentItem item, Control editor)
		{
			TextBox tb = (TextBox)editor;
			string[] rows = tb.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
			for (int i = item.Children.Count - 1; i >= 0; --i)
			{
				int index = Array.FindIndex(rows, delegate(string row)
													  {
														  return row == item.Children[i].Title;
													  }
					);
				if (index < 0)
					Context.Persister.Delete(item.Children[i]);
			}
			for (int i = 0; i < rows.Length; i++)
			{
				ContentItem child = FindChild(item, rows[i]);
				if (child == null)
				{
					child = new Option();
					child.Title = rows[i];
					child.AddTo(item);
				}
				child.SortOrder = i;

				editor.RegisterItemToSave(child);
			}

			return true;
		}
Example #23
0
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue( Control parentControl, string value, Dictionary<string, ConfigurationValue> configurationValues, bool condensed )
        {
            string videoUrl = value;
            if ( !string.IsNullOrEmpty( videoUrl ) )
            {
                if ( condensed )
                {
                    return videoUrl;
                }
                else
                {
                    string htmlFormat = @"
            <audio
            src='{0}'
            class='img img-responsive js-media-audio'
            controls
            >
            </audio>

            <script>
            Rock.controls.mediaPlayer.initialize();
            </script>
            ";
                    var html = string.Format( htmlFormat, videoUrl );
                    return html;
                }

            }

            // value was null
            return null;
        }
        public override void UpdateEditor(N2.ContentItem item, Control editor)
        {
            if (item == null)
                throw new ArgumentNullException("item", "item is null.");
            if (editor == null)
                throw new ArgumentNullException("editor", "editor is null.");

            ListBox lb = (ListBox)editor;
            string currentlySelectedItemsString = (string)item[this.Name] ?? string.Empty;

            if (!string.IsNullOrEmpty(currentlySelectedItemsString))
            {
                string[] currentlySelectedItems = currentlySelectedItemsString.Split(ItemSeperator);
                if (currentlySelectedItems.Length > 0)
                {
                    foreach (string currentItem in currentlySelectedItems)
                    {
                        ListItem listItem = lb.Items.FindByValue(currentItem);

                        if (listItem != null)
                            listItem.Selected = true;
                    }
                }
            }
        }
Example #25
0
        public void LoadWidgets(IEnumerable<DefaultWidgetSetupView> widgetModels, Control placeholder, TemplateControl page)
        {
            if (placeholder == null)
            {
                return;
            }

            if (page == null)
            {
                return;
            }

            if (widgetModels == null)
            {
                return;
            }

            foreach (DefaultWidgetSetupView item in widgetModels.OrderBy(x => x.WidgetOrder))
            {
                using (MixERPWidget widget = page.LoadControl(item.WidgetSource) as MixERPWidget)
                {
                    if (widget != null)
                    {
                        placeholder.Controls.Add(widget);
                        widget.OnControlLoad(widget, new EventArgs());
                    }
                }
            }
        }
Example #26
0
        private void CreateErrorLabel(Control container)
        {
            this.errorLabel = new HtmlGenericControl("div");
            this.errorLabel.Attributes.Add("class", "big error");

            container.Controls.Add(this.errorLabel);
        }
        public ICollection GenerateFields(Control control)
        {
            var itemControl = control as IDataBoundItemControl;
            var containerType = 
                ((!(control is IDataBoundListControl) && !(control is Repeater)) && (control is IDataBoundItemControl)) ?
                ContainerType.Item :
                ContainerType.List;
            var mode = itemControl?.Mode ?? DataBoundControlMode.ReadOnly;

            var columns = _table.GetScaffoldColumns(mode, containerType);
            
            return SortColumns(_table, columns)
                .Select(col => {
                    var field = new DynamicField()
                    {
                        DataField = col.Name,
                        HeaderText = (containerType == ContainerType.List) ? col.ShortDisplayName : col.Name
                    };
                    if (containerType != ContainerType.List)
                    {
                        field.ItemStyle.BorderWidth = 0;
                    }
                    field.ItemStyle.Wrap = false;
                    return field;
                })
                .ToList();
        }
		protected override Control AddEditor(Control container)
		{
			var editor = base.AddEditor(container);
			if (string.IsNullOrEmpty(Title))
				AddHelp(container);
			return editor;
		}
        /*
         * Adds a child control to this control.
         */

        /// <devdoc>
        /// <para>Adds the specified <see cref='System.Web.UI.Control'/> object
        ///    to the collection. The new control is logically added to the end of an ordinal
        ///    index array.</para>
        /// </devdoc>
        public virtual void Add(Control child) {
            // Note: duplication of code with AddAt is deliberate for performance reasons. This is the more common form of the call.

            // Check arguments
            if (child == null)
                throw new ArgumentNullException("child");

            if (_readOnlyErrorMsg != null) {
                throw new HttpException(SR.GetString(_readOnlyErrorMsg ));
            }

            // Make sure we have room
            if (_controls == null) {
                _controls = new Control[_defaultCapacity];
            }
            else if (_size >= _controls.Length) {
                Control[] newArray = new Control[_controls.Length * _growthFactor ];
                Array.Copy(_controls, newArray, _controls.Length);
                _controls = newArray;
            }

            // Add the control
            int index = _size;
            _controls[index] = child;
            _size++;
            _version++;

            // Notify Owner
            _owner.AddedControl(child, index);
        }
 protected void AddLink(Control cssRoot, int InsertAt, HtmlLink link)
 {
     if (string.IsNullOrEmpty(Condition))
     {
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(link);
         }
         else
         {
             cssRoot.Controls.AddAt(InsertAt, link);
         }
     }
     else
     {
         var openif = new Literal();
         openif.Text = string.Format("<!--[if {0}]>", Condition);
         var closeif = new Literal();
         closeif.Text = "<![endif]-->";
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(openif);
             cssRoot.Controls.Add(link);
             cssRoot.Controls.Add(closeif);
         }
         else
         {
             //Since we want to add at a specific location, we do this in reverse order
             //this allows us to use the same insertion point
             cssRoot.Controls.AddAt(InsertAt, closeif);
             cssRoot.Controls.AddAt(InsertAt, link);
             cssRoot.Controls.AddAt(InsertAt, openif);
         }
     }
 }