Skip to content

Commit eb5ae03

Browse files
committed
Merge branch 'develop'
2 parents afd236c + cc1d569 commit eb5ae03

4 files changed

Lines changed: 45 additions & 10 deletions

File tree

assets/snippets/DocLister/core/controller/onetable.php

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function getDocs($tvlist = '')
4949
public function _render($tpl = '')
5050
{
5151
$out = '';
52+
$separator = $this->getCFGDef('outputSeparator', '');
5253
if ($tpl == '') {
5354
$tpl = $this->getCFGDef('tpl', '');
5455
}
@@ -127,6 +128,9 @@ public function _render($tpl = '')
127128
"item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page
128129
}
129130
$out .= $tmp;
131+
if (next($this->_docs) !== false) {
132+
$out .= $separator;
133+
}
130134
$i++;
131135
}
132136
}
@@ -208,7 +212,15 @@ protected function getDocList()
208212
$out = array();
209213
$sanitarInIDs = $this->sanitarIn($this->IDs);
210214
if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) {
215+
$from = $this->table . " " . $this->_filters['join'];
211216
$where = $this->getCFGDef('addWhereList', '');
217+
218+
//====== block added by Dreamer to enable filters ======
219+
$where = ($where ? $where . ' AND ' : '') . $this->_filters['where'];
220+
$where = sqlHelper::trimLogicalOp($where);
221+
//------- end of block -------
222+
223+
212224
if ($where != '') {
213225
$where = array($where);
214226
}
@@ -222,7 +234,8 @@ protected function getDocList()
222234
$limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0));
223235
$fields = $this->getCFGDef('selectFields', '*');
224236
$group = $this->getGroupSQL($this->getCFGDef('groupBy', ''));
225-
$rs = $this->dbQuery("SELECT {$fields} FROM {$this->table} {$where} {$group} {$this->SortOrderSQL($this->getPK())} {$limit}");
237+
$sort = $this->SortOrderSQL($this->getPK());
238+
$rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}");
226239

227240
$pk = $this->getPK(false);
228241
while ($item = $this->modx->db->getRow($rs)) {
@@ -240,9 +253,16 @@ protected function getChildrenList()
240253
{
241254
$where = array();
242255
$out = array();
243-
256+
$from = $this->table . " " . $this->_filters['join'];
244257
$tmpWhere = $this->getCFGDef('addWhereList', '');
245258
$tmpWhere = sqlHelper::trimLogicalOp($tmpWhere);
259+
260+
//====== block added by Dreamer to enable filters ======
261+
$tmpWhere = ($tmpWhere ? $tmpWhere . ' AND ' : '') . $this->_filters['where'];
262+
$tmpWhere = sqlHelper::trimLogicalOp($tmpWhere);
263+
//------- end of block -------
264+
265+
246266
if (!empty($tmpWhere)) {
247267
$where[] = $tmpWhere;
248268
}
@@ -282,12 +302,10 @@ protected function getChildrenList()
282302
}
283303
$fields = $this->getCFGDef('selectFields', '*');
284304
$group = $this->getGroupSQL($this->getCFGDef('groupBy', ''));
305+
$sort = $this->SortOrderSQL($this->getPK());
306+
$limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0));
285307
if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) {
286-
$rs = $this->dbQuery("SELECT {$fields} FROM " . $this->table . " " . $where . " " .
287-
$group . " " .
288-
$this->SortOrderSQL($this->getPK()) . " " .
289-
$this->LimitSQL($this->getCFGDef('queryLimit', 0))
290-
);
308+
$rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}");
291309

292310
$pk = $this->getPK(false);
293311

@@ -308,7 +326,14 @@ public function getChildrenCount()
308326
$out = 0;
309327
$sanitarInIDs = $this->sanitarIn($this->IDs);
310328
if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) {
329+
$from = $this->table . " " . $this->_filters['join'];
311330
$where = $this->getCFGDef('addWhereList', '');
331+
332+
//====== block added by Dreamer ======
333+
$where = ($where ? $where . ' AND ' : '') . $this->_filters['where'];
334+
$where = sqlHelper::trimLogicalOp($where);
335+
//------- end of block -------
336+
312337
if ($where != '') {
313338
$where = array($where);
314339
} else {
@@ -352,7 +377,7 @@ public function getChildrenCount()
352377
$group = $this->getGroupSQL($this->getCFGDef('groupBy', $this->getPK()));
353378
$maxDocs = $this->getCFGDef('maxDocs', 0);
354379
$limit = $maxDocs > 0 ? $this->LimitSQL($this->getCFGDef('maxDocs', 0)) : '';
355-
$rs = ("SELECT count(*) FROM (SELECT count(*) FROM {$this->table} {$where} {$group} {$limit}) as `tmp`");
380+
$rs = ("SELECT count(*) FROM (SELECT count(*) FROM {$from} {$where} {$group} {$limit}) as `tmp`");
356381
$out = $this->modx->db->getValue($rs);
357382
}
358383

assets/snippets/DocLister/core/controller/shopkeeper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function __construct($modx, $cfg = array(), $startTime = null)
3333
public function _render($tpl = '')
3434
{
3535
$out = '';
36+
$separator = $this->getCFGDef('outputSeparator', '');
3637
if ($tpl == '') {
3738
$tpl = $this->getCFGDef('tpl', '@CODE:<a href="[+url+]">[+pagetitle+]</a><br />');
3839
}
@@ -123,6 +124,9 @@ public function _render($tpl = '')
123124
"item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page
124125
}
125126
$out .= $tmp;
127+
if (next($this->_docs) !== false) {
128+
$out .= $separator;
129+
}
126130
$i++;
127131
}
128132
} else {

assets/snippets/DocLister/core/controller/site_content.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function getDocs($tvlist = '')
8888
public function _render($tpl = '')
8989
{
9090
$out = '';
91+
$separator = $this->getCFGDef('outputSeparator', '');
9192
if ($tpl == '') {
9293
$tpl = $this->getCFGDef('tpl', '@CODE:<a href="[+url+]">[+pagetitle+]</a><br />');
9394
}
@@ -176,10 +177,13 @@ public function _render($tpl = '')
176177
"item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page
177178
}
178179
$out .= $tmp;
180+
if (next($this->_docs) !== false) {
181+
$out .= $separator;
182+
}
179183
$i++;
180184
}
181185
} else {
182-
$noneTPL = $this->getCFGDef("noneTPL", "");
186+
$noneTPL = $this->getCFGDef('noneTPL', '');
183187
$out = ($noneTPL != '') ? $this->parseChunk($noneTPL, $sysPlh) : '';
184188
}
185189
$out = $this->renderWrap($out);

assets/snippets/FormLister/core/FormLister.abstract.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,12 @@ public function __construct(\DocumentParser $modx, $cfg = array())
145145
public function initForm()
146146
{
147147
$lexicon = $this->getCFGDef('lexicon');
148+
$langDir = $this->getCFGDef('langDir', 'assets/snippets/FormLister/core/lang/');
149+
$lang = $this->getCFGDef('lang', $this->modx->config['manager_language']);
148150
if ($lexicon) {
149151
$_lexicon = $this->config->loadArray($lexicon);
150152
if (isset($_lexicon[0])) {
151-
$lang = $this->lexicon->loadLang($_lexicon);
153+
$lang = $this->lexicon->loadLang($_lexicon, $lang, $langDir);
152154
} else {
153155
$lang = $this->lexicon->fromArray($_lexicon);
154156
}

0 commit comments

Comments
 (0)