org.silex.core.Com

This class is the communication unit of SILEX : communication with php, javascript, mySql.  In the repository : /trunk/core/Com.as @class Com

Version

1

Author

Alexandre Hoyau

Summary
org.silex.core.ComThis class is the communication unit of SILEX : communication with php, javascript, mySql.
Variables
silex_ptrreference to silex main Api object (org.silex.core.Api)
connectionthe service object we use to call serverside php methods (with amfPhp)
Properties
gatewayUrlURL of the amfPhp gateway.
Variables
fscommandSupport_boolIs fscommand supported by the host? 
Functions
ComConstructor.
getDynDataCall getDynData webservice and returns these data: - constants: langage, ...
writeWebsiteConfigCall writeWebsiteConfig webservice to write into a website config file or to create a website.
duplicateWebsiteDuplicates a website.
listToolsFolderContentCalled by org.silex.ui.ToolsManager.
listFtpFolderContentCalled by toolbox.Library.
writeSectionDataCalled by org.silex.core.Application.save.
regenerateWebsiteIndexStart the indexation process on the server.
getLatestSilexVersionRetrieve the last available version of SILEX.
initJsComfscommand support detection.
jsCallCall this function to execute javascript code.
jsWindowStatusDisplay something in the browser status bar.
silexOnStatusCall the javascript onStatus loginSuccess { type:”loginSuccess”,login:login_str} logout loginError { type:”loginError”,fault:fault.fault.faultstring,message:silex_ptr.config.MESSAGE_AUTH_FAILD}

Variables

silex_ptr

private var silex_ptr: org.silex.core.Api

reference to silex main Api object (org.silex.core.Api)

connection

public var connection: NetConnection

the service object we use to call serverside php methods (with amfPhp)

Properties

gatewayUrl

function get gatewayUrl():String

URL of the amfPhp gateway.  Read only

Variables

fscommandSupport_bool

public var fscommandSupport_bool: Boolean

