Compare commits

...

9 Commits

Author SHA1 Message Date
David Štaleker
98dacb7133 key 2024-11-25 05:47:49 +01:00
David Štaleker
b3f783f407 file 2024-03-13 16:05:35 +01:00
David Štaleker
b8c7d7b200 publish 2024-03-13 06:02:45 +01:00
David Štaleker
5e29cd335d dev5 2024-03-13 05:51:52 +01:00
David Štaleker
023d210a16 iz dev 2024-03-12 19:11:29 +01:00
David Štaleker
c6d14525de dev 2024-03-12 19:04:38 +01:00
David Štaleker
dda4b613f8 dev3 2024-03-11 18:22:37 +01:00
David Štaleker
172626c8ee dev 2024-03-11 06:46:32 +01:00
David Štaleker
4ea291622a debug 2024-03-10 19:10:37 +01:00
43 changed files with 1010 additions and 288 deletions

3
.gitignore vendored
View File

@@ -185,7 +185,8 @@ publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
#Uposevamo publish profile
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to

View File

@@ -18,6 +18,7 @@ RUN dotnet build "./ZpcBulletinBoard.csproj" -c $BUILD_CONFIGURATION -o /app/bui
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ZpcBulletinBoard.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
COPY ["./ZpcBulletinBoard/Keys/key-3a63e3da-2ef0-49c2-9e68-30571c991f22.xml", "ZpcBulletinBoard/Keys/key-3a63e3da-2ef0-49c2-9e68-30571c991f22.xml"]
FROM base AS final
WORKDIR /app

View File

