Allow bulk image MOVE in ML

and give a path information note to the image info layer

References #357
This commit is contained in:
Ian 2015-08-26 12:22:17 +02:00
parent a3c567e864
commit 300bdd6f5f
4 changed files with 40 additions and 0 deletions

View File

@ -1,6 +1,8 @@
Version 2.1 ()
------------------------------------------------------------------------
* Added new bulk image move ability to MediaLibrary
* Fix importers to use the new mysqli API extension with PHP 5+
* WIP: Added an internal cache to speedup s9y's site generation. Can

View File

@ -112,6 +112,32 @@ switch ($serendipity['GET']['adminAction']) {
break;
}
// case bulk multimove (leave the fake oldDir being send as an empty dir)
if (isset($serendipity['POST']['oldDir']) && !empty($serendipity['POST']['newDir'])) {
$messages = array();
$multiMoveImages = $serendipity['POST']['multiDelete'];
unset($serendipity['POST']['multiDelete']);
$oDir = ''; // oldDir is relative to Uploads/, since we can not specify a directory of a ML bulk move
$nDir = (string)serendipity_specialchars($serendipity['POST']['newDir']);
if ($oDir != $nDir) {
foreach($multiMoveImages AS $mkey => $move_id) {
$file = serendipity_fetchImageFromDatabase((int)$move_id);
$oDir = $file['path']; // this now is the exact oldDir path of this ID
if (serendipity_moveMediaDirectory($oDir, $nDir, 'file', (int)$move_id, $file)) {
$messages[] = sprintf('<span class="msg_success"><span class="icon-ok-circled"></span> ' . MEDIA_DIRECTORY_MOVED . '</span>', $nDir);
} else {
$messages[] = sprintf('<span class="msg_error"><span class="icon-attention-circled"></span> ' . MEDIA_DIRECTORY_MOVE_ERROR . '</span>', $nDir);
}
}
}
$data['messages'] = $messages;
// fall back
$data['case_default'] = true;
$data['showML'] = showMediaLibrary();
unset($messages);
break;
}
$ids = '';
$data['rip_image'] = array();
$data['case_multidelete'] = true;

View File

@ -87,6 +87,7 @@
<li><b>{$CONST.THUMBNAIL_SHORT}:</b> {$file.dim.0}x{$file.dim.1}</li>
{/if}
<li><b>{$CONST.IMAGE_SIZE}:</b> {$file.nice_size} KB</li>
<li><b>{$CONST.INSTALL_RELUPLOADPATH}:</b> "{$file.path}"</li>
{/if}
</ul>
</footer>

View File

@ -178,6 +178,17 @@
<div class="form_buttons">
<input class="invert_selection" name="toggle" type="button" value="{$CONST.INVERT_SELECTIONS}">
<input class="state_cancel" name="toggle" type="submit" value="{$CONST.DELETE}">
<div class="form_select">
<label for="newDir">{$CONST.FILTER_DIRECTORY}</label>
<input type="hidden" name="serendipity[oldDir]" value="">
<select id="newDir" name="serendipity[newDir]">
<option value=""></option>
{foreach from=$media.paths item="folder"}
<option{if ($media.only_path == $media.limit_path|cat:$folder.relpath)} selected{/if} value="{$folder.relpath}">{'&nbsp;'|str_repeat:($folder.depth*2)}{$folder.name}</option>
{/foreach}
</select>
<input class="state_submit" name="toggle" type="submit" value="{$CONST.MOVE}">
</div>
</div>
</form>
{/if}