1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-22 06:13:57 +02:00
This commit is contained in:
Ryan Cramer
2019-10-21 09:04:34 -04:00
parent 8d12cb2340
commit 7d4ca45673
2 changed files with 16 additions and 8 deletions

View File

@@ -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'];

View File

@@ -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'] : '&nbsp;'), (strlen($row['num']) ? $row['num'] : '&nbsp;'),
"<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'));