iNetWord APIs and ProtocolsiNetWord can be controlled by utilizing the following APIs and Protocols:
CGI ParametersAll CGI Parameters can be passed within the URL (method = GET) or within POST data. The same parameters can be passed whether you launch iNetWord with its full interface or as a pure-play editor without the files pane (domain.com/s/edit.php). CGI parameter names are case sensitive. No CGI parameters should be specified more than once within the same URL. Take care to URL Encode special characters used within CGI Parameter values (see below).
Filename SpecifiersThe file and folder names used in the new= or open= portion of a URL to launch iNetWord are constructed differently than those displayed to an end user in iNetWord itself. Construct your URL Filename Specifiers as follows:
Example URLSEditor with Files pane at left and editor page at right. All UI and capabilities present. http://www.inetword.com/s/edit.php Editor without Files pane at left. Controlling application should have a UI for browsing documents. User may edit multiple files within the editor. http://www.inetword.com/?new=Templatename.html Editor with a new,
unnamed document based on Templatename.html. http://www.inetword.com/s/edit.php?open=goodfile.html Editor without Files pane at left with goodfile.html loaded for editing. http://www.inetword.com/s/edit.php?filemode=single Editor without Files pane at left and no New document, upload document buttons on the toolbar or file tabs at the left. This is a typical 'pure play' edit one file configuration. http://www.inetword.com/s/edit.php?bgcolor=%238080F0 Editor without
Files pane at left with a light blue background surrounding
the chrome. http://www.inetword.com/?filebuttons=no&open=afile.html&bgcolor=%23A0A0A0 Several options combined. JavaScript Client APIYour Web pages will often launch iNetWord into either another window or within a frame. Once launched, you can control iNetWord by calling its JavaScript API. The API enables you to open or create documents, insert pictures, and control the appearance and configuration of iNetWord.
If you provide file browsing capability to your users, this is how your file browser will open files in an already-running instance of iNetWord. If iNetWord is not yet running, or your user interface dictates that documents be opened in new instances of iNetWord, then use the CGI Parameters described above.
The iNetWord JavaScript API is accessed through a JavaScript object provided by inetword.js. Use this code to instantiate the API object:
<script type="text/javascript" src="js/inetword.js"></script> iNetWordObj = new inetWordInterface(); iNetWordObj.ConnectToEditorFrame( frames['EditorFrame'] );
The iNetWord JavaScript API consists of these methods:
ConnectToEditorFrame( window_object ) Provides the window object within which iNetWord is running. When using Frames this is the .frames['NameOfInetWordFrame'] object. When launching iNetWord in another window, this is the window object returned by window.open(). This method must be called prior to any other API calls. Returns: nothing.
fConnectedToEditorFrame() Indicates whether the ConnectToEditorFrame() method has been performed yet. Returns: boolean, true if ConnectToEditorFrame() has been called.
fCanConnect() Indicates whether the ConnectToEditorFrame() method has been performed yet AND whether the iNetWord editor has completed its initialization and is accepting API calls. Returns: boolean, true if API calls can now be made.
SetConfigDirective( directive, value ) Sets the given directive to the provided value. If the directive changes iNetWord's appearance, then than change is performed synchronously with the call. Returns: nothing
FileOpen( folder_filename ) Opens the given file within the editor. The folder_filename should be the full hierarchical path to the file starting at the user's logical root directory. This root directory is displayed to the user as -Top Folder- and usually is called 'docs' within the user's storage space. If iNetWord is running in filesmulti=yes mode, then this file will be opened in a new tab. Otherwise the user will be prompted to save their document (if changed), and this document will replace their current document, if any. Returns: nothing.
FileOpenAs( folder_filename, New_folder_filename ) Similar to FileOpen() except the document is given the new name and its saved state is set to unsaved. This is how you can programatically fork a document. Returns: nothing.
FileNew( templatename ) Similar to FileOpen() except the passed in template is opened from the 'New' (i.e. templates) pane and the new file is given an 'Untitled#' temporary name.
InsertPicture( Pictureurl, event_obj ) Inserts the specified picture into the document with an <IMG> tag. Returns: nothing.
ValidateName( name ) Tests whether the given name is an acceptable file or folder name. Returns: false if name IS valid, otherwise an error message explaining what character within the name made it invalid.
|