Overview
Comment:Fix small issues in website management
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 413e36cf76c30425e7c72db3045b932f26162479da0ea633b7cab540522b9123
User & Date: bohwaz on 2023-05-10 22:49:32
Other Links: branch diff | manifest | tags
Context
2023-05-10
22:50
Update Windows binary archive link check-in: 390e4893ea user: bohwaz tags: dev, 1.3.0-alpha1
22:49
Fix small issues in website management check-in: 413e36cf76 user: bohwaz tags: dev
22:32
Merge changes from trunk check-in: dc0ce37d99 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Entities/Web/Page.php from [80f872c7a2] to [304428ee4a].

259
260
261
262
263
264
265

266
267
268

269
270
271
272
273
274
275
	public function selfCheck(): void
	{
		$db = DB::getInstance();
		$this->assert($this->type === self::TYPE_CATEGORY || $this->type === self::TYPE_PAGE, 'Unknown page type');
		$this->assert(array_key_exists($this->status, self::STATUS_LIST), 'Unknown page status');
		$this->assert(array_key_exists($this->format, self::FORMATS_LIST), 'Unknown page format');
		$this->assert(trim($this->title) !== '', 'Le titre ne peut rester vide');

		$this->assert(trim($this->file_path) !== '', 'Le chemin de fichier ne peut rester vide');
		$this->assert(trim($this->path) !== '', 'Le chemin ne peut rester vide');
		$this->assert(trim($this->uri) !== '', 'L\'URI ne peut rester vide');

		$this->assert($this->path !== $this->parent, 'Invalid parent page');
		$this->assert($this->parent === '' || $db->test(self::TABLE, 'path = ?', $this->parent), 'Page parent inexistante');

		$this->assert(!$this->exists() || !$db->test(self::TABLE, 'uri = ? AND id != ?', $this->uri, $this->id()), 'Cette adresse URI est déjà utilisée par une autre page, merci d\'en choisir une autre : ' . $this->uri, self::DUPLICATE_URI_ERROR);
		$this->assert($this->exists() || !$db->test(self::TABLE, 'uri = ?', $this->uri), 'Cette adresse URI est déjà utilisée par une autre page, merci d\'en choisir une autre : ' . $this->uri, self::DUPLICATE_URI_ERROR);
	}








>



>







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
	public function selfCheck(): void
	{
		$db = DB::getInstance();
		$this->assert($this->type === self::TYPE_CATEGORY || $this->type === self::TYPE_PAGE, 'Unknown page type');
		$this->assert(array_key_exists($this->status, self::STATUS_LIST), 'Unknown page status');
		$this->assert(array_key_exists($this->format, self::FORMATS_LIST), 'Unknown page format');
		$this->assert(trim($this->title) !== '', 'Le titre ne peut rester vide');
		$this->assert(mb_strlen($this->title) <= 200, 'Le titre ne peut faire plus de 200 caractères');
		$this->assert(trim($this->file_path) !== '', 'Le chemin de fichier ne peut rester vide');
		$this->assert(trim($this->path) !== '', 'Le chemin ne peut rester vide');
		$this->assert(trim($this->uri) !== '', 'L\'URI ne peut rester vide');
		$this->assert(strlen($this->uri) <= 150, 'L\'URI ne peut faire plus de 150 caractères');
		$this->assert($this->path !== $this->parent, 'Invalid parent page');
		$this->assert($this->parent === '' || $db->test(self::TABLE, 'path = ?', $this->parent), 'Page parent inexistante');

		$this->assert(!$this->exists() || !$db->test(self::TABLE, 'uri = ? AND id != ?', $this->uri, $this->id()), 'Cette adresse URI est déjà utilisée par une autre page, merci d\'en choisir une autre : ' . $this->uri, self::DUPLICATE_URI_ERROR);
		$this->assert($this->exists() || !$db->test(self::TABLE, 'uri = ?', $this->uri), 'Cette adresse URI est déjà utilisée par une autre page, merci d\'en choisir une autre : ' . $this->uri, self::DUPLICATE_URI_ERROR);
	}

Modified src/templates/web/edit.tpl from [1824cf44b7] to [475455c50d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{include file="_head.tpl" title="Édition : %s"|args:$page.title current="web" hide_title=true}

{form_errors}

{if $show_diff}
	<h3>Modifications entre votre version et la nouvelle version</h3>
	{diff old=$new_content new=$current_content}
{/if}

<form method="post" action="{$self_url}" class="web-edit" data-focus="#f_content">
	<fieldset class="header">
		<legend>Modification : {$page.title}</legend>
		<p>{input type="text" name="title" source=$page required=true class="full-width" placeholder="Titre" title="Modifier le titre"}</p>
		<div>
			<dl>{input type="list" name="parent" label="Catégorie" default=$parent target="!web/_selector.php?current=%s&parent=%s"|args:$page.path,$page.parent required=true}</dl>
			<dl>{input type="datetime" name="date" label="Date" required=true default=$page.published}</dl>
			<dl>{input type="select" name="format" required=true options=$formats source=$page label="Format"}</dl>
			<dl>{input type="checkbox" name="status" value=$page::STATUS_DRAFT label="Brouillon" source=$page}</dl>
		</ul>
	</fieldset>












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{include file="_head.tpl" title="Édition : %s"|args:$page.title current="web" hide_title=true}

{form_errors}

{if $show_diff}
	<h3>Modifications entre votre version et la nouvelle version</h3>
	{diff old=$new_content new=$current_content}
{/if}

<form method="post" action="{$self_url}" class="web-edit" data-focus="#f_content">
	<fieldset class="header">
		<legend>Modification : {$page.title}</legend>
		<p>{input type="text" name="title" source=$page required=true class="full-width" placeholder="Titre" title="Modifier le titre" maxlength=200}</p>
		<div>
			<dl>{input type="list" name="parent" label="Catégorie" default=$parent target="!web/_selector.php?current=%s&parent=%s"|args:$page.path,$page.parent required=true}</dl>
			<dl>{input type="datetime" name="date" label="Date" required=true default=$page.published}</dl>
			<dl>{input type="select" name="format" required=true options=$formats source=$page label="Format"}</dl>
			<dl>{input type="checkbox" name="status" value=$page::STATUS_DRAFT label="Brouillon" source=$page}</dl>
		</ul>
	</fieldset>
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

		<p>
			<button name="toggleFullscreen">Plein écran</button>
		</p>
		*}

		<dl>
			{input type="text" label="Identifiant unique de la page" name="uri" default=$page.uri required=true help="Utilisé pour désigner l'adresse de la page sur le site. Ne peut comporter que des lettres, chiffres et tirets." pattern="[A-Za-z0-9_-]+" class="full-width"}
		</dl>
	</fieldset>

	<p class="submit">
		{csrf_field key=$csrf_key}
		<input type="hidden" name="editing_started" value="{$editing_started}" />
		{button type="submit" name="save" label="Enregistrer et fermer" shape="right" class="main"}
	</p>

