mirror of
https://github.com/processwire/processwire.git
synced 2025-08-22 06:13:57 +02:00
Fix issue processwire/processwire-issues#1000
This commit is contained in:
@@ -782,7 +782,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
if($n) {} // ignore, $n is for hooks
|
if($n) {} // ignore, $n is for hooks
|
||||||
$pageID = $pagefile->pagefiles->page->id;
|
$pageID = $pagefile->pagefiles->page->id;
|
||||||
$variationCount = $pagefile->variations()->count();
|
$variationCount = $pagefile->variations()->count();
|
||||||
if($pagefile->webp()->exists()) $variationCount++;
|
// if($pagefile->webp()->exists()) $variationCount++;
|
||||||
$editUrl = $this->getEditUrl($pagefile, $pageID);
|
$editUrl = $this->getEditUrl($pagefile, $pageID);
|
||||||
$variationUrl = $this->getVariationUrl($pagefile, $id);
|
$variationUrl = $this->getVariationUrl($pagefile, $id);
|
||||||
$buttonClass = $this->themeSettings['buttonClass'];
|
$buttonClass = $this->themeSettings['buttonClass'];
|
||||||
|
@@ -1375,7 +1375,8 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
if(!$this->page || !$pageimage) throw new WireException("No file provided");
|
if(!$this->page || !$pageimage) throw new WireException("No file provided");
|
||||||
if(!$this->masterPage->editable()) throw new WireException($this->labels['noAccess']);
|
if(!$this->masterPage->editable()) throw new WireException($this->labels['noAccess']);
|
||||||
|
|
||||||
$cnt = 0;
|
$cnt = 0; // for id purposes
|
||||||
|
$num = 0; // for display purposes
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$name = $pageimage->basename();
|
$name = $pageimage->basename();
|
||||||
$filesize = $pageimage->filesize();
|
$filesize = $pageimage->filesize();
|
||||||
@@ -1384,6 +1385,7 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
$modified = date('Y-m-d H:i:s', $mtime);
|
$modified = date('Y-m-d H:i:s', $mtime);
|
||||||
$url = $pageimage->url() . "?nc=$mtime";
|
$url = $pageimage->url() . "?nc=$mtime";
|
||||||
$originalLabel = $this->_('Original');
|
$originalLabel = $this->_('Original');
|
||||||
|
$extraLabel = $this->_('%s of above');
|
||||||
$hasEditPermission = $this->wire('user')->hasPermission('page-edit-images', $this->masterPage);
|
$hasEditPermission = $this->wire('user')->hasPermission('page-edit-images', $this->masterPage);
|
||||||
$variations = $pageimage->getVariations(array('info' => true, 'verbose' => 1));
|
$variations = $pageimage->getVariations(array('info' => true, 'verbose' => 1));
|
||||||
$adminThumbOptions = $this->wire('config')->adminThumbOptions;
|
$adminThumbOptions = $this->wire('config')->adminThumbOptions;
|
||||||
@@ -1404,6 +1406,7 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
'cnt' => $cnt,
|
'cnt' => $cnt,
|
||||||
|
'num' => $num,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'notes' => array($originalLabel),
|
'notes' => array($originalLabel),
|
||||||
@@ -1423,11 +1426,13 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
$mtime = filemtime($extra->filename);
|
$mtime = filemtime($extra->filename);
|
||||||
$modified = date('Y-m-d H:i:s', $mtime);
|
$modified = date('Y-m-d H:i:s', $mtime);
|
||||||
$url = $extra->url() . "?nc=$mtime";
|
$url = $extra->url() . "?nc=$mtime";
|
||||||
|
$ext = strtoupper($extra->ext);
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
'cnt' => ++$cnt,
|
'cnt' => ++$cnt,
|
||||||
|
'num' => "$num <span class='detail'>$ext</span>",
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'notes' => array("$originalLabel ($extra->ext $extra->savingsPct)"),
|
'notes' => array(sprintf($extraLabel, $ext) . " ($extra->savingsPct)"),
|
||||||
'width' => $pageimage->width(),
|
'width' => $pageimage->width(),
|
||||||
'height' => $pageimage->height(),
|
'height' => $pageimage->height(),
|
||||||
'modified' => $modified,
|
'modified' => $modified,
|
||||||
@@ -1473,6 +1478,7 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
'cnt' => ++$cnt,
|
'cnt' => ++$cnt,
|
||||||
|
'num' => ++$num,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'notes' => $notes,
|
'notes' => $notes,
|
||||||
@@ -1494,12 +1500,14 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
$mtime = filemtime($extra->filename());
|
$mtime = filemtime($extra->filename());
|
||||||
$modified = date('Y-m-d H:i:s', $mtime);
|
$modified = date('Y-m-d H:i:s', $mtime);
|
||||||
$url = $extra->url() . "?nc=$mtime";
|
$url = $extra->url() . "?nc=$mtime";
|
||||||
|
$ext = strtoupper($extra->ext);
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
'cnt' => ++$cnt,
|
'cnt' => ++$cnt,
|
||||||
|
'num' => "$num <span class='detail'>$ext</span>",
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'notes' => $notes,
|
'notes' => array(sprintf($extraLabel, $ext) . " ($extra->savingsPct)"),
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'modified' => $modified,
|
'modified' => $modified,
|
||||||
@@ -1535,7 +1543,7 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
$checkbox->val($row['name']);
|
$checkbox->val($row['name']);
|
||||||
$checkbox->attr('id', "delete_$row[cnt]");
|
$checkbox->attr('id', "delete_$row[cnt]");
|
||||||
$table->row(array(
|
$table->row(array(
|
||||||
($row['cnt'] ? $row['cnt'] : ' '),
|
(strlen($row['num']) ? $row['num'] : ' '),
|
||||||
"<a class='preview' href='$row[url]'><img src='$row[url]' alt='$row[name]' style='max-width: 100px;' /></a>",
|
"<a class='preview' href='$row[url]'><img src='$row[url]' alt='$row[name]' style='max-width: 100px;' /></a>",
|
||||||
"<a class='preview' href='$row[url]'>$row[name]</a><br /><span class='detail'>$row[width]x$row[height]</span>",
|
"<a class='preview' href='$row[url]'>$row[name]</a><br /><span class='detail'>$row[width]x$row[height]</span>",
|
||||||
"<span style='display: none;'>$row[filesize]</span>$row[filesizeStr]",
|
"<span style='display: none;'>$row[filesize]</span>$row[filesizeStr]",
|
||||||
@@ -1547,8 +1555,8 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->headline(sprintf(
|
$this->headline(sprintf(
|
||||||
$this->_n('%1$d variation for image %2$s', '%1$d variations for image %2$s', $cnt),
|
$this->_n('%1$d variation for image %2$s', '%1$d variations for image %2$s', $num),
|
||||||
$cnt, $pageimage->basename
|
$num, $pageimage->basename
|
||||||
));
|
));
|
||||||
|
|
||||||
$varcnt = $this->wire('sanitizer')->entities($this->wire('input')->get('varcnt'));
|
$varcnt = $this->wire('sanitizer')->entities($this->wire('input')->get('varcnt'));
|
||||||
|
Reference in New Issue
Block a user