Compare commits
6 Commits
0b82942569
...
7a6fe07d04
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a6fe07d04 | |||
| 4b142d4e63 | |||
| 2b4e2f84a7 | |||
| 9c39e97126 | |||
| 3ddce62f54 | |||
| 1f443b2734 |
@@ -7,21 +7,36 @@
|
|||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IBlackBoardService BlackBoardService
|
@inject IBlackBoardService BlackBoardService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IReportingHandler ReportingHandler
|
|
||||||
@inject IStringLocalizer<Edit> Localizer
|
@inject IStringLocalizer<Edit> Localizer
|
||||||
|
@inject IReportUI ReportingComponent // TODO
|
||||||
|
|
||||||
<form @ref="form" class="@(validated ? " was-validated" : "needs-validation" )" novalidate>
|
<form @ref="form" class="@(validated ? " was-validated" : "needs-validation" )" novalidate>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="name" HelpText="Enter a name" ResourceKey="Name">Name: </Label>
|
<Label Class="col-sm-3" For="name" HelpText="Enter a name" ResourceKey="Name">Name: </Label>
|
||||||
<div class="col-sm-9">
|
<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>
|
</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>
|
</div>
|
||||||
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
<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>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||||
|
|
||||||
|
@if (ReportingComponent != null)
|
||||||
|
{
|
||||||
|
<DynamicComponent Type="@ReportingComponent.ReportType" Parameters="@_parameters"/>
|
||||||
|
}
|
||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
@if (PageState.Action == "Edit")
|
@if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
@@ -32,6 +47,8 @@
|
|||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||||
|
|
||||||
|
public override string RenderMode => RenderModes.Interactive;
|
||||||
|
|
||||||
public override string Actions => "Add,Edit";
|
public override string Actions => "Add,Edit";
|
||||||
|
|
||||||
public override string Title => "Manage BlackBoard";
|
public override string Title => "Manage BlackBoard";
|
||||||
@@ -41,16 +58,20 @@
|
|||||||
new Stylesheet("_content/SZUAbsolventenverein.Module.BlackBoard/Module.css")
|
new Stylesheet("_content/SZUAbsolventenverein.Module.BlackBoard/Module.css")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private RichTextEditor RichTextEditorHtml;
|
||||||
private ElementReference form;
|
private ElementReference form;
|
||||||
private bool validated = false;
|
private bool validated = false;
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private string _name;
|
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
private DateTime _modifiedon;
|
private DateTime _modifiedon;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
private BlackBoard _blackBoard = new BlackBoard();
|
||||||
|
private Dictionary<string, object> _parameters = new Dictionary<string, object>();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -58,15 +79,16 @@
|
|||||||
if (PageState.Action == "Edit")
|
if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
_blackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||||
if (BlackBoard != null)
|
if (_blackBoard != null)
|
||||||
{
|
{
|
||||||
_name = BlackBoard.Name;
|
_createdby = _blackBoard.CreatedBy;
|
||||||
_createdby = BlackBoard.CreatedBy;
|
_createdon = _blackBoard.CreatedOn;
|
||||||
_createdon = BlackBoard.CreatedOn;
|
_modifiedby = _blackBoard.ModifiedBy;
|
||||||
_modifiedby = BlackBoard.ModifiedBy;
|
_modifiedon = _blackBoard.ModifiedOn;
|
||||||
_modifiedon = BlackBoard.ModifiedOn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_parameters = ReportingComponent.ConstructParameterList(_blackBoard, RenderModeBoundary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
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()
|
private async Task Save()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -86,19 +115,16 @@
|
|||||||
{
|
{
|
||||||
if (PageState.Action == "Add")
|
if (PageState.Action == "Add")
|
||||||
{
|
{
|
||||||
BlackBoard BlackBoard = new BlackBoard();
|
_blackBoard.ModuleId = ModuleState.ModuleId;
|
||||||
BlackBoard.ModuleId = ModuleState.ModuleId;
|
_blackBoard = await BlackBoardService.AddBlackBoardAsync(_blackBoard);
|
||||||
BlackBoard.Name = _name;
|
await logger.LogInformation("BlackBoard Added {BlackBoard}", _blackBoard);
|
||||||
BlackBoard = await BlackBoardService.AddBlackBoardAsync(BlackBoard);
|
|
||||||
await logger.LogInformation("BlackBoard Added {BlackBoard}", BlackBoard);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
await BlackBoardService.UpdateBlackBoardAsync(_blackBoard);
|
||||||
BlackBoard.Name = _name;
|
await logger.LogInformation("BlackBoard Updated {BlackBoard}", _blackBoard);
|
||||||
await BlackBoardService.UpdateBlackBoardAsync(BlackBoard);
|
|
||||||
await logger.LogInformation("BlackBoard Updated {BlackBoard}", BlackBoard);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -112,19 +138,4 @@
|
|||||||
AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error);
|
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>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
TargetFramework=$1
|
TargetFramework=$1
|
||||||
ProjectName=$2
|
ProjectName=$2
|
||||||
|
|
||||||
find . -name "*.nupkg" -delete
|
find . -name "*.nupkg" -delete
|
||||||
"..\..\oqtane.framework\oqtane.package\FixProps.exe"
|
dotnet run --project ../../fixProps/FixProps/FixProps.csproj
|
||||||
"..\..\oqtane.framework\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName%
|
dotnet pack $ProjectName.nuspec "/p:targetframework=${TargetFramework};projectname=${ProjectName}"
|
||||||
cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\"
|
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 const string _entityTableName = "SZUAbsolventenvereinBlackBoard";
|
||||||
private readonly PrimaryKey<BlackBoardEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinBlackBoard", x => x.BlackBoardId);
|
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> _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)
|
public BlackBoardEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||||
{
|
{
|
||||||
EntityTableName = _entityTableName;
|
EntityTableName = _entityTableName;
|
||||||
PrimaryKey = _primaryKey;
|
PrimaryKey = _primaryKey;
|
||||||
ForeignKeys.Add(_moduleForeignKey);
|
ForeignKeys.Add(_moduleForeignKey);
|
||||||
|
ForeignKeys.Add(_fileForeignKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BlackBoardEntityBuilder BuildTable(ColumnsBuilder table)
|
protected override BlackBoardEntityBuilder BuildTable(ColumnsBuilder table)
|
||||||
@@ -25,6 +27,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Migrations.EntityBuilders
|
|||||||
BlackBoardId = AddAutoIncrementColumn(table,"BlackBoardId");
|
BlackBoardId = AddAutoIncrementColumn(table,"BlackBoardId");
|
||||||
ModuleId = AddIntegerColumn(table,"ModuleId");
|
ModuleId = AddIntegerColumn(table,"ModuleId");
|
||||||
Name = AddMaxStringColumn(table,"Name");
|
Name = AddMaxStringColumn(table,"Name");
|
||||||
|
ImageID = AddIntegerColumn(table,"ImageID");
|
||||||
AddAuditableColumns(table);
|
AddAuditableColumns(table);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -32,5 +35,6 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Migrations.EntityBuilders
|
|||||||
public OperationBuilder<AddColumnOperation> BlackBoardId { get; set; }
|
public OperationBuilder<AddColumnOperation> BlackBoardId { get; set; }
|
||||||
public OperationBuilder<AddColumnOperation> ModuleId { get; set; }
|
public OperationBuilder<AddColumnOperation> ModuleId { get; set; }
|
||||||
public OperationBuilder<AddColumnOperation> Name { 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 BlackBoardId { get; set; }
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public int ImageID { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string ModuleName => "BlackBoard";
|
public string ModuleName => "BlackBoard";
|
||||||
@@ -19,5 +20,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Models
|
|||||||
public int ModuleID => ModuleId;
|
public int ModuleID => ModuleId;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int EntityID => BlackBoardId;
|
public int EntityID => BlackBoardId;
|
||||||
|
|
||||||
|
[NotMapped] public string UserName => CreatedBy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,12 +13,10 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Interfaces" Version="0.0.0-12" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<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>
|
<Reference Include="Oqtane.Shared"><HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\net10.0\Oqtane.Shared.dll</HintPath></Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user