Exemplo n.º 1
0
		public ILBreakpoint(Debugger debugger, ModuleId module, uint token, uint offset, Func<IILBreakpoint, bool> cond) {
			this.debugger = debugger;
			Module = module;
			Token = token;
			Offset = offset;
			this.cond = cond ?? condAlwaysTrue;
			isEnabled = true;
		}
Exemplo n.º 2
0
		DnModule GetDnModule(ModuleId moduleId) {
			var dbg = theDebugger.Value.Debugger;
			if (dbg == null)
				return null;
			//TODO: This method should have an AppDomain parameter.
			foreach (var m in dbg.Modules) {
				if (m.DnModuleId.ToModuleId().Equals(moduleId))
					return m;
			}
			return null;
		}
 public int GetLanguage(IVsHierarchy pHierarchy, uint itemid, IVsTextBufferCoordinator pBufferCoordinator, out IVsContainedLanguage ppLanguage)
 {
     ModuleId id = new ModuleId(pHierarchy, itemid);
     NemerleContainedLanguage lang;
     if (!languages.TryGetValue(id, out lang))
     {
         lang = new NemerleContainedLanguage(pBufferCoordinator, intellisenseProject, itemid, pHierarchy);
         languages.Add(id, lang);
     }
     ppLanguage = lang;
     return VSConstants.S_OK;
 }
Exemplo n.º 4
0
		public DebuggerModule(Debugger debugger, DnModule mod) {
			debugger.Dispatcher.VerifyAccess();
			this.debugger = debugger;
			this.mod = mod;
			hashCode = mod.GetHashCode();
			uniqueId = mod.UniqueId;
			name = mod.Name;
			address = mod.Address;
			size = mod.Size;
			var moduleId = mod.DnModuleId;
			this.moduleId = new ModuleId(moduleId.AssemblyFullName, moduleId.ModuleName, moduleId.IsDynamic, moduleId.IsInMemory, moduleId.ModuleNameOnly);
		}
Exemplo n.º 5
0
		internal void RefreshIfNameError(ModuleId moduleId) {
			if (!NameError)
				return;

			var dnbp = Breakpoint.DnBreakpoint as DnILCodeBreakpoint;
			if (dnbp == null)
				return;
			if (dnbp.Module.ToModuleId() != moduleId)
				return;

			// If we still can't resolve the method, there's no need to refresh the name field
			if (GetMethodDef(true) == null)
				return;

			RefreshNameField();
		}
Exemplo n.º 6
0
 /// <inheritdoc />
 public override IEnumerable <string> GetMountNames(string frontEnd, ModuleId moduleId)
 {
     return(m_mounts.Keys);
 }
Exemplo n.º 7
0
        private void SetupColorbox()
        {
            // mojoBasePage basePage = Page as mojoBasePage;
            // if (basePage != null) { basePage.ScriptConfig.IncludeColorBox = true; }

            StringBuilder script = new StringBuilder();

            script.Append("$(document).ready(function() {");
            script.Append("$(\".cbg");
            script.Append(ModuleId.ToInvariantString());
            script.Append("\").colorbox(");

            script.Append("{");

            script.Append("rel:'cbg" + ModuleId.ToInvariantString() + "'");

            script.Append(",current: \"" + GalleryResources.ImageCountJsFormat + "\"");
            script.Append(",previous: \"" + GalleryResources.Previous + "\"");
            script.Append(",next: \"" + GalleryResources.Next + "\"");
            script.Append(",close: \"" + GalleryResources.Close + "\"");

            if (config.ColorBoxTransition != GalleryConfiguration.ColorBoxDefaultTransition)
            {
                script.Append(",transition:\"" + config.ColorBoxTransition + "\"");
            }

            if (config.ColorBoxTransitionSpeed != GalleryConfiguration.ColorBoxDefaultTransitionSpeed)
            {
                script.Append(",speed:" + config.ColorBoxTransitionSpeed);
            }

            script.Append(",opacity:" + config.ColorBoxOpacity);

            if (config.ColorBoxUseSlideshow != GalleryConfiguration.ColorBoxDefaultUseSlideShow)
            {
                script.Append(",slideshow:" + config.ColorBoxUseSlideshow.ToString().ToLower());
            }

            if (config.ColorBoxUseSlideshow)
            {
                if (config.ColorBoxSlideShowStartAuto)
                {
                    script.Append(",open:true");
                }

                script.Append(",slideshowSpeed: " + config.ColorBoxSlideshowSpeed);

                if (config.ColorBoxSlideshowAuto != GalleryConfiguration.ColorBoxDefaultUseSlideShow)
                {
                    script.Append(",slideshowAuto: " + config.ColorBoxSlideshowAuto.ToString().ToLower());
                }

                script.Append(",slideshowStart: \"" + GalleryResources.StartSlideShow + "\"");
                script.Append(",slideshowStop: \"" + GalleryResources.StopSlideShow + "\"");
            }

            script.Append(",maxWidth:'95%',maxHeight:'95%'");

            script.Append("}");

            script.Append(");");
            script.Append("});");

            ScriptManager.RegisterStartupScript(Page, typeof(Page),
                                                "img" + ModuleId.ToInvariantString(), "\n<script type=\"text/javascript\">\n"
                                                + script.ToString()
                                                + "\n</script>", false);

            // make it responsive
            //https://github.com/jackmoore/colorbox/issues/158

            script = new StringBuilder();

            script.Append("var resizeTimer; ");
            script.Append("$(window).resize(function(){");
            script.Append("if (resizeTimer) clearTimeout(resizeTimer); ");
            script.Append("resizeTimer = setTimeout(function() {");
            script.Append("if ($('#cboxOverlay').is(':visible')) {");
            script.Append("$.colorbox.load(true); ");
            script.Append("}");
            script.Append("}, 300)");
            script.Append("});");

            script.Append("window.addEventListener('orientationchange', function() {");
            script.Append("if($('#cboxOverlay').is(':visible')){");
            script.Append("$.colorbox.load(true); ");
            script.Append("}");
            script.Append("}, false); ");


            ScriptManager.RegisterStartupScript(Page, typeof(Page),
                                                "colorboxresizer", "\n<script type=\"text/javascript\">\n"
                                                + script.ToString()
                                                + "\n</script>", false);
        }
