Skip to content

Commit

Permalink
Initial (working) commit for PDO SiteFusion rebuild.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Peeters committed Oct 22, 2013
1 parent fd84ae6 commit d54eeb4
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 295 deletions.
16 changes: 15 additions & 1 deletion class/customTree.js
Expand Up @@ -40,8 +40,9 @@ SiteFusion.Classes.CustomTree = Class.create( SiteFusion.Classes.Node, {
this.allowFileDrop = false;
this.sortable = false;

this.setEventHost( [ 'yield', 'openStateChange', 'cellValueChange', 'treeDrop', 'nodeDrop', 'fileDrop', 'sortColumn' ] );
this.element.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);

this.setEventHost( [ 'yield', 'openStateChange', 'cellValueChange', 'treeDrop', 'nodeDrop', 'fileDrop', 'sortColumn', 'itemClick', 'itemDoubleClick', 'itemContextClick' ] );
this.eventHost.yield.msgType = 1;
},

Expand Down Expand Up @@ -113,9 +114,22 @@ SiteFusion.Classes.CustomTree = Class.create( SiteFusion.Classes.Node, {
oThis.element.view = oThis.view;
var tc = oThis.element.getElementsByTagName('treechildren')[0];
tc.setAttribute( 'ondragstart', 'sfRootWindow.windowObject.SiteFusion.Registry['+oThis.cid+'].onDragStartEvent(event);' );
oThis.element.setAttribute( 'onclick', 'sfRootWindow.windowObject.SiteFusion.Registry['+oThis.cid+'].onItemEvent(event, \'itemClick\');' );
oThis.element.setAttribute( 'ondblclick', 'sfRootWindow.windowObject.SiteFusion.Registry['+oThis.cid+'].onItemEvent(event, \'itemDoubleClick\');' );
oThis.element.setAttribute( 'oncontextmenu', 'sfRootWindow.windowObject.SiteFusion.Registry['+oThis.cid+'].onItemEvent(event, \'itemContextClick\');' );
}, 1 );
this.hostWindow.windowObject.setTimeout(function() {oThis.element.columns.restoreNaturalOrder();},200);
},
onItemEvent: function ( eventObj, eventName ) {
var row = {}, column = {}, part = {};
this.element.boxObject.getCellAt(eventObj.clientX, eventObj.clientY, row, column, part);

if(row.value != -1) {
var rowId = this.view.visibleData[row.value].id;
var colIndex = column.value.index;
this.fireEvent( eventName, [ rowId, colIndex, part.value ] );
}
},

onDragStartEvent: function( event ) {
//nsDragAndDrop.startDrag( event, this.DragObserver );
Expand Down
15 changes: 15 additions & 0 deletions class/customTree.php.inc
Expand Up @@ -73,6 +73,9 @@ class XULCustomTree extends XULTree
$this->callMethod( 'setView' );

$this->setEvent( 'cellValueChange', MSG_SEND, $this, 'cellValueYieldCollect' );
$this->setEvent( 'itemClick', MSG_SEND, $this, 'itemClickHandler' );
$this->setEvent( 'itemDoubleClick', MSG_SEND, $this, 'itemDoubleClickHandler' );
$this->setEvent( 'itemContextClick', MSG_SEND, $this, 'itemContextClickHandler' );
$this->setEvent( 'treeDrop', MSG_SEND, $this, 'treeDropHandler' );
$this->setEvent( 'nodeDrop', MSG_SEND, $this, 'nodeDropHandler' );
$this->setEvent( 'fileDrop', MSG_SEND, $this, 'fileDropHandler' );
Expand All @@ -90,6 +93,18 @@ class XULCustomTree extends XULTree
$this->fireLocalEvent( 'cellUpdated', array( $this->dataSet->idToRow[$rowId], $this->dataSet->columns[$colId], $value ) );
}

public function itemClickHandler($e, $rowId, $colId, $part) {
$this->fireLocalEvent( 'itemClicked', array( $this->dataSet->idToRow[$rowId], $this->dataSet->columns[$colId], $part ) );
}

public function itemDoubleClickHandler($e, $rowId, $colId, $part) {
$this->fireLocalEvent( 'itemDoubleClicked', array( $this->dataSet->idToRow[$rowId], $this->dataSet->columns[$colId], $part ) );
}

