Compare commits

...

11 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
David Štaleker
073bb88703 dev 2024-03-10 18:58:33 +01:00
David Štaleker
c4883e4296 dev 2024-03-10 18:58:24 +01:00
66 changed files with 2849 additions and 1345 deletions

3
.gitignore vendored
View File

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

View File

@@ -16,6 +16,7 @@ namespace ZpcBulletinBoard.Data
public DbSet<Note> Notes { get; set; } public DbSet<Note> Notes { get; set; }
public DbSet<BulletinBoard> BulletinBoards { get; set; } public DbSet<BulletinBoard> BulletinBoards { get; set; }
public DbSet<BulletinBoardPage> BulletinBoardPage { get; set; } public DbSet<BulletinBoardPage> BulletinBoardPage { get; set; }
public DbSet<BulletinBoardPageLink> BulletinBoardPageLinks { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
@@ -23,10 +24,15 @@ namespace ZpcBulletinBoard.Data
//Relacije //Relacije
modelBuilder.Entity<BulletinBoard>() modelBuilder.Entity<BulletinBoard>()
.HasMany(t => t.Pages) .HasMany(t => t.Links)
.WithOne(t => t.BulletinBoard) .WithOne(t => t.BulletinBoard)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<BulletinBoardPage>()
.HasMany(t => t.Links)
.WithOne(t => t.BulletinBoardPage)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<BulletinBoardPage>() modelBuilder.Entity<BulletinBoardPage>()
.HasMany(t => t.Notes) .HasMany(t => t.Notes)
.WithOne(t => t.BulletinBoardPage) .WithOne(t => t.BulletinBoardPage)

View File

@@ -18,6 +18,7 @@ RUN dotnet build "./ZpcBulletinBoard.csproj" -c $BUILD_CONFIGURATION -o /app/bui
FROM build AS publish FROM build AS publish
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ZpcBulletinBoard.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false 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 FROM base AS final
WORKDIR /app WORKDIR /app

View File

@@ -1,359 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ZpcBulletinBoard.Data;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20240225160626_1")]
partial class _1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("EveryThing.Models.IdentityApplicationRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("EveryThing.Models.IdentityApplicationUser", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DateValidUntil")
.HasColumnType("datetime(6)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{
b.Property<int>("IdBulletinBoard")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<Guid>("Guid")
.HasColumnType("char(36)");
b.HasKey("IdBulletinBoard");
b.ToTable("BulletinBoards");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{
b.Property<int>("IdNote")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Height")
.HasColumnType("int");
b.Property<int>("IdBulletinBoard")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Width")
.HasColumnType("int");
b.Property<int>("X")
.HasColumnType("int");
b.Property<int>("Y")
.HasColumnType("int");
b.HasKey("IdNote");
b.HasIndex("IdBulletinBoard");
b.ToTable("Notes");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("EveryThing.Models.IdentityApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("EveryThing.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("EveryThing.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.HasOne("EveryThing.Models.IdentityApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EveryThing.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("EveryThing.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Notes")
.HasForeignKey("IdBulletinBoard")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BulletinBoard");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{
b.Navigation("Notes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,73 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BulletinBoards",
columns: table => new
{
IdBulletinBoard = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Guid = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoards", x => x.IdBulletinBoard);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Notes",
columns: table => new
{
IdNote = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IdBulletinBoard = table.Column<int>(type: "int", nullable: false),
X = table.Column<int>(type: "int", nullable: false),
Y = table.Column<int>(type: "int", nullable: false),
Width = table.Column<int>(type: "int", nullable: false),
Height = table.Column<int>(type: "int", nullable: false),
Title = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Content = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Notes", x => x.IdNote);
table.ForeignKey(
name: "FK_Notes_BulletinBoards_IdBulletinBoard",
column: x => x.IdBulletinBoard,
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Notes_IdBulletinBoard",
table: "Notes",
column: "IdBulletinBoard");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Notes");
migrationBuilder.DropTable(
name: "BulletinBoards");
}
}
}

View File

@@ -1,366 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ZpcBulletinBoard.Data;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20240225172529_2")]
partial class _2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{
b.Property<int>("IdBulletinBoard")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<Guid>("Guid")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Ratio")
.HasColumnType("int");
b.HasKey("IdBulletinBoard");
b.ToTable("BulletinBoards");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{
b.Property<int>("IdNote")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Height")
.HasColumnType("int");
b.Property<int>("IdBulletinBoard")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Width")
.HasColumnType("int");
b.Property<int>("X")
.HasColumnType("int");
b.Property<int>("Y")
.HasColumnType("int");
b.HasKey("IdNote");
b.HasIndex("IdBulletinBoard");
b.ToTable("Notes");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationUser", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DateValidUntil")
.HasColumnType("datetime(6)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Notes")
.HasForeignKey("IdBulletinBoard")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BulletinBoard");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{
b.Navigation("Notes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "BulletinBoards",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Ratio",
table: "BulletinBoards",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name",
table: "BulletinBoards");
migrationBuilder.DropColumn(
name: "Ratio",
table: "BulletinBoards");
}
}
}

View File

@@ -1,94 +0,0 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _3 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Notes_BulletinBoards_IdBulletinBoard",
table: "Notes");
migrationBuilder.RenameColumn(
name: "IdBulletinBoard",
table: "Notes",
newName: "IdBulletinBoardPage");
migrationBuilder.RenameIndex(
name: "IX_Notes_IdBulletinBoard",
table: "Notes",
newName: "IX_Notes_IdBulletinBoardPage");
migrationBuilder.CreateTable(
name: "BulletinBoardPage",
columns: table => new
{
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IdBulletinBoard = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Duration = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoardPage", x => x.IdBulletinBoardPage);
table.ForeignKey(
name: "FK_BulletinBoardPage_BulletinBoards_IdBulletinBoard",
column: x => x.IdBulletinBoard,
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_BulletinBoardPage_IdBulletinBoard",
table: "BulletinBoardPage",
column: "IdBulletinBoard");
migrationBuilder.AddForeignKey(
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
table: "Notes",
column: "IdBulletinBoardPage",
principalTable: "BulletinBoardPage",
principalColumn: "IdBulletinBoardPage",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
table: "Notes");
migrationBuilder.DropTable(
name: "BulletinBoardPage");
migrationBuilder.RenameColumn(
name: "IdBulletinBoardPage",
table: "Notes",
newName: "IdBulletinBoard");
migrationBuilder.RenameIndex(
name: "IX_Notes_IdBulletinBoardPage",
table: "Notes",
newName: "IX_Notes_IdBulletinBoard");
migrationBuilder.AddForeignKey(
name: "FK_Notes_BulletinBoards_IdBulletinBoard",
table: "Notes",
column: "IdBulletinBoard",
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _5 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ColorClass",
table: "Notes",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Zindex",
table: "Notes",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ColorClass",
table: "Notes");
migrationBuilder.DropColumn(
name: "Zindex",
table: "Notes");
}
}
}

View File

@@ -11,8 +11,8 @@ using ZpcBulletinBoard.Data;
namespace ZpcBulletinBoard.Migrations namespace ZpcBulletinBoard.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20240227053725_3")] [Migration("20240308174035_1")]
partial class _3 partial class _1
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -148,29 +148,62 @@ namespace ZpcBulletinBoard.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Duration") b.Property<string>("ExternalLink")
.HasColumnType("int"); .IsRequired()
.HasColumnType("longtext");
b.Property<int>("IdBulletinBoard")
.HasColumnType("int");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("Ratio")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("IdBulletinBoardPage"); b.HasKey("IdBulletinBoardPage");
b.HasIndex("IdBulletinBoard");
b.ToTable("BulletinBoardPage"); b.ToTable("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{
b.Property<int>("IdLink")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardFk")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardPageFk")
.HasColumnType("int");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("IdLink");
b.HasIndex("IdBulletinBoardFk");
b.HasIndex("IdBulletinBoardPageFk");
b.ToTable("BulletinBoardPageLinks");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.Property<int>("IdNote") b.Property<int>("IdNote")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("ColorClass")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Content") b.Property<string>("Content")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
@@ -181,9 +214,8 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("IdBulletinBoardPage") b.Property<int>("IdBulletinBoardPage")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Title") b.Property<int>("Type")
.IsRequired() .HasColumnType("int");
.HasColumnType("longtext");
b.Property<int>("Width") b.Property<int>("Width")
.HasColumnType("int"); .HasColumnType("int");
@@ -194,6 +226,9 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("Y") b.Property<int>("Y")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Zindex")
.HasColumnType("int");
b.HasKey("IdNote"); b.HasKey("IdNote");
b.HasIndex("IdBulletinBoardPage"); b.HasIndex("IdBulletinBoardPage");
@@ -368,21 +403,29 @@ namespace ZpcBulletinBoard.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Pages") .WithMany("Links")
.HasForeignKey("IdBulletinBoard") .HasForeignKey("IdBulletinBoardFk")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Links")
.HasForeignKey("IdBulletinBoardPageFk")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("BulletinBoard"); b.Navigation("BulletinBoard");
b.Navigation("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Notes") .WithMany()
.HasForeignKey("IdBulletinBoardPage") .HasForeignKey("IdBulletinBoardPage")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -392,12 +435,12 @@ namespace ZpcBulletinBoard.Migrations
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{ {
b.Navigation("Pages"); b.Navigation("Links");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
{ {
b.Navigation("Notes"); b.Navigation("Links");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

View File

@@ -0,0 +1,142 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BulletinBoardPage",
columns: table => new
{
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Ratio = table.Column<int>(type: "int", nullable: false),
Type = table.Column<int>(type: "int", nullable: false),
ExternalLink = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoardPage", x => x.IdBulletinBoardPage);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "BulletinBoards",
columns: table => new
{
IdBulletinBoard = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Guid = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Ratio = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoards", x => x.IdBulletinBoard);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Notes",
columns: table => new
{
IdNote = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false),
X = table.Column<int>(type: "int", nullable: false),
Y = table.Column<int>(type: "int", nullable: false),
Width = table.Column<int>(type: "int", nullable: false),
Height = table.Column<int>(type: "int", nullable: false),
Content = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Zindex = table.Column<int>(type: "int", nullable: false),
ColorClass = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Type = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Notes", x => x.IdNote);
table.ForeignKey(
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
column: x => x.IdBulletinBoardPage,
principalTable: "BulletinBoardPage",
principalColumn: "IdBulletinBoardPage",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "BulletinBoardPageLinks",
columns: table => new
{
IdLink = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IdBulletinBoardFk = table.Column<int>(type: "int", nullable: false),
IdBulletinBoardPageFk = table.Column<int>(type: "int", nullable: false),
Duration = table.Column<int>(type: "int", nullable: false),
Order = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoardPageLinks", x => x.IdLink);
table.ForeignKey(
name: "FK_BulletinBoardPageLinks_BulletinBoardPage_IdBulletinBoardPage~",
column: x => x.IdBulletinBoardPageFk,
principalTable: "BulletinBoardPage",
principalColumn: "IdBulletinBoardPage",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BulletinBoardPageLinks_BulletinBoards_IdBulletinBoardFk",
column: x => x.IdBulletinBoardFk,
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_BulletinBoardPageLinks_IdBulletinBoardFk",
table: "BulletinBoardPageLinks",
column: "IdBulletinBoardFk");
migrationBuilder.CreateIndex(
name: "IX_BulletinBoardPageLinks_IdBulletinBoardPageFk",
table: "BulletinBoardPageLinks",
column: "IdBulletinBoardPageFk");
migrationBuilder.CreateIndex(
name: "IX_Notes_IdBulletinBoardPage",
table: "Notes",
column: "IdBulletinBoardPage");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BulletinBoardPageLinks");
migrationBuilder.DropTable(
name: "Notes");
migrationBuilder.DropTable(
name: "BulletinBoards");
migrationBuilder.DropTable(
name: "BulletinBoardPage");
}
}
}

View File

@@ -11,8 +11,8 @@ using ZpcBulletinBoard.Data;
namespace ZpcBulletinBoard.Migrations namespace ZpcBulletinBoard.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20240228173917_5")] [Migration("20240309085239_2")]
partial class _5 partial class _2
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -148,23 +148,51 @@ namespace ZpcBulletinBoard.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Duration") b.Property<string>("ExternalLink")
.HasColumnType("int"); .HasColumnType("longtext");
b.Property<int>("IdBulletinBoard")
.HasColumnType("int");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("Ratio")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("IdBulletinBoardPage"); b.HasKey("IdBulletinBoardPage");
b.HasIndex("IdBulletinBoard");
b.ToTable("BulletinBoardPage"); b.ToTable("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{
b.Property<int>("IdLink")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardFk")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardPageFk")
.HasColumnType("int");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("IdLink");
b.HasIndex("IdBulletinBoardFk");
b.HasIndex("IdBulletinBoardPageFk");
b.ToTable("BulletinBoardPageLinks");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.Property<int>("IdNote") b.Property<int>("IdNote")
@@ -185,6 +213,9 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("IdBulletinBoardPage") b.Property<int>("IdBulletinBoardPage")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<int>("Width") b.Property<int>("Width")
.HasColumnType("int"); .HasColumnType("int");
@@ -371,21 +402,29 @@ namespace ZpcBulletinBoard.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Pages") .WithMany("Links")
.HasForeignKey("IdBulletinBoard") .HasForeignKey("IdBulletinBoardFk")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Links")
.HasForeignKey("IdBulletinBoardPageFk")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("BulletinBoard"); b.Navigation("BulletinBoard");
b.Navigation("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Notes") .WithMany()
.HasForeignKey("IdBulletinBoardPage") .HasForeignKey("IdBulletinBoardPage")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -395,12 +434,12 @@ namespace ZpcBulletinBoard.Migrations
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{ {
b.Navigation("Pages"); b.Navigation("Links");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
{ {
b.Navigation("Notes"); b.Navigation("Links");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

View File

@@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ExternalLink",
table: "BulletinBoardPage",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "BulletinBoardPage",
keyColumn: "ExternalLink",
keyValue: null,
column: "ExternalLink",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ExternalLink",
table: "BulletinBoardPage",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@@ -11,8 +11,8 @@ using ZpcBulletinBoard.Data;
namespace ZpcBulletinBoard.Migrations namespace ZpcBulletinBoard.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20240228165943_4")] [Migration("20240309105503_3")]
partial class _4 partial class _3
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -148,29 +148,64 @@ namespace ZpcBulletinBoard.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Duration") b.Property<string>("ExternalLink")
.HasColumnType("int"); .HasColumnType("longtext");
b.Property<int>("IdBulletinBoard") b.Property<string>("Image")
.HasColumnType("int"); .HasColumnType("longtext");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("Ratio")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("IdBulletinBoardPage"); b.HasKey("IdBulletinBoardPage");
b.HasIndex("IdBulletinBoard");
b.ToTable("BulletinBoardPage"); b.ToTable("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{
b.Property<int>("IdLink")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardFk")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardPageFk")
.HasColumnType("int");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("IdLink");
b.HasIndex("IdBulletinBoardFk");
b.HasIndex("IdBulletinBoardPageFk");
b.ToTable("BulletinBoardPageLinks");
});
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.Property<int>("IdNote") b.Property<int>("IdNote")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("ColorClass")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Content") b.Property<string>("Content")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
@@ -181,6 +216,9 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("IdBulletinBoardPage") b.Property<int>("IdBulletinBoardPage")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<int>("Width") b.Property<int>("Width")
.HasColumnType("int"); .HasColumnType("int");
@@ -190,6 +228,9 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("Y") b.Property<int>("Y")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Zindex")
.HasColumnType("int");
b.HasKey("IdNote"); b.HasKey("IdNote");
b.HasIndex("IdBulletinBoardPage"); b.HasIndex("IdBulletinBoardPage");
@@ -364,21 +405,29 @@ namespace ZpcBulletinBoard.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Pages") .WithMany("Links")
.HasForeignKey("IdBulletinBoard") .HasForeignKey("IdBulletinBoardFk")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Links")
.HasForeignKey("IdBulletinBoardPageFk")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("BulletinBoard"); b.Navigation("BulletinBoard");
b.Navigation("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Notes") .WithMany()
.HasForeignKey("IdBulletinBoardPage") .HasForeignKey("IdBulletinBoardPage")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -388,12 +437,12 @@ namespace ZpcBulletinBoard.Migrations
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{ {
b.Navigation("Pages"); b.Navigation("Links");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
{ {
b.Navigation("Notes"); b.Navigation("Links");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

View File

@@ -5,25 +5,25 @@
namespace ZpcBulletinBoard.Migrations namespace ZpcBulletinBoard.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class _4 : Migration public partial class _3 : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropColumn( migrationBuilder.AddColumn<string>(
name: "Title", name: "Image",
table: "Notes"); table: "BulletinBoardPage",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.AddColumn<string>( migrationBuilder.DropColumn(
name: "Title", name: "Image",
table: "Notes", table: "BulletinBoardPage");
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
} }
} }
} }

View File

@@ -136,7 +136,7 @@ namespace ZpcBulletinBoard.Migrations
b.HasKey("IdBulletinBoard"); b.HasKey("IdBulletinBoard");
b.ToTable("BulletinBoards"); b.ToTable("BulletinBoards", (string)null);
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
@@ -145,21 +145,52 @@ namespace ZpcBulletinBoard.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Duration") b.Property<string>("ExternalLink")
.HasColumnType("int"); .HasColumnType("longtext");
b.Property<int>("IdBulletinBoard") b.Property<string>("Image")
.HasColumnType("int"); .HasColumnType("longtext");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("Ratio")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("IdBulletinBoardPage"); b.HasKey("IdBulletinBoardPage");
b.HasIndex("IdBulletinBoard"); b.ToTable("BulletinBoardPage", (string)null);
});
b.ToTable("BulletinBoardPage"); modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{
b.Property<int>("IdLink")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardFk")
.HasColumnType("int");
b.Property<int>("IdBulletinBoardPageFk")
.HasColumnType("int");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("IdLink");
b.HasIndex("IdBulletinBoardFk");
b.HasIndex("IdBulletinBoardPageFk");
b.ToTable("BulletinBoardPageLinks", (string)null);
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
@@ -182,6 +213,9 @@ namespace ZpcBulletinBoard.Migrations
b.Property<int>("IdBulletinBoardPage") b.Property<int>("IdBulletinBoardPage")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<int>("Width") b.Property<int>("Width")
.HasColumnType("int"); .HasColumnType("int");
@@ -198,7 +232,7 @@ namespace ZpcBulletinBoard.Migrations
b.HasIndex("IdBulletinBoardPage"); b.HasIndex("IdBulletinBoardPage");
b.ToTable("Notes"); b.ToTable("Notes", (string)null);
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationRole", b => modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationRole", b =>
@@ -368,21 +402,29 @@ namespace ZpcBulletinBoard.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPageLink", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
.WithMany("Pages") .WithMany("Links")
.HasForeignKey("IdBulletinBoard") .HasForeignKey("IdBulletinBoardFk")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Links")
.HasForeignKey("IdBulletinBoardPageFk")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("BulletinBoard"); b.Navigation("BulletinBoard");
b.Navigation("BulletinBoardPage");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
{ {
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage") b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
.WithMany("Notes") .WithMany()
.HasForeignKey("IdBulletinBoardPage") .HasForeignKey("IdBulletinBoardPage")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -392,12 +434,12 @@ namespace ZpcBulletinBoard.Migrations
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
{ {
b.Navigation("Pages"); b.Navigation("Links");
}); });
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b => modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
{ {
b.Navigation("Notes"); b.Navigation("Links");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

View File

@@ -35,6 +35,6 @@ namespace ZpcBulletinBoard.Models.Editor
// InvoicePart // InvoicePart
[InverseProperty("BulletinBoard")] [InverseProperty("BulletinBoard")]
public virtual ICollection<BulletinBoardPage> Pages { get; set; } public virtual ICollection<BulletinBoardPageLink> Links { get; set; }
} }
} }

View File

@@ -1,29 +1,46 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using ZpcBulletinBoard.Classes;
using static ZpcBulletinBoard.Models.Editor.BulletinBoard;
namespace ZpcBulletinBoard.Models.Editor namespace ZpcBulletinBoard.Models.Editor
{ {
public class BulletinBoardPage public class BulletinBoardPage
{ {
public enum TypeEnum
{
[Display(Name = "Deska")]
Board = 1,
[Display(Name = "Slika")]
Image = 2,
[Display(Name = "Zunanja povezava")]
ExternalLink = 3
}
[Key] [Key]
public int IdBulletinBoardPage { get; set; } public int IdBulletinBoardPage { get; set; }
[Required]
[ForeignKey("BulletinBoard")]
public int IdBulletinBoard { get; set; }
[Required] [Required]
[Display(Name = "Ime")] [Display(Name = "Ime")]
public string Name { get; set; } public string Name { get; set; }
[Required] [Required]
[Display(Name = "Trajanje")] [Display(Name = "Razmerje")]
public int Duration { get; set; } public RatioEnum Ratio { get; set; }
// ForeignKey [NotMapped]
public BulletinBoard BulletinBoard { get; set; } public string RatioString => Ratio.GetAttributeOfType<DisplayAttribute>().Name ?? "";
[Required]
[Display(Name = "Tip")]
public TypeEnum Type { get; set; }
public string? Image { get; set; }
public string? ExternalLink { get; set; }
[InverseProperty("BulletinBoardPage")]
public virtual ICollection<BulletinBoardPageLink> Links { get; set; }
[InverseProperty("BulletinBoardPage")] [InverseProperty("BulletinBoardPage")]
public virtual ICollection<Note> Notes { get; set; } public virtual ICollection<Note> Notes { get; set; }

View File

@@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ZpcBulletinBoard.Models.Editor
{
public class BulletinBoardPageLink
{
[Key]
public int IdLink { get; set; }
[Required]
[ForeignKey("BulletinBoard")]
public int IdBulletinBoardFk { get; set; }
[Required]
[ForeignKey("BulletinBoardPage")]
public int IdBulletinBoardPageFk { get; set; }
[Required]
[Display(Name = "Trajanje")]
public int Duration { get; set; }
[Required]
[Display(Name = "Vrstni red")]
public int Order { get; set; }
// ForeignKey
public BulletinBoard BulletinBoard { get; set; }
public BulletinBoardPage BulletinBoardPage { get; set; }
}
}

View File

@@ -5,6 +5,13 @@ namespace ZpcBulletinBoard.Models.Editor
{ {
public class Note public class Note
{ {
public enum TypeEnum
{
Board = 1,
Image = 2,
ExternalLink = 3
}
[Key] [Key]
public int IdNote { get; set; } public int IdNote { get; set; }
@@ -33,6 +40,9 @@ namespace ZpcBulletinBoard.Models.Editor
[Required] [Required]
public string ColorClass { get; set; } public string ColorClass { get; set; }
[Required]
public TypeEnum Type { get; set; }
// ForeignKey // ForeignKey
public BulletinBoardPage BulletinBoardPage { get; set; } public BulletinBoardPage BulletinBoardPage { get; set; }
} }

View File

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

View File

@@ -36,13 +36,12 @@ namespace ZpcBulletinBoard.Pages.Boards
{ {
Ratio = BulletinBoard.RatioEnum.Ratio16To9, Ratio = BulletinBoard.RatioEnum.Ratio16To9,
Guid = Guid.NewGuid(), Guid = Guid.NewGuid(),
Pages = new List<BulletinBoardPage>()
}; };
return Page(); return Page();
} }
var tmpBoard = await context.BulletinBoards.Include(x => x.Pages) var tmpBoard = await context.BulletinBoards
.FirstOrDefaultAsync(m => m.Guid == guid); .FirstOrDefaultAsync(m => m.Guid == guid);

View File

@@ -3,20 +3,11 @@
@{ @{
ViewData["Title"] = "Oglasne deske - Pregled"; ViewData["Title"] = "Oglasne deske - Pregled";
Layout = "~/Pages/Shared/_Layout.cshtml"; Layout = "~/Pages/Layouts/_Layout.cshtml";
} }
@section Styles { @section Styles {
<link rel="stylesheet" href="~/vendor/libs/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.css"> <link rel="stylesheet" href="~/css/boards/index.css" asp-append-version="true" />
<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>
} }
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4"> <h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
@@ -27,11 +18,23 @@
</span> </span>
</h4> </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"> <div class="card">
<h6 class="card-header"> <h6 class="card-header">
Seznam oglasnih desk Seznam oglasnih desk
</h6> </h6>
<table class="table card-table"> <div class="div-boards">
<table class="table card-table table-hover">
<thead> <thead>
<tr> <tr>
<th> <th>
@@ -54,16 +57,20 @@
@Html.DisplayFor(modelItem => item.Ratio) @Html.DisplayFor(modelItem => item.Ratio)
</td> </td>
<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> <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> </td>
</tr> </tr>
} }
</tbody> </tbody>
</table> </table>
</div>
<div class="card-footer py-3 text-right"> <div class="card-footer py-3 text-right">
<a asp-page="AddEdit" class="btn btn-primary">Dodaj novo</a> <a asp-page="AddEdit" class="btn btn-primary">Dodaj novo</a>
</div> </div>
</div> </div>
@section Scripts { @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

@@ -0,0 +1,76 @@
@page
@model ZpcBulletinBoard.Pages.BoardsLinks.IndexModel
@{
ViewData["Title"] = "Oglasne deske - Povezave";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles
{
<link rel="stylesheet" href="~/css/boards-links/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">
<span>
<span class="text-muted font-weight-light">
<i>Oglasne deske</i>
/</span> Povezave
</span>
</h4>
<div class="card">
<div class="header">
<div class="div-content">
<div class="div-content-boards">
<input id="inpSearchBoard" class="form-control form-control-sm" placeholder="Iskanje oglasnik desk..." />
</div>
<div class="div-content-pages">
<input id="inpSearchPage" class="form-control form-control-sm" placeholder="Iskanje strani..." />
</div>
</div>
</div>
<div class="div-content main-content">
<div class="div-content-boards boards-content">
@* @foreach (var board in Model.Boards)
{
<div class="div-board">
<h5>@board.Name</h5>
</div>
<div class="div-pages" ondrop="dropPage(event, this)" ondragover="allowDropPage(event, this)" data-idboard="@board.IdBulletinBoard">
</div>
<hr/>
} *@
</div>
<div class="div-content-pages">
<div class="div-available-pages">
@foreach (var tmpPage in Model.Pages)
{
<div class="div-page available-page" draggable="true" ondragstart="dragPage(event, this)" data-id="@tmpPage.IdBulletinBoardPage">
@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" onclick="addPageToAllBoards(this)"><i class="fas fa-reply-all"></i></a>
</div>
</div>
}
</div>
</div>
</div>
</div>
@Html.AntiForgeryToken()
@section Scripts {
<script src="~/js/boards-links/index.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using ZpcBulletinBoard.Data;
using ZpcBulletinBoard.Models.Editor;
namespace ZpcBulletinBoard.Pages.BoardsLinks
{
[Authorize]
public class IndexModel(ApplicationDbContext context) : PageModel
{
public IList<BulletinBoardPage> Pages { get;set; }
public async Task OnGetAsync()
{
Pages = await context.BulletinBoardPage.OrderBy(x => x.Name).ToListAsync();
}
//Get
public IActionResult OnGetBoards()
{
var boards = context.BulletinBoards
.Include(x => x.Links.OrderBy(y => y.Order))
.ThenInclude(x => x.BulletinBoardPage)
.ToList();
foreach (var board in boards)
{
foreach (var link in board.Links)
{
link.BulletinBoardPage.Links = null;
link.BulletinBoard = null;
}
}
return new JsonResult(new { successful = true, error = $"", boards });
}
//Post
public IActionResult OnPostAddLink(int idBoard, int idPage)
{
var order = 1;
var links = context.BulletinBoardPageLinks.Where(x => x.IdBulletinBoardFk == idBoard).ToList();
if (links.Any())
order = links.Max(x => x.Order) + 1;
var link = new BulletinBoardPageLink
{
Duration = 30,
IdBulletinBoardFk = idBoard,
IdBulletinBoardPageFk = idPage,
Order = order
};
context.BulletinBoardPageLinks.Add(link);
context.SaveChanges();
link = context.BulletinBoardPageLinks.Include(x => x.BulletinBoardPage).First(x => x.IdLink == link.IdLink);
link.BulletinBoardPage.Links = null;
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

@@ -1,153 +0,0 @@
@page
@model EditMainModel
@{
ViewData["Title"] = "Urejanje";
}
@section Styles
{
<link rel="stylesheet" href="~/lib/summernote/summernote-bs4.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/editor/editor-main.css" asp-append-version="true"/>
}
<div class="fab-container-add">
<div class="button iconbutton btn-success" onclick="addNewNote()">
<i class="far fa-sticky-note fa-2x"></i>
</div>
</div>
<div class="fab-container-save">
<div class="button iconbutton btn-primary" onclick="saveNotes();">
<i class="far fa-save fa-2x"></i>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body div-main-body">
<div class="div-pages">
<div class="div-board" onclick="openModalSelectBoard();">
<h5>Oglasna deska ni izbrana</h5>
<small><i class="fas fa-mouse-pointer"></i>&nbsp;Spremni oglasno desko</small>
</div>
<div class="div-page add-page" onclick="openModalBoardAddNewPage();">
<i class="fas fa-plus fa-2x"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body div-main-body">
<input class="input-hidden" id="inpSelectedBoardPageId" />
<div id="divPlaceholder">
</div>
</div>
</div>
</div>
</div>
<div id="divModalSelectBoard" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Izberi oglasno desko</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th>Naziv</th>
</tr>
</thead>
<tbody id="tbodyModalSelectBoard">
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
<div id="divModalAddEditPage" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 id="titleModalAddEditPage" class="modal-title">List</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input class="input-hidden" id="inpModalAddEditPageId" />
<div class="form-group">
<label class="control-label">Ime</label>
<input id="inpModalAddEditPageName" type="text" class="form-control"/>
</div>
<div class="form-group">
<label class="control-label">Trajanje</label>
<input id="inpModalAddEditPageDuration" type="number" class="form-control"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="boardAddNewPageSave();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="divModalEditNote" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Urejanje zapiska</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input id="inpModalEditNoteIdNote" class="input-hidden"/>
<label class="control-label">Vsebina:</label>
<div id="divModalEditNoteSummernote"></div>
<label class="control-label">Barva:</label>
<div class="div-note-edit-color">
<div class="note-color-white active"></div>
<div class="note-color-yellow"></div>
<div class="note-color-orange"></div>
<div class="note-color-light-green"></div>
<div class="note-color-blue"></div>
<div class="note-color-purple"></div>
<div class="note-color-grey"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="saveModalEditNote();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
@Html.AntiForgeryToken()
@section Scripts
{
<script src="~/lib/summernote/summernote-bs4.js" asp-append-version="true"></script>
<script src="~/lib/html-to-image/dist/html-to-image.js" asp-append-version="true"></script>
<script src="~/js/editor/note.js" asp-append-version="true"></script>
<script src="~/js/editor/edit-main.js" asp-append-version="true"></script>
}

View File

@@ -16,7 +16,7 @@ namespace ZpcBulletinBoard.Pages
public IActionResult OnGet() public IActionResult OnGet()
{ {
return Redirect("~/Editor/EditMain"); return Redirect("~/Pages/Index");
} }
} }
} }

View File

@@ -4,22 +4,31 @@
<div class="app-brand demo"> <div class="app-brand demo">
<span class="app-brand-logo demo bg-secondary"> <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> </span>
<a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">Bulletin board</a> <a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">ZPC 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>
</div> </div>
<div class="sidenav-divider mt-0"></div> <div class="sidenav-divider mt-0"></div>
<ul class="sidenav-inner"> <ul class="sidenav-inner">
<li class="sidenav-item@(currentPage.StartsWith("/Editor")? " active" : "")"> <li class="sidenav-item@(currentPage.StartsWith("/Pages/")? " active" : "")">
<a asp-page="/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Urejevalnik</div></a> <a asp-page="/Pages/Index" class="sidenav-link"><i class="sidenav-icon far fa-file"></i><div>Strani</div></a>
</li> </li>
<li class="sidenav-item@(currentPage.StartsWith("/Boards") ? " active" : "")"> <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>
<li class="sidenav-item@(currentPage.StartsWith("/BoardsLinks/") ? " active" : "")">
<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> </ul>
</div> </div>

View File

@@ -7,7 +7,8 @@
<meta name="description" content="" /> <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" /> <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 --> <!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900" rel="stylesheet" crossorigin="anonymous" /> <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 { @section Styles {

View File

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

View File

@@ -0,0 +1,88 @@
@page
@model EditMainModel
@{
ViewData["Title"] = "Urejanje";
}
@section Styles
{
<link rel="stylesheet" href="~/lib/summernote/summernote-bs4.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/pages/editor-main.css" asp-append-version="true" />
}
<input id="inpIdPage" type="hidden" asp-for="@Model.Page.IdBulletinBoardPage"/>
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">
<i>Oglasna deska strani</i>/
<i>@Model.Page.Name</i>/
</span> Urejanje
</span>
</h4>
<div class="fab-container-add">
<div class="button iconbutton btn-success" onclick="addNewNote()">
<i class="far fa-sticky-note fa-2x"></i>
</div>
</div>
<div class="fab-container-save">
<div class="button iconbutton btn-primary" onclick="saveNotes();">
<i class="far fa-save fa-2x"></i>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body div-main-body">
<input class="input-hidden" id="inpSelectedBoardPageId" />
<div id="divPlaceholder">
</div>
</div>
</div>
</div>
</div>
<div id="divModalEditNote" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Urejanje zapiska</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input id="inpModalEditNoteIdNote" class="input-hidden" />
<label class="control-label">Vsebina:</label>
<div id="divModalEditNoteSummernote"></div>
<label class="control-label">Barva:</label>
<div class="div-note-edit-color">
<div class="note-color-white active"></div>
<div class="note-color-yellow"></div>
<div class="note-color-orange"></div>
<div class="note-color-light-green"></div>
<div class="note-color-blue"></div>
<div class="note-color-purple"></div>
<div class="note-color-grey"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="saveModalEditNote();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
@Html.AntiForgeryToken()
@section Scripts
{
<script src="~/lib/summernote/summernote-bs4.js" asp-append-version="true"></script>
<script src="~/lib/html-to-image/dist/html-to-image.js" asp-append-version="true"></script>
<script src="~/js/pages/note.js" asp-append-version="true"></script>
<script src="~/js/pages/edit-main.js" asp-append-version="true"></script>
}

View File

@@ -5,17 +5,28 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using ZpcBulletinBoard.Data; using ZpcBulletinBoard.Data;
using ZpcBulletinBoard.Models.Editor; using ZpcBulletinBoard.Models.Editor;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Hosting;
namespace ZpcBulletinBoard.Pages.Editor namespace ZpcBulletinBoard.Pages.Pages
{ {
[Authorize] [Authorize]
public class EditMainModel(ILogger<EditMainModel> logger, ApplicationDbContext context) : PageModel public class EditMainModel(ILogger<EditMainModel> logger, ApplicationDbContext context, IWebHostEnvironment webHostEnvironment) : PageModel
{ {
private readonly ILogger<EditMainModel> _logger = logger; private readonly ILogger<EditMainModel> _logger = logger;
public void OnGet() public BulletinBoardPage Page { get; set; }
public IActionResult OnGet(int? idPage)
{ {
if (idPage == null)
return NotFound();
var tmpPage = context.BulletinBoardPage.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return NotFound();
Page = tmpPage;
return Page();
} }
//Get //Get
@@ -28,13 +39,13 @@ namespace ZpcBulletinBoard.Pages.Editor
public IActionResult OnGetBoard(int id) public IActionResult OnGetBoard(int id)
{ {
var board = context.BulletinBoards.Include(x => x.Pages) var board = context.BulletinBoards
.FirstOrDefault(x => x.IdBulletinBoard == id); .FirstOrDefault(x => x.IdBulletinBoard == id);
//Ce je ntre board pole json vrze vn //Ce je ntre board pole json vrze vn
foreach (var bulletinBoardPage in board.Pages) //foreach (var bulletinBoardPage in board.Pages)
{ //{
bulletinBoardPage.BulletinBoard = null; // bulletinBoardPage.BulletinBoard = null;
} //}
return board == null return board == null
? new JsonResult(new { successful = false, error = $"Board with ID {id} not exists!"}) ? new JsonResult(new { successful = false, error = $"Board with ID {id} not exists!"})
: new JsonResult(new { successful = true, error = $"", board }); : new JsonResult(new { successful = true, error = $"", board });
@@ -42,15 +53,25 @@ namespace ZpcBulletinBoard.Pages.Editor
public IActionResult OnGetPage(int id) public IActionResult OnGetPage(int id)
{ {
var page = context.BulletinBoardPage.Include(x => x.Notes) var page = context.BulletinBoardPage
.Include(x => x.Links)
.Include(x => x.Notes)
.FirstOrDefault(x => x.IdBulletinBoardPage == id); .FirstOrDefault(x => x.IdBulletinBoardPage == id);
if (page == null)
return new JsonResult(new { successful = false, error = $"Page with ID {id} not exists!" });
foreach (var link in page.Links)
{
link.BulletinBoardPage = null;
}
foreach (var note in page.Notes) foreach (var note in page.Notes)
{ {
note.BulletinBoardPage = null; note.BulletinBoardPage = null;
} }
return page == null
? new JsonResult(new { successful = false, error = $"Page with ID {id} not exists!" }) return new JsonResult(new { successful = true, error = "", page });
: new JsonResult(new { successful = true, error = $"", page });
} }
//Post //Post
@@ -67,7 +88,7 @@ namespace ZpcBulletinBoard.Pages.Editor
return new JsonResult(new { successful = false, error = $"Page with ID {page.IdBulletinBoardPage} not exists!", page }); return new JsonResult(new { successful = false, error = $"Page with ID {page.IdBulletinBoardPage} not exists!", page });
tmpPage.Name = page.Name; tmpPage.Name = page.Name;
tmpPage.Duration = page.Duration; //tmpPage.Duration = page.Duration;
} }
context.SaveChanges(); context.SaveChanges();
@@ -109,5 +130,32 @@ namespace ZpcBulletinBoard.Pages.Editor
return new JsonResult(new { successful = true, error = "" }); return new JsonResult(new { successful = true, error = "" });
} }
public IActionResult OnPostBoardPageImage(IFormFile? file, int idPage)
{
if (file == null)
return new JsonResult(new { successful = true, error = "No file!" });
var tmpPage = context.BulletinBoardPage.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {idPage} not exists!" });
var uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "bulletin-board-images/pages");
var imageName = "StaticImage_" + idPage + ".svg";
var filePath = Path.Combine(uploadsFolder, imageName);
if (System.IO.File.Exists(filePath))
System.IO.File.Delete(filePath);
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
file.CopyTo(fileStream);
}
tmpPage.Image = imageName;
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"" });
}
} }
} }

View File

@@ -0,0 +1,132 @@
@page
@model ZpcBulletinBoard.Pages.Pages.IndexModel
@{
ViewData["Title"] = "Strani - Pregled";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/css/pages/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">
<span>
<span class="text-muted font-weight-light">
<i>Oglasna deska strani</i>
/</span> Pregled
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<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">
Strani
</h6>
<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>
</div>
<div id="divModalAddEditPage" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Urejanje strani</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input id="inpModalAddEditPageIdPage" type="hidden" />
<div class="form-group">
<label class="control-label">Ime</label>
<input id="inpModalAddEditPageName" class="form-control"/>
</div>
<div class="form-group">
<label class="control-label">Razmerje</label>
<select id="selModalAddEditPageRatio" class="form-control" asp-items="Html.GetEnumSelectList<Models.Editor.BulletinBoard.RatioEnum>()">
</select>
</div>
<div class="form-group">
<label class="control-label">Tip</label>
<select id="selModalAddEditPageType" class="form-control" asp-items="Html.GetEnumSelectList<Models.Editor.BulletinBoardPage.TypeEnum>()">
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="saveModalAddEditPage();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
<div id="divModalPageEditorPicture" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Urejanje slike</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input id="inpModalPageEditorPictureIdPage" type="hidden" />
<div class="form-group">
<label class="control-label">Izberi sliko</label>
<input type="file" id="inpModalPageEditorPicturePicture" class="form-control" />
</div>
<hr/>
<img id="imgModalPageEditorPicture" src="" class="img-fluid" alt="Responsive image">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="saveModalPageEditorPicture();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
<div id="divModalPageEditorLink" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Urejanje zunanje povezave</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<input id="inpModalPageEditorLinkIdPage" type="hidden" />
<div class="form-group">
<label class="control-label">Povezava</label>
<input id="inpModalPageEditorLinkLink" class="form-control" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="saveModalPageEditorLink();">Shrani</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Prekliči</button>
</div>
</div>
</div>
</div>
@Html.AntiForgeryToken()
@section Scripts {
<script src="~/js/pages/index.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using ZpcBulletinBoard.Data;
using ZpcBulletinBoard.Models.Editor;
using Microsoft.AspNetCore.Hosting;
using static System.Net.Mime.MediaTypeNames;
namespace ZpcBulletinBoard.Pages.Pages
{
[Authorize]
public class IndexModel(ApplicationDbContext context, IWebHostEnvironment webHostEnvironment) : PageModel
{
public void OnGet()
{
}
//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)
.FirstOrDefault(x => x.IdBulletinBoardPage == id);
if (page == null)
return new JsonResult(new { successful = false, error = $"Page with ID {id} not exists!" });
foreach (var link in page.Links)
{
link.BulletinBoardPage.Links = null;
}
return new JsonResult(new { successful = true, error = $"", page });
}
//Posts
public IActionResult OnPostBoardPage(BulletinBoardPage page)
{
if (page.IdBulletinBoardPage <= 0)
{
context.BulletinBoardPage.Add(page);
}
else
{
var tmpPage = context.BulletinBoardPage.FirstOrDefault(x => x.IdBulletinBoardPage == page.IdBulletinBoardPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {page.IdBulletinBoardPage} not exists!", page });
tmpPage.Name = page.Name;
//tmpPage.Duration = page.Duration;
}
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"", page });
}
public IActionResult OnPostBoardPageLink(int idPage, string link)
{
var tmpPage = context.BulletinBoardPage.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {idPage} not exists!" });
tmpPage.ExternalLink = link;
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"", tmpPage });
}
public IActionResult OnPostBoardPagePicture(IFormFile? file, int idPage)
{
if (file == null)
return new JsonResult(new { successful = true, error = "No file!" });
var tmpPage = context.BulletinBoardPage.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {idPage} not exists!" });
var uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "bulletin-board-images/pages");
var imageName = "StaticImage_" + idPage + Path.GetExtension(file.FileName);
var filePath = Path.Combine(uploadsFolder, imageName);
if (System.IO.File.Exists(filePath))
System.IO.File.Delete(filePath);
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
file.CopyTo(fileStream);
}
tmpPage.Image = imageName;
context.SaveChanges();
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 @model ZpcBulletinBoard.Pages.SetupNew.SetupModel
@{ @{
ViewData["Title"] = "SetupNew"; ViewData["Title"] = "SetupNew";
Layout = "~/Pages/Shared/_LayoutBlank.cshtml"; Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
} }

View File

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

View File

@@ -118,7 +118,9 @@ namespace ZpcBulletinBoard.Pages.User
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
//TODO samo za DEV
var result = await _loginManager.PasswordSignInAsync(Input.UserName, Input.Password, 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) if (result.Succeeded)
{ {

View File

@@ -2,5 +2,5 @@
@model ZpcBulletinBoard.Pages.User.LogoutModel @model ZpcBulletinBoard.Pages.User.LogoutModel
@{ @{
ViewData["Title"] = "Odjava"; 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; 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(); 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,8 +34,13 @@
<ItemGroup> <ItemGroup>
<Folder Include="Migrations\" /> <Folder Include="Migrations\" />
<Folder Include="Properties\PublishProfiles\" /> <Folder Include="wwwroot\bulletin-board-images\notes\" />
<Folder Include="wwwroot\bulletin-board-images\" /> <Folder Include="wwwroot\bulletin-board-images\pages\" />
<Folder Include="wwwroot\img\" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\docker.zapecnik.com.pubxml.user" />
</ItemGroup> </ItemGroup>
</Project> </Project>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -0,0 +1,121 @@
.main-content{
height: calc(100vh - 300px);
}
.div-content{
width: 100%;
}
.div-content-boards{
float: left;
width: calc(100% - 240px);
max-width: calc(100% - 240px);
}
.div-content-pages{
float: left;
width: 240px;
height: 100%;
}
.boards-content > hr{
margin-top: 0px;
margin-bottom: 0px;
}
.div-board{
float: left;
text-align: center;
width: 50px;
height: 230px;
border: 1px solid rgba(24, 28, 33, 0.06);
border-radius: 0.25rem;
margin: 5px;
margin-right: 15px;
writing-mode: vertical-lr;
background-color: rgba(111, 111, 143, 0.171);
}
.div-board > h5 {
margin: 2px;
margin-left:15px;
text-orientation: mixed;
}
.div-pages {
width: calc(100% - 70px);
margin: 5px;
height: 230px;
margin-left: 10px;
margin-bottom: 5px;
overflow-x: auto;
}
.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;
}
.div-page:hover {
cursor: grab;
/* 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;
}
.div-available-pages{
overflow-y: scroll;
height: 100%;
}
.div-available-pages>.div-page{
margin-top: 5px;
margin-left: 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;
}
#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

@@ -39,74 +39,30 @@
cursor: nwse-resize; cursor: nwse-resize;
} }
.div-board{
float: left;
text-align: center;
width: 200px;
height: 50px;
border: 1px solid rgba(24, 28, 33, 0.06);
border-radius: 0.25rem;
margin-right: 15px;
}
.div-board > h5 {
margin-top: 5px;
margin-bottom: 2px;
}
.div-board:hover {
cursor: pointer;
background-color: rgba(24, 28, 33, 0.06);
}
.div-note { .div-note {
position: absolute !important; position: absolute !important;
float: left; float: left;
} }
.div-note.active{
border-color: blue;
}
.note-content{
overflow: hidden;
max-width: 100%;
max-height: 100%;
}
.note-body{
width: 100%;
height: calc(100% - 15px);
}
.input-hidden { .input-hidden {
display: none; display: none;
} }
.div-pages {
margin: 5px;
height: 50px;
margin-left: 10px;
margin-bottom: 10px;
}
.div-page {
float: left;
text-align: center;
width: 100px;
height: 50px;
border: 1px solid rgba(24, 28, 33, 0.06);
border-radius: 0.25rem;
margin-right: 5px;
}
.div-page:hover {
cursor: pointer;
background-color: rgba(24, 28, 33, 0.06);
}
.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;
}
#lblBoardPageName {
margin-right: 5px;;
}
.div-note-edit-color { .div-note-edit-color {
margin: 5px; margin: 5px;
height: 50px; height: 50px;

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

@@ -0,0 +1,336 @@
$(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({
type: "GET",
url: "/BoardsLinks/Index/?handler=Boards",
data: {
},
success: function (data) {
if (data.successful){
let boardContent = $('.boards-content');
boardContent.empty();
if (data.boards){
data.boards.forEach((board) => {
console.log(board);
boardContent.append(`<div class="div-board">
<h5>${board.name}</h5>
</div>
<div class="div-pages" ondrop="dropPage(event, this)" ondragover="allowDropPage(event, this)" data-idboard="${board.idBulletinBoard}">
</div>
<hr/>`);
if (board.links){
board.links.forEach((link) => {
addPageToBoard(board.idBulletinBoard, link);
});
}
});
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function allowDropPage(ev) {
ev.preventDefault();
// 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",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/BoardsLinks/Index/?handler=AddLink",
data: {
idBoard,
idPage
},
success: function(data) {
if (data.successful){
addPageToBoard(idBoard, data.link);
} 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 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 + '"]');
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" 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

@@ -0,0 +1,307 @@
$(function () {
$('.div-note-edit-color>div').on('click', function(){
$('.div-note-edit-color>div').removeClass('active');
$(this).addClass('active');
});
$(document).on('keyup', function(e){
if (e.originalEvent.key === 'Delete' || e.originalEvent.key === 'Backspace'){
let id = parseInt($('.div-note.active').attr('data-id'));
if (isNaN(id)){
return;
}
deleteNote(id);
}
});
loadPage();
});
let divCanvas;
let canWidth;
let canHeight;
let notes = [];
function addNewNote(){
let idPage = parseInt($('#inpIdPage').val());
if (isNaN(idPage) || idPage <= 0){
Swal.fire('Stran ni izbrana', '', 'warning');
return;
}
let tmpId = -1;
let tmpZindex = 50;
notes.forEach(note => {
if (note.id <= tmpId){
tmpId = note.id -1;
}
if (note.zindex >= tmpZindex){
tmpZindex = note.zindex + 1;
}
});
let note = new Note(tmpId, divCanvas, 0, 0, 400, 240, 'Vnesi besedilo', 'note-color-white', tmpZindex);
notes.push(note);
note.refresh();
}
function noteChangeZindex(id, front){
let note = getNote(id);
let maxIndex = 0;
let minIndex = 999999999999;
notes.forEach(tmpNote => {
if (tmpNote.zindex > maxIndex){
maxIndex = tmpNote.zindex;
}
if (tmpNote.zindex < minIndex){
minIndex = tmpNote.zindex;
}
});
if (front){
//ce je isti ga potem ne premikam
if (note.zindex != maxIndex){
note.zindex = maxIndex + 1;
}
} else {
if (note.zindex != minIndex){
note.zindex = minIndex - 1;
}
}
note.refresh();
}
function deleteNote(id){
let note = getNote(id);
note.element.remove();
let newArray = [];
notes.forEach(tmpNote => {
if (tmpNote.id != note.id){
newArray.push(tmpNote);
}
});
notes = newArray;
}
function openModalEditNote(id){
$('#inpModalEditNoteIdNote').val(id);
note = getNote(id);
$('#divModalEditNote').modal('show');
$('#divModalEditNoteSummernote').summernote('destroy');
$('#divModalEditNoteSummernote').html(note.content);
$('#divModalEditNoteSummernote').summernote({height: 400,});
$('.div-note-edit-color>div').removeClass('active');
$('.div-note-edit-color>.' + note.colorClass).addClass('active');
}
function saveModalEditNote(){
let idNote = parseInt($('#inpModalEditNoteIdNote').val());
note = getNote(idNote);
note.content = $('#divModalEditNoteSummernote').summernote('code');
note.colorClass = $('.div-note-edit-color>.active').attr('class').replace(' active', '');
note.refresh();
$('#divModalEditNote').modal('hide');
}
function getNote(id){
let note;
notes.forEach(e => {
if (e.id === id){
note = e;
}
});
return note;
}
function loadBoard(id){
$.blockUI();
$.ajax({
type: "GET",
url: "/Pages/EditMain/?handler=Board",
data: {
id
},
success: function (data) {
if (data.successful){
$('.div-board>h5').text(data.board.name);
$('.div-board').attr('data-idboard', data.board.idBulletinBoard);
$('[data-idpage]').remove();
if (data.board.pages){
data.board.pages.forEach(element => {
boardAddPage(element);
});
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function loadPage(){
let id = parseInt($('#inpIdPage').val());
$.blockUI();
$.ajax({
type: "GET",
url: "/Pages/EditMain/?handler=Page",
data: {
id
},
success: function (data) {
if (data.successful){
let placeholder = $('#divPlaceholder');
placeholder.empty();
let tmpSplit = data.page.ratioString.split(':');
canWidth = placeholder.width();
canHeight = canWidth / (parseFloat(tmpSplit[0]) / parseFloat(tmpSplit[1]));
divCanvas = $(`<div id='divCanvas'></div>`);
placeholder.append(divCanvas);
divCanvas.css({
'width': '100%',
'height': canHeight + 'px',
'background-color': 'white',
'padding': '5px'
});
notes = [];
$('.div-note').remove();
if (data.page.notes){
data.page.notes.forEach(el => {
let note = new Note(el.idNote, divCanvas, el.x, el.y, el.width, el.height, el.content, el.colorClass, el.zindex);
notes.push(note);
note.refresh();
});
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function saveNotes(){
let idBulletinBoardPage = parseInt($('#inpIdPage').val());
if (isNaN(idBulletinBoardPage) || idBulletinBoardPage <= 0){
Swal.fire('Stran ni izbrana', '', 'warning');
return;
}
//skrijemo okvirje
$('.div-note.active').removeClass('active');
let array = [];
notes.forEach(note => {
array.push({
idNote: note.id,
idBulletinBoardPage,
x: note.x,
y: note.y,
width: note.width,
height: note.height,
content: note.content,
colorClass: note.colorClass,
zindex: note.zindex
})
});
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "EditMain/?handler=Notes",
data: {
idBulletinBoardPage,
notes: array
},
success: function(data) {
if (data.successful){
savePageImage();
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
}
function savePageImage(){
let idPage = parseInt($('#inpIdPage').val());
if (isNaN(idPage) || idPage <= 0){
Swal.fire('Stran ni izbrana', '', 'warning');
return;
}
$.blockUI();
var node = document.getElementById('divCanvas');
htmlToImage.toSvg(node)
.then(function (base64String) {
fetch(base64String)
.then(res => res.blob())
.then(blob => {
let formData = new FormData();
formData.append("file", blob);
formData.append("idPage", idPage);
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/Pages/EditMain/?handler=BoardPageImage",
data: formData,
cache: false,
contentType: false,
processData: false,
success: function(data) {
if (data.successful){
loadPage(idPage);
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
});
})
.catch(function (error) {
$.unblockUI();
console.error('oops, something went wrong!', error);
});
}
function selectNote(id){
$('.div-note.active').removeClass('active');
$('.div-note[data-id="' + id + '"]').addClass('active');
}

View File

@@ -0,0 +1,308 @@
$(function(){
$('#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)){
Swal.fire('Napaka ni id strani!', '', 'error');
return;
}
$.blockUI();
$.ajax({
type: "GET",
url: "/Pages/Index/?handler=Page",
data: {
id: idBulletinBoardPage
},
success: function (data) {
if (data.successful){
$('#inpModalAddEditPageIdPage').val(data.page.idBulletinBoardPage);
$('#inpModalAddEditPageName').val(data.page.name);
$('#selModalAddEditPageRatio').val(data.page.ratio).trigger('change');
$('#selModalAddEditPageType').val(data.page.type).trigger('change');
$('#divModalAddEditPage').modal('show');
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function saveModalAddEditPage(){
let name = $('#inpModalAddEditPageName').val();
let ratio = parseInt($('#selModalAddEditPageRatio').val());
let type = parseInt($('#selModalAddEditPageType').val());
let idBulletinBoardPage = parseInt($('#inpModalAddEditPageIdPage').val());
if (name === ''){
Swal.fire('Ime ni vneseno', '', 'warning');
return;
}
if (isNaN(ratio)){
Swal.fire('Razmerje ni vneseno', '', 'warning');
return;
}
if (isNaN(type)){
Swal.fire('Tip ni vnesen', '', 'warning');
return;
}
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/Pages/Index/?handler=BoardPage",
data: { page : {
idBulletinBoardPage,
name,
ratio,
type
}},
success: function(data) {
if (data.successful){
if (idBulletinBoardPage <= 0){
//Ce je nova dodam in odprem editor
addPageToDiv(data.page);
openEditor(data.page.idBulletinBoardPage);
}
$('#divModalAddEditPage').modal('hide');
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
}
function pageOpenEditor(el){
openEditor(parseInt($(el).parent().parent().attr('data-id')));
}
function openEditor(id){
$.blockUI();
$.ajax({
type: "GET",
url: "/Pages/Index/?handler=Page",
data: {
id
},
success: function (data) {
if (data.successful){
switch (data.page.type){
case 1: //Editor notes
window.location.href = "/Pages/EditMain?idPage=" + data.page.idBulletinBoardPage;
break;
case 2: //Picture
$('#inpModalPageEditorPictureIdPage').val(data.page.idBulletinBoardPage);
$('#imgModalPageEditorPicture').attr("src","/bulletin-board-images/pages/" + data.page.image);
$('#divModalPageEditorPicture').modal('show');
break;
case 3: //Link
$('#inpModalPageEditorLinkIdPage').val(data.page.idBulletinBoardPage);
$('#inpModalPageEditorLinkLink').val(data.page.externalLink);
$('#divModalPageEditorLink').modal('show');
break;
}
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
alert(xhr.responseText);
$.unblockUI();
}
});
}
function saveModalPageEditorLink(){
let link = $('#inpModalPageEditorLinkLink').val();
let idPage = parseInt($('#inpModalPageEditorLinkIdPage').val());
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/Pages/Index/?handler=BoardPageLink",
data: { idPage, link},
success: function(data) {
if (data.successful){
$('#divModalPageEditorLink').modal('hide');
} else {
Swal.fire('Napaka', data.error, 'error');
console.log(data);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
}
function saveModalPageEditorPicture(){
let idPage = parseInt($('#inpModalPageEditorPictureIdPage').val());
let files = $('#inpModalPageEditorPicturePicture').prop("files");
let formData = new FormData();
formData.append("file", files[0]);
formData.append("idPage", idPage);
$.blockUI();
$.ajax({
type: "POST",
beforeSend: function(xhr) {
xhr.setRequestHeader("XSRF-TOKEN",
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "/Pages/Index/?handler=BoardPagePicture",
data: formData,
cache: false,
contentType: false,
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');
$.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);
}
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$.unblockUI();
}
});
}

View File

@@ -0,0 +1,127 @@
class Note{
constructor(id, divCanvas, x, y, width, height, content, colorClass, zindex) {
this.id = id;
this.divCanvas = divCanvas;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.element = null;
this.content = content;
this.colorClass = colorClass;
this.zindex = zindex;
}
refresh(){
if (this.element !== null){
this.element.remove();
}
this.element = $(`
<div class="card div-note ${this.colorClass}" data-id="${this.id}">
<div class="card-body note-body">
<div class='note-content'>
${this.content}
</div>
</div>
</div>`);
this.element.draggable({
containment: "parent",
stop: function( event, ui ) {
let id = parseInt($(this).attr('data-id'));
let note = getNote(id);
note.x = ui.position.left;
note.y = ui.position.top;
}
});
this.element.resizable({
handles: 'se',
autoHide: true,
minHeight: 240,
minWidth: 300,
stop: function( event, ui ) {
let id = parseInt($(this).attr('data-id'));
let note = getNote(id);
note.width = ui.size.width;
note.height = ui.size.height;
}
});
this.element.css({
'width': this.width + 'px',
'height': this.height + 'px',
'position': 'relative',
'z-index': this.zindex
});
this.element.on("dblclick", function() {
openModalEditNote(parseInt($(this).attr('data-id')));
});
this.element.on('mousedown', function(){
selectNote(parseInt($(this).attr('data-id')));
})
$.contextMenu({
selector: '.card[data-id="' + this.id + '"]',
callback: function(key, options) {
let id = parseInt($(this).attr('data-id'));
switch (key){
case 'toFront':
noteChangeZindex(id, true)
break;
case 'toBack':
noteChangeZindex(id, false)
break;
case 'edit':
openModalEditNote(id);
break;
case 'delete':
deleteNote(id);
break;
}
},
items: {
"toFront": {
icon: function(opt, $itemElement, itemKey, item){
$itemElement.html('<i class="fas fa-reply"></i>&nbsp;V odspredje');
return 'context-menu-icon-updated';
}
},
"toBack": {
icon: function(opt, $itemElement, itemKey, item){
$itemElement.html('<i class="fas fa-share"></i>&nbsp;V ozadje');
return 'context-menu-icon-updated';
}
},
"edit": {
icon: function(opt, $itemElement, itemKey, item){
$itemElement.html('<i class="fas fa-edit"></i>&nbsp;Uredi');
return 'context-menu-icon-updated';
}
},
"delete": {
icon: function(opt, $itemElement, itemKey, item){
$itemElement.html('<i class="fas fa-trash-alt"></i>&nbsp;Izbriši');
return 'context-menu-icon-updated';
}
},
}
});
this.divCanvas.append(this.element);
this.setPosition();
}
setPosition(){
this.element.css({
'left': this.x + 'px',
'top': this.y + 'px'
});
}
}

View File

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