Exemplo n.º 8
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "topic": // VarChar
                return(PropertyAccess.FormatString(Topic, strFormat));

            case "locale": // VarChar
                return(PropertyAccess.FormatString(Locale, strFormat));

            case "edition": // Int
                return(Edition.ToString(strFormat, formatProvider));

            case "version": // VarChar
                return(PropertyAccess.FormatString(Version, strFormat));

            case "title": // NVarChar
                return(PropertyAccess.FormatString(Title, strFormat));

            case "parenttopic": // VarChar
                if (ParentTopic == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(ParentTopic, strFormat));

            case "previoustopic": // VarChar
                if (PreviousTopic == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(PreviousTopic, strFormat));

            case "nexttopic": // VarChar
                if (NextTopic == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(NextTopic, strFormat));

            case "contents": // NVarCharMax
                if (Contents == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Contents, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemplo n.º 9
0
        /// <inheritdoc />
        public override BuildXL.FrontEnd.Sdk.TryGetMountResult TryGetMount(string name, ModuleId currentPackage, out IMount mount)
        {
            Contract.Requires(currentPackage.IsValid);

            if (string.IsNullOrEmpty(name))
            {
                mount = null;
                return(BuildXL.FrontEnd.Sdk.TryGetMountResult.NameNullOrEmpty);
            }

            var result = m_mountsByName.TryGetValue(name, out mount)
                ? BuildXL.FrontEnd.Sdk.TryGetMountResult.Success
                : BuildXL.FrontEnd.Sdk.TryGetMountResult.NameNotFound;

            // If the mount is found but it is not a static one and the mount table is not finalized, then this means the call is happening
            // before the workspace is fully constructed and we shouldn't expose non-static mounts
            if (!m_finalized && result == BuildXL.FrontEnd.Sdk.TryGetMountResult.Success)
            {
                // We shouldn't expose non-static mounts if the mount table is not finalized
                return(mount.IsStatic ? result : BuildXL.FrontEnd.Sdk.TryGetMountResult.NameNotFound);
            }

            return(result);
        }
Exemplo n.º 10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var dr = DataProvider.Instance().GetPosts(PortalId, AuthorizedForums, Settings.TopicsOnly, Settings.RandomOrder, Settings.Rows, Settings.Tags);

            var sb = new StringBuilder(Settings.Header);

            var useFriendly = Utilities.IsRewriteLoaded();
            var sHost       = Utilities.GetHost();

            try
            {
                while (dr.Read())
                {
                    var groupName     = Convert.ToString(dr["GroupName"]);
                    var groupId       = Convert.ToInt32(dr["ForumGroupId"]);
                    var topicTabId    = Convert.ToInt32(dr["TabId"]);
                    var topicModuleId = Convert.ToInt32(dr["ModuleId"]);
                    var forumName     = Convert.ToString(dr["ForumName"]);
                    var forumId       = Convert.ToInt32(dr["ForumId"]);
                    var subject       = Convert.ToString(dr["Subject"]);
                    var userName      = Convert.ToString(dr["AuthorUserName"]);
                    var firstName     = Convert.ToString(dr["AuthorFirstName"]);
                    var lastName      = Convert.ToString(dr["AuthorLastName"]);
                    var authorId      = Convert.ToInt32(dr["AuthorId"]);
                    var displayName   = Convert.ToString(dr["AuthorDisplayName"]);
                    var postDate      = Convert.ToDateTime(dr["DateCreated"]);
                    var body          = Utilities.StripHTMLTag(Convert.ToString(dr["Body"]));
                    var topicId       = Convert.ToInt32(dr["TopicId"]);
                    var replyId       = Convert.ToInt32(dr["ReplyId"]);
                    var bodyHtml      = Convert.ToString(dr["Body"]);
                    var replyCount    = Convert.ToInt32(dr["ReplyCount"]);

                    var sForumUrl       = dr["PrefixURL"].ToString();
                    var sTopicUrl       = dr["TopicURL"].ToString();
                    var sGroupPrefixUrl = dr["GroupPrefixURL"].ToString();

                    var ts         = DataCache.MainSettings(topicModuleId);
                    var timeOffset = (int)UserInfo.Profile.PreferredTimeZone.GetUtcOffset(postDate).TotalMinutes;

                    // Use a stringBuilder for better performance;
                    var sbTemplate = new StringBuilder(Settings.Format ?? string.Empty);

                    sbTemplate = sbTemplate.Replace("[FORUMGROUPNAME]", groupName);
                    sbTemplate = sbTemplate.Replace("[FORUMGROUPID]", groupId.ToString());
                    sbTemplate = sbTemplate.Replace("[TOPICTABID]", topicTabId.ToString());
                    sbTemplate = sbTemplate.Replace("[TOPICMODULEID]", topicModuleId.ToString());
                    sbTemplate = sbTemplate.Replace("[FORUMNAME]", forumName);
                    sbTemplate = sbTemplate.Replace("[FORUMID]", forumId.ToString());
                    sbTemplate = sbTemplate.Replace("[SUBJECT]", subject);
                    sbTemplate = sbTemplate.Replace("[AUTHORUSERNAME]", userName);
                    sbTemplate = sbTemplate.Replace("[AUTHORFIRSTNAME]", firstName);
                    sbTemplate = sbTemplate.Replace("[AUTHORLASTNAME]", lastName);
                    sbTemplate = sbTemplate.Replace("[AUTHORID]", authorId.ToString());
                    sbTemplate = sbTemplate.Replace("[AUTHORDISPLAYNAME]", displayName);
                    sbTemplate = sbTemplate.Replace("[DATE]", Utilities.GetDate(postDate, topicModuleId, timeOffset));
                    sbTemplate = sbTemplate.Replace("[TOPICID]", topicId.ToString());
                    sbTemplate = sbTemplate.Replace("[REPLYID]", replyId.ToString());
                    sbTemplate = sbTemplate.Replace("[REPLYCOUNT]", replyCount.ToString());

                    if (useFriendly && !(string.IsNullOrEmpty(sForumUrl) && string.IsNullOrEmpty(sTopicUrl)))
                    {
                        var ctlUtils = new ControlUtils();

                        sTopicUrl = ctlUtils.BuildUrl(topicTabId, topicModuleId, sGroupPrefixUrl, sForumUrl, groupId, forumId, topicId, sTopicUrl, -1, -1, string.Empty, 1, replyId, -1);
                        sForumUrl = ctlUtils.BuildUrl(topicTabId, topicModuleId, sGroupPrefixUrl, sForumUrl, groupId, forumId, -1, string.Empty, -1, -1, string.Empty, 1, replyId, -1);

                        if (sHost.EndsWith("/") && sForumUrl.StartsWith("/"))
                        {
                            sForumUrl = sForumUrl.Substring(1);
                        }

                        if (!(sForumUrl.StartsWith(sHost)))
                        {
                            sForumUrl = sHost + sForumUrl;
                        }

                        if (sHost.EndsWith("/") && sTopicUrl.StartsWith("/"))
                        {
                            sTopicUrl = sTopicUrl.Substring(1);
                        }

                        if (!(sTopicUrl.StartsWith(sHost)))
                        {
                            sTopicUrl = sHost + sTopicUrl;
                        }

                        if (Convert.ToInt32(replyId) == 0)
                        {
                            sbTemplate = sbTemplate.Replace("[POSTURL]", sTopicUrl);
                            sbTemplate = sbTemplate.Replace("[SUBJECTLINK]", "<a href=\"" + sTopicUrl + "\">" + subject + "</a>");
                        }
                        else
                        {
                            if (!(sTopicUrl.EndsWith("/")) && !(sTopicUrl.EndsWith("aspx")))
                            {
                                sTopicUrl += "/";
                            }
                            sTopicUrl += "?afc=" + replyId;
                            sbTemplate = sbTemplate.Replace("[POSTURL]", sTopicUrl);
                            sbTemplate = sbTemplate.Replace("[SUBJECTLINK]", "<a href=\"" + sTopicUrl + "\">" + subject + "</a>");
                        }

                        sbTemplate = sbTemplate.Replace("[TOPICSURL]", sForumUrl);
                    }
                    else
                    {
                        if (replyId == 0)
                        {
                            sbTemplate = sbTemplate.Replace("[POSTURL]", Common.Globals.NavigateURL(topicTabId, "", new[] { ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId }));
                            sbTemplate = sbTemplate.Replace("[SUBJECTLINK]", "<a href=\"" + Common.Globals.NavigateURL(topicTabId, "", new[] { ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId }) + "\">" + subject + "</a>");
                        }
                        else
                        {
                            sbTemplate = sbTemplate.Replace("[POSTURL]", Common.Globals.NavigateURL(topicTabId, "", new[] { ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId }));
                            sbTemplate = sbTemplate.Replace("[SUBJECTLINK]", "<a href=\"" + Common.Globals.NavigateURL(topicTabId, "", new[] { ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId }) + "\">" + subject + "</a>");
                        }
                        sbTemplate = sbTemplate.Replace("[TOPICSURL]", Common.Globals.NavigateURL(topicTabId, "", new[] { ParamKeys.ViewType + "=" + Views.Topics, ParamKeys.ForumId + "=" + forumId }));
                    }


                    sbTemplate = sbTemplate.Replace("[FORUMURL]", Common.Globals.NavigateURL(topicTabId));

                    // Do the body replacements last as they are the most likely to contain conflicts.

                    sbTemplate = sbTemplate.Replace("[BODY]", body);
                    sbTemplate = sbTemplate.Replace("[BODYHTML]", bodyHtml);
                    sbTemplate = sbTemplate.Replace("[BODYTEXT]", Utilities.StripHTMLTag(bodyHtml));

                    var template = sbTemplate.ToString();

                    // Do this regex replace first before moving on to the simpler ones.
                    template = Regex.Replace(template, @"\[BODY\:\s*(\d+)\s*\]", m => SafeSubstring(body, int.Parse(m.Groups[1].Value)), RegexOptions.IgnoreCase);

                    sb.Append(template);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                if (!dr.IsClosed)
                {
                    dr.Close();
                }
                sb.Append(ex.StackTrace);
            }

            var sRSSImage    = string.Empty;
            var sRSSUrl      = string.Empty;
            var sRSSIconLink = string.Empty;

            if (Settings.RSSEnabled)
            {
                sRSSImage    = "<img src=\"" + Page.ResolveUrl("~/DesktopModules/ActiveForums/images/feedicon.gif") + "\" border=\"0\" />";
                sRSSUrl      = Page.ResolveUrl("~/desktopmodules/activeforumswhatsnew/feeds.aspx") + "?portalId=" + PortalId + "&tabid=" + TabId.ToString() + "&moduleid=" + ModuleId.ToString();
                sRSSIconLink = "<a href=\"" + sRSSUrl + "\">" + sRSSImage + "</a>";
            }

            var footer = Settings.Footer;

            footer = footer.Replace("[RSSICON]", sRSSImage);
            footer = footer.Replace("[RSSURL]", sRSSUrl);
            footer = footer.Replace("[RSSICONLINK]", sRSSIconLink);

            sb.Append(footer);

            Controls.Add(new LiteralControl(sb.ToString()));
        }
Exemplo n.º 11
0
		public IILBreakpoint CreateBreakpoint(ModuleId module, uint token, uint offset, Func<IILBreakpoint, bool> cond) => dispatcher.UI(() => {
			var bp = new ILBreakpoint(this, module, token, offset, cond);
			if (theDebugger.IsDebugging) {
				Debug.Assert(breakpointsToInitialize.Count == 0);
				Initialize(bp);
			}
			else
				breakpointsToInitialize.Add(bp);
			return bp;
		});
Exemplo n.º 12
0
        public static void CliOperate(string direction = "", bool isFire = false, int playerId = 0, int userId = 1, ModuleId moduleId = ModuleId.Game)
        {
            CliOperate cliOperate = new CliOperate();

            cliOperate.Direction = direction;
            cliOperate.IsFire    = isFire;
            cliOperate.PlayerId  = playerId;

            CliReq req = CreateCliReq(ClientMsgType.CliOperate, userId, moduleId);

            req.CliOperate = cliOperate;

            UdpSocket.Send(Serialize(req));
        }
Exemplo n.º 13
0
 public string GetFullPathToModuleWorkingDirectory(ModuleId moduleId)
 {
     return Path.Combine(FullPathToRootDataDirectory, "Modules", moduleId.GetFilePathFriendlyString(), "WorkDir");
 }
Exemplo n.º 14
0
		public IDebuggerModule GetModule(ModuleId name) => dispatcher.UI(() => FirstAppDomain?.GetModule(name));
Exemplo n.º 15
0
		public INativeBreakpoint CreateNativeBreakpoint(ModuleId module, uint token, int offset, Func<INativeBreakpoint, bool> cond) =>
			CreateNativeBreakpoint(module, token, (uint)offset, cond);
Exemplo n.º 16
0
		public INativeBreakpoint CreateNativeBreakpoint(ModuleId module, uint token, uint offset, Func<INativeBreakpoint, bool> cond) => dispatcher.UI(() => {
			if (!theDebugger.IsDebugging)
				throw new InvalidOperationException("Native breakpoints can only be set on jitted methods");
			var bp = new NativeBreakpoint(this, module, token, offset, cond);
			Initialize(bp);
			return bp;
		});
Exemplo n.º 17
0
 /// <summary>
 /// Tries to get the mount from the mounts table.
 /// </summary>
 /// <remarks>
 /// One has to pass the current package because mounts could be defined on a per package basis.
 /// This method takes care of reporting errors
 /// </remarks>
 public abstract TryGetMountResult TryGetMount(string name, ModuleId currentPackage, out IMount mount);
Exemplo n.º 18
0
        public IotHubConnectionString(IotHubConnectionStringBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            Audience = builder.HostName;
            HostName = string.IsNullOrEmpty(builder.GatewayHostName)
                ? builder.HostName
                : builder.GatewayHostName;
            SharedAccessKeyName   = builder.SharedAccessKeyName;
            SharedAccessKey       = builder.SharedAccessKey;
            SharedAccessSignature = builder.SharedAccessSignature;
            IotHubName            = builder.IotHubName;
            DeviceId = builder.DeviceId;
            ModuleId = builder.ModuleId;

            HttpsEndpoint = new UriBuilder(Uri.UriSchemeHttps, HostName).Uri;

            AmqpEndpoint = new UriBuilder(CommonConstants.AmqpsScheme, HostName, DefaultSecurePort).Uri;

            if (builder.AuthenticationMethod is AuthenticationWithTokenRefresh)
            {
                TokenRefresher = (AuthenticationWithTokenRefresh)builder.AuthenticationMethod;
                if (Logging.IsEnabled)
                {
                    Logging.Info(this, $"{nameof(IAuthenticationMethod)} is {nameof(AuthenticationWithTokenRefresh)}: {Logging.IdOf(TokenRefresher)}");
                }

                if (Logging.IsEnabled)
                {
                    Logging.Associate(this, TokenRefresher, nameof(TokenRefresher));
                }

                Debug.Assert(TokenRefresher != null);
            }
            else if (!string.IsNullOrEmpty(SharedAccessKey))
            {
                if (ModuleId.IsNullOrWhiteSpace())
                {
                    TokenRefresher = new DeviceAuthenticationWithSakRefresh(DeviceId, this) as AuthenticationWithTokenRefresh;
                    if (Logging.IsEnabled)
                    {
                        Logging.Info(this, $"{nameof(IAuthenticationMethod)} is {nameof(DeviceAuthenticationWithSakRefresh)}: {Logging.IdOf(TokenRefresher)}");
                    }
                }
                else
                {
                    TokenRefresher = new ModuleAuthenticationWithSakRefresh(DeviceId, ModuleId, this) as AuthenticationWithTokenRefresh;
                    if (Logging.IsEnabled)
                    {
                        Logging.Info(this, $"{nameof(IAuthenticationMethod)} is {nameof(ModuleAuthenticationWithSakRefresh)}: {Logging.IdOf(TokenRefresher)}");
                    }
                }

                if (Logging.IsEnabled)
                {
                    Logging.Associate(this, TokenRefresher, nameof(TokenRefresher));
                }

                Debug.Assert(TokenRefresher != null);
            }
        }
Exemplo n.º 19
0
 protected string FormatEditUrl(int itemId)
 {
     return(SiteRoot + "/SuperFlexi/Edit.aspx?ItemID=" + itemId.ToInvariantString()
            + "&mid=" + ModuleId.ToInvariantString()
            + "&pageid=" + PageId.ToInvariantString());
 }
Exemplo n.º 20
0
        private void LoadSettings()
        {
            Module module = new Module(ModuleGuid);

            config = new ModuleConfiguration(module);
            //PageSettings currentPage = CacheHelper.GetCurrentPage();

            if (config.MarkupDefinition != null)
            {
                displaySettings = config.MarkupDefinition;
            }

            if (ModuleConfiguration != null)
            {
                Title       = ModuleConfiguration.ModuleTitle;
                Description = ModuleConfiguration.FeatureName;
            }
            StringBuilder moduleTitle = new StringBuilder();

            moduleTitle.Append(displaySettings.ModuleTitleMarkup);
            SuperFlexiHelpers.ReplaceStaticTokens(moduleTitle, config, IsEditable, displaySettings, module, currentPage, siteSettings, out moduleTitle);
            litModuleTitle.Text = moduleTitle.ToString();

            if (config.InstanceCssClass.Length > 0 && !config.HideOuterWrapperPanel)
            {
                pnlOuterWrap.SetOrAppendCss(config.InstanceCssClass.Replace("$_ModuleID_$", ModuleId.ToString()));
            }

            if (SiteUtils.IsMobileDevice() && config.MobileInstanceCssClass.Length > 0 && !config.HideOuterWrapperPanel)
            {
                pnlOuterWrap.SetOrAppendCss(config.MobileInstanceCssClass.Replace("$_ModuleID_$", ModuleId.ToString()));
            }

            theWidget.Config = config;
            if (currentPage != null)
            {
                theWidget.PageId      = currentPage.PageId;
                theWidget.CurrentPage = currentPage;
            }
            theWidget.ModuleId      = ModuleId;
            theWidget.IsEditable    = IsEditable;
            theWidget.SiteRoot      = SiteRoot;
            theWidget.ImageSiteRoot = ImageSiteRoot;

            //theWidgetRazor.Config = config;
            //theWidgetRazor.PageId = PageId;
            //theWidgetRazor.ModuleId = ModuleId;
            //theWidgetRazor.IsEditable = IsEditable;
            //theWidgetRazor.SiteRoot = SiteRoot;
            //theWidgetRazor.ImageSiteRoot = ImageSiteRoot;

            theWidget.Visible = true;
            //theWidgetRazor.Visible = config.UseRazor;

            if (config.UseHeader && config.HeaderLocation != "InnerBodyPanel" && !String.IsNullOrWhiteSpace(config.HeaderContent) && !String.Equals(config.HeaderContent, "<p>&nbsp;</p>"))
            {
                StringBuilder headerContent = new StringBuilder();
                headerContent.AppendFormat(displaySettings.HeaderContentFormat, config.HeaderContent);
                SuperFlexiHelpers.ReplaceStaticTokens(headerContent, config, IsEditable, displaySettings, module, currentPage, siteSettings, out headerContent);
                LiteralControl litHeaderContent = new LiteralControl(headerContent.ToString());
                //if HeaderLocation is set to a hidden panel the header will be added to the Outside.
                switch (config.HeaderLocation)
                {
                default:
                    break;

                case "OuterBodyPanel":
                    if (config.HideOuterBodyPanel)
                    {
                        goto case "Outside";
                    }
                    pnlOuterBody.Controls.AddAt(0, litHeaderContent);
                    break;

                case "InnerWrapperPanel":
                    if (config.HideInnerWrapperPanel)
                    {
                        goto case "Outside";
                    }
                    pnlInnerWrap.Controls.AddAt(0, litHeaderContent);
                    break;

                case "OuterWrapperPanel":
                    if (config.HideOuterWrapperPanel)
                    {
                        goto case "Outside";
                    }
                    pnlOuterWrap.Controls.AddAt(0, litHeaderContent);
                    break;

                case "Outside":
                    litHead.Text = headerContent.ToString();
                    break;
                }
            }

            if (config.UseFooter && config.FooterLocation != "InnerBodyPanel" && !String.IsNullOrWhiteSpace(config.FooterContent) && !String.Equals(config.FooterContent, "<p>&nbsp;</p>"))
            {
                StringBuilder footerContent = new StringBuilder();
                footerContent.AppendFormat(displaySettings.FooterContentFormat, config.FooterContent);
                SuperFlexiHelpers.ReplaceStaticTokens(footerContent, config, IsEditable, displaySettings, module, currentPage, siteSettings, out footerContent);
                LiteralControl litFooterContent = new LiteralControl(footerContent.ToString());
                //if FooterLocation is set to a hidden panel the footer will be added to the Outside.
                switch (config.FooterLocation)
                {
                default:
                    break;

                case "OuterBodyPanel":
                    if (config.HideOuterBodyPanel)
                    {
                        goto case "Outside";
                    }
                    pnlOuterBody.Controls.Add(litFooterContent);
                    break;

                case "InnerWrapperPanel":
                    if (config.HideInnerWrapperPanel)
                    {
                        goto case "Outside";
                    }
                    pnlInnerWrap.Controls.Add(litFooterContent);
                    break;

                case "OuterWrapperPanel":
                    if (config.HideOuterWrapperPanel)
                    {
                        goto case "Outside";
                    }
                    pnlOuterWrap.Controls.Add(litFooterContent);
                    break;

                case "Outside":
                    litFoot.Text = footerContent.ToString();
                    break;
                }
            }

            pnlOuterWrap.RenderContentsOnly = config.HideOuterWrapperPanel;
            pnlInnerWrap.RenderContentsOnly = config.HideInnerWrapperPanel;
            pnlOuterBody.RenderContentsOnly = config.HideOuterBodyPanel;
            pnlInnerBody.RenderContentsOnly = config.HideInnerBodyPanel;
        }
Exemplo n.º 21
0
 public DbgLanguageDebugInfoKey(ModuleId moduleId, uint token)
 {
     this.token    = token;
     this.moduleId = moduleId;
     module        = null;
 }
Exemplo n.º 22
0
		public static void GoToIL(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, ModuleId moduleId, uint token, uint ilOffset, bool newTab) {
			var file = moduleLoader.LoadModule(moduleId, canLoadDynFile: true, diskFileOk: false, isAutoLoaded: true);
			GoToIL(moduleIdProvider, documentTabService, file, token, ilOffset, newTab);
		}
Exemplo n.º 23
0
 public string GetFullPathToModulePersistentManagerDirectory(ModuleId moduleId)
 {
     return Path.Combine(FullPathToRootDataDirectory, "Modules", moduleId.GetFilePathFriendlyString(), "Data");
 }
Exemplo n.º 24
0
		IDsDocument LoadNonDiskFile(ModuleId moduleId, bool canLoadDynFile) {
			if (UseMemoryModules || moduleId.IsDynamic || moduleId.IsInMemory) {
				var dnModule = GetDnModule(moduleId);
				if (dnModule != null)
					return inMemoryModuleService.Value.LoadDocument(dnModule, canLoadDynFile);
			}

			return null;
		}
Exemplo n.º 25
0
    public void TestScript()
    {
        var moduleId = new ModuleId();

        try
        {
            moduleId.Id = "Расчет режима(TP_PF_BB2BB_VA)";
            CommonService.StartMassUpdate();
            CommonService.RestrictDataAccess(moduleId);
            var tp    = ServiceLocator.Current.GetInstance <ITopologyProcessor>();
            var lf    = ServiceLocator.Current.GetInstance <ILoadflow>();
            var bb2bb = ServiceLocator.Current.GetInstance <IBB2BB2>();
            var va    = ServiceLocator.Current.GetInstance <IViolationAnalysis>();
            if (tp.StartProcessingCommand.CanExecute(null))
            {
                tp.StartProcessingCommand.Execute(null);
            }
            if (tp.NeedToMakeTopology)
            {
                if (tp.SyncUpdatePowerSystemCommand.CanExecute(null))
                {
                    tp.SyncUpdatePowerSystemCommand.Execute(null);
                }
                else if (tp.SyncStartProcessingCommand.CanExecute(null))
                {
                    tp.SyncStartProcessingCommand.Execute(null);
                }
                else
                {
                    tp.SyncRemoveCreatedObjectsCommand.Execute(null);
                    tp.SyncStartProcessingCommand.Execute(null);
                }
            }
            if (lf.StartLoadflow.CanExecute(false))
            {
                lf.SyncStartLoadflow.Execute(null);
            }

            var powerFlowSourceUid = Guid.Parse("10000dae-0000-0000-c000-0000006d746c");
            var allocatedSourceUid = Guid.Parse("10000D96-0000-0000-C000-0000006D746C");

            if (bb2bb.DecompositionCommand.CanExecute(powerFlowSourceUid))
            {
                bb2bb.DecompositionCommand.Execute(powerFlowSourceUid);
            }

            if (bb2bb.CalculationCommand.CanExecute(powerFlowSourceUid))
            {
                bb2bb.CalculationCommand.Execute(powerFlowSourceUid);
            }

            var vaSettingsModel = ServiceLocator.Current.GetInstance <ITNAViolationAnalysisSettings>();
            vaSettingsModel.DataSourceUids = new List <Guid> {
                powerFlowSourceUid, allocatedSourceUid
            };
            vaSettingsModel.SwitchCurrentCalcKind = SwitchCurrentCalculationKind.UseExternalFunction;

            if (va.cmdClearVAResults.CanExecute(false))
            {
                va.cmdSyncClearVAResults.Execute(null);
            }

            if (va.cmdStartVA.CanExecute(false))
            {
                va.cmdSyncStartVA.Execute(null);
            }
        }
        catch (System.Exception ex)
        {
            var eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
            eventAggregator.GetEvent <ProtocolMessageEvent>().
            Publish(new ProtocolMessage()
            {
                Content = ex.Message,
                Source  = "TestScript",
            });
        }
        finally
        {
            Monitel.TNA.MDA.Infrastructure.CommonService.StopMassUpdate();
            CommonService.CancelRestrictDataAccess(moduleId);
        }
    }
Exemplo n.º 26
0
		IDsDocument LoadExisting(ModuleId moduleId) {
			foreach (var file in AllActiveDocuments) {
				var otherId = moduleIdProvider.Create(file.ModuleDef);
				if (otherId.Equals(moduleId))
					return file;
			}

			foreach (var file in AllDocuments) {
				var moduleIdFile = moduleIdProvider.Create(file.ModuleDef);
				if (moduleIdFile.Equals(moduleId))
					return file;
			}

			return null;
		}
Exemplo n.º 27
0
        private void SetupColorbox()
        {
            string ifSlideshow()
            {
                var result = string.Empty;

                if (config.ColorBoxUseSlideshow)
                {
                    if (config.ColorBoxSlideShowStartAuto)
                    {
                        result += "open:true,";
                    }

                    result += $"slideshowSpeed: '{config.ColorBoxSlideshowSpeed}',";

                    if (config.ColorBoxSlideshowAuto != GalleryConfiguration.ColorBoxDefaultUseSlideShow)
                    {
                        result += $"slideshowAuto: '{config.ColorBoxSlideshowAuto.ToString().ToLower()}',";
                    }

                    result += $"slideshowStart: '{GalleryResources.StartSlideShow}',";
                    result += $"slideshowStop: '{GalleryResources.StopSlideShow}',";
                }

                return(result);
            }

            var script = $@"
$(document).ready(function() {{
	$('.cbg{ModuleId.ToInvariantString()}').colorbox({{
		rel: 'cbg{ModuleId.ToInvariantString()}',
		current: '{GalleryResources.ImageCountJsFormat}',
		previous: '{GalleryResources.Previous}',
		next: '{GalleryResources.Next}',
		close: '{GalleryResources.Close}',
		{(config.ColorBoxTransition != GalleryConfiguration.ColorBoxDefaultTransition ? $"transition: '{config.ColorBoxTransition}'," : string.Empty)}
		{(config.ColorBoxTransitionSpeed != GalleryConfiguration.ColorBoxDefaultTransitionSpeed ? $"speed: '{config.ColorBoxTransitionSpeed}'," : string.Empty)}
		opacity: '{config.ColorBoxOpacity}',
		{(config.ColorBoxUseSlideshow != GalleryConfiguration.ColorBoxDefaultUseSlideShow ? $"slideshow: '{config.ColorBoxUseSlideshow.ToString().ToLower()}'," : string.Empty)}
		{ifSlideshow()}
		maxWidth: '95%',
		maxHeight: '95%'
	}});
}});";

            ScriptManager.RegisterStartupScript(
                Page, typeof(Page),
                "img" + ModuleId.ToInvariantString(),
                $"\n<script>{script}\n</script>",
                false
                );

            // make it responsive
            //https://github.com/jackmoore/colorbox/issues/158

            var responsiveScript = @"
(function() {
	let resizeTimer;

	function onResize() {
		if (resizeTimer) {
			clearTimeout(resizeTimer);
		}

		function onTimeout() {
			if ($('#cboxOverlay').is(':visible')) {
				$.colorbox.load(true);
			}
		}

		resizeTimer = setTimeout(onTimeout, 300);
	}

	function onOrientationChange() {
		if ($('#cboxOverlay').is(':visible')) {
			$.colorbox.load(true);
		}
	}

	window.addEventListener('resize', onResize);
	window.addEventListener('orientationchange', onOrientationChange);
})();";

            ScriptManager.RegisterStartupScript(
                Page,
                typeof(Page),
                "colorboxresizer",
                $"\n<script>{responsiveScript}\n</script>",
                false
                );
        }
Exemplo n.º 28
0
		public IDsDocument LoadModule(ModuleId moduleId, bool canLoadDynFile, bool diskFileOk, bool isAutoLoaded) {
			IDsDocument document;
			if (diskFileOk) {
				document = LoadExisting(moduleId) ?? LoadNonDiskFile(moduleId, canLoadDynFile);
				if (document != null)
					return document;
			}
			else {
				document = LoadNonDiskFile(moduleId, canLoadDynFile) ?? LoadExisting(moduleId);
				if (document != null)
					return document;
			}

			if (moduleId.IsDynamic || moduleId.IsInMemory)
				return null;

			string moduleFilename = moduleId.ModuleName;
			if (!File.Exists(moduleFilename))
				return null;
			string asmFilename = GetAssemblyFilename(moduleFilename, moduleId.AssemblyFullName, moduleId.ModuleNameOnly);

			if (!string.IsNullOrEmpty(asmFilename)) {
				document = documentService.TryGetOrCreate(DsDocumentInfo.CreateDocument(asmFilename), isAutoLoaded);
				if (document == null)
					document = documentService.Resolve(new AssemblyNameInfo(moduleId.AssemblyFullName), null);
				if (document != null) {
					// Common case is a one-file assembly or first module of a multifile assembly
					if (asmFilename.Equals(moduleFilename, StringComparison.OrdinalIgnoreCase))
						return document;

					foreach (var child in document.Children) {
						if (child.Filename.Equals(moduleFilename, StringComparison.OrdinalIgnoreCase))
							return child;
					}
				}
			}

			return documentService.TryGetOrCreate(DsDocumentInfo.CreateDocument(moduleFilename), isAutoLoaded);
		}
Exemplo n.º 29
0
 /// <summary>
 /// Private constructor used for creating module specific mount tables
 /// </summary>
 private MountsTable(MountsTable parent, ModuleId moduleId)
     : this(parent.m_loggingContext, parent.m_context)
 {
     m_parent          = parent;
     MountPathExpander = parent.MountPathExpander.CreateModuleMountExpander(moduleId);
 }
Exemplo n.º 30
0
        private void LoadArticle()
        {
            var a = (Article)VersionInfoObject;

            if (a != null)
            {
                //VersionInfoObject.IsNew = false;
                if (a.ArticleText.Trim() == string.Empty)
                {
                    lblArticleText.Text = Localization.GetString("NothingSaved", LocalResourceFile);
                }
                else
                {
                    string articleText = a.ArticleText;
                    //removed until we move forward with a newer version of DNN 4.6.2 or greater.
                    //for enterprise licenses you can uncomment the following if you put the Dotnetnuke.dll (4.6.2+) in the engagepublish/references folder and recompile

                    articleText = Utility.ReplaceTokens(articleText);

                    var tr = new DotNetNuke.Services.Tokens.TokenReplace
                    {
                        AccessingUser = UserInfo,
                        DebugMessages = !DotNetNuke.Common.Globals.IsTabPreview()
                    };

                    articleText         = tr.ReplaceEnvironmentTokens(articleText);
                    lblArticleText.Text = articleText;
                }


                object m = Request.QueryString["modid"];
                if (m != null)
                {
                    if (m.ToString() == ModuleId.ToString())
                    {
                        //check if module id querystring is current moduleid
                        if ((IsAdmin && !VersionInfoObject.IsNew))
                        {
                            divAdminMenuWrapper.Visible = true;
                            divPublishApprovals.Visible = true;
                            divApprovalStatus.Visible   = true;
                            if (UseApprovals && Item.GetItemType(ItemId, PortalId).Equals("ARTICLE", StringComparison.OrdinalIgnoreCase))
                            {
                                FillDropDownList();
                            }
                            else
                            {
                                ddlApprovalStatus.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        divAdminMenuWrapper.Visible = false;
                    }
                }
            }
            else
            {
                lblArticleText.Text = Localization.GetString("NothingSaved", LocalResourceFile);
            }
        }
Exemplo n.º 31
0
        private void BindRepeater()
        {
            DataTable dt = gallery.GetThumbsByPage(PageNumber, thumbsPerPage);

            if (dt.Rows.Count > 0)
            {
                TotalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]);
                itemId     = Convert.ToInt32(dt.Rows[0]["ItemID"]);
                totalRows  = thumbsPerPage * TotalPages;
            }

            //this handles issue: when redirected back to page from edit page
            //if you deleted the last image on the page an error occurs
            //so decrement the pageNumber
            while (PageNumber > TotalPages)
            {
                PageNumber -= 1;

                dt = gallery.GetThumbsByPage(PageNumber, thumbsPerPage);
                if (dt.Rows.Count > 0)
                {
                    TotalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]);
                    itemId     = Convert.ToInt32(dt.Rows[0]["ItemID"]);
                }
            }

            if (TotalPages > 1)
            {
                if (this.RenderInWebPartMode)
                {
                    if (totalRows > this.thumbsPerPage)
                    {
                        Literal moreLink = new Literal();
                        moreLink.Text = "<a href='"
                                        + SiteRoot
                                        + "/" + ViewImagePage
                                        + "?ItemID=" + itemId.ToInvariantString()
                                        + "&amp;mid=" + ModuleId.ToInvariantString()
                                        + "&amp;pageid=" + PageId.ToInvariantString()
                                        + "&amp;pagenumber=" + PageNumber.ToInvariantString()
                                        + "'>" + GalleryResources.GalleryWebPartMoreLink
                                        + "</a>";

                        this.pnlGallery.Controls.Add(moreLink);
                        pager.Visible = false;
                    }
                }
                else
                {
                    pager.ShowFirstLast = true;
                    pager.PageSize      = thumbsPerPage;
                    pager.PageCount     = TotalPages;
                }
            }
            else
            {
                pager.Visible = false;
            }


            if (UseLightboxMode)
            {
                SetupColorbox();
            }

            this.rptGallery.DataSource = dt;
            this.rptGallery.DataBind();
        }
