1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

A few updates in support of new AdminThemeFramework and bump version to 3.0.57

This commit is contained in:
Ryan Cramer
2017-03-24 13:23:36 -04:00
parent 722b504273
commit ec4726b3df
7 changed files with 45 additions and 21 deletions

View File

@@ -1003,6 +1003,7 @@ $config->pageList = array(
* #property bool confirm Notify user if they attempt to navigate away from unsaved changes? * #property bool confirm Notify user if they attempt to navigate away from unsaved changes?
* #property bool ajaxChildren Whether to load the 'children' tab via ajax * #property bool ajaxChildren Whether to load the 'children' tab via ajax
* #property bool ajaxParent Whether to load the 'parent' field via ajax * #property bool ajaxParent Whether to load the 'parent' field via ajax
* #property bool editCrumbs Whether or not breadcrumbs load page editor (false=load page list).
* *
* @var array * @var array
* *
@@ -1012,6 +1013,7 @@ $config->pageEdit = array(
'confirm' => true, 'confirm' => true,
'ajaxChildren' => true, 'ajaxChildren' => true,
'ajaxParent' => true, 'ajaxParent' => true,
'editCrumbs' => false,
); );
@@ -1194,6 +1196,12 @@ $config->https = null;
*/ */
$config->ajax = false; $config->ajax = false;
/**
* modal: This is automatically set to TRUE when request is in a modal window.
*
*/
$config->modal = false;
/** /**
* external: This is automatically set to TRUE when PW is externally bootstrapped. * external: This is automatically set to TRUE when PW is externally bootstrapped.
* *

View File

@@ -61,7 +61,6 @@ abstract class AdminThemeFramework extends AdminTheme {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->set('useAsLogin', false); $this->set('useAsLogin', false);
$this->wire('modules')->get('JqueryUI')->use('panel');
$this->sanitizer = $this->wire('sanitizer'); $this->sanitizer = $this->wire('sanitizer');
} }

View File

@@ -17,6 +17,7 @@
* @see /wire/config.php for more detailed descriptions of all config properties. * @see /wire/config.php for more detailed descriptions of all config properties.
* *
* @property bool $ajax If the current request is an ajax (asynchronous javascript) request, this is set to true. #pw-group-runtime * @property bool $ajax If the current request is an ajax (asynchronous javascript) request, this is set to true. #pw-group-runtime
* @property bool|int $modal If the current request is in a modal window, this is set to a positive number. False if not. #pw-group-runtime
* @property string $httpHost Current HTTP host name. #pw-group-HTTP-and-input * @property string $httpHost Current HTTP host name. #pw-group-HTTP-and-input
* @property bool $https If the current request is an HTTPS request, this is set to true. #pw-group-runtime * @property bool $https If the current request is an HTTPS request, this is set to true. #pw-group-runtime
* @property string $version Current ProcessWire version string (i.e. "2.2.3") #pw-group-system #pw-group-runtime * @property string $version Current ProcessWire version string (i.e. "2.2.3") #pw-group-system #pw-group-runtime

View File

@@ -2842,6 +2842,8 @@ class Page extends WireData implements \Countable, WireMatchable {
$url = ($https ? 'https://' : 'http://') . $this->wire('config')->httpHost . $url; $url = ($https ? 'https://' : 'http://') . $this->wire('config')->httpHost . $url;
} }
} }
$append = $this->wire('session')->getFor($this, 'appendEditUrl');
if($append) $url .= $append;
return $url; return $url;
} }

View File

@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
* Reversion revision number * Reversion revision number
* *
*/ */
const versionRevision = 56; const versionRevision = 57;
/** /**
* Version suffix string (when applicable) * Version suffix string (when applicable)
@@ -258,6 +258,7 @@ class ProcessWire extends Wire {
$config->ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); $config->ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
$config->cli = (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || ($_SERVER['argc'] > 0 && is_numeric($_SERVER['argc'])))); $config->cli = (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || ($_SERVER['argc'] > 0 && is_numeric($_SERVER['argc']))));
$config->modal = empty($_GET['modal']) ? false : abs((int) $_GET['modal']);
$version = self::versionMajor . "." . self::versionMinor . "." . self::versionRevision; $version = self::versionMajor . "." . self::versionMinor . "." . self::versionRevision;
$config->version = $version; $config->version = $version;

View File

@@ -452,7 +452,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$out .= $this->form->render(); $out .= $this->form->render();
// buttons with dropdowns // buttons with dropdowns
if(!$this->wire('input')->get('modal') && !count($this->fields)) { if(!$this->wire('config')->modal && !count($this->fields)) {
$config = $this->wire('config'); $config = $this->wire('config');
$file = $config->debug ? 'dropdown.js' : 'dropdown.min.js'; $file = $config->debug ? 'dropdown.js' : 'dropdown.min.js';
@@ -490,7 +490,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$out .= "</ul>"; $out .= "</ul>";
} }
if($viewable && !count($this->fields)) { if($viewable && !count($this->fields) && !$this->wire('config')->modal) {
// this supports code in the buildFormView() method // this supports code in the buildFormView() method
$out .= "<ul id='_ProcessPageEditViewDropdown' class='pw-dropdown-menu pw-dropdown-menu-rounded' data-my='left top' data-at='left top-9'>"; $out .= "<ul id='_ProcessPageEditViewDropdown' class='pw-dropdown-menu pw-dropdown-menu-rounded' data-my='left top' data-at='left top-9'>";
foreach($this->getViewActions() as $name => $action) { foreach($this->getViewActions() as $name => $action) {
@@ -559,7 +559,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
"panel" => "<a class='pw-panel pw-panel-reload$class' href='$url' data-tab-text='$labels[view]' data-tab-icon='eye'>$labels[panel]</a>", "panel" => "<a class='pw-panel pw-panel-reload$class' href='$url' data-tab-text='$labels[view]' data-tab-icon='eye'>$labels[panel]</a>",
"modal" => "<a class='pw-modal pw-modal-large$class' href='$url'>$labels[modal]</a>", "modal" => "<a class='pw-modal pw-modal-large$class' href='$url'>$labels[modal]</a>",
"new" => "<a class='$class' target='_blank' href='$url'>$labels[new]</a>", "new" => "<a class='$class' target='_blank' href='$url'>$labels[new]</a>",
"this" => "<a class='$class' href='$url'>$labels[this]</a>", "this" => "<a class='$class' target='_top' href='$url'>$labels[this]</a>",
), $actions); ), $actions);
foreach($actions as $name => $action) { foreach($actions as $name => $action) {
@@ -595,7 +595,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
protected function ___buildForm(InputfieldForm $form) { protected function ___buildForm(InputfieldForm $form) {
$action = "./?id=$this->id"; $action = "./?id=$this->id";
$modal = (int) $this->wire('input')->get('modal'); $modal = (int) $this->wire('config')->modal;
if($modal) $action .= "&modal=$modal"; if($modal) $action .= "&modal=$modal";
$context = $this->wire('input')->get('context'); $context = $this->wire('input')->get('context');
if($context !== null) { if($context !== null) {
@@ -720,7 +720,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
if($this->isTrash) $this->message($this->_("This page is in the Trash")); if($this->isTrash) $this->message($this->_("This page is in the Trash"));
$tabDelete = $this->buildFormDelete(); $tabDelete = $this->buildFormDelete();
if($tabDelete->children()->count()) $form->append($tabDelete); if($tabDelete->children()->count()) $form->append($tabDelete);
if($this->page->viewable() && !$this->input->get('modal')) $this->buildFormView($this->page->httpUrl); if($this->page->viewable() && !$modal) $this->buildFormView($this->page->httpUrl);
if($this->page->hasStatus(Page::statusUnpublished)) { if($this->page->hasStatus(Page::statusUnpublished)) {
@@ -854,12 +854,13 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
} }
if($page->addable()) { if($page->addable()) {
$modal = $this->wire('config')->modal;
/** @var InputfieldButton $button */ /** @var InputfieldButton $button */
$button = $this->modules->get("InputfieldButton"); $button = $this->modules->get("InputfieldButton");
$button->attr('id+name', 'AddPageBtn'); $button->attr('id+name', 'AddPageBtn');
$button->attr('value', $this->_('Add New Page Here')); // Button: add new child page $button->attr('value', $this->_('Add New Page Here')); // Button: add new child page
$button->icon = 'plus-circle'; $button->icon = 'plus-circle';
$button->attr('href', "../add/?parent_id={$page->id}" . ($this->input->get('modal') ? "&modal=1" : '')); $button->attr('href', "../add/?parent_id={$page->id}" . ($modal ? "&modal=$modal" : ''));
$field->append($button); $field->append($button);
} }
$wrapper->append($field); $wrapper->append($field);
@@ -1201,7 +1202,11 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$settings = $this->wire('config')->pageEdit; $settings = $this->wire('config')->pageEdit;
$target = ''; $target = '';
if((is_array($settings) && !empty($settings['viewNew'])) || $this->viewAction == 'new') $target = " target='_blank'"; if((is_array($settings) && !empty($settings['viewNew'])) || $this->viewAction == 'new') {
$target = " target='_blank'";
} else {
$target = " target='_top'";
}
$a = $a =
"<a id='_ProcessPageEditView' $target href='$url' data-action='$this->viewAction'>$label" . "<a id='_ProcessPageEditView' $target href='$url' data-action='$this->viewAction'>$label" .
@@ -1442,7 +1447,8 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
*/ */
protected function ___processSaveRedirect($redirectUrl) { protected function ___processSaveRedirect($redirectUrl) {
if(!$redirectUrl) $redirectUrl = "./?id={$this->page->id}&s=1"; if(!$redirectUrl) $redirectUrl = "./?id={$this->page->id}&s=1";
if($this->input->get('modal')) $redirectUrl .= "&modal=1"; $modal = $this->wire('config')->modal;
if($modal) $redirectUrl .= "&modal=$modal";
if(count($this->fields)) { if(count($this->fields)) {
if(count($this->fields) == 1) $redirectUrl .= "&field={$this->field->name}"; if(count($this->fields) == 1) $redirectUrl .= "&field={$this->field->name}";
else $redirectUrl .= "&fields=" . implode(',', array_keys($this->fields)); else $redirectUrl .= "&fields=" . implode(',', array_keys($this->fields));
@@ -2231,15 +2237,19 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$page = $this->page ? $this->page : $this->parent; $page = $this->page ? $this->page : $this->parent;
if($this->masterPage) $page = $this->masterPage; if($this->masterPage) $page = $this->masterPage;
$lastID = (int) $this->wire('session')->get('ProcessPageList', 'lastID'); $lastID = (int) $this->wire('session')->get('ProcessPageList', 'lastID');
$settings = $this->wire('config')->pageEdit;
$editCrumbs = !empty($settings['editCrumbs']);
$numParents = $page->parents->count(); $numParents = $page->parents->count();
foreach($page->parents() as $cnt => $p) { foreach($page->parents() as $cnt => $p) {
$url = "../?open=$p->id"; $url = $editCrumbs && $p->editable() ? "./?id=$p->id" : "../?open=$p->id";
if($cnt == $numParents-1 && $p->id == $lastID) $url = "../"; if(!$editCrumbs && $cnt == $numParents-1 && $p->id == $lastID) $url = "../";
$this->breadcrumb($url, $p->get("title|name")); $this->breadcrumb($url, $p->get("title|name"));
} }
if($this->page && $this->field) $this->breadcrumb("./?id={$this->page->id}", $page->get("title|name")); if($this->page && $this->field) {
$this->breadcrumb("./?id={$this->page->id}", $page->get("title|name"));
}
} }

View File

@@ -452,7 +452,7 @@ class ProcessPageList extends Process implements ConfigurableModule {
} }
/** /**
* Get an instance of PageBookmarks * Get an instance of PageBookmarks (to be phased out)
* *
* @return PageBookmarks * @return PageBookmarks
* *
@@ -582,7 +582,7 @@ class ProcessPageList extends Process implements ConfigurableModule {
} }
/** /**
* Execute the Page Bookmarks * Execute the Page Bookmarks (to be phased out)
* *
* @return string * @return string
* @throws WireException * @throws WireException
@@ -616,12 +616,15 @@ class ProcessPageList extends Process implements ConfigurableModule {
$field->description = $this->_('Every page in a PageList is identified by a label, typically a title or headline field. You may specify which field it should use here. To specify multiple fields, separate each field name with a space, or use your own format string with field names surrounded in {brackets}. If the field resolves to an object (like another page), then specify the property with a dot, i.e. {anotherpage.title}. Note that if the format you specify resolves to a blank value then ProcessWire will use the page "name" field.'); // pageLabelField description $field->description = $this->_('Every page in a PageList is identified by a label, typically a title or headline field. You may specify which field it should use here. To specify multiple fields, separate each field name with a space, or use your own format string with field names surrounded in {brackets}. If the field resolves to an object (like another page), then specify the property with a dot, i.e. {anotherpage.title}. Note that if the format you specify resolves to a blank value then ProcessWire will use the page "name" field.'); // pageLabelField description
$field->notes = $this->_('You may optionally override this setting on a per-template basis in each template "advanced" settings.'); // pageLabelField notes $field->notes = $this->_('You may optionally override this setting on a per-template basis in each template "advanced" settings.'); // pageLabelField notes
$fields->append($field); $fields->append($field);
$bookmarks = $this->getPageBookmarks(); if(!empty($data['useBookmarks'])) {
$bookmarks->addConfigInputfields($fields); // support bookmarks only if already in use as bookmarks for ProcessPageList to be phased out
$admin = $this->wire('pages')->get($this->wire('config')->adminRootPageID); $bookmarks = $this->getPageBookmarks();
$page = $this->wire('pages')->get($admin->path . 'page/list/'); $bookmarks->addConfigInputfields($fields);
$bookmarks->checkProcessPage($page); $admin = $this->wire('pages')->get($this->wire('config')->adminRootPageID);
$page = $this->wire('pages')->get($admin->path . 'page/list/');
$bookmarks->checkProcessPage($page);
}
/* /*
$settings = $this->wire('config')->pageList; $settings = $this->wire('config')->pageList;