Ryan,<div> Thank you for the useful description. I would add a couple of additional relevant observations...</div><div><br></div><div>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..</div>
<div><br></div><div>2) The config directory cannot be read-only... the GUI writes to this directory (output from system commands, link to Master.csv)</div><div><br></div><div>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.</div>
<div><br></div><div>David<br><br><div class="gmail_quote">On Fri, Sep 4, 2009 at 9:29 AM, Ryan Brindley <span dir="ltr"><<a href="mailto:rbrindley@digium.com">rbrindley@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-family:Arial;font-size:10pt;color:#000000">Hey gents,<br>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:<br><br><br>
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/). <br>
<br>
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.<br>
<br>
Now, there are 5 important files to the GUI: index.html, index.js, astman.js, pbx.js and pbx2.js. <br>
<br>
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. <br>
<br>
Index.js contains all the initial loading javascript. It's purpose is
to validate that the system, detect hardware changes, and login the
user. <br>
<br>
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. <br>
<br>
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. <br>
<br>
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.<br><br>-- <br><font color="#888888">Ryan Brindley <br>Digium, Inc. | Software Developer <br>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA <br>
main: +1 256-428-6000 fax: +1 256-864-0464 <br>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a><br>
</font></div></div><br>_______________________________________________<br>
--Bandwidth and Colocation Provided by <a href="http://www.api-digital.com--" target="_blank">http://www.api-digital.com--</a><br>
<br>
asterisk-gui mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-gui" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-gui</a><br></blockquote></div><br></div>