Compare commits

..

No commits in common. "d24c304c971f6e8d5fe186d3680a655238499da3" and "fba84547438f6bc62a0a5d7fd29de645a8a56764" have entirely different histories.

14 changed files with 36 additions and 368 deletions

Binary file not shown.

View File

@ -1,38 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240622233923 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user ADD COLUMN meta_data CLOB DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__user AS SELECT id, email, roles, password, name FROM user');
$this->addSql('DROP TABLE user');
$this->addSql('CREATE TABLE user (id BLOB NOT NULL --(DC2Type:uuid)
, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO user (id, email, roles, password, name) SELECT id, email, roles, password, name FROM __temp__user');
$this->addSql('DROP TABLE __temp__user');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
}
}

View File

@ -18,7 +18,7 @@ body {
.ref-tab {
width: 60px;
padding-top: 55px !important;
padding-top: 75px !important;
}
.ref-tab ul {

View File

@ -1 +1 @@
body{margin:0}.inner{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;align-items:stretch;align-content:flex-start;max-width:1060px;margin:0 auto}.ref-tab{width:60px;padding-top:55px !important}.ref-tab ul{margin:0;padding:0}.ref-tab ul li{list-style:none;list-style-type:none}.tab{margin-bottom:3px}.tab button{display:flex;justify-content:center;align-items:center;height:80px;width:100%;text-align:center;font-size:14px;margin-bottom:3px}.ref{width:36%}.ref>div#ref{vertical-align:top;justify-content:flex-start;align-content:flex-start;overflow-y:scroll;width:100%;height:100%;border:#000 solid 1px;border-radius:3px;box-shadow:0 2px 5px rgba(0,0,0,.3)}#ref{padding:3px 3px 3px 3px}#passage{width:100px}#newSpeaker{display:none;width:110px}#newSeries{display:none;width:110px}#fields-container{display:none}#fields-container.show{display:block}.notes{width:57%}textarea#notes{width:100%;height:100%;font-size:14pt}#notePreview{display:none;overflow-x:scroll;padding-left:10px}#notePreview ul,#notePreview ol{list-style-position:inside}#previewBtn.active,#show-hide-btn.active,.tab button.active,#openRefBtn.active{background-color:#f56a6a !important;color:#fff !important}#note-header-left{display:inline-flex;flex-direction:row;width:25%}#note-header-right{display:inline-flex;flex-direction:row-reverse;width:74%}#note-header-left h2.dirty{color:#ff8c00}#note-list{display:none;height:100%;overflow-y:scroll}#note-list ul{margin:0;padding:0;list-style-type:none;list-style:none}div#refQuery{display:none;position:absolute;z-index:100;background-color:rgba(0,0,0,.8);width:400px;height:200px}div#refQuery #referenceSearch{border:none;border-radius:5px;padding:10px 20px;font-size:16px;line-height:1.5;color:#333;background-color:#f4f4f4;width:150px;height:25px;cursor:pointer;display:none}#passage-popup{display:none;position:absolute;z-index:100;background-color:#fff;color:#000;padding:10px;border:1px solid #ccc;border-radius:5px;box-shadow:0 2px 5px rgba(0,0,0,.3);width:300px;height:300px;overflow-x:scroll}#save-check{opacity:0;text-align:right;font-size:20pt;margin-left:15px;color:green}#save-check.saving{color:orange}#save-check.error{color:red}#fields-container input,#fields-container select{width:32.5%;display:inline-block}#old-notes article p:first-child{margin-bottom:0 !important;font-size:10pt}#old-notes article a{font-size:12pt}#old-notes article p:last-child{font-size:12pt}.inner{padding-left:0}.ref h2{display:inline-block}#ref{font-size:12pt}#ref ol,#ref ul{list-style-position:inside}#referenceBook{display:none}.recording-link{font-size:8pt;color:blue;text-decoration:none}/*# sourceMappingURL=style.min.css.map */
body{margin:0}.inner{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;align-items:stretch;align-content:flex-start;max-width:1060px;margin:0 auto}.ref-tab{width:60px;padding-top:75px !important}.ref-tab ul{margin:0;padding:0}.ref-tab ul li{list-style:none;list-style-type:none}.tab{margin-bottom:3px}.tab button{display:flex;justify-content:center;align-items:center;height:80px;width:100%;text-align:center;font-size:14px;margin-bottom:3px}.ref{width:36%}.ref>div#ref{vertical-align:top;justify-content:flex-start;align-content:flex-start;overflow-y:scroll;width:100%;height:100%;border:#000 solid 1px;border-radius:3px;box-shadow:0 2px 5px rgba(0,0,0,.3)}#ref{padding:3px 3px 3px 3px}#passage{width:100px}#newSpeaker{display:none;width:110px}#newSeries{display:none;width:110px}#fields-container{display:none}#fields-container.show{display:block}.notes{width:57%}textarea#notes{width:100%;height:100%;font-size:14pt}#notePreview{display:none;overflow-x:scroll;padding-left:10px}#notePreview ul,#notePreview ol{list-style-position:inside}#previewBtn.active,#show-hide-btn.active,.tab button.active,#openRefBtn.active{background-color:#f56a6a !important;color:#fff !important}#note-header-left{display:inline-flex;flex-direction:row;width:25%}#note-header-right{display:inline-flex;flex-direction:row-reverse;width:74%}#note-header-left h2.dirty{color:#ff8c00}#note-list{display:none;height:100%;overflow-y:scroll}#note-list ul{margin:0;padding:0;list-style-type:none;list-style:none}div#refQuery{display:none;position:absolute;z-index:100;background-color:rgba(0,0,0,.8);width:400px;height:200px}div#refQuery #referenceSearch{border:none;border-radius:5px;padding:10px 20px;font-size:16px;line-height:1.5;color:#333;background-color:#f4f4f4;width:150px;height:25px;cursor:pointer;display:none}#passage-popup{display:none;position:absolute;z-index:100;background-color:#fff;color:#000;padding:10px;border:1px solid #ccc;border-radius:5px;box-shadow:0 2px 5px rgba(0,0,0,.3);width:300px;height:300px;overflow-x:scroll}#save-check{opacity:0;text-align:right;font-size:20pt;margin-left:15px;color:green}#save-check.saving{color:orange}#save-check.error{color:red}#fields-container input,#fields-container select{width:32.5%;display:inline-block}#old-notes article p:first-child{margin-bottom:0 !important;font-size:10pt}#old-notes article a{font-size:12pt}#old-notes article p:last-child{font-size:12pt}.inner{padding-left:0}.ref h2{display:inline-block}#ref{font-size:12pt}#ref ol,#ref ul{list-style-position:inside}#referenceBook{display:none}.recording-link{font-size:8pt;color:blue;text-decoration:none}/*# sourceMappingURL=style.min.css.map */

View File

@ -19,7 +19,7 @@ body {
.ref-tab {
width: 60px;
padding-top: 55px !important;
padding-top: 75px !important;
}
.ref-tab ul {

View File

@ -4,9 +4,11 @@ var references = {};
var tabs = [];
let saved = false;
let textDirty = false;
let saveTimeout = 15000;
var to = null;
let controller;
var BOOKS = {};
let saveFailCounter = 0;
$(function () {
setHeight();
@ -103,7 +105,7 @@ function setHeight() {
});
}
if (!to) {
to = setTimeout(saveNote, saveInterval);
to = setTimeout(saveNote, saveTimeout);
}
}
@ -179,7 +181,7 @@ function saveNote(event) {
if (!textDirty || !validateNote()) {
clearTimeout(to);
to = setTimeout(saveNote, saveInterval);
to = setTimeout(saveNote, saveTimeout);
return;
}
@ -205,12 +207,11 @@ function saveNote(event) {
contentType: 'application/json',
data: JSON.stringify(note),
dataType: 'json',
timeout: saveTimeout
timeout: 5000
})
.done(function (data) {
if (data.msg == 'saved' && !saved) {
saveFailureCount = SAVE_FAILURE_LIMIT;
saveCheck.classList.remove('saving', 'error', 'fa-times-circle', 'fa-save');
saveCheck.classList.remove('saving', 'error', 'fa-times', 'fa-check');
showSave();
if (noteText == document.querySelector('#notes').value) {
saved = true;
@ -224,21 +225,21 @@ function saveNote(event) {
}
})
.fail(function (xhr, status, error) {
saveFailureCount--;
saveCheck.classList.remove('saving', 'fa-save');
saveCheck.classList.add('fa-times-circle', 'error');
saveFailCounter++;
saveCheck.classList.remove('saving', 'fa-check');
saveCheck.classList.add('fa-times', 'error');
console.error(error);
})
.always(function (xhr, status) {
if (status == 'timeout') {
saveCheck.classList.remove('saving', 'fa-save');
saveCheck.classList.add('error', 'fa-times-circle');
saveCheck.classList.remove('saving', 'fa-check');
saveCheck.classList.add('error', 'fa-times');
}
clearTimeout(to);
if (saveFailureCount > 0) {
to = setTimeout(saveNote, saveInterval);
if (saveFailCounter < 5) {
to = setTimeout(saveNote, saveTimeout);
} else {
saveFailureCount = SAVE_FAILURE_LIMIT;
saveFailCounter = 0;
}
});
}
@ -267,8 +268,8 @@ function isUuidValid(uuid) {
}
function startSave() {
document.querySelector('#save-check').classList.remove('error', 'fa-times-circle', 'fa-save');
document.querySelector('#save-check').classList.add('saving', 'fa-save');
document.querySelector('#save-check').classList.remove('error', 'fa-times', 'fa-check');
document.querySelector('#save-check').classList.add('saving', 'fa-check');
document.querySelector('#save-check').style.opacity = 1;
}
@ -282,7 +283,7 @@ function showSave() {
if (saved) { return; }
var checkmark = document.getElementById("save-check");
checkmark.classList.add('fa-save');
checkmark.classList.add('fa-check');
// Schedule the animation to run every 1 second (which is equivalent to a 1-second delay between each iteration)
var si = setInterval(function () {

File diff suppressed because one or more lines are too long

View File

@ -3227,9 +3227,9 @@ button:disabled,
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
border: 0;
display: block;
height: 4.5em;
height: 7.5em;
left: 26em;
line-height: 4.5em;
line-height: 7.5em;
outline: 0;
overflow: hidden;
position: absolute;
@ -3287,13 +3287,11 @@ button:disabled,
}
#sidebar .toggle {
height: 4.5em;
height: 6.25em;
left: 24em;
line-height: 4.5em;
line-height: 6.25em;
text-indent: 5em;
width: 5em;
background-color: #fff;
margin-left: 1em;
}
#sidebar .toggle:before {
@ -3338,7 +3336,7 @@ button:disabled,
#sidebar .toggle {
text-indent: 6em;
width: 4.5em;
width: 6em;
}
#sidebar .toggle:before {

View File

@ -387,52 +387,4 @@ class AjaxController extends AbstractController
return $res;
}
#[Route('/save-settings', name: 'app_save_settings', methods: ['POST'])]
public function saveSettings(Request $req, EntityManagerInterface $emi): Response
{
$data = json_decode($req->getContent());
/** @var User $user */
$user = $this->getUser();
if (!$user) {
return new Response(json_encode([
'msg' => 'No User'
]));
}
if (!$data->saveInterval) {
$data->saveInterval = 15;
}
if (!$data->saveReferences) {
$data->saveReferences = true;
}
if (!$data->noteTextSize) {
$data->noteTextSize = 12;
}
if (!$data->trackSaveSize) {
$data->trackSaveSize = false;
}
$meta = $user->getMetaData();
$meta['saveInterval'] = $data->saveInterval;
$meta['saveReferences'] = $data->saveReferences;
$meta['noteTextSize'] = $data->noteTextSize;
$meta['trackSaveSize'] = $data->trackSaveSize;
$meta['saveTimeout'] = $data->saveTimeout;
$meta['save-failure-count'] = $data->saveFailureCount;
$user->setMetaData($meta);
$emi->persist($user);
$emi->flush();
$res = new Response();
$res->setContent(json_encode([
'msg' => 'Settings Saved'
]));
return $res;
}
}

View File

@ -3,6 +3,7 @@
namespace App\Controller;
use App\Entity\Note;
use App\Entity\Reference;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -10,6 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use Symfony\Component\Uid\Uuid;
class DefaultController extends AbstractController
{
@ -28,13 +30,11 @@ class DefaultController extends AbstractController
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
$last4Notes = $emi->getRepository(Note::class)->getLast4Notes($user);
$openNotes = $emi->getRepository(Note::class)->reverseNoteSort($user);
$meta = $user->getMetaData();
return $this->render('default/home.html.twig', [
'last4Notes' => $last4Notes,
'reverseNoteSort' => $openNotes,
'isAdmin' => $this->isGranted('ROLE_ADMIN'),
'meta' => $meta,
]);
}
@ -44,31 +44,6 @@ class DefaultController extends AbstractController
return $this->render('default/cheat-sheet.html.twig');
}
#[Route('/profile', name: 'app_profile')]
public function profile(): Response
{
/** @var User $user */
$user = $this->getUser();
$meta = $user->getMetaData();
if (!$meta) {
$meta = [
'saveInterval' => 15,
'saveReferences' => 'checked',
'noteTextSize' => 12,
'trackSaveSize' => null,
'saveFailureCount' => 3,
'saveTimeout' => 5,
];
} else {
$meta['saveReferences'] = $meta['saveReferences'] ? 'checked' : null;
$meta['trackSaveSize'] = $meta['trackSaveSize'] ? 'checked' : null;
}
return $this->render('default/profile.html.twig', [
'meta' => $meta,
]);
}
#[Route('/reference-editor', name: 'app_reference_editor')]
public function referenceEditor(EntityManagerInterface $emi): Response
{

View File

@ -68,22 +68,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, JsonSer
#[ORM\OneToMany(targetEntity: Note::class, mappedBy: 'user')]
private Collection $notes;
/**
* @var Collection<int, NoteShares>
*/
#[ORM\OneToMany(targetEntity: NoteShares::class, mappedBy: 'ownerId', orphanRemoval: true)]
private Collection $noteShares;
#[ORM\Column(nullable: true)]
private ?array $metaData = null;
public function __construct()
{
$this->series = new ArrayCollection();
$this->speakers = new ArrayCollection();
$this->templates = new ArrayCollection();
$this->notes = new ArrayCollection();
$this->noteShares = new ArrayCollection();
}
public function getId(): ?Uuid
@ -91,11 +81,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, JsonSer
return $this->id;
}
public function getHexId(): string
{
return $this->id->toHex();
}
public function setId(?Uuid $id): static
{
$this->id = $id;
@ -318,46 +303,4 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, JsonSer
'name' => $this->name,
];
}
/**
* @return Collection<int, NoteShares>
*/
public function getNoteShares(): Collection
{
return $this->noteShares;
}
public function addNoteShare(NoteShares $noteShare): static
{
if (!$this->noteShares->contains($noteShare)) {
$this->noteShares->add($noteShare);
$noteShare->setOwner($this);
}
return $this;
}
public function removeNoteShare(NoteShares $noteShare): static
{
if ($this->noteShares->removeElement($noteShare)) {
// set the owning side to null (unless already changed)
if ($noteShare->getOwner() === $this) {
$noteShare->setOwner(null);
}
}
return $this;
}
public function getMetaData(): ?array
{
return $this->metaData;
}
public function setMetaData(?array $metaData): static
{
$this->metaData = $metaData;
return $this;
}
}

