Compare commits
6 Commits
0b82942569
...
7a6fe07d04
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a6fe07d04 | |||
| 4b142d4e63 | |||
| 2b4e2f84a7 | |||
| 9c39e97126 | |||
| 3ddce62f54 | |||
| 1f443b2734 |
@@ -7,31 +7,48 @@
|
||||
@inherits ModuleBase
|
||||
@inject IBlackBoardService BlackBoardService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IReportingHandler ReportingHandler
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
@inject IReportUI ReportingComponent // TODO
|
||||
|
||||
<form @ref="form" class="@(validated ? " was-validated" : "needs-validation" )" novalidate>
|
||||
<div class="container">
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="col-sm-3" For="name" HelpText="Enter a name" ResourceKey="Name">Name: </Label>
|
||||
<div class="col-sm-9">
|
||||
<input id="name" class="form-control" @bind="@_name" required />
|
||||
<input id="name" class="form-control" @bind="@_blackBoard.Name" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="col-sm-3" For="description" HelpText="Enter a description" ResourceKey="Description">Beschreibung: </Label>
|
||||
<div class="col-sm-9">
|
||||
<FileManager AnonymizeUploadFilenames="true" UploadMultiple="false" ShowSuccess="true" FileId="@_blackBoard.ImageID" OnSelectFile="@OnFileSelected"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="" For="description" HelpText="Enter a description" ResourceKey="Description">Beschreibung: </Label>
|
||||
<RichTextEditor @ref="RichTextEditorHtml" @Content="@_blackBoard.Name" Placeholder="Enter a description: "/>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
||||
<button type="button" class="btn btn-danger" @onclick="Report">@Localizer["Report"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br /><br />
|
||||
|
||||
@if (ReportingComponent != null)
|
||||
{
|
||||
<DynamicComponent Type="@ReportingComponent.ReportType" Parameters="@_parameters"/>
|
||||
}
|
||||
|
||||
<br/><br/>
|
||||
@if (PageState.Action == "Edit")
|
||||
{
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
}
|
||||
</form>
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||
|
||||
public override string RenderMode => RenderModes.Interactive;
|
||||
|
||||
public override string Actions => "Add,Edit";
|
||||
|
||||
public override string Title => "Manage BlackBoard";
|
||||
@@ -41,16 +58,20 @@
|
||||
new Stylesheet("_content/SZUAbsolventenverein.Module.BlackBoard/Module.css")
|
||||
};
|
||||
|
||||
private RichTextEditor RichTextEditorHtml;
|
||||
private ElementReference form;
|
||||
private bool validated = false;
|
||||
|
||||
private int _id;
|
||||
private string _name;
|
||||
private string _createdby;
|
||||
private DateTime _createdon;
|
||||
private string _modifiedby;
|
||||
private DateTime _modifiedon;
|
||||
|
||||
// TODO
|
||||
private BlackBoard _blackBoard = new BlackBoard();
|
||||
private Dictionary<string, object> _parameters = new Dictionary<string, object>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
@@ -58,15 +79,16 @@
|
||||
if (PageState.Action == "Edit")
|
||||
{
|
||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||
if (BlackBoard != null)
|
||||
_blackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||
if (_blackBoard != null)
|
||||
{
|
||||
_name = BlackBoard.Name;
|
||||
_createdby = BlackBoard.CreatedBy;
|
||||
_createdon = BlackBoard.CreatedOn;
|
||||
_modifiedby = BlackBoard.ModifiedBy;
|
||||
_modifiedon = BlackBoard.ModifiedOn;
|
||||
_createdby = _blackBoard.CreatedBy;
|
||||
_createdon = _blackBoard.CreatedOn;
|
||||
_modifiedby = _blackBoard.ModifiedBy;
|
||||
_modifiedon = _blackBoard.ModifiedOn;
|
||||
}
|
||||
|
||||
_parameters = ReportingComponent.ConstructParameterList(_blackBoard, RenderModeBoundary);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -76,6 +98,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
private Task OnFileSelected(int fileId)
|
||||
{
|
||||
Console.WriteLine("File Selected: " + fileId);
|
||||
_blackBoard.ImageID = fileId;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
@@ -86,19 +115,16 @@
|
||||
{
|
||||
if (PageState.Action == "Add")
|
||||
{
|
||||
BlackBoard BlackBoard = new BlackBoard();
|
||||
BlackBoard.ModuleId = ModuleState.ModuleId;
|
||||
BlackBoard.Name = _name;
|
||||
BlackBoard = await BlackBoardService.AddBlackBoardAsync(BlackBoard);
|
||||
await logger.LogInformation("BlackBoard Added {BlackBoard}", BlackBoard);
|
||||
_blackBoard.ModuleId = ModuleState.ModuleId;
|
||||
_blackBoard = await BlackBoardService.AddBlackBoardAsync(_blackBoard);
|
||||
await logger.LogInformation("BlackBoard Added {BlackBoard}", _blackBoard);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||
BlackBoard.Name = _name;
|
||||
await BlackBoardService.UpdateBlackBoardAsync(BlackBoard);
|
||||
await logger.LogInformation("BlackBoard Updated {BlackBoard}", BlackBoard);
|
||||
await BlackBoardService.UpdateBlackBoardAsync(_blackBoard);
|
||||
await logger.LogInformation("BlackBoard Updated {BlackBoard}", _blackBoard);
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
@@ -112,19 +138,4 @@
|
||||
AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Report()
|
||||
{
|
||||
try
|
||||
{
|
||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||
BlackBoard.Name = _name;
|
||||
ReportingHandler.Report(BlackBoard, "Reported by user");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Reporting BlackBoard {BlackBoardId} {Error}", _id, ex.Message);
|
||||
AddModuleMessage(Localizer["Message.ReportError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Interfaces" Version="0.0.0-12" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
TargetFramework=$1
|
||||
ProjectName=$2
|
||||
|
||||
find . -name "*.nupkg" -delete
|
||||
"..\..\oqtane.framework\oqtane.package\FixProps.exe"
|
||||
"..\..\oqtane.framework\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName%
|
||||
dotnet run --project ../../fixProps/FixProps/FixProps.csproj
|
||||
dotnet pack $ProjectName.nuspec "/p:targetframework=${TargetFramework};projectname=${ProjectName}"
|
||||
cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\"
|
||||
38
Server/Infrastructure/BlackBoardDigestJob.cs
Normal file
38
Server/Infrastructure/BlackBoardDigestJob.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Oqtane.Infrastructure;
|
||||
using Oqtane.Repository;
|
||||
|
||||
namespace SZUAbsolventenverein.Module.BlackBoard.Infrastructure
|
||||
{
|
||||
public class BlackBoardDigestJob : HostedServiceBase
|
||||
{
|
||||
// JobType = "SZUAbsolventenverein.Module.BlackBoard.Infrastructure, SZUAbsolventenverein.Module.BlackBoard.Server.Oqtane"
|
||||
|
||||
public BlackBoardDigestJob(IServiceScopeFactory serviceScopeFactory) : base(serviceScopeFactory)
|
||||
{
|
||||
Name = "BlackBoardDigestJob";
|
||||
Frequency = "m";
|
||||
Interval = 1;
|
||||
IsEnabled = false;
|
||||
}
|
||||
|
||||
public override Task<string> ExecuteJobAsync(IServiceProvider provider)
|
||||
{
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
var sites = provider.GetRequiredService<ISiteRepository>();
|
||||
|
||||
foreach (var site in sites.GetSites())
|
||||
{
|
||||
log.AppendLine(site.Name);
|
||||
}
|
||||
|
||||
return Task.FromResult(log.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Migrations.EntityBuilders
|
||||
private const string _entityTableName = "SZUAbsolventenvereinBlackBoard";
|
||||
private readonly PrimaryKey<BlackBoardEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinBlackBoard", x => x.BlackBoardId);
|
||||
private readonly ForeignKey<BlackBoardEntityBuilder> _moduleForeignKey = new("FK_SZUAbsolventenvereinBlackBoard_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
||||
private readonly ForeignKey<BlackBoardEntityBuilder> _fileForeignKey = new("FK_SZUAbsolventenvereinBlackBoard_File", x => x.ImageID, "File", "FileId", ReferentialAction.Cascade);
|
||||
|
||||
public BlackBoardEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
ForeignKeys.Add(_moduleForeignKey);
|
||||
ForeignKeys.Add(_fileForeignKey);
|
||||
}
|
||||
|
||||
protected override BlackBoardEntityBuilder BuildTable(ColumnsBuilder table)
|
||||
@@ -25,6 +27,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Migrations.EntityBuilders
|
||||
BlackBoardId = AddAutoIncrementColumn(table,"BlackBoardId");
|
||||
ModuleId = AddIntegerColumn(table,"ModuleId");
|
||||
Name = AddMaxStringColumn(table,"Name");
|
||||
ImageID = AddIntegerColumn(table,"ImageID");
|
||||
AddAuditableColumns(table);
|
||||
return this;
|
||||
}
|
||||
@@ -32,5 +35,6 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Migrations.EntityBuilders
|
||||
public OperationBuilder<AddColumnOperation> BlackBoardId { get; set; }
|
||||
public OperationBuilder<AddColumnOperation> ModuleId { get; set; }
|
||||
public OperationBuilder<AddColumnOperation> Name { get; set; }
|
||||
public OperationBuilder<AddColumnOperation> ImageID { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Models
|
||||
public int BlackBoardId { get; set; }
|
||||
public int ModuleId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int ImageID { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string ModuleName => "BlackBoard";
|
||||
@@ -19,5 +20,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Models
|
||||
public int ModuleID => ModuleId;
|
||||
[NotMapped]
|
||||
public int EntityID => BlackBoardId;
|
||||
|
||||
[NotMapped] public string UserName => CreatedBy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="Interfaces" Version="0.0.0-12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Interfaces">
|
||||
<HintPath>..\..\interfaces\Interfaces\bin\Debug\net10.0\Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Oqtane.Shared"><HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\net10.0\Oqtane.Shared.dll</HintPath></Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user