Merge branch 'develop' of github.com:octobercms/october into develop

This commit is contained in:
alekseybobkov 2014-09-29 22:58:55 -07:00
commit 762088463c
37 changed files with 118 additions and 220 deletions

View File

@ -1,6 +1,11 @@
* **Build 14x** (2014-09-xx)
* **Build 15x** (2014-09-xx)
- Moved `ViewMaker` trait to live under system, it can be useful for Models too.
* **Build 149** (2014-09-29)
- Added new `hint` form field type (see Backend > Forms docs).
- Added new `containerAttributes` property to form fields (see Backend > Forms docs).
- Field attributes have had an API change `$field->attributes` should now be `$field->getAttributes()`.
- Added scheduled console commands (see Help > Console docs).
* **Build 145** (2014-09-13)
- Standard setting pages now have **Save** and **Save and Close** buttons.

View File

@ -21,6 +21,7 @@ return array(
| Specify which modules should be registered when using the application.
|
*/
'loadModules' => ['System', 'Backend', 'Cms'],
/*
@ -31,6 +32,7 @@ return array(
| Specify plugin codes which will always be disabled in the application.
|
*/
'disablePlugins' => [],
/*

View File

@ -51,9 +51,14 @@
formatSelection: formatSelectOption,
escapeMarkup: function(m) { return m; }
})
$(document).on('disable', 'select.custom-select', function(event, status){
$(this).select2('enable', !status)
})
})
$(document).on('disable', 'select.custom-select', function(event, status){
$(this).select2('enable', !status)
})
$(document).on('focus', 'select.custom-select', function(event){
setTimeout($.proxy(function() { $(this).select2('focus') }, this), 10)
})
})(jQuery);

View File

@ -27,14 +27,9 @@
keysCount = keys.length,
keyConditions = [],
keyPressed = { shift: false, ctrl: false, cmd: false, alt: false },
keyMap = {8: "backspace", 9: "tab", 10: "return", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 59: ";", 61: "=",
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 173: "-", 186: ";", 187: "=",
188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'"}
keyMap = {'esc':27, 'tab':9, 'space':32, 'return':13, 'enter':13, 'backspace':8, 'scroll':145, 'capslock':20, 'numlock':144, 'pause':19,
'break':19, 'insert':45, 'home':36, 'delete':46, 'suppr':46, 'end':35, 'pageup':33, 'pagedown':34, 'left':37, 'up':38, 'right':39, 'down':40,
'f1':112, 'f2':113, 'f3':114, 'f4':115, 'f5':116, 'f6':117, 'f7':118, 'f8':119, 'f9':120, 'f10':121, 'f11':122, 'f12':123}
for (var i = 0; i < keysCount; i++) {
keyConditions.push(makeCondition(trim(keys[i])))

View File

@ -1,7 +1,7 @@
/*
* Sortable plugin, a forked version of johnny's sortable plugin.
*
* Forked from: https://github.com/johnny/jquery-sortable/tree/271cd2c742439842000e6f92d4dae96bb8dcd595
* Forked from: https://github.com/johnny/jquery-sortable/tree/1563f32858cfe250051ad0a573425569c49d631f
*
* Note: Consider using october.simplelist.js with "is-sortable" class.
*
@ -31,7 +31,6 @@
+function ($) { "use strict";
var eventNames,
isTouch = 'ontouchstart' in window,
cursorAdjustment,
containerDefaults = {
drag: true, // Items can be dragged from this container
@ -174,23 +173,13 @@
top: 0,
bottom: 0,
right: 0
}
if (isTouch) {
},
eventNames = {
start: "touchstart",
drop: "touchend",
drag: "touchmove",
start: "touchstart.sortable mousedown.sortable",
drop: "touchend.sortable touchcancel.sortable mouseup.sortable",
drag: "touchmove.sortable mousemove.sortable",
scroll: "scroll.sortable"
}
} else {
eventNames = {
start: "mousedown.sortable",
drop: "mouseup.sortable",
drag: "mousemove.sortable",
scroll: "scroll.sortable"
}
}
/*
* a is Array [left, right, top, bottom]
@ -316,8 +305,8 @@
groupDefaults.onDrag,
e)
var x = (isTouch) ? e.originalEvent.touches[0].pageX : e.pageX,
y = (isTouch) ? e.originalEvent.touches[0].pageY : e.pageY,
var x = e.pageX || e.originalEvent.pageX,
y = e.pageY || e.originalEvent.pageY,
box = this.sameResultBox,
t = this.options.tolerance
@ -417,17 +406,7 @@
return this.offsetParent
},
setPointer: function (e) {
if (isTouch) {
var pointer = {
left: e.originalEvent.touches[0].pageX,
top: e.originalEvent.touches[0].pageY
}
} else {
var pointer = {
left: e.pageX,
top: e.pageY
}
}
var pointer = this.getPointer(e)
if (this.$getOffsetParent()) {
var relativePointer = getRelativePosition(pointer, this.$getOffsetParent())
@ -439,17 +418,16 @@
this.pointer = pointer
},
distanceMet: function (e) {
if (isTouch) {
return (Math.max(
Math.abs(this.pointer.left - e.originalEvent.touches[0].pageX),
Math.abs(this.pointer.top - e.originalEvent.touches[0].pageY)
) >= this.options.distance)
} else {
return (Math.max(
Math.abs(this.pointer.left - e.pageX),
Math.abs(this.pointer.top - e.pageY)
) >= this.options.distance)
var currentPointer = this.getPointer(e)
return (Math.max(
Math.abs(this.pointer.left - currentPointer.left),
Math.abs(this.pointer.top - currentPointer.top)
) >= this.options.distance)
},
getPointer: function(e) {
return {
left: e.pageX || e.originalEvent.pageX,
top: e.pageY || e.originalEvent.pageY
}
},
setupDelayTimer: function () {

View File

@ -433,7 +433,9 @@
/*
* Detect invalid fields, focus the tab
*/
$(window).on('ajaxInvalidField', function(ev, element, name){
$(window).on('ajaxInvalidField', function(event, element, name, messages, isFirst){
if (!isFirst) return
event.preventDefault()
element.closest('[data-control=tab]').ocTab('goToElement', element)
element.focus()
})

View File

@ -3,6 +3,8 @@
*
* Supported options:
* - handle - class name to use as a handle
* - nested - set to false if sorting should be kept within each OL container, if using
* a handle it should be focused enough to exclude nested handles.
*
* Events:
* - move.oc.treelist - triggered when a node on the tree is moved.
@ -20,26 +22,37 @@
this.options = options || {};
var sortableOptions = {
handle: options.handle,
onDrop: function($item, container, _super) {
self.$el.trigger('move.oc.treelist', { item: $item, container: container })
_super($item, container)
},
afterMove: function($placeholder, container, $closestEl) {
self.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl })
handle: options.handle,
nested: options.nested,
onDrop: function($item, container, _super) {
self.$el.trigger('move.oc.treelist', { item: $item, container: container })
_super($item, container)
},
afterMove: function($placeholder, container, $closestEl) {
self.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl })
}
}
}
$el.find('> ol').sortable($.extend(sortableOptions, options))
if (!options.nested) {
$el.find('> ol ol').sortable($.extend(sortableOptions, options))
}
}
TreeListWidget.prototype.unbind = function() {
this.$el.find('> ol').sortable('destroy')
if (!this.options.nested) {
this.$el.find('> ol ol').sortable('destroy')
}
this.$el.removeData('oc.treelist')
}
TreeListWidget.DEFAULTS = {
handle: null
handle: null,
nested: true
}
// TREELIST WIDGET PLUGIN DEFINITION

