mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
A few updates in support of new AdminThemeFramework and bump version to 3.0.57
This commit is contained in:
@@ -1003,6 +1003,7 @@ $config->pageList = array(
|
||||
* #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 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
|
||||
*
|
||||
@@ -1012,6 +1013,7 @@ $config->pageEdit = array(
|
||||
'confirm' => true,
|
||||
'ajaxChildren' => true,
|
||||
'ajaxParent' => true,
|
||||
'editCrumbs' => false,
|
||||
);
|
||||
|
||||
|
||||
@@ -1194,6 +1196,12 @@ $config->https = null;
|
||||
*/
|
||||
$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.
|
||||
*
|
||||
|
@@ -61,7 +61,6 @@ abstract class AdminThemeFramework extends AdminTheme {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->set('useAsLogin', false);
|
||||
$this->wire('modules')->get('JqueryUI')->use('panel');
|
||||
$this->sanitizer = $this->wire('sanitizer');
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
* @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|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 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
|
||||
|
@@ -2842,6 +2842,8 @@ class Page extends WireData implements \Countable, WireMatchable {
|
||||
$url = ($https ? 'https://' : 'http://') . $this->wire('config')->httpHost . $url;
|
||||
}
|
||||
}
|
||||
$append = $this->wire('session')->getFor($this, 'appendEditUrl');
|
||||
if($append) $url .= $append;
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
|
||||
* Reversion revision number
|
||||
*
|
||||
*/
|
||||
const versionRevision = 56;
|
||||
const versionRevision = 57;
|
||||
|
||||
/**
|
||||
* 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->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;
|
||||
$config->version = $version;
|
||||
|
@@ -452,7 +452,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
$out .= $this->form->render();
|
||||
|
||||
// buttons with dropdowns
|
||||
if(!$this->wire('input')->get('modal') && !count($this->fields)) {
|
||||
if(!$this->wire('config')->modal && !count($this->fields)) {
|
||||
|
||||
$config = $this->wire('config');
|
||||
$file = $config->debug ? 'dropdown.js' : 'dropdown.min.js';
|
||||
@@ -490,7 +490,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
$out .= "</ul>";
|
||||
}
|
||||
|
||||
if($viewable && !count($this->fields)) {
|
||||
if($viewable && !count($this->fields) && !$this->wire('config')->modal) {
|
||||
// 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'>";
|
||||
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>",
|
||||
"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>",
|
||||
"this" => "<a class='$class' href='$url'>$labels[this]</a>",
|
||||
"this" => "<a class='$class' target='_top' href='$url'>$labels[this]</a>",
|
||||
), $actions);
|
||||
|
||||
foreach($actions as $name => $action) {
|
||||
@@ -595,7 +595,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
protected function ___buildForm(InputfieldForm $form) {
|
||||
|
||||
$action = "./?id=$this->id";
|
||||
$modal = (int) $this->wire('input')->get('modal');
|
||||
$modal = (int) $this->wire('config')->modal;
|
||||
if($modal) $action .= "&modal=$modal";
|
||||
$context = $this->wire('input')->get('context');
|
||||
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"));
|
||||
$tabDelete = $this->buildFormDelete();
|
||||
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)) {
|
||||
|
||||
@@ -854,12 +854,13 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
}
|
||||
|
||||
if($page->addable()) {
|
||||
$modal = $this->wire('config')->modal;
|
||||
/** @var InputfieldButton $button */
|
||||
$button = $this->modules->get("InputfieldButton");
|
||||
$button->attr('id+name', 'AddPageBtn');
|
||||
$button->attr('value', $this->_('Add New Page Here')); // Button: add new child page
|
||||
$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);
|
||||
}
|
||||
$wrapper->append($field);
|
||||
@@ -1201,7 +1202,11 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
$settings = $this->wire('config')->pageEdit;
|
||||
$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 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) {
|
||||
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) == 1) $redirectUrl .= "&field={$this->field->name}";
|
||||
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;
|
||||
if($this->masterPage) $page = $this->masterPage;
|
||||
$lastID = (int) $this->wire('session')->get('ProcessPageList', 'lastID');
|
||||
$settings = $this->wire('config')->pageEdit;
|
||||
$editCrumbs = !empty($settings['editCrumbs']);
|
||||
|
||||
$numParents = $page->parents->count();
|
||||
foreach($page->parents() as $cnt => $p) {
|
||||
$url = "../?open=$p->id";
|
||||
if($cnt == $numParents-1 && $p->id == $lastID) $url = "../";
|
||||
$url = $editCrumbs && $p->editable() ? "./?id=$p->id" : "../?open=$p->id";
|
||||
if(!$editCrumbs && $cnt == $numParents-1 && $p->id == $lastID) $url = "../";
|
||||
$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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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
|
||||
*
|
||||
@@ -582,7 +582,7 @@ class ProcessPageList extends Process implements ConfigurableModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the Page Bookmarks
|
||||
* Execute the Page Bookmarks (to be phased out)
|
||||
*
|
||||
* @return string
|
||||
* @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->notes = $this->_('You may optionally override this setting on a per-template basis in each template "advanced" settings.'); // pageLabelField notes
|
||||
$fields->append($field);
|
||||
|
||||
$bookmarks = $this->getPageBookmarks();
|
||||
$bookmarks->addConfigInputfields($fields);
|
||||
$admin = $this->wire('pages')->get($this->wire('config')->adminRootPageID);
|
||||
$page = $this->wire('pages')->get($admin->path . 'page/list/');
|
||||
$bookmarks->checkProcessPage($page);
|
||||
|
||||
if(!empty($data['useBookmarks'])) {
|
||||
// support bookmarks only if already in use as bookmarks for ProcessPageList to be phased out
|
||||
$bookmarks = $this->getPageBookmarks();
|
||||
$bookmarks->addConfigInputfields($fields);
|
||||
$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;
|
||||
|
Reference in New Issue
Block a user