Exemplo n.º 32
0
 /// <summary>
 /// Creates a new <see cref="DbgDotNetCodeLocation"/> instance
 /// </summary>
 /// <param name="module">Module</param>
 /// <param name="token">Token of a method within the module</param>
 /// <param name="offset">IL offset of the location within the method body</param>
 /// <returns></returns>
 public abstract DbgDotNetCodeLocation Create(ModuleId module, uint token, uint offset);
Exemplo n.º 33
0
        private void LoadSettings()
        {
            gallery = new mojoPortal.Business.Gallery(ModuleId);
            try
            {
                // this keeps the action from changing during ajax postback in folder based sites
                SiteUtils.SetFormAction(Page, Request.RawUrl);
            }
            catch (MissingMethodException)
            {
                //this method was introduced in .NET 3.5 SP1
            }

            Title1.EditUrl  = SiteRoot + "/ImageGallery/EditImage.aspx";
            Title1.EditText = GalleryResources.GalleryAddImageLabel;
            Title1.Visible  = !this.RenderInWebPartMode;


            config = new GalleryConfiguration(Settings);

            if (IsEditable)
            {
                Title1.LiteralExtraMarkup = "&nbsp;<a href='"
                                            + SiteRoot
                                            + "/ImageGallery/BulkUpload.aspx?pageid=" + PageId.ToInvariantString()
                                            + "&amp;mid=" + ModuleId.ToInvariantString()
                                            + "' class='ModuleEditLink' title='" + GalleryResources.BulkUploadLink + "'>" + GalleryResources.BulkUploadLink + "</a>";
            }

            if (this.ModuleConfiguration != null)
            {
                Title       = this.ModuleConfiguration.ModuleTitle;
                Description = this.ModuleConfiguration.FeatureName;
            }

            UseSilverlightSlideshow = config.UseSlideShow;


            if (config.CustomCssClass.Length > 0)
            {
                pnlOuterWrap.SetOrAppendCss(config.CustomCssClass);
            }

            if (WebConfigSettings.ImageGalleryUseMediaFolder)
            {
                baseUrl = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + ModuleId.ToInvariantString() + "/";
            }
            else
            {
                baseUrl = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + ModuleId.ToInvariantString() + "/";
            }

            thumnailBaseUrl = baseUrl + "Thumbnails/";
            webSizeBaseUrl  = baseUrl + "WebImages/";
            fullSizeBaseUrl = baseUrl + "FullSizeImages/";

            imageFolderPath = HttpContext.Current.Server.MapPath(baseUrl);
            thumbsPerPage   = config.ThumbsPerPage;
            UseCompactMode  = config.UseCompactMode;

            if (RenderInWebPartMode)
            {
                UseCompactMode          = false;
                UseSilverlightSlideshow = false;
                thumbsPerPage           = 6;
            }

            if (UseCompactMode)
            {
                UseLightboxMode         = false;
                pnlImageDetails.Visible = false;
            }
            else
            {
                UseLightboxMode            = true;
                useViewState               = false;
                rptGallery.EnableViewState = false;
            }

            if (UseLightboxMode)
            {
                mojoBasePage basePage = Page as mojoBasePage;
                if (basePage != null)
                {
                    basePage.ScriptConfig.IncludeColorBox = true;
                    basePage.ScriptConfig.IncludeImageFit = false; // this seems needed for win7 phone
                }
            }

            imageBaseUrl = ImageSiteRoot;

            FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];

            if (p == null)
            {
                return;
            }

            fileSystem = p.GetFileSystem();
            if (fileSystem != null)
            {
                imageBaseUrl = fileSystem.FileBaseUrl;
            }
        }