@@ -3,7 +3,7 @@
@{
ViewData["Title"] = "Edit board";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<!-- Editor -->

View File

@@ -3,20 +3,11 @@
@{
ViewData["Title"] = "Oglasne deske - Pregled";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/vendor/libs/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.css">
<style type="text/css">
.table > tbody > tr > td:nth-child(2),
.table > thead > tr > th:nth-child(2),
.table > tbody > tr > td:nth-child(3),
.table > thead > tr > th:nth-child(3) {
width: 100px
}
</style>
<link rel="stylesheet" href="~/css/boards/index.css" asp-append-version="true" />
}
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
@@ -27,43 +18,59 @@
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<div class="btn-group">
<input id="inpSearchBoard" class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
</div>
</div>
</div>
<div class="card">
<h6 class="card-header">
Seznam oglasnih desk
</h6>
<table class="table card-table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Ratio)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Boards)
{
<div class="div-boards">
<table class="table card-table table-hover">
<thead>
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Ratio)
</td>
<td>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="AddEdit" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Ratio)
</th>
<th></th>
</tr>
}
</tbody>
</table>
</thead>
<tbody>
@foreach (var item in Model.Boards)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Ratio)
</td>
<td>
<a class="btn btn-xs icon-btn btn-outline-success borderless" asp-page="View" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-external-link"></i></a>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="AddEdit" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>
</div>
<div class="card-footer py-3 text-right">
<a asp-page="AddEdit" class="btn btn-primary">Dodaj novo</a>
</div>
</div>
@section Scripts {
<script src="~/js/boards/index.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,26 @@
@page "{handler?}"
@model ZpcBulletinBoard.Pages.Boards.ViewModel
@{
ViewData["Title"] = "Board view";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/css/boards/view.css" asp-append-version="true" />
}
<input id="inpGuidBoard" type="hidden" asp-for="Guid"/>
<div class="div-placeholder">
</div>
<div class="div-no-pages">
<i class="fal fa-exclamation-triangle fa-10x text-danger"></i>
<h2>Ni prosojnic za @Model.Guid</h2>
</div>
@section Scripts {
<script src="~/js/boards/view.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using ZpcBulletinBoard.Data;
using ZpcBulletinBoard.Models;
using ZpcBulletinBoard.Models.Editor;
namespace ZpcBulletinBoard.Pages.Boards
{
[AllowAnonymous]
public class ViewModel(ApplicationDbContext context)
: PageModel
{
[BindProperty] public string Guid { get; set; } = "";
public IActionResult OnGet(string? guid)
{
if (string.IsNullOrEmpty(guid))
{
return NotFound();
}
Guid = guid;
return Page();
}
//GET
public IActionResult OnGetPages(string guid)
{
var board = context.BulletinBoards
.Include(x => x.Links.OrderBy(x => x.Order))
.ThenInclude(x => x.BulletinBoardPage)
.FirstOrDefault(x => x.Guid.ToString() == guid);
var links = new List<BulletinBoardPageLink>();
if (board is not { Links: not null }) return new JsonResult(new { successful = true, links });
links.AddRange(board.Links);
foreach (var link in links)
{
link.BulletinBoardPage.Links = null;
link.BulletinBoard.Links = null;
}
return new JsonResult(new { successful = true, links });
}
}
}

View File

@@ -3,7 +3,7 @@
@{
ViewData["Title"] = "Oglasne deske - Povezave";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles
@@ -20,13 +20,13 @@
</h4>
<div class="card">
<div class="card-header">
<div class="header">
<div class="div-content">
<div class="div-content-boards">
<h6>Oglasne deske</h6>
<input id="inpSearchBoard" class="form-control form-control-sm" placeholder="Iskanje oglasnik desk..." />
</div>
<div class="div-content-pages">
<h6>Strani</h6>
<input id="inpSearchPage" class="form-control form-control-sm" placeholder="Iskanje strani..." />
</div>
</div>
</div>
@@ -48,11 +48,19 @@
@foreach (var tmpPage in Model.Pages)
{
<div class="div-page available-page" draggable="true" ondragstart="dragPage(event, this)" data-id="@tmpPage.IdBulletinBoardPage">
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/@tmpPage.Image" alt="page image" />
@if ((int)tmpPage.Type == 3)
{
<div class='img-link'><i class="fas fa-link fa-5x"></i></div>
}
else
{
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/@tmpPage.Image" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />
}
<small>@tmpPage.Name</small>
<div class="tools">
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-reply"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless"><i class="fas fa-reply-all"></i></a>
@* <a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-reply"></i></a> *@
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless" onclick="addPageToAllBoards(this)"><i class="fas fa-reply-all"></i></a>
</div>
</div>
}

View File

@@ -48,7 +48,7 @@ namespace ZpcBulletinBoard.Pages.BoardsLinks
var order = 1;
var links = context.BulletinBoardPageLinks.Where(x => x.IdBulletinBoardFk == idBoard).ToList();
if (links.Any())
order = links.Max(x => x.IdLink) + 1;
order = links.Max(x => x.Order) + 1;
var link = new BulletinBoardPageLink
{
@@ -68,5 +68,58 @@ namespace ZpcBulletinBoard.Pages.BoardsLinks
return new JsonResult(new { successful = true, error = $"", link });
}
public IActionResult OnPostSwapLinkOrder(int idLinkStart, int idLinkEnd)
{
var linkStart = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLinkStart);
var linkEnd = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLinkEnd);
if (linkStart == null)
return new JsonResult(new { successful = false, error = $"Link with ID {idLinkStart} not exists!" });
if (linkEnd == null)
return new JsonResult(new { successful = false, error = $"Link with ID {idLinkEnd} not exists!" });
(linkStart.Order, linkEnd.Order) = (linkEnd.Order, linkStart.Order);
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"", linkStart, linkEnd });
}
public IActionResult OnPostLinkDuration(int idLink, int duration)
{
var link = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLink);
if (link == null)
return new JsonResult(new { successful = false, error = $"Link with ID {idLink} not exists!" });
link.Duration = duration;
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"", link });
}
//Delete
public IActionResult OnDeleteLink(int idLink)
{
var link = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLink);
if (link == null)
return new JsonResult(new { successful = false, error = $"Link with ID {idLink} not exists!", link });
var links = context.BulletinBoardPageLinks
.Where(x => x.IdBulletinBoardFk == link.IdBulletinBoardFk && x.Order > link.Order).ToList();
foreach (var tmpLink in links)
{
tmpLink.Order -= 1;
}
context.BulletinBoardPageLinks.Remove(link);
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"", link });
}
}
}

View File

