[asterisk-gui] A GUI Overview
David Kerr
David at Kerr.net
Fri Sep 4 12:34:14 CDT 2009
Ryan, Thank you for the useful description. I would add a couple of
additional relevant observations...
1) The scripts directory contains executable shell scripts that are run on
request of the GUI by the asterisk server. These perform functions that must
be executed on the server as they cannot be done from the client browser..
2) The config directory cannot be read-only... the GUI writes to this
directory (output from system commands, link to Master.csv)
This last point bothers me somewhat as the number of write/read/delete
cycles can get quite high. On my asterisk installation the gui directory is
on a Compact Flash card and I'd like to minimize the number of writes to
this. I solved it by creating a config/tmp that is a softlink to a
directory on a ramdisk, then I created a patch file that modifies the GUI
javascript to point to config/tmp for all system output and Master.csv. If
you are interested in this patch let me know and I will open a bug and
attach it for you to look at.
David
On Fri, Sep 4, 2009 at 9:29 AM, Ryan Brindley <rbrindley at digium.com> wrote:
> Hey gents,
> I recently explained to someone a brief overview of the code and decided
> this list might like to hear it as well...so here it is:
>
>
> First off the project has a simplistic file structure. When you pull down
> the source, the config dir holds all the code you'll ever need to modify.
> Directly inside the config dir are the html files. These files contain all
> the HTML, file specific CSS and loading JS. The config folder also contains
> directories for global JS (js/), global CSS (stylesheets/), and images
> (images/).
>
> The JS can be divided into three sections: loading JS, page JS, and JS
> libraries. The loading JS is usually jQuery's $(document).ready() function
> and any directly related helper functions and can be found in the HTML
> files. Page JS is all the functions needed to make a page what it is. If an
> HTML has over ~100 lines of JS code, that code is moved into its own JS
> file. For example, users.html has js/users.js. The JS libraries hold all the
> objects and functions that are commonly used through-out the project. They
> are also located in the js/ directory.
>
> Now, there are 5 important files to the GUI: index.html, index.js,
> astman.js, pbx.js and pbx2.js.
>
> Index.html is the main page. It contains the majority of the 'sessionData'
> variable instantiations as well as the HTML for the main menu and the iframe
> for the pages.
>
> Index.js contains all the initial loading javascript. It's purpose is to
> validate that the system, detect hardware changes, and login the user.
>
> Astman.js is a rather unorganized file. It contains all the array and
> string custom functions and then the ASTGUI object. the ASTGUI object is the
> main function object for the GUI. It holds all the AJAX functions, global
> variables, Asterisk context variables and some random HTML template
> variables. You'll probably see this object used in every JS you encounter.
>
> Pbx.js use to contain all of the data models, but that's been moved to
> pbx2.js (I'll explain later). The only thing that hasn't been ported over to
> pbx2.js is pbx.js's checkEssentials object. These functions verify that
> specific dailplan contexts are exactly as expected. If they aren't the
> functions replace the current context with what it should be. This is the
> only place in the GUI where the GUI actually forces no customizations. These
> functions also load all the configs and create the client-side data cache,
> which is the sessionData object.
>
> Pbx2.js holds all the data models. If you look at the file, you'll see a
> clear system. pbx is the main object with many members, such as: users,
> trunks, queues, etc. etc. Each pbx member has all the necessary methods
> needed to configure Asterisk. For example, the users member has add, edit,
> remove, and list methods. This allows any page to add a user by calling
> pbx.users.add(); Its important to note that if you are looking for where the
> GUI modifies some file, its most likely going to be in pbx2.js sparing a few
> exceptions.
>
> --
> Ryan Brindley
> Digium, Inc. | Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> main: +1 256-428-6000 fax: +1 256-864-0464
> Check us out at: http://digium.com & http://asterisk.org
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-gui mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-gui
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-gui/attachments/20090904/4471cc21/attachment.htm
More information about the asterisk-gui
mailing list