Sitefusion CKEditor v 3.0 – Xpi extension – new version Extended

New version with extended classes

XULCKEditor : Complete editor

XULDataEditorSimple : Simple editor with basic options

XULDataEditorSwitch : Switch panel between editor and HTML viewer

Download : CKeditor SiteFusion

Posted in Uncategorized | Leave a comment

Sitefusion CKEditor v 3.0 – Xpi extension BETA 0.1

Installation :

in sitefusion server dir “components

add files :
sf_ckeditor.js
sf_ckeditor.php.inc

in sitefusion server dir “extensions

add file :
sf_ckeditor@oracoltech.com.xpi

Add this two lines of code in your project file :

RequireExtension( “sf_ckeditor@oracoltech.com”);
LoadClass( ‘sf_ckeditor’, ‘components’ );

Theme default : v2

future steps :

  1. a really simple editor ( bold , list , underline, italic ).
  2. Runtime commands and config parameters from php
  3. a CKEditor FileManager plugin SiteFusion specific

Enjoy, Fully functional still in beta.

Download : sf_ckeditor_beta

Posted in SiteFusion | Leave a comment

XUL SVG images :: easy with SiteFusion

With a little modification that will be implemented in the next version :

add this code at the end of file : class/textAndImages.php.inc

class XULImageSvg extends Node
{

public $remoteConstructor = ‘ImageSvg’;
public $width = NULL;
public $height = NULL;
public $imagePath = NULL;

private $transferStarted = FALSE;
private $transferSize = NULL;

public function __construct( $path = NULL, $width = NULL, $height = NULL ) {
if( $path !== NULL )
$this->src( $path );
if( $width !== NULL )
$this->width( $width );
if( $height !== NULL )
$this->height( $height );

parent::__construct();
}

public function attach() {
$this->createRemoteObject( array( $this->hostWindow, $this->width, $this->height ) );
$this->insertElement();
$this->setStyle(‘display’,'inline-block’);
if ($this->imagePath !== NULL)
$this->callMethod( ‘load’ );
}

public function src($path) {
$this->imagePath = $path;

if( $this->isRegistered )
$this->callMethod(“load”);
}

/**
* [INTERNAL FUNCTION]
* This function is called by the daemon to start a transfer. It returns an array
* of two elements, first is a string with the MIME content-type of the data, and
* second is a integer number containing the size in bytes of the transfer.
*
* @return array Transfer descriptives
*/

public function transferStart() {
$this->transferStarted = TRUE;
if( !file_exists($this->imagePath) )
$this->imagePath = ApplicationProcess::GetOption(‘sitefusionPath’) . $this->imagePath;

if (file_exists($this->imagePath) && strtolower(substr($this->imagePath,-3) == ‘svg’) ) {
$this->transferSize = filesize($this->imagePath);
return array( ‘image/svg+xml’, $this->transferSize );
}
else return FALSE;
}

/**
* [INTERNAL FUNCTION]
* This function is called by the daemon to get (a piece of) data of a transfer.
* It should output this data to the output buffer, which will be intercepted
* by the daemon.
*/

public function transferGetData() {
if( !$this->transferStarted )
throw new SFException( “File transfer not started!”, ERR_REPORT_APP );

readfile( $this->imagePath );
}

/**
* [INTERNAL FUNCTION]
* This function is called by the daemon when all data has been transferred.
* It is used to close open filehandles and clean up.
*/

public function transferEnd() {
$this->transferStarted = FALSE;
$this->transferSize = NULL;
}
}

add this lines at the end of file class/textAndImages.js

SiteFusion.Classes.ImageSvg = Class.create( SiteFusion.Classes.Node, {
sfClassName: ‘XULImageSvg’,

initialize: function( win, width, height ) {
this.hostWindow = win;
this.element = win.createElement( ‘bbox’ );
this.element.sfNode = this;

this.setEventHost();

if( width )
this.width( width );
if( height )
this.height( height );
},

load: function() {
var d = new Date();
var xmlDoc = new XMLHttpRequest();
xmlDoc.open(
“GET”
, SiteFusion.Address + ‘/filestream.php?app=’ + SiteFusion.Application + ‘&args=’ + SiteFusion.Arguments + ‘&sid=’ + SiteFusion.SID + ‘&ident=’ + SiteFusion.Ident + ‘&cid=’ + this.cid + ‘&cycle=’ + d.getTime()
, false
);
xmlDoc.send(null);

var eXml = xmlDoc.responseXML.getElementsByTagName(‘svg’)[0];

if(eXml.getAttributeNode(“width”) != null && eXml.getAttributeNode(“height”) != null) {

var othisWidth = parseInt(this.element.getAttributeNode(“width”).nodeValue);
var othisHeight = parseInt(this.element.getAttributeNode(“height”).nodeValue);

var svgOriWidth = parseInt(eXml.getAttributeNode(“width”).nodeValue);
var svgOriHeight = parseInt(eXml.getAttributeNode(“height”).nodeValue);

var scaleFactorWidth = othisWidth / svgOriWidth;
var scaleFactorHeight = othisHeight / svgOriHeight;

//eXml.setAttribute(“width”,svgOriWidth);
//eXml.setAttribute(“height”,svgOriHeight);
eXml.removeAttribute(“width”);
eXml.removeAttribute(“height”);

eXml.setAttribute(“viewBox”,’0 0 ‘+svgOriWidth+’ ‘+svgOriHeight+”);
//eXml.setAttribute(“preserveAspectRatio”,”xMidYMid meet”);

var transform = xmlDoc.responseXML.createElement(‘g’);
//alert(‘scale(‘+scaleFactorWidth+’,'+scaleFactorHeight+’)');
transform.setAttribute(‘transform’,'scale(‘+scaleFactorWidth+’, ‘+scaleFactorHeight+’)');

while(eXml.length > 0) {
transform.appendChild(eXml.childNodes[0]);
eXml.removeChild(eXml.childNodes[0]);
}

eXml.appendChild(transform);
}

var node = this.hostWindow.windowObject.document.importNode(eXml, true);
this.element.appendChild( node );
//var dummy = document.createTextNode(‘x’);
//this.element.appendChild( dummy );
}
} );

After this modification you have SVG images with scale support and you can use like this

XULImageSvg($srcPath,$width,$height);

really simple! ;)

