早上好,有没有办法达到附件中的结果?
蓝色(右侧)是它当前的显示方式。橙色(左侧)是我希望它显示的方式 当前和必需
编辑:
这是 CSHTML 片段:
@using Extensions;
@using ToSic.SexyContent;
@using System.Collections;
@using System.Web.UI;
@using DotNetNuke.Security.Permissions;
<link rel="stylesheet" data-enableoptimizations="true" href="@App.Path/assets/Announcements.css" />
@if ((Dnn.User.IsSuperUser == false) || (Dnn.User.IsInRole("Administrators") == false))
{
<style>
.sc-content-block-quick-insert {
display: none !important;
}
div.sc-cb-highlight-for-insert {
background: none !important;
}
</style>
}
else
{
<style>
.sc-menu-a {
width: 28px!important;
height: 28px!important;
line-height:28px!important;
background-color: #0088f4;
border-style: solid;
box-sizing: content-box;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
color: #fff;
text-align: center;
font-size: 15px;
background-color: purple;
}
</style>
}
<script src="~/DesktopModules/ToSIC_SexyContent/JS/2sxc.api.min.js" data-enableoptimizations="100"></script>
<script src="~/DesktopModules/ToSIC_SexyContent/Js/AngularJS/angular.min.js" data-enableoptimizations="101"></script>
<script src="~/DesktopModules/ToSIC_SexyContent/Js/AngularJS/2sxc4ng.min.js" data-enableoptimizations="110"></script>
@functions
{
public HtmlString GetFiles(ToSic.SexyContent.DynamicEntity dynEntContent, bool bReverse = false)
{
var lFiles = AsAdam(dynEntContent, "Attachments").Files.ToList();
var iFilesCount = lFiles.Count();
var iTmp = 0;
var sRawHtmlString = "";
if (bReverse)
{
lFiles.Reverse();
}
if (iFilesCount > 0)
{
// sRawHtmlString = "« \r\n"; /* "«" */
sRawHtmlString = "« \r\n"; /* "«" */
foreach(var file in lFiles)
{
sRawHtmlString += "\t\t\t\t\t\t<" + $"a href='{@file.Url}'>{@file.FileName}</" + "a>";
sRawHtmlString += ((++iTmp < iFilesCount) ? " ‖\r\n" : "");
}
// sRawHtmlString += "\r\n\t\t\t\t »"; /* "»" */
sRawHtmlString += "\r\n\t\t\t\t\t »"; /* "»" */
}
return (@Html.Raw(sRawHtmlString));
}
}
<div class="app-announcments app-announcments-list">
<h2>
<div id="ulItem_Menu_(U)" name="ulItem_Menu_(U)" style="width: 100%; direction: ltr;">
<table style="width: 100%; padding: 0 5px 0 5px; border: solid 1pt black;" cellpadding="0" cellspacing="0">
<tr style="height: 55px;">
<td style="width: auto;" valign="top">
@if (Dnn.User.IsSuperUser)
{
@Edit.Toolbar(ListContent)
}
@if ((Dnn.User.IsInRole("Announcements")) && (Dnn.User.IsSuperUser == false))
{
@Edit.Toolbar(actions: "new",
contentType: "Announcements",
prefill: new {
UID = @Dnn.User.UserID,
PublishDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
PublishedBy = Dnn.User.FullName
}
)
}
</td>
<td style="text-align: right;">
לוח מודעות
</td>
</tr>
</table>
</div>
</h2>
@foreach(var li in List)
{
var anContent = li.Content;
var sMnuItem = "ulItem_" + anContent.EntityId + "_Menu_" + ((Dnn.User.IsSuperUser) ? "(SU)" : "(U)");
var sAdminCommands = "[ " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"new\"," +
" \"sortOrder\" : 0," +
" \"prefill\" : {" +
" \"UID\" : " + Dnn.User.UserID + "," +
" \"PublishDate\" : \"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "\"," +
" \"PublishedBy\" : \"" + Dnn.User.FullName + "\"" +
" } " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"action\" : \"edit\"," +
" \"sortOrder\" : 0 " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"action\" : \"remove\"," +
" \"sortOrder\" : 0 " +
"}, " +
// "{" +
// " \"attributeSetName\" : \"Announcements\"," +
// " \"action\" : \"replace\" " +
// "}, " +
"{" +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"publish\"," +
" \"sortOrder\" : 0 " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"more\"," +
" \"sortOrder\" : 0 " +
"}" +
" ]";
var sUserCommandsInAnnouncement = "[ " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"new\"," +
" \"sortOrder\" : 0," +
" \"prefill\" : {" +
" \"UID\" : " + Dnn.User.UserID + "," +
" \"PublishDate\" : \"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "\"," +
" \"PublishedBy\" : \"" + Dnn.User.FullName + "\"" +
" } " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"action\" : \"edit\"," +
" \"sortOrder\" : 0 " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"action\" : \"remove\"," +
" \"sortOrder\" : 0 " +
"}, " +
"{" +
" \"entityId\" : \"" + anContent.EntityId + "\"," +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"publish\"," +
" \"sortOrder\" : 0 " +
"}, " +
"{" +
" \"attributeSetName\" : \"Announcements\"," +
" \"action\" : \"more\"," +
" \"sortOrder\" : 0 " +
"}" +
" ]";
<hr/>
<div class="app-announcments-item sc-element">
<div name="divInfoInAnnouncement">
@if (Dnn.User.IsSuperUser)
{
<!-- ## [Super User] block : BEGIN (line 152) ## -->
<ul id='@sMnuItem' name='@sMnuItem' class='sc-menu' data-toolbar='@Html.Raw(@sAdminCommands)'></ul>
<!-- ## [Super User] block : END (line 154) ## -->
}
@if ((Dnn.User.IsInRole("Announcements")) && (Dnn.User.IsSuperUser == false))
{
<!-- ## [Announcements User] block: BEGIN (line 158) ## -->
<ul id='@sMnuItem' name='@sMnuItem' class='sc-menu' data-toolbar='@Html.Raw(@sUserCommandsInAnnouncement)'></ul>
<!-- ## [Announcements User] block: END (line 160) ## -->
}
</div>
<div class="app-announcments-link" title="@anContent.AnnouncementTitle">
<table class="app-announcments-text" style="width: 100%; padding: 0 10px 10px 10px;" cellpadding="0" cellspacing="0">
<tr>
<td>
<h4>@anContent.AnnouncementTitle</h4>
פורסם על ידי:
<a href="mailto:@Dnn.User.Email" alt="@Dnn.User.Email">@anContent.PublishedBy</a>
</td>
<td valign="top">
<span class="app-announcments-date">@anContent.PublishDate.ToString("yyyy-MM-dd HH:mm")</span>
</td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td colspan="2">
@Html.Raw(anContent.AnnouncementBody)
</td>
</tr>
<tr>
<td colspan="2">
@if (AsAdam(anContent, "Attachments").Files.Count > 0)
{
<div id="divFiles" name="divFiles" style="height: 1em; font-size: 14pt; text-align: center; background: #f3f3f3; color: black; direction: ltr; padding: 5px 0 5px 0;">
@GetFiles(anContent, false)
</div>
}
</td>
</tr>
</table>
</div>
</div>
} @* foreach(var li in List) *@
</div>
...和(大部分)CSS - 我删除了一些不相关的。(大部分代码 css 来自原始的“新闻 - 简单”2sxc 应用程序):
/* 细节样式 */ .app-announcments-detail .app-announcments-image { /* 底部边距:20px;*/ 边框半径:4px; } .app-announcments-detail-trimmed { -o-text-overflow:省略号;/* 歌剧 */ 文本溢出:省略号;/* IE, Safari (WebKit) */ 溢出:隐藏;/* 不显示多余的字符 */ 空白:nowrap;/* 强制单行 */ /* 底部边距:25px; */ 宽度:300px;/* 固定宽度 */ 高度:50px;/* 固定高度 */ } /* 列表样式 */ .app-announcments-item .app-announcments-image { 向左飘浮; 宽度:38.19% /* 黄金比例 */; /* 填充:0 10px 10px 0; */ } .app-announcments-item { 底部填充:20px;边距底部:0px; } div.app-announcements-link { 显示:块;文字装饰:无;颜色:#666; /* 背景颜色:#fcfcfc; */ 背景颜色:白色; /* 填充:10px 10px 0 10px; */ 溢出:隐藏; 边框半径:4px; -webkit-box-shadow: 0px 0px 10px 0px rgba(204,204,204,1); -moz-box-shadow: 0px 0px 10px 0px rgba(204,204,204,1); 盒子阴影:0px 0px 10px 0px rgba(204,204,204,1); -webkit-transition:全1轻松; -moz-transition:全1轻松;-o-transition:全1轻松; 过渡:全1轻松; } div.app-announcments-link:悬停, div.app-announcments-link:focus { 边框半径:6px;/* 背景颜色:#eee; */ 背景颜色:#f3f3f3;-webkit-transition:全1轻松; -moz-transition:全1轻松; -o-transition:全1轻松;过渡:全1轻松; } div.app-announcments-link:hover h3, div.app-announcments-link:focus h3, div.app-announcments-link:hover h2, div.app-announcments-link:focus h2 { 颜色:#000;-webkit-transition:全1轻松; -moz-transition:全1轻松;-o-transition:全1轻松; 过渡:全1轻松; } /* 纽扣 */ div.app-公告按钮, .app-announcements-button { /* 内边距:10px;*/ 背景:#666;白颜色; 显示:内联块;边框半径:2px; } div.app-announcments-link:hover .app-announcments-button, div.app-announcments-link:focus .app-announcments-button, div.app-announcments-button:悬停, div.app-announcments-button:focus { 背景:#000;-webkit-transition:全1轻松; -moz-transition:全1轻松;-o-transition:全1轻松; 过渡:全1轻松; } /************************/ table.app-announcments-link { 显示:块;文字装饰:无;颜色:#666; /* 背景颜色:#fcfcfc; */ 背景颜色:白色; /* 填充:10px 10px 0 10px; */ 溢出:隐藏;边框半径:4px; -webkit-box-shadow: 0px 0px 10px 0px rgba(204,204,204,1); -moz-box-shadow: 0px 0px 10px 0px rgba(204,204,204,1); 盒子阴影:0px 0px 10px 0px rgba(204,204,204,1); -webkit-transition:全1轻松;-moz-transition:全1轻松; -o-transition:全1轻松;过渡:全1轻松; } table.app-announcments-link:悬停, table.app-announcments-link:focus { 边框半径:6px;/* 背景颜色:#eee; */ 背景颜色:#f3f3f3;-webkit-transition:全1轻松; -moz-transition:全1轻松; -o-transition:全1轻松;过渡:全1轻松; } table.app-announcments-link:hover h3, table.app-announcments-link:focus h3, table.app-announcments-link:hover h2, table.app-announcments-link:focus h2 { 颜色:#000;-webkit-transition:全1轻松; -moz-transition:全1轻松; -o-transition:全1轻松;过渡:全1轻松; } /* 纽扣 */ table.app-公告按钮, .app-announcements-button { /* 内边距:10px;*/ 背景:#666;白颜色; 显示:内联块;边框半径:2px; } table.app-announcments-link:hover .app-announcments-button, table.app-announcments-link:focus .app-announcments-button, table.app-announcments-button:悬停, table.app-announcments-button:focus { 背景:#000;-webkit-transition:全1轻松; -moz-transition:全1轻松;-o-transition:全1轻松; 过渡:全1轻松; }