Exemplo n.º 34
0
        private void RazorPageLoad()
        {
            NBrightInfo objCat = null;

            if (_templD.Trim() != "")  // if we don;t have a template, don't do anything
            {
                if (_displayentrypage)
                {
                    // get correct itemid, based on eid given
                    _eid = GetEntryIdFromName(_eid);
                    RazorDisplayDataEntry(_eid);
                }
                else
                {
                    // Get meta data from template

                    var metaTokens = NBrightBuyUtils.RazorPreProcessTempl(_templD, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings(), ModuleId.ToString());

                    #region "Order BY"

                    ////////////////////////////////////////////
                    // get ORDERBY SORT
                    ////////////////////////////////////////////
                    if (_orderbyindex != "") // if we have orderby set in url, find the meta tags
                    {
                        if (metaTokens.ContainsKey("orderby" + _orderbyindex))
                        {
                            if (metaTokens["orderby" + _orderbyindex].Contains("{") || metaTokens["orderby" + _orderbyindex].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy    = metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            else
                            {
                                _navigationdata.OrderBy    = " Order by " + metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            _navigationdata.Save();
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(_navigationdata.OrderBy) && metaTokens.ContainsKey("orderby"))
                        {
                            if (metaTokens["orderby"].Contains("{") || metaTokens["orderby"].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy = metaTokens["orderby"];
                            }
                            else
                            {
                                _navigationdata.OrderBy = " Order by " + metaTokens["orderby"];
                            }
                            _navigationdata.OrderByIdx = "";
                            _navigationdata.Save();
                        }
                    }


                    #endregion

                    #region "Get Paging setup"

                    //See if we have a pagesize, uses the "searchpagesize" tag token.
                    // : This can be overwritten by the cookie value if we need user selection of pagesize.
                    CtrlPaging.Visible = false;

                    #region "Get pagesize, from best place"

                    var pageSize = 0;
                    if (Utils.IsNumeric(ModSettings.Get("pagesize")))
                    {
                        pageSize = Convert.ToInt32(ModSettings.Get("pagesize"));
                    }
                    // overwrite default module pagesize , if we have a pagesize control in the template
                    if (metaTokens.ContainsKey("selectpagesize") && Utils.IsNumeric(_navigationdata.PageSize))
                    {
                        pageSize = Convert.ToInt32(_navigationdata.PageSize);
                    }
                    //check for url param page size
                    if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageSize = Convert.ToInt32(_pagesize);
                    }
                    if (pageSize == 0)
                    {
                        var strPgSize = "";
                        if (metaTokens.ContainsKey("searchpagesize"))
                        {
                            strPgSize = metaTokens["searchpagesize"];
                        }
                        if (metaTokens.ContainsKey("pagesize") && strPgSize == "")
                        {
                            strPgSize = metaTokens["pagesize"];
                        }
                        if (Utils.IsNumeric(strPgSize))
                        {
                            pageSize = Convert.ToInt32(strPgSize);
                        }
                    }
                    if (pageSize > 0)
                    {
                        CtrlPaging.Visible = true;
                    }
                    _navigationdata.PageSize = pageSize.ToString("");

                    #endregion

                    var pageNumber = 1;
                    //check for url param paging
                    if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageNumber = Convert.ToInt32(_pagenum);
                    }

                    //Get returnlimt from module settings
                    var returnlimit    = 0;
                    var strreturnlimit = ModSettings.Get("returnlimit");
                    if (Utils.IsNumeric(strreturnlimit))
                    {
                        returnlimit = Convert.ToInt32(strreturnlimit);
                    }

                    #endregion

                    #region "Get filter setup"

                    // check the display header to see if we have a sqlfilter defined.
                    var strFilter         = "";
                    var sqlTemplateFilter = "";
                    if (metaTokens.ContainsKey("sqlfilter"))
                    {
                        sqlTemplateFilter = GenXmlFunctions.StripSqlCommands(metaTokens["sqlfilter"]);
                    }

                    if (_navigationdata.HasCriteria)
                    {
                        var paramcatid = Utils.RequestQueryStringParam(Context, "catid");
                        if (Utils.IsNumeric(paramcatid))
                        {
                            if (_navigationdata.CategoryId != Convert.ToInt32(paramcatid)) // filter mode DOES NOT persist catid (stop confusion when user selects a category)
                            {
                                _navigationdata.ResetSearch();
                            }
                        }

                        // if navdata is not deleted then get filter from navdata, created by productsearch module.
                        strFilter = _navigationdata.Criteria;
                        if (!strFilter.Contains(sqlTemplateFilter))
                        {
                            strFilter += " " + sqlTemplateFilter;
                        }

                        if (_navigationdata.Mode.ToLower() == "s")
                        {
                            _navigationdata.ResetSearch();                                        // single search so clear after
                        }
                    }
                    else
                    {
                        // reset search if category selected
                        // NOTE: keeping search across categories is VERY confusing for cleint, although it works logically.
                        _navigationdata.ResetSearch();
                        strFilter = sqlTemplateFilter;
                    }

                    #endregion

                    #region "Get Category select setup"

                    var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
                    var dbOwner = DataProvider.Instance().DatabaseOwner;

                    //get default catid.
                    var catseo   = _catid;
                    var defcatid = ModSettings.Get("defaultcatid");
                    if (defcatid == "")
                    {
                        defcatid = "0";
                    }
                    if (Utils.IsNumeric(defcatid) && Convert.ToInt32(defcatid) > 0)
                    {
                        // if we have no filter use the default category
                        if (_catid == "" && strFilter.Trim() == "")
                        {
                            _catid = defcatid;
                        }
                    }
                    else
                    {
                        defcatid = ModSettings.Get("defaultpropertyid");
                        if (defcatid == "")
                        {
                            defcatid = "0";
                        }
                        if (Utils.IsNumeric(defcatid))
                        {
                            // if we have no filter use the default category
                            if (_catid == "" && strFilter.Trim() == "")
                            {
                                _catid = defcatid;
                            }
                        }
                    }

                    // If we have a static list,then always display the default category
                    if (ModSettings.Get("staticlist") == "True")
                    {
                        if (catseo == "")
                        {
                            catseo = _catid;
                        }
                        _catid = defcatid;
                        if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                        }
                        else
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                        }

                        if (ModSettings.Get("caturlfilter") == "True" && catseo != "" && catseo != _catid)
                        {
                            // add aditional filter for catid filter on url (catseo holds catid from url)
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + catseo + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + catseo + ") ";
                            }
                        }
                        // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                        if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                        {
                            _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                        }
                    }
                    else
                    {
                        #region "use url to get category to display"

                        //check if we are display categories
                        // get category list data
                        if (_catname != "") // if catname passed in url, calculate what the catid is
                        {
                            objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname);
                            if (objCat == null)
                            {
                                // check it's not just a single language
                                objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname);
                                if (objCat != null)
                                {
                                    _catid = objCat.ItemID.ToString("");
                                }
                            }
                            else
                            {
                                _catid = objCat.ParentItemId.ToString("");
                                if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture())
                                {
                                    // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge)
                                    var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());
                                    var activeCat  = catGrpCtrl.GetCategory(Convert.ToInt32(_catid));
                                    if (activeCat != null)
                                    {
                                        var redirecturl = "";
                                        if (Utils.IsNumeric(_eid))
                                        {
                                            var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                                            redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey);
                                        }
                                        else
                                        {
                                            redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, Utils.GetCurrentCulture());
                                        }

                                        try
                                        {
                                            if (redirecturl != "")
                                            {
                                                Response.Redirect(redirecturl, false);
                                                Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
                                                Response.End();
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            // catch err
                                        }
                                    }
                                }
                            }
                            // We have a category selected (in url), so overwrite categoryid navigationdata.
                            // This allows the return to the same category after a returning from a entry view.
                            if (Utils.IsNumeric(_catid))
                            {
                                _navigationdata.CategoryId = Convert.ToInt32(_catid);
                            }
                            catseo = _catid;
                            _navigationdata.ResetSearch();
                            strFilter = "";
                        }

                        if (Utils.IsNumeric(_catid))
                        {
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                            }

                            if (Utils.IsNumeric(catseo))
                            {
                                var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture());
                                if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title
                                {
                                    //Page Title
                                    var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    if (seoname == "")
                                    {
                                        seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }

                                    var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle");
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    }
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }
                                    if (newBaseTitle != "")
                                    {
                                        BasePage.Title = newBaseTitle;
                                    }
                                    //Page KeyWords
                                    var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords");
                                    if (newBaseKeyWords != "")
                                    {
                                        BasePage.KeyWords = newBaseKeyWords;
                                    }
                                    //Page Description
                                    var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription");
                                    if (newBaseDescription == "")
                                    {
                                        newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc");
                                    }
                                    if (newBaseDescription != "")
                                    {
                                        BasePage.Description = newBaseDescription;
                                    }


                                    // Remove canonical link for list.  The Open URL Rewriter (OUR) will create a url that is different to the default SEO url in NBS.
                                    // So to stop clashes it's been disable by default.  The requirment for a canonical link on a category list is more ticking the box than of being any SEO help (might even be causing confusion to Search Engines).
                                    // ** If your a SEO nutcases (or SEO companies pushing for it) then you can uncomment the code below, and you can implement the Open URL Rewriter and canonical link.

                                    //if (PortalSettings.HomeTabId == TabId)
                                    //    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                                    //else
                                    //{
                                    //    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture()));
                                    //    // Code required for OUR (if used, test to ensure it works correctly!!)
                                    //    //PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, "", Utils.GetCurrentCulture()));
                                    //}
                                }
                            }

                            // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                            }
                        }
                        else
                        {
                            if (!_navigationdata.FilterMode)
                            {
                                _navigationdata.CategoryId = 0;                              // filter mode persist catid
                            }
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = " Order by ModifiedDate DESC  ";
                            }
                        }

                        #endregion
                    }

                    // This allows the return to the same category after a returning from a entry view. + Gives support for current category in razor tokens
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.CategoryId = Convert.ToInt32(_catid);
                    }

                    #endregion

                    #region "Apply provider product filter"

                    // Special filtering can be done, by using the ProductFilter interface.
                    var productfilterkey = "";
                    if (metaTokens.ContainsKey("providerfilterkey"))
                    {
                        productfilterkey = metaTokens["providerfilterkey"];
                    }
                    if (productfilterkey != "")
                    {
                        var provfilter = FilterInterface.Instance(productfilterkey);
                        if (provfilter != null)
                        {
                            strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context);
                        }
                    }

                    #endregion

                    #region "itemlists (wishlist)"

                    // if we have a itemListName field then get the itemlist cookie.
                    if (ModSettings.Get("displaytype") == "2") // displaytype 2 = "selected list"
                    {
                        var cw = new ItemListData(PortalId, UserController.Instance.GetCurrentUserInfo().UserID);
                        if (cw.Exists && cw.ItemCount > 0)
                        {
                            strFilter = " and (";
                            foreach (var i in cw.GetItemList())
                            {
                                strFilter += " NB1.itemid = '" + i + "' or";
                            }
                            strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") ";
                            // remove the last "or"
                        }
                        else
                        {
                            //no data in list so select false itemid to stop anything displaying
                            strFilter += " and (NB1.itemid = '-1') ";
                        }
                    }

                    #endregion

                    // insert page header text
                    NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_head" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings());

                    // save navigation data
                    _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid");
                    _navigationdata.PageNumber   = Utils.RequestParam(Context, "page");
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid));
                    }

                    // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function
                    NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1);


                    if (strFilter.Trim() == "")
                    {
                        // if at this point we have no filter, then assume we're using urlrewriter and a 404 url has been entered.
                        // rather than display all visible products in a list with no default.
                        // redirect to the product display function, so we can display a 404 and product not found.
                        RazorDisplayDataEntry(_eid);
                    }
                    else
                    {
                        strFilter += " and (NB3.Visible = 1) "; // get only visible products

                        var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, EntityTypeCode, strFilter, EntityTypeCodeLang, Utils.GetCurrentCulture(), DebugMode);

                        _navigationdata.RecordCount = recordCount.ToString("");
                        _navigationdata.Save();

                        if (returnlimit > 0 && returnlimit < recordCount)
                        {
                            recordCount = returnlimit;
                        }

                        // **** check if we already have the template cached, if so no need for DB call or razor call ****
                        // get same cachekey used for DB return, and use for razor.
                        var razorcachekey = ModCtrl.GetDataListCacheKey(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                        var cachekey      = "NBrightBuyRazorOutput" + _templD + "*" + razorcachekey + PortalId.ToString();
                        var strOut        = (String)NBrightBuyUtils.GetModCache(cachekey);
                        if (strOut == null || StoreSettings.Current.DebugMode)
                        {
                            var l = ModCtrl.GetDataList(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                            strOut = NBrightBuyUtils.RazorTemplRenderList(_templD, ModuleId, razorcachekey, l, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                        }

                        var lit = new Literal();
                        lit.Text = strOut;
                        phData.Controls.Add(lit);

                        if (_navigationdata.SingleSearchMode)
                        {
                            _navigationdata.ResetSearch();
                        }

                        if (pageSize > 0)
                        {
                            CtrlPaging.PageSize     = pageSize;
                            CtrlPaging.CurrentPage  = pageNumber;
                            CtrlPaging.TotalRecords = recordCount;
                            CtrlPaging.BindPageLinks();
                        }
                    }
                }
            }
        }
