diff --git a/docs/NEWS b/docs/NEWS index 316a7fa6..43fa7df5 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -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 diff --git a/include/admin/images.inc.php b/include/admin/images.inc.php index 69d6d730..2095f8a0 100644 --- a/include/admin/images.inc.php +++ b/include/admin/images.inc.php @@ -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(' ' . MEDIA_DIRECTORY_MOVED . '', $nDir); + } else { + $messages[] = sprintf(' ' . MEDIA_DIRECTORY_MOVE_ERROR . '', $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; diff --git a/templates/2k11/admin/media_items.tpl b/templates/2k11/admin/media_items.tpl index 639de444..6ea3049c 100644 --- a/templates/2k11/admin/media_items.tpl +++ b/templates/2k11/admin/media_items.tpl @@ -87,6 +87,7 @@