View File

@ -8,12 +8,6 @@
<link href='/theme/assets/css/jquery-ui.structure.css' rel='stylesheet' />
<link href='/css/style.css' rel='stylesheet' />
<link href='//cdn.datatables.net/2.0.8/css/dataTables.dataTables.min.css' rel='stylesheet' />
<style>
#notes,
#notePreview {
font-size: {{ meta.noteTextSize }}pt;
}
</style>
{% endblock %}
{% block javascripts %}
@ -26,12 +20,6 @@
<script src='//momentjs.com/downloads/moment-with-locales.js'></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.2/markdown-it.min.js" integrity="sha512-ohlWmsCxOu0bph1om5eDL0jm/83eH09fvqLDhiEdiqfDeJbEvz4FSbeY0gLJSVJwQAp0laRhTXbUQG+ZUuifUQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src='//cdn.datatables.net/2.0.8/js/dataTables.min.js'></script>
<script>
let saveInterval = ({{ meta.saveInterval }} * 1000);
let saveTimeout = ({{ meta.saveTimeout }} * 1000);
const SAVE_FAILURE_LIMIT = {{ meta.saveFailureCount }};
let saveFailureCount = {{ meta.saveFailureCount }};
</script>
<script src='/js/script.js'></script>
{% endblock %}
@ -62,6 +50,11 @@ let saveFailureCount = {{ meta.saveFailureCount }};
<th>Date</th>
</tr>
</thead>
{#<tbody>
{% for n in reverseNoteSort %}
{{ n.toTableRow()|raw }}
{% endfor %}
</tbody>#}
</table>
</div>
</section>
@ -69,10 +62,10 @@ let saveFailureCount = {{ meta.saveFailureCount }};
<section class="notes">
<div id='note-header-left'>
<h2>Notes</h2>
<i id='save-check' class='fa fa-save'></i>
<i id='save-check' class='fa fa-check'></i>
</div>
<div id='note-header-right'>
<select id='template' onchange="retrieveTemplate('template','notes')" style='width:200px;'>
<select id='template' onchange="retrieveTemplate('template','notes')">
<option value=0>-- Template --</option>
{% for t in app.user.templates %}
<option value="{{ t.id }}">{{ t.name }}</option>

View File

@ -1,156 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Profile | Sermon Notes{% endblock %}
{% block stylesheets %}
<link href="/theme/assets/css/main.css" rel="stylesheet" />
<link href='/theme/assets/css/jquery-ui.theme.css' rel='stylesheet' />
<link href='/theme/assets/css/jquery-ui.structure.css' rel='stylesheet' />
<link href='/css/style.css' rel='stylesheet' />
<link href='//cdn.datatables.net/2.0.8/css/dataTables.dataTables.min.css' rel='stylesheet' />
<style>
.flex-container {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: normal;
align-items: normal;
align-content: normal;
}
.user-flex {
display: block;
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
align-self: auto;
order: 0;
border: solid 1px black;
}
.settings-flex {
display: block;
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto;
align-self: auto;
order: 0;
}
.notes-flex {
display: block;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
align-self: auto;
order: 0;
}
label,
input[type="number"],
input[type="email"],
input[type="text"] {
display: inline !important;
}
input[type="checkbox"] {
appearance: auto;
opacity: 1;
margin: 0;
width: 20px;
height: 20px;
}
</style>
{% endblock %}
{% block javascripts %}
<script src="/theme/assets/js/jquery.min.js"></script>
<script src='/theme/assets/js/jquery-ui.js'></script>
<script src="/theme/assets/js/browser.min.js"></script>
<script src="/theme/assets/js/breakpoints.min.js"></script>
<script src="/theme/assets/js/util.js"></script>
<script src="/theme/assets/js/main.js"></script>
<script src='//momentjs.com/downloads/moment-with-locales.js'></script>
<script src='//cdn.datatables.net/2.0.8/js/dataTables.min.js'></script>
<script type='text/javascript'>
$(function() {
});
function saveSettings() {
var saveInterval = $('#save-interval');
var saveReferences = $('#save-references');
var noteTextSize = $('#note-text-size');
var trackSaveSize = $('#track-save-size');
var saveTimeout = $('#save-timeout');
var saveFailureCount = $('#save-failure-count');
fetch('/index.php/save-settings', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'saveInterval': saveInterval.val(),
'saveReferences': saveReferences.is(':checked'),
'noteTextSize': noteTextSize.val(),
'trackSaveSize': trackSaveSize.is(':checked'),
'saveTimeout': saveTimeout.val(),
'saveFailureCount': saveFailureCount.val()
})
})
.then(response => response.json())
.then(results => {
alert(results.msg);
});
}
</script>
{% endblock %}
{% block body %}
<div class="flex-container">
<div class="user-flex">
<label for='name'>Name: </label>
<input type='text' id='name' name='name' value='{{ app.user.name }}' /><br />
<label for='email'>Email: </label>
<input type='email' id='email' name='email' value='{{ app.user.email }}' /><br />
<label for='password'>Password: </label>
<input type='password' id='password' name='password' /><br/>
<label for='new-password'>New Password: </label>
<input type='password' id='new-password' name='new-password' /><br />
<label for='conf-password'>Confirm Password: </label>
<input type='password' id='conf-password' name='conf-password' /><br />
</div>
<div class="settings-flex">
<label for='save-interval'>Save Interval (seconds)?</label>
<input type='number' id='save-interval' value='{{ meta.saveInterval }}' title='What is the interval to trigger an autosave, in seconds?' /><br/>
<label for='save-references'>Save References?</label>
<input type='checkbox' id='save-references' {{ meta.saveReferences }} title='Do you want to also save reference content' /><br />
<label for='note-text-size'>Note Text Size? (points)</label>
<input type='number' id='note-text-size' value='{{ meta.noteTextSize }}' title='Font size of the note preview, in points' /><br />
<label for='track-save-size'>Track Save Size?</label>
<input type='checkbox' id='track-save-size' {{ meta.noteTextSize }} title='Do you want to track the size of saves, useful if teathering to mobile device?' /><br />
<label for='save-timeout'>Save Timeout? (seconds)</label>
<input type='number' id='save-timeout' value='{{ meta.saveTimeout }}' title='How long does it wait to before cancelling the save and trying again later?' /><br />
<label for='save-failure-count'>Save Failure Count? </label>
<input type='number' id='save-failure-count' value='{{ meta.saveFailureCount }}' title='How many times do you want to attempt to auto save before it stops and waits for a manual attempt' /><br />
<button id='save-settings' onclick='saveSettings()'>Save Settings</button>
<button id='back' onclick='history.go(-1)'>Back</button>
</div>
<div class="notes-fles">
<table id='notes'>
<thead>
</table>
</div>
</div>
{% endblock %}

View File

@ -13,7 +13,7 @@
<nav id="menu">
<header class="major">
{% if app.user %}
<h3>Welcome <a href='/index.php/profile' style='text-decoration:underline;'>{{ app.user.name }}</a></h3>
<h3>Welcome {{ app.user.name }}</h3>
<a href='/index.php/logout'>Logout</a>
{% endif %}
</header>