@@ -4,25 +4,31 @@
<div class="app-brand demo">
<span class="app-brand-logo demo bg-secondary">
<i class="fas fa-draw-circle text-white"></i>
<i class="fas fa-thumbtack text-white"></i>
</span>
<a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">Bulletin board</a>
<a href="javascript:void(0)" class="layout-sidenav-toggle sidenav-link text-large ml-auto">
<i class="ion ion-md-menu align-middle"></i>
</a>
<a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">ZPC Bulletin board</a>
</div>
<div class="sidenav-divider mt-0"></div>
<ul class="sidenav-inner">
<li class="sidenav-item@(currentPage.StartsWith("/Pages/")? " active" : "")">
<a asp-page="/Pages/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Strani</div></a>
<a asp-page="/Pages/Index" class="sidenav-link"><i class="sidenav-icon far fa-file"></i><div>Strani</div></a>
</li>
<li class="sidenav-item@(currentPage.StartsWith("/Boards/") ? " active" : "")">
<a asp-page="/Boards/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Oglasne deske</div></a>
<a asp-page="/Boards/Index" class="sidenav-link"><i class="sidenav-icon fab fa-flipboard"></i><div>Oglasne deske</div></a>
</li>
<li class="sidenav-item@(currentPage.StartsWith("/BoardsLinks/") ? " active" : "")">
<a asp-page="/BoardsLinks/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Povezave</div></a>
<a asp-page="/BoardsLinks/Index" class="sidenav-link"><i class="sidenav-icon fas fa-link"></i><div>Povezave</div></a>
</li>
@if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser"))
{
<li class="sidenav-divider mb-1"></li>
<li class="sidenav-header small font-weight-semibold">ADMINISTRACIJA</li>
<li class="sidenav-item@(currentPage.StartsWith("/TransportLoadingOrder/") ? " active" : "")">
<a asp-page="/TransportLoadingOrder/Index" class="sidenav-link"><i class="sidenav-icon far fa-u"></i><div>Uporabniki</div></a>
</li>
}
</ul>
</div>

View File

@@ -7,7 +7,8 @@
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title>ZPC-BB - @ViewData["Title"]</title>
<title>ZPC BB - @ViewData["Title"]</title>
<link rel="icon" type="image/x-icon" href="/pin.ico">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900" rel="stylesheet" crossorigin="anonymous" />

View File

@@ -1,5 +1,5 @@
@{
Layout = "Shared/_Application";
Layout = "Layouts/_Application";
}
@section Styles {

View File

@@ -1,5 +1,5 @@
@{
Layout = "Shared/_Application";
Layout = "Layouts/_Application";
}
@section Styles {

View File

@@ -3,23 +3,12 @@
@{
ViewData["Title"] = "Strani - Pregled";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/css/pages/index.css" asp-append-version="true" />
<style type="text/css">
.table > tbody > tr > td:nth-child(2),
.table > thead > tr > th:nth-child(2){
width: 200px
}
.table > tbody > tr > td:nth-child(3),
.table > thead > tr > th:nth-child(3),
.table > tbody > tr > td:nth-child(4),
.table > thead > tr > th:nth-child(4) {
width: 100px
}
</style>
}
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
@@ -29,79 +18,25 @@
/</span> Pregled
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<form method="get">
<div class="btn-group">
<input class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
<input id="inpOpenEditorForPage" type="hidden" name="openEditorForPage" asp-for="OpenEditorForPage" />
<div class="btn-group" title="Columns">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-label="Nastavitve" title="Nastavitve">
<i class="opacity-75 ion ion-md-apps"></i>
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right">
@* <label class="dropdown-item">
<input type="checkbox" name="openProjects" @ViewData["OpenProjects"]> <span>Odprti</span>
</label>
<label class="dropdown-item">
<input type="checkbox" name="inProductionProjects" @ViewData["InProductionProjects"]> <span>V izdelavi</span>
</label>
<label class="dropdown-item">
<input type="checkbox" name="finishedProjects" @ViewData["FinishedProjects"]> <span>Zaključeni projekti</span>
</label>
<label class="dropdown-item">
<input type="checkbox" name="offerProjects" @ViewData["OffersProjects"]> <span>Ponudbe</span>
</label> *@
</div>
</div>
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
</div>
</form>
<div class="btn-group">
<input id="inpSearchPage" class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
</div>
</div>
</div>
<div class="card">
<h6 class="card-header">
Seznam strani
Strani
</h6>
<table class="table card-table table-hover">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Pages[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Pages[0].Type)
</th>
<th>
@Html.DisplayNameFor(model => model.Pages[0].Ratio)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Pages)
{
<tr data-id="@item.IdBulletinBoardPage">
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Type)
</td>
<td>
@Html.DisplayFor(modelItem => item.Ratio)
</td>
<td style="text-align:right;">
<a class="btn btn-xs icon-btn btn-outline-primary borderless" href="javascript:;" onclick="rowOpenEditor(this);" data-toggle="tooltip" data-placement="top" title="Urejevalnik" data-state="secondary"><i class="far fa-edit"></i></a>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" href="javascript:;" onclick="openModalEditPage(this);" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>
<div class="div-pages">
</div>
<div class="card-footer py-3 text-right">
<a href="javascript:;" onclick="openModalAddPage();" class="btn btn-primary">Dodaj novo</a>
</div>

View File

@@ -16,17 +16,19 @@ namespace ZpcBulletinBoard.Pages.Pages
[Authorize]
public class IndexModel(ApplicationDbContext context, IWebHostEnvironment webHostEnvironment) : PageModel
{
public IList<BulletinBoardPage> Pages { get;set; }
public int OpenEditorForPage = 0;
public async Task OnGetAsync(int? openEditorForPage = null)
public void OnGet()
{
OpenEditorForPage = openEditorForPage ?? 0;
Pages = await context.BulletinBoardPage.ToListAsync();
}
//Get
public IActionResult OnGetPages()
{
var pages = context.BulletinBoardPage.ToList();
return new JsonResult(new { successful = true, error = $"", pages });
}
public IActionResult OnGetPage(int id)
{
var page = context.BulletinBoardPage.Include(x => x.Links)
@@ -97,7 +99,25 @@ namespace ZpcBulletinBoard.Pages.Pages
tmpPage.Image = imageName;
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"" });
return new JsonResult(new { successful = true, error = $"", page = tmpPage });
}
//Delete
public IActionResult OnDeleteBoardPage(int idPage)
{
var tmpPage = context.BulletinBoardPage
.Include(x => x.Links)
.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {idPage} not exists!"});
if (tmpPage.Links.Any())
return new JsonResult(new { successful = false, error = $"Stran je v uporabi!\nBrisanje ni možno!" });
context.BulletinBoardPage.Remove(tmpPage);
context.SaveChanges();
return new JsonResult(new { successful = true, error = "" });
}
}
}