Is fscommand supported by the host?  If not we use getURL(“javascript:...

Functions

Com

function Com(api: org.silex.core.Api)

Constructor.

Parameters

param api a reference to the api singleton

getDynData

public function getDynData(websiteInfo: Object,
filesList: Array,
callback: Function)

Call getDynData webservice and returns these data: - constants: langage, ...  - dynamic data from a module - website data: layout, content folder, media folder - files to preload

Parameters

param websiteInfo an object containing any properties to be passed to the webservice in order to retrieve the desired data.  websiteInfo has to contain at least “id_site” property set to the website name.
param filesList an array of file names to be retrieved
param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which is an array of objects, one object for each file which contains key/value pairs. 

writeWebsiteConfig

public function writeWebsiteConfig(websiteInfo: Object,
id_site: String,
callback: Function)

Call writeWebsiteConfig webservice to write into a website config file or to create a website.

Parameters

param websiteInfo an object containing any properties to be passed to the webservice - if empty, delete the website from the server (move it in the trash/ folder ).
param id_site the website name.
param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which is a boolean : the success state of the operation server side. 

duplicateWebsite

public function duplicateWebsite(id_site: String,
newName_str: String,
callback: Function)

Duplicates a website.  The whole website folder is duplicated in contents/.

Parameters

param id_site the website name.
param newName_str the new website name.
param callback a function which will be called once the operation is done.  This function has to receive 1 parameter which a string : empty if everything is ok or the error message of the server side operation, or null if a network error occured. 

listToolsFolderContent

function listToolsFolderContent(relativePath: String,
callback: Function)

Called by org.silex.ui.ToolsManager.  Lists the tools folder.

Parameters

param relativePath the path of the folder to be listed, starting from the tools/ folder
param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which an array of objects.  Each object has the following properties : item type a string, either file or folder item size a number of bytes, result of the php function filesize item readable size a string, formated file size (e.g.  “50 Ko”) item name the file name item last modification date last modification date of the file (“Y-m-d\H:i:s”) item width only if the file is a jpg image item height only if the file is a jpg image itemContent an array of objects of the same type: recursive process - only for folders (items with type set to “folder”)

listFtpFolderContent

function listFtpFolderContent(relativePath: String,
callback: Function)

Called by toolbox.Library.

Parameters

param relativePath the path of the folder to be listed, starting from the tools/ folder
param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which an array of objects.  Each object has the following properties : item type a string, either file or folder item size a number of bytes, result of the php function filesize item readable size a string, formated file size (e.g.  “50 Ko”) item name the file name item last modification date last modification date of the file (“Y-m-d\H:i:s”) item width only if the file is a jpg image item height only if the file is a jpg image itemContent an array of objects of the same type: recursive process - only for folders (items with type set to “folder”)

writeSectionData

function writeSectionData(xmlData: String,
xmlFileName: String,
sectionName: String,
seoData_obj: Object,
callback: Function,
domObject: Object)

Called by org.silex.core.Application.save.  Write data to a file - could be a db.  The data corresponds to a section, i.e. a page with a deeplink.

Parameters

param xmlData the data to be stored - if empty, delete the section from the server.
param xmlFileName the file name or record id, a clean version of sectionName
param sectionName the section name
param seoData_obj object with key/value pairs to be stored in the index, i.e. searchable data
param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which is a string : empty if everything is ok or the error message of the server side operation

regenerateWebsiteIndex

function regenerateWebsiteIndex(callback: Function)

Start the indexation process on the server.

Parameters

param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which is the number of media indexed. 

getLatestSilexVersion

function getLatestSilexVersion(callback: Function)

Retrieve the last available version of SILEX.  Called by tools manager.

Parameters

param callback a function which will be called with the resulting data or null if an error occured.  This function has to receive 1 parameter which is a string: the latest stable version available. 

initJsCom

public function initJsCom()

fscommand support detection.  Start the process to determine if fscommand is supported by the host.

jsCall

public function jsCall(commande_str)

Call this function to execute javascript code.  Do not forget to place your javascript instructions in void(...).  @example jsCall(“void(alert(‘test1’); alert(‘test2’);)”);

Parameters

param commande_str the javascript command(s) you want to execute

jsWindowStatus

public function jsWindowStatus(etat_str: String)

Display something in the browser status bar.

Parameters

param etat_str the string to be displayed in the browser status bar

silexOnStatus

public function silexOnStatus(event: Object)

Call the javascript onStatus loginSuccess { type:”loginSuccess”,login:login_str} logout loginError { type:”loginError”,fault:fault.fault.faultstring,message:silex_ptr.config.MESSAGE_AUTH_FAILD}

private var silex_ptr: org.silex.core.Api
reference to silex main Api object (org.silex.core.Api)
public var connection: NetConnection
the service object we use to call serverside php methods (with amfPhp)
function get gatewayUrl():String
URL of the amfPhp gateway.
public var fscommandSupport_bool: Boolean
Is fscommand supported by the host? 
function Com(api: org.silex.core.Api)
Constructor.
public function getDynData(websiteInfo: Object,
filesList: Array,
callback: Function)
Call getDynData webservice and returns these data: - constants: langage, ...
public function writeWebsiteConfig(websiteInfo: Object,
id_site: String,
callback: Function)
Call writeWebsiteConfig webservice to write into a website config file or to create a website.
public function duplicateWebsite(id_site: String,
newName_str: String,
callback: Function)
Duplicates a website.
function listToolsFolderContent(relativePath: String,
callback: Function)
Called by org.silex.ui.ToolsManager.
function listFtpFolderContent(relativePath: String,
callback: Function)
Called by toolbox.Library.
function writeSectionData(xmlData: String,
xmlFileName: String,
sectionName: String,
seoData_obj: Object,
callback: Function,
domObject: Object)
Called by org.silex.core.Application.save.
function regenerateWebsiteIndex(callback: Function)
Start the indexation process on the server.
function getLatestSilexVersion(callback: Function)
Retrieve the last available version of SILEX.
public function initJsCom()
fscommand support detection.
public function jsCall(commande_str)
Call this function to execute javascript code.
public function jsWindowStatus(etat_str: String)
Display something in the browser status bar.
public function silexOnStatus(event: Object)
Call the javascript onStatus loginSuccess { type:”loginSuccess”,login:login_str} logout loginError { type:”loginError”,fault:fault.fault.faultstring,message:silex_ptr.config.MESSAGE_AUTH_FAILD}