Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
1、site增加keywords和description
Browse files Browse the repository at this point in the history
2、新增站点时,添加默认文章
  • Loading branch information
brucexhe committed Feb 28, 2015
1 parent 142025a commit fe3e6fa
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 37 deletions.
19 changes: 17 additions & 2 deletions QN.Repository/Entities/site.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,28 @@ public class site : entity<site>, IMeta<sitemeta>
/// 备案号
/// </summary>
[DisplayName("备案号")]
public virtual string icpnumber { get; set; }

public virtual string icpnumber { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime date { get; set; }


/// <summary>
/// keywords
/// </summary>
[DisplayName("keywords")]
public virtual string keywords { get; set; }


/// <summary>
/// description
/// </summary>
[DisplayName("description")]
public virtual string description { get; set; }


public virtual string meta(string property)
{
if (string.IsNullOrWhiteSpace(property))
Expand Down
31 changes: 28 additions & 3 deletions QN.Service/SiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void Add(site site, user user)

#region 创建默认分类

term postterm = new term()
term defaultterm = new term()
{
name = "默认分类",
modified = DateTime.Now,
Expand All @@ -144,13 +144,13 @@ public void Add(site site, user user)
slug = "default"
};

R.session.Save(postterm);
R.session.Save(defaultterm);

option superterm = new option()
{
name = R.default_term_id,
siteid = site.id,
value = postterm.id.ToString()
value = defaultterm.id.ToString()
};

R.session.Save(superterm);
Expand Down Expand Up @@ -221,6 +221,31 @@ public void Add(site site, user user)

#endregion

#region 创建默认文章
post defaultpost = new post()
{
name = "welcome-to-use-qiniaocms",
title = "欢迎使用奇鸟CMS!",
content = "欢迎使用奇鸟CMS。这是系统自动生成的演示文章,您可以编辑或者删除它!",
type = "post",
status = "publish",
modified = DateTime.Now,
date = DateTime.Now,
siteid = site.id,
author = user.login,
commentcount = 0,
excerpt = "",
pic = "",
piclink = "",
viewcount = 1,
slug = "welcome-to-use-qiniaocms",
order = 0,
termid = defaultterm.id
};
R.session.Save(defaultpost);

#endregion

trans.Commit();

QCache.Remove("site-list");
Expand Down
6 changes: 5 additions & 1 deletion QN.Theme/ThemeViewPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public string description
{
if (string.IsNullOrWhiteSpace(_description))
{
return currentsite.info;
return currentsite.description;
}

return _description;
Expand All @@ -275,6 +275,10 @@ public string keywords
{
get
{
if (string.IsNullOrWhiteSpace(_keywords))
{
return currentsite.keywords;
}
return _keywords;
}
set
Expand Down
69 changes: 40 additions & 29 deletions QN.Web/Areas/Admin/Views/Sites/form.cshtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
@model site

@{
IList<theme> themes = ViewBag.themes;
}

@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.id)
<div class="row">
Expand All @@ -23,36 +21,39 @@
<div class="form-group">
@Html.LabelFor(m => m.domain, new { @class = "col-sm-2 control-label", @id = "inputDomain" })
<div class="col-sm-10">
@Html.TextAreaFor(m => m.domain, new {
@class = "form-control",
@id = "inputDomain",
@style="height:80px;",
@placeholder = lang("请输入网站域名,每行一个,第一个为主域名")
})
@Html.TextAreaFor(m => m.domain, new
{
@class = "form-control",
@id = "inputDomain",
@style = "height:80px;",
@placeholder = lang("请输入网站域名,每行一个,第一个为主域名")
})
@Html.ValidationMessageFor(m => m.domain)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.theme, new { @class = "col-sm-2 control-label", @id = "selectTheme" })
<div class="col-sm-10">
@Html.DropDownListFor(m => m.theme, themes.
Select(x => new SelectListItem() {
Text = x.name,
Select(x => new SelectListItem()
{
Text = x.name,
Value = x.dirname,
Selected = Model.theme == x.dirname
}).ToList<SelectListItem>(), new { @class = "form-control", @id = "selectTheme" })
@Html.ValidationMessageFor(m => m.theme)
</div>
</div>

<div class="form-group">
@Html.LabelFor(m => m.info, new { @class = "col-sm-2 control-label", @id = "inputInfo" })
<div class="col-sm-10">
@Html.TextAreaFor(m => m.info, new {
@class = "form-control",
@id = "inputInfo",
@style = "height:80px;",
@placeholder = lang("请输入网站简介") })
@Html.TextAreaFor(m => m.info, new
{
@class = "form-control",
@id = "inputInfo",
@style = "height:80px;",
@placeholder = lang("请输入网站简介")
})
@Html.ValidationMessageFor(m => m.info)
</div>
</div>
Expand Down Expand Up @@ -91,29 +92,41 @@
@Html.ValidationMessageFor(m => m.icpnumber)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.keywords, new { @class = "col-sm-2 control-label", @id = "keywords" })
<div class="col-sm-10">
@Html.TextBoxFor(m => m.keywords, new { @class = "form-control", @id = "keywords", @placeholder = lang("") })
@Html.ValidationMessageFor(m => m.keywords)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.description, new { @class = "col-sm-2 control-label", @id = "description" })
<div class="col-sm-10">
@Html.TextBoxFor(m => m.description, new { @class = "form-control", @id = "description", @placeholder = lang("") })
@Html.ValidationMessageFor(m => m.description)
</div>
</div>
</div>
</div>

@if (ViewBag.create == true)
{
@Html.Partial("userform", new user())
}

@if (ViewBag.create == true)
{
@Html.Partial("userform", new user())
}
</div>
<div class="col-md-4">
<div class="panel form-horizontal">
<div class="panel-heading">
<span class="panel-title">@lang("操作")</span>
</div>
<div class="panel-body">
<div class="clearfix"></div>
<div class="clearfix">
</div>
<dl class="dl-horizontal form-property">
<dt>@lang("状态")</dt>
<dd><em>@Html.Raw(Model.id == 0 ? lang("新建").ToHtmlString() : lang("编辑").ToHtmlString())</em></dd>
<dt>@lang("创建时间")</dt>
<dd><em>@Html.Raw(Model.date == DateTime.MinValue ? lang("未知").ToHtmlString() : Model.date.ToRecentTime())</em></dd>
</dl>

<hr />
<div class="form-group" style="margin-bottom: 0;">
<div class="col-sm-offset-2 col-sm-10">
Expand All @@ -122,7 +135,7 @@
<input type="submit" class="btn btn-primary" value="@lang("更新")" />
if (Model.id != currentsite.id)
{
<a href="@Url.Action("delete", new { @id = Model.id, @returnurl = backurl })"
<a href="@Url.Action("delete", new { @id = Model.id, @returnurl = backurl })"
ask="@lang("确定删除此网站吗(此操作将不可恢复。)?")"
class="btn btn-danger">@lang("删除")</a>
}
Expand All @@ -135,14 +148,13 @@
</div>
</div>
</div>

<div class="panel form-horizontal">
<div class="panel-heading">
<span class="panel-title">@lang("LOGO")</span>
</div>
<div class="panel-body">
@Html.HiddenFor(m => m.logo)
<table style="width:100%;">
<table style="width: 100%;">
<tr>
<td class="picbox" id="pic-box">
@if (!string.IsNullOrWhiteSpace(Model.logo))
Expand All @@ -159,7 +171,6 @@
</table>
</div>
</div>

</div>
</div>
<script type="text/javascript">
Expand All @@ -184,4 +195,4 @@
return false;
});
</script>
</script>
4 changes: 2 additions & 2 deletions QN.Web/QN.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,11 @@
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>7778</DevelopmentServerPort>
<DevelopmentServerPort>7779</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7778</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>http://www.qiniaosoft.com</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
Expand Down

0 comments on commit fe3e6fa

Please sign in to comment.