Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.新增后台-栏目页排序(仿内容页) #1425

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions SiteServer.BackgroundPages/Cms/ModalChannelTaxis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.UI.WebControls;
using SiteServer.Utils;
using SiteServer.CMS.Core;
using SiteServer.CMS.Core.Create;
using SiteServer.CMS.DataCache;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Attributes;
using SiteServer.Utils.Enumerations;

namespace SiteServer.BackgroundPages.Cms
{
public class ModalChannelTaxis : BasePageCms
{
protected DropDownList DdlTaxisType;
protected TextBox TbTaxisNum;

private int _channelId;
private string _returnUrl;
private List<int> _contentIdList;
private string _tableName;

public static string GetOpenWindowString(int siteId)
{
return LayerUtils.GetOpenScriptWithCheckBoxValue("栏目排序", PageUtils.GetCmsUrl(siteId, nameof(ModalChannelTaxis), null), "ChannelIDCollection", "请选择需要排序的内容!", 400, 280);
}

public void Page_Load(object sender, EventArgs e)
{
if (IsForbidden) return;

PageUtils.CheckRequestParameter("siteId", "ChannelIDCollection");

_channelId = AuthRequest.GetQueryInt("ChannelIDCollection");
_contentIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));
_tableName = ChannelManager.GetTableName(SiteInfo, _channelId);

if (IsPostBack) return;

DdlTaxisType.Items.Add(new ListItem("上升", "Up"));
DdlTaxisType.Items.Add(new ListItem("下降", "Down"));
ControlUtils.SelectSingleItem(DdlTaxisType, "Up");
}

public override void Submit_OnClick(object sender, EventArgs e)
{
var isUp = DdlTaxisType.SelectedValue == "Up";
var taxisNum = TranslateUtils.ToInt(TbTaxisNum.Text);

foreach (var contentId in _contentIdList)
{
DataProvider.ChannelDao.UpdateTaxis(SiteId, _channelId, isUp);

AuthRequest.AddSiteLog(SiteId, _channelId, 0, "栏目排序" + (isUp ? "上升" : "下降"),
$"栏目:{ChannelManager.GetChannelName(SiteId, _channelId)}");
}
LayerUtils.CloseAndRedirect(Page, PageChannel.GetRedirectUrl(SiteId, _channelId));
}

}
}
4 changes: 4 additions & 0 deletions SiteServer.BackgroundPages/Cms/PageChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ private string GetButtonsHtml()
");
}

builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalChannelTaxis.GetOpenWindowString(SiteId)}"">排 序</a>
");

return builder.ToString();
}

Expand Down
47 changes: 47 additions & 0 deletions SiteServer.Web/SiteServer/Cms/ModalChannelTaxis.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<%@ Page Language="C#" Inherits="SiteServer.BackgroundPages.Cms.ModalChannelTaxis" Trace="false"%>
<%@ Register TagPrefix="ctrl" Namespace="SiteServer.BackgroundPages.Controls" Assembly="SiteServer.BackgroundPages" %>
<!DOCTYPE html>
<html class="modalPage">

<head>
<meta charset="utf-8">
<!--#include file="../inc/head.html"-->
</head>

<body>
<form runat="server">
<ctrl:alerts runat="server" />

<div class="form-group form-row">
<label class="col-3 text-right col-form-label">排序方向</label>
<div class="col-8">
<asp:DropDownList ID="DdlTaxisType" class="form-control" runat="server"></asp:DropDownList>
</div>
<div class="col-1"></div>
</div>

<div class="form-group form-row">
<label class="col-3 text-right col-form-label">移动数目</label>
<div class="col-8">
<asp:TextBox class="form-control" Text="1" MaxLength="50" id="TbTaxisNum" runat="server" />
</div>
<div class="col-1">
<asp:RequiredFieldValidator ControlToValidate="TbTaxisNum" errorMessage=" *" foreColor="red" Display="Dynamic" runat="server"
/>
<asp:RegularExpressionValidator runat="server" ControlToValidate="TbTaxisNum" ValidationExpression="^([1-9]|[1-9][0-9]{1,})$"
errorMessage=" *" foreColor="red" Display="Dynamic" />
</div>
</div>

<hr />

<div class="text-right mr-1">
<asp:Button class="btn btn-primary m-l-5" text="确 定" runat="server" onClick="Submit_OnClick" />
<button type="button" class="btn btn-default m-l-5" onclick="window.parent.layer.closeAll()">取 消</button>
</div>

</form>
</body>

</html>
<!--#include file="../inc/foot.html"-->