Overview
Comment:Allow to rename transaction/user files, but not directories
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 5aa42d5233b8c6ead64dec16adec7535b49896c02b8904a43f453a9f3961e9a9
User & Date: bohwaz on 2021-05-04 00:37:09
Other Links: manifest | tags
Context
2021-05-04
00:46
Fix [32de8ad66c] check-in: 7c48b762cc user: bohwaz tags: trunk, stable
00:37
Allow to rename transaction/user files, but not directories check-in: 5aa42d5233 user: bohwaz tags: trunk, stable
00:33
Fix bad copy/paste, plus PHP_INT_MAX should be enough as PHP_FLOAT_MAX is HUGE check-in: 74a1f99457 user: bohwaz tags: trunk, stable
Changes

Modified src/templates/docs/index.tpl from [967173c419] to [cb91864560].

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
						{if $can_write && $file->getEditor()}
							{linkbutton href="!common/files/edit.php?p=%s"|args:$file.path label="Modifier" shape="edit" target="_dialog" data-dialog-height="90%"}
						{/if}
						{if $file->canPreview()}
							{linkbutton href="!common/files/preview.php?p=%s"|args:$file.path label="Voir" shape="eye" target="_dialog" data-mime=$file.mime}
						{/if}
						{linkbutton href=$file->url(true) label="Télécharger" shape="download"}
						{if $can_write && ($context == File::CONTEXT_SKELETON || $context == File::CONTEXT_DOCUMENTS)}
							{linkbutton href="!common/files/rename.php?p=%s"|args:$file.path label="Renommer" shape="minus" target="_dialog"}
						{/if}
						{if $can_delete}
							{linkbutton href="!common/files/delete.php?p=%s"|args:$file.path label="Supprimer" shape="delete" target="_dialog"}
						{/if}
					</td>
				</tr>







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
						{if $can_write && $file->getEditor()}
							{linkbutton href="!common/files/edit.php?p=%s"|args:$file.path label="Modifier" shape="edit" target="_dialog" data-dialog-height="90%"}
						{/if}
						{if $file->canPreview()}
							{linkbutton href="!common/files/preview.php?p=%s"|args:$file.path label="Voir" shape="eye" target="_dialog" data-mime=$file.mime}
						{/if}
						{linkbutton href=$file->url(true) label="Télécharger" shape="download"}
						{if $can_write}
							{linkbutton href="!common/files/rename.php?p=%s"|args:$file.path label="Renommer" shape="minus" target="_dialog"}
						{/if}
						{if $can_delete}
							{linkbutton href="!common/files/delete.php?p=%s"|args:$file.path label="Supprimer" shape="delete" target="_dialog"}
						{/if}
					</td>
				</tr>

Modified src/www/admin/common/files/rename.php from [7b6a31350b] to [c1d61a3f81].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

if (!$file->checkWriteAccess($session)) {
    throw new UserException('Vous n\'avez pas le droit de modifier ce fichier.');
}

$context = $file->context();

if ($context != File::CONTEXT_DOCUMENTS && $context != File::CONTEXT_SKELETON) {
	throw new UserException('Vous n\'avez pas le droit de renommer ce fichier.');
}

$csrf_key = 'file_rename_' . $file->pathHash();

$form->runIf('rename', function () use ($file) {
	$file->changeFileName(f('new_name'));
}, $csrf_key, '!');

$tpl->assign(compact('file', 'csrf_key'));

$tpl->display('common/files/rename.tpl');







<
<
<
<









14
15
16
17
18
19
20




21
22
23
24
25
26
27
28
29

if (!$file->checkWriteAccess($session)) {
    throw new UserException('Vous n\'avez pas le droit de modifier ce fichier.');
}

$context = $file->context();





$csrf_key = 'file_rename_' . $file->pathHash();

$form->runIf('rename', function () use ($file) {
	$file->changeFileName(f('new_name'));
}, $csrf_key, '!');

$tpl->assign(compact('file', 'csrf_key'));

$tpl->display('common/files/rename.tpl');