Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from modxcms/Segr-develop
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Segr committed Feb 27, 2014
2 parents 79cc709 + e0dfb90 commit 623dd6a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
10 changes: 5 additions & 5 deletions assets/plugins/managermanager/mm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
);

// Add in TVs to the list of available fields
$all_tvs = $modx->db->makeArray($modx->db->select('name,type,id', $modx->getFullTableName('site_tmplvars'), '', 'name ASC'));
$all_tvs = $modx->db->makeArray($modx->db->select('name,type,id', $modx->db->config['table_prefix'].'site_tmplvars', '', 'name ASC'));
foreach ($all_tvs as $thisTv){
// What is the field name?
$n = $thisTv['name'];
Expand Down Expand Up @@ -210,13 +210,13 @@ function initJQddManagerManager(){
case 'OnPluginFormRender':
// The ID of the plugin we're editing
$plugin_id_editing = $e->params['id'];
$result = $modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$plugin_id_editing}'");
$result = $modx->db->select('name', $modx->db->config['table_prefix'].'site_plugins', "id='{$plugin_id_editing}'");
$plugin_editing_name = $modx->db->getValue($result);

// if it's the right plugin
if (strtolower($plugin_editing_name) == 'managermanager'){
// Get all templates
$result = $modx->db->select('templatename, id, description', $modx->getFullTableName('site_templates'), '', 'templatename ASC');
$result = $modx->db->select('templatename, id, description', $modx->db->config['table_prefix'].'site_templates', '', 'templatename ASC');
$all_templates = $modx->db->makeArray($result);

$template_table = '<table>';
Expand All @@ -235,7 +235,7 @@ function initJQddManagerManager(){
$template_table .= '</table>';

// Get all tvs
$result = $modx->db->select('name,caption,id', $modx->getFullTableName('site_tmplvars'), '', 'name ASC');
$result = $modx->db->select('name,caption,id', $modx->db->config['table_prefix'].'site_tmplvars', '', 'name ASC');
$all_tvs = $modx->db->makeArray($result);
$tvs_table = '<table>';
$tvs_table .= '<tr><th class="gridHeader">TV name</th><th class="gridHeader">TV caption</th><th class="gridHeader">ID</th></tr>';
Expand All @@ -252,7 +252,7 @@ function initJQddManagerManager(){
$tvs_table .= '</table>';

// Get all roles
$result = $modx->db->select('name, id', $modx->getFullTableName('user_roles'), '', 'name ASC');
$result = $modx->db->select('name, id', $modx->db->config['table_prefix'].'user_roles', '', 'name ASC');
$all_roles = $modx->db->makeArray($result);

$roles_table = '<table>';
Expand Down
12 changes: 6 additions & 6 deletions assets/plugins/managermanager/modx.ddtools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ public static function getDocuments($ids = array(), $published = false, $deleted
}else{
$limit = ($limit != "") ? "LIMIT $limit" : ""; // LIMIT capabilities - rad14701
// modify field names to use sc. table reference
$fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
$sort = ($sort == "") ? "" : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
$fields = 'sc.' . implode(',sc.', preg_replace("/^\s/i", "", explode(',', $fields)));
$sort = ($sort == "") ? "" : 'sc.' . implode(',sc.', preg_replace("/^\s/i", "", explode(',', $sort)));

if ($where != ''){
$where = 'AND '.$where;
Expand Down Expand Up @@ -592,8 +592,8 @@ public static function getTemplateVars($idnames = array(), $fields = "*", $docid
}

// get user defined template variables
$fields = ($fields == "") ? "tv.*" : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
$sort = ($sort == "") ? "" : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
$fields = ($fields == "") ? "tv.*" : 'tv.'.implode(',tv.', preg_replace("/^\s/i", "", explode(',', $fields)));
$sort = ($sort == "") ? "" : 'tv.'.implode(',tv.', preg_replace("/^\s/i", "", explode(',', $sort)));

if ($idnames == "*"){
$query = "tv.id<>0";
Expand Down Expand Up @@ -716,8 +716,8 @@ public static function getDocumentChildren($parentid = 0, $published = 1, $delet
}

// modify field names to use sc. table reference
$fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
$sortBy = ($sortBy == "") ? "" : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sortBy))));
$fields = 'sc.'.implode(',sc.', preg_replace("/^\s/i", "", explode(',', $fields)));
$sortBy = ($sortBy == "") ? "" : 'sc.'.implode(',sc.', preg_replace("/^\s/i", "", explode(',', $sortBy)));

// get document groups for current user
if ($docgrp = $modx->getUserDocGroups()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ function mm_widget_showimagetvs($tvs = '', $w = 300, $h = 100, $thumbnailerUrl =
';

// If we have a PHPThumb URL
$thumbnailerCode = '';
if (!empty($thumbnailerUrl)){
$thumbnailerCode = 'url = "'.$thumbnailerUrl.'?src="+escape(url)+"&w='.$w.'&h='.$h.'"; ' . "\n";
$output .= 'url = "'.$thumbnailerUrl.'?src="+escape(url)+"&w='.$w.'&h='.$h.'"; ' . "\n";
}

$output .= '
Expand All @@ -76,7 +75,6 @@ function mm_widget_showimagetvs($tvs = '', $w = 300, $h = 100, $thumbnailerUrl =
if (url != ""){
// Create a new preview
'.$thumbnailerCode.'
$j("#tv'.$tv['id'].'").parents("td").append("<div class=\"tvimage\" id=\"tv'.$tv['id'].'PreviewContainer\"><img src=\""+url+"\" style=\""+'.$style.'+"\" id=\"tv'.$tv['id'].'Preview\"/></div>");
// Attach a browse event to the picture, so it can trigger too
Expand Down
6 changes: 3 additions & 3 deletions manager/includes/document.parser.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@ function makeUrl($id, $alias= '', $args= '', $scheme= '') {
$f_url_prefix = $this->config['friendly_url_prefix'];
$f_url_suffix = $this->config['friendly_url_suffix'];
if (!is_numeric($id)) {
$this->messageQuit('`{$id}` is not numeric and may not be passed to makeUrl().');
$this->messageQuit('`' . $id . '` is not numeric and may not be passed to makeUrl()');
}
if ($args != '' && $this->config['friendly_urls'] == 1) {
// add ? to $args if missing
Expand Down Expand Up @@ -2766,8 +2766,8 @@ function getTemplateVars($idnames = array(), $fields = '*', $docid = '', $publis
"{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value",
$this->getFullTableName('site_tmplvars') . " tv
INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'"
"{$query} AND tvtpl.templateid = '{$docRow['template']}'",
LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'
{$query} AND tvtpl.templateid = '{$docRow['template']}'",
($sort ? "{$sort} {$dir}" : "")
);

Expand Down
2 changes: 1 addition & 1 deletion manager/includes/tmplvars.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function ParseIntputOptions($v) {
$a = array();
if(is_array($v)) return $v;
else if(is_resource($v)) {
$a = $modx->db->makeArray($v);
while ($cols = $modx->db->getRow($v,'num')) $a[] = $cols;
}
else $a = explode("||", $v);
return $a;
Expand Down

0 comments on commit 623dd6a

Please sign in to comment.