Author Topic: Bikin CMP non ExtJS  (Read 3315 times)

0 Members and 1 Guest are viewing this topic.

Offline crackers

  • Administrator
  • Full Member
  • *****
  • Posts: 166
  • Karma: +0/-0
Bikin CMP non ExtJS
« on: July 26, 2012, 09:25:50 PM »
hehehhe betul Masta sudah itu mah........sekarang itu gimana cara gantiin ke jquery yah ext jsnya?

ini coding di cotrollernya pada bagian mana yah harus dganti?

Code: [Select]
abstract class PackagesManagerController extends modExtraManagerController {
    /** @var Doodles $doodles */
    public $doodles;
    public function initialize() {
        $this->packages = new Package($this->modx);
 
        $this->addCss($this->packages->config['cssUrl'].'mgr.css');
        $this->addJavascript($this->packages->config['jsUrl'].'mgr/doodles.js');
        $this->addHtml('<script type="text/javascript">
        Ext.onReady(function() {
            Doodles.config = '.$this->modx->toJSON($this->packages->config).';
        });
        </script>');
        return parent::initialize();
    }
    public function getLanguageTopics() {
        return array('doodles:default');
    }
    public function checkPermissions() { return true;}
}
class IndexManagerController extends DoodlesManagerController {
    public static function getDefaultController() { return 'home'; }
}

Offline goldsky

  • tweets @_goldsky
  • Administrator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +1/-0
  • Less is more
    • Virtudraft Intermedia Telematika
Re: Bikin CMP non ExtJS
« Reply #1 on: July 26, 2012, 09:51:26 PM »
Ini gw kasih contoh controller gw, yang pake DOJO.

Code: (php) [Select]
<?php

require_once dirname(__FILE__) . '/model/myPackage.class.php';

abstract class 
myPackageManagerController extends modExtraManagerController {

    
/** @var myPackage $myPackage */
    
public $myPackage;

    public function 
initialize() {
        
$this->myPackage = new myPackage($this->modx);

        
$this->addCss($this->myPackage->configs['libsUrl'] . 'dtk/dijit/themes/claro/claro.css');
        
$this->addCss($this->myPackage->configs['libsUrl'] . 'dtk/dgrid/css/dgrid.css');
        
$this->addCss($this->myPackage->configs['libsUrl'] . 'dtk/dgrid/css/skins/claro.css');
        
$this->addCss($this->myPackage->configs['cssUrl'] . 'mgr.css');
        
$this->addHtml('
        <script type="text/javascript">
            var dojoConfig = {
                async: true,
                parseOnLoad: false
            };
            var myPackageConfigs = ' 
$this->modx->toJSON($this->myPackage->configs) . ';
        </script>'
);
        
$this->addJavascript($this->myPackage->configs['libsUrl'] . 'dtk/dojo/dojo.js');
        
$this->addJavascript($this->myPackage->configs['jsUrl'] . 'mgr/myPackage.class.js');
        
$this->addLastJavascript($this->myPackage->configs['jsUrl'] . 'mgr/myPackage.js');
        return 
parent::initialize();
    }

    public function 
getLanguageTopics() {
        return array(
'myPackage:default');
    }

    public function 
checkPermissions() {
        return 
true;
    }

}

class 
IndexManagerController extends myPackageManagerController {

    public static function 
getDefaultController() {
        return 
'home';
    }

}

Perhatian, di sini gw pake istilah "configs", bukan "config" kayak MODX, jadi elo sesuaikan aja sama yang elo pake, entah yang mana.
« Last Edit: July 26, 2012, 10:01:10 PM by goldsky »
Rico
Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!

Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets | IE 6 must die !

Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

PING ME ON TWITTER @_goldsky

Offline goldsky

  • tweets @_goldsky
  • Administrator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +1/-0
  • Less is more
    • Virtudraft Intermedia Telematika
Re: Bikin CMP non ExtJS
« Reply #2 on: July 26, 2012, 10:12:26 PM »
Setelah itu, pada file2 Javascript-nya, segala fungsi2 jQuery/DOJO/ js-js lainnya, wajib ditaro di dalam Ext.onReady().

Code: (js) [Select]

/**
 * Menjalankan Dojo di dalam Ext.onReady karena 'modx-content' panel sebagai tempat
 * CMP baru tersedia setelah selesai render.
 * 'modx-content' panel adalah komponen ModExt, jadi perlu ditunggu sampai selesai.
 */
Ext.onReady(function(){

    require([
        'dojo/ready',
        'dojo/_base/window',
        'dojo/_base/declare',
       
        /* .........  */
       
        'dojo/dom'
        ], function(
            ready, win, declare,
       
            /* .........  */
       
            dom
            ){
               
                /* segala isi fungsi-fungsi DOJO ada di sini */
               
               
        }); // require

// Ext.onReady
});

« Last Edit: July 26, 2012, 10:17:34 PM by goldsky »
Rico
Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!

Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets | IE 6 must die !

Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

PING ME ON TWITTER @_goldsky

Offline goldsky

  • tweets @_goldsky
  • Administrator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +1/-0
  • Less is more
    • Virtudraft Intermedia Telematika
Re: Bikin CMP non ExtJS
« Reply #3 on: August 03, 2012, 05:30:38 AM »
Satu lagi, tentang CSS-nya.
Code: (css) [Select]
#myPackage-panel-home-div {
    /* required to inherit ExtJs's wrapper */
    position: inherit;
    height: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
}
Jangan bikin position yang lain, karena sekali lagi, modx-content-nya gak bisa elo atur2 karena dia adalah komponen ExtJs.
Rico
Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!

Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets | IE 6 must die !

Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

PING ME ON TWITTER @_goldsky

 

term