public function itemContextClickHandler($e, $rowId, $colId, $part) {
$this->fireLocalEvent( 'itemContextClicked', array( $this->dataSet->idToRow[$rowId], $this->dataSet->columns[$colId], $part ) );
}

public function treeDropHandler( $e, $sourceTree, $sourceSelection, $targetRow, $orientation ) {
$selectedRows = array();
foreach ( explode(',',$sourceSelection) as $rowId ) {
Expand Down
3 changes: 2 additions & 1 deletion class/fileHandling.js
Expand Up @@ -305,7 +305,8 @@ SiteFusion.Classes.FileDownloader = Class.create( SiteFusion.Classes.Node, {
this.persistObject.saveURI(uri,null,null,null,null,this.targetFile,privacyContext);
}
} catch (e) {
SiteFusion.Error(e);
this.fireEvent( 'failed', [ this.localPath, e.name ] );
return;
}

this.fireEvent( 'started', [ this.localPath ] );
Expand Down
11 changes: 3 additions & 8 deletions conf/daemon.conf.example
Expand Up @@ -38,20 +38,15 @@ $SFCONFIG['sessionTimeout'] = 60 * 30;
// service client connection.
$SFCONFIG['serviceClientTimeout'] = 60 * 5;

// Database hostname or IP address
// This should be the database server that contains the SiteFusion database
$SFCONFIG['databaseHost'] = 'localhost';
//the DSN path for file based databases should be relative to the sitefusiond path
$WEBCONFIG['databaseDSN'] = "sqlite:../db/sfdb.sq3";
//$WEBCONFIG['databaseDSN'] = "mysql:host=127.0.0.1;dbname=sitefusion";

// Username and password for the database server
// This login is only used by the daemon, not by the child processes
$SFCONFIG['databaseUsername'] = 'root';
$SFCONFIG['databasePassword'] = 'dev';

// Database name
// The name of the database that SiteFusion uses to hold process information
$SFCONFIG['databaseName'] = 'sitefusion';


// Path to the SiteFusion directory
$SFCONFIG['sitefusionPath'] = '/usr/local/sitefusion';

Expand Down
14 changes: 3 additions & 11 deletions conf/webfrontend.conf.example
Expand Up @@ -18,24 +18,16 @@ $WEBCONFIG['port'] = 5173;

$WEBCONFIG['sitefusionPath'] = '/usr/local/sitefusion';


// Database hostname or IP address
// This should be the database server that contains the 'sitefusion' database

$WEBCONFIG['databaseHost'] = 'localhost';

//the DSN path for file based databases should be relative to www
$WEBCONFIG['databaseDSN'] = 'sqlite:db/sfdb.sq3"';
//$WEBCONFIG['databaseDSN'] = "mysql:host=127.0.0.1;dbname=sitefusion";

// Username and password for the database server
// This login is only used by the daemon, not by the child processes

$WEBCONFIG['databaseUsername'] = 'root';
$WEBCONFIG['databasePassword'] = 'dev';

// Database name
// The name of the database that SiteFusion uses to hold process information
$WEBCONFIG['databaseName'] = 'sitefusion';


// Seconds for a reverse-communication connection to keep polling before recycling

$WEBCONFIG['revCommTimeout'] = 30;
9 changes: 8 additions & 1 deletion daemon/app.php.inc
Expand Up @@ -700,7 +700,14 @@ class ApplicationProcess extends ExtendedSiteFusionProcess
if( !self::$Application )
return;

self::DatabaseQuery( "UPDATE `".self::$Options['databaseName']."`.`processes` SET `memory` = ".memory_get_usage().", `memory_peak` = ".memory_get_peak_usage().", `nodes` = ".count(self::$Application->registry->all)." WHERE `id` = '".self::$SessionID."' LIMIT 1" );
self::DatabaseQuery( "UPDATE ".self::$Database->tblProcesses." SET memory=?,memory_peak=?,nodes=? WHERE id=?",
array(
memory_get_usage(),
memory_get_peak_usage(),
count(self::$Application->registry->all),
self::$SessionID
)
);
}

static public function Header( $text ) {
Expand Down

0 comments on commit d54eeb4

Please sign in to comment.