| String generateCellURL() |
This method is overloadable and should not be called directly.
This method generates a URL to be associated with a cell. By default, this method returns the current page URL with the cellId querystring parameter set to the new cell ID.
Parameters
|
| String | parentID | The identifier for the parent cell. | Required |
| String | title | The title of the cell. | Required |
| String [] | tags | The keyword tags for the cell. | Defaults to [] |
| String | cellID | The identifier for the cell. | Required |
| Returns the URL to be associated with the cell. |
Usage
Synchronous
if( window.WPCAPI ) {
WPCAPI.generateCellURL = function( parentID, title, tags, cellID ) {
return "/path/to/template/engine?cellId=" + cellID;
};
} |
Asynchronous
if( window.WPCAPI ) {
WPCAPI.generateCellURL = function( parentID, title, tags, cellID ) {
var params = '?' + "parentID=" + encodeURIComponent(parentID) + "&title=" + encodeURIComponent(title) + "&tags=" + encodeURIComponent(tags) + "&cellID=" + encodeURIComponent(cellID);
var request = new XMLHttpRequest(); request.open( "/path/to/generateURL/action" + params, "GET", true ); request.onreadystatechange = function() {
if( request.readyState == 4 ) {
var response = request.responseXML; // Format: <cell url="..."/> var url = response ? response.getAttribute("url") : null; WPCAPI.generateCellURL_Callback(url);
}
}; request.send(null);
return null;
};
} |
|