Skip to content

Instantly share code, notes, and snippets.

@larscwallin
larscwallin / README.txt
Created September 14, 2011 14:02
simplx.controller, now with url routing
SIMPLX Controller V0.7
UPDATE 111109
NEW FEATURES:
- Added a whole bunch of modResource fields to the Request object. This means that you can route on stuff like:
pagetitle
template
@larscwallin
larscwallin / result.js
Created September 8, 2011 09:49
XPDO to simple ExtJS 3 Stores
var SimplxStudio = {};
SimplxStudio.modx = {};
/* Creating JSON representation for modAccess */
SimplxStudio.modx.modAccess={
"class": "modAccess",
"extends":"xPDOSimpleObject",
"fields": [
"id","alias","target","principal_class","principal","authority","policy"
@larscwallin
larscwallin / simplx.http.php
Created September 7, 2011 08:40
simplx.http
<?php
interface ISimplxHTTPProxy{
public function setBaseURL($url);
public function setServiceURI($uri);
public function login($usn,$psw);
public function logout();
public function get($res,$data);
public function post($res,$data);
public function patch($res,$data);
public function put($res,$data);
@splittingred
splittingred / prehook.profile.php
Created August 26, 2011 17:48
PreHook for FormIt to load User data into form
<?php
if (!$modx->user->hasSessionContext($modx->context->get('key')) return '';
$userArray = $modx->user->toArray();
$profile = $modx->user->getOne('Profile');
if ($profile) {
$userArray = array_merge($profile->toArray(),$userArray);
$extended = $profile->get('extended');
if (!empty($extended) && is_array($extended)) {
@anselmh
anselmh / prerender-avoid-ga.js
Created June 27, 2011 09:15
prerender-avoid-ga
// if you have analytics, set them in pagevisibility mode to get real-user-trackig according to prerender-issues in Chrome/WebKit.
var viewCounted = false;
function handleVisibilityChange(evt) {
//Only count the view once we're done prerendering AND the document is done loading
if (document.webkitVisibilityState == 'prerender'
|| document.readyState != 'complete' || viewCounted)
return;
/* Implementation of view counting system starts here */
// Code for Google Analytics | Change UA-XXXXX-X to be your site's ID
<?php
if ($modx->event->name == 'OnManagerPageInit') {
$script = <<<SCRIPT
<script type="text/javascript">
Ext.ComponentMgr.onAvailable('modx-panel-resource', function(){
Ext.getCmp('modx-panel-resource').on('ready', function(){
window.setTimeout(function(){Ext.getCmp('modx-panel-resource').markDirty()}, 250);
})
})
</script>
@splittingred
splittingred / gist:1018793
Created June 10, 2011 13:05
Hide left trees in MODX Revolution
Ext.onReady(function() {
Ext.getCmp('modx-layout').hideLeftbar();
});
/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* [email protected]
* http://www.extjs.com/license
*/
Ext.onReady(function(){
Ext.QuickTips.init();
@larscwallin
larscwallin / gridFilter.js
Created June 8, 2011 21:55
ExtJs Grid filter
/**
* Ext.ux.grid.GridFilters v0.2.8
**/
Ext.namespace("Ext.ux.grid");
/* PATCH http://extjs.com/forum/showthread.php?t=76280 */
Ext.override(Ext.grid.GridView, {
handleHdMenuClick : function(item){
var index = this.hdCtxIndex,
cm = this.cm,
@lossendae
lossendae / linked_combobox.js
Created June 8, 2011 09:50
Combobox linké
var firstCombo = new Ext.form.ComboBox({
store: store_combo_1,
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
id:'combo1'
});