public static string FormatCrossPortalTabUrl (IModuleControl module, int tabId, bool trackClicks)
        {
            try {
                // get tab info by tabId
                var tab = new TabController ().GetTab (tabId, Null.NullInteger, false);

                // check if this tab belongs to another portal
                if (tab.PortalID != module.ModuleContext.PortalId) {
                    // get portal alias, primary first (we don't know exactly,
                    // which portal aliases are globally-available, and which are not)
                    var portalAlias = PortalAliasController.Instance.GetPortalAliasesByPortalId (tab.PortalID)
                        .OrderBy (pa => !pa.IsPrimary).First ();

                    // target portal URL (let target portal use right protocol and do URL rewriting)
                    return "http://" + portalAlias.HTTPAlias + (trackClicks ?
                        string.Format ("/LinkClick.aspx?link={0}&tabid={1}", tabId, module.ModuleContext.TabId) :
                        string.Format ("/Default.aspx?tabid={0}", tabId));
                }

                // tab is on same portal
                return FormatURL (module, tabId.ToString (), trackClicks);
            }
            catch {
                return string.Empty;
            }
        }
示例#2
0
        // TODO: Move to the base library
        public static string FormatCrossPortalTabUrl(IModuleControl module, int tabId, bool trackClicks)
        {
            try {
                // get tab info by tabId
                var tab = new TabController().GetTab(tabId, Null.NullInteger, false);

                // check if this tab belongs to another portal
                if (tab.PortalID != module.ModuleContext.PortalId)
                {
                    // get portal alias, primary first (we don't know exactly,
                    // which portal aliases are globally-available, and which are not)
                    var portalAlias = PortalAliasController.Instance.GetPortalAliasesByPortalId(tab.PortalID)
                                      .OrderBy(pa => !pa.IsPrimary).First();

                    // target portal URL (let target portal use right protocol and do URL rewriting)
                    return("http://" + portalAlias.HTTPAlias + (trackClicks ?
                                                                string.Format("/LinkClick.aspx?link={0}&tabid={1}", tabId, module.ModuleContext.TabId) :
                                                                string.Format("/Default.aspx?tabid={0}", tabId)));
                }

                // tab is on same portal
                return(FormatURL(module, tabId.ToString(), trackClicks));
            }
            catch {
                return(string.Empty);
            }
        }
示例#3
0
 public ModuleControl(IModuleControl control, string title)
 {
     InitializeComponent();
     DataContext = this;
     Title       = title;
     Settings    = control;
     Settings.ContainerControl = container;
 }
        /// <summary>
        /// Determines whether the current user can manage applications for the specified module.
        /// </summary>
        /// <param name="moduleControl">The module control.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="moduleControl"/> is <c>null</c></exception>
        /// <returns>
        /// <c>true</c> if the current user can manage applications for the specified module; otherwise, <c>false</c>.
        /// </returns>
        public static bool CanManageApplications(IModuleControl moduleControl)
        {
            if (moduleControl == null)
            {
                throw new ArgumentNullException("moduleControl");
            }

            return CanManageApplications(moduleControl.ModuleContext.Configuration);
        }
示例#5
0
        /// <summary>
        /// Determines whether the current user can manage applications for the specified module.
        /// </summary>
        /// <param name="moduleControl">The module control.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="moduleControl"/> is <c>null</c></exception>
        /// <returns>
        /// <c>true</c> if the current user can manage applications for the specified module; otherwise, <c>false</c>.
        /// </returns>
        public static bool CanManageApplications(IModuleControl moduleControl)
        {
            if (moduleControl == null)
            {
                throw new ArgumentNullException("moduleControl");
            }

            return(CanManageApplications(moduleControl.ModuleContext.Configuration));
        }