Exemplo n.º 35
0
 public abstract IEnumerable <string> GetMountNames(ModuleId currentPackage);
Exemplo n.º 36
0
        override protected void OnInit(EventArgs e)
        {
            _eid           = Utils.RequestQueryStringParam(Context, "eid");
            _print         = Utils.RequestParam(Context, "print");
            _printtemplate = Utils.RequestParam(Context, "template");
            _controlPath   = ControlPath;

            EnablePaging = true;

            base.OnInit(e);

            if (ModSettings != null)
            {
                // check if we're using a typcode for the data.
                var modentitytypecode = ModSettings.Get("entitytypecode");
                if (modentitytypecode != "")
                {
                    EntityTypeCode     = modentitytypecode;
                    EntityTypeCodeLang = modentitytypecode + "LANG";
                }
                // check if we're using a provider controlpath for the templates.
                var providercontrolpath = ModSettings.Get("providercontrolpath");
                if (providercontrolpath != "")
                {
                    _controlPath = "/DesktopModules/NBright/" + providercontrolpath + "/";
                }
            }


            // if guidkey entered instead of eid, find it using the guid and assign to _eid
            _guidkey = Utils.RequestQueryStringParam(Context, "guidkey");
            if (_guidkey == "")
            {
                _guidkey = Utils.RequestQueryStringParam(Context, "ref");
            }

            Logging.Info($"ProductRazorView requested with: eid={_eid}, guidkey={_guidkey}.");

            if (_eid == "" && _guidkey != "")
            {
                var guidData = ModCtrl.GetByGuidKey(PortalId, -1, EntityTypeCode, _guidkey);
                if (guidData != null)
                {
                    _eid = guidData.ItemID.ToString("D");
                }
                else
                {
                    _eid = "0";
                }
            }

            // if we want to print we need to open the browser with a startup script, this points to a Printview.aspx. (Must go after the ModSettings has been init.)
            if (_print != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "printproduct", "window.open('" + StoreSettings.NBrightBuyPath() + "/PrintView.aspx?itemid=" + _eid + "&printcode=" + _print + "&template=" + _printtemplate + "&theme=" + ModSettings.Get("themefolder") + "','_blank');", true);
            }

            if (ModuleKey == "")  // if we don't have module setting jump out
            {
                var lit = new Literal();
                lit.Text = "NO MODULE SETTINGS";
                phData.Controls.Add(lit);
                return;
            }

            _navigationdata = new NavigationData(PortalId, ModuleKey);

            // Pass in a template specifying the token to create a friendly url for paging.
            // (NOTE: we need this in NBS becuase the edit product from list return url will copy the page number and hence paging will not work after editing if we don;t do this)
            CtrlPaging.HrefLinkTemplate = "[<tag type='valueof' databind='PreText' />][<tag type='if' databind='Text' testvalue='' display='{OFF}' />][<tag type='hrefpagelink' moduleid='" + ModuleId.ToString("") + "' />][<tag type='endif' />][<tag type='valueof' databind='PostText' />]";
            CtrlPaging.UseListDisplay   = true;
            try
            {
                _catid   = Utils.RequestQueryStringParam(Context, "catid");
                _catname = Utils.RequestQueryStringParam(Context, "catref");

                #region "set templates based on entry id (eid) from url"

                _ename        = Utils.RequestQueryStringParam(Context, "entry");
                _modkey       = Utils.RequestQueryStringParam(Context, "modkey");
                _pagemid      = Utils.RequestQueryStringParam(Context, "pagemid");
                _pagenum      = Utils.RequestQueryStringParam(Context, "page");
                _pagesize     = Utils.RequestQueryStringParam(Context, "pagesize");
                _orderbyindex = Utils.RequestQueryStringParam(Context, "orderby");

                // see if we need to display the entry page.
                if ((_modkey == ModuleKey | _modkey == "") && (_eid != "" | _ename != ""))
                {
                    _displayentrypage = true;
                }

                // if we have entry detail display, but no catd, get the default one.
                if (_displayentrypage && _catid == "" && Utils.IsNumeric(_eid))
                {
                    var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                    var defcat  = prdData.GetDefaultCategory();
                    if (defcat != null)
                    {
                        _catid = defcat.categoryid.ToString("");
                    }
                }

                if (ModSettings.Get("listonly").ToLower() == "true")
                {
                    _displayentrypage = false;
                }

                // get template codes
                if (_displayentrypage)
                {
                    _templD = ModSettings.Get("razordetailtemplate");
                    if (_templD == "")
                    {
                        _templD = ModSettings.Get("txtdisplayentrybody");                // legacy name
                    }
                }
                else
                {
                    _templD = ModSettings.Get("razorlisttemplate");
                    if (_templD == "")
                    {
                        _templD = ModSettings.Get("txtdisplaybody");                // legacy name
                    }
                }

                #endregion
            }
            catch (Exception exc)
            {
                // remove any cookie which might store SQL in error.
                _navigationdata.Delete();
                DisplayProductError(exc.ToString());
            }
        }
