MODx.tree.Tree on Custom Manager Page

17 Sep 2012

Again what sounds simple sometimes, takes your day. Tried to get some data via MODX processor and bind it to a ExtJS tree.

Main mistakes: I tried to extend modObjectGetListProcessor  and not modObjectProcessor, for some reason I could not set the root node to results as other elements allow.

Known this and looking at core/model/modx/processors/security/group/getnodes.class.php make things clear.

So that’s what I came up with.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * Get a list of Tags
 *
 * @package modtours
 * @subpackage processors
 */
class TagGetNodesProcessor extends modObjectProcessor {
	public $classKey = 'Tag';
	public $languageTopics = array('modtours:default');
	public $defaultSortField = 'name';
	public $defaultSortDirection = 'ASC';
	public $objectType = 'modtours.tag';
 
	/*
	* Get list by parent
	*/    
	public function process() {
 
		// Get parent ID
		$parentId = str_replace('n_ug_','', $this->getProperty('id') );
 
		// Get child tags
		$tagList = $this->getTags($parentId);
 
		// Write list
		$newList = array();
			foreach( $tagList as $item ){
 
			// Check if children exist
			$itemChilds =  $this->getTags($item->get('id'));
			if( !empty($itemChilds) ){
				$leaf = false;
				$type = 'dir';
			}else{
				$leaf = true;
				$type = 'file';        	
			}
 
			// Write new node item
			$newList[] = array(
				'text' => $item->get('name'),       
				'name' => $item->get('name'),       		    	
				'description' => $item->get('description'),       
				'parentid' => $item->get('id'),
				'id' => 'n_ug_0' . $item->get('id'),
				'leaf' => $leaf,
				'type' => $type,
				'cls' => ''
			);
		}    
		return $this->toJSON($newList);
	}
	/*
	* Get results of tags by parent id
	*/
	protected function getTags($parentId) {
		$tagList = $this->modx->getCollection('Tag',array(
			'parentid' => $parentId
		));
		return $tagList;
	}	
}
return 'TagGetNodesProcessor';

And then just create your new tree Object

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
modTours.tree.Tags = function(config) {
    config = config || {};
    Ext.applyIf(config,{
        title: _('modtours.tags')
        ,id: 'modtours-tree-tags'
        ,url: modTours.config.connectorUrl 
        ,action: 'tag/getnodes'      
        ,root_id: '0'
        ,root_name: _('Tags')
        ,rootVisible: true
        ,ddAppendOnly: true
        ,useDefaultToolbar: true        
    });
    modTours.tree.Tags.superclass.constructor.call(this,config);
};
Ext.extend(modTours.tree.Tags,MODx.tree.Tree);
Ext.reg('modtours-tree-tags',modTours.tree.Tags);

Which you can use like

1
2
3
4
,items: [{
    xtype: 'modtours-tree-tags'
    ,preventRender: true
}]

Hope this helps..

MODX phpThumbOf not thumb images in IE

06 Jun 2012

Just had some strange problems with MODX phpThumbOf not showing generated thumbnails (right; only with Internet Explorer).

First thought it’s some MIME-TYPE configuration of the server, but this all seemed to be OK, after comparing my local Apache config with the live server the only difference was the missing GD Support.

And see there, installing (Ubuntu) the php5_dg package solved my problem.

1
2
# sudo apt-get install php5-gd
# sudo /etc/init.d/apache2 restart

Not sure why it didn’t work with IE, probably the generated thumb was in a wrong format or  ImageMagick (which was installed), caused some issues.

Anyway I’m glad it working.

Note: Make sure to delete all the old thumbnails from the MODX cache to make sure the are generated new.

My first official MODX extra

09 Mar 2012

Feels good, more will follow!

 

 

http://modx.com/extras/package/formitlog

https://github.com/sofasurfer/MODX-FormItLog

Run MODX, WordPress and Redmine on NGINX EC2 micro AIM

12 Feb 2012

I’m using amazon web services now for a while and was wondering, if it’s really necessary to host my  sites on a Small Instance

So I came across NGINX web server which is famous for it’s performance and low resource usage.

So here how to run,  MODXWordPress and Redmine with NGINX on a amzn-ami-2011.09.2.i386-ebs (ami-b4b0cae6) micro AIM  instance.

Thanks to:

Read the rest of this entry »

MODX FormLog hook to store formIt data in a jSon

28 Jan 2012

I was looking for a simple way to store FormIt data, so i came up with this simple hook:

MODX SuperBoxSelect For Dummies

21 Nov 2011

Dealing now more then one year with MODX revo and ExtJS, I thought it can’t be too hard to add a SuperBoxSelect component to a custom manager page. The fact that it’s now even  integrated in MODX  (thanks Ben), made me believe this will be a 5 min job (yeah i’m still an optimist and obviously there’s allot to learn).

Also there are plenty of information, forums and examples out there but it still took me almost half a night to puzzle them together and made it actually work.

So here, step by step what finally worked for me (not sure if this is the best solution so any input welcome).

Read the rest of this entry »

carsNcampers Motorhome Rental

06 Jun 2011

Compleate e-commerce solution for Australia and New Zealand cars/camper rental, based on MODX content management system.

Web sitecarsncampers.com
Design bytelosbrand.com

Features:

  • More then 10 supplier: Alpha Campervans, ApolloMotorhome, Backpacker Campers, Britz, Budget Rent-A-Car, Cheapa Campa, EuropcarHertz Rent-A-Car, Kea Campers, Kea Campers, MauiPacific Horizon, United Campervans
  • Dynamic flex rates import and price moddel
  • Fully futured booking engine
  • CRM: Compelate vehicle/rates management system

© Copyright 2010 carsNcampers.com

DizzyGoat MODX GTA Hotel Reservation System

26 Apr 2010

DizzyGoat is a hotel reservation system based on MODX.

Website: dizzzygoat.com

Features:

  • Supports multiple suppliers such as GTAKUONI andRESTEL.
  • Real time availability check with, instant confirmationbooking process.
  • XML driven payment gateway (eClearing) and PayPalintegration.
  • Closed user group with cancel and amend booking functionality for customers.
  • Fully featured CRM backend system with with affiliate stat’sand dynamic price model.
  • Customer revards points which can be used in previous bookings.

Screenshots:

Copyright © BARM International Ltd. All rights and images used under license.

Switch to our mobile site

Clicky