// コンストラクタ

		protected HatomaruActionBase(HatomaruXml model, AbsPath path){
			myModel = model;
			myUserPath = path;
			myPath = path;
			myResponse = new NormalResponse(model, myPath);
			GetHtml();
		}
Example #2
0
// ナビゲーション

		/// <summary>
		/// TopicPath を設定します。
		/// Model までの Path と、追加された LinkItem とでリストを作成します。
		/// </summary>
		protected void SetTopicPath(HatomaruResponse hr){
			List<LinkItem> tempList = new List<LinkItem>();
			HatomaruXml currentXml = Model;
			for(;;){
				if(currentXml == null) break;
				hr.AddDataSource(currentXml);
				LinkItem item = currentXml.GetLinkItem();
				tempList.Add(item);
				currentXml = currentXml.ParentXml;
			}
			tempList.Reverse();
			if(hr.TopicPath != null) tempList.AddRange(hr.TopicPath);
			XmlNode result = null;
			if(tempList.Count > 1){
				result = Html.P(TopicPathClassName);
				for(int i = 0; i < tempList.Count; i++){
					LinkItem item = tempList[i];
					if(i > 0){
						result.AppendChild(Html.Text(" "));
						XmlElement sep = Html.Create("span", "separate", ">");
						result.AppendChild(sep);
						result.AppendChild(Html.Text(" "));
					}
					XmlElement a = Html.A(item.Path, null, item.InnerText);
					result.AppendChild(a);
				}
			}
			hr.Html.Replace(TopicPathPlaceHolderName, result);
		}
Example #3
0
		/// <summary>
		/// キーワードをHtml に反映します。
		/// </summary>
		protected virtual void SetKeywords(HatomaruResponse hr, string keywords){
			if(!string.IsNullOrEmpty(keywords)){
				hr.Keywords = keywords;
				XmlElement metaKeywords = hr.Html.Create("meta");
				metaKeywords.SetAttribute("name", "keywords");
				metaKeywords.SetAttribute("content", keywords);
				hr.Html.Head.AppendChild(metaKeywords);
			}
		}
Example #4
0
// オーバーライド

		/// <summary>
		/// タイトルをHtml に反映します。
		/// </summary>
		protected override void SetTitle(HatomaruResponse hr){
			if(hr.SelfTitle == null){
				hr.SelfTitle = Model.BaseTitle;
				if(Model.ParentXml != null) hr.BaseTitle = Model.ParentXml.BaseTitle;
			} else if(hr.BaseTitle == null){
				hr.BaseTitle = Model.BaseTitle;
			}
			hr.Html.Title.InnerText = hr.Title;
			hr.Html.H1.InnerText = Model.BaseTitle;
		}
Example #5
0
		private XmlNode GetCacheDatas(HatomaruResponse[] cached){
			XmlElement result = Html.Create("table");
			foreach(HatomaruResponse hr in cached){
				// データソースをまとめる
				string dataSourceNames = "";
				foreach(HatomaruData hd in hr.DataSource){
					dataSourceNames += hd.File.FullName.CutLeft(Model.Manager.IniData.DataPath.FullName);
					dataSourceNames += " ";
				}
				if(hr is RedirectResponse){
					RedirectResponse rr = hr as RedirectResponse;
					XmlElement tr = Html.Tr(null, 1, "", hr.Path, hr.StatusCode, hr.Length, hr.LastModified, rr.DestPath);
					result.AppendChild(tr);
				} else {
					XmlElement tr = Html.Tr(null, 1, hr.Title, hr.Path, hr.StatusCode, hr.Length, hr.LastModified, dataSourceNames);
					result.AppendChild(tr);
				}
			}
		return result;
		}
		protected HatomaruResponse NotFound(string mes){
			myResponse = new NotFoundResponse(Model, Path, mes);
			GetHtml();
			XmlElement p = Html.P(null, mes);
			Html.Append(p);
			return myResponse;
		}
Example #7
0
		/// <summary>
		/// ナビゲーションを設定します。
		/// </summary>
		protected virtual void SetNavigation(HatomaruResponse hr){
			SetChildrenNav(GetSubNav());
			SetRecentlyArticle();
			// Prev/Nextを設定します。
			hr.Html.Append(GetPrevNextNav());
		}
		/// <summary>
		/// コメント先へのリンクを取得します。
		/// </summary>
		protected XmlElement GetCommentToLink(HatomaruResponse hr){
			XmlElement commentToA = Html.A(hr.Path, "comment-to", hr.FullTitle);
			return commentToA;
		}