View File

@ -76,7 +76,7 @@ class FormController extends ControllerBehavior
$config = $this->makeConfig($this->config->form);
$config->model = $model;
$config->arrayName = Str::getRealClass($model);
$config->arrayName = class_basename($model);
$config->context = $context;
/*

View File

@ -1,7 +1,6 @@
<?php namespace Backend\Behaviors;
use DB;
use Str;
use Lang;
use Event;
use Form as FormHelper;
@ -400,7 +399,7 @@ class RelationController extends ControllerBehavior
*/
public function relationGetId($suffix = null)
{
$id = Str::getRealClass($this);
$id = class_basename($this);
if ($this->field)
$id .= '-' . $this->field;
@ -673,7 +672,7 @@ class RelationController extends ControllerBehavior
elseif ($this->viewMode == 'single') {
$config = $this->makeConfig($this->config->form);
$config->model = $this->relationModel;
$config->arrayName = Str::getRealClass($this->relationModel);
$config->arrayName = class_basename($this->relationModel);
$config->context = 'relation';
$config->alias = $this->alias . 'ViewForm';
@ -732,7 +731,7 @@ class RelationController extends ControllerBehavior
elseif ($this->manageMode == 'form' && isset($this->config->form)) {
$config = $this->makeConfig($this->config->form);
$config->model = $this->relationModel;
$config->arrayName = Str::getRealClass($this->relationModel);
$config->arrayName = class_basename($this->relationModel);
$config->context = 'relation';
$config->alias = $this->alias . 'ManageForm';
@ -778,7 +777,7 @@ class RelationController extends ControllerBehavior
{
$config = $this->makeConfig($this->config->pivot);
$config->model = $this->relationModel;
$config->arrayName = Str::getRealClass($this->relationModel);
$config->arrayName = class_basename($this->relationModel);
$config->context = 'relation';
$config->alias = $this->alias . 'ManagePivotForm';

View File

@ -1,7 +1,6 @@
<?php namespace Backend\Classes;
use App;
use Str;
use Log;
use Lang;
use View;
@ -33,7 +32,7 @@ class Controller extends Extendable
{
use \System\Traits\AssetMaker;
use \System\Traits\ConfigMaker;
use \Backend\Traits\ViewMaker;
use \System\Traits\ViewMaker;
use \Backend\Traits\WidgetMaker;
use \October\Rain\Support\Traits\Emitter;
@ -459,7 +458,7 @@ class Controller extends Extendable
*/
public function getId($suffix = null)
{
$id = Str::getRealClass(get_called_class()) . '-' . $this->action;
$id = class_basename(get_called_class()) . '-' . $this->action;
if ($suffix !== null)
$id .= '-' . $suffix;

View File

@ -4,7 +4,7 @@ use Str;
use Lang;
use System\Classes\ApplicationException;
use October\Rain\Extension\ExtensionBase;
use Backend\Traits\ViewMaker;
use System\Traits\ViewMaker;
/**
* Controller Behavior base class
@ -14,10 +14,10 @@ use Backend\Traits\ViewMaker;
*/
class ControllerBehavior extends ExtensionBase
{
use \Backend\Traits\WidgetMaker;
use \System\Traits\AssetMaker;
use \System\Traits\ConfigMaker;
use \Backend\Traits\WidgetMaker;
use \Backend\Traits\ViewMaker {
use \System\Traits\ViewMaker {
ViewMaker::makeFileContents as localMakeFileContents;
}

View File

@ -1,6 +1,5 @@
<?php namespace Backend\Classes;
use Str;
use File;
use Config;
use October\Rain\Router\Helper as RouterHelper;
@ -55,7 +54,7 @@ abstract class Skin
* Guess the skin path
*/
$class = get_called_class();
$classFolder = strtolower(Str::getRealClass($class));
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$this->skinPath = $classFile
? $classFile . '/' . $classFolder

View File

@ -16,7 +16,7 @@ abstract class WidgetBase
use \System\Traits\AssetMaker;
use \System\Traits\ConfigMaker;
use \Backend\Traits\ViewMaker;
use \System\Traits\ViewMaker;
use \Backend\Traits\WidgetMaker;
use \October\Rain\Support\Traits\Emitter;
@ -123,7 +123,7 @@ abstract class WidgetBase
*/
public function getId($suffix = null)
{
$id = Str::getRealClass(get_called_class());
$id = class_basename(get_called_class());
if ($this->alias != $this->defaultAlias)
$id .= '-' . $this->alias;

View File

@ -38,8 +38,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>

View File

@ -17,8 +17,7 @@
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
@ -27,8 +26,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>

View File

@ -18,8 +18,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -28,8 +27,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -17,8 +17,7 @@
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
@ -27,8 +26,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>

View File

@ -11,8 +11,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -21,8 +20,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -18,8 +18,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -28,8 +27,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -24,19 +24,7 @@ trait InspectableContainer
if (!$className)
throw new ApplicationException('The inspectable class name is not specified.');
$classes = class_parents($className);
array_unshift($classes, $className);
$traitFound = false;
foreach ($classes as $class) {
$traits = class_uses($class);
if (in_array('System\Traits\PropertyContainer', $traits)) {
$traitFound = true;
break;
}
}
$traitFound = in_array('System\Traits\PropertyContainer', class_uses_recursive($className));
if (!$traitFound)
throw new ApplicationException('The options cannot be loaded for the specified class.');

View File

@ -57,7 +57,9 @@
/*
* Detect invalid fields, uncollapse the panel
*/
$(window).on('ajaxInvalidField', function(ev, element, name){
$(window).on('ajaxInvalidField', function(ev, element, name, messages, isFirst){
if (!isFirst) return
event.preventDefault()
var $panel = element.closest('.form-tabless-fields.collapsed'),
$primaryPanel = element.closest('.control-tabs.primary.collapsed')

View File

@ -23,8 +23,6 @@ use Assetic\Cache\FilesystemCache;
*/
class CombineAssets
{
use \System\Traits\PathMaker;
/**
* @var Self Instance for multi cycle execution.
*/
@ -376,7 +374,7 @@ class CombineAssets
$filesSalt = null;
foreach ($assets as $asset) {
$filters = $this->getFilters(File::extension($asset));
$path = $this->makePath($asset) ?: $this->path . $asset;
$path = File::symbolizePath($asset) ?: $this->path . $asset;
$files[] = new FileAsset($path, $filters, public_path());
$filesSalt .= $this->path . $asset;
}

View File

@ -4,8 +4,7 @@
class="btn btn-primary oc-icon-check save"
data-request="onSave"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s">
data-hotkey="ctrl+s, cmd+s">
<?= e(trans('backend::lang.form.save')) ?>
</a>

View File

@ -4,8 +4,7 @@
class="btn btn-primary oc-icon-check save"
data-request="onSave"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s">
data-hotkey="ctrl+s, cmd+s">
<?= e(trans('backend::lang.form.save')) ?>
</a>

View File

@ -4,8 +4,7 @@
class="btn btn-primary oc-icon-check save"
data-request="onSave"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s">
data-hotkey="ctrl+s, cmd+s">
<?= e(trans('backend::lang.form.save')) ?>
</a>

View File

@ -4,8 +4,7 @@
class="btn btn-primary oc-icon-check save"
data-request="onSave"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s">
data-hotkey="ctrl+s, cmd+s">
<?= e(trans('backend::lang.form.save')) ?>
</a>

View File

@ -1,6 +1,5 @@
<?php namespace Cms\Twig;
use Str;
use Twig_Extension;
use Twig_Environment;
use Twig_SimpleFunction;
@ -243,7 +242,7 @@ class DebugExtension extends Twig_Extension
protected function evalObjLabel($variable)
{
$class = get_class($variable);
$label = Str::getRealClass($variable);
$label = class_basename($variable);
if ($variable instanceof ComponentBase)
$label = '<strong>Component</strong>';

View File

@ -50,7 +50,7 @@ class ServiceProvider extends ModuleServiceProvider
if (!defined('PATH_BASE')) define('PATH_BASE', base_path());
if (!defined('PATH_PUBLIC')) define('PATH_PUBLIC', public_path());
if (!defined('PATH_STORAGE')) define('PATH_STORAGE', storage_path());
if (!defined('PATH_PLUGINS')) define('PATH_PLUGINS', base_path() . Config::get('cms.pluginsDir'));
if (!defined('PATH_PLUGINS')) define('PATH_PLUGINS', base_path() . Config::get('cms.pluginsDir', '/plugins'));
/*
* Register singletons

View File

@ -1,6 +1,5 @@
<?php namespace System\Controllers;
use Str;
use Lang;
use Flash;
use Backend;
@ -125,7 +124,7 @@ class Settings extends Controller
{
$config = $model->getFieldConfig();
$config->model = $model;
$config->arrayName = Str::getRealClass($model);
$config->arrayName = class_basename($model);
$config->context = 'update';
$widget = $this->makeWidget('Backend\Widgets\Form', $config);

View File

@ -16,8 +16,7 @@
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Layout..."
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
@ -26,8 +25,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Layout..."
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>

View File

@ -26,8 +26,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Layout..."
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -36,8 +35,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Layout..."
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -16,8 +16,7 @@
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Template..."
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
@ -26,8 +25,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Template..."
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>

View File

@ -26,8 +26,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Template..."
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -36,8 +35,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Template..."
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -10,8 +10,7 @@
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
@ -20,8 +19,7 @@
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter"
data-hotkey-mac="cmd+enter"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>

View File

@ -1,6 +1,5 @@
<?php namespace System\Traits;
use Str;
use File;
use Lang;
use Event;
@ -120,9 +119,9 @@ trait ConfigMaker
if (!$configPath)
$configPath = $this->configPath;
$fileName = str_replace('@', PATH_BASE, $fileName);
$fileName = File::symbolizePath($fileName, $fileName);
if (substr($fileName, 0, 1) == '/' || realpath($fileName) !== false)
if (File::isLocalPath($fileName) || realpath($fileName) !== false)
return $fileName;
if (!is_array($configPath))
@ -156,7 +155,7 @@ trait ConfigMaker
*/
public function guessConfigPathFrom($class, $suffix = '')
{
$classFolder = strtolower(Str::getRealClass($class));
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $guessedPath;

View File

@ -1,56 +0,0 @@
<?php namespace System\Traits;
/**
* Path Maker Trait
*
* Converts path symbols to relevant points in the filesystem.
*
* $ - Relative to the plugins directory
* ~ - Relative to the application directory
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
trait PathMaker
{
/**
* @var array Known path symbols and their prefixes.
*/
protected $pathSymbols = [
'$' => PATH_PLUGINS,
'~' => PATH_BASE,
// '/' => PATH_BASE, // @deprecated
'@' => PATH_BASE, // @deprecated
];
/**
* Converts a path.
* @param string $path
* @return string
*/
public function makePath($path, $default = false)
{
if (!$firstChar = $this->isPathSymbol($path))
return $default;
$_path = substr($path, 1);
return $this->pathSymbols[$firstChar] . $_path;
}
/**
* Returns true if the path uses a symbol.
* @param string $path
* @return boolean
*/
public function isPathSymbol($path)
{
$firstChar = substr($path, 0, 1);
if (isset($this->pathSymbols[$firstChar]))
return $firstChar;
return false;
}
}

View File

@ -1,6 +1,5 @@
<?php namespace Backend\Traits;
<?php namespace System\Traits;
use Str;
use File;
use Lang;
use Block;
@ -16,8 +15,6 @@ use System\Classes\SystemException;
trait ViewMaker
{
use \System\Traits\PathMaker;
/**
* @var array A list of variables to pass to the page.
*/
@ -52,7 +49,7 @@ trait ViewMaker
*/
public function makePartial($partial, $params = [], $throwException = true)
{
if (!$this->isPathSymbol($partial) && realpath($partial) === false)
if (!File::isPathSymbol($partial) && realpath($partial) === false)
$partial = '_' . strtolower($partial) . '.htm';
$partialPath = $this->getViewPath($partial);
@ -131,7 +128,7 @@ trait ViewMaker
*/
public function makeLayoutPartial($partial, $params = [])
{
if (!in_array(substr($partial, 0, 1), ['/', '@']))
if (!File::isLocalPath($partial) && !File::isPathSymbol($partial))
$partial = '_' . strtolower($partial);
return $this->makeLayout($partial, $params);
@ -153,9 +150,9 @@ trait ViewMaker
if (!$viewPath)
$viewPath = $this->viewPath;
$fileName = $this->makePath($fileName, $fileName);
$fileName = File::symbolizePath($fileName, $fileName);
if (substr($fileName, 0, 1) == '/' || realpath($fileName) !== false)
if (File::isLocalPath($fileName) || realpath($fileName) !== false)
return $fileName;
if (!is_array($viewPath))
@ -214,7 +211,7 @@ trait ViewMaker
*/
public function guessViewPathFrom($class, $suffix = '', $isPublic = false)
{
$classFolder = strtolower(Str::getRealClass($class));
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return ($isPublic) ? File::localToPublic($guessedPath) : $guessedPath;