Overview
Comment:Add breadcrumbs in documents navigation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 15f857019ae8b046eee1940e7470f77953c031bcd9fc7e6758dca46ad02d8d70
User & Date: bohwaz on 2021-03-04 01:24:41
Other Links: branch diff | manifest | tags
Context
2021-03-04
01:31
Move context button check-in: a7d294f40d user: bohwaz tags: dev, 1.1.0-alpha2
01:24
Add breadcrumbs in documents navigation check-in: 15f857019a user: bohwaz tags: dev
01:09
Fix dialog reload parent frame check-in: dd7855e361 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Files/Files.php from [603c9db512] to [bd9d7f0553].

230
231
232
233
234
235
236
237













	}

	static public function getContextRef(string $path): ?string
	{
		$context = strtok($path, '/');
		return strtok('/') ?: null;
	}
}




















|
>
>
>
>
>
>
>
>
>
>
>
>
>
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	}

	static public function getContextRef(string $path): ?string
	{
		$context = strtok($path, '/');
		return strtok('/') ?: null;
	}

	static public function getBreadcrumbs(string $path): array
	{
		$parts = explode('/', $path);
		$breadcrumbs = [];

		foreach ($parts as $part) {
			$path = trim(key($breadcrumbs) . '/' . $part, '/');
			$breadcrumbs[$path] = $part;
		}

		return $breadcrumbs;
	}
}

Modified src/templates/docs/index.tpl from [0184e992af] to [4a6052dd1c].

22
23
24
25
26
27
28