Exemplo n.º 37
0
        string?GetMethodAsString(ModuleId moduleId, uint token)
        {
            var module = dbgMetadataService.Value.TryGetMetadata(moduleId, DbgLoadModuleOptions.AutoLoaded);

            return((module?.ResolveToken(token) as MethodDef)?.ToString());
        }
Exemplo n.º 38
0
        private void RazorDisplayDataEntry(String entryId)
        {
            var productData = new ProductData();

            if (Utils.IsNumeric(entryId))
            {
                productData = ProductUtils.GetProductData(Convert.ToInt32(entryId), Utils.GetCurrentCulture(), true, EntityTypeCode);
            }

            if (productData.Exists && (productData.Info.PortalId == -1 || productData.Info.PortalId == PortalId))
            {
                if (PortalSettings.HomeTabId == TabId)
                {
                    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                }
                else
                {
                    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetEntryUrl(PortalId, _eid, "", productData.SEOName, TabId.ToString("")));
                }

                // overwrite SEO data
                if (productData.SEOName != "")
                {
                    BasePage.Title = productData.SEOTitle;
                }
                else
                {
                    BasePage.Title = productData.ProductName;
                }

                if (productData.SEODescription != "")
                {
                    BasePage.Description = productData.SEODescription;
                }

                // if debug , output the xml used.
                if (DebugMode)
                {
                    productData.Info.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_entry.xml");
                }
                // insert page header text
                NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_seohead" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings(), productData);

                #region "do razor template"

                var strOut = NBrightBuyUtils.RazorTemplRender(_templD, ModuleId, "productdetailrazor" + ModuleId.ToString() + "*" + entryId, productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                var lit    = new Literal();
                lit.Text = strOut;
                phData.Controls.Add(lit);

                #endregion
            }
            else
            {
                _404code = true;

                // insert page header text
                NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, "ProductNotFound_head.cshtml", _controlPath, ModSettings.ThemeFolder, ModSettings.Settings(), productData);

                var strOut = NBrightBuyUtils.RazorTemplRender("ProductNotFound.cshtml", ModuleId, "", productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                var lit    = new Literal();
                lit.Text = strOut;
                phData.Controls.Add(lit);
            }
        }