Posted in SiteFusion | Leave a comment

XULStdAppMenu :: 10 lines of code to create really deeper menu in SiteFusion

USAGE :

// Istantiate and add the classto the Application window

$this->window->addChild(
$top = new XULStdAppMenu()
);

// Only create root menu is required, after you can “overwrite” and redeclare all menu
// without any problem because after the first creation, the class recall the created menu

$top->addMenuRoot(‘File’,NULL); OR $top->addMenuRoot(‘File’,NULL,[b]TRUE[/b]); to add the root menu on the right

// Add a standard application menu
$top->addMenu(
'File','File'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

Examine : $top->addMenu('File','File',array(menus) );

add menu or menu contained in array(Somemenus) to rootMenu(‘File’) in group(‘File’)

Examine : array('New', $this, 'noEventYet')
New = the label of the menu
$this->noEventYet();

Examine : array(NULL,NULL,NULL) // it's a separator

Attention : After you call the method addMenuRoot ( ex.  $top->addMenuRoot(‘File’,NULL); )

you can do this :

$top->addMenu(
'File','FileSubMenu'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

or this :

$top->addMenu(
'File','FileSubMenu'
,array(array('New', $this, 'noEventYet'))
);

$top->addMenu(
'File','FileSubMenu'
,array(array('File', $this, 'noEventYet'))
);

$top->addMenu(
'File','FileSubMenu'
,array(array('Exit', $this, 'noEventYet'))
);

or this :

$top->addMenu(
'File','FileSubMenu'
,array(array('New', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubMenu','FileSubSubMenu'
,array(array('File', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubSubMenu','FileSubSubSubMenu'
,array(array('Exit', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubSubSubMenu','FileSubSubSubMenu'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

Or Like this :

$top->addMenuRoot(‘TestDeepRef’,NULL);
$top->addMenuRoot(‘TestDeepRef’,'TestDeepRef2′);
$top->addMenuRoot(‘TestDeepRef2′,’TestDeepRef3′);
$top->addMenuRoot(‘TestDeepRef3′,’TestDeepRef4′);

$top->addMenu(
‘TestDeepRef4′
,’TestDeepRef4′
,array(
array(‘openAbout’, $this, ‘openAbout’),
array(‘openAboutMemory’, $this,’openAboutMemory’),
array(‘openExtensions’, $this, ‘openExtensions’),
array(‘openErrorConsole’,$this,’openErrorConsole’)
)
);

$top->addMenu(
‘TestDeepRef3′
,’TestDeepRef3′
,array(
array(‘openAbout’, $this, ‘openAbout’),
array(‘openAboutMemory’, $this,’openAboutMemory’),
array(‘openExtensions’, $this, ‘openExtensions’),
array(‘openErrorConsole’,$this,’openErrorConsole’)
)
);

Sitefusion it’s really simple to use and extends!

File Download : testTopMenu.startup.php

Posted in SiteFusion | Leave a comment

XULAdvancedTabBox

XULAdvancedTabBox

  • addTabbedPanel ( $name,  $panel, [ $background = false])
    • $name = name of the tab
    • $panel = The Component to added
    • $background = will be add in background
  • closeActiveTab ([ $e = NULL])
    • Close the active panel
  • closeAll ([ $e = NULL], [ $leaveActive = FALSE], [ $posActive = -1])
    • Close all panel if $leaveActive is true doesn’t close the active panel
  • closeAllNoActive ([ $e = NULL])
    • Close All non active panels ( it’s a shortcut to $this->closeAll(NULL, TRUE))
  • isEmpty ()
  • removeTabbedPanel ( $panel)
  • removeTabbedTab ( $tab)
  • addHideComponentIfEmpty($component)
    • add a component to hide when empty if setIfEmptyFlexZero(TRUE)
  • setIfEmptyFlexZero ( $bool)
    • if set TRUE, when the component isEmpty(TRUE) , autohide itself and all componets add with method addHideComponentIfEmpty($component)

File Download : testAdvTabBox.startup.php

Posted in SiteFusion | Leave a comment

VirtueMart : get All Parent Child Categories IDs By Category Root

SELECT SQL_CACHE
CONCAT_WS(
',',
GROUP_CONCAT(DISTINCT lev01.category_child_id),
GROUP_CONCAT(DISTINCT lev02.category_child_id),
GROUP_CONCAT(DISTINCT lev03.category_child_id),
GROUP_CONCAT(DISTINCT lev04.category_child_id),
GROUP_CONCAT(DISTINCT lev05.category_child_id)
) as deepListCatIds
FROM jos_vm_category_xref lev01
LEFT OUTER JOIN jos_vm_category_xref lev02 ON lev01.category_child_id = lev02.category_parent_id
LEFT OUTER JOIN jos_vm_category_xref lev03 ON lev02.category_child_id = lev03.category_parent_id
LEFT OUTER JOIN jos_vm_category_xref lev04 ON lev03.category_child_id = lev04.category_parent_id
LEFT OUTER JOIN jos_vm_category_xref lev05 ON lev04.category_child_id = lev05.category_parent_id
WHERE lev01.category_parent_id =6;

Result = 12,20,21,22,23,24,25,48,89,92,99,114,19,93,104

Posted in MySql | Leave a comment

VirtueMart : Parent Child Category

SELECT
lev01.category_child_id id_01, tblname01.category_name name_01,
lev02.category_child_id id_02, tblname02.category_name name_02,
lev03.category_child_id id_03, tblname03.category_name name_03,
lev04.category_child_id id_04, tblname04.category_name name_04
FROM jos_vm_category_xref lev01
LEFT OUTER JOIN jos_vm_category_xref lev02 ON lev01.category_child_id = lev02.category_parent_id
LEFT OUTER JOIN jos_vm_category_xref lev03 ON lev02.category_child_id = lev03.category_parent_id
LEFT OUTER JOIN jos_vm_category_xref lev04 ON lev03.category_child_id = lev04.category_parent_id
LEFT JOIN jos_vm_category tblname01 ON tblname01.category_id = lev01.category_child_id
LEFT JOIN jos_vm_category tblname02 ON tblname02.category_id = lev02.category_child_id
LEFT JOIN jos_vm_category tblname03 ON tblname03.category_id = lev03.category_child_id
LEFT JOIN jos_vm_category tblname04 ON tblname04.category_id = lev04.category_child_id
WHERE lev01.category_parent_id = 0;

id_01 name_01 id_02 name_02 id_03 name_03 id_04 name_04
10 ABBIGLIAMENTO CACCIA E PESCA 16 Stivali in gomma e in pvc (NULL) (NULL) (NULL) (NULL)
10 ABBIGLIAMENTO CACCIA E PESCA 90 Impermeabili e antipioggia (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 15 Borracce e Thermos (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 27 Impermeabili e antipioggia (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 28 Sacchi a pelo (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 29 Zaini (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 107 Navigatori GPS (NULL) (NULL) (NULL) (NULL)
7 MONTAGNA 115 Calze (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 12 tute e pantaloni con pettorina (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 20 Calzature antinfortunistiche (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 21 Stivali in gomma e in pvc (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 22 Abbigliamento da sala/servizio (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 23 Abbigliamento da cuoco/cucina (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 24 Impermeabili e antipioggia (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 25 Giacche e Giubbini in tela (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 48 Pantaloni (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 89 Abbigliamento Sanitario – Ospedaliero (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 92 Vestaglie, Casacche, Camici 19 Vestaglie DONNA (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 92 Vestaglie, Casacche, Camici 93 Camici, Casacche UOMO (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 92 Vestaglie, Casacche, Camici 104 Casacche DONNA (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 99 Caschi, cuffie, occhiali protettivi (NULL) (NULL) (NULL) (NULL)
6 ABITI DA LAVORO E ANTINFORTUNISTICA 114 Calze (NULL) (NULL) (NULL) (NULL)
9 SUBACQUEA 18 Pinne (NULL) (NULL) (NULL) (NULL)
9 SUBACQUEA 94 Maschere (NULL) (NULL) (NULL) (NULL)
9 SUBACQUEA 95 Fucili (NULL) (NULL) (NULL) (NULL)
9 SUBACQUEA 97 Coltelli (NULL) (NULL) (NULL) (NULL)
9 SUBACQUEA 98 Torce (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 35 Verande per caravan,roulotte, camper, van ed accessori 49 Accessori Verande per caravan/roulotte (NULL) (NULL)
8 CAMPEGGIO 35 Verande per caravan,roulotte, camper, van ed accessori 50 Verande per caravan/roulotte e camper mod. speciali e invernali (NULL) (NULL)
8 CAMPEGGIO 35 Verande per caravan,roulotte, camper, van ed accessori 77 Verande per caravan/roulotte tradizionali (NULL) (NULL)
8 CAMPEGGIO 35 Verande per caravan,roulotte, camper, van ed accessori 105 Verande per caravan/roulotte – Teli ombra – Tendalini (NULL) (NULL)
8 CAMPEGGIO 35 Verande per caravan,roulotte, camper, van ed accessori 116 Verande-Tendalini automatici per camper e caravan (NULL) (NULL)
8 CAMPEGGIO 45 Borracce, Thermos e contenitori termici (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 39 Pentole, stoviglie, gavette ecc. 72 Gavette,pentole,popote (NULL) (NULL)
8 CAMPEGGIO 39 Pentole, stoviglie, gavette ecc. 73 Posate – Bicchieri (NULL) (NULL)
8 CAMPEGGIO 39 Pentole, stoviglie, gavette ecc. 74 Stoviglie Melamina e vari articoli cucina (NULL) (NULL)
8 CAMPEGGIO 40 Mobili cucina portafornello (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 42 Accessori e ricambi tende e verande (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 43 Accessori caravan e camper 113 Accessori di allestimento interno (NULL) (NULL)
8 CAMPEGGIO 43 Accessori caravan e camper 112 Accessori di allestimento esterno (NULL) (NULL)
8 CAMPEGGIO 43 Accessori caravan e camper 111 Varie accessori caravan e camper (NULL) (NULL)
8 CAMPEGGIO 44 Frigoriferi e frigoborse 69 Frigoriferi elettrici e trivalenti (NULL) (NULL)
8 CAMPEGGIO 44 Frigoriferi e frigoborse 70 Frigoborse morbide (NULL) (NULL)
8 CAMPEGGIO 44 Frigoriferi e frigoborse 71 Ghiacciaie (NULL) (NULL)
8 CAMPEGGIO 46 Armadi e Porta Oggetti 79 Armadi-Mobiletti (NULL) (NULL)
8 CAMPEGGIO 46 Armadi e Porta Oggetti 80 Tasche portaoggetti – portanecessaire (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 30 Tende da campeggio Igloo 2/3 p. (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 31 Tende da campeggio Igloo 4/5 p. (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 32 Tende da campeggio Igloo 4/8 p. e MAXI (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 33 Tende da campeggio Canadesi (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 34 Tende da campeggio Casetta (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 36 Tende da campeggio Cucinotti e Multiuso (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 37 Tende da campeggio da Pesca/ripari outdoor (NULL) (NULL)
8 CAMPEGGIO 47 Tende da campeggio ed accessori 64 Tende da Spiaggia – Paravento e Parasole (NULL) (NULL)
8 CAMPEGGIO 52 Gas – Fornelli, Lampade Ricambi ecc. 53 Fornelli (NULL) (NULL)
8 CAMPEGGIO 52 Gas – Fornelli, Lampade Ricambi ecc. 41 Accessori e ricambi gas (NULL) (NULL)
8 CAMPEGGIO 52 Gas – Fornelli, Lampade Ricambi ecc. 54 Lampade (NULL) (NULL)
8 CAMPEGGIO 56 Sedie – Tavoli 75 Sedie – Sgabelli – Sdraio (NULL) (NULL)
8 CAMPEGGIO 56 Sedie – Tavoli 76 Tavoli (NULL) (NULL)
8 CAMPEGGIO 57 Lettini – Brandine (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 58 Sacchi letto 101 Sacchi letto a coperta e Pronto letto (NULL) (NULL)
8 CAMPEGGIO 58 Sacchi letto 102 Sacchi letto a coperta con cappuccio (NULL) (NULL)
8 CAMPEGGIO 58 Sacchi letto 103 Sacchi letto a mummia (NULL) (NULL)
8 CAMPEGGIO 59 Pompe e Gonfiatori (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 60 Taniche – Serbatoi – Docce (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 61 Teloni (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 62 Stuoie e Pavimenti (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 63 Zaini (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 65 Wc chimici, accessori,liquidi (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 66 Amache – Ombrelloni (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 67 Grill e Barbecue (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 68 Varie Outdoor (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 81 Materassini – Cuscini ecc. 26 Materassini – Cuscini (NULL) (NULL)
8 CAMPEGGIO 81 Materassini – Cuscini ecc. 82 Materassini – ricambi e accessori (NULL) (NULL)
8 CAMPEGGIO 100 Gazebo (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 106 Lampade e Torce elettriche (NULL) (NULL) (NULL) (NULL)
8 CAMPEGGIO 108 Navigatori GPS (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 14 Tender, canotti gonfiabili (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 83 Fuoribordo-accessori e ricambi motori (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 84 Canoe gonfiabili (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 85 Remi – Pagaie – Mezzi marinai (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 86 Accessori di allestimento e Varie (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 87 OSCULATI Accessori nautici (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 88 Teloni (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 96 Elettronica (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 117 Dotazioni di Sicurezza (NULL) (NULL) (NULL) (NULL)
11 NAUTICA 118 Ormeggio (NULL) (NULL) (NULL) (NULL)

Interrogazione MySql direttamente dal sito : ACS Cremona

Posted in MySql | Leave a comment