29
30
31
32
33
34
35
		{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
			<li{if $context == File::CONTEXT_USER} class="current"{/if}><a href="./?p=<?=File::CONTEXT_USER?>">Fichiers des membres</a></li>
		{/if}
		{if $session->canAccess($session::SECTION_WEB, $session::ACCESS_ADMIN)}
			<li{if $context == File::CONTEXT_SKELETON} class="current"{/if}><a href="./?p=<?=File::CONTEXT_SKELETON?>">Squelettes du site web</a></li>
		{/if}
	</ul>












</nav>

{if !$can_mkdir && !$context_ref}
<p class="block alert">
	Il n'est pas possible de créer de répertoire ici.
	{if $context == File::CONTEXT_USER}
		Utiliser le <a href="{"!membres/ajouter.php"|local_url}">formulaire de création</a> pour enregistrer un membre.







>
>
>
>
>
>
>
>
>
>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
		{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
			<li{if $context == File::CONTEXT_USER} class="current"{/if}><a href="./?p=<?=File::CONTEXT_USER?>">Fichiers des membres</a></li>
		{/if}
		{if $session->canAccess($session::SECTION_WEB, $session::ACCESS_ADMIN)}
			<li{if $context == File::CONTEXT_SKELETON} class="current"{/if}><a href="./?p=<?=File::CONTEXT_SKELETON?>">Squelettes du site web</a></li>
		{/if}
	</ul>

</nav>

<nav class="breadcrumbs">
	<ul>
	{foreach from=$breadcrumbs item="name" key="bc_path"}
		<li><a href="?p={$bc_path}">{$name}</a></li>
	{/foreach}
	</ul>
	{if count($breadcrumbs) > 1}
		{linkbutton href="?p=%s"|args:$parent_path label="Retour au répertoire parent" shape="left"}
	{/if}
</nav>

{if !$can_mkdir && !$context_ref}
<p class="block alert">
	Il n'est pas possible de créer de répertoire ici.
	{if $context == File::CONTEXT_USER}
		Utiliser le <a href="{"!membres/ajouter.php"|local_url}">formulaire de création</a> pour enregistrer un membre.

Modified src/templates/web/page.tpl from [649589244d] to [9f5b248254].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		{if $session->canAccess($session::SECTION_WEB, $session::ACCESS_ADMIN)}
			<li><a href="{$admin_url}web/delete.php?id={$page.id}">Supprimer</a></li>
		{/if}
	</ul>
</nav>

{if !empty($breadcrumbs)}
<div class="breadCrumbs">
	<ul>
		{foreach from=$breadcrumbs key="id" item="title"}
			<li><a href="?id={$id}">{$title}</a></li>
		{/foreach}
	</ul>
</div>
{/if}

{if !$page}
	<p class="block error">
		Cette page n'existe pas.
	</p>








|





|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		{if $session->canAccess($session::SECTION_WEB, $session::ACCESS_ADMIN)}
			<li><a href="{$admin_url}web/delete.php?id={$page.id}">Supprimer</a></li>
		{/if}
	</ul>
</nav>

{if !empty($breadcrumbs)}
<nav class="breadcrumbs">
	<ul>
		{foreach from=$breadcrumbs key="id" item="title"}
			<li><a href="?id={$id}">{$title}</a></li>
		{/foreach}
	</ul>
</nav>
{/if}

{if !$page}
	<p class="block error">
		Cette page n'existe pas.
	</p>

Modified src/www/admin/docs/index.php from [5ad36957f0] to [82bacd41c5].

30
31
32
33
34
35
36




37
38
39
$context_ref = Files::getContextRef($path);

$can_create = File::checkCreateAccess($path, $session);
$can_upload = $can_create && (($context == File::CONTEXT_DOCUMENTS || $context == File::CONTEXT_SKELETON)
	|| (($context == File::CONTEXT_USER || $context == File::CONTEXT_TRANSACTION) && $context_ref));
$can_mkdir = $can_create && ($context == File::CONTEXT_DOCUMENTS || $context == File::CONTEXT_SKELETON);





$tpl->assign(compact('path', 'files', 'can_write', 'can_delete', 'can_mkdir', 'can_upload', 'context', 'context_ref'));

$tpl->display('docs/index.tpl');







>
>
>
>
|


30
31
32
33
34
35
36
37
38
39
40
41
42
43
$context_ref = Files::getContextRef($path);

$can_create = File::checkCreateAccess($path, $session);
$can_upload = $can_create && (($context == File::CONTEXT_DOCUMENTS || $context == File::CONTEXT_SKELETON)
	|| (($context == File::CONTEXT_USER || $context == File::CONTEXT_TRANSACTION) && $context_ref));
$can_mkdir = $can_create && ($context == File::CONTEXT_DOCUMENTS || $context == File::CONTEXT_SKELETON);

$breadcrumbs = Files::getBreadcrumbs($path);

$parent_path = dirname($path);

$tpl->assign(compact('path', 'files', 'can_write', 'can_delete', 'can_mkdir', 'can_upload', 'context', 'context_ref', 'breadcrumbs', 'parent_path'));

$tpl->display('docs/index.tpl');

Modified src/www/admin/static/styles/02-common.css from [fed0918522] to [ebfb3f04a6].

418
419
420
421
422
423
424























    margin: .5rem;
}

.files-list aside small {
    display: block;
    color: #666;
}






























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
    margin: .5rem;
}

.files-list aside small {
    display: block;
    color: #666;
}

nav.breadcrumbs {
    margin: .5em;
    color: #999;
}

nav.breadcrumbs a {
    color: #333;
}


nav.breadcrumbs ul, nav.breadcrumbs li {
    list-style-type: none;
    display: inline;
}

nav.breadcrumbs li:before {
    content: "> ";
}

nav.breadcrumbs li:last-child a {
    font-weight: bold;
}

Modified src/www/admin/static/styles/wiki.css from [42c10ca70a] to [457e35542d].

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
}

.web-tree .choice {
    text-align: center;
    margin-bottom: 1em;
}

.breadCrumbs {
    margin-bottom: .8em;
    font-size: .9em;
    color: #999;
}

.breadCrumbs ul, .breadCrumbs li {
    list-style-type: none;
    display: inline;
}

.breadCrumbs li:before {
    content: "> ";
}

.breadCrumbs li a {
    color: #333;
}

.wikiSearch fieldset {
    padding: .3em;
}

.wikiSearch input[type=text] {
    padding: .3em;
}

.wikiResults h3 {
    font-weight: normal;
    margin-bottom: .3em;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







116
117
118
119
120
121
122























123
124
125
126
127
128
129
}

.web-tree .choice {
    text-align: center;
    margin-bottom: 1em;
}
























.wikiSearch input[type=text] {
    padding: .3em;
}

.wikiResults h3 {
    font-weight: normal;
    margin-bottom: .3em;