Skip to content

Commit

Permalink
Fix CRC icons in tree
Browse files Browse the repository at this point in the history
  • Loading branch information
theboxer committed Aug 29, 2014
2 parents 860f853 + 1e757dc commit bd2f8c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/docs/changelog.txt
Expand Up @@ -2,6 +2,7 @@
This file shows the changes in recent releases of MODX. The most current release is usually the
development release, and is only shown to give an idea of what's currently in the pipeline.

- Fix CRC icons in tree
- Refresh/expand appropriate tree node when creating a resource using "quick create"
- Limit property set name/description length
- Added ability to update a namespace within a window
Expand Down
19 changes: 14 additions & 5 deletions core/model/modx/processors/resource/getnodes.class.php
Expand Up @@ -414,15 +414,20 @@ public function prepareResourceNode(modResource $resource) {

// Check for an icon class on the resource template
$tplIcon = $resource->Template ? $resource->Template->icon : '';
if (strlen($tplIcon) > 0) $iconCls[] = $tplIcon;


// Assign an icon class based on the class_key
$classKey = strtolower($resource->get('class_key'));
if (substr($classKey, 0, 3) == 'mod') {
$classKey = substr($classKey, 3);
}
$classKeyIcon = $this->modx->getOption('mgr_tree_icon_' . $classKey, null, 'tree-resource');
$iconCls[] = $classKeyIcon;

$classKeyIcon = $this->modx->getOption('mgr_tree_icon_' . $classKey, null, 'tree-resource', true);

if (!empty($tplIcon)) {
$iconCls[] = $tplIcon;
} else {
$iconCls[] = $classKeyIcon;
}

switch($classKey) {
case 'weblink':
Expand All @@ -444,7 +449,10 @@ public function prepareResourceNode(modResource $resource) {

// Modifiers to indicate resource _state_
if ($hasChildren || $resource->isfolder) {
$iconCls[] = $this->modx->getOption('mgr_tree_icon_folder', null, 'tree-folder');;
if (empty($tplIcon) && $classKeyIcon == 'tree-resource') {
$iconCls[] = $this->modx->getOption('mgr_tree_icon_folder', null, 'tree-folder');
}

$iconCls[] = 'parent-resource';
}

Expand All @@ -454,6 +462,7 @@ public function prepareResourceNode(modResource $resource) {
$iconCls[] = 'locked-resource';
/** @var modUser $lockedBy */
$lockedBy = $this->modx->getObject('modUser',$locked);

if ($lockedBy) {
$qtip .= ' - ' . $this->modx->lexicon('locked_by',array('username' => $lockedBy->get('username')));
}
Expand Down

0 comments on commit bd2f8c5

Please sign in to comment.