Skip to content

Commit 381803a

Browse files
committed
initial modExtra commit 2
1 parent 9455218 commit 381803a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2611
-0
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
$properties = array();
4+
5+
$tmp = array(
6+
'tpl' => array(
7+
'type' => 'textfield',
8+
'value' => 'tpl.Sendex.item',
9+
),
10+
'sortby' => array(
11+
'type' => 'textfield',
12+
'value' => 'name',
13+
),
14+
'sortdir' => array(
15+
'type' => 'list',
16+
'options' => array(
17+
array('text' => 'ASC', 'value' => 'ASC'),
18+
array('text' => 'DESC', 'value' => 'DESC'),
19+
),
20+
'value' => 'ASC',
21+
),
22+
'limit' => array(
23+
'type' => 'numberfield',
24+
'value' => 10,
25+
),
26+
'outputSeparator' => array(
27+
'type' => 'textfield',
28+
'value' => "\n",
29+
),
30+
'toPlaceholder' => array(
31+
'type' => 'combo-boolean',
32+
'value' => false,
33+
),
34+
);
35+
36+
foreach ($tmp as $k => $v) {
37+
$properties[] = array_merge(
38+
array(
39+
'name' => $k,
40+
'desc' => PKG_NAME_LOWER . '_prop_' . $k,
41+
'lexicon' => PKG_NAME_LOWER . ':properties',
42+
), $v
43+
);
44+
}
45+
46+
return $properties;
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
if (file_exists(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php')) {
3+
/** @noinspection PhpIncludeInspection */
4+
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php';
5+
}
6+
else {
7+
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/config.core.php';
8+
}
9+
/** @noinspection PhpIncludeInspection */
10+
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
11+
/** @noinspection PhpIncludeInspection */
12+
require_once MODX_CONNECTORS_PATH . 'index.php';
13+
/** @var Sendex $Sendex */
14+
$Sendex = $modx->getService('sendex', 'Sendex', $modx->getOption('sendex_core_path', null,
15+
$modx->getOption('core_path') . 'components/sendex/') . 'model/sendex/'
16+
);
17+
$modx->lexicon->load('sendex:default');
18+
19+
// handle request
20+
$corePath = $modx->getOption('sendex_core_path', null, $modx->getOption('core_path') . 'components/sendex/');
21+
$path = $modx->getOption('processorsPath', $Sendex->config, $corePath . 'processors/');
22+
$modx->getRequest();
23+
24+
/** @var modConnectorRequest $request */
25+
$request = $modx->request;
26+
$request->handleRequest(array(
27+
'processors_path' => $path,
28+
'location' => '',
29+
));

assets/components/sendex/css/index.html

Whitespace-only changes.

assets/components/sendex/css/mgr/bootstrap.buttons.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Grid */
2+
.sendex-grid-row-disabled { font-style: italic; opacity: .6; color: #555; }
3+
.x-grid3-col-actions { padding: 3px 0 3px 5px; }
4+
/* Actions */
5+
.action-red { color: darkred !important; }
6+
.action-green { color: darkgreen !important; }
7+
.action-blue { color: cadetblue !important; }
8+
.action-yellow { color: goldenrod !important; }
9+
.action-gray { color: dimgray !important; }
10+
ul.sendex-row-actions { margin: 0; padding: 0; list-style: none; }
11+
ul.sendex-row-actions li { float: left; }
12+
ul.sendex-row-actions .btn { padding: 5px; margin-right: 2px; min-width: 26px; font-size: inherit; }
13+
/* Action menu */
14+
a.x-menu-item .x-menu-item-text, a.x-menu-item .x-menu-item-text .icon { cursor: pointer; }
15+
a.x-menu-item .x-menu-item-text .icon { line-height: 16px; top: auto; }
16+
.x-menu-list .icon { min-width: 1em; text-align: center; }
17+
.x-menu-list-item:hover .icon { color: inherit !important; }
18+
ul.sendex-row-actions .actions-menu { width: 40px; }
19+
ul.sendex-row-actions .actions-menu:after { content: " \f107"; }
20+
/* Search field */
21+
.x-field-search-clear,
22+
.x-field-search-go { border-left: 1px solid #e4e4e4 !important; }
23+
.x-field-search-clear:hover,
24+
.x-field-search-go:hover { border-left-color: transparent !important; }
25+
.x-field-search-clear:before { content: '\f00d' !important; }
26+
.x-field-search-go { right: 31px !important; border-radius: 0 !important; }
27+
.x-field-search-go:before { content: '\f002' !important; }

assets/components/sendex/index.html

Whitespace-only changes.

assets/components/sendex/js/index.html

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Sendex.combo.Search = function (config) {
2+
config = config || {};
3+
Ext.applyIf(config, {
4+
xtype: 'twintrigger',
5+
ctCls: 'x-field-search',
6+
allowBlank: true,
7+
msgTarget: 'under',
8+
emptyText: _('search'),
9+
name: 'query',
10+
triggerAction: 'all',
11+
clearBtnCls: 'x-field-search-clear',
12+
searchBtnCls: 'x-field-search-go',
13+
onTrigger1Click: this._triggerSearch,
14+
onTrigger2Click: this._triggerClear,
15+
});
16+
Sendex.combo.Search.superclass.constructor.call(this, config);
17+
this.on('render', function () {
18+
this.getEl().addKeyListener(Ext.EventObject.ENTER, function () {
19+
this._triggerSearch();
20+
}, this);
21+
});
22+
this.addEvents('clear', 'search');
23+
};
24+
Ext.extend(Sendex.combo.Search, Ext.form.TwinTriggerField, {
25+
26+
initComponent: function () {
27+
Ext.form.TwinTriggerField.superclass.initComponent.call(this);
28+
this.triggerConfig = {
29+
tag: 'span',
30+
cls: 'x-field-search-btns',
31+
cn: [
32+
{tag: 'div', cls: 'x-form-trigger ' + this.searchBtnCls},
33+
{tag: 'div', cls: 'x-form-trigger ' + this.clearBtnCls}
34+
]
35+
};
36+
},
37+
38+
_triggerSearch: function () {
39+
this.fireEvent('search', this);
40+
},
41+
42+
_triggerClear: function () {
43+
this.fireEvent('clear', this);
44+
},
45+
46+
});
47+
Ext.reg('sendex-combo-search', Sendex.combo.Search);
48+
Ext.reg('sendex-field-search', Sendex.combo.Search);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Sendex.utils.renderBoolean = function (value) {
2+
return value
3+
? String.format('<span class="green">{0}</span>', _('yes'))
4+
: String.format('<span class="red">{0}</span>', _('no'));
5+
};
6+
7+
Sendex.utils.getMenu = function (actions, grid, selected) {
8+
var menu = [];
9+
var cls, icon, title, action;
10+
11+
var has_delete = false;
12+
for (var i in actions) {
13+
if (!actions.hasOwnProperty(i)) {
14+
continue;
15+
}
16+
17+
var a = actions[i];
18+
if (!a['menu']) {
19+
if (a == '-') {
20+
menu.push('-');
21+
}
22+
continue;
23+
}
24+
else if (menu.length > 0 && !has_delete && (/^remove/i.test(a['action']) || /^delete/i.test(a['action']))) {
25+
menu.push('-');
26+
has_delete = true;
27+
}
28+
29+
if (selected.length > 1) {
30+
if (!a['multiple']) {
31+
continue;
32+
}
33+
else if (typeof(a['multiple']) == 'string') {
34+
a['title'] = a['multiple'];
35+
}
36+
}
37+
38+
icon = a['icon'] ? a['icon'] : '';
39+
if (typeof(a['cls']) == 'object') {
40+
if (typeof(a['cls']['menu']) != 'undefined') {
41+
icon += ' ' + a['cls']['menu'];
42+
}
43+
}
44+
else {
45+
cls = a['cls'] ? a['cls'] : '';
46+
}
47+
title = a['title'] ? a['title'] : a['title'];
48+
action = a['action'] ? grid[a['action']] : '';
49+
50+
menu.push({
51+
handler: action,
52+
text: String.format(
53+
'<span class="{0}"><i class="x-menu-item-icon {1}"></i>{2}</span>',
54+
cls, icon, title
55+
),
56+
scope: grid
57+
});
58+
}
59+
60+
return menu;
61+
};
62+
63+
Sendex.utils.renderActions = function (value, props, row) {
64+
var res = [];
65+
var cls, icon, title, action, item;
66+
for (var i in row.data.actions) {
67+
if (!row.data.actions.hasOwnProperty(i)) {
68+
continue;
69+
}
70+
var a = row.data.actions[i];
71+
if (!a['button']) {
72+
continue;
73+
}
74+
75+
icon = a['icon'] ? a['icon'] : '';
76+
if (typeof(a['cls']) == 'object') {
77+
if (typeof(a['cls']['button']) != 'undefined') {
78+
icon += ' ' + a['cls']['button'];
79+
}
80+
}
81+
else {
82+
cls = a['cls'] ? a['cls'] : '';
83+
}
84+
action = a['action'] ? a['action'] : '';
85+
title = a['title'] ? a['title'] : '';
86+
87+
item = String.format(
88+
'<li class="{0}"><button class="btn btn-default {1}" action="{2}" title="{3}"></button></li>',
89+
cls, icon, action, title
90+
);
91+
92+
res.push(item);
93+
}
94+
95+
return String.format(
96+
'<ul class="sendex-row-actions">{0}</ul>',
97+
res.join('')
98+
);
99+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Sendex.page.Home = function (config) {
2+
config = config || {};
3+
Ext.applyIf(config, {
4+
components: [{
5+
xtype: 'sendex-panel-home',
6+
renderTo: 'sendex-panel-home-div'
7+
}]
8+
});
9+
Sendex.page.Home.superclass.constructor.call(this, config);
10+
};
11+
Ext.extend(Sendex.page.Home, MODx.Component);
12+
Ext.reg('sendex-page-home', Sendex.page.Home);
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var Sendex = function (config) {
2+
config = config || {};
3+
Sendex.superclass.constructor.call(this, config);
4+
};
5+
Ext.extend(Sendex, Ext.Component, {
6+
page: {}, window: {}, grid: {}, tree: {}, panel: {}, combo: {}, config: {}, view: {}, utils: {}
7+
});
8+
Ext.reg('sendex', Sendex);
9+
10+
Sendex = new Sendex();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Sendex.panel.Home = function (config) {
2+
config = config || {};
3+
Ext.apply(config, {
4+
baseCls: 'modx-formpanel',
5+
layout: 'anchor',
6+
/*
7+
stateful: true,
8+
stateId: 'sendex-panel-home',
9+
stateEvents: ['tabchange'],
10+
getState:function() {return {activeTab:this.items.indexOf(this.getActiveTab())};},
11+
*/
12+
hideMode: 'offsets',
13+
items: [{
14+
html: '<h2>' + _('sendex') + '</h2>',
15+
cls: '',
16+
style: {margin: '15px 0'}
17+
}, {
18+
xtype: 'modx-tabs',
19+
defaults: {border: false, autoHeight: true},
20+
border: true,
21+
hideMode: 'offsets',
22+
items: [{
23+
title: _('sendex_items'),
24+
layout: 'anchor',
25+
items: [{
26+
html: _('sendex_intro_msg'),
27+
cls: 'panel-desc',
28+
}, {
29+
xtype: 'sendex-grid-items',
30+
cls: 'main-wrapper',
31+
}]
32+
}]
33+
}]
34+
});
35+
Sendex.panel.Home.superclass.constructor.call(this, config);
36+
};
37+
Ext.extend(Sendex.panel.Home, MODx.Panel);
38+
Ext.reg('sendex-panel-home', Sendex.panel.Home);

0 commit comments

Comments
 (0)