8000 editor · githubsunyf/cms@c204748 · GitHub
[go: up one dir, main page]

Skip to content

Commit c204748

Browse files
committed
editor
1 parent 2cda28e commit c204748

File tree

305 files changed

+40244
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+40244
-94
lines changed

SiteServer.BackgroundPages/Cms/PageConfigurationSiteAttributes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private string GetAttributesHtml(NameValueCollection formCollection)
7575

7676
if (InputTypeUtils.Equals(styleInfo.InputType, InputType.TextEditor))
7777
{
78-
var commands = WebUtils.GetTextEditorCommands(SiteInfo, styleInfo.AttributeName);
78+
var commands = WebUtils.GetTextEditorCommands(SiteInfo, 0, styleInfo.AttributeName);
7979
builder.Append($@"
8080
<div class=""form-group"">
8181
<label class=""control-label"">{styleInfo.DisplayName}</label>

SiteServer.BackgroundPages/Controls/AuxiliaryControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected override void Render(HtmlTextWriter output)
4444

4545
if (styleInfo.InputType == InputType.TextEditor)
4646
{
47-
var commands = WebUtils.GetTextEditorCommands(SiteInfo, styleInfo.AttributeName);
47+
var commands = WebUtils.GetTextEditorCommands(SiteInfo, ChannelId, styleInfo.AttributeName);
4848
builder.Append($@"
4949
<div class=""form-group form-row"">
5050
<label class=""col-sm-1 col-form-label text-right text-truncate text-nowrap"">{styleInfo.DisplayName}</label>

SiteServer.BackgroundPages/Core/WebUtils.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,12 @@ 整 理
235235
return builder.ToString();
236236
}
237237

238-
public static string GetTextEditorCommands(SiteInfo siteInfo, string attributeName)
238+
public static string GetTextEditorCommands(SiteInfo siteInfo, int channelId, string attributeName)
239239
{
240+
var url = $"editorLayerImage.cshtml?siteId={siteInfo.Id}&channelId={channelId}&attributeName={attributeName}";
241+
var insertImage = $@"utils.openLayer({{title: '插入图片', url: '{url}', width: 700, height: 500}});return false;";
242+
url = $"editorLayerText.cshtml?siteId={siteInfo.Id}&channelId={channelId}&attributeName={attributeName}";
243+
var insertText = $@"utils.openLayer({{title: '插入图文', url: '{url}', full: true}});return false;";
240244
return $@"
241245
<script type=""text/javascript"">
242246
function getWordSpliter(){{
@@ -276,13 +280,15 @@ function getWordSpliter(){{
276280
</script>
277281
<div class=""btn-group btn-group-sm"">
278282
<button class=""btn"" onclick=""{ModalTextEditorImportWord.GetOpenWindowString(siteInfo.Id, attributeName)}"">导入Word</button>
279-
<button class=""btn"" onclick=""{ModalTextEditorInsertImage.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入图片</button>
283+
<button class=""btn"" onclick=""{insertImage}"">插入图片</button>
280284
<button class=""btn"" onclick=""{ModalTextEditorInsertVideo.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入视频</button>
281285
<button class=""btn"" onclick=""{ModalTextEditorInsertAudio.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入音频</button>
286+
<button class=""btn"" onclick=""{insertText}"">插入图文</button>
282287
<button class=""btn"" onclick=""getWordSpliter();return false;"">提取关键字</button>
283288
<button class=""btn"" onclick=""detection_{attributeName}();return false;"">敏感词检测</button>
284289
</div>
285290
";
291+
// <button class=""btn"" onclick=""{ModalTextEditorInsertImage.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入图片</button>
286292
}
287293

288294
public static string GetAutoCheckKeywordsScript(SiteInfo siteInfo, List<string> allTagNames, List<string> tagNames)

SiteServer.CMS/Core/DataProvider.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public static DatabaseApi DatabaseApi
7979
private static KeywordDao _keywordDao;
8080
public static KeywordDao KeywordDao => _keywordDao ?? (_keywordDao = new KeywordDao());
8181

82+
private static LibraryGroupDao _libraryGroupDao;
83+
public static LibraryGroupDao LibraryGroupDao => _libraryGroupDao ?? (_libraryGroupDao = new LibraryGroupDao());
84+
85+
private static LibraryImageDao _libraryImageDao;
86+
public static LibraryImageDao LibraryImageDao => _libraryImageDao ?? (_libraryImageDao = new LibraryImageDao());
87+
88+
private static LibraryTextDao _libraryTextDao;
89+
public static LibraryTextDao LibraryTextDao => _libraryTextDao ?? (_libraryTextDao = new LibraryTextDao());
90+
8291
private static LogDao _logDao;
8392
public static LogDao LogDao => _logDao ?? (_logDao = new LogDao());
8493

@@ -159,6 +168,9 @@ public static void Reset()
159168
_dbCacheDao = null;
160169
_errorLogDao = null;
161170
_keywordDao = null;
171+
_libraryGroupDao = null;
172+
_libraryImageDao = null;
173+
_libraryTextDao = null;
162174
_logDao = null;
163175
_permissionsInRolesDao = null;
164176
_pluginConfigDao = null;
@@ -198,6 +210,9 @@ public static void Reset()
198210
DbCacheDao,
199211
ErrorLogDao,
200212
KeywordDao,
213+
LibraryGroupDao,
214+
LibraryImageDao,
215+
LibraryTextDao,
201216
LogDao,
202217
PermissionsInRolesDao,
203218
PluginConfigDao,

SiteServer.CMS/DataCache/ConfigManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static class SitePermissions
6363
public const string ContentsTranslate = "site_contentsTranslate";
6464
public const string ContentsCheck = "site_contentsCheck";
6565
public const string ContentsTrash = "site_contentsTrash";
66+
public const string Library = "site_library";
6667
public const string Templates = "site_templates";
6768
public const string Specials = "site_specials";
6869
public const string TemplatesMatch = "site_templatesMatch";

SiteServer.CMS/Model/ContentInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,9 @@ public override Dictionary<string, object> ToDictionary()
304304
var channelInfo = ChannelManager.GetChannelInfo(SiteId, ChannelId);
305305
var styleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, channelInfo);
306306

307-
foreach (var styleInfo in styleInfoList)
307+
if (siteInfo == null || channelInfo == null || styleInfoList == null) return dict;
308+
309+
foreach (var styleInfo in styleInfoList)
308310
{
309311
if (styleInfo.InputType == InputType.Image || styleInfo.InputType == InputType.File || styleInfo.InputType == InputType.Video)
310312
{

SiteServer.CMS/Model/Enumerations/LibraryType.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ namespace SiteServer.CMS.Model.Enumerations
1212
public enum LibraryType
1313
{
1414
Text,
15-
Image,
16-
Document,
17-
Audio,
18-
Video,
19-
File
15+
Image
2016
}
2117
}
Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
1-
using Datory;
1+
using System;
2+
using Datory;
23
using Newtonsoft.Json;
34
using SiteServer.CMS.Model.Enumerations;
45
using SiteServer.Utils;
56

67
namespace SiteServer.CMS.Model
78
{
8-
[DataTable("siteserver_LibraryGroup")]
9-
public class LibraryGroup : Entity
9+
public class LibraryGroupInfo
1010
{
11+
public int Id { get; set; }
12+
1113
[JsonIgnore]
1214
private string Type { get; set; }
1315

1416
public LibraryType LibraryType
1517
{
16-
get => TranslateUtils.ToEnum(Type, LibraryType.Document);
17-
set => Type = value.GetValue();
18+
get => GetEnumType(Type);
19+
set => Type = GetValue(value);
1820
}
1921

20-
[DataColumn]
2122
public string GroupName { get; set; }
23+
24+
public static LibraryType GetEnumType(string typeStr)
25+
{
26+
var retVal = LibraryType.Text;
27+
28+
if (Equals(LibraryType.Text, typeStr))
29+
{
30+
retVal = LibraryType.Text;
31+
}
32+
else if (Equals(LibraryType.Image, typeStr))
33+
{
34+
retVal = LibraryType.Image;
35+
}
36+
37+
return retVal;
38+
}
39+
40+
public static bool Equals(LibraryType type, string typeStr)
41+
{
42+
if (string.IsNullOrEmpty(typeStr)) return false;
43+
if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
44+
{
45+
return true;
46+
}
47+
return false;
48+
}
49+
50+
public static string GetValue(LibraryType type)
51+
{
52+
if (type == LibraryType.Text)
53+
{
54+
return "Text";
55+
}
56+
if (type == LibraryType.Image)
57+
{
58+
return "Image";
59+
}
60+
throw new Exception();
61+
}
2262
}
2363
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SiteServer.CMS.Model
8+
{
9+
public class LibraryImageInfo
10+
{
11+
public int Id { get; set; }
12+
13+
public string Title { get; set; }
14+
15+
public int GroupId { get; set; }
16+
17+
public string Url { get; set; }
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Datory;
2+
3+
namespace SiteServer.CMS.Model
4+
{
5+
public class LibraryTextInfo
6+
{
7+
public int Id { get; set; }
8+
9+
public string Title { get; set; }
10+
11+
public int GroupId { get; set; }
12+
13+
public string ImageUrl { get; set; }
14+
15+
public string Summary { get; set; }
16+
17+
public string Content { get; set; }
18+
}
19+
}

0 commit comments

Comments
 (0)
0