| Package | com.thirdavedesign.drupalSite |
| Class | public class DrupalSite |
| Inheritance | DrupalSite Amf |
| Implements | flash.events.IEventDispatcher |
DrupalSite provides high-level methods for invoking and retrieving data from Drupal services. This class requires the Amf connection class, which provides basic methods for establishing and handling the Amf connection with Drupal.
The DrupalSite class must be instantiated. After the class is instantiated and the gateway URL is provided, DrupalSite attempts to establish a connection and invoke the system.connect Drupal service method. If this is successful, the session ID is retrieved, the CONNECTED property is set to true, and the COMPLETE event is dispatched. Also, if the session is for an already authenticated user, then the USER and UID properties are set.
If the user is not yet authenticated, then the login method can be used for authenticating the current user via the user.login Drupal service method.
DrupalSite also provides the following methods for accessing Drupal services:
| Drupal service method | DrupalSite method |
|---|---|
| taxonomy.getTree | getCategory |
| node.load | getNode |
| view.getView | getView |
| node.delete | nodeDelete |
| node.save | nodeSave |
| system.mail | sendMail |
These methods implement some basic measures to improve the reliability and speed of calling Drupal services. First, these methods use an internal blocking system for retrying delayed or broken connections. Second, three methods (getCategory, getNode, and getView) save the results to a cache so that some subsequent calls may not need to fetch duplicate data. These methods include an argument to ignore cached data.
| Property | Defined by | ||
|---|---|---|---|
![]() | apiKey : String = ""
API key for Drupal services.
| Amf | |
| CONNECTED : Boolean = false
Status variable for whether DrupalSite is currently connected.
| DrupalSite | ||
| Event_DATA : String = "Event_DATA" [static]
Event definition for new data.
| DrupalSite | ||
| Event_ERROR : String = "Event_ERROR" [static]
Event definition for error.
| DrupalSite | ||
| GATEWAY : String
URL to Drupal services AMFPHP gateway.
| DrupalSite | ||
![]() | gatewayUrl : String = ""
URL to the Drupal services AMFPHP gateway.
| Amf | |
| KEY : String
API key for Drupal services AMFPHP gateway.
| DrupalSite | ||
![]() | sessionId : String = ""
Session ID from successful connection to Drupal services.
| Amf | |
| UID : int = 0
Drupal user ID of authenticated user.
| DrupalSite | ||
| USER : Object
Drupal user object of authenticated user.
| DrupalSite | ||
| VERBOSE : Boolean = true
Determines whether debug printout is enabled.
| DrupalSite | ||
| Method | Defined by | ||
|---|---|---|---|
|
DrupalSite(gatewayUrl:String = "", apiKey:String = "")
Creates a new DrupalSite instance.
| DrupalSite | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
| DrupalSite | ||
|
amfConnect():void
Invokes Drupal system.connect service method using the blocking routines.
| DrupalSite | ||
![]() |
connect(onSuccess:Function):void
Invoke Drupal system.connect service method to establish connection
with Drupal services.
| Amf | |
|
dispatchEvent(evt:Event):Boolean
| DrupalSite | ||
|
getCategory(vid:int, tid:int, callback:Function, data:Object = null, reload:Boolean = false):Boolean
Invokes the Drupal taxonomy.getTree service method for retrieving nodes
associated with a category or term.
| DrupalSite | ||
|
getNode(nid:int, callback:Function, data:Object = null, reload:Boolean = false):Boolean
Invokes the Drupal node.load service method for retrieving a node.
| DrupalSite | ||
|
getView(viewname:String, callback:Function, data:Object = null, reload:Boolean = false):Boolean
Invokes the Drupal view.getView service method for retrieving nodes from a view.
| DrupalSite | ||
|
hasEventListener(type:String):Boolean
| DrupalSite | ||
|
login(username:String, password:String, callback:Function = null, data:Object = null):Boolean
Invokes the Drupal user.login service method to authenticate a user.
| DrupalSite | ||
|
nodeDelete(nid:int, callback:Function = null, data:Object = null):Boolean
Invokes the Drupal node.delete service method for deleting a node.
| DrupalSite | ||
|
nodeSave(node:Object, callback:Function = null, data:Object = null):Boolean
Invokes the Drupal node.save service method for saving a node.
| DrupalSite | ||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
| DrupalSite | ||
|
sendMail(addrTo:String, subject:String, body:String, addrFrom:String = "", mailKey:String = "service-system-mail", headers:Array = null, callback:Function = null, data:Object = null):Boolean
Invokes the Drupal system.mail service method to send an e-mail.
| DrupalSite | ||
![]() |
service(onSuccess:Function, onFault:Function, command:String, ... args):Boolean
Invoke Drupal services method.
| Amf | |
|
willTrigger(type:String):Boolean
| DrupalSite | ||
| Constant | Defined by | ||
|---|---|---|---|
| DATE : String = "8.27.2008" [static]
Engine version date.
| DrupalSite | ||
| LICENSE : String = "DrupalSite by Third Ave Design. Licensed under GPLv3." [static]
Engine license.
| DrupalSite | ||
| NAME : String = "DrupalSite" [static]
Engine name.
| DrupalSite | ||
| VERSION : String = "Alpha 0.5 - release/Public" [static]
Engine version.
| DrupalSite | ||
| CONNECTED | property |
public var CONNECTED:Boolean = falseStatus variable for whether DrupalSite is currently connected.
| Event_DATA | property |
public static var Event_DATA:String = "Event_DATA"Event definition for new data.
| Event_ERROR | property |
public static var Event_ERROR:String = "Event_ERROR"Event definition for error.
| GATEWAY | property |
public var GATEWAY:StringURL to Drupal services AMFPHP gateway.
| KEY | property |
public var KEY:StringAPI key for Drupal services AMFPHP gateway.
| UID | property |
public var UID:int = 0Drupal user ID of authenticated user.
| USER | property |
public var USER:ObjectDrupal user object of authenticated user.
| VERBOSE | property |
public var VERBOSE:Boolean = trueDetermines whether debug printout is enabled. It also prints version information at initialization.
| DrupalSite | () | constructor |
public function DrupalSite(gatewayUrl:String = "", apiKey:String = "")Creates a new DrupalSite instance. If the gatewayUrl is specified, DrupalSite tries immediately to establish a connection.
ParametersgatewayUrl:String (default = "") — [Optional] URL to Drupal AMFPHP service gateway.
|
|
apiKey:String (default = "") — [Optional] API key for Drupal services.
|
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| amfConnect | () | method |
public function amfConnect():voidInvokes Drupal system.connect service method using the blocking routines. This validates the API key and retrieves a Drupal session. If the user is already authenticated, the UID and USER properties on DrupalSite will be set. Event.COMPLETE will be dispatched when the connection is made.
| dispatchEvent | () | method |
public function dispatchEvent(evt:Event):BooleanParameters
evt:Event |
Boolean |
| getCategory | () | method |
public function getCategory(vid:int, tid:int, callback:Function, data:Object = null, reload:Boolean = false):BooleanInvokes the Drupal taxonomy.getTree service method for retrieving nodes associated with a category or term.
Parametersvid:int — Drupal vocabulary ID
|
|
tid:int — Drupal term ID
|
|
callback:Function — Callback function on succcess.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
|
reload:Boolean (default = false) — [Optional] If set to true, then any cached data for the category
or term is ignored, and the nodes are reloaded from the Drupal site.
|
Boolean — Success (true) or failure (false) of blocking initiation.
|
| getNode | () | method |
public function getNode(nid:int, callback:Function, data:Object = null, reload:Boolean = false):BooleanInvokes the Drupal node.load service method for retrieving a node.
Parametersnid:int — Drupal node ID.
|
|
callback:Function — Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
|
reload:Boolean (default = false) — [Optional] If set to true, then any cached data for the node is ignored,
and the node is reloaded from the Drupal site.
|
Boolean — Success (true) or failure (false) of blocking initiation.
|
| getView | () | method |
public function getView(viewname:String, callback:Function, data:Object = null, reload:Boolean = false):BooleanInvokes the Drupal view.getView service method for retrieving nodes from a view.
Parametersviewname:String — Name of Drupal view to retrieve.
|
|
callback:Function — Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
|
reload:Boolean (default = false) — [Optional] If set to true, then any cached data for the view is ignored,
and the view is reloaded from the Drupal site.
|
Boolean — Success (true) or failure (false) of blocking initiation.
|
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanParameters
type:String |
Boolean |
| login | () | method |
public function login(username:String, password:String, callback:Function = null, data:Object = null):BooleanInvokes the Drupal user.login service method to authenticate a user.
Parametersusername:String — Username for Drupal account
|
|
password:String — Password
|
|
callback:Function (default = null) — [Optional] Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
Boolean |
| nodeDelete | () | method |
public function nodeDelete(nid:int, callback:Function = null, data:Object = null):BooleanInvokes the Drupal node.delete service method for deleting a node.
Parametersnid:int — Drupal node ID for node to delete.
|
|
callback:Function (default = null) — [Optional] Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
Boolean |
| nodeSave | () | method |
public function nodeSave(node:Object, callback:Function = null, data:Object = null):BooleanInvokes the Drupal node.save service method for saving a node.
Parametersnode:Object — Drupal node object to save. Node objects for new nodes
must include the type property; otherwise, node objects must include
the nid and changed properties.
|
|
callback:Function (default = null) — Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
Boolean |
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
| sendMail | () | method |
public function sendMail(addrTo:String, subject:String, body:String, addrFrom:String = "", mailKey:String = "service-system-mail", headers:Array = null, callback:Function = null, data:Object = null):BooleanInvokes the Drupal system.mail service method to send an e-mail.
ParametersaddrTo:String — Recipient's address for e-mail.
|
|
subject:String — Subject for e-mail.
|
|
body:String — Body text of e-mail.
|
|
addrFrom:String (default = "") — [Optional] Sender's address for e-mail.
|
|
mailKey:String (default = "service-system-mail") — [Optional] Mail key used within Drupal for identifying/modifying mail message.
|
|
headers:Array (default = null) — [Optional] Array of other headers to include in e-mail.
|
|
callback:Function (default = null) — [Optional] Callback function on success.
|
|
data:Object (default = null) — [Optional] Data passed as argument to callback function.
|
Boolean |
| willTrigger | () | method |
public function willTrigger(type:String):BooleanParameters
type:String |
Boolean |
| DATE | constant |
public static const DATE:String = "8.27.2008"Engine version date. Enables version date to be retrieved at runtime.
| LICENSE | constant |
public static const LICENSE:String = "DrupalSite by Third Ave Design. Licensed under GPLv3."Engine license. Enables license to be retrieved at runtime.
| NAME | constant |
public static const NAME:String = "DrupalSite"Engine name. Enables engine name to be retrieved at runtime.
| VERSION | constant |
public static const VERSION:String = "Alpha 0.5 - release/Public"Engine version. Enables version to be retrieved at runtime.