示例#6
0
        public static void SynchronizeModuleHack(this IModuleControl module)
        {
            ModuleController.SynchronizeModule(module.ModuleContext.ModuleId);

            // NOTE: update module cache (temporary fix before 7.2.0)?
            // more info: https://github.com/dnnsoftware/Dnn.Platform/pull/21
            var moduleController = new ModuleController();

            moduleController.ClearCache(module.ModuleContext.TabId);
        }
示例#7
0
        /// <summary>
        /// Formats the Edit control URL by DNN rules (popups supported).
        /// </summary>
        /// <returns>Formatted Edit control URL.</returns>
        /// <param name="module">A module reference.</param>
        /// <param name="controlKey">Edit control key.</param>
        /// <param name="args">Additional parameters.</param>
        public static string EditUrl(this IModuleControl module, string controlKey, params string [] args)
        {
            // REVIEW: Use 2-element array
            var argList = new List <string> (args);

            argList.Add("mid");
            argList.Add(module.ModuleContext.ModuleId.ToString());

            return(module.ModuleContext.NavigateUrl(module.ModuleContext.TabId, controlKey, false, argList.ToArray()));
        }
示例#8
0
        public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc, bool DisplayErrorMessage)
        {
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            try
            {
                if (!Host.UseCustomErrorMessages)
                {
                    throw new ModuleLoadException(FriendlyMessage, exc);
                }
                else
                {
                    IModuleControl      ctrlModule = ctrl as IModuleControl;
                    ModuleLoadException lex        = null;
                    if (ctrlModule == null)
                    {
                        lex = new ModuleLoadException(exc.Message.ToString(), exc);
                    }
                    else
                    {
                        lex = new ModuleLoadException(exc.Message.ToString(), exc, ctrlModule.ModuleContext.Configuration);
                    }
                    CommonLibrary.Services.Log.EventLog.EventLogController objExceptionLog = new CommonLibrary.Services.Log.EventLog.EventLogController();
                    objExceptionLog.AddLog(lex);
                    if (DisplayErrorMessage)
                    {
                        PlaceHolder ErrorPlaceholder = null;
                        if (ctrl.Parent != null)
                        {
                            ErrorPlaceholder = (PlaceHolder)ctrl.Parent.FindControl("MessagePlaceHolder");
                        }
                        if (ErrorPlaceholder != null)
                        {
                            ctrl.Visible             = false;
                            ErrorPlaceholder.Visible = true;
                            ErrorPlaceholder.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                        else
                        {
                            ctrl.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                    }
                }
            }
            catch (Exception exc2)
            {
                ProcessPageLoadException(exc2);
            }
        }
        public static string FormatDivisionLink (this OccupiedPositionInfo op, IModuleControl module)
        {
            // do not display division title for high-level divisions
            if (op.Division.ParentDivisionID != null) {
                var strDivision = FormatHelper.FormatShortTitle (op.Division.ShortTitle, op.Division.Title);
                if (!string.IsNullOrWhiteSpace (op.Division.HomePage))
                    strDivision = string.Format ("<a href=\"{0}\" target=\"_blank\">{1}</a>", 
                        UniversityUrlHelper.FormatURL (module, op.Division.HomePage, false), strDivision);

                return strDivision;
            }

            return string.Empty;
        }
        public string FormatDivisionLink (IModuleControl module)
        {
            // do not display division title for high-level divisions
            if (ParentDivisionID != null)
            {
                var strDivision = DivisionInfo.FormatShortTitle (DivisionTitle, DivisionShortTitle);
                if (!string.IsNullOrWhiteSpace (HomePage))
                    strDivision = string.Format ("<a href=\"{0}\">{1}</a>", 
                        Utils.FormatURL (module, HomePage, false), strDivision);

                return strDivision;
            }
              
            return string.Empty;
        }
        public static string FormatDivisionLink(this OccupiedPositionInfo op, IModuleControl module)
        {
            // don't display division title/link for single-entity divisions
            if (!op.Division.IsSingleEntity)
            {
                var strDivision = FormatHelper.FormatShortTitle(op.Division.ShortTitle, op.Division.Title);
                if (!string.IsNullOrWhiteSpace(op.Division.HomePage))
                {
                    strDivision = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>",
                                                UniversityUrlHelper.FormatURL(module, op.Division.HomePage, false), strDivision);
                }

                return(strDivision);
            }

            return(string.Empty);
        }
示例#12
0
        // TODO: Move to the base library
        /// <summary>
        /// Temp workaround for issue with IE and Unicode characters in EditURL-generated URL:
        /// https://dnntracker.atlassian.net/browse/DNN-9280
        /// </summary>
        /// <returns>The raw edit URL.</returns>
        /// <param name="module">Module control.</param>
        /// <param name="request">HTTP request.</param>
        /// <param name="keyName">Key name.</param>
        /// <param name="keyValue">Key value.</param>
        /// <param name="controlKey">Control key.</param>
        public static string IESafeEditUrl(IModuleControl module, HttpRequest request, string keyName, string keyValue, string controlKey)
        {
            if (PortalSettings.Current.EnablePopUps)
            {
                // for any IE browser except Edge, return non-popup edit URL
                if (!request.UserAgent.Contains("Edge"))
                {
                    var browserName = request.Browser.Browser.ToUpperInvariant();
                    if (browserName.StartsWith("IE", StringComparison.Ordinal) ||
                        browserName.Contains("MSIE") ||
                        browserName == "INTERNETEXPLORER")
                    {
                        return(Globals.NavigateURL(controlKey, keyName, keyValue,
                                                   "mid", module.ModuleContext.ModuleId.ToString()));
                    }
                }
            }

            // popups disabled, it's safe to use default implementation
            return(module.ModuleContext.EditUrl(keyName, keyValue, controlKey));
        }
示例#13
0
        protected void Initialize(IConnectionHandler connectionHandler,
                                  IMessageParser parser,
                                  IConnectionStorage connectionStorage,
                                  IEndpointManager endpointManager,
                                  IMessenger broadcaster,
                                  IModuleFramework moduleFramework,
                                  IModuleControl moduleControl,
                                  LogManager logManager)
        {
            if (Initialized)
            {
                throw new Exception("Server is already initialized!");
            }

            LogManager = logManager;
            log        = LogManager.GetLogger("Server");

            _network  = endpointManager;
            Framework = moduleFramework;

            Framework.Messenger = broadcaster;
            Framework.Server    = this;

            ConnectionHandler = connectionHandler;

            ConnectionStorage = connectionStorage;

            _network.ConnectionHandler = connectionHandler;
            _network.MessageParser     = parser;

            connectionHandler.Modules   = moduleControl;
            connectionHandler.Messenger = broadcaster;

            parser.Modules           = moduleControl;
            parser.ConnectionHandler = connectionHandler;

            broadcaster.Connections = connectionStorage;

            Initialized = true;
        }
示例#14
0
        public static void ProcessModuleLoadException(Control ctrl, Exception exc, bool DisplayErrorMessage)
        {
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            string         friendlyMessage = Services.Localization.Localization.GetString("ErrorOccurred");
            IModuleControl ctrlModule      = ctrl as IModuleControl;

            if (ctrlModule == null)
            {
                friendlyMessage = Services.Localization.Localization.GetString("ErrorOccurred");
            }
            else
            {
                string moduleTitle = Null.NullString;
                if (ctrlModule != null && ctrlModule.ModuleContext.Configuration != null)
                {
                    moduleTitle = ctrlModule.ModuleContext.Configuration.ModuleTitle;
                }
                friendlyMessage = string.Format(Localization.Localization.GetString("ModuleUnavailable"), moduleTitle);
            }
            ProcessModuleLoadException(friendlyMessage, ctrl, exc, DisplayErrorMessage);
        }
示例#15
0
        internal AdvancedBrowser(IModuleControl aModuleControl, IXappFormsTabHandler aTabHandler, Func<string, string> aHtmlProvider, string aPath)
            : base(aModuleControl, "<div id='{0}' class='browser' />", aModuleControl.Id)
        {
            iTabHandler = aTabHandler;
            iHtmlProvider = aHtmlProvider;
            iHomePath = aPath;

            iPath = aPath;

            iHistory = new Stack<string>();
            iFuture = new Stack<string>();

            iToolbar = iTabHandler.CreateContainer().WithClass("browser-toolbar");
            iWindow = iTabHandler.CreateContainer().WithClass("browser-window");

            iBack = iTabHandler.CreateButton("Back").WithClass("browser-back");
            iForward = iTabHandler.CreateButton("Forward").WithClass("browser-forward");
            iRefresh = iTabHandler.CreateButton("Refresh").WithClass("browser-refresh");
            iHome = iTabHandler.CreateButton("Home").WithClass("browser-home");
            iSearch = iTabHandler.CreateTextbox().WithClass("browser-search");
            iGo = iTabHandler.CreateButton("Go").WithClass("browser-go");

            iBack.Disabled = true;
            iForward.Disabled = true;
            iGo.Disabled = true;

            iBack.Click += (obj, args) =>
            {
                if (iHistory.Count > 0)
                {
                    iFuture.Push(iPath);
                    iForward.Disabled = false;
                    iPath = iHistory.Pop();

                    if (iHistory.Count == 0)
                    {
                        iBack.Disabled = true;
                    }

                    Refresh();
                }
            };

            iForward.Click += (obj, args) =>
            {
                if (iFuture.Count > 0)
                {
                    iHistory.Push(iPath);
                    iBack.Disabled = false;
                    iPath = iFuture.Pop();

                    if (iFuture.Count == 0)
                    {
                        iForward.Disabled = true;
                    }

                    Refresh();
                }
            };

            iRefresh.Click += (obj, args) =>
            {
                Refresh();
            };

            iHome.Click += (obj, args) =>
            {
                if (iPath != iHomePath)
                {
                    iPath = iHomePath;
                    iHistory.Clear();
                    iFuture.Clear();
                    iBack.Disabled = true;
                    iForward.Disabled = true;
                    Refresh();
                }
            };

            iSearch.Change += (obj, args) =>
            {
                iGo.Disabled = iSearch.Text.Length == 0;
            };

            iSearch.Enter += (obj, args) =>
            {
                Search();
            };

            iGo.Click += (obj, args) =>
            {
                Search();
            };

            iToolbar.Add(iBack);
            iToolbar.Add(iForward);
            iToolbar.Add(iRefresh);
            iToolbar.Add(iHome);
            iToolbar.Add(iSearch);
            iToolbar.Add(iGo);

            ControlEval(string.Format("{0}.append({1})", iSelector, iToolbar.Id.JquerySelector()));
            ControlEval(string.Format("{0}.append({1})", iSelector, iWindow.Id.JquerySelector()));

            ControlRegisterEventHandler("link", OnLink);

            Refresh();
        }
示例#16
0
        internal void ProcessControl(Control c, ArrayList affectedControls, bool includeChildren, string ResourceFileRoot)
        {
            string key = GetControlAttribute(c, affectedControls);

            if (!string.IsNullOrEmpty(key))
            {
                string value;
                value = Services.Localization.Localization.GetString(key, ResourceFileRoot);
                if (c is Label)
                {
                    Label ctrl;
                    ctrl = (Label)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.Text = value;
                    }
                }
                if (c is LinkButton)
                {
                    LinkButton ctrl;
                    ctrl = (LinkButton)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        MatchCollection imgMatches = Regex.Matches(value, "<(a|link|img|script|input|form).[^>]*(href|src|action)=(\\\"|'|)(.[^\\\"']*)(\\\"|'|)[^>]*>", RegexOptions.IgnoreCase);
                        foreach (Match _match in imgMatches)
                        {
                            if ((_match.Groups[_match.Groups.Count - 2].Value.IndexOf("~") != -1))
                            {
                                string resolvedUrl = Page.ResolveUrl(_match.Groups[_match.Groups.Count - 2].Value);
                                value = value.Replace(_match.Groups[_match.Groups.Count - 2].Value, resolvedUrl);
                            }
                        }
                        ctrl.Text = value;
                        if (string.IsNullOrEmpty(ctrl.ToolTip))
                        {
                            ctrl.ToolTip = value;
                        }
                    }
                }
                if (c is HyperLink)
                {
                    HyperLink ctrl;
                    ctrl = (HyperLink)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.Text = value;
                    }
                }
                if (c is ImageButton)
                {
                    ImageButton ctrl;
                    ctrl = (ImageButton)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.AlternateText = value;
                    }
                }
                if (c is Button)
                {
                    Button ctrl;
                    ctrl = (Button)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.Text = value;
                    }
                }
                if (c is System.Web.UI.HtmlControls.HtmlImage)
                {
                    System.Web.UI.HtmlControls.HtmlImage ctrl;
                    ctrl = (System.Web.UI.HtmlControls.HtmlImage)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.Alt = value;
                    }
                }
                if (c is CheckBox)
                {
                    CheckBox ctrl;
                    ctrl = (CheckBox)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.Text = value;
                    }
                }
                if (c is BaseValidator)
                {
                    BaseValidator ctrl;
                    ctrl = (BaseValidator)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.ErrorMessage = value;
                    }
                }
                if (c is System.Web.UI.WebControls.Image)
                {
                    System.Web.UI.WebControls.Image ctrl;
                    ctrl = (System.Web.UI.WebControls.Image)c;
                    if (!String.IsNullOrEmpty(value))
                    {
                        ctrl.AlternateText = value;
                        ctrl.ToolTip       = value;
                    }
                }
            }
            if (c is RadioButtonList)
            {
                RadioButtonList ctrl;
                ctrl = (RadioButtonList)c;
                int i;
                for (i = 0; i <= ctrl.Items.Count - 1; i++)
                {
                    System.Web.UI.AttributeCollection ac = null;
                    ac  = ctrl.Items[i].Attributes;
                    key = ac[Services.Localization.Localization.KeyName];
                    if (key != null)
                    {
                        string value = Services.Localization.Localization.GetString(key, ResourceFileRoot);
                        if (!String.IsNullOrEmpty(value))
                        {
                            ctrl.Items[i].Text = value;
                        }
                    }
                    if (key != null && affectedControls != null)
                    {
                        affectedControls.Add(ac);
                    }
                }
            }
            if (c is DropDownList)
            {
                DropDownList ctrl;
                ctrl = (DropDownList)c;
                int i;
                for (i = 0; i <= ctrl.Items.Count - 1; i++)
                {
                    System.Web.UI.AttributeCollection ac = null;
                    ac  = ctrl.Items[i].Attributes;
                    key = ac[Services.Localization.Localization.KeyName];
                    if (key != null)
                    {
                        string value = Services.Localization.Localization.GetString(key, ResourceFileRoot);
                        if (!String.IsNullOrEmpty(value))
                        {
                            ctrl.Items[i].Text = value;
                        }
                    }
                    if (key != null && affectedControls != null)
                    {
                        affectedControls.Add(ac);
                    }
                }
            }
            if (c is System.Web.UI.WebControls.Image)
            {
                System.Web.UI.WebControls.Image ctrl;
                ctrl = (System.Web.UI.WebControls.Image)c;
                if ((ctrl.ImageUrl.IndexOf("~") != -1))
                {
                    ctrl.ImageUrl = Page.ResolveUrl(ctrl.ImageUrl);
                }
            }
            if (c is System.Web.UI.HtmlControls.HtmlImage)
            {
                System.Web.UI.HtmlControls.HtmlImage ctrl;
                ctrl = (System.Web.UI.HtmlControls.HtmlImage)c;
                if ((ctrl.Src.IndexOf("~") != -1))
                {
                    ctrl.Src = Page.ResolveUrl(ctrl.Src);
                }
            }
            if (c is System.Web.UI.WebControls.HyperLink)
            {
                System.Web.UI.WebControls.HyperLink ctrl;
                ctrl = (System.Web.UI.WebControls.HyperLink)c;
                if ((ctrl.NavigateUrl.IndexOf("~") != -1))
                {
                    ctrl.NavigateUrl = Page.ResolveUrl(ctrl.NavigateUrl);
                }
                if ((ctrl.ImageUrl.IndexOf("~") != -1))
                {
                    ctrl.ImageUrl = Page.ResolveUrl(ctrl.ImageUrl);
                }
            }
            if (includeChildren == true && c.HasControls())
            {
                IModuleControl objModuleControl = c as IModuleControl;
                if (objModuleControl == null)
                {
                    PropertyInfo pi = c.GetType().GetProperty("LocalResourceFile");
                    if (pi != null && pi.GetValue(c, null) != null)
                    {
                        IterateControls(c.Controls, affectedControls, pi.GetValue(c, null).ToString());
                    }
                    else
                    {
                        IterateControls(c.Controls, affectedControls, ResourceFileRoot);
                    }
                }
                else
                {
                    IterateControls(c.Controls, affectedControls, objModuleControl.LocalResourceFile);
                }
            }
        }
