Esempio n. 1
0
        /// <summary>
        /// Loads a check-in block to determine if it will require a selection or not. This is used to find the
        /// next page/block that does require a selection so that user can be redirected once to that block,
        /// rather than just continuously redirected to next/prev page blocks and possibly exceeding the maximum
        /// number of redirects.
        /// </summary>
        /// <param name="attributeKey">The attribute key.</param>
        /// <returns></returns>
        protected CheckInBlock GetCheckInBlock(string attributeKey)
        {
            var pageReference = new PageReference(GetAttributeValue(attributeKey));

            if (pageReference.PageId > 0)
            {
                var page = PageCache.Get(pageReference.PageId);
                if (page != null)
                {
                    foreach (var block in page.Blocks.OrderBy(b => b.Order))
                    {
                        var control = TemplateControl.LoadControl(block.BlockType.Path);
                        if (control != null)
                        {
                            var checkinBlock = control as CheckInBlock;
                            if (checkinBlock != null)
                            {
                                checkinBlock.SetBlock(page, block, true, true);
                                checkinBlock.GetState();
                                return(checkinBlock);
                            }
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the Load event of the Router_Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event
        /// data.</param>
        private void Router_Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Load the menu on the left
                string         leftControl    = ControlSharedControlsWikiMenu;
                WikiModuleBase wikiModuleBase = (WikiModuleBase)TemplateControl.LoadControl(leftControl);
                wikiModuleBase.ModuleConfiguration = this.ModuleConfiguration;
                wikiModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(leftControl);
                this.phWikiMenu.Controls.Add(wikiModuleBase);

                string         controlToLoad = this.GetControlString(Request.QueryString["loc"]);
                WikiModuleBase wikiContent   = (WikiModuleBase)LoadControl(controlToLoad);
                wikiContent.ModuleConfiguration = this.ModuleConfiguration;
                wikiContent.ID = System.IO.Path.GetFileNameWithoutExtension(controlToLoad);
                this.phWikiContent.Controls.Add(wikiContent);

                this.LoadWikiButtonControl(controlToLoad);

                // Print the Topic
                foreach (ModuleAction objAction in this.Actions)
                {
                    if (objAction.CommandName.Equals(ModuleActionType.PrintModule))
                    {
                        objAction.Url += "&topic=" + WikiMarkup.EncodeTitle(this.PageTopic);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 3
0
        protected internal override void Render(HtmlTextWriter writer)
        {
            string method = MethodName;

            if (method.Length == 0)
            {
                return;
            }

            TemplateControl tc = TemplateControl;

            if (tc == null)
            {
                return;
            }

            HttpContext  ctx  = Context;
            HttpResponse resp = ctx != null ? ctx.Response : null;

            if (resp == null)
            {
                return;
            }

            resp.WriteSubstitution(CreateCallback(method, tc));
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (!IsDesignMode)
            {
                TemplateControl control = (TemplateControl)Page.LoadControl(_userControlPath);
                Controls.Add(control);
                _userControl = control as IDataEditControl;

                if (_userControl != null && DataSource != null)
                {
                    IBusinessObjectDataSource dataSourceControl = DataSource;
                    if (Property != null)
                    {
                        _referenceDataSource            = new BusinessObjectReferenceDataSourceControl();
                        _referenceDataSource.DataSource = DataSource;
                        _referenceDataSource.Property   = Property;
                        _referenceDataSource.Mode       = DataSource.Mode;
                        dataSourceControl = _referenceDataSource;
                        Controls.Add(_referenceDataSource);
                    }

                    _userControl.Mode           = dataSourceControl.Mode;
                    _userControl.BusinessObject = dataSourceControl.BusinessObject;
                }
            }
        }
        internal override void FrameworkInitialize(TemplateControl templateControl)
        {
            Page page = (Page)templateControl;

            page.StyleSheetTheme = this._stylesheetTheme;
            page.InitializeStyleSheet();
            base.FrameworkInitialize(templateControl);
            if (this._traceEnabled != TraceEnable.Default)
            {
                page.TraceEnabled = this._traceEnabled == TraceEnable.Enable;
            }
            if (this._traceMode != TraceMode.Default)
            {
                page.TraceModeValue = this._traceMode;
            }
            if (this._outputCacheData != null)
            {
                page.AddWrappedFileDependencies(this._fileDependencies);
                page.InitOutputCache(this._outputCacheData);
            }
            if (this._validateRequest)
            {
                page.Request.ValidateInput();
            }
        }
        // Return true if specified evaluator exists on the page with the
        // correct signature.  If it does, return result of invoking it in
        // evaluatorResult.
        private bool CheckOnPageEvaluator(MobileCapabilities capabilities,
                                          out bool evaluatorResult)
        {
            evaluatorResult = false;
            TemplateControl containingTemplateControl = Owner.ClosestTemplateControl;

            MethodInfo methodInfo =
                containingTemplateControl.GetType().GetMethod(_deviceFilter,
                                                              new Type[]
            {
                typeof(MobileCapabilities),
                typeof(String)
            }
                                                              );

            if (methodInfo == null || methodInfo.ReturnType != typeof(bool))
            {
                return(false);
            }
            else
            {
                evaluatorResult = (bool)
                                  methodInfo.Invoke(containingTemplateControl,
                                                    new Object[]
                {
                    capabilities,
                    _argument
                }
                                                    );

                return(true);
            }
        }
Esempio n. 7
0
        internal static void InitializeGroup(TemplateControl owner, string groupName)
        {
            var monitorClasses = $"mc mc-group-{groupName}"
                                 .ToLowerInvariant();

            var container = FindControl(owner, "Container" + groupName);

            container?.AddCssClasses(monitorClasses + " mc-container updated");

            var control = FindControl(owner, "Control" + groupName);

            control?.AddCssClasses(monitorClasses + " mc-data");

            var undo = FindControl(owner, "Undo" + groupName);

            undo?.AddCssClasses(monitorClasses + " mc-undo");

            var feedback = FindControl(owner, "Feedback" + groupName);

            feedback?.AddCssClasses(monitorClasses + " mc-feedback");

            var ajaxloader = FindControl(owner, "AjaxLoader" + groupName);

            ajaxloader?.AddCssClasses(monitorClasses + " mc-ajaxloader");

            var button = FindControl(owner, "Button" + groupName);

            button?.AddCssClasses(monitorClasses + " mc-button");

            var description = FindControl(owner, "Description" + groupName);

            description?.AddCssClasses(monitorClasses + " mc-desc");
        }
Esempio n. 8
0
        /// <summary>
        /// Creates the specified page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="controlUid">The control uid.</param>
        /// <param name="instanseUid">The instanse uid.</param>
        /// <returns></returns>
        public static Control Create(TemplateControl page, string controlUid, string instanseUid)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            if (controlUid == null)
            {
                throw new ArgumentNullException("controlUid");
            }

            Initialize();
            Control retVal = null;

            // Load Control Info
            DynamicControlInfo info = GetControlInfo(controlUid);

            if (info == null)
            {
                return(null);
            }
            //throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Invalid control Uid '{0}'", controlUid), "controlUid");

            // Try Load Control
            if (!string.IsNullOrEmpty(info.Path))
            {
                retVal = page.LoadControl(CreateControlVirtualPath(info.Path));
            }
            else if (!string.IsNullOrEmpty(info.Type))
            {
                retVal = (Control)AssemblyUtil.LoadObject(info.Type);
            }

            // Try Load Adapter
            if (retVal != null && (!string.IsNullOrEmpty(info.AdapterPath) || !string.IsNullOrEmpty(info.AdapterType)))
            {
                Control adapter = null;

                if (!string.IsNullOrEmpty(info.Path))
                {
                    adapter = page.LoadControl(CreateControlVirtualPath(info.AdapterPath));
                }
                else if (!string.IsNullOrEmpty(info.Type))
                {
                    adapter = (Control)AssemblyUtil.LoadObject(info.AdapterType);
                }

                if (adapter != null)
                {
                    // Add Control to adapter
                    adapter.Controls.Add(retVal);

                    // Return adapter
                    retVal = adapter;
                }
            }

            return(retVal);
        }
Esempio n. 9
0
        // Internals //////////////////////////////////////////////////////
        private Control LoadUserInterface(TemplateControl page, string path)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            Control ui;

            try
            {
                ui = page.LoadControl(path);
            }
            catch (Exception e) //logged
            {
                Logger.WriteException(e);
                HasError = true;
                var msg        = String.Format("{0}", e.Message);
                var msgControl = new Label {
                    ID = "RuntimeErrMsg", Text = msg, ForeColor = Color.Red
                };
                return(msgControl);
            }
            return(ui);
        }
Esempio n. 10
0
        protected override void Render(HtmlTextWriter output)
        {
            Control objContainer = TemplateControl.LoadControl(String.Concat("~/Modulos/CMS/Modulos", PathModulo));

            objContainer.ID = string.Concat("CTT_", IdModulo);

            this.Controls.Add(objContainer);

            string  auxOutputPar = null;
            dynamic tempWriter   = new StringWriter();

            base.RenderChildren(new HtmlTextWriter(tempWriter));
            auxOutputPar = tempWriter.ToString();

            //se o resultado for um div vazio, retorna string.Empty. Essa verificação feita assim ignora case e qualquer atributo no div,
            //além de considerar vazio um div que contenha apenas espaçamento (espaços, tabs, quebras de linha, mas sem conteúdo)
            {
                if (System.Text.RegularExpressions.Regex.IsMatch(auxOutputPar, "(?is)^\\W*<div[^>]*>\\W*</div>\\W*$"))
                {
                    auxOutputPar = string.Empty;
                }
            }

            output.Write(auxOutputPar);
        }
        internal static Assembly GetLocalResourceAssembly(TemplateControl control)
        {
            object   localResXResourceProvider = LocalResXResourceProviderFactory.CreateLocalResourceProvider(control.AppRelativeVirtualPath);
            Assembly localResourceAssembly     = (Assembly)fnGetLocalResourceAssembly.Invoke(localResXResourceProvider, null);

            return(localResourceAssembly);
        }
 public LocalResXAssemblyResourceManager(TemplateControl templateControl, Assembly localResourceAssembly)
     : base(
         VirtualPathUtility.GetFileName(templateControl.AppRelativeVirtualPath), localResourceAssembly)
 {
     AssertUtils.ArgumentNotNull(templateControl, "templateControl");
     AssertUtils.ArgumentNotNull(localResourceAssembly, "localResourceAssembly");
 }
Esempio n. 13
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Title = (!String.IsNullOrEmpty(Title) ? Title : Resources.Resource.RecentActivity);

            var activityBox = (RecentActivityBox)TemplateControl.LoadControl(RecentActivityBox.Location);

            activityBox.userActivityList = UserActivityManager.GetUserActivities(
                TenantId,
                UserId,
                ProductId,
                new[] { ModuleId },
                UserActivityConstants.AllActionType,
                null,
                0, MaxItems);
            activityBox.MaxLengthTitle = 20;
            activityBox.ItemCSSClass   = ItemCSSClass;
            Controls.Add(activityBox);

            Controls.Add(new LiteralControl
            {
                Text =
                    string.Format("<div style='margin:10px 20px 0 20px;'><a href='{0}'>{1}</a></div>",
                                  WhatsNew.GetUrlForModule(ProductId, ModuleId),
                                  Resources.Resource.ToWhatsNewPage)
            });
        }
Esempio n. 14
0
        private void EvalKeepInSessionAttributeSet(TemplateControl instance, FieldInfo field)
        {
            var keepInSessionAttribute = GetAttributeFromField <KeepInSessionAttribute>(field);

            if (keepInSessionAttribute != null)
            {
                if (!KeepInSessionAttribute.TypeAllowed(field.FieldType))
                {
                    throw new InvalidTypeException("KeepInsession", field);
                }

                if (string.IsNullOrEmpty(keepInSessionAttribute.SessionKey))
                {
                    if (!(field.GetValue(instance) != null && Session[field.Name + "AutoSave"] == null))
                    {
                        field.SetValue(instance, Session[field.Name + "AutoSave"]);
                    }
                }
                else
                {
                    if (!(field.GetValue(instance) != null && Session[Request.QueryString[keepInSessionAttribute.SessionKey]] == null))
                    {
                        field.SetValue(instance, Session[Request.QueryString[keepInSessionAttribute.SessionKey]]);
                    }
                }
            }
        }
Esempio n. 15
0
        protected void ASPxPageControl1_Init(object sender, EventArgs e)
        {
            DataTable objDtBep = newsClass.SelectAll().Tables[0];

            for (int i = 0; i < objDtBep.Rows.Count; i++)//循环写入标题
            {
                TabPage objTp   = new TabPage();
                string  ClassID = objDtBep.Rows[0]["ID"].ToString();
                objTp.Text = objDtBep.Rows[0]["ClassName"].ToString();
                string userdpet = string.Empty;
                if (Session["userdept"] != null)
                {
                    userdpet = Session["userdept"].ToString();
                }
                else
                {
                    userdpet = "全院";
                }

                DataTable objDtParen = news.GetNewsByClassId(ClassID, userdpet).Tables[0]; //此函数的第二个参数为登录人的部门代码
                for (int y = 0; y < objDtParen.Rows.Count; y++)                            //循环写入内容
                {
                    if (y % 7 == 0 && y != 0)
                    {
                        Control objControl2 = TemplateControl.ParseControl("<br>");
                        objTp.Controls.Add(objControl2);
                    }
                    Control objControl = TemplateControl.ParseControl("<span class='list_date'>" + objDtParen.Rows[y]["AddTime"].ToString() + "</span><asp:HyperLink  runat='server' NavigateUrl='NewsDetails.aspx?NewsID=" + objDtParen.Rows[y]["ID"].ToString() + "' Width='50%'>" + objDtParen.Rows[y]["Title"].ToString() + "</asp:HyperLink><br/>"); //面板
                    objTp.Controls.Add(objControl);                                                                                                                                                                                                                                                                                                       //向一个标签内加入面板
                }
                ASPxPageControl1.TabPages.Add(objTp);                                                                                                                                                                                                                                                                                                     //向控件中加入标签
            }
        }
Esempio n. 16
0
        internal virtual void FrameworkInitialize(TemplateControl templateControl)
        {
            HttpContext     current = HttpContext.Current;
            TemplateControl control = current.TemplateControl;

            current.TemplateControl = templateControl;
            try
            {
                if (!this._initialized)
                {
                    lock (this)
                    {
                        this._rootBuilder.InitObject(templateControl);
                    }
                    this._initialized = true;
                }
                else
                {
                    this._rootBuilder.InitObject(templateControl);
                }
            }
            finally
            {
                if (control != null)
                {
                    current.TemplateControl = control;
                }
            }
        }
 private void BindCustomSettings()
 {
     if (_activeSection.Settings.Count > 0)
     {
         foreach (ModuleSetting ms in _activeSection.ModuleType.ModuleSettings)
         {
             Control ctrl = TemplateControl.FindControl(ms.Name);
             if (_activeSection.Settings[ms.Name] != null)
             {
                 string settingValue = _activeSection.Settings[ms.Name].ToString();
                 if (ctrl is TextBox)
                 {
                     ((TextBox)ctrl).Text = settingValue;
                 }
                 else if (ctrl is CheckBox)
                 {
                     ((CheckBox)ctrl).Checked = Boolean.Parse(settingValue);
                 }
                 else if (ctrl is DropDownList)
                 {
                     DropDownList ddl = (DropDownList)ctrl;
                     ListItem     li  = ddl.Items.FindByValue(settingValue);
                     if (li != null)
                     {
                         li.Selected = true;
                     }
                 }
             }
         }
     }
 }
Esempio n. 18
0
        public static Control LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration, string controlKey, string controlSrc)
        {
            if (TracelLogger.IsDebugEnabled)
            {
                TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}");
            }

            Control control = null;
            IModuleControlFactory controlFactory = GetModuleControlFactory(controlSrc);

            if (controlFactory != null)
            {
                control = controlFactory.CreateControl(containerControl, controlKey, controlSrc);
            }

            // set the control ID to the resource file name ( ie. controlname.ascx = controlname )
            // this is necessary for the Localization in PageBase
            if (control != null)
            {
                control.ID = Path.GetFileNameWithoutExtension(controlSrc);

                var moduleControl = control as IModuleControl;

                if (moduleControl != null)
                {
                    moduleControl.ModuleContext.Configuration = moduleConfiguration;
                }
            }

            if (TracelLogger.IsDebugEnabled)
            {
                TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}");
            }
            return(control);
        }
Esempio n. 19
0
            protected override void InitializeItem(TemplateControl owner,
                                                   bool addMonitorClasses = true, FeedbackContainerControl feedback = null)
            {
                var page = owner as SecurePage;

                // ReSharper disable once BaseMethodCallWithDefaultParameter
                base.InitializeItem(page, addMonitorClasses);

                _Heading =
                    page.Master.FindMainContentControl("Heading" + Column) as
                    HtmlGenericControl;
                IconBox =
                    page.Master.FindMainContentControl("IconBox" + Column) as HtmlAnchor;

                if (_Heading != null)
                {
                    _Heading.InnerHtml = Description;
                }

                if (IconBox != null)
                {
                    IconBox.Attributes.Add("title", IconToolTip);
                    IconBox.AddCssClasses("tiptip");
                }
            }
Esempio n. 20
0
        public Control CreateControl(TemplateControl containerControl, string controlKey, string controlSrc)
        {
            // load from a typename in an assembly ( ie. server control)
            var objType = Reflection.CreateType(controlSrc);

            return(containerControl.LoadControl(objType, null));
        }
        internal void RenderMarkup(HtmlTextWriter writer)
        {
            if (MethodName.Length == 0)
            {
                return;
            }

            TemplateControl target = TemplateControl;

            if (target == null)
            {
                return;
            }

            // get the delegate to the method
            HttpResponseSubstitutionCallback callback = null;

            try {
                callback = GetDelegate(target.GetType(), MethodName);
            }
            catch {
            }

            if (callback == null)
            {
                throw new HttpException(
                          SR.GetString(SR.Substitution_BadMethodName, MethodName));
            }

            // add the substitution to the response
            Page.Response.WriteSubstitution(callback);
        }
 private void SetCustomSettings()
 {
     foreach (ModuleSetting ms in _activeSection.ModuleType.ModuleSettings)
     {
         Control ctrl = TemplateControl.FindControl(ms.Name);
         object  val  = null;
         if (ctrl is TextBox)
         {
             string text = ((TextBox)ctrl).Text;
             if (ms.IsRequired && text == String.Empty)
             {
                 throw new Exception(String.Format("The value for {0} is required.", ms.FriendlyName));
             }
             val = text;
         }
         else if (ctrl is CheckBox)
         {
             val = ((CheckBox)ctrl).Checked;
         }
         else if (ctrl is DropDownList)
         {
             val = ((DropDownList)ctrl).SelectedValue;
         }
         else if (ctrl is CustomTypeSettingControl)
         {
             val = ((CustomTypeSettingControl)ctrl).SelectedValue;
         }
         try
         {
             // Check if the datatype is correct -> brute force casting :)
             Type type = ms.GetRealType();
             if (type.IsEnum && val is string)
             {
                 val = Enum.Parse(type, val.ToString());
             }
             else if (type.IsSubclassOf(typeof(EnumrableSetting)))
             {
                 // There is no need to worry, but if we can check, it's better
             }
             else if (type.IsSubclassOf(typeof(TreeViewSetting)))
             {
                 // There is no need to worry, but if we can check, it's better
             }
             else
             {
                 if (val.ToString().Length > 0)
                 {
                     object testObj = Convert.ChangeType(val, type);
                 }
             }
         }
         catch (InvalidCastException ex)
         {
             throw new Exception(String.Format("Giá trị nhập cho {0}: {1} không hợp lệ", ms.FriendlyName, val),
                                 ex);
         }
         _activeSection.Settings[ms.Name] = val.ToString();
     }
 }
Esempio n. 23
0
        public new String ResolveUrl(String relativeUrl)
        {
            int length;

            if (relativeUrl == null ||
                (length = relativeUrl.Length) == 0 ||
                !UrlPath.IsRelativeUrl(relativeUrl))
            {
                return(relativeUrl);
            }

            String baseUrl = TemplateSourceDirectory;

            // Determine if there are any . or .. sequences.

            bool containsDots = false;

            for (int examine = 0; examine < length; examine++)
            {
                examine = relativeUrl.IndexOf('.', examine);
                if (examine < 0)
                {
                    break;
                }

                // Expression borrowed from UrlPath.cs
                if ((examine == 0 || relativeUrl[examine - 1] == '/') &&
                    (examine + 1 == length || relativeUrl[examine + 1] == '/' ||
                     (relativeUrl[examine + 1] == '.' &&
                      (examine + 2 == length || relativeUrl[examine + 2] == '/'))))
                {
                    containsDots = true;
                    break;
                }
            }

            if (!containsDots)
            {
                if (baseUrl.Length == 0)
                {
                    return(relativeUrl);
                }

                TemplateControl parentTemplateControl = FindContainingTemplateControl();
                if (parentTemplateControl == null || parentTemplateControl is MobilePage)
                {
                    return(relativeUrl);
                }
            }

            if (baseUrl.IndexOf(' ') != -1)
            {
                baseUrl = baseUrl.Replace(" ", "%20");
            }

            String url = UrlPath.Combine(baseUrl, relativeUrl);

            return(Context.Response.ApplyAppPathModifier(url));
        }
Esempio n. 24
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var canAdministrateBlockOnPage = false;
            var pageBlocks = PageCache.Blocks;

            foreach (Rock.Web.Cache.BlockCache block in pageBlocks)
            {
                bool canAdministrate = block.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson);
                bool canEdit         = block.IsAuthorized(Authorization.EDIT, CurrentPerson);
                bool canView         = block.IsAuthorized(Authorization.VIEW, CurrentPerson);

                // Make sure user has access to view block instance
                if (canAdministrate || canEdit || canView)
                {
                    Control control = null;

                    // Check to see if block is configured to use a "Cache Duration'
                    if (block.OutputCacheDuration > 0)
                    {
                        RockMemoryCache cache         = RockMemoryCache.Default;
                        string          blockCacheKey = string.Format("Rock:BlockOutput:{0}", block.Id);
                        if (cache.Contains(blockCacheKey))
                        {
                            // If the current block exists in our custom output cache, add the cached output instead of adding the control
                            control = new LiteralControl(cache[blockCacheKey] as string);
                        }
                    }

                    if (control == null)
                    {
                        try
                        {
                            control = TemplateControl.LoadControl(block.BlockType.Path);
                            control.ClientIDMode = ClientIDMode.AutoID;
                        }
                        catch (Exception)
                        {
                            // Swallow this exception--NOM NOM
                        }
                    }

                    if (control != null)
                    {
                        if (canAdministrate || (canEdit && control is RockBlockCustomSettings))
                        {
                            canAdministrateBlockOnPage = true;
                        }
                    }
                }
            }

            if (PageCache.IncludeAdminFooter && (PageCache.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson) || canAdministrateBlockOnPage))
            {
                RockPage.AddCSSLink(ResolveRockUrl("~~/Styles/theme.css"));
            }
        }