Exemplo n.º 39
0
        public static void CliEnterRoom(int roomId = 0, string name = "", int userId = 1, ModuleId moduleId = ModuleId.Game)
        {
            CliEnterRoom cliEnterRoom = new CliEnterRoom();

            cliEnterRoom.RoomId = roomId;
            cliEnterRoom.Name   = name;

            CliReq req = CreateCliReq(ClientMsgType.CliEnterRoom, userId, moduleId);

            req.CliEnterRoom = cliEnterRoom;

            UdpSocket.Send(Serialize(req));
        }
Exemplo n.º 40
0
 public abstract DbgModule GetModule(ModuleId moduleId);
Exemplo n.º 41
0
 public DbgLanguageDebugInfoKey(DbgModule module, uint token)
 {
     this.token  = token;
     moduleId    = default;
     this.module = module;
 }
 public static MockHttpMessageHandler AddMeasurements(this MockHttpMessageHandler mockHttp, ModuleId moduleId, IEnumerable <Measure> types, int num = 10)
 {
     var beginTime              = 1585752321;
     var time                   = beginTime;
     var valueCount             = 0;
     var pseudoRandom5MinSteps  = new[] { 308, 307, 308, 295, 320, 304, 257, 305, 310, 302, 298, 306 };
     var pseudoRandomClumpSizes = new[] { 2, 3, 2, 2, 4 };
Exemplo n.º 43
0
        /// <summary>
        /// Creates a new PipConstructionHelper
        /// </summary>
        /// <remarks>
        /// Ideally this function would take ModuleId, FullSymbol QualifierId and compute uniqueOutputLocation itself. Unfortunately today the data is not yet
        /// exposed via IPipGraph, therefore the responsibility is on the call site for now.
        /// </remarks>
        public static PipConstructionHelper Create(
            PipExecutionContext context,
            AbsolutePath objectRoot,
            AbsolutePath redirectedRoot,
            AbsolutePath tempRoot,
            IMutablePipGraph pipGraph,
            ModuleId moduleId,
            string moduleName,
            RelativePath specRelativePath,
            FullSymbol symbol,
            LocationData thunkLocation,
            QualifierId qualifierId)
        {
            var stringTable = context.StringTable;
            var pathTable   = context.PathTable;

            // We have to manually compute the pipPipUniqueString here, Ideally we pass PackageId, SpecFile, FullSymbol and qualiferId and have it computed inside, but the IPipGraph does not allow querying it for now.
            string hashString;
            long   semiStableHashSeed = 0;

            using (var builderWrapper = Pools.GetStringBuilder())
            {
                var builder = builderWrapper.Instance;

                builder.Append(moduleName);
                builder.Append('/');
                semiStableHashSeed = HashCodeHelper.GetOrdinalHashCode64(moduleName);

                if (specRelativePath.IsValid)
                {
                    string specPath = specRelativePath.ToString(stringTable);
                    builder.Append(specPath);
                    builder.Append('/');
                    semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(specPath));
                }

                var symbolName = symbol.ToStringAsCharArray(context.SymbolTable);
                builder.Append(symbolName);
                builder.Append('/');
                semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(symbolName));

                var qualifierDisplayValue = context.QualifierTable.GetCanonicalDisplayString(qualifierId);
                builder.Append(qualifierDisplayValue);
                semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(qualifierDisplayValue));

                var pipPipUniqueString = builder.ToString();
                hashString = Hash(pipPipUniqueString);
            }

            var pipRelativePath = RelativePath.Create(
                PathAtom.Create(stringTable, hashString.Substring(0, 1)),
                PathAtom.Create(stringTable, hashString.Substring(1, 1)),
                PathAtom.Create(stringTable, hashString.Substring(2)));

            var valuePip = new ValuePip(symbol, qualifierId, thunkLocation);

            return(new PipConstructionHelper(
                       context,
                       objectRoot,
                       redirectedRoot,
                       tempRoot,
                       pipGraph,
                       moduleId,
                       moduleName,
                       valuePip,
                       pipRelativePath,
                       semiStableHashSeed));
        }