</form>

{include file="_foot.tpl"}







|












45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

		<p>
			<button name="toggleFullscreen">Plein écran</button>
		</p>
		*}

		<dl>
			{input type="text" label="Identifiant unique de la page" name="uri" default=$page.uri required=true help="Utilisé pour désigner l'adresse de la page sur le site. Ne peut comporter que des lettres, chiffres et tirets." pattern="[A-Za-z0-9_-]+" class="full-width" maxlength=150}
		</dl>
	</fieldset>

	<p class="submit">
		{csrf_field key=$csrf_key}
		<input type="hidden" name="editing_started" value="{$editing_started}" />
		{button type="submit" name="save" label="Enregistrer et fermer" shape="right" class="main"}
	</p>

</form>

{include file="_foot.tpl"}

Modified src/templates/web/index.tpl from [dbfdded4a3] to [035d42a029].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
	</aside>
</nav>

<nav class="web breadcrumbs no-clear">
	<ul>
		<li><a href="?p=">Site web</a></li>
		{foreach from=$breadcrumbs key="id" item="title"}
			<li><a href="?p={$id}">{$title}</a></li>
		{/foreach}
	</ul>
	{if $page}
		<small>{linkbutton href="?p=%s"|args:$page.parent shape="left" label="Retour à la catégorie parent"}</small>
	{/if}
</nav>








|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
	</aside>
</nav>

<nav class="web breadcrumbs no-clear">
	<ul>
		<li><a href="?p=">Site web</a></li>
		{foreach from=$breadcrumbs key="id" item="title"}
			<li><a href="?p={$id}">{$title|truncate:40}</a></li>
		{/foreach}
	</ul>
	{if $page}
		<small>{linkbutton href="?p=%s"|args:$page.parent shape="left" label="Retour à la catégorie parent"}</small>
	{/if}
</nav>

Modified src/www/admin/static/styles/web.css from [0905b89c27] to [b121cea629].

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.web.category-list li {
    display: block;
    width: 32%;
    margin: 0.5%;
}

.web.category-list li a {
    background: rgba(var(--gSecondColor), 0.3);
    padding: 1em;
    border-radius: .5em;
    display: block;
    font-size: 1.1em;
    height: calc(100% - 2em);
    color: rgba(var(--gTextColor), .8);
    text-decoration-color: rgba(var(--gMainColor), 0.5);
}

.web.category-list li a span {
    float: right;
    color: rgba(var(--gMainColor), 0.5);







|
|


|
|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.web.category-list li {
    display: block;
    width: 32%;
    margin: 0.5%;
}

.web.category-list li a {
    background: rgba(var(--gSecondColor), 0.2);
    padding: .7em;
    border-radius: .5em;
    display: block;
    font-size: 1.2em;
    min-height: calc(100% - 1.4em);
    color: rgba(var(--gTextColor), .8);
    text-decoration-color: rgba(var(--gMainColor), 0.5);
}

.web.category-list li a span {
    float: right;
    color: rgba(var(--gMainColor), 0.5);

Modified src/www/admin/web/edit.php from [d1964051a2] to [35a8401907].

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
			die(json_encode(['error' => $e->getMessage()]));
		}

		throw $e;
	}

	if (qg('js') !== null) {
		$url = Utils::getLocalURL('!web/page.php?p=' . $page->path);
		die(json_encode(['success' => true, 'modified' => $page->modified->getTimestamp(), 'redirect' => $url]));
	}

	Utils::redirect('!web/?p=' . $page->path);
}, $csrf_key);

$parent_title = $page->parent ? Web::get($page->parent)->title : 'Racine du site';







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
			die(json_encode(['error' => $e->getMessage()]));
		}

		throw $e;
	}

	if (qg('js') !== null) {
		$url = Utils::getLocalURL('!web/?p=' . $page->path);
		die(json_encode(['success' => true, 'modified' => $page->modified->getTimestamp(), 'redirect' => $url]));
	}

	Utils::redirect('!web/?p=' . $page->path);
}, $csrf_key);

$parent_title = $page->parent ? Web::get($page->parent)->title : 'Racine du site';