示例#17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:R7.Dnn.Extensions.ViewModels.ViewModelContext`1"/> class.
 /// </summary>
 /// <param name="module">Module control.</param>
 /// <param name="settings">Settings.</param>
 public ViewModelContext(IModuleControl module, TSettings settings) : base(module)
 {
     Settings = settings;
 }
示例#18
0
 public StreamViewModel(IModuleControl module, StreamSettings settings) : base(module, settings)
 {
 }
		public EmployeeSettings (IModuleControl module) : base (module)
		{
		}
		public LaunchpadSettings (IModuleControl module) : base (module)
		{
		}
示例#21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes ModuleControl Titles
        /// </summary>
        /// <param name="moduleControl">ModuleControl</param>
        /// <returns>
        /// Localized control title if found
        /// </returns>
        /// <remarks>
        /// Resource keys are: ControlTitle_[key].Text
        /// Key MUST be lowercase in the resource file
        /// </remarks>
        /// <history>
        /// 	[vmasanas]	08/11/2004	Created
        ///     [cnurse]    11/28/2008  Modified Signature
        /// </history>
        /// -----------------------------------------------------------------------------
        public static string LocalizeControlTitle(IModuleControl moduleControl)
        {
            //Priority order is: 1. Custom title, 2. Default definition title, 3. Localized title
            var controlTitle = moduleControl.ModuleContext.Configuration.ModuleTitle;

            if (string.IsNullOrEmpty(controlTitle))
            {
                controlTitle = moduleControl.ModuleContext.Configuration.ModuleControl.ControlTitle;
            }

            if (string.IsNullOrEmpty(controlTitle))
            {
                var controlKey = moduleControl.ModuleContext.Configuration.ModuleControl.ControlKey;
                if (!string.IsNullOrEmpty(controlKey))
                {
                    var reskey = "ControlTitle_" + controlKey.ToLower() + ".Text";
                    var localizedvalue = GetString(reskey, moduleControl.LocalResourceFile);
                    if (!string.IsNullOrEmpty(localizedvalue))
                    {
                        controlTitle = localizedvalue;
                    }
                }
            }
            return controlTitle;
        }
 public EmployeeDirectorySettings (IModuleControl module): base (module)
 {
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes ModuleControl Titles
        /// </summary>
        /// <param name="moduleControl">ModuleControl</param>
        /// <returns>
        /// Localized control title if found
        /// </returns>
        /// <remarks>
        /// Resource keys are: ControlTitle_[key].Text
        /// Key MUST be lowercase in the resource file
        /// Key can also be "blank" for admin/edit controls. These will only be used
        /// in admin pages
        /// </remarks>
        /// -----------------------------------------------------------------------------
        public static string LocalizeControlTitle(IModuleControl moduleControl)
        {
            string controlTitle = moduleControl.ModuleContext.Configuration.ModuleTitle;
            string controlKey = moduleControl.ModuleContext.Configuration.ModuleControl.ControlKey.ToLower();

            if (!string.IsNullOrEmpty(controlKey))
            {
                string reskey = "ControlTitle_" + moduleControl.ModuleContext.Configuration.ModuleControl.ControlKey.ToLower() + ".Text";
                string localizedvalue = GetString(reskey, moduleControl.LocalResourceFile);
                if (string.IsNullOrEmpty(localizedvalue))
                {
                    controlTitle = moduleControl.ModuleContext.Configuration.ModuleControl.ControlTitle;
                }
                else
                {
                    controlTitle = localizedvalue;
                }
            }
            else
            {
                bool isAdminPage = false;
                //we should be checking that the tab path matches //Admin//pagename or //admin
                //in this way we should avoid partial matches (ie //Administrators
                if (PortalSettings.Current.ActiveTab.TabPath.StartsWith("//Admin//", StringComparison.CurrentCultureIgnoreCase) ||
                    String.Compare(PortalSettings.Current.ActiveTab.TabPath, "//Admin", StringComparison.OrdinalIgnoreCase) == 0 ||
                    PortalSettings.Current.ActiveTab.TabPath.StartsWith("//Host//", StringComparison.CurrentCultureIgnoreCase) ||
                    String.Compare(PortalSettings.Current.ActiveTab.TabPath, "//Host", StringComparison.OrdinalIgnoreCase) == 0
                    )
                {
                    isAdminPage = true;
                }

                string reskey = "ControlTitle_.Text";
                string localizedvalue = GetString(reskey, moduleControl.LocalResourceFile);
                if (!string.IsNullOrEmpty(localizedvalue) && isAdminPage)
                {
                    controlTitle = localizedvalue;
                }
            }
            return controlTitle;
        }
 public ViewModelContext (Control control, IModuleControl module)
 {
     Module = module.ModuleContext;
     LocalResourceFile = DotNetNuke.Web.UI.Utilities.GetLocalResourceFile (control);
 }
 public ViewModelContext (IModuleControl module)
 {
     Module = module.ModuleContext;
     LocalResourceFile = module.LocalResourceFile;
 }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:R7.Dnn.Extensions.ViewModels.ViewModelContext"/> class.
 /// </summary>
 /// <param name="module">Module control.</param>
 public ViewModelContext(IModuleControl module)
 {
     Module            = module.ModuleContext;
     LocalResourceFile = module.LocalResourceFile;
 }
示例#27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:R7.Dnn.Extensions.ViewModels.ViewModelContext`1"/> class.
 /// </summary>
 /// <param name="control">Control.</param>
 /// <param name="module">Module control.</param>
 /// <param name="settings">Settings.</param>
 public ViewModelContext(Control control, IModuleControl module, TSettings settings) : base(control, module)
 {
     Settings = settings;
 }
 public ModuleSecurityContext(UserInfo user, IModuleControl module) : this(user)
 {
     Module = module;
 }
示例#29
0
 internal AdvancedFrame(IModuleControl aModuleControl, string aUri)
     : base(aModuleControl, "<iframe id='{0}' class='frame' src='{1}' />", aModuleControl.Id, aUri)
 {
 }
		public DivisionSettings (IModuleControl module) : base (module)
		{
		}
 public DivisionDirectorySettings (IModuleControl module): base (module)
 {
 }
示例#32
0
        private ModuleInstanceContext GetModuleContext()
        {
            IModuleControl moduleControl = this.modulePipeline.CreateModuleControl(this.ActiveModule) as IModuleControl;

            return(new ModuleInstanceContext(moduleControl));
        }
示例#33
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes ModuleControl Titles
        /// </summary>
        /// <param name="moduleControl">ModuleControl</param>
        /// <returns>
        /// Localized control title if found
        /// </returns>
        /// <remarks>
        /// Resource keys are: ControlTitle_[key].Text
        /// Key MUST be lowercase in the resource file
        /// </remarks>
        /// <history>
        /// 	[vmasanas]	08/11/2004	Created
        ///     [cnurse]    11/28/2008  Modified Signature
        /// </history>
        /// -----------------------------------------------------------------------------
        public static string LocalizeControlTitle(IModuleControl moduleControl)
        {
            string controlTitle = moduleControl.ModuleContext.Configuration.ModuleTitle;
            string controlKey = moduleControl.ModuleContext.Configuration.ModuleControl.ControlKey.ToLower();

            if (!string.IsNullOrEmpty(controlTitle) && !string.IsNullOrEmpty(controlKey))
            {
                controlTitle = moduleControl.ModuleContext.Configuration.ModuleControl.ControlTitle;
            }

            if (!string.IsNullOrEmpty(controlKey))
            {
                string reskey = "ControlTitle_" + moduleControl.ModuleContext.Configuration.ModuleControl.ControlKey.ToLower() + ".Text";
                string localizedvalue = GetString(reskey, moduleControl.LocalResourceFile);
                if (string.IsNullOrEmpty(localizedvalue))
                {
                    controlTitle = moduleControl.ModuleContext.Configuration.ModuleControl.ControlTitle;
                }
                else
                {
                    controlTitle = localizedvalue;
                }
            }
            return controlTitle;
        }
示例#34
0
 /// <summary>
 /// Formats the URL by DNN rules.
 /// </summary>
 /// <returns>Formatted URL.</returns>
 /// <param name="module">A module reference.</param>
 /// <param name="link">A link value. May be TabID, FileID=something or in other valid forms.</param>
 /// <param name="trackClicks">If set to <c>true</c> then track clicks.</param>
 public static string FormatURL(IModuleControl module, string link, bool trackClicks)
 {
     return(Globals.LinkClick(link, module.ModuleContext.TabId, module.ModuleContext.ModuleId, trackClicks));
 }
 public ModuleInstanceContext(IModuleControl moduleControl)
 {
     _moduleControl = moduleControl;
 }
示例#36
0
		public DocumentsSettings (IModuleControl module) : base (module)
		{
		}
		public EduProgramDirectorySettings (IModuleControl module) : base (module)
		{
		}
示例#38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:R7.Dnn.Extensions.ViewModels.ViewModelContext"/> class.
 /// </summary>
 /// <param name="control">Control.</param>
 /// <param name="module">Module control.</param>
 public ViewModelContext(Control control, IModuleControl module)
 {
     Module            = module.ModuleContext;
     LocalResourceFile = UiUtilities.GetLocalResourceFile(control);
 }
示例#39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleInstanceContext"/> class.
 /// </summary>
 /// <param name="moduleControl"></param>
 public ModuleInstanceContext(IModuleControl moduleControl)
 {
     this._moduleControl = moduleControl;
 }
  /// <summary>
 /// Formats the URL by DNN rules.
 /// </summary>
 /// <returns>Formatted URL.</returns>
 /// <param name="module">A module reference.</param>
 /// <param name="link">A link value. May be TabID, FileID=something or in other valid forms.</param>
 /// <param name="trackClicks">If set to <c>true</c> then track clicks.</param>
 public static string FormatURL (IModuleControl module, string link, bool trackClicks)
 {
     return Globals.LinkClick (link, module.ModuleContext.TabId, module.ModuleContext.ModuleId, trackClicks);
 }