Esempio n. 25
0
        private void EvalKeepInViewStateAttributeStore(TemplateControl instance, FieldInfo field)
        {
            var keepInViewStateAttribute = GetAttributeFromField <KeepInViewStateAttribute>(field);

            if (keepInViewStateAttribute != null)
            {
                ViewState[field.Name + "AutoSave"] = field.GetValue(instance).ToString();
            }
        }
        /// <summary>
        /// Initializes a new instance of the MultiBindableTemplate class.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="paths"></param>
        public MultiBindableTemplate(TemplateControl control, params String[] paths)
        {
            _templates = new IBindableTemplate[paths.Length];

            for (int i = 0; i < paths.Length; i++)
            {
                _templates[i] = FormUtil.LoadBindableTemplate(control, paths[i]);
            }
        }
Esempio n. 27
0
        public virtual object CreateInstance()
        {
            TemplateControl control = (TemplateControl)HttpRuntime.FastCreatePublicInstance(this._baseType);

            control.TemplateControlVirtualPath      = base.VirtualPath;
            control.TemplateControlVirtualDirectory = base.VirtualPath.Parent;
            control.SetNoCompileBuildResult(this);
            return(control);
        }
Esempio n. 28
0
        private static BaseModuleControl LoadModuleControl(TemplateControl page, ModuleBase module)
        {
            BaseModuleControl ctrl =
                (BaseModuleControl)page.LoadControl(UrlHelper.GetApplicationPath() + module.CurrentViewControlPath);

            ctrl.ID     = "ctrl" + module.Section.Id;
            ctrl.Module = module;
            return(ctrl);
        }
Esempio n. 29
0
 public void ReadStringResource_Deny_Unrestricted()
 {
     try {
         TemplateControl.ReadStringResource(null);
     }
     catch (TypeInitializationException) {
         Assert.Ignore("exception during initialization");
     }
 }
        private void ButtonWhyIsTemplateIncompleteClick(object sender, RoutedEventArgs e)
        {
            var invalidControl = TemplateControl.FindInvalidControl();

            if (invalidControl != null)
            {
                invalidControl.NotifyIfInvalid();
                AnimateStatusBarText("Missing answer for: " + invalidControl.NodeName);
            }
            else
            {
                var missingMarkupControl = TemplateControl.FindControlWithMissingMarkup();
                if (missingMarkupControl != null)
                {
                    string missingMarkupMessage = String.Empty;
                    switch (missingMarkupControl.GeometricShapeWpfControl.GeometricShape.GeometricShape)
                    {
                    case AimTemplateTreeGeometricShapeNode.GeometricShapes.MultiPoint:
                        missingMarkupMessage = "line or protractor/angle";
                        break;

                    case AimTemplateTreeGeometricShapeNode.GeometricShapes.Polyline:
                        missingMarkupMessage = "rectangle or polygon";
                        break;

                    case AimTemplateTreeGeometricShapeNode.GeometricShapes.Circle:
                        missingMarkupMessage = "ellipse";
                        break;

                    case AimTemplateTreeGeometricShapeNode.GeometricShapes.Ellipse:
                        missingMarkupMessage = "ellipse";
                        break;

                    case AimTemplateTreeGeometricShapeNode.GeometricShapes.Point:
                        missingMarkupMessage = "point callout or crosshair";
                        break;
                    }

                    missingMarkupControl.GeometricShapeWpfControl.Valid = false;
                    missingMarkupControl.GeometricShapeWpfControl.NotifyIfInvalid();
                    if (missingMarkupControl.MarkupCount == 1)
                    {
                        AnimateStatusBarText("Missing " + missingMarkupMessage + " markup");
                    }
                    else
                    {
                        AnimateStatusBarText("Missing " + missingMarkupControl.MarkupCount + " " + missingMarkupMessage + " markups");
                    }
                }
                else if (Annotation.Configuration.AimSettings.Default.RequireMarkupInAnnotation &&
                         Component.AimTemplateTree.Markup.Count == 0)
                {
                    AnimateStatusBarText("Missing graphic markup on image.");
                }
            }
        }
Esempio n. 31
0
 public override Control CreateControlPanel(TemplateControl parent)
 {
     return new $fileinputname$ControlPanel();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="idx">The row index of the template item</param>
 /// <param name="templateItem">The item related to the event</param>
 public DataListCancelEventArgs(int idx, TemplateControl templateItem)
     : base(idx, templateItem)
 {
 }