View File

@@ -2,5 +2,5 @@
@model ZpcBulletinBoard.Pages.SetupNew.SetupModel
@{
ViewData["Title"] = "SetupNew";
Layout = "~/Pages/Shared/_LayoutBlank.cshtml";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}

View File

@@ -4,7 +4,7 @@
@model ZpcBulletinBoard.Pages.User.LoginModel
@{
ViewData["Title"] = "Prijava";
Layout = "~/Pages/Shared/_LayoutBlank.cshtml";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}
@section Styles {

View File

@@ -119,8 +119,8 @@ namespace ZpcBulletinBoard.Pages.User
if (ModelState.IsValid)
{
//TODO samo za DEV
//var result = await _loginManager.PasswordSignInAsync(Input.UserName, Input.Password, Input.RememberLogin, false);
var result = await _loginManager.PasswordSignInAsync("Admin", "*zpcBulletinBoard2024*", Input.RememberLogin, false);
var result = await _loginManager.PasswordSignInAsync(Input.UserName, Input.Password, Input.RememberLogin, false);
//var result = await _loginManager.PasswordSignInAsync("Admin", "*zpcBulletinBoard2024*", Input.RememberLogin, false);
if (result.Succeeded)
{

View File

@@ -2,5 +2,5 @@
@model ZpcBulletinBoard.Pages.User.LogoutModel
@{
ViewData["Title"] = "Odjava";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}

View File

@@ -1,3 +1,3 @@
@{
Layout = "_Layout";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}

View File

@@ -90,7 +90,7 @@ builder.Services.Configure<IISOptions>(options =>
options.AutomaticAuthentication = false;
});
builder.Services.AddDataProtection().SetApplicationName("ZpcBulletinBoard").PersistKeysToFileSystem(new DirectoryInfo(@"Keys/"));
builder.Services.AddDataProtection().SetApplicationName("ZpcBulletinBoard").PersistKeysToFileSystem(new DirectoryInfo(@"wwwroot/keys/"));
var app = builder.Build();

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>Container</WebPublishMethod>
<ContainerPublishMethod>NetSdk</ContainerPublishMethod>
<RegistryUrl>docker.zapecnik.com</RegistryUrl>
<UserName>david</UserName>
<PublishImageTag>latest</PublishImageTag>
<PublishProvider>ContainerRegistry</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>707627f1-2251-4416-a5ea-93c98d8eed1a</ProjectGuid>
<_IsDockerfilePresent>true</_IsDockerfilePresent>
<_TargetId>NetSdkCustomContainerRegistry</_TargetId>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>Container</WebPublishMethod>
<ContainerPublishMethod>NetSdk</ContainerPublishMethod>
<RegistryUrl>docker.zapecnik.com</RegistryUrl>
<UserName>david</UserName>
<PublishImageTag>latest</PublishImageTag>
<PublishProvider>ContainerRegistry</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>707627f1-2251-4416-a5ea-93c98d8eed1a</ProjectGuid>
<_IsDockerfilePresent>true</_IsDockerfilePresent>
<_TargetId>NetSdkCustomContainerRegistry</_TargetId>
</PropertyGroup>
</Project>

View File

@@ -34,9 +34,13 @@
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Properties\PublishProfiles\" />
<Folder Include="wwwroot\bulletin-board-images\notes\" />
<Folder Include="wwwroot\bulletin-board-images\pages\" />
<Folder Include="wwwroot\img\" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\docker.zapecnik.com.pubxml.user" />
</ItemGroup>
</Project>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 22 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -97,6 +97,25 @@
margin-top: 5px;
}
.btn-tool{
/* padding: 1px; */
.img-link{
height: 170px;
width: 170px;
margin-left: 15px;
margin-top: 5px;
padding-top: 50px;
}
#inpSearchBoard{
width: 40%;
}
.header{
padding: 5px 5px 5px 5px;
margin-bottom: 5px;
border-bottom: 1px solid rgba(24, 28, 33, 0.06);
}
.div-boards{
height: 63vh;
overflow-x: auto;
}

View File

@@ -0,0 +1,14 @@
.table > tbody > tr > td:nth-child(2),
.table > thead > tr > th:nth-child(2) {
width: 100px
}
.table > tbody > tr > td:nth-child(3),
.table > thead > tr > th:nth-child(3) {
width: 100px;
text-align: right;
}
.div-boards {
height: 63vh;
overflow-x: auto;
}

View File

@@ -0,0 +1,38 @@
html, body {
margin: 0;
padding: 0;
height: 100%;
overflow-y: hidden !important;
overflow-x: hidden !important;
}
.div-placeholder{
height: 100%;
width: 100%;
}
.div-no-pages{
padding: 20%;
text-align: center;
}
.div-no-pages > h2{
margin-top: 10px;
}
.div-placeholder > img {
width: 100%;
height: 100%;
}
.div-placeholder > iframe {
width: 100%;
height: 100%;
border: none;
/* width: 100%; */
/* height: calc(100% - 25px); */
overflow-y: hidden !important;
overflow-x: hidden !important;
margin: 0;
padding: 0;
}

View File

@@ -0,0 +1,50 @@
.div-page {
float: left;
text-align: center;
width: 200px;
height: 230px;
border: 1px solid rgba(24, 28, 33, 0.06);
border-radius: 0.25rem;
margin-right: 5px;
margin-top: 5px;
margin-left: 10px;
}
.div-page:hover {
/* background-color: rgba(24, 28, 33, 0.06); */
border-color: blue;
}
.page-active {
background-color: rgba(128, 171, 226, 0.5);
}
.div-page > h5 {
margin-top: 5px;
margin-bottom: 2px;
}
.div-page > i {
margin-top: 10px;
}
.img-thumbnail{
height: 170px;
width: 170px;
margin-left: 15px;
margin-top: 5px;
}
.img-link{
height: 170px;
width: 170px;
margin-left: 15px;
margin-top: 5px;
padding-top: 50px;
}
.div-pages{
height: 63vh;
overflow-x: auto;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,7 +1,43 @@
$(function(){
$('#inpSearchBoard').on('keyup', function(){
searchBoards();
});
$('#inpSearchPage').on('keyup', function(){
searchPages();
});
loadBoards();
});
function searchBoards(){
let value = $('#inpSearchBoard').val().toLowerCase();
$(".div-board").each(function(i, e) {
let boardText = $(e).find('h5').text().toLowerCase();
if (boardText.indexOf(value) < 0){
$(e).hide();
$(e).next().hide();
} else {
$(e).show();
$(e).next().show();
}
});
}
function searchPages(){
let value = $('#inpSearchPage').val().toLowerCase();
$(".available-page").each(function(i, e) {
let pageText = $(e).find('small').text().toLowerCase();
if (pageText.indexOf(value) < 0){
$(e).hide();
} else {
$(e).show();
}
});
}
function loadBoards(){
$.blockUI();
$.ajax({
@@ -47,23 +83,30 @@ function loadBoards(){
}
function allowDropPage(ev) {
console.log('allowDrop');
if (ev.dataTransfer.getData("idPage")){
ev.preventDefault();
}
}
function dragPage(ev, el) {
console.log('drag');
ev.dataTransfer.setData("idPage", $(el).attr('data-id'));
}
function dropPage(ev, el) {
console.log('drop');
ev.preventDefault();
let idPage = parseInt(ev.dataTransfer.getData("idPage"));
// if (ev.dataTransfer.getData("idPage")){
// ev.preventDefault();
// }
}
function dragPage(ev, el) {
$('.available-page[data-dragg="1"]').removeAttr('data-dragg');
$(el).attr('data-dragg', '1');
}
function dropPage(ev, el) {
ev.preventDefault();
let idPage = parseInt($('.available-page[data-dragg="1"]').attr('data-id'));
if (isNaN(idPage)){
return;
}
$('.available-page[data-dragg="1"]').removeAttr('data-dragg');
let idBoard = parseInt($(el).attr('data-idboard'));
insertPageToBoard(idBoard, idPage);
}
function insertPageToBoard(idBoard, idPage){
$.blockUI();
$.ajax({
type: "POST",
@@ -91,19 +134,203 @@ function allowDropPage(ev) {
$.unblockUI();
}
});
}
}
function addPageToBoard(idBoard, link){
function addPageToAllBoards(el){
let idPage = parseInt($(el).parent().parent().attr('data-id'));
$('.div-pages').each(function (i, e){
let idBoard = parseInt($(e).attr('data-idboard'));
insertPageToBoard(idBoard, idPage);
});
}
function addPageToBoard(idBoard, link){
let div = $('.div-pages[data-idboard="' + idBoard + '"]');
div.append(`<div class="div-page" data-id="${link.idLink}" data-idPage='${link.bulletinBoardPage.idBulletinBoardPage}'>
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/${link.bulletinBoardPage.image}" alt="page image" />
let preview;
if (link.bulletinBoardPage.type == 3){
preview = `<div class='img-link'><i class="fas fa-link fa-5x"></i></div>`;
} else {
preview = `<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/${link.bulletinBoardPage.image}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`
}
div.append(`<div class="div-page" data-id="${link.idLink}" data-idPage='${link.bulletinBoardPage.idBulletinBoardPage}' data-duration='${link.duration}'>
${preview}
<small>${link.bulletinBoardPage.name}</small>
<div class="tools">
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-chevron-left"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless"><i class="far fa-clock"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-danger borderless"><i class="fas fa-trash-alt"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-chevron-right"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless" onclick="moveLink(this, -1)"><i class="fas fa-chevron-left"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless" onclick="setDuration(this)"><i class="far fa-clock"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-danger borderless" onclick="deleteLink(this)"><i class="fas fa-trash-alt"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless" onclick="moveLink(this, 1)"><i class="fas fa-chevron-right"></i></a>
</div>
</div>`);
}
}
function deleteLink(el){
let idLink = parseInt($(el).parent().parent().attr('data-id'));
if (isNaN(idLink)){
return;
}
$.blockUI();
$.ajax({
type: "DELETE",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/BoardsLinks/Index/?handler=Link",
data: {
idLink
},
success: function(data) {
if (data.successful){
$(el).parent().parent().remove();
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log({xhr, ajaxOptions, thrownError});
alert(xhr.responseText);
$.unblockUI();
}
});
}
function moveLink(el, direction){
let divStart = $(el).parent().parent();
let idLinkStart = parseInt(divStart.attr('data-id'));
if (isNaN(idLinkStart)){
return;
}
let divEnd;
let idLinkEnd;
if (direction == -1){
divEnd = divStart.prev();
} else {
divEnd = divStart.next();
}
idLinkEnd = parseInt(divEnd.attr('data-id'));
if (isNaN(idLinkEnd)){
return;
}
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/BoardsLinks/Index/?handler=SwapLinkOrder",
data: {
idLinkStart,
idLinkEnd
},
success: function(data) {
if (data.successful){
if (direction == -1){
divStart.insertBefore(divEnd);
} else {
divStart.insertAfter(divEnd);
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log({xhr, ajaxOptions, thrownError});
alert(xhr.responseText);
$.unblockUI();
}
});
}
function setDuration(el){
let div = $(el).parent().parent();
let idLink = parseInt(div.attr('data-id'));
if (isNaN(idLink)){
return;
}
let step = 5;
let duration = div.attr('data-duration');
Swal.fire({
title: 'Trajanje [s]',
html: `
<input
type="number"
value="${duration}"
step="${step}"
class="swal2-input"
id="range-value">`,
input: 'range',
inputValue: duration,
inputAttributes: {
min: '5',
max: '3600',
step: step.toString(),
},
confirmButtonText: 'Potrdi',
cancelButtonText: 'Prekliči',
showCancelButton: true,
didOpen: () => {
const inputRange = Swal.getInput();
const inputNumber = Swal.getPopup().querySelector('#range-value');
// remove default output
Swal.getPopup().querySelector('output').style.display = 'none'
inputRange.style.width = '100%'
// sync input[type=number] with input[type=range]
inputRange.addEventListener('input', () => {
inputNumber.value = inputRange.value
})
// sync input[type=range] with input[type=number]
inputNumber.addEventListener('change', () => {
inputRange.value = inputNumber.value
})
},
}).then((result) => {
console.log(result);
if (result.isConfirmed) {
let newDuration = parseInt(result.value);
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/BoardsLinks/Index/?handler=LinkDuration",
data: {
idLink,
duration: newDuration
},
success: function(data) {
if (data.successful){
div.attr('data-duration', data.link.duration);
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log({xhr, ajaxOptions, thrownError});
alert(xhr.responseText);
$.unblockUI();
}
});
}
});
}

View File

@@ -0,0 +1,18 @@
$(function(){
$('#inpSearchBoard').on('keyup', function(){
searchBoards();
});
});
function searchBoards(){
let value = $('#inpSearchBoard').val().toLowerCase();
$("table > tbody > tr").each(function(i, e) {
let boardText = $(e).find('td:first').text().toLowerCase();
if (boardText.indexOf(value) < 0){
$(e).hide();
} else {
$(e).show();
}
});
}

View File

@@ -0,0 +1,74 @@
let indexLink = 0;
let links = [];
$(function(){
loadBoard();
});
function loadBoard(){
let guid = $('#inpGuidBoard').val();
$.blockUI();
$.ajax({
type: "GET",
url: "/Boards/View/?handler=Pages",
data: {
guid
},
success: function (data) {
if (data.successful){
indexLink = 0;
links = data.links;
if (links == null || links.length <= 0){
$('.div-placeholder').css('display', 'none');
$('.div-no-pages').css('display', '');
setTryAgainTimer();
} else {
$('.div-placeholder').css('display', '');
$('.div-no-pages').css('display', 'none');
showPage(false);
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function setTryAgainTimer(){
}
function showPage(showNext){
if (showNext){
indexLink += 1;
if (indexLink >= links.length){
loadBoard();
return;
}
}
let link = links[indexLink];
$('.div-placeholder').empty();
let element;
if (link.bulletinBoardPage.type == 3){
element = ` <iframe src="${link.bulletinBoardPage.externalLink}" title="page iframe" scrolling='no'></iframe> `;
} else {
let date = new Date();
element = `<img class='img-fluid' src="/bulletin-board-images/pages/${link.bulletinBoardPage.image}?${date.getTime()}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`;
}
$('.div-placeholder').append(element);
setTimeout(function () {
showPage(true);
}, link.duration * 1000);
}

View File

@@ -1,19 +1,83 @@
$(function(){
let openEditorForPage = parseInt($('#inpOpenEditorForPage').val());
if (!isNaN(openEditorForPage) && openEditorForPage > 0){
$('#inpOpenEditorForPage').val(0);
openEditor(openEditorForPage);
}
$('[data-toggle="tooltip"]').tooltip();
$('#inpSearchPage').on('keyup', function(){
searchPages();
});
loadPages();
});
function searchPages(){
let value = $('#inpSearchPage').val().toLowerCase();
$(".div-page").each(function(i, e) {
let pageText = $(e).find('small').text().toLowerCase();
if (pageText.indexOf(value) < 0){
$(e).hide();
} else {
$(e).show();
}
});
}
function loadPages(){
$.blockUI();
$.ajax({
type: "GET",
url: "/Pages/Index/?handler=Pages",
data: {
},
success: function (data) {
if (data.successful){
let pageContent = $('.div-pages');
pageContent.empty();
if (data.pages){
data.pages.forEach((page) => {
addPageToDiv(page);
});
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function addPageToDiv(page){
let date = new Date();
let preview;
if (page.type == 3){
preview = `<div class='img-link'><i class="fas fa-link fa-5x"></i></div>`;
} else {
preview = `<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/${page.image}?${date.getTime()}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`
}
let element = $(`<div class="div-page" data-id="${page.idBulletinBoardPage}">
${preview}
<small>${page.name}</small>
<div class="tools">
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless" onclick="pageOpenEditor(this);" data-toggle="tooltip" data-placement="top" title="Urejevalnik" data-state="secondary"><i class="far fa-edit"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless" onclick="openModalEditPage(this);" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-danger borderless" onclick="deletePage(this)"><i class="fas fa-trash-alt"></i></a>
</div>
</div>`);
$('.div-pages').append(element);
element.find('[data-toggle="tooltip"]').tooltip();
}
function openModalAddPage(){
$('#inpModalAddEditPageIdPage').val(0);
$('#inpModalAddEditPageName').val('');
$('#divModalAddEditPage').modal('show');
}
function openModalEditPage(el){
let idBulletinBoardPage = parseInt($(el).parent().parent().attr('data-id'));
if (isNaN(idBulletinBoardPage)){
@@ -84,14 +148,12 @@ function saveModalAddEditPage(){
}},
success: function(data) {
if (data.successful){
$('#divModalAddEditPage').modal('hide');
if (idBulletinBoardPage > 0){
//Ce je edit ne odprem editorja
$('#inpOpenEditorForPage').val(0);
} else {
$('#inpOpenEditorForPage').val(data.page.idBulletinBoardPage);
if (idBulletinBoardPage <= 0){
//Ce je nova dodam in odprem editor
addPageToDiv(data.page);
openEditor(data.page.idBulletinBoardPage);
}
$('#btnRefresh').trigger('click');
$('#divModalAddEditPage').modal('hide');
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
@@ -105,7 +167,7 @@ function saveModalAddEditPage(){
});
}
function rowOpenEditor(el){
function pageOpenEditor(el){
openEditor(parseInt($(el).parent().parent().attr('data-id')));
}
@@ -163,8 +225,7 @@ function saveModalPageEditorLink(){
data: { idPage, link},
success: function(data) {
if (data.successful){
$('#divModalAddEditPage').modal('hide');
$('#btnRefresh').trigger('click');
$('#divModalPageEditorLink').modal('hide');
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
@@ -200,8 +261,39 @@ function saveModalPageEditorPicture(){
processData: false,
success: function(data) {
if (data.successful){
let date = new Date();
$('.div-page[data-id="' + idPage + '"] > img').attr('src', '/bulletin-board-images/pages/' + data.page.image + '?' + date.getTime());
$('#divModalPageEditorPicture').modal('hide');
$('#btnRefresh').trigger('click');
$.unblockUI();
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
}
function deletePage(el){
let idPage = parseInt($(el).parent().parent().attr('data-id'));
$.blockUI();
$.ajax({
type: "DELETE",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/Pages/Index/?handler=BoardPage",
data: {
idPage
},
success: function(data) {
if (data.successful){
$(el).parent().parent().remove();
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="3a63e3da-2ef0-49c2-9e68-30571c991f22" version="1">
<creationDate>2024-02-27T04:54:17.6808298Z</creationDate>
<activationDate>2024-02-27T04:54:17.6419309Z</activationDate>
<expirationDate>2024-05-27T04:54:17.6419309Z</expirationDate>
<key id="dd9d2694-d2a1-4c84-8780-8cc2a8450e4b" version="1">
<creationDate>2024-03-13T04:20:53.7153581Z</creationDate>
<activationDate>2024-03-13T04:20:53.6880609Z</activationDate>
<expirationDate>2024-06-11T04:20:53.6880609Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>1ujUNFqnvXGLHSTiSV2F9ymK+Sosgl6qdy7m0M/Z9bPXyplHR9bOAgm4cy5otT3C/q5H/Qf6NnQkgUqggldGiw==</value>
<value>1XXNVBuC3ok1caM9YT8GT0kQE7/8eRQiPgWe36qOTqXhGZVuy4HAnRi6XaxFTcWdNys7KEpjf8YWHyuwHfxm9g==</value>
</masterKey>
</descriptor>
</descriptor>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="f2b93c6e-8236-49e8-a358-a222619e483d" version="1">
<creationDate>2024-10-01T03:27:21.3194487Z</creationDate>
<activationDate>2024-10-01T03:27:21.2754418Z</activationDate>
<expirationDate>2024-12-30T03:27:21.2754418Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>TnWlT92Q/3q/QtY2uWeQRsGVS5NUVXp7bB5lzeXT+84afyp92YQZyfWSPKfOe8WBqqiGkJ/ge6aUQfcmYk3syg==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB