├── assets
├── livechat-module.png
└── livechat-settings.png
├── src
├── LiveChat.OrchardCore
│ ├── Views
│ │ ├── Items
│ │ │ ├── LiveChatDeploymentStep.Edit.cshtml
│ │ │ ├── LiveChatDeploymentStep.Thumbnail.cshtml
│ │ │ └── LiveChatDeploymentStep.Summary.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── LiveChatSettings.Edit.cshtml
│ ├── Models
│ │ └── LiveChatSettings.cs
│ ├── ViewModels
│ │ └── LiveChatSettingsViewModel.cs
│ ├── Deployment
│ │ ├── LiveChatDeploymentStep.cs
│ │ ├── LiveChatDeploymentStepDriver.cs
│ │ └── LiveChatDeploymentSource.cs
│ ├── Manifest.cs
│ ├── LiveChat.OrchardCore.csproj
│ ├── Permissions.cs
│ ├── Startup.cs
│ ├── AdminMenu.cs
│ ├── Filters
│ │ └── LiveChatFilter.cs
│ └── Drivers
│ │ └── LiveChatSettingsDisplayDriver.cs
├── Directory.Build.props
└── Common.props
├── NuGet.config
├── appveyor.yml
├── LICENSE
├── LiveChat.sln
├── .gitignore
└── README.md
/assets/livechat-module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidhayden/LiveChat/HEAD/assets/livechat-module.png
--------------------------------------------------------------------------------
/assets/livechat-settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidhayden/LiveChat/HEAD/assets/livechat-settings.png
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Views/Items/LiveChatDeploymentStep.Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model dynamic
2 |
3 |
@T["Live Chat"]
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Views/Items/LiveChatDeploymentStep.Thumbnail.cshtml:
--------------------------------------------------------------------------------
1 | @model dynamic
2 |
3 | @T["Live Chat"]
4 | @T["Exports Live Chat Site Settings."]
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Views/Items/LiveChatDeploymentStep.Summary.cshtml:
--------------------------------------------------------------------------------
1 | @model dynamic
2 |
3 | @T["Live Chat"]
4 |
5 | @T["Adds Live Chat settings to the plan."]
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Models/LiveChatSettings.cs:
--------------------------------------------------------------------------------
1 | namespace LiveChat.OrchardCore.Models {
2 | public class LiveChatSettings {
3 | public bool Enable { get; set; }
4 | public string Text { get; set; }
5 | }
6 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/ViewModels/LiveChatSettingsViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace LiveChat.OrchardCore.ViewModels {
2 | public class LiveChatSettingsViewModel {
3 | public bool Enable { get; set; }
4 | public string Text { get; set; }
5 | }
6 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Deployment/LiveChatDeploymentStep.cs:
--------------------------------------------------------------------------------
1 | using OrchardCore.Deployment;
2 |
3 | namespace LiveChat.OrchardCore.Deployment {
4 | public class LiveChatDeploymentStep : DeploymentStep {
5 | public LiveChatDeploymentStep() {
6 | Name = "LiveChat";
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @*
2 | For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
3 | *@
4 |
5 | @inherits OrchardCore.DisplayManagement.Razor.RazorPage
6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7 | @addTagHelper *, OrchardCore.DisplayManagement
8 | @addTagHelper *, OrchardCore.ResourceManagement
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Manifest.cs:
--------------------------------------------------------------------------------
1 | using OrchardCore.Modules.Manifest;
2 |
3 | [assembly: Module(
4 | Name = "Live Chat",
5 | Author = "David Hayden",
6 | Website = "https://www.davidhayden.me",
7 | Version = "1.0.0-rc2",
8 | Description = "Provides settings for adding live chat functionality to website.",
9 | Dependencies = new [] { "OrchardCore.Admin", "OrchardCore.Resources" },
10 | Category = "Content"
11 | )]
--------------------------------------------------------------------------------
/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | LiveChat.OrchardCore
5 | Live Chat Module for Orchard Core
6 | Provides settings for adding live chat functionality to website.
7 | Chat;LiveChat;OrchardCore
8 | 1.0.0
9 | rc2
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Views/LiveChatSettings.Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model LiveChat.OrchardCore.ViewModels.LiveChatSettingsViewModel
2 |
3 |
9 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2019
2 | init:
3 | - git config --global core.autocrlf true
4 | install:
5 | - ps: $env:BuildNumber= $env:APPVEYOR_BUILD_NUMBER
6 | - ps: $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = true
7 | - ps: $env:NUGET_XMLDOC_MODE = "skip"
8 | - ps: $env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
9 | build_script:
10 | - dotnet --version
11 | - dotnet restore
12 | - dotnet build -c Release
13 | - dotnet pack -c Release
14 | artifacts:
15 | - path: 'src\**\*.nupkg'
16 | deploy:
17 | - provider: NuGet
18 | on:
19 | branch: master
20 | server: https://www.myget.org/F/davidhayden-ci/api/v2/package
21 | api_key:
22 | secure: zO9VvXdyZxlJe4oXgfO5NBtulXZUZ5YWLvI+YoKn0TFW7mq7hL/GZuxt1O2t7D7K
23 | skip_symbols: true
24 | artifact: /.*\.nupkg/
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/LiveChat.OrchardCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Permissions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 | using OrchardCore.Security.Permissions;
5 |
6 | namespace LiveChat.OrchardCore {
7 | public class Permissions : IPermissionProvider {
8 | public static readonly Permission ManageLiveChat = new Permission("ManageLiveChat", "Manage Live Chat");
9 |
10 | public Task> GetPermissionsAsync() {
11 | return Task.FromResult(new[] {
12 | ManageLiveChat
13 | }.AsEnumerable());
14 | }
15 |
16 | public IEnumerable GetDefaultStereotypes() {
17 | return new[] {
18 | new PermissionStereotype {
19 | Name = "Administrator",
20 | Permissions = new[] {ManageLiveChat}
21 | }
22 | };
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Deployment/LiveChatDeploymentStepDriver.cs:
--------------------------------------------------------------------------------
1 | using OrchardCore.Deployment;
2 | using OrchardCore.DisplayManagement.Handlers;
3 | using OrchardCore.DisplayManagement.Views;
4 |
5 | namespace LiveChat.OrchardCore.Deployment
6 | {
7 | public class LiveChatDeploymentStepDriver : DisplayDriver
8 | {
9 | public override IDisplayResult Display(LiveChatDeploymentStep step)
10 | {
11 | return
12 | Combine(
13 | View("LiveChatDeploymentStep_Summary", step).Location("Summary", "Content"),
14 | View("LiveChatDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content")
15 | );
16 | }
17 |
18 | public override IDisplayResult Edit(LiveChatDeploymentStep step)
19 | {
20 | return View("LiveChatDeploymentStep_Edit", step).Location("Content");
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 David Hayden
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Deployment/LiveChatDeploymentSource.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using LiveChat.OrchardCore.Models;
3 | using Newtonsoft.Json.Linq;
4 | using OrchardCore.Deployment;
5 | using OrchardCore.Entities;
6 | using OrchardCore.Settings;
7 |
8 | namespace LiveChat.OrchardCore.Deployment {
9 | public class LiveChatDeploymentSource : IDeploymentSource {
10 | private readonly ISiteService _siteService;
11 |
12 | public LiveChatDeploymentSource(ISiteService siteService) {
13 | _siteService = siteService;
14 | }
15 |
16 | public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result) {
17 | var liveChatState = step as LiveChatDeploymentStep;
18 |
19 | if (liveChatState == null) {
20 | return;
21 | }
22 |
23 | var siteSettings = await _siteService.GetSiteSettingsAsync();
24 |
25 | // Adding Layer settings
26 | result.Steps.Add(new JObject(
27 | new JProperty("name", "Settings"),
28 | new JProperty("LiveChatSettings", JObject.FromObject(siteSettings.As()))
29 | ));
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Startup.cs:
--------------------------------------------------------------------------------
1 | using LiveChat.OrchardCore.Deployment;
2 | using LiveChat.OrchardCore.Drivers;
3 | using LiveChat.OrchardCore.Filters;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Microsoft.Extensions.DependencyInjection;
6 | using OrchardCore.Deployment;
7 | using OrchardCore.DisplayManagement.Handlers;
8 | using OrchardCore.Navigation;
9 | using OrchardCore.Modules;
10 | using OrchardCore.Security.Permissions;
11 | using OrchardCore.Settings;
12 |
13 | namespace LiveChat.OrchardCore {
14 | public class Startup : StartupBase {
15 | public override void ConfigureServices(IServiceCollection services) {
16 | services.AddScoped, LiveChatSettingsDisplayDriver>();
17 | services.AddScoped();
18 | services.AddScoped();
19 |
20 | services.AddTransient();
21 | services.AddSingleton(new DeploymentStepFactory());
22 | services.AddScoped, LiveChatDeploymentStepDriver>();
23 |
24 | services.Configure((options) => { options.Filters.Add(typeof(LiveChatFilter)); });
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/AdminMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using LiveChat.OrchardCore.Drivers;
4 | using Microsoft.Extensions.Localization;
5 | using OrchardCore.Navigation;
6 |
7 | namespace LiveChat.OrchardCore {
8 | public class AdminMenu : INavigationProvider {
9 | public AdminMenu(IStringLocalizer localizer) {
10 | T = localizer;
11 | }
12 |
13 | public IStringLocalizer T { get; set; }
14 |
15 | public Task BuildNavigationAsync(string name, NavigationBuilder builder) {
16 | if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) {
17 | return Task.CompletedTask;
18 | }
19 |
20 | builder
21 | .Add(T["Configuration"], configuration => configuration
22 | .Add(T["Settings"], settings => settings
23 | .Add(T["Live Chat"], T["Live Chat"], chat => chat
24 | .Action("Index", "Admin",
25 | new {area = "OrchardCore.Settings", groupId = LiveChatSettingsDisplayDriver.GroupId})
26 | .Permission(Permissions.ManageLiveChat)
27 | .LocalNav()
28 | )));
29 |
30 | return Task.CompletedTask;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | David Hayden
5 | David Hayden
6 | https://github.com/davidhayden/LiveChat
7 | https://github.com/davidhayden/LiveChat
8 | https://github.com/davidhayden/LiveChat/blob/master/LICENSE
9 | netcoreapp3.1
10 | $(VersionSuffix)-$(BuildNumber)
11 | true
12 | embedded
13 | true
14 | false
15 | false
16 | false
17 | false
18 | false
19 | false
20 | false
21 | false
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Filters/LiveChatFilter.cs:
--------------------------------------------------------------------------------
1 | using LiveChat.OrchardCore.Models;
2 | using Microsoft.AspNetCore.Html;
3 | using Microsoft.AspNetCore.Mvc;
4 | using Microsoft.AspNetCore.Mvc.Filters;
5 | using OrchardCore.Admin;
6 | using OrchardCore.Entities;
7 | using OrchardCore.ResourceManagement;
8 | using OrchardCore.Settings;
9 |
10 | namespace LiveChat.OrchardCore.Filters {
11 | public class LiveChatFilter : IResultFilter {
12 | private readonly IResourceManager _resourceManager;
13 | private readonly ISiteService _siteService;
14 |
15 | public LiveChatFilter(IResourceManager resourceManager, ISiteService siteService) {
16 | _resourceManager = resourceManager;
17 | _siteService = siteService;
18 | }
19 |
20 | public async void OnResultExecuting(ResultExecutingContext filterContext) {
21 | var siteSettings = await _siteService.GetSiteSettingsAsync();
22 | var settings = siteSettings.As();
23 |
24 | // Display only when enabled
25 | if (settings == null || !settings.Enable) {
26 | return;
27 | }
28 |
29 | // Don't display on admin pages
30 | if (AdminAttribute.IsApplied(filterContext.HttpContext)) {
31 | return;
32 | }
33 |
34 | // Should only run on a full view rendering result
35 | if (!(filterContext.Result is ViewResult)) {
36 | return;
37 | }
38 |
39 | var content = new HtmlString(settings.Text);
40 |
41 | _resourceManager.RegisterFootScript(content);
42 | }
43 |
44 | public void OnResultExecuted(ResultExecutedContext filterContext) { }
45 | }
46 | }
--------------------------------------------------------------------------------
/LiveChat.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26124.0
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7C0A1D5-CF0A-4A94-AC39-7A74B9C8D25A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveChat.OrchardCore", "src\LiveChat.OrchardCore\LiveChat.OrchardCore.csproj", "{4951AD53-4EBE-4B6D-9225-72EBC91C64AB}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|x64 = Debug|x64
14 | Debug|x86 = Debug|x86
15 | Release|Any CPU = Release|Any CPU
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|x64.ActiveCfg = Debug|Any CPU
26 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|x64.Build.0 = Debug|Any CPU
27 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|x86.ActiveCfg = Debug|Any CPU
28 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Debug|x86.Build.0 = Debug|Any CPU
29 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|Any CPU.Build.0 = Release|Any CPU
31 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|x64.ActiveCfg = Release|Any CPU
32 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|x64.Build.0 = Release|Any CPU
33 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|x86.ActiveCfg = Release|Any CPU
34 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB}.Release|x86.Build.0 = Release|Any CPU
35 | EndGlobalSection
36 | GlobalSection(NestedProjects) = preSolution
37 | {4951AD53-4EBE-4B6D-9225-72EBC91C64AB} = {C7C0A1D5-CF0A-4A94-AC39-7A74B9C8D25A}
38 | EndGlobalSection
39 | EndGlobal
40 |
--------------------------------------------------------------------------------
/src/LiveChat.OrchardCore/Drivers/LiveChatSettingsDisplayDriver.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using LiveChat.OrchardCore.Models;
3 | using LiveChat.OrchardCore.ViewModels;
4 | using Microsoft.AspNetCore.Authorization;
5 | using Microsoft.AspNetCore.Http;
6 | using OrchardCore.DisplayManagement.Entities;
7 | using OrchardCore.DisplayManagement.Handlers;
8 | using OrchardCore.DisplayManagement.Views;
9 | using OrchardCore.Settings;
10 |
11 | namespace LiveChat.OrchardCore.Drivers {
12 | public class LiveChatSettingsDisplayDriver : SectionDisplayDriver {
13 | public const string GroupId = "chat";
14 | private readonly IHttpContextAccessor _httpContextAccessor;
15 | private readonly IAuthorizationService _authorizationService;
16 |
17 | public LiveChatSettingsDisplayDriver(
18 | IHttpContextAccessor httpContextAccessor,
19 | IAuthorizationService authorizationService) {
20 | _httpContextAccessor = httpContextAccessor;
21 | _authorizationService = authorizationService;
22 | }
23 |
24 | public override async Task EditAsync(LiveChatSettings settings, BuildEditorContext context) {
25 | var user = _httpContextAccessor.HttpContext?.User;
26 |
27 | if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageLiveChat)) {
28 | return null;
29 | }
30 |
31 | return Initialize("LiveChatSettings_Edit", m => {
32 | m.Enable = settings.Enable;
33 | m.Text = settings.Text;
34 | }).Location("Content:1").OnGroup(GroupId);
35 | }
36 |
37 | public override async Task UpdateAsync(LiveChatSettings settings, BuildEditorContext context) {
38 | var user = _httpContextAccessor.HttpContext?.User;
39 |
40 | if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageLiveChat)) {
41 | return null;
42 | }
43 |
44 | if (context.GroupId == GroupId) {
45 | var model = new LiveChatSettingsViewModel();
46 |
47 | await context.Updater.TryUpdateModelAsync(model, Prefix);
48 |
49 | settings.Enable = model.Enable;
50 | settings.Text = model.Text;
51 | }
52 |
53 | return await EditAsync(settings, context);
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 | *.sln.ide/
9 |
10 | # Build results
11 |
12 | [Dd]ebug/
13 | [Rr]elease/
14 | x64/
15 | build/
16 | app.publish/
17 | [Bb]in/
18 | [Oo]bj/
19 |
20 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
21 | !packages/*/build/
22 |
23 | # MSTest test Results
24 | [Tt]est[Rr]esult*/
25 | [Bb]uild[Ll]og.*
26 |
27 | *_i.c
28 | *_p.c
29 | *.ilk
30 | *.meta
31 | *.obj
32 | *.pch
33 | *.pdb
34 | *.pgc
35 | *.pgd
36 | *.rsp
37 | *.sbr
38 | *.tlb
39 | *.tli
40 | *.tlh
41 | *.tmp
42 | *.tmp_proj
43 | *.log
44 | *.vspscc
45 | *.vssscc
46 | .builds
47 | *.pidb
48 | *.log
49 | *.scc
50 | project.lock.json
51 |
52 | # Visual C++ cache files
53 | ipch/
54 | *.aps
55 | *.ncb
56 | *.opensdf
57 | *.sdf
58 | *.cachefile
59 |
60 | # Visual Studio profiler
61 | *.psess
62 | *.vsp
63 | *.vspx
64 |
65 | # Guidance Automation Toolkit
66 | *.gpState
67 |
68 | # ReSharper is a .NET coding add-in
69 | _ReSharper*/
70 | *.[Rr]e[Ss]harper
71 |
72 | # TeamCity is a build add-in
73 | _TeamCity*
74 |
75 | # DotCover is a Code Coverage Tool
76 | *.dotCover
77 |
78 | # NCrunch
79 | *.ncrunch*
80 | .*crunch*.local.xml
81 |
82 | # Installshield output folder
83 | [Ee]xpress/
84 |
85 | # DocProject is a documentation generator add-in
86 | DocProject/buildhelp/
87 | DocProject/Help/*.HxT
88 | DocProject/Help/*.HxC
89 | DocProject/Help/*.hhc
90 | DocProject/Help/*.hhk
91 | DocProject/Help/*.hhp
92 | DocProject/Help/Html2
93 | DocProject/Help/html
94 |
95 | # Click-Once directory
96 | publish/
97 |
98 | # Publish Web Output
99 | *.Publish.xml
100 | *.pubxml
101 |
102 | # NuGet Packages Directory
103 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
104 | packages/
105 |
106 | # Windows Azure Build Output
107 | csx
108 | *.build.csdef
109 |
110 | # Windows Store app package directory
111 | AppPackages/
112 |
113 | # Others
114 | *.Cache
115 | !OrchardCore.Environment.Cache
116 | ClientBin/
117 | [Ss]tyle[Cc]op.*
118 | ~$*
119 | *~
120 | *.dbmdl
121 | *.[Pp]ublish.xml
122 | *.pfx
123 | *.publishsettings
124 |
125 | # RIA/Silverlight projects
126 | Generated_Code/
127 |
128 | # Backup & report files from converting an old project file to a newer
129 | # Visual Studio version. Backup files are not needed, because we have git ;-)
130 | _UpgradeReport_Files/
131 | Backup*/
132 | UpgradeLog*.XML
133 | UpgradeLog*.htm
134 |
135 | # SQL Server files
136 | App_Data/*.mdf
137 | App_Data/*.ldf
138 |
139 | # =========================
140 | # Windows detritus
141 | # =========================
142 |
143 | # Windows image file caches
144 | Thumbs.db
145 | ehthumbs.db
146 |
147 | # Folder config file
148 | Desktop.ini
149 |
150 | # Recycle Bin used on file shares
151 | $RECYCLE.BIN/
152 |
153 | # Mac crap
154 | .DS_Store
155 |
156 | # =========================
157 | # Orchard specifics
158 | # =========================
159 |
160 | App_Data/
161 | glob:*.user
162 | *.patch
163 | *.hg
164 | build/
165 | /buildazure
166 | /buildtasks
167 | /artifacts
168 | site/
169 | *.sln.cache
170 | src/OrchardCore.Modules/**/launchSettings.json
171 | src/OrchardCore.Themes/**/launchSettings.json
172 | log.xml
173 | profiling/
174 | *.orig
175 | .vs/
176 | .vscode/
177 | .build/
178 | .testPublish/
179 | .idea/
180 |
181 | nuget.exe
182 | .nuget/
183 |
184 | #enable all /lib artifacts
185 | !lib/*/*.*
186 |
187 | #exclude node modules
188 | node_modules/
189 |
190 | wwwroot
191 | !src/OrchardCore.Modules/**/wwwroot
192 | !src/OrchardCore.Themes/**/wwwroot
193 | !src/Templates/**/content/**
194 | .template.config/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LiveChat
2 |
3 | LiveChat.OrchardCore is an Orchard Core CMS Module that provides the necessary settings to add script code from your live chat service to the website.
4 |
5 | ## Status
6 |
7 | [](https://ci.appveyor.com/project/davidhayden/livechat) [](https://www.myget.org/feed/davidhayden-ci/package/nuget/LiveChat.OrchardCore)
8 |
9 | ## Getting Started
10 |
11 | Add the NuGet package, **LiveChat.OrchardCore**, to the Orchard Core CMS Website. Launch the website and sign in as an administrator to enable the module from the dashboard under Configuration -> Features.
12 |
13 | 
14 |
15 | Add the script code from your live chat service to the settings area provided by the module, Configuration -> Settings -> Live Chat.
16 |
17 | 
18 |
19 | Make sure you check Enable to activate live chat and click Save to save the settings.
20 |
21 | Visit the front-end of your website. The script code will be injected at the bottom of every non-admin page just above the closing `body` tag.
22 |
23 | ## Troubleshooting
24 |
25 | If your live chat service is not displaying on the website, here are some common problems.
26 |
27 | * **Incorrect Script Code**: Please double-check the script you entered into settings is correct and your live chat service is active and configured properly.
28 | * **Live Chat Not Enabled**: The Enable checkbox allows you to turn on and off live chat without removing the code. Make sure you have checked Enable.
29 | * **Missing FootScript from Theme Layout**: The script code is injected into the website using Orchard Core's `ResourceManager`. Verify your theme's layout is injecting resources of type `FootScript`.
30 |
31 | See the Orchard Core Documentation for more information on [Resources](https://orchardcore.readthedocs.io/en/latest/OrchardCore.Modules/OrchardCore.Resources/README/).
32 |
33 | ## Customizations
34 |
35 | The module is easily customizable. Here are a couple possible customizations depending on your needs.
36 |
37 | ### Injecting Live Chat at Head of Page
38 |
39 | If you prefer your live chat script be added within the `head` tag of the page instead of before the closing `body` tag, you can change the `LiveChatFilter` code to inject the code as HeadScript.
40 |
41 | ```
42 | // _resourceManager.RegisterFootScript(content);
43 | _resourceManager.RegisterHeadScript(content);
44 | ```
45 |
46 | ### Requesting Live Chat Code Instead of Script in Settings
47 |
48 | Many third-party plugins ask for a code, instead of a script, from the live chat service. These plugins are usually specific to a certain service and a bit more fragile since they need to be updated when the script they embed changes. Asking for a script avoids frequent updates and allows the module to support multiple live chat services.
49 |
50 | However, you can modify the module to request a code in settings instead of a script by changing `LiveChatSettings.Edit.cshtml`. You can then embed the live chat service's script in the module and generate the script using the code before the call to `_resourceManager`.
51 |
52 | ```
53 | var code = new HtmlString(settings.Text);
54 | var content = GenerateScript(code);
55 | _resourceManager.RegisterFootScript(content);
56 | ```
57 |
58 | ## Road map
59 |
60 | There is 1 planned enhancement:
61 |
62 | * **Caching**: Caching will be implemented using `IMemoryCache`.
63 |
64 | ## Credits
65 | LiveChat.OrchardCore is created and maintained by David Hayden.
66 |
--------------------------------------------------------------------------------