Пример #1
0
        private string CheckWiki(string path)
        {
            Log.log("Checking wiki... {0}", path);

            OrionTopic topic = Wiki.ParseTopic(path);

            if (topic != null)
            {
                Log.log("Wiki Request!");

                HttpContext.Current.RewritePath(Wiki.Section);
                HttpContext.Current.Items["WikiTopic"] = topic;

                Log.log("Original Path: {0}", path);
                Log.log("New Path: {0}", Wiki.Section);
                Log.log("WikiTopic: {0}", HttpContext.Current.Items["WikiTopic"]);

                return(Wiki.Section);
            }
            else
            {
                if (path.IndexOf("/wiki/default.aspx/") != -1)
                {
                    Log.log("Ups, path and url mixed!");
                    Log.log("Path: {0}", path);
                    path = path.Replace("wiki/default.aspx/", "");
                    Log.log("Arranged Path: {0}", path);
                    HttpContext.Current.RewritePath(path);
                }
            }

            return(path);
        }
Пример #2
0
        /// <summary>Mostra o controlo</summary>
        protected override void Render(HtmlTextWriter writer)
        {
#if WIKI
        #if DEBUG
            Check(GetFederation(), "Federation");
        #endif
            if (WikiSearch != null)
            {
                WriteSearchResults(writer);
                return;
            }

            string currentTopic = "Orionsbelt.Orionsbelt";

            OrionTopic obj = (OrionTopic)Context.Items["WikiTopic"];
            if (obj != null)
            {
                currentTopic = obj.ToString();
            }

            if (obj != null && !obj.Exists)
            {
                writer.WriteLine("Lamentamos, mas o tpico {0} ainda no foi adicionado.", obj.ToString());
                ExceptionLog.log("WikiTopic", string.Format("Access detected to WikiTopic '{0}' that does not exist.", obj.ToString()));
                return;
            }

            FlexWiki.AbsoluteTopicName topic = new FlexWiki.AbsoluteTopicName(currentTopic);

            string display = GetDisplay(topic);
            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, string.Format("{0} - {1}", CultureModule.getContent("help"), display));

            FlexWiki.Federation fed = GetFederation();

            string formattedBody = fed.GetTopicFormattedContent(topic, false);
            writer.WriteLine("<div id='TopicTip'></div>");
            writer.WriteLine("<div id='wiki'>");
            WriteLocation(writer, topic, display);
            CheckPreviewImage(writer, topic);
            writer.WriteLine("<h1>{0}</h1>", display);
            writer.WriteLine(formattedBody);
            writer.WriteLine("</div>");
#else
            writer.WriteLine("<p>This <b>orionsbelt</b> version was compiled without Wiki support!</p>");
            writer.WriteLine("<p>If this is an online version... then... er... maybe we forgot the wiki, please warn us!</p>");
#endif
        }