Exemplo n.º 44
0
        /// <summary>
        /// </summary>
        /// <remarks>
        /// </remarks>
        private bool CreateModuleDefinition()
        {
            try
            {
                if (PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == GetClassName()) == null)
                {
                    var controlName = Null.NullString;

                    //Create module folder
                    CreateModuleFolder();

                    //Create module control
                    controlName = CreateModuleControl();
                    if (controlName != "")
                    {
                        //Create package
                        var objPackage = new PackageInfo();
                        objPackage.Name         = GetClassName();
                        objPackage.FriendlyName = txtModule.Text;
                        objPackage.Description  = txtDescription.Text;
                        objPackage.Version      = new Version(1, 0, 0);
                        objPackage.PackageType  = "Module";
                        objPackage.License      = "";
                        objPackage.Owner        = txtOwner.Text;
                        objPackage.Organization = txtOwner.Text;
                        objPackage.FolderName   = "DesktopModules/" + GetFolderName();
                        objPackage.License      = "The license for this package is not currently included within the installation file, please check with the vendor for full license details.";
                        objPackage.ReleaseNotes = "This package has no Release Notes.";
                        PackageController.Instance.SaveExtensionPackage(objPackage);

                        //Create desktopmodule
                        var objDesktopModule = new DesktopModuleInfo();
                        objDesktopModule.DesktopModuleID         = Null.NullInteger;
                        objDesktopModule.ModuleName              = GetClassName();
                        objDesktopModule.FolderName              = GetFolderName();
                        objDesktopModule.FriendlyName            = txtModule.Text;
                        objDesktopModule.Description             = txtDescription.Text;
                        objDesktopModule.IsPremium               = false;
                        objDesktopModule.IsAdmin                 = false;
                        objDesktopModule.Version                 = "01.00.00";
                        objDesktopModule.BusinessControllerClass = "";
                        objDesktopModule.CompatibleVersions      = "";
                        objDesktopModule.AdminPage               = "";
                        objDesktopModule.HostPage                = "";
                        objDesktopModule.Dependencies            = "";
                        objDesktopModule.Permissions             = "";
                        objDesktopModule.PackageID               = objPackage.PackageID;
                        objDesktopModule.DesktopModuleID         = DesktopModuleController.SaveDesktopModule(objDesktopModule, false, true);
                        objDesktopModule = DesktopModuleController.GetDesktopModule(objDesktopModule.DesktopModuleID, Null.NullInteger);

                        //Add OwnerName to the DesktopModule taxonomy and associate it with this module
                        var vocabularyId      = -1;
                        var termId            = -1;
                        var objTermController = DotNetNuke.Entities.Content.Common.Util.GetTermController();
                        var objTerms          = objTermController.GetTermsByVocabulary("Module_Categories");
                        foreach (Term term in objTerms)
                        {
                            vocabularyId = term.VocabularyId;
                            if (term.Name == txtOwner.Text)
                            {
                                termId = term.TermId;
                            }
                        }
                        if (termId == -1)
                        {
                            termId = objTermController.AddTerm(new Term(vocabularyId)
                            {
                                Name = txtOwner.Text
                            });
                        }
                        var objTerm = objTermController.GetTerm(termId);
                        var objContentController = DotNetNuke.Entities.Content.Common.Util.GetContentController();
                        var objContent           = objContentController.GetContentItem(objDesktopModule.ContentItemId);
                        objTermController.AddTermToContent(objTerm, objContent);

                        //Add desktopmodule to all portals
                        DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                        //Create module definition
                        var objModuleDefinition = new ModuleDefinitionInfo();
                        objModuleDefinition.ModuleDefID     = Null.NullInteger;
                        objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                        // need core enhancement to have a unique DefinitionName
                        objModuleDefinition.FriendlyName = GetClassName();
                        //objModuleDefinition.FriendlyName = txtModule.Text;
                        //objModuleDefinition.DefinitionName = GetClassName();
                        objModuleDefinition.DefaultCacheTime = 0;
                        objModuleDefinition.ModuleDefID      = ModuleDefinitionController.SaveModuleDefinition(objModuleDefinition, false, true);

                        //Create modulecontrol
                        var objModuleControl = new ModuleControlInfo();
                        objModuleControl.ModuleControlID          = Null.NullInteger;
                        objModuleControl.ModuleDefID              = objModuleDefinition.ModuleDefID;
                        objModuleControl.ControlKey               = "";
                        objModuleControl.ControlSrc               = "DesktopModules/" + GetFolderName() + "/" + controlName;
                        objModuleControl.ControlTitle             = "";
                        objModuleControl.ControlType              = SecurityAccessLevel.View;
                        objModuleControl.HelpURL                  = "";
                        objModuleControl.IconFile                 = "";
                        objModuleControl.ViewOrder                = 0;
                        objModuleControl.SupportsPartialRendering = false;
                        objModuleControl.SupportsPopUps           = false;
                        ModuleControlController.AddModuleControl(objModuleControl);

                        //Update current module to reference new moduledefinition
                        var objModule = ModuleController.Instance.GetModule(ModuleId, TabId, false);
                        objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                        objModule.ModuleTitle = txtModule.Text;

                        //HACK - need core enhancement to be able to update ModuleDefID
                        DotNetNuke.Data.DataProvider.Instance().ExecuteSQL("Update dbo.Modules set ModuleDefID = " + objModule.ModuleDefID.ToString() + " where ModuleID = " + ModuleId.ToString());

                        ModuleController.Instance.UpdateModule(objModule);

                        return(true);
                    }
                    else
                    {
                        DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TemplateProblem.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                        return(false);
                    }
                }
                else
                {
                    DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AlreadyExists.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    return(false);
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, exc.ToString(), ModuleMessage.ModuleMessageType.RedError);
                return(false);
            }
        }
Exemplo n.º 45
0
        internal TDef GetDefinition <TDef>(ModuleId module, uint token) where TDef : class
        {
            var md = dbgMetadataService.Value.TryGetMetadata(module, DbgLoadModuleOptions.AutoLoaded);

            return(md?.ResolveToken(token) as TDef);
        }
Exemplo n.º 46
0
		public IDebuggerModule GetModule(ModuleId name) => debugger.Dispatcher.UI(() => {
			foreach (var m in Modules) {
				if (name == m.ModuleId)
					return m;
			}
			return null;
		});