diff --git a/sites/all/modules/maestro/LICENSE.txt b/sites/all/modules/maestro/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2c095c8d3f42488e8168f9710a4ffbfc4125a159
--- /dev/null
+++ b/sites/all/modules/maestro/LICENSE.txt
@@ -0,0 +1,274 @@
+GNU GENERAL PUBLIC LICENSE
+
+              Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not allowed.
+
+                  Preamble
+
+The licenses for most software are designed to take away your freedom to
+share and change it. By contrast, the GNU General Public License is
+intended to guarantee your freedom to share and change free software--to
+make sure the software is free for all its users. This General Public License
+applies to most of the Free Software Foundation's software and to any other
+program whose authors commit to using it. (Some other Free Software
+Foundation software is covered by the GNU Library General Public License
+instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the
+freedom to distribute copies of free software (and charge for this service if
+you wish), that you receive source code or can get it if you want it, that you
+can change the software or use pieces of it in new free programs; and that
+you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to
+deny you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show
+them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients
+to know that what they have is not the original, so that any problems
+introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will individually
+obtain patent licenses, in effect making the program proprietary. To prevent
+this, we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+           GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
+               MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms
+of this General Public License. The "Program", below, refers to any such
+program or work, and a "work based on the Program" means either the
+Program or any derivative work under copyright law: that is to say, a work
+containing the Program or a portion of it, either verbatim or with
+modifications and/or translated into another language. (Hereinafter, translation
+is included without limitation in the term "modification".) Each licensee is
+addressed as "you".
+
+Activities other than copying, distribution and modification are not covered
+by this License; they are outside its scope. The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made
+by running the Program). Whether that is true depends on what the Program
+does.
+
+1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you
+may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it,
+thus forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you
+also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that
+you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in whole or in
+part contains or is derived from the Program or any part thereof, to be
+licensed as a whole at no charge to all third parties under the terms of this
+License.
+
+c) If the modified program normally reads commands interactively when run,
+you must cause it, when started running for such interactive use in the most
+ordinary way, to print or display an announcement including an appropriate
+copyright notice and a notice that there is no warranty (or else, saying that
+you provide a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this License.
+(Exception: if the Program itself is interactive but does not normally print such
+an announcement, your work based on the Program is not required to print
+an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be
+reasonably considered independent and separate works in themselves, then
+this License, and its terms, do not apply to those sections when you distribute
+them as separate works. But when you distribute the same sections as part
+of a whole which is a work based on the Program, the distribution of the
+whole must be on the terms of this License, whose permissions for other
+licensees extend to the entire whole, and thus to each and every part
+regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to
+work written entirely by you; rather, the intent is to exercise the right to
+control the distribution of derivative or collective works based on the
+Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of a
+storage or distribution medium does not bring the other work under the scope
+of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1
+and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source
+code, which must be distributed under the terms of Sections 1 and 2 above
+on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years, to give
+any third party, for a charge no more than your cost of physically performing
+source distribution, a complete machine-readable copy of the corresponding
+source code, to be distributed under the terms of Sections 1 and 2 above on
+a medium customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer to distribute
+corresponding source code. (This alternative is allowed only for
+noncommercial distribution and only if you received the program in object
+code or executable form with such an offer, in accord with Subsection b
+above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source code
+means all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation and
+installation of the executable. However, as a special exception, the source
+code distributed need not include anything that is normally distributed (in
+either source or binary form) with the major components (compiler, kernel,
+and so on) of the operating system on which the executable runs, unless that
+component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to
+copy from a designated place, then offering equivalent access to copy the
+source code from the same place counts as distribution of the source code,
+even though third parties are not compelled to copy the source along with the
+object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy,
+modify, sublicense or distribute the Program is void, and will automatically
+terminate your rights under this License. However, parties who have received
+copies, or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the
+Program or its derivative works. These actions are prohibited by law if you
+do not accept this License. Therefore, by modifying or distributing the
+Program (or any work based on the Program), you indicate your acceptance
+of this License to do so, and all its terms and conditions for copying,
+distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these terms and
+conditions. You may not impose any further restrictions on the recipients'
+exercise of the rights granted herein. You are not responsible for enforcing
+compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose
+that choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original copyright
+holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In such
+case, this License incorporates the limitation as if written in the body of this
+License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will be
+similar in spirit to the present version, but may differ in detail to address new
+problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies
+a version number of this License which applies to it and "any later version",
+you have the option of following the terms and conditions either of that
+version or of any later version published by the Free Software Foundation. If
+the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software
+Foundation, write to the Free Software Foundation; we sometimes make
+exceptions for this. Our decision will be guided by the two goals of
+preserving the free status of all derivatives of our free software and of
+promoting the sharing and reuse of software generally.
+
+               NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
+PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
+WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
+AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
+ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
+LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE
+PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
+OR DATA BEING RENDERED INACCURATE OR LOSSES
+SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
+PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
+IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.
+
+          END OF TERMS AND CONDITIONS
diff --git a/sites/all/modules/maestro/README.txt b/sites/all/modules/maestro/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7d2543598c531a01be84f77e709dacc91bd95152
--- /dev/null
+++ b/sites/all/modules/maestro/README.txt
@@ -0,0 +1,73 @@
+// $Id: README.txt,v 1.5 2010/12/17 14:15:33 randy Exp $
+
+August 24/2010
+
+INSTALLATION INSTRUCTIONS
+-------------------------
+The installation of Maestro should be done in the sites/all/modules folder structure.
+Do NOT install Maestro in the core modules directory.
+Maestro ships with 3 add-on modules: Common Functions, Content Publish and Maestro Test Workflow Patterns.
+We recommend that you install all 3 modules to begin.  Common Functions and Content Publish will enable functions/functionality
+that is used in the tasks shipped with Maestro.  The Test Workflow patterns module is strongly suggested to get you up and
+running and familiar with Maestro.  It will install a handful of workflows that give you examples to begin structuring your workflows with.
+
+During the installation of the Maestro Test Workflow Patterns module, a content type test workflow is installed.
+The content type test workflow pattern requires at least 3 distinct users -- the person initiating the workflow, a user named Editor
+and a user named Publisher.  Since you probably don't have those users in your system, the import will not be able to assign two
+of the tasks to those users.
+
+You will have to do one of the following two things to ensure the Content Type test workflow works for you:
+
+1.  Edit the Test Content Type Task workflow and assign the Editor Review Article to an existing user in your system.
+    Edit the Publisher Review Article Task and assign it to an existing user in your system.
+
+  OR
+
+2. Create an Editor and Publisher user.  Assign the Editor Review Article to the Editor user and assign the Publisher Review Article task
+  to the Publisher user.
+
+
+CONFIGURATION INSTRUCTIONS
+--------------------------
+You will find the Maestro base configuration options under the Configuration menu.  Maestro is found under the Workflow category and
+is listed as Maestro Config.  Out of the box, you will find that Maestro has a few default settings enabled.
+
+THIS IS IMPORTANT!! PLEASE READ!
+One of the settings is "Run the Orchestrator when the Task Console Renders".  This setting allows the Maestro engine to run
+when you click on the Task Console link in the Nav menu.  If you uncheck this option, the engine will not run.  This is an ALPHA
+release of Maestro.  So be advised that the Orchestrator will have its own asynchronous way to fire as we draw closer to a BETA release.
+
+The other options are:
+
+-Enable the import window in the Template Editor:
+    You will be unable to do manual IMPORTS of workflows without this setting turned on.  If you try to use the IMPORT option on the
+    Maestro Workflow main editor page, you will get an error.
+
+-Enable Maestro Notifications:
+    You have the ability to globally turn on/off all notifications sent out by Maestro.
+    Check this on to enable, check if off to disable.
+
+-Select Which Notifiers to Enable:
+    This gives you fine grain control over which specific notifications to actually enable.
+    Its a multi select, so choose the notifications you want to use.
+
+
+
+THE ORCHESTRATOR
+----------------
+The whole point of Maestro is that it has an engine that can (and should) run independently of end-user clicks.
+The way this is accomplished is through a mechanism we call the Orchestrator.  The Orchestrator does exactly what it sounds like it does:
+it orchestrates the execution of tasks and marshalls the engine properly.
+
+While the orchestrator can be run through hits to the Task Console, This is NOT an optimal configuration and is
+only there for testing. We have enabled the option to run the Orchestrator through the task console rendering by
+default for ease of use, but that can be disabled on the Maestro configuration page.
+
+To set up the cron, see http://drupal.org/cron. Note however in this documentation, instead of (or in addition to)
+using http://www.example.com/cron.php as the url, use http://www.example.com/maestro/orchestrator. This orchestrator
+cron should be set to run every few minutes.
+
+Current release of Maestro does not have a "secured" orchestrator link.  Therefore anyone can hit the maestro/orchestrator link and run 
+the orchestrator.  While this is not necessarily harmful, it is not optimal as the engine will run and potentially be run more than once
+at the same time causing queue issues.  Eventually there will be an application token that would have to be passed to the orchestrator link
+in order to run the orchestrator from cron. However for now, be aware there are no safeguards around it.
diff --git a/sites/all/modules/maestro/batch/maestro_batch_script_sample.php b/sites/all/modules/maestro/batch/maestro_batch_script_sample.php
new file mode 100644
index 0000000000000000000000000000000000000000..33b0b29de55237dc548dc299c67f538f60314bfb
--- /dev/null
+++ b/sites/all/modules/maestro/batch/maestro_batch_script_sample.php
@@ -0,0 +1,28 @@
+<?php
+// $Id: maestro_batch_script_sample.php,v 1.2 2010/08/24 15:51:22 randy Exp $
+
+
+/**
+ * @file
+ * maestro_batch_script_sample.php
+ *
+ * Description:  This is a sample file for showing how Maestro can link in at task execution time, an entire script.
+ * In order for the engine to detect that the execution has been successful, you must set a key variable named $success to
+ * the boolean value of TRUE.
+ *
+ * Since this is a simple example, we are not doing anything terribly important in this script, so we are just setting the success variable
+ * to TRUE.
+ * If you do not set $success to TRUE, $success is set as FALSE in the engine and the task will not flag its execution as complete.
+ *
+ * Use case scenarios for this task type include running 3rd party scripts, running fully written scripts outside of web root, and running
+ * non-included-in-Drupal scripts.
+ * Batch Tasks differ from Batch Function Tasks in that a batch task is 100% free form code that is included at task execution time.
+ *
+ *
+ */
+
+
+//Perform any batch automation functions in here.
+
+
+$success = TRUE;  //If we don't set this to TRUE here, the engine will re-execute this code on the next scheduled task execution phase.
\ No newline at end of file
diff --git a/sites/all/modules/maestro/css/maestro.css b/sites/all/modules/maestro/css/maestro.css
new file mode 100644
index 0000000000000000000000000000000000000000..10ae1cfa6a6748e35dc0438161241e3f68a53461
--- /dev/null
+++ b/sites/all/modules/maestro/css/maestro.css
@@ -0,0 +1,299 @@
+.aligntop {
+  vertical-align:top;
+}
+
+.alignright {
+  text-align:right;
+}
+.aligncenter {
+  text-align:center;
+}
+.valigncenter {
+  vertical-align: -30%;
+}
+.valigntop {
+  vertical-align: top;
+  margin: 3px 0px 0px 0px;
+}
+
+#maestro_workflow_container {
+  position: relative;
+  overflow: auto;
+}
+
+.maestro_heading {
+  font-size: 16pt;
+  font-weight: bold;
+  padding: 5px;
+}
+
+.maestro_tool_tip {
+  background: #F8EFA6;
+  z-index: 10000;
+  position: relative;
+}
+
+.maestro_tool_tip_inner {
+  padding: 5px;
+}
+
+.maestro_tool_tip input {
+  margin: 3px 3px 3px 3px;
+  padding: 1px 7px 1px 7px;
+  cursor: pointer;
+  border: 1px solid black;
+}
+
+.maestro_ajax_indicator {
+  float: right;
+}
+
+.maestro_context_menu {
+  display: none;
+}
+
+.maestro_task_container {
+  position: absolute;
+  background: #FFFFFF;
+  cursor: move;
+  z-index: 100;
+}
+
+.maestro_task {
+  cursor: move;
+}
+
+.maestro_task_body {
+  padding: 3px;
+  text-align: center;
+}
+
+.maestro_task_edit_panel {
+  background: #fff;
+  width: 600px;
+}
+
+.maestro_task_edit_panel table {
+  border: 0px;
+}
+.maestro_task_edit_panel .sticky-table {
+  border: 1px solid #BEBFB9;
+}
+
+.maestro_task_edit_panel input,
+.maestro_task_edit_panel select,
+.maestro_task_edit_panel textarea {
+  border: 1px solid #ccc;
+}
+.maestro_task_edit_panel input[type="checkbox"],
+.maestro_task_edit_panel input[type="radio"] {
+  border: 0px;
+}
+.maestro_task_edit_panel input[type="text"] {
+  width: 250px;
+}
+.maestro_task_edit_save_div {
+  text-align: center;
+  margin: 10px 0px 10px 0px;
+}
+
+.maestro_task_edit_tab {
+  float: left;
+  margin: 0px 0px 0px 5px;
+}
+.unactive .maestro_task_edit_tab {
+  background: #ccc;
+}
+.active .maestro_task_edit_tab {
+  background: #fff;
+}
+.maestro_task_edit_tab_close {
+  background: #c00;
+}
+
+.maestro_task_title {
+  height: 22px;
+  padding: 0px 3px 0px 3px;
+  color: #FFFFFF;
+  font-weight: bold;
+  text-align: center;
+}
+
+.maestro_taskname {
+  margin: 10px 0px 0px 0px;
+}
+
+.taskconsoleActionRec {
+  min-width:600px;
+  border:1px solid #D9EAF5;
+}
+
+.maestroDetailSubTable td {
+  font-size:92%;
+}
+
+.tl { background: url(../images/admin/corners/tl.png) 0 0 no-repeat; }
+.tr { background: url(../images/admin/corners/tr.png) 100% 0 no-repeat; padding: 10px; }
+.bl { background: url(../images/admin/corners/bl.png) 0 100% no-repeat; }
+.br { background: url(../images/admin/corners/br.png) 100% 100% no-repeat; }
+.tl-grn { background: url(../images/admin/corners/tl-grn.png) 0 0 no-repeat; }
+.tr-grn { background: url(../images/admin/corners/tr-grn.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.tm-grn { background: url(../images/admin/corners/tm-grn.png) repeat-x; }
+.tl-red { background: url(../images/admin/corners/tl-red.png) 0 0 no-repeat; }
+.tr-red { background: url(../images/admin/corners/tr-red.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.tm-red { background: url(../images/admin/corners/tm-red.png) repeat-x; }
+.tl-yel { background: url(../images/admin/corners/tl-yel.png) 0 0 no-repeat; }
+.tr-yel { background: url(../images/admin/corners/tr-yel.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.tm-yel { background: url(../images/admin/corners/tm-yel.png) repeat-x; }
+.tl-bl { background: url(../images/admin/corners/tl-bl.png) 0 0 no-repeat; }
+.tr-bl { background: url(../images/admin/corners/tr-bl.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.tm-bl { background: url(../images/admin/corners/tm-bl.png) repeat-x; }
+.tl-gry { background: url(../images/admin/corners/tl-gry.png) 0 0 no-repeat; }
+.tr-gry { background: url(../images/admin/corners/tr-gry.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.tm-gry { background: url(../images/admin/corners/tm-gry.png) repeat-x; }
+
+.tl-bge { background: url(../images/admin/corners/tl-bge.png) 0 0 no-repeat; }
+.tr-bge { background: url(../images/admin/corners/tr-bge.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.bl-bge { background: url(../images/admin/corners/bl-bge.png) 0 100% no-repeat; }
+.br-bge { background: url(../images/admin/corners/br-bge.png) 100% 100% no-repeat; }
+.tl-wht { background: url(../images/admin/corners/tl-wht.png) 0 0 no-repeat; }
+.tr-wht { background: url(../images/admin/corners/tr-wht.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.bl-wht { background: url(../images/admin/corners/bl-wht.png) 0 100% no-repeat; }
+.br-wht { background: url(../images/admin/corners/br-wht.png) 100% 100% no-repeat; }
+.unactive .tl-tab { background: url(../images/admin/corners/tl-wht2.png) 0 0 no-repeat; }
+.unactive .tr-tab { background: url(../images/admin/corners/tr-wht2.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.unactive .bl-tab { }
+.unactive .br-tab { }
+.active .tl-tab { background: url(../images/admin/corners/tl-wht.png) 0 0 no-repeat; }
+.active .tr-tab { background: url(../images/admin/corners/tr-wht.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.active .bl-tab { }
+.active .br-tab { }
+.tl-cl { background: url(../images/admin/corners/tl-cl.png) 0 0 no-repeat; }
+.tr-cl { background: url(../images/admin/corners/tr-cl.png) 100% 0 no-repeat; padding: 1px 10px 1px 10px; }
+.bl-cl { }
+.br-cl { }
+
+.t { background: url(../images/admin/corners/dot.png) 0 0 repeat-x; }
+.b { background: url(../images/admin/corners/dot.png) 0 100% repeat-x; }
+.l { background: url(../images/admin/corners/dot.png) 0 0 repeat-y; }
+.r { background: url(../images/admin/corners/dot.png) 100% 0 repeat-y; }
+
+span.maestro_working {
+  background:url(../images/admin/status-active.gif) no-repeat right center;
+  padding-right:18px;
+}
+
+.maestro_hide_item {
+	display: none;
+}
+
+.maestro_show_item {
+	display: ;
+}
+
+
+.focused_process {
+  font-weight: bold;
+}
+.blurred_process {
+  font-weight: normal;
+}
+.process_variables {
+  border-bottom: 1px solid #D3E7F4;
+}
+
+
+.maestro_comment {
+    padding: 2px;
+}
+div.maestro_boxed {
+    border: dashed 1px #CCC;
+    overflow: auto;
+}
+.maestro_boxed p {
+    padding: 5px;
+    margin: 0px;
+}
+.elementUpdated {
+    background-color: rgb(255, 255, 225);
+}
+
+
+
+/* Older tooltip or on-hover css styles */
+a.info{
+  position:relative; /*this is the key*/
+  z-index:24;
+  color:#000;
+  text-decoration:none
+}
+
+a.info:hover  {
+  z-index:25;
+  padding-top:5px;
+  padding-bottom:5px;
+  text-decoration:none
+}
+
+a.info span{display: none}
+
+a.info:hover span { /*the span will display just on :hover state*/
+  font-family:Verdana, Tahoma, Arial;
+  font-style:normal;
+  font-size: 7pt;
+  display:block !important;
+  position:absolute;
+  top:3em; left:-15em; width:22em;
+  border:1px solid #5D96B9;
+  background-color:#FFFFA0; color:#555;
+  padding:2px;
+  text-align: left;
+  text-decoration:none
+}
+/* End of older tooltip CSS styles */
+
+/* CSS for Maestro Views */
+.maestro_view_table {
+  padding:0 px;
+  margin: 0;
+  border-top-width: 0px;
+  width: 100%;
+}
+
+.maestro_view_50_percent {
+  width: 50%;
+}
+.maestro_view_25_percent {
+  width: 25%;
+}
+.maestro_view_10_percent {
+  width: 10%;
+}
+.maestro_view_5_percent {
+  width: 5%;
+}
+
+.views-row-even  {
+	border-top: 0px;
+	border-top-width: 0px;
+	background-color: #f0f0f0;
+	}
+
+/* End of CSS for Maestro Views */
+
+
+.maestroOddRow {
+  border-top: 0px;
+  border-top-width: 0px;
+  background-color: #f0f0f0;
+}
+
+.maestroEvenRow {
+  border-top: 0px;
+  border-top-width: 0px;
+  background-color: #ffffff;
+}
+
+.maestro_hide_secondary_row {
+  display: none;
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/images/admin/close.png b/sites/all/modules/maestro/images/admin/close.png
new file mode 100644
index 0000000000000000000000000000000000000000..354994ffd265d0ae114ee491d6e144bd35ad337f
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/close.png differ
diff --git a/sites/all/modules/maestro/images/admin/copy.gif b/sites/all/modules/maestro/images/admin/copy.gif
new file mode 100644
index 0000000000000000000000000000000000000000..736ae39db85cc3294d672a8d974ee21e9f02d9e1
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/copy.gif differ
diff --git a/sites/all/modules/maestro/images/admin/corners/bl-bge.png b/sites/all/modules/maestro/images/admin/corners/bl-bge.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0af32dbb4815ef22b7cf91b1cadff9732d64edb
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/bl-bge.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/bl-wht.png b/sites/all/modules/maestro/images/admin/corners/bl-wht.png
new file mode 100644
index 0000000000000000000000000000000000000000..ef25a4c63e4580bda71bf35fc993ff4b6724bf59
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/bl-wht.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/bl.png b/sites/all/modules/maestro/images/admin/corners/bl.png
new file mode 100644
index 0000000000000000000000000000000000000000..38cb6be6b47429fc2219e74dfb08a7768b920e74
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/bl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/br-bge.png b/sites/all/modules/maestro/images/admin/corners/br-bge.png
new file mode 100644
index 0000000000000000000000000000000000000000..7a2c86309c4ad3f22cdc6853c8911519a28570ac
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/br-bge.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/br-wht.png b/sites/all/modules/maestro/images/admin/corners/br-wht.png
new file mode 100644
index 0000000000000000000000000000000000000000..93118cbfd2ac0aa51de5a8e17e18f8c0f2dab708
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/br-wht.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/br.png b/sites/all/modules/maestro/images/admin/corners/br.png
new file mode 100644
index 0000000000000000000000000000000000000000..c636518542eb077b475cc753aef5ba80151a0a79
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/br.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/dot.png b/sites/all/modules/maestro/images/admin/corners/dot.png
new file mode 100644
index 0000000000000000000000000000000000000000..ca3f0f53229330d7d085761a72c60f1daa6f8831
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/dot.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-bge.png b/sites/all/modules/maestro/images/admin/corners/tl-bge.png
new file mode 100644
index 0000000000000000000000000000000000000000..50c62136ac20be9bf05cbd8a37ab20fd138da1c2
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-bge.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-bl.png b/sites/all/modules/maestro/images/admin/corners/tl-bl.png
new file mode 100644
index 0000000000000000000000000000000000000000..0296685205f3a17d00592e712121cf939d514936
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-bl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-cl.png b/sites/all/modules/maestro/images/admin/corners/tl-cl.png
new file mode 100644
index 0000000000000000000000000000000000000000..cf275599560b6d180480eb5c20977e0975b7dc3b
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-cl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-grn.png b/sites/all/modules/maestro/images/admin/corners/tl-grn.png
new file mode 100644
index 0000000000000000000000000000000000000000..4280c836e43479f5b636bf6566f30c519a767f2b
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-grn.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-gry.png b/sites/all/modules/maestro/images/admin/corners/tl-gry.png
new file mode 100644
index 0000000000000000000000000000000000000000..519b7ab983273989e9bb9fe8a5f400a039f8930c
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-gry.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-red.png b/sites/all/modules/maestro/images/admin/corners/tl-red.png
new file mode 100644
index 0000000000000000000000000000000000000000..57db6c1e6f98c63b4f144cbc80787c7375ec7898
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-red.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-wht.png b/sites/all/modules/maestro/images/admin/corners/tl-wht.png
new file mode 100644
index 0000000000000000000000000000000000000000..631e19954bb4097069674f775e41eb43aab03b0c
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-wht.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-wht2.png b/sites/all/modules/maestro/images/admin/corners/tl-wht2.png
new file mode 100644
index 0000000000000000000000000000000000000000..c5228496e55ca226c33397afd510c861f6145f12
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-wht2.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl-yel.png b/sites/all/modules/maestro/images/admin/corners/tl-yel.png
new file mode 100644
index 0000000000000000000000000000000000000000..931b25ab9bf594ecdb96af5424eee57a96b9617a
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl-yel.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tl.png b/sites/all/modules/maestro/images/admin/corners/tl.png
new file mode 100644
index 0000000000000000000000000000000000000000..f90531a3784963b18b4f1c3a82e20378ea721313
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tm-bl.png b/sites/all/modules/maestro/images/admin/corners/tm-bl.png
new file mode 100644
index 0000000000000000000000000000000000000000..9ee7176515c84ec4e4c01d7b03f1f22b8e5c4dbc
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tm-bl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tm-grn.png b/sites/all/modules/maestro/images/admin/corners/tm-grn.png
new file mode 100644
index 0000000000000000000000000000000000000000..656466de286c039208815cb106f850ff414b32e2
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tm-grn.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tm-gry.png b/sites/all/modules/maestro/images/admin/corners/tm-gry.png
new file mode 100644
index 0000000000000000000000000000000000000000..6a0d2fdea9be475098c15ec1714797cc7ede0558
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tm-gry.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tm-red.png b/sites/all/modules/maestro/images/admin/corners/tm-red.png
new file mode 100644
index 0000000000000000000000000000000000000000..7e1b0b577f3a95fe441aef0297dfbeef0cd1f724
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tm-red.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tm-yel.png b/sites/all/modules/maestro/images/admin/corners/tm-yel.png
new file mode 100644
index 0000000000000000000000000000000000000000..fce8ae6d5bbc6568b14bb9a84d7d27d1fd9203b2
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tm-yel.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-bge.png b/sites/all/modules/maestro/images/admin/corners/tr-bge.png
new file mode 100644
index 0000000000000000000000000000000000000000..943318c8daa24ba8afd884df991940904e3230f0
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-bge.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-bl.png b/sites/all/modules/maestro/images/admin/corners/tr-bl.png
new file mode 100644
index 0000000000000000000000000000000000000000..4e624ec50b9492f27f4f59a2c361988107f3100b
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-bl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-cl.png b/sites/all/modules/maestro/images/admin/corners/tr-cl.png
new file mode 100644
index 0000000000000000000000000000000000000000..f4eac352c8d9cf79ef87bbeee6d15488f8e23aab
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-cl.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-grn.png b/sites/all/modules/maestro/images/admin/corners/tr-grn.png
new file mode 100644
index 0000000000000000000000000000000000000000..50e241454b706ffd8e192cb3a7c4c8ffa915c95c
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-grn.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-gry.png b/sites/all/modules/maestro/images/admin/corners/tr-gry.png
new file mode 100644
index 0000000000000000000000000000000000000000..423b1daf860eec575e72eaf535c329a6e4379fe4
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-gry.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-red.png b/sites/all/modules/maestro/images/admin/corners/tr-red.png
new file mode 100644
index 0000000000000000000000000000000000000000..ba58180ea353baf65553889d59ccd730a21a2ecd
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-red.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-wht.png b/sites/all/modules/maestro/images/admin/corners/tr-wht.png
new file mode 100644
index 0000000000000000000000000000000000000000..31d086289e538344c66f3d31056b781228ce3bfe
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-wht.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-wht2.png b/sites/all/modules/maestro/images/admin/corners/tr-wht2.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2569fcf8242c64d3848ef7761bc5358b56a9223
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-wht2.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr-yel.png b/sites/all/modules/maestro/images/admin/corners/tr-yel.png
new file mode 100644
index 0000000000000000000000000000000000000000..bbeef9532fc6cca037f3d2de45cc914129405a84
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr-yel.png differ
diff --git a/sites/all/modules/maestro/images/admin/corners/tr.png b/sites/all/modules/maestro/images/admin/corners/tr.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb27f43f94f76bb229612b44ee09e797cdda3388
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/corners/tr.png differ
diff --git a/sites/all/modules/maestro/images/admin/delete.gif b/sites/all/modules/maestro/images/admin/delete.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b5ffb46559bf4f66b2ef6e257cae2db2b1dac990
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/delete.gif differ
diff --git a/sites/all/modules/maestro/images/admin/edit_properties.gif b/sites/all/modules/maestro/images/admin/edit_properties.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e54aa89af716a3fd38dfaaa0be38bf66ebb2d84a
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/edit_properties.gif differ
diff --git a/sites/all/modules/maestro/images/admin/edit_tasks.gif b/sites/all/modules/maestro/images/admin/edit_tasks.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5f420efb7616c232a2141c1b60ca2f8c71107d73
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/edit_tasks.gif differ
diff --git a/sites/all/modules/maestro/images/admin/export.gif b/sites/all/modules/maestro/images/admin/export.gif
new file mode 100644
index 0000000000000000000000000000000000000000..54d7390439452d769f12319f8b2f63247ade356c
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/export.gif differ
diff --git a/sites/all/modules/maestro/images/admin/left-arrow.png b/sites/all/modules/maestro/images/admin/left-arrow.png
new file mode 100644
index 0000000000000000000000000000000000000000..81cc5771e6bccc7eb14e0d8c916a86f952b3769a
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/left-arrow.png differ
diff --git a/sites/all/modules/maestro/images/admin/remove.png b/sites/all/modules/maestro/images/admin/remove.png
new file mode 100644
index 0000000000000000000000000000000000000000..b89867c0ce355410831770c5c8db779c2c242a13
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/remove.png differ
diff --git a/sites/all/modules/maestro/images/admin/right-arrow.png b/sites/all/modules/maestro/images/admin/right-arrow.png
new file mode 100644
index 0000000000000000000000000000000000000000..eede2b46266a76bba38eadfffe4f262a5502c415
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/right-arrow.png differ
diff --git a/sites/all/modules/maestro/images/admin/status-active.gif b/sites/all/modules/maestro/images/admin/status-active.gif
new file mode 100644
index 0000000000000000000000000000000000000000..207e95c3fa8cc31a89af150ad74059b1667922b6
Binary files /dev/null and b/sites/all/modules/maestro/images/admin/status-active.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/archived.png b/sites/all/modules/maestro/images/taskconsole/archived.png
new file mode 100644
index 0000000000000000000000000000000000000000..ffefcbd0fc675277341d1ed1f68e09114a663938
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/archived.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/arrow_ltr.png b/sites/all/modules/maestro/images/taskconsole/arrow_ltr.png
new file mode 100644
index 0000000000000000000000000000000000000000..8cdb8ca172a3652f5470054bde0155184f5cb071
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/arrow_ltr.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/collapse.png b/sites/all/modules/maestro/images/taskconsole/collapse.png
new file mode 100644
index 0000000000000000000000000000000000000000..b6476fdb3d8aca5486f1ab8604b94ffe9b5405c2
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/collapse.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/comment.gif b/sites/all/modules/maestro/images/taskconsole/comment.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6f76e86bd7a23c6ed7c417d244495fbfa0718ead
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/comment.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/delete.gif b/sites/all/modules/maestro/images/taskconsole/delete.gif
new file mode 100644
index 0000000000000000000000000000000000000000..33fe2e36dae1cccf6fdd38f365fda5966b7ee653
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/delete.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/delete.png b/sites/all/modules/maestro/images/taskconsole/delete.png
new file mode 100644
index 0000000000000000000000000000000000000000..40b3c27585ae37071cf34e403849f71935a567b8
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/delete.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/details.png b/sites/all/modules/maestro/images/taskconsole/details.png
new file mode 100644
index 0000000000000000000000000000000000000000..dba60223993954d7b3a79ec32506f0f09480e34a
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/details.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/email.png b/sites/all/modules/maestro/images/taskconsole/email.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce20377c1224eca380b885aab16bdb73a2e85907
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/email.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/expand.png b/sites/all/modules/maestro/images/taskconsole/expand.png
new file mode 100644
index 0000000000000000000000000000000000000000..c7ba85093cd2678e91e9666700811eef8b854aff
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/expand.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/folder_closed.gif b/sites/all/modules/maestro/images/taskconsole/folder_closed.gif
new file mode 100644
index 0000000000000000000000000000000000000000..2d6fb10b3e746d1048ade0ec56ce3db31970c134
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/folder_closed.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/folder_open.gif b/sites/all/modules/maestro/images/taskconsole/folder_open.gif
new file mode 100644
index 0000000000000000000000000000000000000000..bb82b92893eb896b76c16c0deb54d7e9b97e0d76
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/folder_open.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/new_comment.gif b/sites/all/modules/maestro/images/taskconsole/new_comment.gif
new file mode 100644
index 0000000000000000000000000000000000000000..8cbf11e4ee41a4cc389196050153502954f038ca
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/new_comment.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/new_task.gif b/sites/all/modules/maestro/images/taskconsole/new_task.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7c9a527891fe1e02cd984ba8926eac327c4036cb
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/new_task.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/reassign.png b/sites/all/modules/maestro/images/taskconsole/reassign.png
new file mode 100644
index 0000000000000000000000000000000000000000..06041886f32486569e59cc38855b299dfd90bc46
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/reassign.png differ
diff --git a/sites/all/modules/maestro/images/taskconsole/task.gif b/sites/all/modules/maestro/images/taskconsole/task.gif
new file mode 100644
index 0000000000000000000000000000000000000000..fc78e5d2e41fa8422c71d1799e6b22d033a55046
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/task.gif differ
diff --git a/sites/all/modules/maestro/images/taskconsole/trace.png b/sites/all/modules/maestro/images/taskconsole/trace.png
new file mode 100644
index 0000000000000000000000000000000000000000..31b82d16056fd2b9beb04d21a18d5431992d7d7c
Binary files /dev/null and b/sites/all/modules/maestro/images/taskconsole/trace.png differ
diff --git a/sites/all/modules/maestro/js/admin_template_editor.js b/sites/all/modules/maestro/js/admin_template_editor.js
new file mode 100644
index 0000000000000000000000000000000000000000..7100c45b8f7b5b4ed0587d6815d4dd2ab9330798
--- /dev/null
+++ b/sites/all/modules/maestro/js/admin_template_editor.js
@@ -0,0 +1,750 @@
+var draw_status = 0;
+var draw_type = 1;
+var line_start = '';
+var line_end = '';
+var existing_tasks = [];
+var line_ids = [];
+var lines = [];
+var dd = [];
+var steptypes = [];
+var taskIdCount = -1;
+var trueLineColor = "#000000";
+var falseLineColor = "#D10000";
+var oMenu;
+var panels = [];
+var oMenuBar;
+var menuCheckArray = [];
+var assignment_type = 0;
+var select_boxes = new Array();
+var posx = 0;
+var posy = 0;
+
+(function($) {
+  $(document).ready(function() {
+    initialize_drag_drop();
+    initialize_lines();
+    $('#maestro_workflow_container').mousedown(function (e) {
+      var el = $('#maestro_workflow_container').offset();
+      posx = e.pageX - el.left;
+      posy = e.pageY - el.top;
+    });
+  });
+
+})(jQuery);
+
+function initialize_drag_drop() {
+  (function($) {
+    $(".maestro_task_container").bind("dragstart", function(event, ui) {
+      //$(this.id).draggable( "option", "zIndex", 500 );
+      this.style.zIndex = 500;
+    });
+    $(".maestro_task_container").bind("dragstop", function(event, ui) {
+      update_lines(this);
+      //$(".maestro_task_container").draggable( "option", "zIndex", 100 );
+      this.style.zIndex = 100;
+      var task_class = this.className.split(' ')[0];
+      var task_id = this.id.substring(4, this.id.length);
+      enable_ajax_indicator();
+      $.ajax({
+        type: 'POST',
+        url: ajax_url + task_class + '/' + task_id + '/0/move/',
+        cache: false,
+        data: {offset_left: this.offsetLeft, offset_top: this.offsetTop},
+        success: disable_ajax_indicator,
+        error: editor_ajax_error
+      });
+    });
+    $(".maestro_task_container").bind("drag", function(event, ui) {
+      if (document.frm_animate.animateFlag.checked) {
+        update_lines(this);
+      }
+    });
+  })(jQuery);
+}
+
+function update_snap_to_grid() {
+  (function($) {
+    if (document.frm_animate.snapToGrid.checked) {
+      $( ".maestro_task_container" ).draggable("option", "grid", [25, 25]);
+    }
+    else {
+      $( ".maestro_task_container" ).draggable("option", "grid", false);
+    }
+  })(jQuery);
+}
+
+function update_snap_to_objects() {
+  (function($) {
+    if (document.frm_animate.snapToObjects.checked) {
+      $( ".maestro_task_container" ).draggable("option", "snap", true);
+    }
+    else {
+      $( ".maestro_task_container" ).draggable("option", "snap", false);
+    }
+  })(jQuery);
+}
+
+function update_lines(el) {
+  //update transactions involving el with the new coords
+  var cnt = 0;
+  var length = lines.length;
+  for (var i in lines) {
+    if (lines[i] != null && lines[i][8] != null) {
+      if (lines[i][5] == el || lines[i][6] == el) {
+        lines[i][8].clear();
+        lines[i] = connect_tasks(lines[i][5], lines[i][6], lines[i][7], lines[i][8]);
+      }
+    }
+  }
+}
+
+
+function initialize_lines() {
+  for (var i in line_ids) {
+    var start = document.getElementById(line_ids[i][0]);
+    var end = document.getElementById(line_ids[i][1]);
+
+    if (start != null && end != null) {
+      var line = connect_tasks(start, end, line_ids[i][2]);
+    }
+    lines.push(line);
+  }
+  redraw_lines();
+}
+
+function begin_task_connect() {
+  if (draw_status == 0) {
+    draw_status = 1;
+    document.getElementById('nf_tooltip').innerHTML = LANG_select_first;
+  }
+}
+
+function draw_line(line) {
+  //draw the line
+  line[8].drawLine(line[0], line[1], line[2], line[3]);
+
+  //draw the arrow start
+  line[8].fillEllipse(line[0] - 2, line[1] - 2, 6, 6);
+
+  //draw the arrow head
+  if (line[2] == line[2] && line[3] == line[3]) {     //since NaN never equals itself, we can use this trick to check for NaN
+    var start = line[4] - 30;
+    if (start < 0) {
+      start += 360;
+    }
+    var end = line[4] + 30
+    line[8].fillArc(line[2] - 10, line[3] - 10, 22, 22, start, end);
+  }
+
+  line[8].paint();
+}
+
+function connect_tasks(start, end, styleFlag, drawClass) {
+  var start_bottom = start.offsetTop + start.offsetHeight;
+  var end_bottom = end.offsetTop + end.offsetHeight;
+  var start_halfwidth = start.offsetWidth / 2;
+  var start_halfheight = start.offsetHeight /2;
+  var end_halfwidth = end.offsetWidth / 2;
+  var end_halfheight = end.offsetHeight / 2;
+  var start_midx = start.offsetLeft + start_halfwidth;
+  var start_midy = start.offsetTop + start_halfheight;
+  var end_midx = end.offsetLeft + end_halfwidth;
+  var end_midy = end.offsetTop + end_halfheight;
+  var line = [];
+  var x, y;
+  var x_st, y_st;
+
+  var x_diff = end_midx - start_midx;
+  var y_diff = end_midy - start_midy;
+
+  //find the point to draw the arc
+  var m = y_diff / x_diff;
+  var b = start.offsetTop + start_halfheight;
+
+  if (start_midx < end_midx) {
+    x = end.offsetLeft - end_halfwidth - 1;
+    x_st = start.offsetLeft + start_halfwidth + 1;
+  }
+  else {
+    x = end.offsetLeft + end_halfwidth;
+    x_st = start.offsetLeft - start_halfwidth - 1;
+  }
+
+  var excess = end_halfwidth - start_halfwidth;
+  var excess_st = start_halfwidth - start_halfwidth;
+  line[0] = x_st + start_halfwidth;
+  line[1] = (m * (x_st - start.offsetLeft + excess_st)) + b;
+
+  line[2] = x + end_halfwidth;
+  line[3] = (m * (x - start.offsetLeft + excess)) + b;
+
+  //start pos
+  if (line[1] > (start.offsetTop + start.offsetHeight)) {
+    y = start.offsetTop + start.offsetHeight + 1;
+    if (x_diff == 0) {
+      x = start_halfwidth + start.offsetLeft;
+      y -= start.offsetHeight + 1;
+    }
+    else {
+      x = ((y - b) / m) + start.offsetLeft - excess_st + start_halfwidth;
+    }
+    line[0] = x;
+    line[1] = y;
+  }
+  else if (line[1] < start.offsetTop) {
+    y = start.offsetTop - 1;
+    if (x_diff == 0) {
+      x = start_halfwidth + start.offsetLeft;
+      y += start.offsetHeight + 2;
+    }
+    else {
+      x = ((y - b) / m) + start.offsetLeft - excess_st + start_halfwidth;
+    }
+    line[0] = x;
+    line[1] = y;
+  }
+
+  //end pos
+  if (line[3] < end.offsetTop) {
+    y = end.offsetTop - 1;
+    if (x_diff == 0) {
+      x = end_halfwidth + end.offsetLeft;
+      y += end.offsetHeight;
+    }
+    else {
+      x = ((y - b) / m) + start.offsetLeft - excess + end_halfwidth;
+    }
+    line[2] = x;
+    line[3] = y;
+  }
+  else if (line[3] > (end.offsetTop + end.offsetHeight)) {
+    y = end.offsetTop + end.offsetHeight - 1;
+    if (x_diff == 0) {
+      x = end_halfwidth + end.offsetLeft;
+      y -= end.offsetHeight;
+    }
+    else {
+      x = ((y - b) / m) + start.offsetLeft - excess + end_halfwidth;
+    }
+    line[2] = x;
+    line[3] = y;
+  }
+
+  //find the angle to draw the arrow
+  if (x_diff > 0 && y_diff < 0) {         //quadrant 1
+    y_diff *= -1;
+    angle = cot(y_diff / x_diff);
+    angle += 180;
+    quad = 1;
+  }
+  else if (x_diff < 0 && y_diff < 0) {    //quadrant 2
+    x_diff *= -1;
+    y_diff *= -1;
+    angle = cot(x_diff / y_diff) + 270;
+    quad = 2;
+  }
+  else if (x_diff < 0 && y_diff > 0) {    //quadrant 3
+    x_diff *= -1;
+    angle = cot(y_diff / x_diff);
+    quad = 3;
+  }
+  else if (x_diff > 0 && y_diff > 0) {    //quadrant 4
+    angle = cot(x_diff / y_diff) + 90;
+    quad = 4;
+  }
+  else if (x_diff == 0 && y_diff < 0) {   //vertical, positive slope
+    angle = 270;
+  }
+  else if (x_diff == 0 && y_diff > 0) {   //vertical, negative slope
+    angle = 90;
+  }
+  else if (y_diff == 0 && x_diff < 0) {   //horizontal, moving left
+    angle = 0;
+  }
+  else if (y_diff == 0 && x_diff > 0) {   //horizontal, moving right
+    angle = 180;
+  }
+  else if (x_diff == 0 && y_diff == 0) {  //line to nowhere
+    angle = 0;
+  }
+
+  line[4] = angle;
+
+  //add to the record of lines
+  line[5] = start;
+  line[6] = end;
+  line[7] = styleFlag;
+  if (drawClass != null) {
+    line[8] = drawClass;
+  }
+  else if (line[8] != null) {
+    line[8].clear();
+  }
+  else {
+    line[8] = new jsGraphics('maestro_workflow_container');
+    line[8].setStroke(2);
+    if (styleFlag) {
+      line[8].setColor(trueLineColor);
+    }
+    else {
+      line[8].setColor(falseLineColor);
+    }
+  }
+
+  draw_line(line);
+
+  return line;
+}
+
+function redraw_lines() {
+  for (var i in lines) {
+    if (lines[i] != null && lines[i][5] != null) {
+      draw_line(lines[i]);
+    }
+  }
+}
+
+function display_task_panel(r) {
+  (function($) {
+    $.modal(r.html, { modal: true, overlayClose: false, position: [130, 0], overlayCss: {backgroundColor:"#888"}, opacity:80 });
+    disable_ajax_indicator();
+  })(jQuery);
+}
+
+function add_task_success(r) {
+  (function($) {
+    $('#maestro_workflow_container').append(r.html);
+    eval(r.js);
+    $(".maestro_task_container").draggable( {snap: true} );
+    initialize_drag_drop();
+    update_snap_to_grid();
+    update_snap_to_objects();
+    initialize_drag_drop();
+    disable_ajax_indicator();
+  })(jQuery);
+}
+
+function save_task(frm) {
+  var i;
+  for (i in select_boxes) {
+    select_all_options(document.getElementById(select_boxes[i]));
+  }
+
+  (function($) {
+    enable_ajax_indicator();
+    $.ajax({
+      type: 'POST',
+      url: ajax_url + frm.task_class.value + '/' + frm.template_data_id.value + '/0/save/',
+      cache: false,
+      data: $("#maestro_task_edit_form").serialize(),
+      dataType: 'json',
+      success: save_task_success,
+      error: editor_ajax_error
+    });
+  })(jQuery);
+
+  return false;
+}
+
+function save_task_success(r) {
+  (function($) {
+    var el = document.getElementById('task_title' + r.task_id);
+    if (el != null) {
+      el.innerHTML = document.getElementById('maestro_task_name').value;
+    }
+    el = document.getElementById('task_assignment' + r.task_id);
+    if (el != null) {
+      el.innerHTML = get_assignment_display();
+    }
+    $.modal.close();
+    disable_ajax_indicator();
+    select_boxes = [];   //reset the array for when the user re-opens the edit panel;
+  })(jQuery);
+}
+
+function get_assignment_display() {
+  var assigned = '';
+  var options = '';
+
+  assigned = Drupal.t('Assigned to:') + ' ' + get_summary('assign', '');
+
+  return assigned;
+}
+
+function draw_line_to(element) {
+  (function($) {
+    if (draw_status == 1) {
+      set_tool_tip('');
+      line_end = element;
+      if (line_start != line_end) {
+        //draw line now
+        var type = (draw_type == 1) ? true:false;
+        var line = connect_tasks(line_start, line_end, type);
+        lines.push(line);
+        var template_data_id = line_start.id.substr(4, line_start.id.length - 4);
+        var template_data_id2 = line_end.id.substr(4, line_end.id.length - 4);
+        var task_class = line_start.className.split(' ')[0];
+
+        if (draw_type == 2) {
+          $.ajax({
+            type: 'POST',
+            url: ajax_url + task_class + '/' + template_data_id + '/0/drawLineFalse/',
+            cache: false,
+            data: { line_to: template_data_id2 },
+            success: disable_ajax_indicator,
+            error: editor_ajax_error
+          });
+        }
+        else {
+          $.ajax({
+            type: 'POST',
+            url: ajax_url + task_class + '/' + template_data_id + '/0/drawLine/',
+            cache: false,
+            data: { line_to: template_data_id2 },
+            success: disable_ajax_indicator,
+            error: editor_ajax_error
+          });
+        }
+
+        enable_ajax_indicator();
+      }
+      draw_status = 0;
+    }
+  })(jQuery);
+}
+
+function clear_task_lines(el) {
+  (function($) {
+    var indexes = [];
+    var i = 0;
+    var j = 0;
+    var template_data_id = el.id.substr(4, el.id.length - 4);
+    var task_class = el.className.split(' ')[0];
+
+    for (i in lines) {
+      if (lines[i] != null && lines[i][8] != null) {
+        if (el == lines[i][5] || el == lines[i][6]) {
+          lines[i][8].clear();
+          delete lines[i][8];
+          indexes.push(i);
+        }
+      }
+    }
+    var cnt = 0;
+    var length = indexes.length;
+    for (i in indexes) {
+      if (++cnt > length) {
+        break;
+      }
+      lines.splice(indexes[i] - j++, 1);
+    }
+
+    enable_ajax_indicator();
+    $.ajax({
+      type: 'POST',
+      url: ajax_url + task_class + '/' + template_data_id + '/0/clearAdjacentLines/',
+      cache: false,
+      success: disable_ajax_indicator,
+      error: editor_ajax_error
+    });
+  })(jQuery);
+}
+
+function delete_task(r) {
+  (function($) {
+    disable_ajax_indicator();
+    if (r.success == 0) {  //warn the user first
+      set_tool_tip(r.message);
+    }
+    else {  //just make the task invisible for now, it will get fully deleted on page reload
+      clear_task_lines(document.getElementById('task' + r.task_id));
+      $('#' + 'task' + r.task_id).hide(300);
+    }
+  })(jQuery);
+}
+
+function grow_canvas() {
+  (function($) {
+    $('#maestro_workflow_container').height($('#maestro_workflow_container').height() + 100);
+    enable_ajax_indicator();
+    $.ajax({
+      type: 'POST',
+      url: ajax_url + 'MaestroTaskInterfaceStart/0/' + template_id + '/setCanvasHeight/',
+      cache: false,
+      data: { height: $('#maestro_workflow_container').height() },
+      success: disable_ajax_indicator,
+      error: editor_ajax_error
+    });
+  })(jQuery);
+}
+
+function shrink_canvas() {
+  (function($) {
+    if ($('#maestro_workflow_container').height() > 600) {
+      $('#maestro_workflow_container').height($('#maestro_workflow_container').height() - 100);
+      enable_ajax_indicator();
+      $.ajax({
+        type: 'POST',
+        url: ajax_url + 'MaestroTaskInterfaceStart/0/' + template_id + '/setCanvasHeight/',
+        cache: false,
+        data: { height: $('#maestro_workflow_container').height() },
+        success: disable_ajax_indicator,
+        error: editor_ajax_error
+      });
+    }
+  })(jQuery);
+}
+
+function switch_task_edit_section(id) {
+  var el;
+
+  document.getElementById('task_edit_main').style.display = 'none';
+  document.getElementById('task_edit_tab_main').className = 'unactive';
+
+  el = document.getElementById('task_edit_optional');
+  if (el != null) {
+    el.style.display = 'none';
+    document.getElementById('task_edit_tab_optional').className = 'unactive';
+  }
+
+  el = document.getElementById('task_edit_assignment');
+  if (el != null) {
+    el.style.display = 'none';
+    document.getElementById('task_edit_tab_assignment').className = 'unactive';
+  }
+
+  el = document.getElementById('task_edit_notification');
+  if (el != null) {
+    el.style.display = 'none';
+    document.getElementById('task_edit_tab_notification').className = 'unactive';
+  }
+
+  document.getElementById('task_edit_' + id).style.display = '';
+  document.getElementById('task_edit_tab_' + id).className = 'active';
+}
+
+function move_to_left(id, type) {
+  var left = document.getElementById(type + '_by_' + id + '_unselected');
+  var right = document.getElementById(type + '_by_' + id);
+  move_options(right, left);
+}
+
+function move_to_right(id, type) {
+  var left = document.getElementById(type + '_by_' + id + '_unselected');
+  var right = document.getElementById(type + '_by_' + id);
+  move_options(left, right);
+}
+
+function move_options(sel_from_id, sel_to_id) {
+  var sel_from = document.getElementById(sel_from_id);
+  var sel_to = document.getElementById(sel_to_id);
+
+  if (sel_from != null && sel_to != null) {
+    var len = sel_from.length;
+    var text = new Array();
+    var values = new Array();
+    var count = 0;
+    var i;
+
+    for (i = len - 1; i >= 0; i--) {
+      if (sel_from.options[i].selected) {
+        text[count] = sel_from.options[i].text;
+        values[count] = sel_from.options[i].value;
+        delete_option(sel_from, i);
+        count++;
+      }
+    }
+
+    for (i = count - 1; i >= 0; i--) {
+      add_option(sel_to, text[i], values[i]);
+    }
+  }
+
+  set_summary('assign');
+  set_summary('notify');
+}
+
+function get_selected_options(sel) {
+  var text = '';
+  var count = 0;
+  var i;
+  var len;
+
+  if (sel != null) {
+    len = sel.length;
+
+    for (i = len - 1; i >= 0; i--) {
+      if (sel.options[i].selected) {
+        if (text != '') {
+          text += ', ';
+        }
+        text += sel.options[i].text;
+      }
+    }
+  }
+
+  return text;
+}
+
+function delete_option(sel, index) {
+  var len = sel.length;
+  if(len > 0) {
+    sel.options[index] = null;
+  }
+}
+
+function add_option(sel, text, value) {
+  var opt = new Option(text, value);
+  var len = sel.length;
+  sel.options[len] = opt;
+}
+
+function select_all_options(sel) {
+  if (sel != null) {
+    var len = sel.length;
+    var i;
+
+    for (i = len - 1; i >= 0; i--) {
+      sel.options[i].selected = true;
+    }
+  }
+}
+
+function unselect_all_options(sel) {
+  if (sel != null) {
+    var len = sel.length;
+    var i;
+
+    for (i = len - 1; i >= 0; i--) {
+      sel.options[i].selected = false;
+    }
+  }
+}
+
+function add_variable() {
+  (function($) {
+    $('#optional_parm_vars').append(document.getElementById('optional_parm_form').innerHTML);
+    $('#optional_parm_vars').find('tr').each(function(i, el) {
+      el.className = ((i % 2) == 1) ? 'even':'odd';
+    });
+  })(jQuery);
+}
+
+function remove_variable(el) {
+  (function ($) {
+    $(el).closest('tr').remove();
+    $('#optional_parm_vars').find('tr').each(function(i, el) {
+      el.className = ((i % 2) == 1) ? 'even':'odd';
+    });
+  })(jQuery);
+}
+
+function editor_ajax_error() {
+  disable_ajax_indicator();
+  set_tool_tip('An AJAX error has occurred. The operation has failed.');
+}
+
+
+function toggle_list_type(area) {
+  (function ($) {
+    var type = '.' + $('#' + area + '_type').attr('value');
+    var by_var = '.' + $('#' + area + '_by_variable').attr('value');
+    var when = '';
+    if (area == 'notify') {
+      when = '.' + $('#notify_when').attr('value');
+    }
+
+    $('.' + area + '_row').hide();
+    $('.' + area + '_row' + type + by_var + when).show();
+
+    set_summary(area);
+  })(jQuery);
+}
+
+function set_summary(area) {
+  (function ($) {
+    if (area == 'assign') {
+      $('#' + area + '_summary').html(get_summary(area, ''));
+    }
+    else {
+      $('#' + area + '_assign_summary').html(get_summary(area, 'assignment'));
+      $('#' + area + '_complete_summary').html(get_summary(area, 'completion'));
+      $('#' + area + '_remind_summary').html(get_summary(area, 'reminder'));
+      $('#' + area + '_escalate_summary').html(get_summary(area, 'escalation'));
+    }
+  })(jQuery);
+}
+
+function get_summary(area, when) {
+  var summary = '';
+  var value;
+  var i;
+  var j;
+  var sel;
+
+  for (i in select_boxes) {
+    if ((select_boxes[i].indexOf(area + '_row') != -1) && (select_boxes[i].indexOf(when) != -1)) {
+      sel = document.getElementById(select_boxes[i]);
+      select_all_options(sel);
+
+      value = get_selected_options(sel);
+      if (value != '') {
+        if (summary != '') {
+          summary += ', ';
+        }
+        summary += value;
+      }
+
+      unselect_all_options(sel);
+    }
+  }
+
+  return summary;
+}
+
+
+function change_handler_option() {
+  (function($) {
+    var selected = $('#handler_options').attr('value');
+    var message = $('#handler_' + selected).attr('message');
+    $('#handler_options_message').html(message);
+
+    if (selected == '') {
+      $('#handler_options_other').show();
+    }
+    else {
+      $('#handler_options_other').hide();
+    }
+
+    $('#handler_options_other_text').attr('value', '');
+  })(jQuery);
+}
+
+
+
+
+//general helper functions
+function set_tool_tip(msg) {
+  if (msg == '') {
+    document.getElementById('maestro_tool_tip_container').style.display = 'none';
+  }
+  else {
+    document.getElementById('maestro_tool_tip_container').style.display = '';
+  }
+  document.getElementById('maestro_tool_tip').innerHTML = msg;
+}
+
+function enable_ajax_indicator() {
+  document.getElementById('maestro_ajax_indicator').style.display = '';
+}
+
+function disable_ajax_indicator() {
+  document.getElementById('maestro_ajax_indicator').style.display = 'none';
+}
+
+function cot(x) {
+  return Math.atan(x) * 57.2957795;
+}
+
+
+
diff --git a/sites/all/modules/maestro/js/jquery.contextmenu.js b/sites/all/modules/maestro/js/jquery.contextmenu.js
new file mode 100644
index 0000000000000000000000000000000000000000..e394cc6af5aa9a99ca23ff67a94e78ad93c24714
--- /dev/null
+++ b/sites/all/modules/maestro/js/jquery.contextmenu.js
@@ -0,0 +1,144 @@
+/*
+ * ContextMenu - jQuery plugin for right-click context menus
+ *
+ * Author: Chris Domigan
+ * Contributors: Dan G. Switzer, II
+ * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Version: r2
+ * Date: 16 July 2007
+ *
+ * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/
+ *
+ */
+
+(function($) {
+
+ 	var menu, shadow, trigger, content, hash, currentTarget;
+  var defaults = {
+    menuStyle: {
+      listStyle: 'none',
+      padding: '1px',
+      margin: '0px',
+      backgroundColor: '#fff',
+      border: '1px solid #999',
+      width: '100px'
+    },
+    itemStyle: {
+      margin: '0px',
+      color: '#000',
+      display: 'block',
+      cursor: 'default',
+      padding: '3px',
+      border: '1px solid #fff',
+      backgroundColor: 'transparent'
+    },
+    itemHoverStyle: {
+      border: '1px solid #0a246a',
+      backgroundColor: '#b6bdd2'
+    },
+    eventPosX: 'pageX',
+    eventPosY: 'pageY',
+    shadow : true,
+    onContextMenu: null,
+    onShowMenu: null
+ 	};
+
+  $.fn.contextMenu = function(id, options) {
+    if (!menu) {                                      // Create singleton menu
+      menu = $('<div id="jqContextMenu"></div>')
+               .hide()
+               .css({position:'absolute', zIndex:'500'})
+               .appendTo('body')
+               .bind('click', function(e) {
+                 e.stopPropagation();
+               });
+    }
+    if (!shadow) {
+      shadow = $('<div></div>')
+                 .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499})
+                 .appendTo('body')
+                 .hide();
+    }
+    hash = hash || [];
+    hash.push({
+      id : id,
+      menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}),
+      itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}),
+      itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}),
+      bindings: options.bindings || {},
+      shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow,
+      onContextMenu: options.onContextMenu || defaults.onContextMenu,
+      onShowMenu: options.onShowMenu || defaults.onShowMenu,
+      eventPosX: options.eventPosX || defaults.eventPosX,
+      eventPosY: options.eventPosY || defaults.eventPosY
+    });
+
+    var index = hash.length - 1;
+    $(this).bind('contextmenu', function(e) {
+      // Check if onContextMenu() defined
+      var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
+      if (bShowContext) display(index, this, e, options);
+      return false;
+    });
+    return this;
+  };
+
+  function display(index, trigger, e, options) {
+    var cur = hash[index];
+    content = $('#'+cur.id).find('ul:first').clone(true);
+    content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(
+      function() {
+        $(this).css(cur.itemHoverStyle);
+      },
+      function(){
+        $(this).css(cur.itemStyle);
+      }
+    ).find('img').css({verticalAlign:'middle',paddingRight:'2px'});
+
+    // Send the content to the menu
+    menu.html(content);
+
+    // if there's an onShowMenu, run it now -- must run after content has been added
+		// if you try to alter the content variable before the menu.html(), IE6 has issues
+		// updating the content
+    if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu);
+
+    $.each(cur.bindings, function(id, func) {
+      $('#'+id, menu).bind('click', function(e) {
+        hide();
+        func(trigger, currentTarget);
+      });
+    });
+
+    menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();
+    if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();
+    $(document).one('click', hide);
+  }
+
+  function hide() {
+    menu.hide();
+    shadow.hide();
+  }
+
+  // Apply defaults
+  $.contextMenu = {
+    defaults : function(userDefaults) {
+      $.each(userDefaults, function(i, val) {
+        if (typeof val == 'object' && defaults[i]) {
+          $.extend(defaults[i], val);
+        }
+        else defaults[i] = val;
+      });
+    }
+  };
+
+})(jQuery);
+
+(function($) {
+  $('div.contextMenu').hide();
+})(jQuery);
\ No newline at end of file
diff --git a/sites/all/modules/maestro/js/jquery.simplemodal.min.js b/sites/all/modules/maestro/js/jquery.simplemodal.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..7176e34fc17e83d0b482482556e92026d754551a
--- /dev/null
+++ b/sites/all/modules/maestro/js/jquery.simplemodal.min.js
@@ -0,0 +1,8 @@
+/*
+ * SimpleModal 1.3.5 - jQuery Plugin
+ * http://www.ericmmartin.com/projects/simplemodal/
+ * Copyright (c) 2010 Eric Martin (http://twitter.com/EricMMartin)
+ * Dual licensed under the MIT and GPL licenses
+ * Revision: $Id: jquery.simplemodal.min.js,v 1.1 2010/07/13 04:03:23 chevy Exp $
+ */
+;(function($){var ie6=$.browser.msie&&parseInt($.browser.version)==6&&typeof window['XMLHttpRequest']!="object",ieQuirks=null,w=[];$.modal=function(data,options){return $.modal.impl.init(data,options);};$.modal.close=function(){$.modal.impl.close();};$.fn.modal=function(options){return $.modal.impl.init(this,options);};$.modal.defaults={appendTo:'body',focus:true,opacity:50,overlayId:'simplemodal-overlay',overlayCss:{},containerId:'simplemodal-container',containerCss:{},dataId:'simplemodal-data',dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1000,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:'simplemodal-close',escClose:true,overlayClose:false,position:null,persist:false,modal:true,onOpen:null,onShow:null,onClose:null};$.modal.impl={o:null,d:{},init:function(data,options){var s=this;if(s.d.data){return false;}ieQuirks=$.browser.msie&&!$.boxModel;s.o=$.extend({},$.modal.defaults,options);s.zIndex=s.o.zIndex;s.occb=false;if(typeof data=='object'){data=data instanceof jQuery?data:$(data);s.d.placeholder=false;if(data.parent().parent().size()>0){data.before($('<span></span>').attr('id','simplemodal-placeholder').css({display:'none'}));s.d.placeholder=true;s.display=data.css('display');if(!s.o.persist){s.d.orig=data.clone(true);}}}else if(typeof data=='string'||typeof data=='number'){data=$('<div></div>').html(data);}else{alert('SimpleModal Error: Unsupported data type: '+typeof data);return s;}s.create(data);data=null;s.open();if($.isFunction(s.o.onShow)){s.o.onShow.apply(s,[s.d]);}return s;},create:function(data){var s=this;w=s.getDimensions();if(s.o.modal&&ie6){s.d.iframe=$('<iframe src="javascript:false;"></iframe>').css($.extend(s.o.iframeCss,{display:'none',opacity:0,position:'fixed',height:w[0],width:w[1],zIndex:s.o.zIndex,top:0,left:0})).appendTo(s.o.appendTo);}s.d.overlay=$('<div></div>').attr('id',s.o.overlayId).addClass('simplemodal-overlay').css($.extend(s.o.overlayCss,{display:'none',opacity:s.o.opacity/100,height:s.o.modal?w[0]:0,width:s.o.modal?w[1]:0,position:'fixed',left:0,top:0,zIndex:s.o.zIndex+1})).appendTo(s.o.appendTo);s.d.container=$('<div></div>').attr('id',s.o.containerId).addClass('simplemodal-container').css($.extend(s.o.containerCss,{display:'none',position:'fixed',zIndex:s.o.zIndex+2})).append(s.o.close&&s.o.closeHTML?$(s.o.closeHTML).addClass(s.o.closeClass):'').appendTo(s.o.appendTo);s.d.wrap=$('<div></div>').attr('tabIndex',-1).addClass('simplemodal-wrap').css({height:'100%',outline:0,width:'100%'}).appendTo(s.d.container);s.d.data=data.attr('id',data.attr('id')||s.o.dataId).addClass('simplemodal-data').css($.extend(s.o.dataCss,{display:'none'})).appendTo('body');data=null;s.setContainerDimensions();s.d.data.appendTo(s.d.wrap);if(ie6||ieQuirks){s.fixIE();}},bindEvents:function(){var s=this;$('.'+s.o.closeClass).bind('click.simplemodal',function(e){e.preventDefault();s.close();});if(s.o.modal&&s.o.close&&s.o.overlayClose){s.d.overlay.bind('click.simplemodal',function(e){e.preventDefault();s.close();});}$(document).bind('keydown.simplemodal',function(e){if(s.o.modal&&s.o.focus&&e.keyCode==9){s.watchTab(e);}else if((s.o.close&&s.o.escClose)&&e.keyCode==27){e.preventDefault();s.close();}});$(window).bind('resize.simplemodal',function(){w=s.getDimensions();s.setContainerDimensions(true);if(ie6||ieQuirks){s.fixIE();}else if(s.o.modal){s.d.iframe&&s.d.iframe.css({height:w[0],width:w[1]});s.d.overlay.css({height:w[0],width:w[1]});}});},unbindEvents:function(){$('.'+this.o.closeClass).unbind('click.simplemodal');$(document).unbind('keydown.simplemodal');$(window).unbind('resize.simplemodal');this.d.overlay.unbind('click.simplemodal');},fixIE:function(){var s=this,p=s.o.position;$.each([s.d.iframe||null,!s.o.modal?null:s.d.overlay,s.d.container],function(i,el){if(el){var bch='document.body.clientHeight',bcw='document.body.clientWidth',bsh='document.body.scrollHeight',bsl='document.body.scrollLeft',bst='document.body.scrollTop',bsw='document.body.scrollWidth',ch='document.documentElement.clientHeight',cw='document.documentElement.clientWidth',sl='document.documentElement.scrollLeft',st='document.documentElement.scrollTop',s=el[0].style;s.position='absolute';if(i<2){s.removeExpression('height');s.removeExpression('width');s.setExpression('height',''+bsh+' > '+bch+' ? '+bsh+' : '+bch+' + "px"');s.setExpression('width',''+bsw+' > '+bcw+' ? '+bsw+' : '+bcw+' + "px"');}else{var te,le;if(p&&p.constructor==Array){var top=p[0]?typeof p[0]=='number'?p[0].toString():p[0].replace(/px/,''):el.css('top').replace(/px/,'');te=top.indexOf('%')==-1?top+' + (t = '+st+' ? '+st+' : '+bst+') + "px"':parseInt(top.replace(/%/,''))+' * (('+ch+' || '+bch+') / 100) + (t = '+st+' ? '+st+' : '+bst+') + "px"';if(p[1]){var left=typeof p[1]=='number'?p[1].toString():p[1].replace(/px/,'');le=left.indexOf('%')==-1?left+' + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"':parseInt(left.replace(/%/,''))+' * (('+cw+' || '+bcw+') / 100) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}}else{te='('+ch+' || '+bch+') / 2 - (this.offsetHeight / 2) + (t = '+st+' ? '+st+' : '+bst+') + "px"';le='('+cw+' || '+bcw+') / 2 - (this.offsetWidth / 2) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}s.removeExpression('top');s.removeExpression('left');s.setExpression('top',te);s.setExpression('left',le);}}});},focus:function(pos){var s=this,p=pos||'first';var input=$(':input:enabled:visible:'+p,s.d.wrap);input.length>0?input.focus():s.d.wrap.focus();},getDimensions:function(){var el=$(window);var h=$.browser.opera&&$.browser.version>'9.5'&&$.fn.jquery<='1.2.6'?document.documentElement['clientHeight']:$.browser.opera&&$.browser.version<'9.5'&&$.fn.jquery>'1.2.6'?window.innerHeight:el.height();return[h,el.width()];},getVal:function(v){return v=='auto'?0:v.indexOf('%')>0?v:parseInt(v.replace(/px/,''));},setContainerDimensions:function(resize){var s=this;if(!resize||(resize&&s.o.autoResize)){var ch=$.browser.opera?s.d.container.height():s.getVal(s.d.container.css('height')),cw=$.browser.opera?s.d.container.width():s.getVal(s.d.container.css('width')),dh=s.d.data.outerHeight(true),dw=s.d.data.outerWidth(true);var mh=s.o.maxHeight&&s.o.maxHeight<w[0]?s.o.maxHeight:w[0],mw=s.o.maxWidth&&s.o.maxWidth<w[1]?s.o.maxWidth:w[1];if(!ch){if(!dh){ch=s.o.minHeight;}else{if(dh>mh){ch=mh;}else if(dh<s.o.minHeight){ch=s.o.minHeight;}else{ch=dh;}}}else{ch=ch>mh?mh:ch;}if(!cw){if(!dw){cw=s.o.minWidth;}else{if(dw>mw){cw=mw;}else if(dw<s.o.minWidth){cw=s.o.minWidth;}else{cw=dw;}}}else{cw=cw>mw?mw:cw;}s.d.container.css({height:ch,width:cw});if(dh>ch||dw>cw){s.d.wrap.css({overflow:'auto'});}}if(s.o.autoPosition){s.setPosition();}},setPosition:function(){var s=this,top,left,hc=(w[0]/2)-(s.d.container.outerHeight(true)/2),vc=(w[1]/2)-(s.d.container.outerWidth(true)/2);if(s.o.position&&Object.prototype.toString.call(s.o.position)==="[object Array]"){top=s.o.position[0]||hc;left=s.o.position[1]||vc;}else{top=hc;left=vc;}s.d.container.css({left:left,top:top});},watchTab:function(e){var s=this;if($(e.target).parents('.simplemodal-container').length>0){s.inputs=$(':input:enabled:visible:first, :input:enabled:visible:last',s.d.data[0]);if((!e.shiftKey&&e.target==s.inputs[s.inputs.length-1])||(e.shiftKey&&e.target==s.inputs[0])||s.inputs.length==0){e.preventDefault();var pos=e.shiftKey?'last':'first';setTimeout(function(){s.focus(pos);},10);}}else{e.preventDefault();setTimeout(function(){s.focus();},10);}},open:function(){var s=this;s.d.iframe&&s.d.iframe.show();if($.isFunction(s.o.onOpen)){s.o.onOpen.apply(s,[s.d]);}else{s.d.overlay.show();s.d.container.show();s.d.data.show();}s.focus();s.bindEvents();},close:function(){var s=this;if(!s.d.data){return false;}s.unbindEvents();if($.isFunction(s.o.onClose)&&!s.occb){s.occb=true;s.o.onClose.apply(s,[s.d]);}else{if(s.d.placeholder){var ph=$('#simplemodal-placeholder');if(s.o.persist){ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display',s.display));}else{s.d.data.hide().remove();ph.replaceWith(s.d.orig);}}else{s.d.data.hide().remove();}s.d.container.hide().remove();s.d.overlay.hide().remove();s.d.iframe&&s.d.iframe.hide().remove();s.d={};}}};})(jQuery);
\ No newline at end of file
diff --git a/sites/all/modules/maestro/js/maestro_structure_admin.js b/sites/all/modules/maestro/js/maestro_structure_admin.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5c948d2875803c6f0f67e4a67f88d7681d602ce
--- /dev/null
+++ b/sites/all/modules/maestro/js/maestro_structure_admin.js
@@ -0,0 +1,528 @@
+var maestro_structure_cntr=0;
+
+function maestro_OpenCloseCreateVariable(cntr) {
+	jQuery('#variableAdd_' + cntr).toggle();
+}
+
+function maestro_saveTemplateName(id, cntr) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error.  Please try your save again.');
+	var ajaxwaitobject='#maestro_updating_' + cntr;
+	var frmID = "#maestro_template_save_" + cntr;
+	dataString = jQuery(frmID).serialize();
+	dataString += "&id=" + id;
+	dataString += "&cntr=" + cntr;
+	dataString += "&op=savetemplate";
+	maestro_structure_cntr = cntr;
+	jQuery('#maestro_updating_' + cntr).addClass('maestro_working');
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function (data) {
+			jQuery('#maestro_updating_' + maestro_structure_cntr).removeClass('maestro_working');
+			if (data.status == "0") { // query failed
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			} else {
+				maestro_hideErrorBar();
+				jQuery('#maestro_error_message').html('');
+			}
+		},
+		
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_CreateVariable(id, cntr) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error saving your variable.  Please try your save again.');
+	var ajaxwaitobject='#maestro_variable_updating_' + cntr;
+	var frmID = "#frmVariableAdd_" + cntr;
+	dataString = jQuery(frmID).serialize();
+	dataString += "&id=" + id;
+	dataString += "&cntr=" + cntr;
+	dataString += "&op=createvariable";
+	maestro_structure_cntr = cntr;
+	jQuery('#maestro_variable_updating_' + cntr).addClass('maestro_working');
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery("#newVariableName").attr("value", "");
+			jQuery("#newVariableValue").attr("value", "");
+			jQuery('#maestro_variable_updating_' + maestro_structure_cntr).removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#ajaxReplaceTemplateVars_' + data.cntr).html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template variable.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_CancelTemplateVariable(id) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error cancelling your variable edit.  Please try your cancel again.');
+	var ajaxwaitobject='#maestro_variable_updating_' + maestro_structure_cntr;
+	dataString = "";
+	dataString += "id=" + id;
+	dataString += "&op=showvariables";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery("#newVariableName").attr("value", "");
+			jQuery("#newVariableValue").attr("value", "");
+			jQuery('#maestro_variable_updating_' + maestro_structure_cntr).removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#ajaxReplaceTemplateVars_' + data.cntr).html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template variable.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_saveTemplateVariable(tid, var_id) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error saving your variable.  Please try your save again.');
+	var ajaxwaitobject='#maestro_updating_variable_' + maestro_structure_cntr;
+	var name = jQuery('#editVarName_' + var_id).attr("value");
+	var val = jQuery('#editVarValue_' + var_id).attr("value");
+	dataString = "";
+	dataString += "id=" + var_id;
+	dataString += "&name=" + name;
+	dataString += "&val=" + val;
+	dataString += "&op=updatevariable";
+	jQuery('#maestro_updating_variable_' + var_id).addClass('maestro_working');
+	maestro_structure_cntr = var_id;
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery('#maestro_updating_variable_' + data.var_id).removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#ajaxReplaceTemplateVars_' + data.cntr).html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template variable.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_deleteTemplateVariable(tid, var_id, cntr) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error deleting your variable.  Please try your delete again.');
+	var ajaxwaitobject='#maestro_updating_variable_' + maestro_structure_cntr;
+	var name = jQuery('#editVarName_' + var_id).attr("value");
+	var val = jQuery('#editVarValue_' + var_id).attr("value");
+	var x = confirm(Drupal.t('Delete this variable?'));
+	if (x) {
+		dataString = "";
+		dataString += "id=" + var_id;
+		dataString += "&tid=" + tid;
+		dataString += "&cntr=" + cntr;
+		dataString += "&op=deletevariable";
+		jQuery.ajax( {
+			type : 'POST',
+			cache : false,
+			url : ajax_url,
+			dataType : "json",
+			success : function(data){
+				jQuery('#maestro_updating_variable_' + data.var_id).removeClass('maestro_working');
+				if (data.status == "1") {
+					maestro_hideErrorBar();
+					jQuery('#ajaxReplaceTemplateVars_' + data.cntr).html(data.data);
+				} else {
+					maestro_showErrorBar();
+					var error = Drupal.t('There has been an error deleting your template variable.\nYou can\'t delete the "initiator" variable.\nPlease try your delete again.');
+					alert(error);
+			
+				}
+			},
+			error : function (request, status, error){
+				maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+			},
+			data : dataString
+		});
+	} else {
+		return false;
+	}
+}
+
+function maestro_editTemplateVariable(tid, var_id) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error editing your variable.  Please try your edit again.');
+	var ajaxwaitobject='#maestro_updating_variable_' + maestro_structure_cntr;
+	dataString = "";
+	dataString += "id=" + var_id;
+	dataString += "&tid=" + tid;
+	dataString += "&op=editvariable";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery('#maestro_updating_variable_' + data.var_id).removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#ajaxReplaceTemplateVars_' + data.cntr).html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template variable.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_CreateTemplate() {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error creating your template.  Please try your create again.');
+	var ajaxwaitobject='#maestro_new_template_updating';
+	jQuery('#maestro_new_template_updating').addClass('maestro_working');
+	var name = jQuery('#newTemplateName').attr("value");
+	dataString = "";
+	dataString += "name=" + name;
+	dataString += "&op=createtemplate";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery('#maestro_new_template_updating').removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#maestro_template_admin').html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your template.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_CreateAppgroup() {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error creating your Application Group.  Please try your create again.');
+	var ajaxwaitobject='#maestro_new_appgroup_updating';
+	jQuery('#maestro_new_appgroup_updating').addClass('maestro_working');
+	var name = jQuery('#appGroupName').attr("value");
+	dataString = "";
+	dataString += "name=" + name;
+	dataString += "&op=createappgroup";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			jQuery('#maestro_new_appgroup_updating').removeClass('maestro_working');
+			jQuery('#appGroupName').attr("value","");
+			if (data.status == "0") {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error saving your App Group.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+			else {
+				maestro_hideErrorBar();
+				maestro_refreshAppGroup('deleteAppGroup');
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_refreshAppGroup(which) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an AJAX error refreshing your Application Group.');
+	var ajaxwaitobject='#maestro_new_appgroup_updating';
+	dataString = "";
+	dataString += "id=" + name;
+	dataString += "&which=" + which;
+	dataString += "&op=refreshappgroup";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success :  function(data){
+			jQuery('#maestro_del_appgroup_updating').removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#replaceDeleteAppGroup').html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error deleting your app gropu.  Please try your delete again.');
+				jQuery('#maestro_error_message').html(error);
+	
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_DeleteAppgroup() {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error deleting your Application Group.  Please try your delete again.');
+	var ajaxwaitobject='#maestro_del_appgroup_updating';
+	jQuery('#maestro_del_appgroup_updating').addClass('maestro_working');
+	var name = jQuery('#deleteAppGroup').attr("value");
+	dataString = "";
+	dataString += "id=" + name;
+	dataString += "&op=deleteappgroup";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+		jQuery('#maestro_del_appgroup_updating').removeClass('maestro_working');
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				jQuery('#replaceDeleteAppGroup').html(data.data);
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error deleting your app gropu.  Please try your delete again.');
+				jQuery('#maestro_error_message').html(error);
+	
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_deleteTemplate(tid) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error deleting your Template.  Please try your delete again.');
+	var ajaxwaitobject='';
+	var x = confirm(Drupal.t('Delete this template?'));
+	if (x) {
+		dataString = "";
+		dataString += "id=" + tid;
+		dataString += "&op=deletetemplate";
+		jQuery.ajax( {
+			type : 'POST',
+			cache : false,
+			url : ajax_url,
+			dataType : "json",
+			success : function(data){
+				if (data.status == "1") {
+					maestro_hideErrorBar();
+					jQuery('#maestro_template_admin').html(data.data);
+				} else {
+					maestro_showErrorBar();
+					var error = Drupal.t('There has been an error deleting your template.  Please try your save again.');
+					jQuery('#maestro_error_message').html(error);
+				}
+			},
+			error : function (request, status, error){
+				maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+			},
+			data : dataString
+		});
+	} else {
+		return false;
+	}
+}
+
+function maestro_copyTemplate(tid) {
+	maestro_hideErrorBar();
+	var errormsg=Drupal.t('There has been an error copying your Template.  Please try your copy again.');
+	var ajaxwaitobject='';
+	dataString = "";
+	dataString += "id=" + tid;
+	dataString += "&op=copytemplate";
+	jQuery.ajax( {
+		type : 'POST',
+		cache : false,
+		url : ajax_url,
+		dataType : "json",
+		success : function(data){
+			if (data.status == "1") {
+				maestro_hideErrorBar();
+				document.location.reload();
+			} else {
+				maestro_showErrorBar();
+				var error = Drupal.t('There has been an error copying your template.  Please try your save again.');
+				jQuery('#maestro_error_message').html(error);
+			}
+		},
+		error : function (request, status, error){
+			maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error);
+		},
+		data : dataString
+	});
+}
+
+function maestro_showErrorBar() {
+	jQuery('#maestro_error_row').removeClass('maestro_hide_item');
+	jQuery('#maestro_error_row').addClass('maestro_show_item');
+}
+function maestro_hideErrorBar() {
+	var error = '';
+	jQuery('#maestro_error_message').html(error);
+	jQuery('#maestro_error_row').removeClass('maestro_show_item');
+	jQuery('#maestro_error_row').addClass('maestro_hide_item');
+}
+
+
+function maestro_structure_handleAjaxError(ajaxwaitobject, errormsg, request, status, error) {
+	if(errormsg != '') {
+		maestro_showErrorBar();
+		jQuery('#maestro_error_message').html(errormsg);
+		var el=document.getElementById('maestro_template_admin');
+		el.scrollIntoView(true);
+	}
+	if(ajaxwaitobject != '') jQuery(ajaxwaitobject).removeClass('maestro_working');
+}
+
+
+jQuery(function($) {
+  $('#importMaestroTemplate').click(function() {
+	maestro_hideErrorBar();
+	maestro_hideImportMessages();
+    dataString = "op=openimport";
+    jQuery.ajax( {
+      type : 'POST',
+      cache : false,
+      url : ajax_url + '/openimport',
+      dataType : "json",
+      data : dataString,
+      success : function(data) {
+        try{
+        	if (data.status == 1) {
+        		$("#importTemplate").toggle();	          
+        	} 
+        	else {
+        		var error = Drupal.t('There has been an error.  Either you do not have enough permissions to perform this action or you have not enabled the import in the configuration panel.');
+            	maestro_structure_handleAjaxError(null, error, null, 0, null);	
+        	}
+        }
+        catch(ex) {
+        	var error = Drupal.t('There has been an error.  Either you do not have enough permissions to perform this action or you have not enabled the import in the configuration panel.');
+        	maestro_structure_handleAjaxError(null, error, null, 0, null);	
+        }
+      },
+      error : function() {
+    	  var error = Drupal.t('There has been an error.  Either you do not have enough permissions to perform this action or you have not enabled the import in the configuration panel.');
+    	  jQuery('#maestro_error_message').html(error);
+    	  maestro_showErrorBar(); 
+    	  }
+    });
+    return false;
+  })
+});
+
+jQuery(function($) {
+	  $('#doMaestroTemplateImport').click(function() {
+		maestro_hideErrorBar();
+		maestro_hideImportMessages();
+		var frmID = "#maestroImportTemplateFrm";
+		dataString = jQuery(frmID).serialize();
+		dataString += "&op=doimport";
+	    jQuery.ajax( {
+	      type : 'POST',
+	      cache : false,
+	      url : ajax_url + '/doimport',
+	      dataType : "json",
+	      data : dataString,
+	      success : function(data) {
+	        try{
+	        	if (data.status == 1) {
+	        		maestro_hideImportMessages();
+	        		jQuery('#importSuccessMessage').removeClass('maestro_hide_item');
+	        		jQuery('#importSuccessMessage').addClass('maestro_show_item');  
+	        		document.location.reload();
+	        	}
+	        	else if(data.status == -1) {
+	        		maestro_hideImportMessages();
+	        		jQuery('#importProblemMessage').removeClass('maestro_hide_item');
+	        		jQuery('#importProblemMessage').addClass('maestro_show_item');     
+	        	}
+	        	else {
+	        		maestro_hideImportMessages();
+	        		jQuery('#importFailureMessage').removeClass('maestro_hide_item');
+	        		jQuery('#importFailureMessage').addClass('maestro_show_item');     
+	        	}
+	        }
+	        catch(ex) {
+	        	maestro_hideImportMessages();
+        		jQuery('#importFailureMessage').removeClass('maestro_hide_item');
+        		jQuery('#importFailureMessage').addClass('maestro_show_item');   
+	        }
+	      },
+	      error : function() {
+	    	maestro_hideImportMessages();
+      		jQuery('#importFailureMessage').removeClass('maestro_hide_item');
+      		jQuery('#importFailureMessage').addClass('maestro_show_item');   
+	    	  }
+	    });
+	    return false;
+	  })
+	});
+
+
+function maestro_hideImportMessages() {
+	jQuery('#importFailureMessage').removeClass('maestro_show_item');
+	jQuery('#importFailureMessage').addClass('maestro_hide_item');     
+	jQuery('#importSuccessMessage').removeClass('maestro_show_item');
+	jQuery('#importSuccessMessage').addClass('maestro_hide_item');    
+	jQuery('#importProblemMessage').removeClass('maestro_show_item');
+	jQuery('#importProblemMessage').addClass('maestro_hide_item');    
+	
+	
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/js/moderator.js b/sites/all/modules/maestro/js/moderator.js
new file mode 100644
index 0000000000000000000000000000000000000000..f1693cc2912013387988f8771fa524f5d3c617a5
--- /dev/null
+++ b/sites/all/modules/maestro/js/moderator.js
@@ -0,0 +1,183 @@
+function show_reassign(link, uid) {
+  (function ($) {
+    var html;
+    var show_flag = true;
+
+    if ($('#reassign_form').html() != null) {
+      if ($('#reassign_form').closest('tr').attr('id') == $(link).closest('tr').attr('id')) {
+        show_flag = false;
+      }
+      $('#reassign_form').remove();
+    }
+
+    if (show_flag == true) {
+      html  = '<div id="reassign_form"><form style="margin: 8px 0px 8px 0px; padding: 0px" method="post" action="' + $(link).attr('href') + '">';
+      html += $('#user_select').html();
+      html += '<input type="hidden" name="current_uid" value="' + uid + '">';
+      html += '<input type="submit" value="' + Drupal.t('Go') + '">';
+      html += '</form></div>';
+
+      $(link).closest('td').append(html);
+    }
+  })(jQuery);
+}
+
+function switch_process_focus(pid) {
+  (function ($) {
+    var newclass;
+
+    newclass = $('.focused_process').attr('class').replace('focused', 'blurred').replace('odd', 'even');
+    $('.focused_process').attr('class', newclass);
+    newclass = $('.process' + pid).attr('class').replace('blurred', 'focused').replace('even', 'odd');
+    $('.process' + pid).attr('class', newclass);
+
+    $('.process_variables').hide();
+    $('#process_variables' + pid).show();
+  })(jQuery);
+}
+
+function set_archived(el, index) {
+  (function ($) {
+    $('#archived' + index).attr('value', (el.checked) ? 1:0);
+  })(jQuery);
+}
+
+function set_batch_op(el, index) {
+  (function ($) {
+    $('#batch_op' + index).attr('value', (el.checked) ? 1:0);
+  })(jQuery);
+}
+
+function save_task_changes(frm) {
+  (function ($) {
+    enable_activity_indicator();
+    $.ajax({
+      type: 'POST',
+      url: ajax_url,
+      cache: false,
+      data: $("#maestro_task_history_form").serialize(),
+      dataType: 'json',
+      success: save_success,
+      error: moderator_ajax_error
+    });
+  })(jQuery);
+}
+
+function save_process_variables(frm) {
+  (function ($) {
+    enable_activity_indicator();
+    $.ajax({
+      type: 'POST',
+      url: ajax_url,
+      cache: false,
+      data: $("#maestro_process_variables_form").serialize(),
+      dataType: 'json',
+      success: save_success,
+      error: moderator_ajax_error
+    });
+  })(jQuery);
+}
+
+function save_success() {
+  location.reload();
+}
+
+function enable_activity_indicator() {
+  document.getElementById('maestro_ajax_indicator').style.display = '';
+}
+
+function disable_activity_indicator() {
+  document.getElementById('maestro_ajax_indicator').style.display = 'none';
+}
+
+function moderator_ajax_error() {
+  disable_activity_indicator();
+}
+
+jQuery(function($) {
+  $('#filterAllFlows').click(function() {
+	jQuery('#maestro_filter_working').addClass('maestro_working');
+	maestro_allFlowsHideErrorBar();
+	dataString = jQuery('#maestroFilterAllFlowsFrm').serialize();
+    jQuery.ajax( {
+      type : 'POST',
+      cache : false,
+      url : filter_url + '/filterprojects',
+      dataType : "json",
+      data : dataString,
+      success : function(data) {
+        try{
+        	if (data.status == 1) {
+        		//success	  
+        		jQuery('#maestro_filter_working').removeClass('maestro_working');
+        		jQuery('#maestro_all_flows_display').html(data.html);
+        	} 
+        	else {
+        		maestro_allFlowsShowErrorBar(Drupal.t('There has been an error with your filter.  Please adjust the filter and try again'));
+        		jQuery('#maestro_filter_working').removeClass('maestro_working');
+        	}
+        }
+        catch(ex) {
+        	maestro_allFlowsShowErrorBar(Drupal.t('There has been an error. Please try again'));
+        	jQuery('#maestro_filter_working').removeClass('maestro_working');
+        }
+      },
+      error : function() {
+    	  maestro_allFlowsShowErrorBar(Drupal.t('There has been an error. Please try again'));
+    	  jQuery('#maestro_filter_working').removeClass('maestro_working');
+    	  }
+    });
+    return false;
+  })
+});
+
+
+
+function maestro_allFlowsShowErrorBar(error) {
+	jQuery('#maestro_error_message').html(error);
+	jQuery('#maestro_error_message').removeClass('maestro_hide_item');
+	jQuery('#maestro_error_message').addClass('maestro_show_item');
+}
+function maestro_allFlowsHideErrorBar() {
+	var error = '';
+	jQuery('#maestro_error_message').html(error);
+}
+
+function maestro_get_project_details(obj) {
+  var projectID = jQuery(obj).attr('pid');
+    var img, index, newicon;
+    img = jQuery('#maestro_viewdetail_' + projectID).attr('src');
+    index = img.indexOf('_closed');
+    if(index>0) {
+      jQuery.ajax({
+        type: 'POST',
+      url : ajax_url + '/getprojectdetails',
+      cache: false,
+      data : {
+      projectID : projectID,
+      },
+      dataType: 'json',
+      success:  function (data) {
+        if (data.status == 1) {
+        index = img.indexOf('_closed');
+        newicon = img.substr(0, index) + '_open' + img.substr(index + 7);
+        jQuery('#maestro_viewdetail_' + projectID).attr('src',newicon);
+        jQuery('#maestro_project_information_row_' + projectID).toggle();
+        jQuery('#maestro_project_information_div_'+ projectID).html(data.html);
+        } else {
+          alert('An error occurred updating assignment');
+        }
+      },
+      error: function() { alert('there was a SERVER Error processing AJAX request'); }
+
+      });
+    }
+    else {
+      jQuery('#maestro_project_information_row_' + projectID).toggle();
+      img = jQuery('#maestro_viewdetail_' + projectID).attr('src');
+        index = img.indexOf('_open');
+        newicon = img.substr(0, index) + '_closed' + img.substr(index + 5);
+    jQuery('#maestro_viewdetail_' + projectID).attr('src',newicon);
+    }
+
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/js/taskconsole.js b/sites/all/modules/maestro/js/taskconsole.js
new file mode 100644
index 0000000000000000000000000000000000000000..527355d8b2402c79b5b25e6e487aead9da8188b1
--- /dev/null
+++ b/sites/all/modules/maestro/js/taskconsole.js
@@ -0,0 +1,287 @@
+// $Id:
+
+/**
+ * @file
+ * taskconsole.js
+ */
+
+/* When the task name in the task console is clicked, open the interactive task (inline function)
+ * Trigger the AJAX update to update the task start_date
+ */
+jQuery(function($) {
+  $('.maestro_taskconsole_interactivetaskName a').click(function() {
+    var taskid = jQuery(this).attr('taskid');
+    $('#maestro_actionrec' + taskid).toggle();
+    $.post(ajax_url + '/starttask/',"taskid=" + taskid);
+    if (document.getElementById('maestro_actionrec' + taskid)) {
+      $('html,body').animate({scrollTop: $('#maestro_actionrec' + taskid).offset().top - 125},500);
+    }
+  })
+});
+
+
+/* When the task name in the task console is clicked, open the interactive task (inline function)
+ * Trigger the AJAX update to update the task start_date
+ */
+jQuery(function($) {
+  $('.maestro_taskconsole_viewdetail').click(function() {
+    var taskid = jQuery(this).attr('taskid');
+    var rowid = jQuery(this).attr('rowid');
+    if (document.getElementById('maestro_taskconsole_detail_rec' + taskid).style.display == 'none') {
+      $('#maestro_ajax_indicator' + taskid).show();
+      $.ajax({
+        type: 'POST',
+        url : ajax_url + '/getdetails',
+        cache: false,
+        data : {
+        taskid : taskid,
+        rowid : rowid
+        },
+        dataType: 'json',
+        success:  function (data) {
+          if (data.status == 1) {
+            // Swap the image of the closed folder for a open folder icon
+            var s = $('#maestro_viewdetail_foldericon' + taskid).attr('src');
+            var index = s.indexOf('_closed');
+            var newicon = s.substr(0, index) + '_open' + s.substr(index + 7);
+            $('#maestro_viewdetail_foldericon' + taskid).attr('src',newicon);
+            $('#projectdetail_rec' + rowid).html(data.html);
+            $('#maestro_taskconsole_detail_rec' + taskid).show();
+            $('#maestro_ajax_indicator' + taskid).hide();
+          } else {
+            alert('An error occurred updating assignment');
+          }
+        },
+        error: function() { alert('there was a SERVER Error processing AJAX request'); }
+
+      });
+
+    } else {
+        // Swap the image of the open folder for a closed folder icon
+        var s = $('#maestro_viewdetail_foldericon' + taskid).attr('src');
+        var index = s.indexOf('_open');
+        var newicon = s.substr(0, index) + '_closed' + s.substr(index + 5);
+        $('#maestro_viewdetail_foldericon' + taskid).attr('src',newicon);
+        $('#maestro_taskconsole_detail_rec' + taskid).hide();
+    }
+
+  })
+});
+
+
+/* In the project details area, the workflow admin can change the assigned user for a task */
+function maestro_ajaxUpdateTaskAssignment(id) {
+  (function ($) {
+    $.ajax({
+      type: 'POST',
+      url : ajax_url + '/setassignment',
+      cache: false,
+      data: $("#frmOutstandingTasksRow" + id).serialize(),
+      dataType: 'json',
+      success:  function (data) {
+        if (data.status != 1) {
+          alert('An error occurred updating assignment');
+        }
+      },
+      error: function() { alert('there was a SERVER Error processing AJAX request'); }
+
+    });
+  })(jQuery);
+}
+
+/* In the project details area, the workflow admin can delete a project and its associated tasks and content */
+function maestro_ajaxDeleteProject(id) {
+  alert('Delete Project feature not yet implemented.');
+  /*
+  (function ($) {
+    $.ajax({
+      type: 'POST',
+      url : ajax_url + '/deleteproject',
+      cache: false,
+      data: {tracking_id: id},
+      dataType: 'json',
+      success:  function (data) {
+        if (data.status != 1) {
+          alert('An error occurred deleting project');
+        }
+      },
+      error: function() { alert('there was a SERVER Error processing AJAX request'); }
+
+    });
+  })(jQuery);
+  */
+}
+
+function ajaxMaestroComment(op, rowid, id, cid) {
+  if (op == 'new') {
+    jQuery('#newcomment_container_' + rowid).show();
+    jQuery('html,body').animate({scrollTop: jQuery('#newcomment_container_' + rowid).offset().top -50},500);
+  } else if (op == 'add') {
+    (function ($) {
+      $.ajax({
+        type : 'POST',
+        url : ajax_url + '/add_comment',
+        cache : false,
+        data : {
+          rowid : rowid,
+          tracking_id : id,
+          comment: document.getElementById("newcomment_" + id).value
+        },
+        dataType : 'json',
+        success : function(data) {
+          if (data.status == 1) {
+            $('#projectCommentsOpen_rec' + rowid).html(data.html);
+            $('html,body').animate({scrollTop: $('#projectCommentsOpen_rec' + rowid).offset().top-1},500);
+          } else {
+            alert('An error occurred adding comment');
+          }
+        },
+        error : function() {
+          alert('there was a SERVER Error processing AJAX request');
+        }
+
+      });
+      $('#newcomment_container_' + rowid).hide();
+    })(jQuery);
+
+  } else if (op == 'del') {
+    (function ($) {
+      $.ajax({
+      type : 'POST',
+      url : ajax_url + '/del_comment',
+      cache : false,
+      data : {
+        rowid : rowid,
+        tracking_id : id,
+        cid : cid
+      },
+      dataType : 'json',
+      success : function(data) {
+        if (data.status == 1) {
+          $('#projectCommentsOpen_rec' + rowid).html(data.html);
+          $('html,body').animate({scrollTop: $('#projectCommentsOpen_rec' + rowid).offset().top-1},500);
+        } else {
+          alert('An error occurred deleting comment');
+        }
+      },
+      error : function() {
+        alert('there was a SERVER Error processing AJAX request');
+      }
+
+    });
+    })(jQuery);
+
+  }
+
+}
+
+/*
+ * Function handles the form submit buttons for the inline interactive tasks All
+ * the form buttons should be of input type 'button' even the 'task complete'
+ * Function will fire automatically when a form button is pressed and execute
+ * the ajax operation for the interactive_post action and automatically post the
+ * form contents plus the taskid and task operation that was picked up from the
+ * button's custom 'maestro' attribute. <input type="button" maestro="save"
+ * value="Save Data">
+ */
+jQuery(function($) {
+  $('.maestro_taskconsole_interactivetaskcontent input[type=button]').click(function() {
+    var id = jQuery(this).parents('tr').filter(".maestro_taskconsole_interactivetaskcontent").attr('id');
+    var idparts = id.split('maestro_actionrec');
+    var taskid = idparts[1];
+    var op = jQuery(this).attr('maestro');
+    dataString = jQuery(this).closest('form').serialize();
+    dataString += "&queueid=" + taskid;
+    dataString += "&op=" + op;
+    jQuery.ajax( {
+      type : 'POST',
+      cache : false,
+      url : ajax_url + '/interactivetask_post',
+      dataType : "json",
+      success : function(data) {
+        $("#maestro_actionrec" + taskid).hide();
+        if (data.status == 1) {
+          if (data.hidetask == 1) {
+            $("#maestro_taskcontainer" + taskid).hide();
+            $("#maestro_taskconsole_detail_rec" + taskid).hide();
+          }
+        } else {
+          alert('An error occurred processing this interactive task');
+        }
+      },
+      error : function() { alert('there was a SERVER Error processing AJAX request'); },
+      data : dataString
+    });
+    return false;
+
+  })
+});
+
+
+jQuery(function($) {
+  $('#taskConsoleLaunchNewProcess').click(function() {
+    $("#newProcessStatusRowSuccess").hide();
+    $("#newProcessStatusRowFailure").hide();
+    dataString = jQuery('#frmLaunchNewProcess').serialize();
+    dataString += "&op=newprocess";
+    jQuery.ajax( {
+      type : 'POST',
+      cache : false,
+      url : ajax_url + '/newprocess',
+      dataType : "json",
+      success : function(data) {
+        if (data.status == 1 && data.processid > 0) {
+          $("#newProcessStatusRowSuccess").show();
+        } else {
+          $("#newProcessStatusRowFailure").show();
+        }
+      },
+      error : function() { $("#newProcessStatusRowFailure").show(); },
+      data : dataString
+    });
+    return false;
+  })
+});
+
+
+function toggleProjectSection(section,state,rowid) {
+    var obj1 = document.getElementById(section + state + '_rec' + rowid);
+    if (obj1) {
+      if (state == 'Open') {
+        obj1.style.display = 'none';
+        var obj2 = document.getElementById(section + 'Closed_rec' + rowid);
+        obj2.style.display = '';
+      } else if (state = 'Closed') {
+        obj1.style.display = 'none';
+        var obj2 = document.getElementById(section + 'Open_rec' + rowid);
+        obj2.style.display = '';
+      }
+    }
+}
+
+function projectDetailToggleAll(state,rowid) {
+  jQuery(function($) {
+    $(".taskdetailOpenRec" + rowid).each(function() {
+      if (state == 'expand') {
+        $(this).show();
+      } else {
+        $(this).hide();
+      }
+    })
+    $(".taskdetailClosedRec" + rowid).each(function() {
+      if (state == 'expand') {
+        $(this).hide();
+      } else {
+        $(this).show();
+      }
+    })
+    if (state == 'expand') {
+      $("#expandProject" + rowid).hide();
+      $("#collapseProject" + rowid).show();
+    } else {
+      $("#expandProject" + rowid).show();
+      $("#collapseProject" + rowid).hide();
+    }
+  });
+}
+
diff --git a/sites/all/modules/maestro/js/wz_jsgraphics.js b/sites/all/modules/maestro/js/wz_jsgraphics.js
new file mode 100644
index 0000000000000000000000000000000000000000..5988602893853f248a476e088422f852758eb382
--- /dev/null
+++ b/sites/all/modules/maestro/js/wz_jsgraphics.js
@@ -0,0 +1,1108 @@
+/* This notice must be untouched at all times.
+
+wz_jsgraphics.js    v. 3.05
+The latest version is available at
+http://www.walterzorn.com
+or http://www.devira.com
+or http://www.walterzorn.de
+
+Copyright (c) 2002-2009 Walter Zorn. All rights reserved.
+Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )
+Last modified: 2. 2. 2009
+
+Performance optimizations for Internet Explorer
+by Thomas Frank and John Holdsworth.
+fillPolygon method implemented by Matthieu Haller.
+
+High Performance JavaScript Graphics Library.
+Provides methods
+- to draw lines, rectangles, ellipses, polygons
+	with specifiable line thickness,
+- to fill rectangles, polygons, ellipses and arcs
+- to draw text.
+NOTE: Operations, functions and branching have rather been optimized
+to efficiency and speed than to shortness of source code.
+
+LICENSE: LGPL
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License (LGPL) as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
+or see http://www.gnu.org/copyleft/lesser.html
+*/
+
+
+var jg_ok, jg_ie, jg_fast, jg_dom, jg_moz;
+
+
+function _chkDHTM(wnd, x, i)
+// Under XUL, owner of 'document' must be specified explicitly
+{
+	x = wnd.document.body || null;
+	jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && wnd.document.createElement;
+	jg_dom = (x && !jg_ie &&
+		typeof x.appendChild != "undefined" &&
+		typeof wnd.document.createRange != "undefined" &&
+		typeof (i = wnd.document.createRange()).setStartBefore != "undefined" &&
+		typeof i.createContextualFragment != "undefined");
+	jg_fast = jg_ie && wnd.document.all && !wnd.opera;
+	jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";
+	jg_ok = !!(jg_ie || jg_dom);
+}
+
+function _pntCnvDom()
+{
+	var x = this.wnd.document.createRange();
+	x.setStartBefore(this.cnv);
+	x = x.createContextualFragment(jg_fast? this._htmRpc() : this.htm);
+	if(this.cnv) this.cnv.appendChild(x);
+	this.htm = "";
+}
+
+function _pntCnvIe()
+{
+	if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this._htmRpc() : this.htm);
+	this.htm = "";
+}
+
+function _pntDoc()
+{
+	this.wnd.document.write(jg_fast? this._htmRpc() : this.htm);
+	this.htm = '';
+}
+
+function _pntN()
+{
+	;
+}
+
+function _mkDiv(x, y, w, h)
+{
+	this.htm += '<div style="position:absolute;'+
+		'left:' + x + 'px;'+
+		'top:' + y + 'px;'+
+		'width:' + w + 'px;'+
+		'height:' + h + 'px;'+
+		'clip:rect(0,'+w+'px,'+h+'px,0);'+
+		'background-color:' + this.color +
+		(!jg_moz? ';overflow:hidden' : '')+
+		';"><\/div>';
+}
+
+function _mkDivIe(x, y, w, h)
+{
+	this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';
+}
+
+function _mkDivPrt(x, y, w, h)
+{
+	this.htm += '<div style="position:absolute;'+
+		'border-left:' + w + 'px solid ' + this.color + ';'+
+		'left:' + x + 'px;'+
+		'top:' + y + 'px;'+
+		'width:0px;'+
+		'height:' + h + 'px;'+
+		'clip:rect(0,'+w+'px,'+h+'px,0);'+
+		'background-color:' + this.color +
+		(!jg_moz? ';overflow:hidden' : '')+
+		';"><\/div>';
+}
+
+var _regex =  /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
+function _htmRpc()
+{
+	return this.htm.replace(
+		_regex,
+		'<div style="overflow:hidden;position:absolute;background-color:'+
+		'$1;left:$2px;top:$3px;width:$4px;height:$5px"></div>\n');
+}
+
+function _htmPrtRpc()
+{
+	return this.htm.replace(
+		_regex,
+		'<div style="overflow:hidden;position:absolute;background-color:'+
+		'$1;left:$2px;top:$3px;width:$4px;height:$5px;border-left:$4px solid $1"></div>\n');
+}
+
+function _mkLin(x1, y1, x2, y2)
+{
+	if(x1 > x2)
+	{
+		var _x2 = x2;
+		var _y2 = y2;
+		x2 = x1;
+		y2 = y1;
+		x1 = _x2;
+		y1 = _y2;
+	}
+	var dx = x2-x1, dy = Math.abs(y2-y1),
+	x = x1, y = y1,
+	yIncr = (y1 > y2)? -1 : 1;
+
+	if(dx >= dy)
+	{
+		var pr = dy<<1,
+		pru = pr - (dx<<1),
+		p = pr-dx,
+		ox = x;
+		while(dx > 0)
+		{--dx;
+			++x;
+			if(p > 0)
+			{
+				this._mkDiv(ox, y, x-ox, 1);
+				y += yIncr;
+				p += pru;
+				ox = x;
+			}
+			else p += pr;
+		}
+		this._mkDiv(ox, y, x2-ox+1, 1);
+	}
+
+	else
+	{
+		var pr = dx<<1,
+		pru = pr - (dy<<1),
+		p = pr-dy,
+		oy = y;
+		if(y2 <= y1)
+		{
+			while(dy > 0)
+			{--dy;
+				if(p > 0)
+				{
+					this._mkDiv(x++, y, 1, oy-y+1);
+					y += yIncr;
+					p += pru;
+					oy = y;
+				}
+				else
+				{
+					y += yIncr;
+					p += pr;
+				}
+			}
+			this._mkDiv(x2, y2, 1, oy-y2+1);
+		}
+		else
+		{
+			while(dy > 0)
+			{--dy;
+				y += yIncr;
+				if(p > 0)
+				{
+					this._mkDiv(x++, oy, 1, y-oy);
+					p += pru;
+					oy = y;
+				}
+				else p += pr;
+			}
+			this._mkDiv(x2, oy, 1, y2-oy+1);
+		}
+	}
+}
+
+function _mkLin2D(x1, y1, x2, y2)
+{
+	if(x1 > x2)
+	{
+		var _x2 = x2;
+		var _y2 = y2;
+		x2 = x1;
+		y2 = y1;
+		x1 = _x2;
+		y1 = _y2;
+	}
+	var dx = x2-x1, dy = Math.abs(y2-y1),
+	x = x1, y = y1,
+	yIncr = (y1 > y2)? -1 : 1;
+
+	var s = this.stroke;
+	if(dx >= dy)
+	{
+		if(dx > 0 && s-3 > 0)
+		{
+			var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
+			_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
+		}
+		else var _s = s;
+		var ad = Math.ceil(s/2);
+
+		var pr = dy<<1,
+		pru = pr - (dx<<1),
+		p = pr-dx,
+		ox = x;
+		while(dx > 0)
+		{--dx;
+			++x;
+			if(p > 0)
+			{
+				this._mkDiv(ox, y, x-ox+ad, _s);
+				y += yIncr;
+				p += pru;
+				ox = x;
+			}
+			else p += pr;
+		}
+		this._mkDiv(ox, y, x2-ox+ad+1, _s);
+	}
+
+	else
+	{
+		if(s-3 > 0)
+		{
+			var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
+			_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
+		}
+		else var _s = s;
+		var ad = Math.round(s/2);
+
+		var pr = dx<<1,
+		pru = pr - (dy<<1),
+		p = pr-dy,
+		oy = y;
+		if(y2 <= y1)
+		{
+			++ad;
+			while(dy > 0)
+			{--dy;
+				if(p > 0)
+				{
+					this._mkDiv(x++, y, _s, oy-y+ad);
+					y += yIncr;
+					p += pru;
+					oy = y;
+				}
+				else
+				{
+					y += yIncr;
+					p += pr;
+				}
+			}
+			this._mkDiv(x2, y2, _s, oy-y2+ad);
+		}
+		else
+		{
+			while(dy > 0)
+			{--dy;
+				y += yIncr;
+				if(p > 0)
+				{
+					this._mkDiv(x++, oy, _s, y-oy+ad);
+					p += pru;
+					oy = y;
+				}
+				else p += pr;
+			}
+			this._mkDiv(x2, oy, _s, y2-oy+ad+1);
+		}
+	}
+}
+
+function _mkLinDott(x1, y1, x2, y2)
+{
+	if(x1 > x2)
+	{
+		var _x2 = x2;
+		var _y2 = y2;
+		x2 = x1;
+		y2 = y1;
+		x1 = _x2;
+		y1 = _y2;
+	}
+	var dx = x2-x1, dy = Math.abs(y2-y1),
+	x = x1, y = y1,
+	yIncr = (y1 > y2)? -1 : 1,
+	drw = true;
+	if(dx >= dy)
+	{
+		var pr = dy<<1,
+		pru = pr - (dx<<1),
+		p = pr-dx;
+		while(dx > 0)
+		{--dx;
+			if(drw) this._mkDiv(x, y, 1, 1);
+			drw = !drw;
+			if(p > 0)
+			{
+				y += yIncr;
+				p += pru;
+			}
+			else p += pr;
+			++x;
+		}
+	}
+	else
+	{
+		var pr = dx<<1,
+		pru = pr - (dy<<1),
+		p = pr-dy;
+		while(dy > 0)
+		{--dy;
+			if(drw) this._mkDiv(x, y, 1, 1);
+			drw = !drw;
+			y += yIncr;
+			if(p > 0)
+			{
+				++x;
+				p += pru;
+			}
+			else p += pr;
+		}
+	}
+	if(drw) this._mkDiv(x, y, 1, 1);
+}
+
+function _mkOv(left, top, width, height)
+{
+	var a = (++width)>>1, b = (++height)>>1,
+	wod = width&1, hod = height&1,
+	cx = left+a, cy = top+b,
+	x = 0, y = b,
+	ox = 0, oy = b,
+	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+	st = (aa2>>1)*(1-(b<<1)) + bb2,
+	tt = (bb2>>1) - aa2*((b<<1)-1),
+	w, h;
+	while(y > 0)
+	{
+		if(st < 0)
+		{
+			st += bb2*((x<<1)+3);
+			tt += bb4*(++x);
+		}
+		else if(tt < 0)
+		{
+			st += bb2*((x<<1)+3) - aa4*(y-1);
+			tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+			w = x-ox;
+			h = oy-y;
+			if((w&2) && (h&2))
+			{
+				this._mkOvQds(cx, cy, x-2, y+2, 1, 1, wod, hod);
+				this._mkOvQds(cx, cy, x-1, y+1, 1, 1, wod, hod);
+			}
+			else this._mkOvQds(cx, cy, x-1, oy, w, h, wod, hod);
+			ox = x;
+			oy = y;
+		}
+		else
+		{
+			tt -= aa2*((y<<1)-3);
+			st -= aa4*(--y);
+		}
+	}
+	w = a-ox+1;
+	h = (oy<<1)+hod;
+	y = cy-oy;
+	this._mkDiv(cx-a, y, w, h);
+	this._mkDiv(cx+ox+wod-1, y, w, h);
+}
+
+function _mkOv2D(left, top, width, height)
+{
+	var s = this.stroke;
+	width += s+1;
+	height += s+1;
+	var a = width>>1, b = height>>1,
+	wod = width&1, hod = height&1,
+	cx = left+a, cy = top+b,
+	x = 0, y = b,
+	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+	st = (aa2>>1)*(1-(b<<1)) + bb2,
+	tt = (bb2>>1) - aa2*((b<<1)-1);
+
+	if(s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))
+	{
+		var ox = 0, oy = b,
+		w, h,
+		pxw;
+		while(y > 0)
+		{
+			if(st < 0)
+			{
+				st += bb2*((x<<1)+3);
+				tt += bb4*(++x);
+			}
+			else if(tt < 0)
+			{
+				st += bb2*((x<<1)+3) - aa4*(y-1);
+				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+				w = x-ox;
+				h = oy-y;
+
+				if(w-1)
+				{
+					pxw = w+1+(s&1);
+					h = s;
+				}
+				else if(h-1)
+				{
+					pxw = s;
+					h += 1+(s&1);
+				}
+				else pxw = h = s;
+				this._mkOvQds(cx, cy, x-1, oy, pxw, h, wod, hod);
+				ox = x;
+				oy = y;
+			}
+			else
+			{
+				tt -= aa2*((y<<1)-3);
+				st -= aa4*(--y);
+			}
+		}
+		this._mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
+		this._mkDiv(cx+a+wod-s, cy-oy, s, (oy<<1)+hod);
+	}
+
+	else
+	{
+		var _a = (width-(s<<1))>>1,
+		_b = (height-(s<<1))>>1,
+		_x = 0, _y = _b,
+		_aa2 = (_a*_a)<<1, _aa4 = _aa2<<1, _bb2 = (_b*_b)<<1, _bb4 = _bb2<<1,
+		_st = (_aa2>>1)*(1-(_b<<1)) + _bb2,
+		_tt = (_bb2>>1) - _aa2*((_b<<1)-1),
+
+		pxl = new Array(),
+		pxt = new Array(),
+		_pxb = new Array();
+		pxl[0] = 0;
+		pxt[0] = b;
+		_pxb[0] = _b-1;
+		while(y > 0)
+		{
+			if(st < 0)
+			{
+				pxl[pxl.length] = x;
+				pxt[pxt.length] = y;
+				st += bb2*((x<<1)+3);
+				tt += bb4*(++x);
+			}
+			else if(tt < 0)
+			{
+				pxl[pxl.length] = x;
+				st += bb2*((x<<1)+3) - aa4*(y-1);
+				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+				pxt[pxt.length] = y;
+			}
+			else
+			{
+				tt -= aa2*((y<<1)-3);
+				st -= aa4*(--y);
+			}
+
+			if(_y > 0)
+			{
+				if(_st < 0)
+				{
+					_st += _bb2*((_x<<1)+3);
+					_tt += _bb4*(++_x);
+					_pxb[_pxb.length] = _y-1;
+				}
+				else if(_tt < 0)
+				{
+					_st += _bb2*((_x<<1)+3) - _aa4*(_y-1);
+					_tt += _bb4*(++_x) - _aa2*(((_y--)<<1)-3);
+					_pxb[_pxb.length] = _y-1;
+				}
+				else
+				{
+					_tt -= _aa2*((_y<<1)-3);
+					_st -= _aa4*(--_y);
+					_pxb[_pxb.length-1]--;
+				}
+			}
+		}
+
+		var ox = -wod, oy = b,
+		_oy = _pxb[0],
+		l = pxl.length,
+		w, h;
+		for(var i = 0; i < l; i++)
+		{
+			if(typeof _pxb[i] != "undefined")
+			{
+				if(_pxb[i] < _oy || pxt[i] < oy)
+				{
+					x = pxl[i];
+					this._mkOvQds(cx, cy, x, oy, x-ox, oy-_oy, wod, hod);
+					ox = x;
+					oy = pxt[i];
+					_oy = _pxb[i];
+				}
+			}
+			else
+			{
+				x = pxl[i];
+				this._mkDiv(cx-x, cy-oy, 1, (oy<<1)+hod);
+				this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
+				ox = x;
+				oy = pxt[i];
+			}
+		}
+		this._mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);
+		this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
+	}
+}
+
+function _mkOvDott(left, top, width, height)
+{
+	var a = (++width)>>1, b = (++height)>>1,
+	wod = width&1, hod = height&1, hodu = hod^1,
+	cx = left+a, cy = top+b,
+	x = 0, y = b,
+	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+	st = (aa2>>1)*(1-(b<<1)) + bb2,
+	tt = (bb2>>1) - aa2*((b<<1)-1),
+	drw = true;
+	while(y > 0)
+	{
+		if(st < 0)
+		{
+			st += bb2*((x<<1)+3);
+			tt += bb4*(++x);
+		}
+		else if(tt < 0)
+		{
+			st += bb2*((x<<1)+3) - aa4*(y-1);
+			tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+		}
+		else
+		{
+			tt -= aa2*((y<<1)-3);
+			st -= aa4*(--y);
+		}
+		if(drw && y >= hodu) this._mkOvQds(cx, cy, x, y, 1, 1, wod, hod);
+		drw = !drw;
+	}
+}
+
+function _mkRect(x, y, w, h)
+{
+	var s = this.stroke;
+	this._mkDiv(x, y, w, s);
+	this._mkDiv(x+w, y, s, h);
+	this._mkDiv(x, y+h, w+s, s);
+	this._mkDiv(x, y+s, s, h-s);
+}
+
+function _mkRectDott(x, y, w, h)
+{
+	this.drawLine(x, y, x+w, y);
+	this.drawLine(x+w, y, x+w, y+h);
+	this.drawLine(x, y+h, x+w, y+h);
+	this.drawLine(x, y, x, y+h);
+}
+
+function jsgFont()
+{
+	this.PLAIN = 'font-weight:normal;';
+	this.BOLD = 'font-weight:bold;';
+	this.ITALIC = 'font-style:italic;';
+	this.ITALIC_BOLD = this.ITALIC + this.BOLD;
+	this.BOLD_ITALIC = this.ITALIC_BOLD;
+}
+var Font = new jsgFont();
+
+function jsgStroke()
+{
+	this.DOTTED = -1;
+}
+var Stroke = new jsgStroke();
+
+function jsGraphics(cnv, wnd)
+{
+	this.setColor = function(x)
+	{
+		this.color = x.toLowerCase();
+	};
+
+	this.setStroke = function(x)
+	{
+		this.stroke = x;
+		if(!(x+1))
+		{
+			this.drawLine = _mkLinDott;
+			this._mkOv = _mkOvDott;
+			this.drawRect = _mkRectDott;
+		}
+		else if(x-1 > 0)
+		{
+			this.drawLine = _mkLin2D;
+			this._mkOv = _mkOv2D;
+			this.drawRect = _mkRect;
+		}
+		else
+		{
+			this.drawLine = _mkLin;
+			this._mkOv = _mkOv;
+			this.drawRect = _mkRect;
+		}
+	};
+
+	this.setPrintable = function(arg)
+	{
+		this.printable = arg;
+		if(jg_fast)
+		{
+			this._mkDiv = _mkDivIe;
+			this._htmRpc = arg? _htmPrtRpc : _htmRpc;
+		}
+		else this._mkDiv = arg? _mkDivPrt : _mkDiv;
+	};
+
+	this.setFont = function(fam, sz, sty)
+	{
+		this.ftFam = fam;
+		this.ftSz = sz;
+		this.ftSty = sty || Font.PLAIN;
+	};
+
+	this.drawPolyline = this.drawPolyLine = function(x, y)
+	{
+		for (var i=x.length - 1; i;)
+		{--i;
+			this.drawLine(x[i], y[i], x[i+1], y[i+1]);
+		}
+	};
+
+	this.fillRect = function(x, y, w, h)
+	{
+		this._mkDiv(x, y, w, h);
+	};
+
+	this.drawPolygon = function(x, y)
+	{
+		this.drawPolyline(x, y);
+		this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);
+	};
+
+	this.drawEllipse = this.drawOval = function(x, y, w, h)
+	{
+		this._mkOv(x, y, w, h);
+	};
+
+	this.fillEllipse = this.fillOval = function(left, top, w, h)
+	{
+		var a = w>>1, b = h>>1,
+		wod = w&1, hod = h&1,
+		cx = left+a, cy = top+b,
+		x = 0, y = b, oy = b,
+		aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+		st = (aa2>>1)*(1-(b<<1)) + bb2,
+		tt = (bb2>>1) - aa2*((b<<1)-1),
+		xl, dw, dh;
+		if(w) while(y > 0)
+		{
+			if(st < 0)
+			{
+				st += bb2*((x<<1)+3);
+				tt += bb4*(++x);
+			}
+			else if(tt < 0)
+			{
+				st += bb2*((x<<1)+3) - aa4*(y-1);
+				xl = cx-x;
+				dw = (x<<1)+wod;
+				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+				dh = oy-y;
+				this._mkDiv(xl, cy-oy, dw, dh);
+				this._mkDiv(xl, cy+y+hod, dw, dh);
+				oy = y;
+			}
+			else
+			{
+				tt -= aa2*((y<<1)-3);
+				st -= aa4*(--y);
+			}
+		}
+		this._mkDiv(cx-a, cy-oy, w, (oy<<1)+hod);
+	};
+
+	this.fillArc = function(iL, iT, iW, iH, fAngA, fAngZ)
+	{
+		var a = iW>>1, b = iH>>1,
+		iOdds = (iW&1) | ((iH&1) << 16),
+		cx = iL+a, cy = iT+b,
+		x = 0, y = b, ox = x, oy = y,
+		aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+		st = (aa2>>1)*(1-(b<<1)) + bb2,
+		tt = (bb2>>1) - aa2*((b<<1)-1),
+		// Vars for radial boundary lines
+		xEndA, yEndA, xEndZ, yEndZ,
+		iSects = (1 << (Math.floor((fAngA %= 360.0)/180.0) << 3))
+				| (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3))
+				| ((fAngA >= fAngZ) << 16),
+		aBndA = new Array(b+1), aBndZ = new Array(b+1);
+		
+		// Set up radial boundary lines
+		fAngA *= Math.PI/180.0;
+		fAngZ *= Math.PI/180.0;
+		xEndA = cx+Math.round(a*Math.cos(fAngA));
+		yEndA = cy+Math.round(-b*Math.sin(fAngA));
+		_mkLinVirt(aBndA, cx, cy, xEndA, yEndA);
+		xEndZ = cx+Math.round(a*Math.cos(fAngZ));
+		yEndZ = cy+Math.round(-b*Math.sin(fAngZ));
+		_mkLinVirt(aBndZ, cx, cy, xEndZ, yEndZ);
+
+		while(y > 0)
+		{
+			if(st < 0) // Advance x
+			{
+				st += bb2*((x<<1)+3);
+				tt += bb4*(++x);
+			}
+			else if(tt < 0) // Advance x and y
+			{
+				st += bb2*((x<<1)+3) - aa4*(y-1);
+				ox = x;
+				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+				this._mkArcDiv(ox, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+				oy = y;
+			}
+			else // Advance y
+			{
+				tt -= aa2*((y<<1)-3);
+				st -= aa4*(--y);
+				if(y && (aBndA[y] != aBndA[y-1] || aBndZ[y] != aBndZ[y-1]))
+				{
+					this._mkArcDiv(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+					ox = x;
+					oy = y;
+				}
+			}
+		}
+		this._mkArcDiv(x, 0, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+		if(iOdds >> 16) // Odd height
+		{
+			if(iSects >> 16) // Start-angle > end-angle
+			{
+				var xl = (yEndA <= cy || yEndZ > cy)? (cx - x) : cx;
+				this._mkDiv(xl, cy, x + cx - xl + (iOdds & 0xffff), 1);
+			}
+			else if((iSects & 0x01) && yEndZ > cy)
+				this._mkDiv(cx - x, cy, x, 1);
+		}
+	};
+
+/* fillPolygon method, implemented by Matthieu Haller.
+This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.
+C source of GD 1.8.4 found at http://www.boutell.com/gd/
+
+THANKS to Kirsten Schulz for the polygon fixes!
+
+The intersection finding technique of this code could be improved
+by remembering the previous intertersection, and by using the slope.
+That could help to adjust intersections to produce a nice
+interior_extrema. */
+	this.fillPolygon = function(array_x, array_y)
+	{
+		var i;
+		var y;
+		var miny, maxy;
+		var x1, y1;
+		var x2, y2;
+		var ind1, ind2;
+		var ints;
+
+		var n = array_x.length;
+		if(!n) return;
+
+		miny = array_y[0];
+		maxy = array_y[0];
+		for(i = 1; i < n; i++)
+		{
+			if(array_y[i] < miny)
+				miny = array_y[i];
+
+			if(array_y[i] > maxy)
+				maxy = array_y[i];
+		}
+		for(y = miny; y <= maxy; y++)
+		{
+			var polyInts = new Array();
+			ints = 0;
+			for(i = 0; i < n; i++)
+			{
+				if(!i)
+				{
+					ind1 = n-1;
+					ind2 = 0;
+				}
+				else
+				{
+					ind1 = i-1;
+					ind2 = i;
+				}
+				y1 = array_y[ind1];
+				y2 = array_y[ind2];
+				if(y1 < y2)
+				{
+					x1 = array_x[ind1];
+					x2 = array_x[ind2];
+				}
+				else if(y1 > y2)
+				{
+					y2 = array_y[ind1];
+					y1 = array_y[ind2];
+					x2 = array_x[ind1];
+					x1 = array_x[ind2];
+				}
+				else continue;
+
+				 //  Modified 11. 2. 2004 Walter Zorn
+				if((y >= y1) && (y < y2))
+					polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
+
+				else if((y == maxy) && (y > y1) && (y <= y2))
+					polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
+			}
+			polyInts.sort(_CompInt);
+			for(i = 0; i < ints; i+=2)
+				this._mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);
+		}
+	};
+
+	this.drawString = function(txt, x, y)
+	{
+		this.htm += '<div style="position:absolute;white-space:nowrap;'+
+			'left:' + x + 'px;'+
+			'top:' + y + 'px;'+
+			'font-family:' +  this.ftFam + ';'+
+			'font-size:' + this.ftSz + ';'+
+			'color:' + this.color + ';' + this.ftSty + '">'+
+			txt +
+			'<\/div>';
+	};
+
+/* drawStringRect() added by Rick Blommers.
+Allows to specify the size of the text rectangle and to align the
+text both horizontally (e.g. right) and vertically within that rectangle */
+	this.drawStringRect = function(txt, x, y, width, halign)
+	{
+		this.htm += '<div style="position:absolute;overflow:hidden;'+
+			'left:' + x + 'px;'+
+			'top:' + y + 'px;'+
+			'width:'+width +'px;'+
+			'text-align:'+halign+';'+
+			'font-family:' +  this.ftFam + ';'+
+			'font-size:' + this.ftSz + ';'+
+			'color:' + this.color + ';' + this.ftSty + '">'+
+			txt +
+			'<\/div>';
+	};
+
+	this.drawImage = function(imgSrc, x, y, w, h, a)
+	{
+		this.htm += '<div style="position:absolute;'+
+			'left:' + x + 'px;'+
+			'top:' + y + 'px;'+
+			// w (width) and h (height) arguments are now optional.
+			// Added by Mahmut Keygubatli, 14.1.2008
+			(w? ('width:' +  w + 'px;') : '') +
+			(h? ('height:' + h + 'px;'):'')+'">'+
+			'<img src="' + imgSrc +'"'+ (w ? (' width="' + w + '"'):'')+ (h ? (' height="' + h + '"'):'') + (a? (' '+a) : '') + '>'+
+			'<\/div>';
+	};
+
+	this.clear = function()
+	{
+		this.htm = "";
+		if(this.cnv) this.cnv.innerHTML = "";
+	};
+
+	this._mkOvQds = function(cx, cy, x, y, w, h, wod, hod)
+	{
+		var xl = cx - x, xr = cx + x + wod - w, yt = cy - y, yb = cy + y + hod - h;
+		if(xr > xl+w)
+		{
+			this._mkDiv(xr, yt, w, h);
+			this._mkDiv(xr, yb, w, h);
+		}
+		else
+			w = xr - xl + w;
+		this._mkDiv(xl, yt, w, h);
+		this._mkDiv(xl, yb, w, h);
+	};
+	
+	this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects)
+	{
+		var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w;
+
+		if(!h) h = 1;
+		x = cx - x;
+
+		if(iSects & 0xff0000) // Start-angle > end-angle
+		{
+			y2 = cy - y - h;
+			if(iSects & 0x00ff)
+			{
+				if(iSects & 0x02)
+				{
+					xl = Math.max(x, aBndZ[y]);
+					w = xrDef - xl;
+					if(w > 0) this._mkDiv(xl, y2, w, h);
+				}
+				if(iSects & 0x01)
+				{
+					xr = Math.min(xrDef, aBndA[y]);
+					w = xr - x;
+					if(w > 0) this._mkDiv(x, y2, w, h);
+				}
+			}
+			else
+				this._mkDiv(x, y2, xrDef - x, h);
+			y2 = cy + y + (iOdds >> 16);
+			if(iSects & 0xff00)
+			{
+				if(iSects & 0x0100)
+				{
+					xl = Math.max(x, aBndA[y]);
+					w = xrDef - xl;
+					if(w > 0) this._mkDiv(xl, y2, w, h);
+				}
+				if(iSects & 0x0200)
+				{
+					xr = Math.min(xrDef, aBndZ[y]);
+					w = xr - x;
+					if(w > 0) this._mkDiv(x, y2, w, h);
+				}
+			}
+			else
+				this._mkDiv(x, y2, xrDef - x, h);
+		}
+		else
+		{
+			if(iSects & 0x00ff)
+			{
+				if(iSects & 0x02)
+					xl = Math.max(x, aBndZ[y]);
+				else
+					xl = x;
+				if(iSects & 0x01)
+					xr = Math.min(xrDef, aBndA[y]);
+				else
+					xr = xrDef;
+				y2 = cy - y - h;
+				w = xr - xl;
+				if(w > 0) this._mkDiv(xl, y2, w, h);
+			}
+			if(iSects & 0xff00)
+			{
+				if(iSects & 0x0100)
+					xl = Math.max(x, aBndA[y]);
+				else
+					xl = x;
+				if(iSects & 0x0200)
+					xr = Math.min(xrDef, aBndZ[y]);
+				else
+					xr = xrDef;
+				y2 = cy + y + (iOdds >> 16);
+				w = xr - xl;
+				if(w > 0) this._mkDiv(xl, y2, w, h);
+			}
+		}
+	};
+
+	this.setStroke(1);
+	this.setFont("verdana,geneva,helvetica,sans-serif", "12px", Font.PLAIN);
+	this.color = "#000000";
+	this.htm = "";
+	this.wnd = wnd || window;
+
+	if(!jg_ok) _chkDHTM(this.wnd);
+	if(jg_ok)
+	{
+		if(cnv)
+		{
+			if(typeof(cnv) == "string")
+				this.cont = document.all? (this.wnd.document.all[cnv] || null)
+					: document.getElementById? (this.wnd.document.getElementById(cnv) || null)
+					: null;
+			else if(cnv == window.document)
+				this.cont = document.getElementsByTagName("body")[0];
+			// If cnv is a direct reference to a canvas DOM node
+			// (option suggested by Andreas Luleich)
+			else this.cont = cnv;
+			// Create new canvas inside container DIV. Thus the drawing and clearing
+			// methods won't interfere with the container's inner html.
+			// Solution suggested by Vladimir.
+			this.cnv = this.wnd.document.createElement("div");
+			this.cnv.style.fontSize=0;
+			this.cont.appendChild(this.cnv);
+			this.paint = jg_dom? _pntCnvDom : _pntCnvIe;
+		}
+		else
+			this.paint = _pntDoc;
+	}
+	else
+		this.paint = _pntN;
+
+	this.setPrintable(false);
+}
+
+function _mkLinVirt(aLin, x1, y1, x2, y2)
+{
+	var dx = Math.abs(x2-x1), dy = Math.abs(y2-y1),
+	x = x1, y = y1,
+	xIncr = (x1 > x2)? -1 : 1,
+	yIncr = (y1 > y2)? -1 : 1,
+	p,
+	i = 0;
+	if(dx >= dy)
+	{
+		var pr = dy<<1,
+		pru = pr - (dx<<1);
+		p = pr-dx;
+		while(dx > 0)
+		{--dx;
+			if(p > 0)    //  Increment y
+			{
+				aLin[i++] = x;
+				y += yIncr;
+				p += pru;
+			}
+			else p += pr;
+			x += xIncr;
+		}
+	}
+	else
+	{
+		var pr = dx<<1,
+		pru = pr - (dy<<1);
+		p = pr-dy;
+		while(dy > 0)
+		{--dy;
+			y += yIncr;
+			aLin[i++] = x;
+			if(p > 0)    //  Increment x
+			{
+				x += xIncr;
+				p += pru;
+			}
+			else p += pr;
+		}
+	}
+	for(var len = aLin.length, i = len-i; i;)
+		aLin[len-(i--)] = x;
+};
+
+function _CompInt(x, y)
+{
+	return(x - y);
+}
+
diff --git a/sites/all/modules/maestro/lib-test.php b/sites/all/modules/maestro/lib-test.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b94fe5e318c4a127afd351cdb589158e1eadd30
--- /dev/null
+++ b/sites/all/modules/maestro/lib-test.php
@@ -0,0 +1,18 @@
+<?php
+
+error_reporting(E_ALL);
+ini_set('display_errors', TRUE);
+ini_set('display_startup_errors', TRUE);
+
+
+
+function maestro_createtestworkflow() {
+
+}
+
+function test_observers() {
+  include('maestro_notification.class.php');
+
+  $notification = new MaestroNotification(1,'this is a test message','Sample Subject',0);
+  $notification->notify();
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro.admin.inc b/sites/all/modules/maestro/maestro.admin.inc
new file mode 100644
index 0000000000000000000000000000000000000000..b892ea9e92a4439e0bc5f7a959986720ad4e3e29
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.admin.inc
@@ -0,0 +1,753 @@
+<?php
+// $Id: maestro.admin.inc,v 1.62 2011/01/10 17:19:32 chevy Exp $
+
+/**
+ * @file
+ * maestro.admin.inc
+ */
+
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_interface.class.php';
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_task_interface.class.php';
+
+function maestro_admin($tid=0, $operation='', $var=0) {
+  global $base_url;
+  $maestro_path = $base_url . '/' . drupal_get_path('module', 'maestro');
+  drupal_add_css(drupal_get_path('module', 'maestro') . '/css/maestro.css');
+  drupal_add_js($maestro_path . '/js/maestro_structure_admin.js');
+
+  return theme('maestro_workflow_list', array('tid' => $tid, 'operation' => $operation , 'edit_var' => $var));
+}
+
+//called from the hooks_menu
+function maestro_edit_workflow($tid='') {
+  global $base_url;
+
+  if ($tid === '') drupal_goto('admin/structure/maestro');
+
+  $maestro_path = '/' . drupal_get_path('module', 'maestro');
+
+  drupal_add_css(drupal_get_path('module', 'maestro') . '/css/maestro.css');
+  drupal_add_js($base_url . $maestro_path . '/js/wz_jsgraphics.js');
+  drupal_add_js($base_url . $maestro_path . '/js/admin_template_editor.js');
+  drupal_add_js($base_url . $maestro_path . '/js/jquery.contextmenu.js');
+  drupal_add_js($base_url . $maestro_path . '/js/jquery.simplemodal.min.js');
+
+  $mi = new MaestroInterface($tid);
+
+  return $mi->displayPage();
+}
+
+function maestro_handle_editor_ajax_request($task_type, $template_data_id, $template_id, $op) {
+  if (class_exists($task_type)) {
+    $ti = new $task_type($template_data_id, $template_id);
+  }
+  else {
+    $ti = new MaestroTaskInterfaceUnknown($template_data_id, $template_id);
+  }
+
+  print json_encode($ti->$op());
+  exit();
+}
+
+function maestro_handle_structure_ajax_request(){
+  global $base_url;
+  if(!user_access('maestro admin')) return false;
+  $op=@check_plain($_POST['op']);
+  $cntr=@check_plain($_POST['cntr']);
+  $id=@check_plain($_POST['id']);
+
+  switch($op){
+    case 'openimport':
+      //the fact that they made it in here means that we're OK as far as security is concerned.
+      //we have to check to see if the config parameter is set to even show this option.
+      $status = 0;
+      if(variable_get('maestro_enable_import_window',0) == 1) {
+        $status = 1;
+      }
+      $arr=array('status' => $status);
+      echo json_encode($arr);
+      exit(0);
+      break;
+
+    case 'doimport':
+      $status = 0;
+      if(variable_get('maestro_enable_import_window',0) == 1) {
+        $templatecode=($_POST['templatecode']);
+        //Lets see if someone has tried to do something "evil".
+        if(strpos(strtolower($templatecode),'delete') !== FALSE ||
+        strpos(strtolower($templatecode),'drop') !== FALSE ||
+        strpos(strtolower($templatecode),'truncate') !== FALSE ) {
+          $status = -1;
+        }
+        else {
+          try {
+            $ret=eval($templatecode);
+            $status = 1;
+          }
+          catch (Exception $ex) {
+            $status = 0;
+          }
+        }
+
+      }
+      $data=theme('maestro_workflow_list', array('tid' => 0, 'operation' => '' , 'edit_var' => 0));
+      $arr=array('data' => $data, 'status' => $status);
+      echo json_encode($arr);
+      break;
+
+    case 'savetemplate':
+      $name=check_plain($_POST['templateName']);
+      $app_group=intval(check_plain($_POST['appGroup']));
+
+      $update=db_update('maestro_template')
+      ->fields(array( 'template_name' => $name,
+                      'app_group' => $app_group
+      ))
+      ->condition('id', $id)
+      ->execute();
+      $status="0";
+      if($update>=0){
+        $status="1";
+      }
+      $arr=array('id' => $id, 'cntr' => $cntr, 'status' => $status);
+      echo json_encode($arr);
+      break;
+
+    case 'createvariable':
+      $name=check_plain($_POST['newVariableName']);
+      $value=check_plain($_POST['newVariableValue']);
+      $recID=maestro_createTemplateVariable($id, $name, $value);
+      $status = 0;
+      if($recID > 0){
+        $status = 1;
+      }
+      $data=theme('maestro_workflow_edit_template_variables',  array('tid' => $id ));
+
+      $arr=array('status' => $status, 'data' => $data, 'cntr' => $id );
+      echo json_encode($arr);
+      break;
+
+    case 'updatevariable':
+      $name=check_plain($_POST['name']);
+      $value=check_plain($_POST['val']);
+      $update=db_update('maestro_template_variables')
+      ->fields(array( 'variable_name' => $name,
+                      'variable_value' => $value
+      ))
+      ->condition('id', $id)
+      ->execute();
+
+      $query = db_select('maestro_template_variables', 'a');
+      $query->fields('a',array('template_id'));
+      $query->condition('a.id',$id,'=');
+      $res=current($query->execute()->fetchAll());
+
+      $status="0";
+      if($update>=0){
+        $status="1";
+      }
+      $data=theme('maestro_workflow_edit_template_variables',  array('tid' => $res->template_id ));
+      $arr=array('status' => $status, 'data' => $data, 'var_id' => $id);
+      echo json_encode($arr);
+      break;
+
+    case 'deletevariable':
+      $tid=check_plain($_POST['tid']);
+      $ret=maestro_deleteTemplateVariable($id);
+      $data=theme('maestro_workflow_edit_template_variables',  array('tid' => $tid ));
+      $status="0";
+      if($ret){
+        $status="1";
+      }
+      $arr=array('status' => $status, 'data' => $data, 'cntr' => $tid);
+      echo json_encode($arr);
+      break;
+
+    case 'editvariable':
+      $tid=check_plain($_POST['tid']);
+      $data=theme('maestro_workflow_edit_template_variables',  array('tid' => $tid, 'edit_var' => $id));
+      $arr=array('status' => "1", 'data' => $data, 'cntr' => $tid);
+      echo json_encode($arr);
+      break;
+
+    case 'showvariables':
+      $data=theme('maestro_workflow_edit_template_variables',  array('tid' => $id ));
+      $arr=array('status' => "1", 'data' => $data, 'cntr' => $id);
+      echo json_encode($arr);
+      break;
+
+    case 'createtemplate':
+      $name=check_plain($_POST['name']);
+      $recID=maestro_createNewTemplate($name);
+      $status = 0;
+      if($recID > 0){
+        $status = 1;
+      }
+      $data=theme('maestro_workflow_list', array('tid' => 0, 'operation' => '' , 'edit_var' => 0));
+
+      $arr=array('status' => $status, 'data' => $data);
+      echo json_encode($arr);
+      break;
+
+    case 'createappgroup':
+      $name=check_plain($_POST['name']);
+      if($name != '')  $recID=maestro_createAppGroup($name);
+      $status = 0;
+      if($recID > 0){
+        $status = 1;
+      }
+      $arr=array('status' => $status, 'data' => '');
+      echo json_encode($arr);
+      break;
+
+    case 'deleteappgroup':
+      maestro_deleteAppGroup($id);
+      $data=maestro_createAppGroupDropDown('deleteAppGroup');
+      $arr=array('status' => "1", 'data' => $data);
+      echo json_encode($arr);
+      break;
+
+    case 'refreshappgroup':
+      $which=check_plain($_POST['which']);
+      $data=maestro_createAppGroupDropDown($which);
+      $arr=array('status' => "1", 'data' => $data);
+      echo json_encode($arr);
+      break;
+
+    case 'deletetemplate':
+      $res=db_query("SELECT id FROM {maestro_template_data} WHERE template_id = :tid", array('tid' => $id));
+      foreach($res as $rec){
+        $query = db_delete('maestro_template_assignment');
+        $query->condition('template_data_id',$rec->id,'=');
+        $query->execute();
+
+        $query = db_delete('maestro_template_notification');
+        $query->condition('template_data_id',$rec->id,'=');
+        $query->execute();
+
+        $query = db_delete('maestro_template_data_next_step');
+        $query->condition('template_data_from',$rec->id,'=');
+        $query->execute();
+
+        $query = db_delete('maestro_template_data');
+        $query->condition('id',$rec->id,'=');
+        $query->execute();
+      }
+
+      $query = db_delete('maestro_template_variables');
+      $query->condition('template_id',$id,'=');
+      $query->execute();
+
+      $query = db_delete('maestro_template');
+      $query->condition('id',$id,'=');
+      $query->execute();
+
+      $data = theme('maestro_workflow_list', array('tid' => 0, 'operation' => '' , 'edit_var' => 0));
+      $arr=array('status' => "1", 'data' => $data);
+      echo json_encode($arr);
+      break;
+
+    case 'copytemplate':
+      $query = db_select('maestro_template', 'a');
+      $query->fields('a',array('template_name', 'app_group','canvas_height'));
+      $query->condition('a.id',$id,'=');
+      $name=current($query->execute()->fetchAll());
+      $record = new stdClass();
+      $record ->template_name = $name->template_name . " - COPY";
+      $record ->app_group = $name->app_group;
+      $record ->canvas_height = $name->canvas_height;
+      drupal_write_record('maestro_template', $record);
+      $newTID=$record->id;
+
+      $variable_xref_array = Array();
+      $variable_xref_array[0] = 0;
+      $res=db_query("SELECT * FROM {maestro_template_variables} WHERE template_id = :tid", array('tid' => $id));
+      foreach($res as $rec) {
+        $newrecord = new stdClass();
+        $newrecord->template_id = $newTID;
+        $newrecord->variable_name = $rec->variable_name;
+        $newrecord->variable_value = $rec->variable_value;
+        drupal_write_record('maestro_template_variables', $newrecord);
+        $variable_xref_array[$rec->id] = $newrecord->id;
+      }
+
+      $taskDataArray=array();
+      $res=db_query("SELECT * FROM {maestro_template_data} WHERE template_id = :tid", array('tid' => $id));
+      foreach($res as $rec) {
+        $newrecord = new stdClass();
+        $newrecord->template_id = $newTID;
+        $newrecord->task_class_name = $rec->task_class_name;
+        $newrecord->is_interactive = $rec->is_interactive;
+
+        //we need to transform this data here to use the new variables etc etc if required.
+        $task_type = substr($rec->task_class_name, 15);
+        $task_class = 'MaestroTaskInterface' . $task_type;
+        $ti = new $task_class(0, 0);
+        $fixed_data = $ti->modulateExportTaskData($rec->task_data, $variable_xref_array);
+        $rec->task_data = $fixed_data;
+        $newrecord->task_data = $rec->task_data;
+
+        $newrecord->handler = $rec->handler;
+        $newrecord->first_task = $rec->first_task;
+        $newrecord->taskname = $rec->taskname;
+        $newrecord->assigned_by_variable = $rec->assigned_by_variable;
+        $newrecord->argument_variable = $rec->argument_variable;
+        $newrecord->if_argument_process = $rec->if_argument_process;
+        $newrecord->operator = $rec->operator;
+        $newrecord->if_value = $rec->if_value;
+        $newrecord->regenerate = $rec->regenerate;
+        $newrecord->regen_all_live_tasks = $rec->regen_all_live_tasks;
+        $newrecord->is_dynamic_form = $rec->is_dynamic_form;
+        $newrecord->dynamic_form_variable_id = $rec->dynamic_form_variable_id;
+        $newrecord->is_dynamic_taskname = $rec->is_dynamic_taskname;
+        $newrecord->dynamic_taskname_variable_id = $rec->dynamic_taskname_variable_id;
+        $newrecord->function = $rec->function;
+        $newrecord->form_id = $rec->form_id;
+        $newrecord->field_id = $rec->field_id;
+        $newrecord->var_value = $rec->var_value;
+        $newrecord->inc_value = $rec->inc_value;
+        $newrecord->var_to_set = $rec->var_to_set;
+        $newrecord->optional_parm = $rec->optional_parm;
+        $newrecord->reminder_interval = $rec->reminder_interval;
+        $newrecord->reminder_interval_variable = $rec->reminder_interval_variable;
+        $newrecord->subsequent_reminder_interval = $rec->subsequent_reminder_interval;
+        $newrecord->last_updated = $rec->last_updated;
+        $newrecord->pre_notify_subject = $rec->pre_notify_subject;
+        $newrecord->post_notify_subject = $rec->post_notify_subject;
+        $newrecord->reminder_subject = $rec->reminder_subject;
+        $newrecord->pre_notify_message = $rec->pre_notify_message;
+        $newrecord->post_notify_message = $rec->post_notify_message;
+        $newrecord->reminder_message = $rec->reminder_message;
+        $newrecord->num_reminders = $rec->num_reminders;
+        $newrecord->escalate_variable_id = $rec->escalate_variable_id;
+        $newrecord->offset_left = $rec->offset_left;
+        $newrecord->offset_top = $rec->offset_top;
+        $newrecord->surpress_first_notification = $rec->surpress_first_notification;
+        drupal_write_record('maestro_template_data', $newrecord);
+        $taskDataArray[$rec->id]= $newrecord->id;
+      }
+
+      //at this point, we have a list that points the old ID record to the new one.
+      //now for each template data next step, we determine which record to go to/from
+      $res=db_query("SELECT * FROM {maestro_template_data} WHERE template_id = :tid", array('tid' => $id));
+      foreach($res as $rec) {
+        $nextstepres = db_query("SELECT * FROM {maestro_template_data_next_step} WHERE template_data_from = :id", array('id' => $rec->id));
+        foreach($nextstepres as $nextstep) {
+          $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) ";
+          $sql .= "VALUES (:a1, :b1, :c1)";
+          db_query($sql, array('a1' => $taskDataArray[$nextstep->template_data_from], 'b1' => $taskDataArray[$nextstep->template_data_to], 'c1' => $taskDataArray[$nextstep->template_data_to_false]));
+        }
+
+        $assignmentres = db_query("SELECT * FROM {maestro_template_assignment} WHERE template_data_id = :id", array('id' => $rec->id));
+        foreach($assignmentres as $ares) {
+          $assign_by = $ares->assign_by;
+          $modulated_id = intval($ares->assign_id);
+          switch($ares->assign_type) {
+            case MaestroAssignmentTypes::USER:
+              if($assign_by == MaestroAssignmentBy::VARIABLE) {
+                $modulated_id = $variable_xref_array[$ares->assign_id];
+              }
+              break;
+
+            case MaestroAssignmentTypes::GROUP:
+              //@TODO:  implement this when we implement OG suppport
+              break;
+
+            case MaestroAssignmentTypes::ROLE:
+              //@TODO:  implement this when we implement Role suppport
+              break;
+          }
+
+          $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) ";
+          $sql .= "VALUES (:a1, :b1, :c1, :d1)";
+          db_query($sql, array( 'a1' => $taskDataArray[$ares->template_data_id],
+                                'b1' => $ares->assign_type,
+                                'c1' => $ares->assign_by,
+                                'd1' => $modulated_id
+          ));
+        }
+
+      }
+      $data = theme('maestro_workflow_list', array('tid' => 0, 'operation' => '' , 'edit_var' => 0));
+      $arr=array('status' => "1", 'data' => $data);
+      echo json_encode($arr);
+      break;
+
+  }
+}
+
+function maestro_configure() {
+  return drupal_get_form('maestro_admin_form');
+}
+
+function maestro_admin_form() {
+
+  $form['maestro_batch_script_location'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Maestro batch script physical file location'),
+    '#default_value' => variable_get('maestro_batch_script_location', drupal_get_path('module','maestro') . "/batch/"),
+    '#size' => 100,
+    '#description' => t('This is the physical directory where the batch scripts are stored.
+          It is highly recommended that batch scripts be placed in a directory outside of web root.'),
+    '#required' => TRUE,
+  );
+  $form['maestro_run_orchestrator_in_task_console'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Run the Orchestrator when the Task Console Renders'),
+    '#default_value' => variable_get('maestro_run_orchestrator_in_task_console', 0),
+    '#description' => t('Enabling this option will run the Orchestrator each time you visit or refresh the Task Console page.'),
+    '#required' => FALSE,
+  );
+  $form['maestro_enable_import_window'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable the import window in the Template Editor.'),
+    '#default_value' => variable_get('maestro_enable_import_window', 0),
+    '#description' => t('Enabling this option will turn on the Import Window in the template editor.  It is NOT recommended to have this on in production environments.'),
+    '#required' => FALSE,
+  );
+
+  $form['maestro_enable_notifications'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable Maestro Notifications.'),
+    '#default_value' => variable_get('maestro_enable_notifications', 1),
+    '#description' => t('Checking this option will turn on the Maestro Notifications mechanism.'),
+    '#required' => FALSE,
+  );
+
+  include_once('maestro_notification.class.php');
+  $observers = array();
+  $observers[0] = t("No Notifier");
+  foreach (module_implements('maestro_notification_observer') as $module) {
+    $function = $module . '_maestro_notification_observer';
+    if ($declaredObserver = $function()) {
+      foreach($declaredObserver as $observer) {
+        $obj = new $observer();
+        $observers[$observer] = $obj->displayName;
+      }
+    }
+  }
+
+  if(variable_get('maestro_enabled_notifiers') == NULL || (is_array(variable_get('maestro_enabled_notifiers')) && count(variable_get('maestro_enabled_notifiers')) == 0 )  ) {
+    //this means that all of them should be selected by default
+    $x = array();
+    foreach($observers as $key => $val) {
+      if($key != '0') {
+        $x[$key] = $key;
+      }
+    }
+
+    variable_set('maestro_enabled_notifiers',$x);
+  }
+
+
+  $form['maestro_enabled_notifiers'] = array(
+    '#type' => 'select',
+    '#title' => t('Select Which Notifiers to Enable'),
+    '#default_value' => variable_get('maestro_enabled_notifiers', NULL),
+    '#options' =>  $observers,
+    '#description' => t('The notifiers highlighted will be used to send Maestro notifications.'),
+    '#rows'        => 10,
+    '#multiple'    => TRUE,
+  );
+
+  $form['notifications'] = array(
+  '#type' => 'vertical_tabs',
+  );
+
+  $form['assignment_notifications'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Task Assignment Notifcation settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE,
+    '#group' => 'notifications'
+    );
+
+    $form['assignment_notifications']['maestro_assignment_subject'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Assignment Notification Default Subject'),
+    '#default_value' => variable_get('maestro_assignment_subject'),
+    '#required' => FALSE,
+    );
+
+    $form['assignment_notifications']['maestro_assignment_message'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Assignment Notification Default Message'),
+    '#default_value' => variable_get('maestro_assignment_message'),
+    '#description' => t('Valid tokens: [workflow_name], [task_name], [task_owner], [task_console_url]'),
+    '#required' => FALSE,
+    );
+
+    $form['commpletion_notifications'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Task Completion Notifcation settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE,
+    '#group' => 'notifications'
+    );
+
+    $form['commpletion_notifications']['maestro_completion_subject'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Completion Notification Default Subject'),
+    '#default_value' => variable_get('maestro_completion_subject'),
+    '#required' => FALSE,
+    );
+
+    $form['commpletion_notifications']['maestro_completion_message'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Completion Notification Default Message'),
+    '#default_value' => variable_get('maestro_completion_message'),
+    '#description' => t('Valid tokens: [workflow_name], [task_name], [task_owner], [task_console_url]'),
+    '#required' => FALSE,
+    );
+
+    $form['reminder_notifications'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Task Reminder Notifcation settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE,
+    '#group' => 'notifications'
+    );
+
+    $form['reminder_notifications']['maestro_reminder_subject'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Reminder Notification Default Subject'),
+    '#default_value' => variable_get('maestro_reminder_subject'),
+    '#required' => FALSE,
+    );
+
+    $form['reminder_notifications']['maestro_reminder_message'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Reminder Notification Default Message'),
+    '#default_value' => variable_get('maestro_reminder_message'),
+    '#description' => t('Valid tokens: [workflow_name], [task_name], [task_owner], [task_console_url]'),
+    '#required' => FALSE,
+    );
+
+    $form['escalation_notifications'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Task Escalation Notification settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE,
+    '#group' => 'notifications'
+    );
+
+    $form['escalation_notifications']['maestro_escalation_subject'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Escalation Notification Default Subject'),
+    '#default_value' => variable_get('maestro_escalation_subject'),
+    '#required' => FALSE,
+    );
+
+    $form['escalation_notifications']['maestro_escalation_message'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Escalation Notification Default Message'),
+    '#default_value' => variable_get('maestro_escalation_message'),
+    '#description' => t('Valid tokens: [workflow_name], [task_name], [task_owner], [task_console_url]'),
+    '#required' => FALSE,
+    );
+
+    return system_settings_form($form);
+}
+
+
+function maestro_edit_properties($tid, $var=0){
+  //$tid is the edited template
+  return maestro_admin($tid, 'edit', $var);
+}
+
+/*
+ * The following functions are here in support of the Maestro Structure page functionality.
+ * These functions need to exist in order to run unit tests against their functionality.
+ */
+
+function maestro_createNewTemplate($name, $skip_task_creation = FALSE, $skip_variable_creation = FALSE, $canvas_height=500){
+  if(!user_access('maestro admin')) return false;
+  if(trim($name) != '') {
+    $record = new stdClass();
+    $record->template_name = $name;
+    $record->canvas_height = $canvas_height;
+    drupal_write_record('maestro_template', $record);
+    $newTemplateRecId = $record->id;
+    if(!$skip_task_creation) {
+      $task=new MaestroTaskInterfaceStart(0, $newTemplateRecId);
+      $task->create();
+      $task=new MaestroTaskInterfaceEnd(0, $newTemplateRecId);
+      $task->create();
+    }
+    if(!$skip_variable_creation) {
+      maestro_createTemplateVariable($newTemplateRecId, 'initiator', '');
+    }
+    return $newTemplateRecId;
+  }
+  else {
+    return FALSE;
+  }
+}
+
+function maestro_createTemplateVariable($tid, $name, $value){
+  if(!user_access('maestro admin')) return false;
+  $record = new stdClass();
+  $record ->variable_name = $name;
+  $record ->variable_value = $value;
+  $record ->template_id = $tid;
+  drupal_write_record('maestro_template_variables', $record);
+  return $record->id;
+}
+
+function maestro_deleteTemplateVariable($id){
+  if(!user_access('maestro admin')) return false;
+  $query = db_select('maestro_template_variables', 'a');
+  $query->fields('a',array('variable_name'));
+  $query->condition('a.id', $id, '=');
+  $name=current($query->execute()->fetchAll());
+  if($name->variable_name != 'initiator') {
+    $query = db_delete('maestro_template_variables');
+    $query->condition('id', $id, '=');
+    $query->execute();
+    return true;
+  }
+  else {
+    return false;
+  }
+
+}
+
+function maestro_createAppGroup($name){
+  if(!user_access('maestro admin')) return false;
+  $record = new stdClass();
+  $record ->app_group = $name;
+  drupal_write_record('maestro_app_groups', $record);
+  return $record->id;
+}
+
+function maestro_deleteAppGroup($id){
+  if(!user_access('maestro admin')) return false;
+  $query = db_delete('maestro_app_groups');
+  $query->condition('id', $id, '=');
+  $query->execute();
+}
+
+function maestro_joinAppGroup($template_id, $appgroup_id) {
+  if(!user_access('maestro admin')) return false;
+  $update = db_update('maestro_template')
+  ->fields(array( 'app_group' => $appgroup_id
+  ))
+  ->condition('id', $template_id)
+  ->execute();
+}
+
+function maestro_export($id) {
+  $output_php = "";
+  $id=intval($id);
+  if($id > 0) {
+    //first step -- fetch the name of the original template
+    $output_php .= '$_POST[\'offset_top\'] = 0;' . "\n";
+    $output_php .= '$_POST[\'offset_left\'] = 0;' . "\n";
+    $output_php .= '$variable_xref_array = Array();' . "\n";
+    $output_php .= '$variable_xref_array[0] = 0;' . "\n";
+    $output_php .= '$task_xref_array = Array();' . "\n";
+    $output_php .= '$task_xref_array[0] = 0;' . "\n";
+    $query = db_select('maestro_template', 'a');
+    $query->fields('a',array('template_name', 'canvas_height'));
+    $query->condition('a.id',$id,'=');
+    $name=current($query->execute()->fetchAll());
+    $original_template_name = str_replace('"', '\"', $name->template_name);
+    $canvas_height = $name->canvas_height;
+    $output_php .= '$templateID = maestro_createNewTemplate("IMPORT - ' . $original_template_name . '", TRUE, TRUE, ' . $canvas_height . ');' . "\n"; //create new template
+    //lets get all of the template variables:
+    $template_variables_record_set=db_query("SELECT * FROM {maestro_template_variables} WHERE template_id = :tid", array('tid' => $id));
+    foreach($template_variables_record_set as $rec) {
+      $var_name = str_replace('"', '\"', $rec->variable_name);
+      $var_value = str_replace('"', '\"', $rec->variable_value);
+      $output_php .= '$variable_xref_array[' . $rec->id . '] = maestro_createTemplateVariable($templateID, "' . $var_name . '", "' . $var_value . '");' . "\n";
+    }
+    //lets get all of the template_data entries
+    $template_data_record_set=db_query("SELECT * FROM {maestro_template_data} WHERE template_id = :tid", array('tid' => $id));
+    foreach($template_data_record_set as $rec) {
+      $task_type = substr($rec->task_class_name, 15);
+      $task_class = 'MaestroTaskInterface' . $task_type;
+      $output_php .= '$ti = new ' . $task_class . '(0, $templateID);' . "\n";
+      $output_php .= '$ti->create();' . "\n";
+      $output_php .= '$task_xref_array[' . $rec->id . '] = $ti->get_task_id();' . "\n";
+      $output_php .= '$res = db_select(\'maestro_template_data\', \'a\');' . "\n";
+      $output_php .= '$res->fields(\'a\', array(\'id\', \'task_data\'));' . "\n";
+      $output_php .= '$res->condition(\'a.id\', $ti->get_task_id(), \'=\');' . "\n";
+      $output_php .= '$rec = current($res->execute()->fetchAll());' . "\n";
+      foreach($rec as $key => $data){
+        if($key!='id' && $key!='task_class_name' && $key!='template_id') {
+          if($key == 'task_data') {
+            $output_php .= '$fixed_data = $ti->modulateExportTaskData(\'' . str_replace("'", "\'", $data) . '\', $variable_xref_array);' . "\n";
+            $output_php .='$rec->task_data = $fixed_data;' . "\n";
+          }
+          elseif(is_numeric($data)) {
+            $output_php .='$rec->' . $key . ' = ' . $data . ';' . "\n";
+          }
+          else {
+            $output_php .='$rec->' . $key . ' = \'' . $data . '\';' . "\n";
+          }
+        }
+      }
+      $output_php .= 'drupal_write_record(\'maestro_template_data\', $rec, array(\'id\'));' . "\n";
+    }
+    //we now have to create the next step and assignmnents
+    $template_data_record_set=db_query("SELECT * FROM {maestro_template_data} WHERE template_id = :tid", array('tid' => $id));
+    foreach($template_data_record_set as $rec) {
+      $nextstepres = db_query("SELECT * FROM {maestro_template_data_next_step} WHERE template_data_from = :id", array('id' => $rec->id));
+      foreach($nextstepres as $nextstep) {
+        $output_php .='$sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";' . "\n";
+        $output_php .='db_query($sql, array(\'a1\' => $task_xref_array[' . $nextstep->template_data_from . '], \'b1\' => $task_xref_array[' . $nextstep->template_data_to . '], \'c1\' => $task_xref_array[' . $nextstep->template_data_to_false . ']));' . "\n";
+      }
+      $assignmentres = db_query("SELECT * FROM {maestro_template_assignment} WHERE template_data_id = :id", array('id' => $rec->id));
+      foreach($assignmentres as $ares) {
+        $output_php .='$query = db_select(\'maestro_template_data\', \'a\');' . "\n";
+        $output_php .='$query->fields(\'a\',array(\'task_class_name\'));' . "\n";
+        $output_php .='$query->condition(\'a.id\',$task_xref_array[' . $ares->template_data_id . '],\'=\');' . "\n";
+        $output_php .='$name=current($query->execute()->fetchAll());'. "\n";
+        $output_php .='$task_type = substr($name->task_class_name, 15);' . "\n";
+        $output_php .='$task_class = \'MaestroTaskInterface\' . $task_type;' . "\n";
+        $output_php .='$ti = new $task_class(0,0);' . "\n";
+
+        //we'll just make an initial assumption that the assign_by is by variable
+        //we overwrite this in the switch if it is actually by a fixed value
+        $assign_by = $ares->assign_by;
+        $modulated_string = '$modulated_id = $variable_xref_array[' . intval($ares->assign_id) . '];' . "\n";
+        switch($ares->assign_type) {
+          case MaestroAssignmentTypes::USER:
+            if($assign_by == MaestroAssignmentBy::FIXED) {
+              $temp_user_info = user_load($ares->assign_id);
+              $modulated_string ='$modulated_id = $ti->modulateExportUser("' . $temp_user_info->name . '");' . "\n";
+            }
+            break;
+
+          case MaestroAssignmentTypes::GROUP:
+            //@TODO:  implement this when we implement OG suppport
+            break;
+
+          case MaestroAssignmentTypes::ROLE:
+            //@TODO:  implement this when we implement Role suppport
+            break;
+        }
+
+        $output_php .= $modulated_string;
+
+        $output_php .='$sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";' . "\n";
+        $output_php .='db_query($sql, array( \'a1\' => $task_xref_array[' . $ares->template_data_id . '],';
+        $output_php .='\'b1\' => ' . $ares->assign_type . ',';
+        $output_php .='\'c1\' => ' . $ares->assign_by . ',';
+        $output_php .='\'d1\' => $modulated_id,';
+        $output_php .='));' . "\n";
+
+      }
+    }
+  }
+  return $output_php;
+}
+
+function maestro_export_template($tid, $var=0){
+  $content=maestro_export($tid);
+  return maestro_admin($tid, 'export_template', $var);
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro.class.php b/sites/all/modules/maestro/maestro.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..caed7f49205d2076e261f3cc19794f3976339b4c
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.class.php
@@ -0,0 +1,50 @@
+<?php
+
+  /* Using Drupal OO Coding Standards as described: http://drupal.org/node/608152 */
+
+  class Maestro {
+
+    private static $MAESTRO;
+    private $_engine = null;
+
+    function createMaestroObject ($version, $options = FALSE){
+        if (!isset(self::$MAESTRO)) {
+            // instance does not exist, so create it
+            self::$MAESTRO = new self($version, $options);
+        } else {
+          return self::$MAESTRO;
+        }
+        return self::$MAESTRO;
+    }
+
+    function __construct($version, $options = FALSE) {
+      include_once './' . drupal_get_path('module', 'maestro') . '/maestro_base_engine.class.php';
+      include_once './' . drupal_get_path('module', 'maestro') . '/maestro_tasks.class.php';
+      $classfile = drupal_get_path('module','maestro')."/maestro_engine_version{$version}.class.php";
+      if (require_once $classfile) {
+        $class = "MaestroEngineVersion{$version}";
+        if (class_exists($class)) {
+          $this->_engine = new $class($options);
+        } else {
+          die("maestro.class - Unable to instantiate class $class from $classfile");
+        }
+      } else {
+        die("maestro.class - Unable to include file: $classfile");
+      }
+    }
+
+
+   /**
+   * Returns a reference to the instantiated engine object for use in working with the engine.
+   *
+   * @code
+   * $x = $maestro->engine()->newprocess(1);
+   * @endcode
+   *
+   * @return
+   *   A reference to the engine object
+   */
+    public function engine(){
+      return $this->_engine;
+    }
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro.info b/sites/all/modules/maestro/maestro.info
new file mode 100644
index 0000000000000000000000000000000000000000..9b63ff1c2edea920330d9bfdb0a22075f6fdd410
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.info
@@ -0,0 +1,20 @@
+; $Id: maestro.info,v 1.16 2011/01/07 21:07:39 chevy Exp $
+name = Maestro
+description = Maestro workflow management system which lets you define processes and route tasks to different site users.
+package = Maestro
+version = 7.x-1.0-rc1
+core = 7.x
+dependencies[] = trigger
+files[] = maestro.module
+files[] = maestro.install
+files[] = maestro.test
+files[] = maestro.admin.inc
+files[] = maestro.views.inc
+configure = admin/structure/maestro
+
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/maestro.install b/sites/all/modules/maestro/maestro.install
new file mode 100644
index 0000000000000000000000000000000000000000..7885b9d3cf05c4b47ecd7c61f1f870adaa0a055b
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.install
@@ -0,0 +1,975 @@
+<?php
+// $Id: maestro.install,v 1.61 2010/09/07 17:30:21 chevy Exp $
+
+/**
+ * @file
+ * maestro.install
+ */
+
+function maestro_install() {
+  //@TODO:  set this option to 0 for release.
+  variable_set('maestro_run_orchestrator_in_task_console', 1);
+  variable_set('maestro_enable_notifications', 1);
+  variable_set('maestro_enabled_notifiers', NULL);
+
+  variable_set('maestro_assignment_subject', "Task [task_name] has been Assigned");
+  variable_set('maestro_assignment_message', "Hello,\n\nA new task, \"[task_name]\" has been assigned to [task_owner].\n\nClick here for your task console: [task_console_url]\n\nRegards,\nAdministrator");
+  variable_set('maestro_completion_subject', "Task [task_name] has been Completed");
+  variable_set('maestro_completion_message', "Hello,\n\nThe task \"[task_name]\" has been completed by [task_owner].\n\nRegards,\nAdministrator");
+  variable_set('maestro_reminder_subject', "Task [task_name] Reminder");
+  variable_set('maestro_reminder_message', "Hello,\n\nThis is a reminder of the task \"[task_name]\" which has been assigned to [task_owner] and is not yet completed.\n\nClick here for your task console: [task_console_url]\n\nRegards,\nAdministrator");
+  variable_set('maestro_escalation_subject', "Task [task_name] Escalation");
+  variable_set('maestro_escalation_message', "Hello,\n\nThe task \"[task_name]\" has gone uncompleted for too long. This message is to make the supervisor aware of this.\n\nRegards,\nAdministrator");
+
+  // Grant authenticated role access to the task console by default
+  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('maestro taskconsole'));
+}
+
+
+function maestro_uninstall() {
+  variable_del('maestro_batch_script_location');
+  variable_del('maestro_run_orchestrator_in_task_console');
+  variable_del('maestro_enable_import_window');
+  variable_del('maestro_enabled_notifiers');
+
+  variable_del('maestro_assignment_subject');
+  variable_del('maestro_assignment_message');
+  variable_del('maestro_completion_subject');
+  variable_del('maestro_completion_message');
+  variable_del('maestro_reminder_subject');
+  variable_del('maestro_reminder_message');
+  variable_del('maestro_escalation_subject');
+  variable_del('maestro_escalation_message');
+}
+
+function maestro_schema() {
+  //maestro_app_groups
+  $schema['maestro_app_groups'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'app_group' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+      ),
+    ),
+    'primary key' => array('id'),
+  );
+
+  //maestro_notifications
+  $schema['maestro_notifications'] = array(
+    'description' => '',
+    'fields' => array(
+      'queue_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'notification_sent' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'indexes' => array(
+      'queue_id' => array('queue_id'),
+      'uid' => array('uid'),
+    ),
+  );
+
+  //maestro_process
+  $schema['maestro_process'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'flow_name' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'complete' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'initiator_uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'pid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'initiating_pid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'tracking_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'initiated_date' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'completed_date' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'template_id' => array('template_id'),
+    ),
+  );
+
+  //maestro_process_variables
+  $schema['maestro_process_variables'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'process_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'variable_value' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'template_variable_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'process_id' => array('process_id'),
+      'template_variable_id' => array('template_variable_id'),
+    ),
+  );
+
+  //maestro_production_assignments
+  $schema['maestro_production_assignments'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'task_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'process_variable' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'assign_back_uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_updated' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'security_hash' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '64',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'assign_back_uid' => array('assign_back_uid'),
+      'process_variable' => array('process_variable'),
+      'task_id' => array('task_id'),
+    ),
+  );
+
+  //maestro_project_comments
+  $schema['maestro_project_comments'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'tracking_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'task_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'timestamp' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'comment' => array(
+        'description' => '',
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'tracking_id' => array('tracking_id'),
+    ),
+  );
+
+
+  //maestro_projects
+  $schema['maestro_projects'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'project_num' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '12',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'originator_uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'description' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'status' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'prev_status' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'related_processes' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'originator_uid' => array('originator_uid'),
+      'project_num' => array('project_num'),
+      'status' => array('status'),
+    ),
+  );
+
+  //maestro_queue
+  $schema['maestro_queue'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'process_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'template_data_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'task_class_name' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'engine_version' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'is_interactive' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'show_in_detail' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'handler' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'task_data' => array(
+        'description' => 'Serialized array of task specific data or options.',
+        'type' => 'text'
+      ),
+      'temp_data' => array(
+        'description' => 'Serialized array of task temporary data the developer can us to save data while task is active.',
+        'type' => 'text'
+      ),
+      'status' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'archived' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'run_once' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'prepopulate' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'created_date' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+      ),
+      'started_date' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+      ),
+      'completed_date' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+      ),
+      'next_reminder_time' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+      ),
+      'num_reminders_sent' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'archived' => array('archived'),
+      'process_id' => array('process_id'),
+      'status' => array('status'),
+      'template_data_id' => array('template_data_id'),
+    ),
+  );
+
+  //maestro_queue_from
+  $schema['maestro_queue_from'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'queue_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'from_queue_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+    ),
+    'primary key' => array('id'),
+  );
+
+
+  //maestro_template
+  $schema['maestro_template'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_name' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'canvas_height' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 500,
+      ),
+      'app_group' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+  );
+
+  //maestro_template_assignment
+  $schema['maestro_template_assignment'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_data_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'assign_type' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'assign_by' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'assign_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'assign_id' => array('assign_id'),
+      'template_data_id' => array('template_data_id'),
+    ),
+  );
+
+  //maestro_template_notification
+  $schema['maestro_template_notification'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_data_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'notify_type' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'notify_by' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'notify_when' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'notify_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'notify_id' => array('notify_id'),
+      'template_data_id' => array('template_data_id'),
+    ),
+  );
+
+  //maestro_template_data
+  $schema['maestro_template_data'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'task_class_name' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'is_interactive' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'task_data' => array(
+        'description' => 'Serialized array of task specific data or options.',
+        'type' => 'text'
+      ),
+      'handler' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'first_task' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'taskname' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '150',
+        'not null' => FALSE,
+      ),
+      'argument_variable' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => FALSE,
+      ),
+      'regenerate' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'regen_all_live_tasks' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'show_in_detail' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'is_dynamic_taskname' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'dynamic_taskname_variable_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'reminder_interval' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'escalation_interval' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_updated' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'pre_notify_subject' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '127',
+        'not null' => FALSE,
+      ),
+      'post_notify_subject' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '127',
+        'not null' => FALSE,
+      ),
+      'reminder_subject' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '127',
+        'not null' => FALSE,
+      ),
+      'escalation_subject' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '127',
+        'not null' => FALSE,
+      ),
+      'pre_notify_message' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'post_notify_message' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'reminder_message' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'escalation_message' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'num_reminders' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'offset_left' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'size' => 'small',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'offset_top' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'size' => 'small',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'surpress_first_notification' => array(
+        'description' => '',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'template_id' => array('template_id'),
+    ),
+  );
+
+  //maestro_template_data_next_step
+  $schema['maestro_template_data_next_step'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_data_from' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'template_data_to' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'template_data_to_false' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+    ),
+    'primary key' => array('id'),
+  );
+
+  //maestro_template_variables
+  $schema['maestro_template_variables'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'template_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'variable_name' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'variable_value' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'template_id' => array('template_id'),
+    ),
+  );
+
+
+  //maestro_project_content
+  $schema['maestro_project_content'] = array(
+    'description' => '',
+    'fields' => array(
+      'id' => array(
+        'description' => '',
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'nid' => array(
+        'description' => 'Node ID',
+        'type' => 'int',
+        'not null' => TRUE,
+      ),
+      'tracking_id' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'task_id' => array(
+        'description' => 'Created by this task id - template_data id',
+        'type' => 'int',
+        'not null' => FALSE,
+      ),
+      'instance'=> array(
+        'description' => 'Instance of this content type for this project',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'content_type' => array(
+        'description' => '',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+      ),
+      'task_data' => array(
+        'description' => 'Optional serialized array of task specific data or options.',
+        'type' => 'text'
+      ),
+      'created_by_uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'is_locked_by_uid' => array(
+        'description' => '',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'status' => array(
+        'description' => '',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('id'),
+    'indexes' => array(
+      'nid' => array('nid'),
+    ),
+  );
+
+
+  return $schema;
+}
+
+
diff --git a/sites/all/modules/maestro/maestro.moderator.inc b/sites/all/modules/maestro/maestro.moderator.inc
new file mode 100644
index 0000000000000000000000000000000000000000..97f598bb166376289b5a4b6f6745fe1143056b26
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.moderator.inc
@@ -0,0 +1,255 @@
+<?php
+// $Id: maestro.moderator.inc,v 1.16 2011/01/07 18:17:36 randy Exp $
+
+/**
+ * @file
+ * maestro.moderator.inc
+ */
+
+function maestro_outstanding_tasks($op='', $qid=0, $other=NULL) {
+  global $base_url;
+
+  $maestro_path = '/' . drupal_get_path('module', 'maestro');
+  $maestro_url = $base_url . $maestro_path;
+
+  drupal_add_css($base_url . $maestro_path . '/css/maestro.css');
+  drupal_add_js($base_url . $maestro_path . '/js/moderator.js');
+
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+  $m = $maestro->engine();
+
+  $show_system_tasks = (intval(@($_POST['show_system_tasks'])) == 1) ? TRUE:FALSE;
+
+  switch ($op) {
+  case 'reassign':
+    $m->reassignTask($qid, $_POST['reassign_uid'], $_POST['current_uid']);
+    drupal_set_message("Task re-assignment completed and notification sent.");
+    break;
+
+  case 'email':
+    $m->sendTaskReminderNotifications($qid, $other);
+    drupal_set_message("Task assignment reminder notification sent.");
+    break;
+
+  case 'trace':
+    break;
+
+  case 'delete':
+    $m->deleteTask($qid);
+    break;
+
+  default:
+    $maestro->engine()->setMode('admin');
+    $q = $m->getQueue($show_system_tasks);
+
+    $query = db_select('users', 'a');
+    $query->fields('a', array('uid', 'name'));
+    $query->condition('a.uid', 0, '>');
+    $user_res = $query->execute();
+
+    return theme('maestro_outstanding_tasks', array('maestro_url' => $maestro_url, 'show_system_tasks' => $show_system_tasks, 'maestro' => $m, 'queue' => $q, 'users' => $user_res));
+    break;
+  }
+
+  drupal_goto('maestro/outstanding');
+}
+
+function maestro_trace($tracking_id=0, $process_id=0, $queue_id=0) {
+  global $base_url;
+
+  $op = '';
+  if (is_array($_POST) && array_key_exists('op', $_POST)) {
+    $op = $_POST['op'];
+  }
+
+  switch ($op) {
+  case 'save_task_changes':
+    maestro_save_task_changes();
+    break;
+
+  case 'save_process_variables':
+    maestro_save_process_variables();
+    break;
+
+  default:
+    $maestro_path = '/' . drupal_get_path('module', 'maestro');
+    $maestro_url = $base_url . $maestro_path;
+    $ajax_url = url('maestro');
+
+    drupal_add_css($base_url . $maestro_path . '/css/maestro.css');
+    drupal_add_js($base_url . $maestro_path . '/js/moderator.js');
+
+    $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+    $m = $maestro->engine();
+
+    if ($process_id == 0 && $queue_id > 0) {
+      $res = db_select('maestro_queue', 'a')
+        ->fields('a', array('process_id'))
+        ->condition('a.id', $queue_id, '=')
+        ->execute();
+      $process_id = current($res->fetchAll())->process_id;
+    }
+
+    if ($process_id > 0) {
+      $res = db_select('maestro_process', 'a')
+        ->fields('a', array('tracking_id'))
+        ->condition('a.id', $process_id, '=')
+        ->execute();
+      $tracking_id = current($res->fetchAll())->tracking_id;
+    }
+
+    $initiating_pid = $m->getParentProcessId($process_id);
+
+    $properties = new stdClass();
+    $properties->queue_id = $queue_id;
+    $properties->process_id = $process_id;
+    $properties->tracking_id = $tracking_id;
+    $properties->initiating_pid = $initiating_pid;
+
+
+    $query = db_select('maestro_process', 'a');
+    $query->fields('b', array('variable_value', 'process_id', 'id'));
+    $query->fields('c', array('variable_name'));
+    $query->leftJoin('maestro_process_variables', 'b', 'a.id=b.process_id');
+    $query->leftJoin('maestro_template_variables', 'c', 'b.template_variable_id=c.id');
+    $query->condition('a.initiating_pid', $initiating_pid, '=');
+    $query->orderBy('a.id', 'ASC');
+    $query->orderBy('c.id', 'ASC');
+    $pv_res = $query->execute();
+
+    $query = db_select('maestro_process', 'a');
+    $query->fields('a', array('id'));
+    $query->fields('b', array('template_name'));
+    $query->leftJoin('maestro_template', 'b', 'a.template_id=b.id');
+    $query->condition('a.initiating_pid', $initiating_pid, '=');
+    $proc_res = $query->execute();
+
+    $statuses = MaestroTaskStatusCodes::getStatusLabel();
+
+    $wf_res = $m->getRelatedWorkflows($tracking_id);
+    $trace = $m->getQueueHistory($initiating_pid);
+
+    return theme('maestro_trace', array('maestro_url' => $maestro_url, 'ajax_url' => $ajax_url, 'trace' => $trace, 'properties' => $properties, 'pv_res' => $pv_res, 'proc_res' => $proc_res, 'wf_res' => $wf_res, 'statuses' => $statuses));
+    break;
+  }
+}
+
+function maestro_save_task_changes() {
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+  $m = $maestro->engine();
+
+  foreach ($_POST['queue_id'] as $key => $qid) {
+    $query = db_select('maestro_queue', 'a');
+    $query->fields('a', array('id', 'status', 'archived'));
+    $query->condition('a.id', $qid, '=');
+    $rec = current($query->execute()->fetchAll());
+
+    $prev_status = $rec->status;
+    $status = ($_POST['batch_op'][$key] == 1) ? $_POST['batch_op_status'] : $_POST['status'][$key];
+
+    $rec->status = $status;
+    $rec->archived = $_POST['archived'][$key];
+    drupal_write_record('maestro_queue', $rec, array('id'));
+
+    if ($status == MaestroTaskStatusCodes::STATUS_DELETED) {
+      $m->deleteTask($qid);
+    }
+    else { //need to readd the procution assignment records
+      if ($prev_status == MaestroTaskStatusCodes::STATUS_DELETED) {
+        $m->reviveTask($qid);
+      }
+    }
+  }
+
+  print json_encode(array('success' => 1));
+  exit();
+}
+
+function maestro_save_process_variables() {
+  foreach ($_POST['process_variable_id'] as $key => $vid) {
+    $query = db_update('maestro_process_variables');
+    $query->fields(array('variable_value' => $_POST['process_variable_value'][$key]));
+    $query->condition('id', $vid, '=');
+    $query->execute();
+  }
+
+  print json_encode(array('success' => 1));
+  exit();
+}
+
+
+function maestro_all_flows() {
+  global $base_url;
+  $maestro_path = '/' . drupal_get_path('module', 'maestro');
+  $maestro_url = $base_url . $maestro_path;
+  drupal_add_css($base_url . $maestro_path . '/css/maestro.css');
+  drupal_add_js($base_url . $maestro_path . '/js/moderator.js');
+  drupal_add_js($base_url . $maestro_path . '/js/taskconsole.js');
+  $ajax_url = url('maestro/taskconsole/ajax') ;
+  $rows = maestro_get_all_flows_data();  //no filters.  all flows here
+  return theme('maestro_all_flows', array('ajax_url' => $ajax_url, 'filter_url' => $ajax_url, 'database_result_set' => $rows));
+}
+
+function maestro_my_flows() {
+  global $base_url, $user;
+  $maestro_path = '/' . drupal_get_path('module', 'maestro');
+  $maestro_url = $base_url . $maestro_path;
+  drupal_add_css($base_url . $maestro_path . '/css/maestro.css');
+  drupal_add_js($base_url . $maestro_path . '/js/moderator.js');
+  drupal_add_js($base_url . $maestro_path . '/js/taskconsole.js');
+  $ajax_url = url('maestro/taskconsole/ajax')  ;
+  $filter = array(
+        'myflows' => true,
+        );
+  $rows = maestro_get_all_flows_data($filter);  //user as a filter
+  return theme('maestro_all_flows', array('ajax_url' => $ajax_url , 'filter_url' => $ajax_url . '/myflows', 'database_result_set' => $rows));
+}
+
+//filters is a keyed array where the key is what to search for, value is what to filter on
+function maestro_get_all_flows_data($filters = NULL) {
+  global $user;
+
+  $query = db_select('maestro_projects', 'a')->extend('PagerDefault');
+  $query->fields('a', array('originator_uid', 'description', 'id'));
+  $query->fields('c', array('name'));
+  $query->join('maestro_process', 'b', 'a.id = b.tracking_id');
+  $query->join('users', 'c', 'a.originator_uid = c.uid');
+  $query->join('maestro_queue', 'd', 'b.id = d.process_id');
+  $query->join('users', 'e', 'd.uid = e.uid');
+  $query->groupBy('a.originator_uid');
+  $query->groupBy('a.description');
+  $query->groupBy('a.id');
+  $query->groupBy('c.name');
+  //RK -- commented out the next 2 lines as they were destroying the SQL Server output for all flows
+  //$query->groupBy('d.id');
+  //$query->orderBy('d.id','DESC');
+  //$query->limit(1);
+
+  if(is_array($filters)) {
+    foreach($filters as $key => $filter) {
+      if(isset($filter) && $filter !=''){
+
+        switch($key) {
+          case 'userid':
+            $query->condition(db_or()->condition('a.originator_uid', intval($filter))->condition('e.uid', intval($filter)));
+            break;
+
+          case 'projectname':
+            $query->condition('a.description', '%' . $filter . '%', 'LIKE');
+            break;
+
+          case 'username':
+            $query->condition(db_or()->condition('c.name', $filter)->condition('e.name', $filter));
+            break;
+
+          case 'myflows':  //this is a pseudo filter to force on the right filtering for the query to isolate the flows ONLY for that user
+            $query->condition(db_or()->condition('a.originator_uid', intval($user->uid))->condition('e.uid', intval($user->uid)));
+            break;
+        }
+      }
+    }
+  }
+  $res = $query->execute();
+  return $res;
+}
+
diff --git a/sites/all/modules/maestro/maestro.module b/sites/all/modules/maestro/maestro.module
new file mode 100644
index 0000000000000000000000000000000000000000..a790496795d2a162e2422d7af67890500ef69849
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.module
@@ -0,0 +1,1485 @@
+<?php
+// $Id: maestro.module,v 1.155 2011/01/17 18:21:50 chevy Exp $
+
+/**
+ * @file
+ * maestro.module
+ */
+
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro.class.php';
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_tasks.class.php';
+
+function maestro_menu() {
+  $items = array();
+
+  $items['maestro/taskconsole'] = array(
+    'title' => 'Task Console',
+    'page callback' => 'maestro_taskconsole',
+    'access callback' => 'user_access',
+    'access arguments' => array('maestro taskconsole'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+
+  $items['maestro/launch'] = array(
+    'page callback' => 'maestro_launch_workflow',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+  );
+
+  $items['maestro/newprocess'] = array(
+    'page callback' => 'maestro_new_process',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+  );
+
+  $items['admin/structure/maestro'] = array(
+    'title' => 'Maestro Workflows',
+    'description' => 'Define and administer workflows.',
+    'page callback' => 'maestro_admin',
+    'access arguments' => array('maestro admin'),
+    //'type' => MENU_LOCAL_TASK,
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['maestro/taskconsole/ajax'] = array(
+    'page callback' => 'maestro_handle_taskconsole_ajax_request',
+    'page arguments' => array(3, 4) ,      // Passing in wildcard which should be parm 1
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('maestro taskconsole')
+  );
+
+  $items['maestro/outstanding'] = array(
+    'title' => 'Outstanding Tasks',
+    'page callback' => 'maestro_outstanding_tasks',
+    'type' => MENU_NORMAL_ITEM,
+    'access arguments' => array('view outstanding tasks'),
+    'file' => 'maestro.moderator.inc'
+  );
+
+  $items['maestro/allflows'] = array(
+    'title' => 'All Maestro Workflows',
+    'page callback' => 'maestro_all_flows',
+    'type' => MENU_NORMAL_ITEM,
+    'access arguments' => array('maestro admin'),
+    'file' => 'maestro.moderator.inc'
+  );
+
+  $items['maestro/myflows'] = array(
+    'title' => 'My Workflows',
+    'page callback' => 'maestro_my_flows',
+    'type' => MENU_NORMAL_ITEM,
+    'access arguments' => array('maestro taskconsole'),
+    'file' => 'maestro.moderator.inc'
+  );
+
+  $items['maestro/trace'] = array(
+    'page callback' => 'maestro_trace',
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('edit outstanding tasks'),
+    'file' => 'maestro.moderator.inc'
+  );
+
+  $items['admin/structure/maestro/ajax'] = array(
+    'page callback' => 'maestro_handle_editor_ajax_request',
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('maestro admin'),
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['admin/structure/maestro/structure_ajax'] = array(
+    'page callback' => 'maestro_handle_structure_ajax_request',
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('maestro admin'),
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['admin/structure/maestro/new'] = array(
+    'title' => 'New',
+    'type' => MENU_LOCAL_TASK,
+  );
+
+  $items['admin/structure/maestro/edit'] = array(
+    'title' => 'Edit',
+    'page callback' => 'maestro_edit_workflow',
+    'access arguments' => array('maestro admin'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['admin/structure/maestro/edit_properties'] = array(
+    'title' => 'Edit Template Name and Variables',
+    'page callback' => 'maestro_edit_properties',
+    'access arguments' => array('maestro admin'),
+    'type' => MENU_CALLBACK,
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['maestro_enginetest'] = array(
+    'title' => 'Execute Development Test',
+    'page callback' => 'maestro_enginetest',
+    'page arguments' => array(),
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+    'file'  => 'lib-test.php',
+  );
+
+  $items['admin/config/workflow/maestro_configure'] = array(
+    'title' => 'Maestro Config',
+    'description' => 'Configure the Maestro Engine.',
+    'page callback' => 'maestro_configure',
+    'access arguments' => array('maestro admin'),
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['admin/structure/maestro/export'] = array(
+    'title' => 'Export a Maestro Template',
+    'page callback' => 'maestro_export_template',
+    'access arguments' => array('maestro admin'),
+    'type' => MENU_CALLBACK,
+    'file' => 'maestro.admin.inc'
+  );
+
+  $items['maestro/orchestrator'] = array(
+    'page callback' => 'maestro_orchestrator',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+  );
+
+  return $items;
+}
+
+
+function maestro_permission() {
+  return array(
+    'maestro taskconsole'  => array(
+      'title' => t('Access Maestro Task Console')
+    ),
+    'maestro admin' => array(
+      'title' => t('Administer Maestro Workflows')
+    ),
+    'maestro view outstanding tasks' => array(
+      'title' => t('View Outstanding Tasks')
+    ),
+    'maestro edit outstanding tasks' => array(
+      'title' => t('Edit Outstanding Tasks')
+    ),
+    'maestro reassign tasks' => array(
+      'title' => t('Re-Assign Tasks')
+    )
+  );
+}
+
+function maestro_help($path, $arg) {
+  $output = '';
+
+  switch ($path) {
+    case "admin/help#maestro":
+      $output = '<p>' . t("Define and administer workflows.") .'</p>';
+      break;
+  }
+  return $output;
+}
+
+/**
+ * Implements hook_admin_paths().
+ */
+function maestro_admin_paths() {
+  $paths = array(
+    'node/*/maestro' => TRUE,
+    'node/add/*/maestro/*' => TRUE,
+    'node/*/edit/maestro/edit/*' => TRUE,
+    'maestro/trace/*/*/*' => TRUE
+  );
+  return $paths;
+}
+
+function maestro_theme() {
+  global $base_url;
+  return array(
+    'maestro_all_flows' => array(
+      'template' => 'theme/maestro-all-flows',
+      'variables' => array('ajax_url' => NULL, 'filter_url' => NULL, 'database_result_set' => NULL),
+    ),
+    'maestro_all_flows_display' => array(
+      'template' => 'theme/maestro-all-flows-display',
+      'variables' => array('ajax_url' => NULL, 'database_result_set' => NULL, 'maestro_path' => $base_url . '/' . drupal_get_path('module', 'maestro')),
+    ),
+    'maestro_taskconsole' => array(
+      'template' => 'theme/maestro-taskconsole',
+      'render element' => 'stucture'
+    ),
+    'maestro_outstanding_tasks' => array(
+      'template' => 'theme/maestro-outstanding-tasks',
+      'variables' => array('maestro_url' => NULL, 'show_system_tasks' => NULL, 'maestro' => NULL, 'queue' => NULL, 'users' => NULL),
+    ),
+    'maestro_taskconsole_details' => array(
+      'template' => 'theme/project_detail_container',
+      'variables' => array('task' => NULL,'source' => NULL),
+      ),
+    'maestro_project_comments' => array(
+      'template' => 'theme/project_detail_comments',
+      'variables' => array('rowid' => NULL,'tracking_id' => NULL),
+      ),
+    'maestro_trace' => array(
+      'template' => 'theme/maestro-trace',
+      'variables' => array('maestro_url' => NULL, 'trace' => NULL, 'properties' => NULL, 'pv_res' => NULL, 'wf_res' => NULL, 'statuses' => NULL),
+    ),
+    'maestro_workflow_list' => array(
+      'template' => 'theme/structure/maestro-workflow-list',
+      'variables' => array('tid' => NULL, 'operation' => NULL, 'edit_var' => 0)
+    ),
+    'maestro_workflow_list_item' => array(
+      'template' => 'theme/structure/maestro-workflow-list-item',
+      'variables' => array('rec' => NULL, 'cntr' => NULL, 'tid' => NULL, 'operation' => NULL, 'edit_var' => 0)
+    ),
+    'maestro_workflow_edit_template_variables_list' => array(
+      'template' => 'theme/structure/maestro-workflow-edit-template-variables-list',
+      'variables' => array('id' => NULL, 'tid' => NULL, 'variable_name' => NULL, 'variable_name' => NULL, 'edit_var' => 0, 'cntr' => 0)
+    ),
+
+    'maestro_workflow_edit_template_variables' => array(
+      'template' => 'theme/structure/maestro-workflow-edit-template-variables',
+      'variables' => array('tid' => NULL, 'edit_var' => 0, 'cntr' => 0)
+    ),
+
+    'maestro_workflow_task_frame' => array(
+      'template' => 'theme/structure/maestro-workflow-task-frame',
+      'variables' => array('rec' => NULL, 'ti' => NULL, 'task_class' => NULL)
+    ),
+    'maestro_workflow_edit' => array(
+      'template' => 'theme/structure/maestro-workflow-edit',
+      'variables' => array('tid' => NULL, 'mi' => NULL, 'maestro_url' => NULL, 't_rec' => NULL)
+    ),
+    'maestro_workflow_edit_tasks_frame' => array(
+      'template' => 'theme/structure/maestro-workflow-edit-tasks-frame',
+      'variables' => array('tdid' => NULL, 'tid' => NULL, 'form_content' => NULL, 'maestro_url' => NULL, 'pv_options' => NULL, 'uid_options' => NULL, 'role_options' => NULL, 'og_options' => NULL, 'selected_options' => NULL, 'task_class' => NULL, 'vars' => NULL, 'task_edit_tabs' => NULL, 'optional_parms' => NULL, 'types' => NULL, 'bys' => NULL, 'whens' => NULL)
+    ),
+    'maestro_workflow_assign_notify_select_boxes' => array(
+      'template' => 'theme/structure/maestro-workflow-assign-notify-select-boxes',
+      'variables' => array('maestro_url' => NULL, 'display' => NULL, 'row_class' => NULL, 'type' => NULL, 'by_variable' => NULL, 'when' => NULL, 'options' => NULL, 'selected_options' => NULL, 'name' => NULL)
+    ),
+
+    'maestro_task_unknown' => array(
+      'template' => 'theme/structure/tasks/maestro-task-unknown',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+
+    'maestro_task_start' => array(
+      'template' => 'theme/structure/tasks/maestro-task-start',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+
+    'maestro_task_end' => array(
+      'template' => 'theme/structure/tasks/maestro-task-end',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+
+    'maestro_task_and' => array(
+      'template' => 'theme/structure/tasks/maestro-task-and',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+
+    'maestro_task_if' => array(
+      'template' => 'theme/structure/tasks/maestro-task-if',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_if_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-if-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL)
+    ),
+
+    'maestro_task_batch' => array(
+      'template' => 'theme/structure/tasks/maestro-task-batch',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_batch_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-batch-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL)
+    ),
+
+    'maestro_task_batch_function' => array(
+      'template' => 'theme/structure/tasks/maestro-task-batch-function',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_batch_function_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-batch-function-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL, 'handler_options' => NULL)
+    ),
+
+    'maestro_task_set_process_variable' => array(
+      'template' => 'theme/structure/tasks/maestro-task-set-process-variable',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_set_process_variable_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-set-process-variable-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL, 'pvars' => NULL, 'set_methods' => NULL)
+    ),
+
+    'maestro_task_interactive_function' => array(
+      'template' => 'theme/structure/tasks/maestro-task-interactive-function',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_interactive_function_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-interactive-function-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL, 'handler_options' => NULL)
+    ),
+
+    'maestro_task_manual_web' => array(
+      'template' => 'theme/structure/tasks/maestro-task-manual-web',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_manual_web_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-manual-web-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL)
+    ),
+
+    'maestro_task_content_type' => array(
+      'template' => 'theme/structure/tasks/maestro-task-content-type',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_content_type_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-content-type-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL, 'content_types' => NULL)
+    ),
+
+    'maestro_task_fire_trigger' => array(
+      'template' => 'theme/structure/tasks/maestro-task-fire-trigger',
+      'variables' => array('tdid' => NULL, 'taskname' => NULL, 'ti' => NULL)
+    ),
+    'maestro_task_fire_trigger_edit' => array(
+      'template' => 'theme/structure/tasks/maestro-task-fire-trigger-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL, 'aa_res' => NULL, 'options' => NULL)
+    ),
+  );
+}
+
+/* maestro custom action logic */
+
+function maestro_action_info() {
+  return array(
+    'launch_workflow_action' => array(
+      'type' => 'maestro',
+      'label' => t('Launch a Maestro Workflow'),
+      'configurable' => TRUE,
+      'triggers' => array ('any'),
+    )
+  );
+}
+
+function launch_workflow_action(&$object, $context = array()) {
+  global $user;
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+  $template = intval($context['workflow']);
+
+  $newprocess = 0;
+  if ($template > 0) {
+    $newprocess = $maestro->engine()->newProcess($template);
+  }
+
+  $tracking_id = $maestro->engine()->getTrackingId($newprocess);
+  $query = db_select('maestro_queue', 'a');
+  $query->fields('a', array('id'));
+  $query->condition('a.process_id', $newprocess, '=');
+  $rec = current($query->execute()->fetchAll());
+  $task_id = $rec->id;
+  switch ($context['group']) {
+  case 'node':
+    //check to see if node id exists in project content table
+    $query = db_insert('maestro_project_content');
+    $query->fields(array('nid', 'tracking_id', 'task_id', 'instance', 'content_type', 'task_data', 'created_by_uid', 'is_locked_by_uid', 'status'));
+    $query->values(array(
+      'nid' => $context['node']->nid,
+      'tracking_id' => $tracking_id,
+      'task_id' => $task_id,
+      'instance' => 1,
+      'content_type' => $context['node']->type,
+      'task_data' => NULL,
+      'created_by_uid' => $user->uid,
+      'is_locked_by_uid' => 0,
+      'status' => MaestroContentStatusCodes::STATUS_SUBMITTED)
+    );
+    $query->execute();
+    break;
+  }
+
+  if ($newprocess > 0) {
+    watchdog('maestro', "Maestro Launch Workflow Action has been invoked by user {$user->uid}. New process of template id #$template has been started.");
+  }
+  else {
+    watchdog('maestro', "Maestro Launch Workflow Action has been invoked by user {$user->uid}. Failed to launch new process of template id #$template.");
+  }
+
+  //RK - I think we need a post-launch trigger/action ability here.
+  //we'll need something to let other modules hook into this.  The handler will be
+  // modulename_maestro_post_action_handler
+  //this will give devs the ability to read the db, handle a new process, do anything with data manipulation/UI etc.
+  foreach (module_implements('maestro_post_action_handler') as $module) {
+    $function = $module . '_maestro_post_action_handler';
+    if(function_exists($function)) {
+      $function($newprocess, $context);
+    }
+  }
+}
+
+function launch_workflow_action_submit($form, $form_state) {
+  return array('workflow' => $form_state['values']['workflow']);
+}
+
+function launch_workflow_action_form($context) {
+  $form = array();
+
+  $res = db_query("SELECT id, template_name FROM {maestro_template}");
+  $options = array('' => t('Select Workflow'));
+  foreach ($res as $rec) {
+    $options[$rec->id] = t($rec->template_name);
+  }
+
+  $form['workflow'] = array(
+    '#title' => t("Workflow to Launch"),
+    '#type' => 'select',
+    '#options' => $options,
+    '#default_value' => isset($context['workflow']) ? $context['workflow']:'',
+    '#required' => TRUE
+  );
+
+  return $form;
+}
+
+/* end of custom action logic */
+
+
+/* maestro custom trigger logic */
+
+function maestro_trigger_info() {
+  //dynamically get triggers based on the fire trigger tasks
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a', array('id', 'taskname', 'template_id'));
+  $query->fields('b', array('template_name'));
+  $query->leftJoin('maestro_template', 'b', 'a.template_id=b.id');
+  $query->condition('a.task_class_name', 'MaestroTaskTypeFireTrigger', '=');
+  $res = $query->execute();
+
+  $triggers = array();
+  foreach ($res as $rec) {
+    $triggers['fire_trigger_task' . $rec->id] = array(
+      'label' => t('When the') . ' ' . t($rec->taskname) . " ({$rec->id}) " . t('task from the') . ' ' . t($rec->template_name) . " ({$rec->template_id}) " . t('workflow is executed')
+    );
+  };
+
+  return array('maestro' => $triggers);
+}
+
+/* end of custom trigger logic */
+
+
+/**
+ * Display of the Task Console - called from hook_menu callback.
+ */
+function maestro_taskconsole() {
+
+  drupal_add_css(drupal_get_path('module', 'maestro') . '/css/maestro.css');
+  $modulepath = drupal_get_path('module', 'maestro');
+  drupal_set_breadcrumb('');
+
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+
+  //Only run the orchestrator if we've been told to do so on the config page.
+  //if this is our initial installation, set the default value to 1
+  //to allow the orchestrator to clean the queue properly
+  if(variable_get('maestro_run_orchestrator_in_task_console', 1)){
+    $maestro->engine()->cleanQueue();
+  }
+
+  return theme('maestro_taskconsole');
+}
+
+
+function maestro_cleanqueue() {
+  global $base_url;
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+  $maestro->engine()->cleanQueue();
+  $maestro->engine()->setProcessVariable('initiator',1);
+  drupal_set_message("Maestro Clean Queue Completed");
+  drupal_goto($base_url);
+}
+
+
+function maestro_launch_workflow($template=0) {
+  global $base_url;
+
+  $template = intval ($template);
+  if ($template > 0) {
+    $maestro = Maestro::createMaestroObject(1);
+    $newprocess = $maestro->engine()->newProcess($template);
+
+    if ($newprocess > 0) {
+      drupal_set_message("New Process Code Success! - Process ID: $newprocess");
+    } else {
+      drupal_set_message("New Process Code FAIL! - Template: $template not defined");
+    }
+  }
+  else {
+    drupal_set_message("New Process Code FAIL! - No Template ID Given");
+  }
+
+  return $newprocess;
+}
+
+function maestro_new_process($template=0) {
+  global $base_url;
+
+  $template = intval ($template);
+  if ($template > 0) {
+    $maestro = Maestro::createMaestroObject(1);
+    $newprocess = $maestro->engine()->newProcess($template);
+
+    if ($newprocess > 0) {
+      drupal_set_message("New Process Code Success! - Process ID: $newprocess");
+    } else {
+      drupal_set_message("New Process Code FAIL! - Template: $template not defined");
+    }
+  }
+  else {
+    drupal_set_message("New Process Code FAIL! - No Template ID Given");
+  }
+
+  drupal_goto('maestro/taskconsole');
+  return $newprocess;
+}
+
+function maestro_orchestrator() {
+  $maestro = Maestro::createMaestroObject(1);
+  $maestro->engine()->cleanQueue();
+}
+
+function template_preprocess_maestro_taskconsole(&$variables) {
+  global $base_url;
+
+  $variables['ajax_server_url'] = url('maestro/taskconsole/ajax');
+  $maestro_path = $base_url . '/' . drupal_get_path('module', 'maestro');
+  $variables['module_base_url'] = $maestro_path;
+  $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+  $objtasks = $maestro->engine()->getQueue();
+  $variables['taskcount'] = $maestro->engine()->getUserTaskCount();
+  $variables['formatted_tasks'] = array();
+
+  drupal_add_js($maestro_path . '/js/taskconsole.js');
+
+  if (is_array($objtasks) AND count($objtasks) > 0) {
+    $rowid = 1;
+    foreach ($objtasks as $task) {
+      $formatted_task = $task;
+      $formatted_task->class_newtask = 'maestroNewTask';
+      $formatted_task->hidetaskinfo = 'none';
+      $formatted_task->onholdnotice = '';
+      $formatted_task->task_action_url = '#';  //we let the interactive tasks override this later if need be.
+
+      if ($task->dates['started'] > 0) {
+        $formatted_task->task_started = ', Started: ' . format_date($task->dates['started'],'short');
+        $formatted_task->task_icon = $maestro_path . '/images/taskconsole/task.gif';
+      } else {
+        $formatted_task->task_started = '';
+        $formatted_task->task_icon = $maestro_path . '/images/taskconsole/new_task.gif';
+      }
+      $formatted_task->assigned_shortdate = format_date($task->dates['created'],'custom','m/d/y');
+      $formatted_task->assigned_longdate = format_date($task->dates['created'],'medium');
+      $formatted_task->project_details = '';
+
+      // Determine if this task is for a regenerated workflow and we need to update the main project/request record
+      if ($formatted_task->regen) {
+        $formatted_task->taskname = '<div style="color:red;padding-right:5px;display:inline;">[R]</div>' . $formatted_task->taskname;
+      }
+
+      if ($task->flags['is_interactive'] == 1) {
+        $current_task = new $task->tasktype($task);  //fire up the engine task here to let us re-use its methods to create task console output.
+        $formatted_task->task_action_url = $current_task->getTaskConsoleURL();  //here is where we override the action url.
+        $action_record = $maestro->engine()->showInteractiveTask($current_task,$task->queue_id);
+        if ($action_record === FALSE OR empty($action_record)) {
+          $formatted_task->action_record = '';
+        } else {
+          $formatted_task->action_record = $action_record;
+        }
+      } else {
+        $formatted_task->action_record = '';
+      }
+
+      // Show the extra task detail 'onhover info' if this is a project related task
+      $formatted_task->showmoretaskdetail = 'none';
+      $formatted_task->description = 'yada yada';
+      $formatted_task->comment_note = 'yada yada';
+
+      $variables['rowid'] = $rowid;
+      $variables['formatted_tasks'][] = $formatted_task;
+      $rowid++;
+    }
+    $variables['details_icon'] = '<img src="' . $maestro_path . '/images/taskconsole/details.png' . '">';
+
+  }
+
+  $res = db_query("SELECT id, template_name FROM {maestro_template}");
+  $options = array('' => t('Select Workflow'));
+  foreach ($res as $rec) {
+    $options[$rec->id] = t($rec->template_name);
+  }
+   $variables['process_dropdown']=$options;
+
+}
+
+
+
+function template_preprocess_maestro_taskconsole_details(&$variables) {
+  global $base_url,$user;
+
+  $task = $variables['task'];
+  $variables['base_url'] = $base_url;
+  $variables['module_base_url'] = $base_url . '/' . drupal_get_path('module', 'maestro');
+  $variables['hiderequestlink'] = 'none';
+  $variables['project_link'] = '';
+
+  $variables['tracking_id'] =  $task->tracking_id;
+  $variables['flow_description'] = $task->flow_name;
+  $variables['custom_workflow_summary'] = '';
+
+  if (user_access('maestro reassign tasks')) {
+    $variables['workflow_admin'] = TRUE;
+    $variables['show_otaskaction'] = '';
+  } else {
+    $variables['workflow_admin'] = FALSE;
+    $variables['show_otaskaction'] = 'none';
+  }
+
+  $projectRec = db_select('maestro_projects','a')
+  ->fields('a',array('project_num','originator_uid','description','status','prev_status','related_processes'))
+  ->condition('id', $task->tracking_id, '=')
+  ->execute()->fetchObject();
+
+  $variables['project_status'] = MaestroProjectStatusCodes::getStatusLabel($projectRec->status);
+
+  /* @TODO: Would like to make this extensible so that other project status options can in the future add their own
+   * Action form and AJAX handler to perform custom actions on the overall project workflow instance.
+   *
+   * Initially we need to have a 'delete project' action
+   */
+  $variables['special_status_action'] = '';
+
+  if (user_access('maestro admin')) {
+    $variables['delete_project_action'] = '<a href="#" onClick="maestro_ajaxDeleteProject(' . $task->tracking_id . ');return false;">' . t('Delete Project') . '</a>';
+  } else {
+    $variables['delete_project_action'] = '';
+  }
+
+  $variables['completed_tasks'] = maestro_getProjectTasksHistory($task->tracking_id);
+
+  /* Format Outstanding Tasks Object to be used in the template */
+  $arr_otasks = array();  // Array of outstanding task objects
+  $query = db_select('maestro_process','process');
+  $query->join('maestro_queue', 'queue', 'queue.process_id = process.id');
+  $query->join('maestro_template_data', 'template', 'queue.template_data_id = template.id');
+  $query->join('maestro_production_assignments', 'assignment', 'assignment.task_id = queue.id');
+  $query->join('users', 'user', 'user.uid = assignment.uid');
+  $query->fields('queue', array('process_id','created_date','started_date','completed_date','status'));
+  $query->fields('template', array('taskname','is_dynamic_taskname','dynamic_taskname_variable_id'));
+  $query->fields('assignment', array('uid','process_variable'));
+  $query->addField('queue','id','queue_id');
+  $query->addField('user','name','username');
+  $query->addField('process','pid','parent_process_id');
+  $query->addField('process','tracking_id','tracking_id');
+  $query->condition('process.tracking_id', $task->tracking_id, '=');
+  $query->condition('queue.status',0,'=');
+  $query->condition('queue.show_in_detail',1,'=');
+  $res = $query->execute();
+  foreach ($res as $record) {
+    $otask = new stdClass();
+    $otask->assigned_date = strftime("%b %d/%Y %H:%M",$record->created_date);
+    $otask->task_id = $record->queue_id;
+    if ($record->parent_process_id > 0) $record->taskname = '<span style="color:red;padding-right:3px;">[R]</span>' . $record->taskname;
+    $otask->taskname = $record->taskname;
+    $otask->taskuser = $record->uid;
+    $otask->owner = $record->username;
+    $otask->variable_id = $record->process_variable;
+    if ($otask->variable_id > 0) {
+      $otask->taskassign_mode = 'variable';
+    } else {
+      $otask->taskassign_mode = 'user';
+    }
+    $variables['outstanding_tasks'][] = $otask;
+  }
+
+  $res = db_select('users','users')
+  ->fields('users', array('uid','name'))
+  ->condition('uid', 0, '>')
+  ->execute();
+  foreach ($res as $rec) {
+    $variables['reassign_user_options'][$rec->uid] = $rec->name;
+  }
+
+  /* For each task - check and see if they have any formatted content to display */
+  $variables['content_records'] = array();
+  $query = db_select('maestro_process','process');
+  $query->join('maestro_queue', 'queue', 'queue.process_id = process.id');
+  $query->fields('queue', array('id','process_id','template_data_id','task_class_name'));
+  $query->addField('queue','id','queue_id');
+  $query->condition('process.tracking_id', $task->tracking_id, '=');
+  $res = $query->execute();
+  $uniqueTasks = array();
+  foreach ($res as $taskrec) {
+    // Only need to call this task method once for each template task step - added in case of regen instances
+    if(!in_array($taskrec->template_data_id,$uniqueTasks)) {
+      $uniqueTasks[] = $taskrec->template_data_id;
+      $current_task = new $taskrec->task_class_name();
+      $taskContent = $current_task->showContentDetail($task->tracking_id,$taskrec->id);
+      if (!empty($taskContent)) {
+        $variables['content_records'][] = $taskContent;
+      }
+    }
+  }
+
+}
+
+
+function template_preprocess_maestro_project_comments(&$variables) {
+  global $base_url, $user;
+
+  $maestro_path = $base_url . '/' . drupal_get_path('module', 'maestro');
+  $variables['module_base_url'] = $maestro_path;
+
+  /* Format any project comments records */
+  $variables['comment_records'] = array();
+  $query = db_select('maestro_project_comments','a');
+  $query->fields('a',array('id','uid','timestamp','comment'));
+  $query->join('users','b','b.uid = a.uid');
+  $query->addField('b','name','username');
+  $query->condition('a.tracking_id',$variables['tracking_id'],'=');
+  $res = $query->execute();
+  foreach ($res as $record) {
+    if (isset($record->task_id) AND $record->task_id > 0) {
+    $query = db_select('maestro_queue','a');
+    $query->join('maestro_template_data','b','b.id = a.template_data_id');
+    $query->addField('b','taskname','taskname');
+    $query->condition('a.id',$record->task_id,'=');
+    $record->taskname = $query->execute()->fetchField();
+    } else {
+      $record->taskname = t('N/A');
+    }
+    $record->date = strftime("%b %d/%Y %H:%M",$record->timestamp);
+    if ($record->uid == $user->uid OR user_access('maestro admin')) {
+      $record->show_delete = 'visible';
+    } else {
+      $record->show_delete = 'hidden';
+    }
+    $variables['comment_records'][] = $record;
+  }
+
+}
+
+function template_preprocess_maestro_workflow_edit(&$variables) {
+  global $base_url;
+  $mi = new MaestroInterface($variables['tid']);
+
+  $variables['additional_js'] = $mi->initializeJavascriptArrays();
+  $variables['ajax_url'] = url('admin/structure/maestro/ajax/');
+}
+
+function template_preprocess_maestro_workflow_list(&$variables) {
+  $query = db_select('maestro_template', 'a');
+  $query->addExpression('COUNT(a.id)','templateCount');
+  $queryNumRows = $query->countQuery()->execute()->fetchField();
+  $variables['num_records'] = intval($queryNumRows);
+  $output="";
+
+  $res = db_query("SELECT id, template_name FROM {maestro_template}");
+  $cntr=0;
+  foreach ($res as $rec) {
+    $output .= theme('maestro_workflow_list_item', array( 'rec' => $rec,
+                                                          'cntr' => $cntr,
+                                                          'operation' => $variables['operation'],
+                                                          'tid' => $variables['tid'],
+                                                          'edit_var' => $variables['edit_var']
+    ));
+    $cntr++;
+  }
+
+  $variables['workflow_list'] = $output;
+  $variables['error_message'] = '';
+  $variables['ajax_url']=url('admin/structure/maestro/structure_ajax');
+  //app group listing:
+  $variables['app_groups'] = maestro_createAppGroupDropDown('deleteAppGroup');
+}
+
+function template_preprocess_maestro_workflow_list_item(&$variables) {
+  global $base_url;
+  $output="";
+  $variables['show_export_item'] = 'none';
+  $variables['export_content'] = '';
+  $variables['template_app_groups'] = "";
+  $variables['module_path']=$base_url . "/" . drupal_get_path('module', 'maestro');
+  if ($variables['operation'] == 'edit' && $variables['tid'] ==  $variables['rec']->id ) {  //only show this when we're editing a specific template.
+    $variables['show_item'] = '';
+    $output=theme('maestro_workflow_edit_template_variables',  array('tid' => $variables['tid'], 'edit_var' => $variables['edit_var'] , 'cntr' => $variables['cntr']));
+    $query = db_select('maestro_template', 'a');
+    $query->fields('a',array('template_name','app_group'));
+    $query->condition('a.id',$variables['tid'],'=');
+    $res=current($query->execute()->fetchAll());
+    $variables['template_app_groups'] = maestro_createAppGroupDropDown('appGroup', $res->app_group);
+  }
+  elseif ($variables['operation'] == 'export_template' && $variables['tid'] ==  $variables['rec']->id ) { //only show this when we're exporting a specific template
+    $variables['show_item'] = 'none';
+    $variables['export_content'] = maestro_export($variables['tid']);
+    $variables['show_export_item'] = '';
+  }
+  else {
+    $variables['show_item'] = 'none';
+  }
+  $variables['template_variables'] = $output;
+
+}
+
+
+
+function template_preprocess_maestro_workflow_edit_template_variables(&$variables) {
+  global $base_url;
+  $variables['module_path']=$base_url . "/" . drupal_get_path('module', 'maestro');
+  $output="";
+  $res = db_query("SELECT id, variable_name, variable_value FROM {maestro_template_variables} WHERE template_id=:tid", array('tid' => $variables['tid']));
+  foreach ($res as $rec) {
+    $output .= theme('maestro_workflow_edit_template_variables_list', array( 'var_id' => $rec->id,
+                                                                        'tid' => $variables['tid'],
+                                                                        'variable_name' => $rec->variable_name,
+                                                                        'variable_value' => $rec->variable_value,
+                                                                        'edit_var' => $variables['edit_var'],
+                                                                        'cntr' => $variables['cntr']
+    ));
+  }
+  $variables['template_variables'] = $output;
+}
+
+function template_preprocess_maestro_workflow_edit_template_variables_list(&$variables) {
+  global $base_url;
+  $variables['module_path' ] = $base_url . "/" . drupal_get_path('module', 'maestro');
+  if($variables['var_id'] == $variables['edit_var']) {
+    $variables['show_variable_actions'] = 'none';
+    $variables['show_variable_edit_actions'] = '';
+  }
+  else {
+    $variables['show_variable_actions'] = '';
+    $variables['show_variable_edit_actions'] = 'none';
+  }
+
+}
+
+
+function maestro_createAppGroupDropDown($name, $selected = 0){
+  $res = db_query("SELECT id, app_group FROM {maestro_app_groups}");
+  $output = "<select class='form-select' id='{$name}' name='{$name}' size='4' >";
+  $output .= "<option value='0'>" . t('N/A') . "</option>";
+  foreach ($res as $rec) {
+    $sel = "";
+    if($selected == $rec->id) $sel = " selected ";
+    $output .= "<option value='{$rec->id}' {$sel}>{$rec->app_group}</option>";
+  }
+  $output .= "</select>";
+  return $output;
+}
+
+/* Any other maestro task type modules will also implement this function
+ * For the core task types that we implement as part of maestro
+ * we need to describe them in this function
+ *
+ * This information is used by the maestro UI (interface) presently
+ * to get contextMenu options and handler options.
+ */
+function maestro_maestro_get_taskobject_info() {
+  $options = array(
+    array('display_name' => t('And Task'),
+      'class_name' => 'MaestroTaskInterfaceAnd'
+    ),
+    array('display_name' => t('If Task'),
+      'class_name' => 'MaestroTaskInterfaceIf'
+    ),
+    array('display_name' => t('Batch Task'),
+      'class_name' => 'MaestroTaskInterfaceBatch'
+    ),
+    array('display_name' => t('Batch Function Task'),
+      'class_name' => 'MaestroTaskInterfaceBatchFunction'
+    ),
+    array('display_name' => t('Interactive Function Task'),
+      'class_name' => 'MaestroTaskInterfaceInteractiveFunction'
+    ),
+    array('display_name' => t('Set Process Variable Task'),
+      'class_name' => 'MaestroTaskInterfaceSetProcessVariable'
+    ),
+    array('display_name' => t('Manual Web Task'),
+      'class_name' => 'MaestroTaskInterfaceManualWeb'
+    ),
+    array('display_name' => t('Content Type Task'),
+      'class_name' => 'MaestroTaskInterfaceContentType'
+    ),
+    array('display_name' => t('Fire Trigger Task'),
+      'class_name' => 'MaestroTaskInterfaceFireTrigger'
+    ),
+  );
+  return $options;
+}
+
+
+function maestro_maestro_handler_options() {
+
+  $handlers = array(
+    'MaestroTaskTypeBatchFunction' => array(
+      'maestro_test_batch_function' => t('Sample test batch function - do nothing.')
+    )
+  );
+  return $handlers;
+}
+
+/**
+* @desc Implements HOOK_maestro_set_process_variable_methods.
+*       The return must be an array structure as follows:
+*       array (
+*         'set_method_name' => array (    //a unique name for your set method
+*           'title' => t('Title'),        //the title which will show up when you edit the set process variable task
+*           'engine_handler' => 'maestro_set_process_variable_handler'    //the function that gets called which returns
+*         )                                                               //the value to set the process variable to.
+*       );
+*/
+function maestro_maestro_set_process_variable_methods() {
+  return array(
+    'hardcoded_value' => array (
+      'title' => t('Hardcoded Value'),
+      'engine_handler' => 'maestro_set_process_variable_logic_hardcoded'
+    ),
+    'increment_value' => array (
+      'title' => t('Add or Subtract a Value') . '<br>' . t('(negative number for subtraction)'),
+      'engine_handler' => 'maestro_set_process_variable_logic_increment'
+    ),
+    'maestro_content_type_task' => array (
+      'title' => t('Content Field Result'),
+      'engine_handler' => 'content_type_task_maestro_set_process_variable_logic'
+    ),
+  );
+}
+
+
+/**
+ *@desc the following are functions that set_process_variable() calls to
+ *      get the value to set the process variable to.
+ */
+function maestro_set_process_variable_logic_hardcoded(&$task_class, $current_value, $arg) {
+  return $arg;
+}
+
+function maestro_set_process_variable_logic_increment(&$task_class, $current_value, $arg) {
+  return intval($current_value) + intval($arg);
+}
+
+function content_type_task_maestro_set_process_variable_logic(&$task, $current_value, $arg) {
+  $args = explode(':', $arg);  //$args[0] = content type, $arg[1] = field name
+  if (empty($args[0]) OR empty($args[1])) {
+    return FALSE;
+  }
+
+  $content_type = $args[0];
+  $field_name = $args[1];
+
+  // Retrieve the tracking_id for the workflow instance
+  // Use the tracking_id to get the Node id for the content record of type $content_type
+  $tracking_id = maestro_getTaskTrackingId($task->_properties->id);
+  $query = db_select('maestro_project_content','content');
+  $query->addField('content','nid');
+  $query->condition('content.tracking_id',$tracking_id,'=');
+  $query->condition('content.instance',1,'=');
+  $query->condition('content.content_type',$content_type,'=');
+  $nid = $query->execute()->fetchField();
+  if (empty($nid)) {
+    return FALSE;
+  }
+
+  $node = node_load($nid);
+
+  if ($field_name == 'title') {  // Unlikely but title is not implemented as a field - still in the node table
+    return $node->title;
+  }
+
+  $field_info = field_info_field($field_name);
+
+  /* Need to assume the first element in the field definition maps to the field value but this could be dangerous
+   * Does not appear to be another way to return just the field value
+   * Tried field_view_value but that returns a formatted array that may not even contain the value - could be a link for display
+   */
+  $field_data_column = key($field_info['columns']);
+  $node_entity = entity_load('node',array($nid));
+  $data = field_view_field('node',$node_entity[$nid],$field_name);
+  $retval = $data['#items'][0][$field_data_column];
+
+  return $retval;
+
+}
+
+
+function maestro_handle_taskconsole_ajax_request($action, $queue_id = 0) {
+  global $user;
+
+  switch ($action) {
+    case 'starttask':
+      $startedDate = db_query("SELECT started_date FROM {maestro_queue} WHERE id = :tid",
+      array(':tid' => $_POST['taskid']))->fetchField();
+      if ($startedDate == NULL or $startedDate <= 0) {
+        db_update('maestro_queue')
+        ->fields(array('started_date' => time()))
+        ->condition('id', $_POST['taskid'], '=')
+        ->execute();
+      }
+      break;
+
+    case 'newprocess':
+      $tid = intval($_POST['templateid']);
+      $pid = maestro_launch_workflow($tid);
+      $retdata = array ('status' => "1", 'processid' => $pid);
+      echo json_encode($retdata);
+      break;
+
+    case 'setassignment':
+      if (user_access('maestro reassign tasks')) {
+        $taskid = intval($_POST['taskid']);
+        $process_id = db_query("SELECT process_id FROM {maestro_queue} WHERE id = :tid",
+        array(':tid' => $taskid))->fetchField();
+        $task_data_id = db_query("SELECT template_data_id FROM {maestro_queue} WHERE id = :tid",
+        array(':tid' => $taskid))->fetchField();
+        $tracking_id = db_query("SELECT tracking_id FROM {maestro_process} WHERE id = :pid",
+        array(':pid' => $process_id))->fetchField();
+        $assigned_uid = db_query("SELECT uid FROM {maestro_production_assignments} WHERE task_id = :tid",
+        array(':tid' => $taskid))->fetchField();
+        $maestro = Maestro::createMaestroObject(1);
+        if ($assigned_uid != $_POST['task_reassign_uid']) {
+          $maestro->engine()->reassignTask($taskid,$_POST['task_reassign_uid'],$_POST['taskuser'],$_POST['variable_id']);
+        }
+        $retdata = array ('status' => TRUE);
+      } else {
+        $retdata = array ('status' => FALSE);
+      }
+      echo json_encode($retdata);
+      break;
+
+    case 'interactivetask_post':
+      $queue_id = intval($_POST['queueid']);
+      $taskop = CHECK_PLAIN($_POST['op']);
+      if ($queue_id > 0) {
+        $rec = db_select('maestro_queue')
+        ->fields('maestro_queue', array('task_class_name','process_id'))
+        ->condition('id', $queue_id, '=')
+        ->execute()->fetchObject();
+        $tasktype = $rec->task_class_name;
+        $data = new stdClass();
+        // Need to pass in data object when instantiating task class and queueid needs to be set in class _properties.
+        $data->process_id = $rec->process_id;
+        $data->queue_id = $queue_id;
+        $task = new $tasktype($data);
+        $ret = $task->processInteractiveTask($queue_id,$taskop);
+        if ($ret->retcode === TRUE) {
+          if ($ret->engineop == 'completetask') {
+            if (!isset($ret->status)) $ret->status = 1;    // Just in case interactive function has not set this - set to default 'success'
+            $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+            $maestro->engine()->completeTask($queue_id,$ret->status);
+            $retdata = array('status' => TRUE, 'hidetask' => TRUE);
+          } else {
+            $retdata = array('status' => TRUE, 'hidetask' => FALSE);
+          }
+        } else{
+          $retdata = array('status' => FALSE, 'hidetask' => FALSE);
+        }
+      } else {
+        $retdata = array('status' => FALSE, 'hidetask' => FALSE);
+      }
+      echo json_encode($retdata);
+      break;
+
+    case 'complete_task':
+      //We require the queueID to be passed back to us in the URL
+      $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+      $queue_id = intval($queue_id);
+      $maestro->engine()->completeTask($queue_id);
+      $retdata = array ('status' => "1");
+      echo json_encode($retdata);
+      break;
+
+    case 'deleteproject':
+      $tracking_id = intval($_POST['tracking_id']);
+      $retdata = array ('status' => "1");
+      echo json_encode($retdata);
+      break;
+
+    case 'add_comment':
+      if (!empty($_POST['comment'])) {
+        db_insert('maestro_project_comments')
+        ->fields(array('tracking_id','uid','task_id','timestamp','comment'))
+        ->values(array(
+                'tracking_id' => $_POST['tracking_id'],
+                'uid' => $user->uid,
+                'task_id' => 0,
+                'timestamp' => time(),
+                'comment'  => $_POST['comment']
+        ))
+        ->execute();
+        $rowid = intval($_POST['rowid']);
+        $html = theme('maestro_project_comments',array('rowid' => $rowid, 'tracking_id' => $_POST['tracking_id']));
+        $retdata = array ('html' => $html,'status' => "1");
+      } else {
+        $retdata = array ('status' => "1");
+      }
+      echo json_encode($retdata);
+      break;
+
+    case 'del_comment':
+      if ($_POST['cid'] > 0) {
+        $query = db_select('maestro_project_comments','a');
+        $query->addField('a','uid');
+        $query->condition('a.id',$_POST['cid'],'=');
+        $comment_owner = $query->execute()->fetchField();
+        if ($comment_owner == $user->uid OR user_access('maestro admin')) {
+          db_delete('maestro_project_comments')
+            ->condition('id',$_POST['cid'],'=')
+            ->execute();
+          $rowid = intval($_POST['rowid']);
+          $html = theme('maestro_project_comments',array('rowid' => $rowid, 'tracking_id' => $_POST['tracking_id']));
+          $retdata = array ('html' => $html,'status' => "1");
+        } else {
+          $retdata = array ('status' => "0");
+        }
+      } else {
+        $retdata = array ('status' => "0");
+      }
+      echo json_encode($retdata);
+      break;
+
+    case 'getdetails':
+      $task = new stdClass();
+      $task->tracking_id = maestro_getTaskTrackingId($_POST['taskid']);  // Retrieve the tracking_id from the taskid
+      $flowname = db_query("SELECT description FROM {maestro_projects} WHERE id = :id",
+        array(':id' => $task->tracking_id))->fetchField();
+      $task->flow_name = $flowname;
+      $rowid = intval($_POST['rowid']);
+      $html = theme('maestro_taskconsole_details',array('task' => $task, 'source' => 'mytasks', 'rowid' => $rowid ));
+
+      $retdata = array ('html' => $html,'status' => "1");
+      echo json_encode($retdata);
+      break;
+
+    case 'myflows':
+      $myflowfilter =  array('myflows' => true);
+    case 'filterprojects':
+      include('maestro.moderator.inc');
+      $filter = array(
+        'username' => check_plain($_POST['userNameFilter']),
+        'projectname' => check_plain($_POST['flowNameFilter'])
+        );
+      if(is_array($myflowfilter)) {  //this has to be an array.  otherwise, this is not a valid executable area for a non-regular user
+        $filter = array_merge($filter, $myflowfilter);
+      }
+      else {  //better check if the user should be here
+        if(!user_access('maestro admin')) {
+          $retdata = array ('html' => t('Illegal attempt on viewing flow data detected.'),'status' => "0");
+          echo json_encode($retdata);
+          exit(0);
+        }
+      }
+      $rows = maestro_get_all_flows_data($filter);
+      $ajax_url = url('maestro/taskconsole/ajax');
+      $retdata = array ('html' => theme('maestro_all_flows_display', array('ajax_url' => $ajax_url, 'database_result_set' => $rows)),'status' => "1");
+      echo json_encode($retdata);
+      break;
+
+    case 'getprojectdetails':
+      $task = new stdClass();
+      $task->tracking_id = intval($_POST['projectID']);
+      $flowname = db_query("SELECT description FROM {maestro_projects} WHERE id = :id",
+        array(':id' => $task->tracking_id))->fetchField();
+      $task->flow_name = $flowname;
+      $rowid = intval($_POST['projectID']);
+      $html = theme('maestro_taskconsole_details',array('task' => $task, 'source' => 'mytasks', 'rowid' => $rowid ));
+      $retdata = array ('html' => $html,'status' => "1");
+      echo json_encode($retdata);
+      break;
+  }
+
+}
+
+
+function maestro_form_alter(&$form, $form_state, $form_id) {
+  /* Determine if the cached list of content types being used by configured maestro workflow templates is setup. */
+  $maestro_content_types = cache_get('maestro_content_types');
+  if($maestro_content_types === FALSE) {  // if not set - scan templates for unique content types
+    $types = array();
+    $query = db_select('maestro_template_data','template_data');
+    $query->addField('template_data','task_data','task_data');
+    $query->condition('task_class_name', 'MaestroTaskTypeContentType', '=');
+    $res = $query->execute();
+    foreach ($res as $rec) {
+      $data = unserialize($rec->task_data);
+      if (!empty($data['content_type']) AND !in_array($data['content_type'],$types)) {
+        $types[] = $data['content_type'] . '_node_form';
+      }
+    }
+    cache_set('maestro_content_types', $types);
+    $maestro_content_types = $types;
+  }
+  else {
+    $maestro_content_types = ($maestro_content_types->data);
+  }
+
+  if (in_array($form_id,$maestro_content_types)) {
+    $request = urldecode(request_uri());
+    $requestParms = explode('/',$request);
+
+    $maestroIndex=-1;
+    foreach($requestParms as $index => $val) {
+      if($val == 'maestro') {
+        $maestroIndex = $index;
+        //removed the break, because we are looking for the last occurrance
+        //of 'maestro' in the requestParms.
+      }
+    }
+    if($maestroIndex >= 2 ) { //really only applies if your site is named maestro, ie localhost/maestro, but a valid index should be around 5
+      if (isset($requestParms[$maestroIndex]) AND $requestParms[$maestroIndex] == 'maestro' AND isset($requestParms[$maestroIndex + 1])) {
+        if ($requestParms[$maestroIndex + 1] == 'edit' AND intval($requestParms[$maestroIndex + 2] > 0)) {
+          $form['maestro_taskid'] = array(
+            '#value'  => intval($requestParms[$maestroIndex + 2]),
+            '#type'   => 'hidden',
+          );
+          // The extra option is added to the URL via MaestroTaskTypeContentType->getTaskConsoleURL()
+          // Clicking on a EDIT Form as a direct task - should complete the task on submit.
+          if (isset($requestParms[$maestroIndex + 3]) AND $requestParms[$maestroIndex + 3] == 'completeonsubmit') {
+            $form['maestro_completeonsubmit'] = array(
+              '#value'  => 1,
+              '#type'   => 'hidden',
+            );
+          }
+        }
+        else {
+          $form['maestro_taskid'] = array(
+            '#value'  => intval($requestParms[$maestroIndex + 1]),
+            '#type'   => 'hidden',
+          );
+        }
+        /** Overwrite the default node submission handler with our own.
+         * Had a real issue getting this to work as the available docs indicate
+         * $form['#submit'][] = 'maestro_content_form_submit';
+         * should work but the default node submit handler 'node_form_submit()' would always be used.
+         * Posted to rfay's blog: http://randyfay.com/node/66
+         * On IRC, DamZ recommended this syntax which works
+         */
+        $form['actions']['submit']['#submit'][] = 'maestro_content_form_submit';
+      }
+    }
+    else if (array_key_exists('complete form', $form_state) && array_key_exists('maestro_taskid', $form_state['complete form'])) {
+      /** If there is a get/post action called, such as when an attachment field's upload button is clicked,
+       * we need to re-add the fields to the form. so we check the form_state to see if the previous values
+       * there so that we know it is a maestro content type task form we are dealing with.
+       */
+      $form['actions']['submit']['#submit'][] = 'maestro_content_form_submit';
+      $form['maestro_taskid'] = array(
+        '#value'  => $form_state['complete form']['maestro_taskid']['#value'],
+        '#type'   => 'hidden',
+      );
+      if (array_key_exists('maestro_completeonsubmit', $form_state['complete form'])) {
+        $form['maestro_completeonsubmit'] = array(
+          '#value'  => $form_state['complete form']['maestro_completeonsubmit']['#value'],
+          '#type'   => 'hidden',
+        );
+      }
+    }
+  }
+}
+
+function maestro_node_insert($node) {
+  if (isset($node->maestro_taskid) AND $node->maestro_taskid > 0) {
+    $task_classname = db_query("SELECT task_class_name FROM {maestro_queue} WHERE id = :tid",
+    array(':tid' => $node->maestro_taskid))->fetchField();
+
+    $task = new $task_classname();
+    $task->processContent($node->maestro_taskid,'insert',$node);
+
+  }
+}
+
+/**
+ * Implements hook_node_update().
+ *
+ * Check if content_type is being updated via a maestro task
+ */
+function maestro_node_update($node) {
+  if (isset($node->maestro_taskid) AND $node->maestro_taskid > 0) {
+
+    // Extra form field set by maestro_form_alter if taskconsole task is a contentType task - Edit operation
+    // Inline tasks that prompt user to review/edit a node (contentType) may also redirect user to Edit but
+    // It's up to the interactiveFunction's code to complete that task.
+    // Usually after someone clicks on 'accept' or 'reject' in the custom interactiveFunctions inline action form.
+    if (isset($node->maestro_completeonsubmit) AND $node->maestro_completeonsubmit == 1) {
+
+      // Initiate the maestro workflow engine and complete the task
+      $maestro = Maestro::createMaestroObject(1);
+      $queue_id = intval($node->maestro_taskid);
+      $maestro->engine()->completeTask($node->maestro_taskid);
+    }
+  }
+
+}
+
+
+function maestro_content_form_submit($form, &$form_state) {
+  $form_state['redirect'] = 'maestro/taskconsole';
+}
+
+
+/* Helper function that interactive tasks can use
+ * for example to review/edit content that needs a node id
+ */
+function maestro_getNodeId($process_id,$content_type) {
+  $tracking_id = db_select('maestro_process')
+    ->fields('maestro_process', array('tracking_id'))
+    ->condition('id', $process_id, '=')
+    ->execute()->fetchField();
+  if ($tracking_id > 0) {
+    $nid = db_select('maestro_project_content')
+      ->fields('maestro_project_content', array('nid'))
+      ->condition('tracking_id', $tracking_id, '=')
+      ->condition('content_type', $content_type, '=')
+      ->execute()->fetchField();
+  }
+  if ($tracking_id > 0 AND $nid > 0) {
+    return $nid;
+  }
+  else {
+    return FALSE;
+  }
+}
+
+/* Helper function that retrieves the tracking_id for a specific queue task
+ */
+function maestro_getTaskTrackingId($taskid) {
+  $res = db_select('maestro_queue','a');
+  $res->join('maestro_process', 'b', 'a.process_id = b.id');
+  $res->fields('b',array('tracking_id'));
+  $res->condition('a.id', $taskid, '=');
+  $tracking_id = $res->execute()->fetchField();
+  if ($tracking_id > 0 ) {
+    return $tracking_id;
+  }
+  else {
+    return FALSE;
+  }
+}
+
+/* Retrieve the task history for a maestro project (all related workflow instances) */
+function maestro_getProjectTasksHistory($tracking_id) {
+
+  $query = db_select('maestro_process','process');
+  $query->join('maestro_queue', 'queue', 'queue.process_id = process.id');
+  $query->join('maestro_template_data', 'template', 'queue.template_data_id = template.id');
+  $query->join('users', 'users', 'users.uid = queue.uid');
+  $query->fields('queue', array('process_id','created_date','started_date','completed_date','status'));
+  $query->fields('template', array('taskname','is_dynamic_taskname','dynamic_taskname_variable_id'));
+  $query->addField('users','name','username');
+  $query->addField('users','uid');
+  $query->addField('queue','id','queue_id');
+  $query->addField('process','pid','parent_process_id');
+  $query->condition('process.tracking_id', $tracking_id, '=');
+  $query->condition('queue.show_in_detail',1,'=');
+  $query->condition(db_or()->condition('queue.completed_date',0,'>')->condition('queue.status',MaestroTaskStatusCodes::STATUS_ON_HOLD,'='));
+  $res = $query->execute();
+
+  $retval = array();
+  foreach ($res as $record) {
+    $ctask = new stdClass();
+    $ctask->assigned_date = strftime("%b %d/%Y %H:%M",$record->created_date);
+    $ctask->started_date = strftime("%b %d/%Y %H:%M",$record->started_date);
+    $ctask->completed_date = strftime("%b %d/%Y %H:%M",$record->completed_date);
+    $ctask->status = t('Completed');
+    if ($record->uid == 0) $record->username = t('Maestro');
+    if ($record->parent_process_id > 0) $record->taskname = '<span style="color:red;padding-right:3px;">[R]</span>' . $record->taskname;
+    $ctask->owner = $record->username;
+    $ctask->taskname = $record->taskname;
+    $retval[] = $ctask;
+  }
+
+  return $retval;
+}
+
+/*
+ * Implementation of hook_maestro_notification_observer found in the notifications class for Maestro
+ */
+
+function maestro_maestro_notification_observer() {
+  return array('MaestroEmailNotification','SAMPLEMaestroTwitterNotification', 'MaestroWatchDogNotification'); //MaestroEmailNotification is the name of the class used for email notifications
+}
+
+/*
+ * Implementation of hook_mail
+ */
+function maestro_mail($key, &$message, $params) {
+  include_once('maestro_notification.class.php');
+  $options = array(
+    'langcode' => $message['language']->language,
+  );
+
+  //@TODO:
+  //We need to distinguish between these keys and set the subject and body appropriately.
+  //For now, I will treat each type the same until we round this out.
+
+  switch ($key) {  //pick off the keys here to preprocess the emails
+    case MaestroNotificationTypes::ASSIGNMENT:
+    case MaestroNotificationTypes::REMINDER:
+    case MaestroNotificationTypes::COMPLETION:
+    case MaestroNotificationTypes::ESCALATION:
+      $message['subject'] = check_plain($params['subject']);
+      $message['body'][] = check_plain($params['message']);
+      break;
+  }
+}
+
+ /* Utility function used in the contructor to merge arrays and maintain keys
+  * Copy of example function found on php.net documentation page for array_merge
+  */
+function maestro_array_merge_keys($arr1, $arr2) {
+  if (is_array($arr2)) {
+    foreach($arr2 as $k=>$v) {
+      if (!array_key_exists($k, $arr1)) { //K DOESN'T EXISTS //
+        $arr1[$k] = $v;
+      }
+      else { // K EXISTS //
+        if (is_array($v)) { // K IS AN ARRAY //
+          $arr1[$k] = maestro_array_merge_keys($arr1[$k], $arr2[$k]);
+        }
+      }
+    }
+  }
+
+  return $arr1;
+}
+
+function maestro_array_add($arr1, $arr2) {
+  if (is_array($arr1) && is_array($arr2)) {
+    foreach ($arr2 as $k=>$v) {
+      $arr1[] = $v;
+    }
+  }
+
+  return $arr1;
+}
+
+function maestro_set_process_flow_name ($process_id, $new_flow_name) {
+  if($process_id >0 && $new_flow_name != '') {
+    db_update('maestro_process')
+            ->fields(array('flow_name' => $new_flow_name))
+            ->condition('id', $process_id, '=')
+            ->execute();
+    $query = db_select('maestro_process', 'a');
+    $query->fields('a', array('tracking_id'));
+    $query->condition('a.id', $process_id, "=");
+    $res = current($query->execute()->fetchAll());
+    $proj_id = intval($res->tracking_id);
+    db_update('maestro_projects')
+           ->fields(array('description' => $new_flow_name))
+           ->condition('id', $proj_id, '=')
+           ->execute();
+  }
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro.test b/sites/all/modules/maestro/maestro.test
new file mode 100644
index 0000000000000000000000000000000000000000..75ae5601981ab2279d7933870f9d9bb2e008cbdb
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.test
@@ -0,0 +1,109 @@
+<?php
+// $Id: maestro.test,v 1.4 2010/07/12 20:27:44 randy Exp $
+
+/**
+ * @file
+ * Tests for the Maestro module
+ */
+
+class MaestroTestInstance extends DrupalWebTestCase {
+  protected $admin_user;
+
+  protected $varID=0;
+  protected $varcount=0;
+
+  protected $appGroupID=0;
+  protected $appGroupCount=0;
+
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Test Maestro Instance functionality',
+      'description' => 'Test instantiating the Maestro objects.',
+      'group' => 'Maestro',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('maestro');
+    $this->admin_user = $this->drupalCreateUser(array( 'maestro admin'));
+  }
+
+  /**
+   * Test creating the Maestro singleton and ensuring that it is indeed a single instance.
+   */
+  function testCreatingMaestroInstance() {
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.class.php';
+    $this->drupalLogin($this->admin_user);
+    $v1=Maestro::createMaestroObject(1);
+    $v2=Maestro::createMaestroObject(1);
+    $exp=var_export($v1,true);
+    $exp2=var_export($v2,true);
+    $this->assertTrue($exp == $exp2, t('Maestro Instantiation is a singleton'));
+    $this->drupalLogout();
+  }
+
+
+  function testMaestroStructurePage() {
+    $this->drupalGet('admin/structure/maestro');
+    $this->assertResponse(403,t('Non admin user should not be able to access the Maestro Structure menu.'));
+    $this->drupalLogin($this->admin_user);
+    $this->drupalGet('admin/structure/maestro');
+    $this->assertResponse(200, t('Admin User can access the Maestro Structure Page.'));
+    $this->drupalLogout();
+  }
+
+  function testCreateMaestroTemplate() {
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.admin.inc';
+    $recID=0;
+    $recID=maestro_createNewTemplate('test new template');
+    $this->assertTrue($recID == 2,t('First new template must have an ID of 2.'),'Maestro');
+  }
+
+
+  function testCreateMaestroTemplateVariable() {
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.admin.inc';
+    $query = db_select('maestro_template_variables', 'a');
+    $query->addExpression('count(a.id)','cnt');
+    $query->condition('a.template_id',1,'=');
+    $cnt=current($query->execute()->fetchAll());
+    $this->varcount = $cnt->cnt;
+    $this->varID=maestro_createTemplateVariable(1,'test variable','5');
+    $this->assertTrue($this->varID > 0,t('New Variable must have an ID greater than 0. New ID:' . $this->varID),'Maestro');
+
+  }
+
+  function testDeleteMaestroTemplateVariable(){
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.admin.inc';
+    maestro_deleteTemplateVariable($this->varID);
+    $query = db_select('maestro_template_variables', 'a');
+    $query->addExpression('count(a.id)','cnt');
+    $query->condition('a.template_id',1,'=');
+    $cnt=current($query->execute()->fetchAll());
+    $this->assertTrue($cnt->cnt == $this->varcount,t('Deleting variable successful'),'Maestro');
+  }
+
+
+  function testCreateMaestroAppGroup() {
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.admin.inc';
+    $query = db_select('maestro_app_groups', 'a');
+    $query->addExpression('count(a.id)','cnt');
+    $cnt=current($query->execute()->fetchAll());
+    $this->appGroupCount = $cnt->cnt;
+    $this->appGroupID=maestro_createAppGroup('Test App Group');
+    $this->assertTrue($this->appGroupID > 0,t('New App Group must have an ID greater than 0. New ID:' . $this->appGroupID),'Maestro');
+
+  }
+
+  function testDeleteMaestroAppGroup(){
+    include_once './' . drupal_get_path('module', 'maestro') . '/maestro.admin.inc';
+    maestro_deleteAppGroup($this->appGroupID);
+    $query = db_select('maestro_app_groups', 'a');
+    $query->addExpression('count(a.id)','cnt');
+    $cnt=current($query->execute()->fetchAll());
+    $this->assertTrue($cnt->cnt == $this->appGroupCount,t('Deleting App Group successful'),'Maestro');
+  }
+
+}
+
+
diff --git a/sites/all/modules/maestro/maestro.views.inc b/sites/all/modules/maestro/maestro.views.inc
new file mode 100644
index 0000000000000000000000000000000000000000..37d7bef7c70b024ad7da74fb0697d5b01ed72582
--- /dev/null
+++ b/sites/all/modules/maestro/maestro.views.inc
@@ -0,0 +1,391 @@
+<?php
+
+// $Id:
+
+/**
+ * @file
+ * maestro.views.inc
+ * Contains all Views related API calls and default view creation information
+ */
+
+/**
+ * Implementation of hook_views_api().
+*/
+function maestro_views_api() {
+  return array(
+    'api' => 2.0,
+  );
+}
+
+
+
+function maestro_views_data() {
+  $data = array();
+  $data['maestro_queue']['table']['group']  = t('Maestro Queue');
+  $data['maestro_template_data']['table']['group']  = t('Maestro Template Data');
+  $data['maestro_template']['table']['group']  = t('Maestro Template');
+  $data['maestro_production_assignments']['table']['group']  = t('Maestro Assignments');
+
+   //table definitions
+
+  //template
+  $data['maestro_template']['table']['base'] = array(
+    'field' => 'id',
+    'title' => t('Maestro Template'),
+    'help' => t("Stores all master template records."),
+    'weight' => -13,
+  );
+
+  $data['maestro_template']['table']['join']['maestro_queue'] = array(  //this one allows the template data fields to be available in the queue table view
+      'left_table' => 'maestro_template_data',
+      'left_field' => 'template_id',
+      'field' => 'id',
+  );
+
+
+
+  //template data
+  $data['maestro_template_data']['table']['base'] = array(
+    'field' => 'id',
+    'title' => t('Maestro Template Data'),
+    'help' => t("Holds all of the Templated tasks."),
+    'weight' => -10,
+  );
+
+  $data['maestro_template_data']['table']['join'] = array(  //this one allows the template data fields to be available in the queue table view
+    'maestro_queue' => array(
+      'left_field' => 'template_data_id',
+      'field' => 'id',
+    ),
+  );
+
+
+  //queue
+  $data['maestro_queue']['table']['base'] = array(
+    'field' => 'id',
+    'title' => t('Maestro Queue'),
+    'help' => t("Queue holds all of the production data for tasks."),
+    'weight' => -11,
+  );
+
+  $data['users']['table']['join'] = array(  //telling the users table that we're joined to it by uid
+    'maestro_queue' => array(
+      'left_field' => 'uid',
+      'field' => 'uid',
+    ),
+  );
+
+  //production assignments
+  $data['maestro_production_assignments']['table']['base'] = array(
+    'field' => 'id',
+    'title' => t('Maestro Production Assignments'),
+    'help' => t("Maestro's store for production assignments."),
+    'weight' => -12,
+  );
+
+  $data['maestro_production_assignments']['table']['join'] = array(  //telling the queue table that we're joined to it by taskID
+    'maestro_queue' => array(
+      'left_field' => 'id',
+      'field' => 'task_id',
+    ),
+  );
+
+
+  //*****Field definitions******
+  $data['maestro_template']['template_name'] = array(
+    'title' => t('Template Name'),
+    'help' => t('Name of the Template'),
+    'field' => array(
+      'click sortable' => TRUE,
+    ),
+  );
+
+  $data['maestro_template_data']['taskname'] = array(
+    'title' => t('Task Name'),
+    'help' => t('A Reference to the template data table.'),
+    'field' => array(
+      //'handler' =>
+      'click sortable' => TRUE,
+    ),
+  );
+
+  $data['maestro_queue']['assigned_users'] = array(
+    'real field' => 'id',
+    'title' => t('Assigned Users'),
+    'help' => t('All of the assigned users'),
+    'field' => array (
+      'handler' => 'views_handler_field_maestro_assigned_users',
+      'click sortable' => TRUE,
+    ),
+  );
+
+  $data['maestro_queue']['template_data_id'] = array(
+    'title' => t('Template Data ID'),
+    'help' => t('A Reference to the template data table.'),
+    'field' => array (
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+  );
+
+  //INT fields here:
+  $data['maestro_queue']['process_id'] = array (
+    'title' => t('Process ID'),
+    'help'  => t('Unique Process Identifier.'),
+    'field' => array (
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  $data['maestro_queue']['engine_version'] = array (
+    'title' => t('Engine Version'),
+    'help'  => t('Version of the engine used to run this task.'),
+    'field' => array (
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  $data['maestro_queue']['is_interactive'] = array (
+    'title' => t('Interactive Flag'),
+    'help'  => t('Set to 1 for interactive. 0 for non-interactive.'),
+    'field' => array (
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+    $data['maestro_queue']['status'] = array (
+    'title' => t('Status flag'),
+    'help'  => t('Textual Status flag.'),
+    'field' => array (
+      'handler' => 'views_handler_field_maestro_status',  //using a custom field handler
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  $data['maestro_queue']['uid'] = array (
+    'title' => t('Completed By'),
+    'help'  => t('The user who completed the task.'),
+    'field' => array (
+      'handler' => 'views_handler_field_maestro_uid',  //using a custom field handler
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+
+
+
+  return $data;
+}
+
+
+
+/**
+ * Field handler to display the Maestro Status
+ */
+class views_handler_field_maestro_status extends views_handler_field_numeric {
+
+  function render($values) {
+    global $base_path;
+    @include_once($base_path . drupal_get_path('module','maestro') . '/maestro_contatnts.class.php');
+    $value = $values->{$this->field_alias};
+    return MaestroTaskStatusCodes::getStatusLabel($value);
+  }
+}
+
+/**
+ * Field handler to display the Completed User
+ */
+class views_handler_field_maestro_uid extends views_handler_field_numeric {
+  function render($values) {
+    $value = $values->{$this->field_alias};
+    if ($value==0 && isset($value)) {
+      return 'Maestro';
+    }
+    elseif (!isset($value)) {
+      return t('Not yet completed');
+    }
+    else {
+      return $value;
+    }
+  }
+}
+
+
+/**
+ * Field handler to display the assigned users
+ */
+class views_handler_field_maestro_assigned_users extends views_handler_field_numeric {
+  function render($values) {
+    $value = $values->{$this->field_alias};
+    //return $value;
+    //@TODO:  need to fix this method once the OG/role ability is rolled out
+    $q = db_select('maestro_production_assignments', 'a');
+    $q->join('users', 'b', 'a.uid = b.uid');
+    $q->addField('a','uid');
+    $q->addField('b','mail');
+    $q->addField('b','name');
+    $q->condition('a.task_id',intval($value));
+    $res = $q->execute();
+    $output = "";
+    foreach($res as $record) {
+      if($output != '') $output .= "<br>";
+      $output .="{$record->name}";
+    }
+    if($output == '') {
+      $output = t('Maestro');
+    }
+    return $output;
+  }
+}
+/**
+ * Implements hook_views_default_views().
+ */
+function maestro_views_default_views() {
+  $view = new view;
+  $view->name = 'All Queue Tasks';
+  $view->description = 'Sample View to show off all in queue tasks';
+  $view->tag = 'maestro';
+  $view->view_php = '';
+  $view->base_table = 'maestro_queue';
+  $view->is_cacheable = FALSE;
+  $view->api_version = '3.0-alpha1';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->display->display_options['title'] = 'All Queue Tasks';
+  $handler->display->display_options['access']['type'] = 'none';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '50';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'process_id' => 'process_id',
+    'status' => 'status',
+    'taskname' => 'taskname',
+    'uid' => 'uid',
+    'template_name' => 'template_name',
+  );
+  $handler->display->display_options['style_options']['default'] = '-1';
+  $handler->display->display_options['style_options']['info'] = array(
+    'process_id' => array(
+      'sortable' => 1,
+      'align' => '',
+      'separator' => '',
+    ),
+    'status' => array(
+      'sortable' => 1,
+      'align' => '',
+      'separator' => '',
+    ),
+    'taskname' => array(
+      'sortable' => 1,
+      'align' => '',
+      'separator' => '',
+    ),
+    'uid' => array(
+      'sortable' => 1,
+      'align' => '',
+      'separator' => '',
+    ),
+    'template_name' => array(
+      'sortable' => 1,
+      'align' => '',
+      'separator' => '',
+    ),
+  );
+  $handler->display->display_options['style_options']['override'] = 1;
+  $handler->display->display_options['style_options']['sticky'] = 0;
+  /* Field: Maestro Queue: Process ID */
+  $handler->display->display_options['fields']['process_id']['id'] = 'process_id';
+  $handler->display->display_options['fields']['process_id']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['process_id']['field'] = 'process_id';
+  /* Field: Maestro Queue: Status flag */
+  $handler->display->display_options['fields']['status']['id'] = 'status';
+  $handler->display->display_options['fields']['status']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['status']['field'] = 'status';
+  /* Field: Maestro Template Data: Task Name */
+  $handler->display->display_options['fields']['taskname']['id'] = 'taskname';
+  $handler->display->display_options['fields']['taskname']['table'] = 'maestro_template_data';
+  $handler->display->display_options['fields']['taskname']['field'] = 'taskname';
+  /* Field: Maestro Queue: Completed By */
+  $handler->display->display_options['fields']['uid']['id'] = 'uid';
+  $handler->display->display_options['fields']['uid']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['uid']['field'] = 'uid';
+  /* Field: Maestro Template: Template Name */
+  $handler->display->display_options['fields']['template_name']['id'] = 'template_name';
+  $handler->display->display_options['fields']['template_name']['table'] = 'maestro_template';
+  $handler->display->display_options['fields']['template_name']['field'] = 'template_name';
+  /* Field: Maestro Queue: Assigned Users */
+  $handler->display->display_options['fields']['assigned_users']['id'] = 'assigned_users';
+  $handler->display->display_options['fields']['assigned_users']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['assigned_users']['field'] = 'assigned_users';
+
+  /* Display: All Queue Tasks */
+  $handler = $view->new_display('page', 'All Queue Tasks', 'all_queue_tasks');
+  $handler->display->display_options['defaults']['fields'] = FALSE;
+  /* Field: Maestro Queue: Process ID */
+  $handler->display->display_options['fields']['process_id']['id'] = 'process_id';
+  $handler->display->display_options['fields']['process_id']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['process_id']['field'] = 'process_id';
+  /* Field: Maestro Queue: Status flag */
+  $handler->display->display_options['fields']['status']['id'] = 'status';
+  $handler->display->display_options['fields']['status']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['status']['field'] = 'status';
+  /* Field: Maestro Template Data: Task Name */
+  $handler->display->display_options['fields']['taskname']['id'] = 'taskname';
+  $handler->display->display_options['fields']['taskname']['table'] = 'maestro_template_data';
+  $handler->display->display_options['fields']['taskname']['field'] = 'taskname';
+  /* Field: Maestro Queue: Completed By */
+  $handler->display->display_options['fields']['uid']['id'] = 'uid';
+  $handler->display->display_options['fields']['uid']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['uid']['field'] = 'uid';
+  /* Field: Maestro Template: Template Name */
+  $handler->display->display_options['fields']['template_name']['id'] = 'template_name';
+  $handler->display->display_options['fields']['template_name']['table'] = 'maestro_template';
+  $handler->display->display_options['fields']['template_name']['field'] = 'template_name';
+  /* Field: Maestro Queue: Assigned Users */
+  $handler->display->display_options['fields']['assigned_users']['id'] = 'assigned_users';
+  $handler->display->display_options['fields']['assigned_users']['table'] = 'maestro_queue';
+  $handler->display->display_options['fields']['assigned_users']['field'] = 'assigned_users';
+  $handler->display->display_options['path'] = 'all_queue_tasks';
+  $views[$view->name] = $view;
+  return $views;
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro_base_engine.class.php b/sites/all/modules/maestro/maestro_base_engine.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..e4da49e7391d125cfd5cae7f2884e1cd660b4c26
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_base_engine.class.php
@@ -0,0 +1,355 @@
+<?php
+
+  /* Using Drupal OO Coding Standards as described: http://drupal.org/node/608152 */
+include_once('maestro_constants.class.php');
+
+  abstract class MaestroEngine {
+//@TODO: Need to convert these to the proper public/protected variables.
+
+    var $_version                 = '';       // Current engine version
+    var $_processId               = NULL;     // Current Process the workflow engine is working on
+    var $_templateId              = NULL;     // Current workflow template id being processed
+    var $_queueId                 = NULL;     // Current Queue record id being processed. This is either null, a single item or a semi colon delimited list
+    var $_userId                  = NULL;     // Current User Id
+    var $_trackingId              = NULL;     // Workflow grouping Tracking Id to enable project or detail workflow tracking and link related workflows
+    var $_taskType                = '';
+    var $_debug                   = FALSE;    // Set the current debug level to false.
+    var $_userTaskCount           = 0;        // Number of tasks the user has in the queue
+    var $_userTaskObject          = NULL;     // Users Active Tasks in the queue
+    var $_templateCount           = 0;        // Number of templates the user is able to kick off
+    var $_processTaskCount        = 0;        // Number of tasks the current process has in the queue
+    var $_status                  = 0;        // Set in cleanQueue to indicate status of last executing task before calling nextStep method
+    var $_lastTestStatus          = 0;        // Used in nextStep when the task that last executed will branch to different tasks - like an IF task
+    var $_mode;
+    var $task                     = NULL;
+
+    function setMode($mode) { $this->_mode = $mode; }
+    function getMode() { return $this->_mode; }
+
+    // Simply sets the debug parameter.
+    function setDebug($debug) {
+        if ($debug) {
+            watchdog('maestro',"Set debug mode on");
+        }
+        $this->_debug = $debug;
+    }
+
+    public function setProcessId($id) {
+      if (intval($id) > 0) {
+        $this->_processId = $id;
+      }
+    }
+
+    /* If a valid tracking_id is passed in, set the class variable
+     * and update the process table's value for this process record.
+     * The tracking_id is so we can group related workflow instance information together,
+     * such as content_type node records, task history, comments and other data.
+     */
+    function setTrackingId($id) {
+      if (intval($id) > 0) {
+        $this->_trackingId = $id;
+        if ($this->_processId > 0) {
+          db_update('maestro_process')
+            ->fields(array('tracking_id' => $id))
+            ->condition('id', $this->_processId, '=')
+            ->execute();
+        }
+      }
+    }
+
+    /* Default will be to return the tracking_id that is set but if not set,
+     * then we may be asking for the tracking_id for another process ($pid)
+     * like a parent process - called this way in the newProcess code if we are
+     * regenerating the existing process and want to inherit the same tracking_id
+     * If no process_id is passed in, then test if $this->_processId is set and
+     * then look up in the process table for the tracking_id.
+     */
+    function getTrackingId($pid = 0) {
+      $retval = FALSE;
+      if ($this->_trackingId > 0) {
+        $retval = $this->_trackingId;
+      }
+      elseif ($pid == 0 AND $this->_processId > 0) {
+        $id = db_select('maestro_process')
+          ->fields('maestro_process', array('tracking_id'))
+          ->condition('id', $this->_processId, '=')
+          ->execute()->fetchField();
+        $retval = $id;
+      } elseif ($pid > 0) {
+        $id = db_select('maestro_process')
+          ->fields('maestro_process', array('tracking_id'))
+          ->condition('id', $pid, '=')
+          ->execute()->fetchField();
+        $retval = $id;
+      }
+      return $retval;
+    }
+
+    public function getUserTaskCount() {
+      return $this->_userTaskCount;
+    }
+
+    public function executeTask(MaestroTask $task) {
+       return $task->execute();
+    }
+
+    public function prepareTask(MaestroTask $task) {
+       return $task->prepareTask();
+    }
+
+    public function showInteractiveTask(MaestroTask $task,$taskid) {
+      /* Common HTML container with an ID set that we will hook onto to show/hide.
+       * This lets developer not have to worry about returning a table row with 5 columns
+       */
+      $prehtmlfragment = '<tr class="maestro_taskconsole_interactivetaskcontent" id="maestro_actionrec' . $taskid . '" style="display:none;"><td colspan="6">';
+      $posthtmlfragment = '</td></tr>';
+      $retval = $task->showInteractiveTask();
+      if ($retval === FALSE) {
+      	return '';
+      }
+      else if (empty($retval)) {
+        return $prehtmlfragment . t('empty interactive task - nothing to display for interactive function.') . $posthtmlfragment;
+      }
+      else {
+        return $prehtmlfragment . $retval . $posthtmlfragment;
+      }
+    }
+
+
+    // Get a process variable as defined for this template
+    // Requires the processID to be set and then pass in a variable's name.
+    // if both the process and the name exist, you get a value..
+    // otherwise, you get NULL
+    function getProcessVariable($variable, $process_id=0) {
+      $retval = NULL;
+      $thisvar = strtolower($variable);
+
+      if ($process_id == 0 && !empty($this->_processId)) {
+        $process_id = $this->_processId;
+      }
+      else if ($process_id == 0) {
+        if ($this->_debug ) {
+          watchdog('maestro',"get_ProcessVariable: The Process ID has not been set.");
+          return $retval;
+        }
+      }
+
+      $query = db_select('maestro_process_variables', 'a');
+      $query->addField('a','variable_value');
+      $query->join('maestro_template_variables', 'b', 'a.template_variable_id = b.id');
+      $query->condition('a.process_id',$process_id,'=');
+      $query->condition('b.variable_name',$thisvar,'=');
+      $result = $query->execute();
+      $numrows = $query->countQuery()->execute()->fetchField();
+      if ($numrows > 0 ) {
+        $record = $result->fetchObject();
+        $retval = $record->variable_value;
+        if ($this->_debug ) {
+          watchdog('maestro',"get_ProcessVariable: $variable -> $retval");
+        }
+      }
+      else {
+        if ($this->_debug ) {
+          watchdog('maestro',"get_processVariable -> Process:{$this->_processId}, variable:$variable - DOES NOT EXIST");
+        }
+      }
+
+      return $retval;
+    }
+
+
+    // Set a process variable as defined for this template
+    // Requires the processID to be set and then pass in a variable's name and value
+    // if both the process and the name exist, you get a value..
+    // otherwise, you get NULL
+    function setProcessVariable($variableName, $variableValue=0, $process_id=0) {
+      $retval = NULL;
+      $thisvar = strtolower($variableName);
+
+      if ($process_id == 0 && !empty($this->_processId)) {
+        $process_id = $this->_processId;
+      }
+      else if ($process_id == 0) {
+        if ($this->_debug ) {
+          watchdog('maestro',"get_ProcessVariable: The Process ID has not been set.");
+          return $retval;
+        }
+      }
+
+      // setting the value
+      $query = db_select('maestro_process_variables', 'a');
+      $query->addField('a','id','process_variable_id');
+      $query->addField('a','template_variable_id','variable_id');
+      $query->join('maestro_template_variables', 'b', 'a.template_variable_id = b.id');
+      $query->condition('a.process_id', $process_id, '=');
+      $query->condition('b.variable_name',$thisvar,'=');
+      $result = $query->execute();
+      $numrows = $query->countQuery()->execute()->fetchField();
+      if ($numrows > 0) {
+        $processVariableRecord = $result->fetchObject();
+        $count = db_update('maestro_process_variables')
+          ->fields(array('variable_value' => $variableValue))
+          ->condition('id', $processVariableRecord->process_variable_id, '=')
+          ->condition('process_id', $process_id, '=')
+          ->execute();
+        if ($this->_debug ) {
+            watchdog('maestro',"set_processVariable -> Process:{$process_id}, variable:$thisvar, value:$variableValue");
+        }
+        if ($count == 1) {
+            $retval = $variableValue;
+        }
+
+         // Now see if that process variable controlled assignment
+        if (isset($processVariableRecord->template_variable_id) AND $processVariableRecord->template_variable_id > 0) {
+          $query = db_select('maestro_queue', 'a');
+          $query->leftJoin('maestro_template_assignment', 'b', 'a.template_data_id=b.template_data_id');
+          $query->fields('a', array('id'));
+          $query->condition('b.assign_by', MaestroAssignmentBy::VARIABLE, '=');
+          $query->condition('b.assign_id', $processVariableRecord->template_variable_id, '=');
+          $res = $query->execute()->fetchAll();
+          $queueRecords = $query->execute();
+          foreach ($queueRecords as $queueRecord) {
+            $this->assignTask($queueRecord->id, array($processVariableRecord->variable_id => $variableValue));
+          }
+        }
+      }
+      else {
+        if ($this->_debug ) {
+          watchdog('maestro',"set_processVariable -> Process:{$process_id}, variable:$thisvar - DOES NOT EXIST");
+        }
+      }
+
+      return $retval;
+    }
+
+    function sendTaskAssignmentNotifications ($qid=0) {
+      include_once('maestro_notification.class.php');
+      if ($qid == 0) {
+        $qid = $this->_queueId;
+      }
+
+      $message = variable_get('maestro_assignment_message');
+      $subject = variable_get('maestro_assignment_subject');
+      $notification = new MaestroNotification($message, $subject, $qid, MaestroNotificationTypes::ASSIGNMENT);
+      $notification->notify();
+    }
+
+    function sendTaskCompletionNotifications ($qid=0) {
+      include_once('maestro_notification.class.php');
+      if ($qid == 0) {
+          $qid = $this->_queueId;
+      }
+
+      $message = variable_get('maestro_completion_message');
+      $subject = variable_get('maestro_completion_subject');
+      $notification = new MaestroNotification($message, $subject, $qid, MaestroNotificationTypes::COMPLETION);
+      $notification->notify();
+    }
+
+    function sendTaskReminderNotifications ($qid=0, $user_id=0) {
+      include_once('maestro_notification.class.php');
+      if ($qid == 0) {
+        $qid = $this->_queueId;
+      }
+
+      $message = variable_get('maestro_reminder_message');
+      $subject = variable_get('maestro_reminder_subject');
+      $notification = new MaestroNotification($message, $subject, $qid, MaestroNotificationTypes::REMINDER);
+
+      if($user_id != 0) {
+        $notification->setUserIDs($user_id);
+      }
+      $notification->notify();
+    }
+
+    function reassignTask($qid, $current_uid, $reassign_uid) {
+      if ($qid > 0 && $reassign_uid > 0) {
+        db_update('maestro_production_assignments')
+          ->fields(array('uid' => $reassign_uid, 'assign_back_uid' => $current_uid))
+          ->condition('task_id', $qid, '=')
+          ->condition('uid', $current_uid, '=')
+          ->execute();
+      }
+    }
+
+    function deleteTask($qid) {
+      if ($qid > 0) {
+        db_delete('maestro_production_assignments')
+          ->condition('task_id', $qid, '=')
+          ->execute();
+        db_update('maestro_queue')
+          ->fields(array('status' => MaestroTaskStatusCodes::STATUS_DELETED, 'archived' => 1))
+          ->condition('id', $qid, '=')
+          ->execute();
+      }
+    }
+
+    function getQueueHistory($initiating_pid) {
+      $query = db_select('maestro_queue', 'a');
+      $query->fields('a', array('id', 'process_id', 'status', 'archived', 'created_date', 'started_date', 'completed_date'));
+      $query->fields('c', array('taskname'));
+      $query->fields('d', array('name'));
+      $query->leftJoin('maestro_process', 'b', 'a.process_id=b.id');
+      $query->leftJoin('maestro_template_data', 'c', 'a.template_data_id=c.id');
+      $query->leftJoin('users', 'd', 'a.uid=d.uid');
+      $query->condition('b.initiating_pid', $initiating_pid, '=');
+      $query->orderBy('a.id', 'ASC');
+      $res = $query->execute();
+
+      $queue_history = array();
+      foreach ($res as $rec) {
+        if ($rec->archived != 1) {
+          $q2 = db_select('maestro_production_assignments', 'a');
+          $q2->fields('b', array('name'));
+          $q2->leftJoin('users', 'b', 'a.uid=b.uid');
+          $q2->condition('a.task_id', $rec->id, '=');
+          $res2 = $q2->execute();
+          $rec->username = '';
+          foreach ($res2 as $userRec) {
+            if ($rec->username != '') {
+              $rec->username .= ', ';
+            }
+            $rec->username .= $userRec->name;
+          }
+        }
+        else {
+          $rec->username = $rec->name;
+        }
+
+        $queue_history[] = $rec;
+      }
+
+      return $queue_history;
+    }
+
+    function getRelatedWorkflows($tracking_id) {
+      $query = db_select('maestro_process', 'a');
+      $query->fields('a', array('tracking_id', 'initiating_pid'));
+      $query->fields('b', array('template_name'));
+      $query->leftJoin('maestro_template', 'b', 'a.template_id=b.id');
+      $query->groupBy('a.initiating_pid');
+      $query->condition('a.tracking_id', $tracking_id, '=');
+
+      return $query->execute();
+    }
+
+    abstract function getVersion();
+
+    abstract function assignTask($queueId,$userObject);
+
+    abstract function getAssignedUID($queue_id=0);
+
+    abstract function completeTask($queueId,$status = 1);
+
+    abstract function archiveTask($queueId);
+
+    abstract function cancelTask($queueId);
+
+    /* Main method for the Maestro Workflow Engine. Query the queue table and determine if
+     * any items in the queue associated with a process are complete.
+     * If they are complete, its the job of this function to determine if there are any next steps and fill the queue.
+     */
+    abstract function cleanQueue();
+
+
+}
diff --git a/sites/all/modules/maestro/maestro_constants.class.php b/sites/all/modules/maestro/maestro_constants.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..624ef21e91c444543e6354cb9dc80a963aaf5cd6
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_constants.class.php
@@ -0,0 +1,151 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro_constants.class.php
+ *
+ * Description:  This file holds all of the classes used to define constants
+ *
+ */
+
+class MaestroNotificationTypes {
+  CONST ASSIGNMENT = 1;
+  CONST COMPLETION = 2;
+  CONST REMINDER = 3;
+  CONST ESCALATION = 4;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::ASSIGNMENT] = array('name' => 'ASSIGNMENT', 'label' => t('On Assignment'));
+    $labels[self::COMPLETION] = array('name' => 'COMPLETION', 'label' => t('On Completion'));
+    $labels[self::REMINDER] = array('name' => 'REMINDER', 'label' => t('Reminder'));
+    $labels[self::ESCALATION] = array('name' => 'ESCALATION', 'label' => t('Escalation'));
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+// The maestro Engine's clean queue will not pick up any status' less than 0
+class MaestroTaskStatusCodes {
+  CONST STATUS_DELETED = -2;
+  CONST STATUS_ON_HOLD = -1;
+  CONST STATUS_READY = 0;
+  CONST STATUS_COMPLETE = 1;
+  CONST STATUS_ABORTED = 2;
+  CONST STATUS_IF_CONDITION_FALSE = 3;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::STATUS_DELETED] = t('Deleted');
+    $labels[self::STATUS_ON_HOLD] = t('On Hold');
+    $labels[self::STATUS_READY] = t('Ready');
+    $labels[self::STATUS_COMPLETE] = t('Complete');
+    $labels[self::STATUS_ABORTED] = t('Aborted');
+    $labels[self::STATUS_IF_CONDITION_FALSE] = t('If Condition False');
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+
+}
+
+// Maestro Project or workflow instance entity status codes
+class MaestroProjectStatusCodes {
+  CONST STATUS_ON_HOLD = -1;
+  CONST STATUS_ACTIVE = 0;
+  CONST STATUS_COMPLETED = 1;
+  CONST STATUS_CANCELLED = 2;
+  CONST STATUS_REGENERATED = 3;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::STATUS_ON_HOLD] = t('On Hold');
+    $labels[self::STATUS_ACTIVE] = t('Active');
+    $labels[self::STATUS_COMPLETED] = t('Completed');
+    $labels[self::STATUS_CANCELLED] = t('Cancelled');
+    $labels[self::STATUS_REGENERATED] = t('Regenerated');
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+
+// Maestro Project or workflow instance entity status codes
+class MaestroContentStatusCodes {
+  CONST STATUS_UNDEFINED = 0;
+  CONST STATUS_SUBMITTED = 1;
+  CONST STATUS_DRAFT = 2;
+  CONST STATUS_UNAPPROVED = 3;
+  CONST STATUS_UNDER_REVIEW = 4;
+  CONST STATUS_ACCEPTED = 10;
+  CONST STATUS_PUBLISHED = 11;
+  CONST STATUS_REJECTED = 20;
+
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::STATUS_UNDEFINED] = t('Un-Defined');
+    $labels[self::STATUS_SUBMITTED] = t('Submitted');
+    $labels[self::STATUS_DRAFT] = t('Draft');
+    $labels[self::STATUS_UNAPPROVED] = t('Unapproved');
+    $labels[self::STATUS_UNDER_REVIEW] = t('Under Review');
+    $labels[self::STATUS_ACCEPTED] = t('Accepted');
+    $labels[self::STATUS_PUBLISHED] = t('Published');
+    $labels[self::STATUS_REJECTED] = t('Rejected');
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+
+// Maestro Process entity status codes
+class MaestroProcessStatusCodes {
+  CONST STATUS_ON_HOLD = -1;
+  CONST STATUS_ACTIVE = 0;
+  CONST STATUS_COMPLETED = 1;
+  CONST STATUS_REGENERATED = 2;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::STATUS_ON_HOLD] = t('On Hold');
+    $labels[self::STATUS_ACTIVE] = t('Active');
+    $labels[self::STATUS_COMPLETED] = t('Completed');
+    $labels[self::STATUS_REGENERATED] = t('Regenerated');
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+class MaestroAssignmentTypes {
+  CONST USER = 1;
+  CONST ROLE = 2;
+  CONST GROUP = 3;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::USER] = array('name' => 'USER', 'label' => t('User'));
+    $labels[self::ROLE] = array('name' => 'ROLE', 'label' => t('Role'));
+    $labels[self::GROUP] = array('name' => 'GROUP', 'label' => t('Organic Group'));
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+//options for the assignment and notification, it can be either variable or static
+class MaestroAssignmentBy {
+  CONST FIXED = 1;
+  CONST VARIABLE = 2;
+
+  static public function getStatusLabel($var=NULL) {
+    $labels = array();
+    $labels[self::FIXED] = array('name' => 'FIXED', 'label' => t('Fixed'));
+    $labels[self::VARIABLE] = array('name' => 'VARIABLE', 'label' => t('Variable'));
+
+    return ($var === NULL) ? $labels:$labels[$var];
+  }
+}
+
+class MaestroInteractiveFlag {
+  CONST IS_INTERACTIVE = 1;
+  CONST IS_NOT_INTERACTIVE = 0;
+}
diff --git a/sites/all/modules/maestro/maestro_engine_version1.class.php b/sites/all/modules/maestro/maestro_engine_version1.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..fd770234540540193b2f2c2655136031f6066627
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_engine_version1.class.php
@@ -0,0 +1,1026 @@
+<?php
+
+/* Using Drupal OO Coding Standards as described: http://drupal.org/node/608152 */
+include_once('maestro_task_interface.class.php');
+class MaestroEngineVersion1 extends MaestroEngine {
+
+  var $_version = '1.x';
+  var $_properties;
+
+  function __construct($options) {
+    global $user;
+    $this->_properties = $options;
+    $this->_userId = $user->uid;
+  }
+
+
+  public function getVersion() {
+    return $this->_version;
+  }
+
+  /* Generate a new process for a workflow template
+   * @param $template:
+   *   The workflow template id (int) - Mandatory
+   *
+   * @param $startoffset
+   *   Optional paramater to launch the workflow process at other then the default task step 0.
+   *   Also used if the process regeneration will not be at task 0 (automatically handled by engine)
+   *
+   * @param $pid
+   *   Optional paramater Parent Process id. This is used when regenerating a process or
+   *   if this new process should be a child process (or associated) with another workflow grouping (project)
+   *
+   * @param $useExistingGroupingId
+   *   Optional BOOLEAN value (default FALSE) that if TRUE triggers the process related records to be grouped (related)
+   *   as part of a project or related workflow grouping.
+   *
+   * @return
+   *   The process id
+   */
+
+  function newProcess($template, $startoffset = null, $pid = null , $useExistingGroupingId = FALSE) {
+    global $user;
+    $queue_id_for_notifications = 0;
+
+    // Retrieve the first step of the process and kick it off
+    if ($startoffset == null ) {
+      $query = db_select('maestro_template_data_next_step', 'a');
+      $query->fields('a',array('template_data_from'));
+      $query->fields('b',array('regen_all_live_tasks','show_in_detail','reminder_interval','task_class_name','is_interactive','task_data','handler'));
+      $query->addField('b','id','taskid');
+      $query->fields('c',array('template_name'));
+      $query->join('maestro_template_data', 'b', 'a.template_data_from = b.id');     // default is an INNER JOIN
+      $query->join('maestro_template', 'c', 'b.template_id = c.id');
+      $query->condition('b.first_task',1,'=');
+      $query->condition('c.id',$template,'=');
+      $query->orderBy('template_data_from','ASC');
+      $query->range(0,1);
+    }
+    else {
+      // Retrieve the one queue record - where it is equal to the passed in start offset.
+      $startoffset = intval($startoffset);
+      $query = db_select('maestro_template_data','a');
+      $query->addField('a','id','taskid');
+      $query->fields('b',array('template_name'));
+      $query->fields('a',array('regen_all_live_tasks','show_in_detail','reminder_interval','task_class_name','is_interactive','task_data','handler'));
+      $query->join('maestro_template', 'b', 'b.id = a.template_id');
+      $query->condition('a.id',$startoffset);
+    }
+    if ($this->_debug ) {
+      watchdog('maestro','New process code executing');
+    }
+
+    // Only 1 record expected - query returns an array of object records
+    $templaterec = current($query->execute()->fetchAll());
+
+    if (!empty($templaterec->taskid)) {
+      $pid = intval($pid);
+      if ($pid > 0) {
+        $flowname = db_query("SELECT flow_name FROM {maestro_process} WHERE id=$pid")->fetchField();
+      }
+      else {
+        $flowname = db_query("SELECT template_name FROM {maestro_template} WHERE id=$template")->fetchField();
+      }
+
+      $process_record = new stdClass();
+      $process_record->template_id = $template;
+      $process_record->flow_name = $flowname;
+      $process_record->complete = 0;
+      $process_record->pid = $pid;
+      $process_record->initiating_pid = $this->getParentProcessId($pid);
+      $process_record->initiator_uid = $user->uid;
+      $process_record->initiated_date = time();
+      drupal_write_record('maestro_process',$process_record);
+      $new_processid = $process_record->id;
+
+      if ($process_record->id == 0) {
+        watchdog('maestro', "New Process Code FAIL! - for template: $template");
+        return FALSE;
+      }
+      if ($pid == 0) {
+        $process_record->initiating_pid = $new_processid;
+        drupal_write_record('maestro_process', $process_record, array('id'));
+      }
+      $this->setProcessId($new_processid);
+
+      if ($templaterec->reminder_interval > 0) {
+        $next_reminder_date = time() + $templaterec->reminder_interval;
+      }
+      else {
+        $next_reminder_date = 0;
+      }
+
+      $queue_record = new stdClass();
+      $queue_record->process_id = $new_processid;
+      $queue_record->template_data_id = $templaterec->taskid;
+      $queue_record->task_class_name = $templaterec->task_class_name;
+      $queue_record->is_interactive = $templaterec->is_interactive;
+      $queue_record->show_in_detail = $templaterec->show_in_detail;
+      $queue_record->handler = $templaterec->handler;
+      $queue_record->task_data = $templaterec->task_data;
+      $queue_record->status = 0;
+      $queue_record->archived = 0;
+      $queue_record->engine_version = $this->_version;
+      $queue_record->created_date = time();
+      $queue_record->next_reminder_date = $next_reminder_date;
+      // Instantiate the tasktype specific method to set the queue record task data
+      $taskdata = $this->prepareTask(new $templaterec->task_class_name($templaterec));
+      if (isset($taskdata) AND is_array($taskdata)) {
+        if (isset($taskdata['handler'])) $queue_record->handler = $taskdata['handler'];
+        if (isset($taskdata['serialized_data'])) $queue_record->task_data = $taskdata['serialized_data'];
+      }
+      drupal_write_record('maestro_queue',$queue_record);
+      if ($queue_record->id == 0) {
+        watchdog('maestro', "New Process Code FAIL! - Unexpected problem creating initial queue record for template: $template");
+        return FALSE;
+      }
+      $queue_id_for_notifications = $queue_record->id;
+
+      // Determine if the offset is set.. if so, update the original parent process record with a status of 2
+      if (!empty($startoffset) AND !empty($pid)) {
+        db_update('maestro_process')
+        ->fields(array('complete' => MaestroProcessStatusCodes::STATUS_REGENERATED, 'completed_date' => time()))
+        ->condition('id',$pid,'=')
+        ->execute();
+
+        // Within this section we need to detect whether or not the startoffset task has the "regenerate all live tasks" option set.
+        // if so, the process we just layed to rest will hold some in-production tasks, and those tasks will have their pids set to the new pid.
+        // @TODO: Need to test this condition -- RK to add more comments to explain what we are doing here and regen all vs not
+        if($templaterec->regen_all_live_tasks == 1) {
+          $q2 = db_select('maestro_queue','a');
+          $q2->addField('a','id','id');
+          $q2->join('maestro_template_data', 'b', 'a.template_data_id = b.id');
+          $q2->condition('b.task_class_name','MaestroTaskTypeAnd');
+          $q2->condition('a.process_id',$pid);
+          $q2->condition(db_or()->condition('a.archived',0)->condition('a.archived',NULL));
+          $active_queue_tasks_result = $q2->execute();
+          foreach ($active_queue_tasks_result as $active_queue_record) {
+            /* The maestro_queue_from table is used by the IF Task to test previous task's status if that's the condition to test
+             * Also used to simplify later reporting of active tasks
+             */
+            $q3 = db_select('maesto_queue_from','a');
+            $q3->addField('a','from_queue_id');
+            $q3->condition("a.queue_id = {$active_queue_record->id}");
+            $queue_reporting_result = $q3->execute();
+            foreach ($queue_reporting_result as $queue_reporting_record) {
+              $record = new stdClass();
+              $record->id = $queue_reporting_record->from_queue_id;
+              $record->process_id = $new_processid;
+              drupal_write_record('maestro_queue',$record);
+            }
+            db_update('maestro_queue')
+            ->fields(array('process_id' => $new_processid))
+            ->condition('id', $active_queue_record->id)
+            ->condition(db_or()->condition('archived',0)->condition('archived',NULL))
+            ->execute();
+          }
+        }
+        // Select the process variables for the parent and create new ones for the new process $this->_processId
+        $pvquery = db_select('maestro_process_variables','a');
+        $pvquery->addExpression($new_processid,'process_id');
+        $pvquery->fields('a',array('variable_value','template_variable_id'));
+        $pvquery->condition('a.process_id',$pid);
+        db_insert('maestro_process_variables')
+        ->fields(array('variable_value','template_variable_id','process_id'))
+        ->from($pvquery)
+        ->execute();
+
+
+      } else {
+        // Situation where this is the root process, inserts the default template variables into the process
+        $pvquery = db_select('maestro_template_variables','a');
+        $pvquery->addExpression($new_processid,'process_id');
+        $pvquery->fields('a',array('variable_value','id'));
+        $pvquery->condition('a.template_id',$template,'=');
+        db_insert('maestro_process_variables')
+        ->fields(array('variable_value','template_variable_id','process_id'))
+        ->from($pvquery)
+        ->execute();
+      }
+      if ($this->_debug ) {
+        watchdog('maestro',"New queue id (1) : {$queue_record->id} - Template Taskid: {$templaterec->taskid}");
+      }
+
+      // Set the initiator variable here if not already set - via a regenerated process creation
+      if ($this->getProcessVariable('INITIATOR', $new_processid) == 0) {
+        $this->setProcessVariable('INITIATOR', $user->uid, $new_processid);
+      }
+      $newTaskAssignedUsers = $this->getAssignedUID($queue_record->id);
+      if (is_array($newTaskAssignedUsers) AND count($newTaskAssignedUsers) > 0) {
+        $this->assignTask($queue_record->id, $newTaskAssignedUsers);
+      }
+
+      if($useExistingGroupingId === FALSE) {
+        // Detect whether this new process needs a more detailed project table association created for it.
+        if(empty($pid)) {
+          // Condition where there is no parent (totally new process)
+          $project_record = new stdClass();
+          $project_record->originator_uid = $user->uid;
+          $project_record->task_id = $queue_record->id;
+          $project_record->status = MaestroProcessStatusCodes::STATUS_ACTIVE;
+          $project_record->description = $templaterec->template_name;
+          drupal_write_record('maestro_projects',$project_record);
+          $this->setTrackingId($project_record->id);
+          if ($this->_debug ) {
+            watchdog('maestro',"new process: created new project_id: {$project_record->id}");
+          }
+        }
+        else {
+          // Condition where there IS a parent AND we want a tracking table association
+          // One different step here - to update the wf process association for the original Parent process to include the new process
+          $parent_tracking_id = db_select('maestro_process','a')
+          ->fields('a',array('tracking_id'))
+          ->condition('id', $pid, '=')
+          ->execute()->fetchField();
+          $related_processes = db_select('maestro_projects','a')
+          ->fields('a',array('related_processes'))
+          ->condition('id', $parent_tracking_id, '=')
+          ->execute()->fetchField();
+          if (empty($related_processes)) {
+            $related_processes .= $pid;
+          }
+          else {
+            $related_processes .= ",{$new_processid}";
+          }
+          db_update('maestro_projects')
+          ->fields(array('related_processes' => $related_processes))
+          ->condition('id', $parent_tracking_id, '=')
+          ->execute();
+          if ($this->_debug ) {
+            watchdog('maestro',"updated existing project record process ({$new_processid}), set related_processes set to: $related");
+          }
+          $this->setTrackingId($parent_tracking_id);
+        }
+      }
+      else {
+        // Condition here where we are spawning a new process from an already existing process
+        // BUT we are not going to create a new tracking project, rather we are going to associate this process with the
+        // parent's already established tracking id
+        if(!empty($pid)) {
+          // First, pull back the existing project (grouping) entry
+          $existing_project_id = $this->getTrackingId($pid);
+          if ($existing_project_id > 0) {
+            $related_processes = db_select('maestro_projects','a')
+            ->fields('a',array('related_processes'))
+            ->condition('id', $existing_project_id, '=')
+            ->execute()->fetchField();
+            if(!empty($related_processes)) {
+              $existing_project_result->related_processes .= ",$new_processid";
+              db_update('maestro_projects')
+              ->fields(array('related_processes' => $existing_project_result->related_processes))
+              ->condition('id', $existing_project_id, '=')
+              ->execute();
+              $this->setTrackingId($existing_project_id);
+            }
+          }
+        }
+      }
+
+      // Tracking Id (previously known as project id - should have been set by code above
+      if($this->getTrackingId() == NULL) {
+        watchdog('maestro', "New Process Code failed to set tracking ID for Process: {$new_processid}");
+      }
+
+      if ($this->_debug) {
+        watchdog('maestro', "New Process Code completed Process: {$new_processid}, Tracking Id: {$this->_trackingId}");
+      }
+
+      // Check if notification has been defined for new task assignment
+      $this->sendTaskAssignmentNotifications($queue_id_for_notifications);
+
+      return $new_processid;
+
+    }
+    else {
+      watchdog('maestro', "New Process Code FAIL! - Template: $template not defined");
+    }
+  }
+
+
+
+
+
+  /* Main method for the Maestro Workflow Engine. Query the queue table and determine if
+   * any items in the queue associated with a process are complete.
+   * If they are complete, its the job of this function to determine if there are any next steps and fill the queue.
+   */
+  function cleanQueue() {
+    $processTaskList = array("id" => array(), "processid" => array() );
+    $processTaskListcount = 0;
+
+    $query = db_select('maestro_queue', 'a');
+    $query->join('maestro_process', 'b', 'a.process_id = b.id');
+    $query->join('maestro_template_data', 'c', 'a.template_data_id = c.id');
+    $query->join('maestro_template', 'd', 'b.template_id = d.id');
+    $query->fields('a',array('id','status','archived','template_data_id','task_class_name','engine_version','is_interactive'));
+    $query->addField('b','id','process_id');
+    $query->addField('c','task_class_name','step_type');
+    $query->addField('a','handler');
+    $query->addField('d','template_name');
+    $query->condition(db_and()->condition('a.archived',0)->condition('b.complete',0)->condition('a.run_once',0));
+    $res = $query->execute();
+    if ($this->_debug) {
+      watchdog('maestro',"CleanQueue: Number of entries in the queue:" . count($res));
+    }
+    $numrows = 0;
+    foreach ($res as $queueRecord) {
+      $this->_lastTestStatus = 0;
+      if ($this->_debug) {
+        watchdog('maestro',"CleanQueue: processing task of type: {$queueRecord->step_type}");
+      }
+      $numrows++;
+      $this->_processId = $queueRecord->process_id;
+      $this->_queueId = $queueRecord->id;
+
+      /* Clean queue will execute non-interactive tasks in one step - execute and then crank the process to setup the next task.
+       * The interactive tasks like manual web, interactiveTasks and contentType tasks will not complete immediately.
+       * The new interactive tasks (first appearance in the queue) will be executed now but do not complete immediately.
+       * They will complete at some time in the future. They will be flagged complete then but since there should only
+       * be one instance of the workflow engine that processes the tasks and sets up the next task.
+       * That's what this method is for and so we will look for any completed interactive tasks and archive them.
+       * Once archived, we crank that process forward (nextStep) and setup the next task for that workflow instance (process)
+       */
+
+      // Test for any interactive Tasks that have completed - we need to archive them now and crank the engine
+      if ($queueRecord->status > 0 AND $queueRecord->is_interactive == MaestroInteractiveFlag::IS_INTERACTIVE AND $queueRecord->archived == 0) {
+        $this->nextStep();
+      } else {
+
+        /* Using the strategy Design Pattern - Pass a new taskclass as the object to the maestro engine execute method
+         * All non-interactive tasks will normally execute and complete in one step and return a true/false.
+         * There can be batchTasks like that test for a condition and if not yet met - they would return FALSE
+         * Example: have a batch task that holds up the workflow until it's Friday at 12:00 noon - then send out an email.
+         * The interactive tasks like manual web, interactiveTask and contentType tasks will not execute and
+         * not complete now, they will at some time in the future and be archived by this method.
+         * InteractiveTasks will be picked up for the user via a call by the taskconsole to getQueue and presented
+         * to the user where they interact (example: inline interactive task, question, redirect or create/edit content)
+         * It's up to the code associated with the interactive task to trigger the completeTask operation - most likely by a
+         * a defined MENU CALLBACK to our defined menu handlers - review code for example interactiveTasks.
+         */
+        $task = $this->executeTask(new $queueRecord->task_class_name($queueRecord));
+        if ($task->executionStatus === FALSE) {
+          watchdog('maestro',"Failed Task: {$this->_queueId}, Process: {$this->_processId} , Step Type: $this->_taskType");
+          watchdog('maestro',"Task Information: ". $task->getMessage());
+          // TODO:  what do we do for a failed task?
+          // A task should have some sort of error recovery method
+        }
+        else if ($task->completionStatus > 0) {
+          // Execution successful with a valid return status which will now be used to complete the task.
+          $this->completeTask($task->_properties->id, $task->completionStatus);
+          // @TODO:  any post complete task hooks?
+          $this->_lastTestStatus = $task->getLastTestStatus();
+          $this->nextStep();
+        }
+      }
+    }
+
+    if ($numrows == 0 AND $this->_debug) {
+      watchdog('maestro','cleanQueue - 0 rows returned.  Nothing in queue.');
+    }
+    return $this;
+  }
+
+
+
+  function nextStep() {
+    if ($this->_debug ) {
+      watchdog('maestro', "nextStep: QueueId: $this->_queueId, ProcessId: $this->_processId");
+    }
+    // using the queueid and the processid, we are able to create or generate the
+    // next step or the regenerated next step in a new process
+    $query = db_select('maestro_queue', 'a');
+    //if the archive status explicitly says that we're looking at a false condition from an IF, use the false path instead
+    if($this->_lastTestStatus == MaestroTaskStatusCodes::STATUS_IF_CONDITION_FALSE) {
+      $query->addField('b','template_data_to_false','taskid');
+    }
+    else {
+      $query->addField('b','template_data_to','taskid');
+    }
+    $query->fields('c',array('task_class_name','is_interactive','show_in_detail','reminder_interval'));
+    $query->join('maestro_template_data_next_step', 'b', 'a.template_data_id = b.template_data_from');
+    if($this->_lastTestStatus == MaestroTaskStatusCodes::STATUS_IF_CONDITION_FALSE) {
+      $query->join('maestro_template_data', 'c', 'c.id = b.template_data_to_false');
+    }
+    else {
+      $query->join('maestro_template_data', 'c', 'c.id = b.template_data_to');
+    }
+    $query->condition('a.process_id',$this->_processId,'=');
+    $query->condition('a.id',$this->_queueId,'=');
+    $nextTaskResult = $query->execute();
+
+    $nextTaskRows = $query->countQuery()->execute()->fetchField();
+    //watchdog('maestro',"nextStep: Number of next task records: $nextTaskRows");
+    if ($nextTaskRows == 0 ) {
+      // There are no rows for this specific queueId and nothing for this processId, there's no next task
+      $this->archiveTask($this->_queueId);
+      db_update('maestro_process')
+      ->fields(array('complete' => MaestroProcessStatusCodes::STATUS_COMPLETED, 'completed_date' => time()))
+      ->condition('id', $this->_processId, '=')
+      ->execute();
+
+    } else { // we've got tasks
+      foreach ($nextTaskResult as $nextTaskRec) {
+        if ($this->_debug ) {
+          watchdog('maestro',"Got tasks  qid: {$this->_queueId}, pid: {$this->_processId} and Next taskid: {$nextTaskRec->taskid}");
+        }
+        // Check if the next template id is null, ensures that if we're on the last task and it points to null, that we end it properly
+        if ($nextTaskRec->taskid == null or $nextTaskRec->taskid == '' ) {
+          // Process is done - archive queue item
+          $this->archiveTask($this->_queueId);
+          db_update('maestro_process')
+          ->fields(array('complete' => MaestroProcessStatusCodes::STATUS_COMPLETED, 'completed_date' => time()))
+          ->condition('id', $this->_processId, '=')
+          ->execute();
+        }
+        else {
+          /* We have a next step, thus we can archive the queue item and also insert a
+           * new queue item with the next step populated as the next template_stepid
+           */
+          $query = db_select('maestro_queue', 'a');
+          $query->addField('a','id');
+          $query->addExpression('COUNT(a.id)','rec_count');
+          $query->groupBy('a.id');
+          $query->condition('a.process_id', $this->_processId,'=');
+          $query->condition('a.template_data_id', $nextTaskRec->taskid,'=');
+          $nextTaskQueueRec = $query->execute()->fetchObject();
+          if ($nextTaskQueueRec == FALSE OR $nextTaskQueueRec->rec_count == 0 ) {
+            $this->archiveTask($this->_queueId);
+            if ($nextTaskRec->reminder_interval > 0) {
+              $next_reminder_date = time() + $nextTaskRec->reminder_interval;
+            }
+            else {
+              $next_reminder_date = 0;
+            }
+            // No next item in the queue.. just create it
+            $queue_record = new stdClass();
+            $queue_record->process_id = $this->_processId;
+            $queue_record->template_data_id = $nextTaskRec->taskid;
+            $queue_record->task_class_name = $nextTaskRec->task_class_name;
+            $queue_record->is_interactive = $nextTaskRec->is_interactive;
+            $queue_record->show_in_detail = $nextTaskRec->show_in_detail;
+            $queue_record->status = 0;
+            $queue_record->archived = 0;
+            $queue_record->engine_version = $this->_version;
+            $queue_record->created_date = time();
+            $queue_record->next_reminder_date = $next_reminder_date;
+            // Instantiate the tasktype specific method to set the queue record task data
+            if (class_exists($nextTaskRec->task_class_name)) {
+              $taskdata = $this->prepareTask(new $nextTaskRec->task_class_name($nextTaskRec));
+              if (isset($taskdata) AND is_array($taskdata)) {
+                if (isset($taskdata['handler'])) $queue_record->handler = $taskdata['handler'];
+                if (isset($taskdata['serialized_data'])) $queue_record->task_data = $taskdata['serialized_data'];
+              }
+
+              drupal_write_record('maestro_queue',$queue_record);
+
+              $next_record = new stdClass();
+              $next_record->queue_id = $queue_record->id;
+              $next_record->from_queue_id = $this->_queueId;
+              drupal_write_record('maestro_queue_from',$next_record);
+
+              if ($queue_record->id > 0) {
+                if ($this->_debug ) {
+                  $logmsg  = "New queue id (3) : {$this->_queueId} - Template Taskid: {$nextTaskRec->taskid} - ";
+                  $logmsg .= "Assigned to " . $this->getTaskOwner($nextTaskRec->taskid,$this->_processId);
+                  watchdog('maestro', $logmsg);
+                }
+              }
+              else {
+                watchdog('maestro', "nextStep Method FAIL! - Unexpected problem creating queue record");
+              }
+
+              $newTaskAssignedUsers = $this->getAssignedUID($queue_record->id);
+              if (is_array($newTaskAssignedUsers) AND count($newTaskAssignedUsers) > 0) {
+                $this->assignTask($queue_record->id,$newTaskAssignedUsers);
+              }
+
+              // Check if notification has been defined for new task assignment
+              $this->sendTaskAssignmentNotifications($queue_record->id);
+            }
+            else {
+              watchdog('maestro', "Invalid Task Type: {$nextTaskRec->task_class_name}");
+              drupal_set_message("Invalid Task Type: {$nextTaskRec->task_class_name}", 'error');
+            }
+
+          }
+          else {
+            /* We have a situation here where the next item already exists.
+             * need to determine if the next item has a regeneration flag.
+             * If there is a regeneration flag, then create a new process starting with that regeneration flagged item
+             */
+            $query = db_select('maestro_template_data', 'a');
+            $query->fields('a',array('id','regenerate','template_id'));
+            $query->addExpression('COUNT(id)','rec_count');
+            $query->groupBy('a.regenerate');
+            $query->groupBy('a.template_id');
+            $query->groupBy('a.id');
+            $query->condition('a.id', $nextTaskRec->taskid,'=');
+            $regenRec = current($query->execute()->fetchAll());
+
+            if ($regenRec->regenerate == 1) {
+              $this->archiveTask($this->_queueId);
+              // Regenerate the same process starting at the next step
+              // Set the current process' complete status to 2.. 0 is active, 1 is done, 2 is has children
+              $this->newProcess($regenRec->template_id, $nextTaskRec->taskid, $this->_processId);
+            }
+            else {
+              // No regeneration so we are done
+              $this->archiveTask($this->_queueId);
+              $toQueueID = $nextTaskQueueRec->id;
+              $next_record = new stdClass();
+              $next_record->queue_id = $nextTaskQueueRec->id;
+              $next_record->from_queue_id = $this->_queueId;
+              drupal_write_record('maestro_queue_from',$next_record);
+
+              $query = db_select('maestro_queue', 'a');
+              $query->addExpression('COUNT(id)','rec_count');
+              $query->condition('a.process_id', $this->_processId,'=');
+              $query->condition('a.template_data_id', $nextTaskRec->taskid,'=');
+              if ($query->execute()->fetchField() == 0 ) {
+                db_update('maestro_process')
+                ->fields(array('complete' => MaestroProcessStatusCodes::STATUS_COMPLETED, 'completed_date' => time()))
+                ->condition('id', $this->_processId, '=')
+                ->execute();
+              }
+            }
+          }
+        }
+      }
+    }
+    return $this;
+  }
+
+
+  /**
+   * Method assign task - create productionAssignment Record and test if to-be-assigned user has their out-of-office setting active
+   * @param        int         $queueID     Task ID from the workflow queue table
+   * @param        array       $assignemnt  Array of records where the key is the variable id  if applicable and the user id
+   If the assignment is by user, the key will be 0 or a negative value - in the case of multiple assignments
+   * @return       n/a         No return
+   */
+  function assignTask($queueId,$userObject) {
+    foreach ($userObject as $processVariableId => $userId) {
+      if (strpos($userId, ':') !== false) {
+        $userIds = explode(':', $userId);
+      }
+      else {
+        $userIds = array($userId);
+      }
+
+      foreach ($userIds as $userId) {
+        $userId = intval($userId);
+        /* The array of users to be assigned may be an array of multiple assignments by user not variable
+         * In this case, we can not have multiple array records with a key of 0 - so a negative value is used
+         */
+        if($processVariableId < 0) $processVariableId = 0;
+        if ($userId > 0) {
+          $query = db_select('maestro_user_away', 'a');
+          $query->fields('a',array('away_start','away_return','is_active'));
+          $query->condition('a.uid',$userId,'=');
+          //$res1 = $query->execute()->fetchObject();
+          $res1 = NULL; //temporary until user away settings are added
+          if ($res1) {
+            // Check if user is away - away feature active and current time within the away window
+            if ($res1->is_active == 1 AND time() > $res1->away_start AND time() < $res1->away_return) {
+              /* User is away - determine who to re-assign task to */
+              $assignToUserId = $this->getAwayReassignmentUid($userId);
+              // If we have a new value for the assignment - then we need to set the assignBack field
+              if ($assignToUserId != $userId) {
+                $assignBack = $userId;
+              }
+              else {
+                $assignBack = 0;
+              }
+            }
+            else {
+              $assignToUserId = $userId;
+              $assignBack = 0;
+            }
+          }
+          else {
+            $assignToUserId = $userId;
+            $assignBack = 0;
+          }
+        }
+        else {
+          $assignToUserId = 0;
+          $assignBack = 0;
+        }
+
+        // Check and see if we have an production assignment record for this task and processVariable
+        $query = db_select('maestro_production_assignments', 'a');
+        $query->addField('a','uid');
+        $query->condition('a.task_id',$queueId,'=');
+        if ($processVariableId > 0) {
+          $query->condition('a.process_variable',$processVariableId,'=');
+        }
+        else {
+          $query->condition('a.process_variable',0,'=');
+          $query->condition('a.uid',$userId,'=');
+        }
+        $res2 = $query->execute();
+        $numrows = $query->countQuery()->execute()->fetchField();
+        if ($numrows < count($userIds)) {
+          db_insert('maestro_production_assignments')
+          ->fields(array('task_id','uid','process_variable','assign_back_uid','last_updated'))
+          ->values(array(
+                    'task_id' => $queueId,
+                    'uid' => $assignToUserId,
+                    'process_variable' => $processVariableId,
+                    'assign_back_uid' => $assignBack,
+                    'last_updated'  => time()
+          ))
+          ->execute();
+        }
+        else {
+          db_update('maestro_production_assignments')
+          ->fields(array('uid' => $assignToUserId, 'last_updated' => time(), 'assign_back_uid' => $assignBack))
+          ->condition('task_id', $queueId, '=')
+          ->condition('process_variable',$processVariableId,'=')
+          ->execute();
+        }
+      }
+    }
+  }
+
+  function reassignTask($queueId, $assignUid, $currentUid=0, $variableId=0) {
+    /* Assignment Record has to exist - but there can be multiple for this workflow queue record (process task)
+     * If the assign_uid is 0 then it's not presently assigned
+     * If the process_variable field is 0 then the task is assigned by UID and not by variable
+     */
+
+    // Check that user exists, is valid and status is an active user - else skip the re-assignment
+    $user_status = db_query("SELECT status FROM {users} WHERE uid = :uid", array(':uid' => $assignUid))->fetchField();
+
+    if ($assignUid >= 1 AND $user_status > 0) {
+      $query = db_select('maestro_production_assignments', 'a');
+      $query->fields('a', array('id', 'uid', 'assign_back_uid'));
+      $query->condition('task_id', $queueId, '=');
+      if ($variableId > 0) {
+        $query->condition('process_variable', $variableId, '=');
+      }
+      else if ($currentUid > 0) {
+        $query->condition('uid', $currentUid, '=');
+      }
+
+      $res = $query->execute();
+      $rec = $query->execute()->fetchObject();
+      // Check and see if we have a production assignment record - if unassigned, then lets create one
+      if ($rec === FALSE OR !isset($rec->id)) {
+        db_insert('maestro_production_assignments')
+        ->fields(array('task_id','uid','process_variable','assign_back_uid','last_updated'))
+        ->values(array(
+            'task_id' => $queueId,
+            'uid' => $assignUid,
+            'process_variable' => 0,
+            'assign_back_uid' => 0,
+            'last_updated'  => time()
+        ))
+        ->execute();
+        $assignToUserId = $assignUid;
+      } else {
+        /* If the task has been re-assigned previously for this task, then we will now loose the originally assigned user */
+        /* Need to now check if the to-be-assigned user is away and if so .. then assigned to their backup */
+        $assignToUserId = $this->getAwayReassignmentUid($assignUid);
+        db_update('maestro_production_assignments')
+        ->fields(array('uid' => $assignToUserId, 'last_updated' => time(), 'assign_back_uid' => $currentUid))
+        ->condition('id', $rec->id, '=')
+        ->execute();
+      }
+
+      // Create a comment in the project comments
+      $query = db_select('maestro_queue', 'a');
+      $query->join('maestro_process','b','b.id = a.process_id');
+      $query->fields('a', array('id','template_data_id', 'process_id'));
+      $query->fields('b', array('tracking_id'));
+      $query->condition('a.id', $queueId, '=');
+      $rec = $query->execute()->fetchObject();
+      $taskname = db_query("SELECT taskname FROM {maestro_template_data} WHERE id = :tid",
+      array(':tid' => $rec->template_data_id))->fetchField();
+      $assigned_name = db_query("SELECT name FROM {users} WHERE uid = :uid",
+      array(':uid' => $currentUid))->fetchField();
+      $reassigned_name = db_query("SELECT name FROM {users} WHERE uid = :uid",
+      array(':uid' => $assignToUserId))->fetchField();
+      $comment = "Task Owner change, was {$assigned_name}, now {$reassigned_name} for task: {$taskname}";
+      db_insert('maestro_project_comments')
+      ->fields(array('tracking_id','uid','task_id','timestamp','comment'))
+      ->values(array(
+              'tracking_id' => $rec->tracking_id,
+              'uid' => $assignToUserId,
+              'task_id' => $rec->id,
+              'timestamp' => time(),
+              'comment'  => $comment
+      ))
+      ->execute();
+    }
+  }
+
+
+  /* @TODO: Need to complete this function and add the user profile feature for
+   * user to setup auto re-assignment options if they are away
+   */
+  function getAwayReassignmentUid($uid) {
+    return $uid;
+  }
+
+  function getAssignedUID($queue_id=0) {
+    if ($queue_id == 0) {
+      $queue_id = $this->_queueId;
+    }
+
+    $assigned = array();
+    $query = db_select('maestro_template_assignment', 'a');
+    $query->leftJoin('maestro_queue', 'b', 'a.template_data_id=b.template_data_id');
+    $query->fields('a', array('assign_type', 'assign_by', 'assign_id'));
+    $query->fields('b', array('process_id'));
+    $query->condition('b.id', $queue_id, '=');
+    $res = $query->execute()->fetchAll();
+
+    $assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED] = array();
+    $assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE] = array();
+
+    foreach ($res as $rec) {
+      if ($rec->assign_by == MaestroAssignmentBy::FIXED) {
+        $assigned[$rec->assign_type][$rec->assign_by][] = $rec->assign_id;
+      }
+      else {
+        $pvQuery = db_select('maestro_process_variables', 'a');
+        $pvQuery->fields('a', array('variable_value'));
+        $pvQuery->condition('a.template_variable_id', $rec->assign_id, '=');
+        $pvQuery->condition('a.process_id', $rec->process_id, '=');
+        $pvRec = current($pvQuery->execute()->fetchAll());
+        $assign_id = $pvRec->variable_value;
+        $assigned[$rec->assign_type][$rec->assign_by][$rec->assign_id] = $assign_id;
+      }
+    }
+
+    if (count($assigned) == 0) {
+      //check to see if this is a valid queue_id, if so add a blank assignment record
+      $query = db_select('maestro_queue', 'a');
+      $query->fields('a', array('id'));
+      $query->condition('a.id', $queue_id, '=');
+      $rec = current($query->execute()->fetchAll());
+      if ($rec != FALSE) {
+        $assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][0] = 0;
+      }
+    }
+
+    //TODO: hack for now to support current assignment. in beta we will need to return the $assigned array as it is right now, without the following logic
+    if (count($assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED]) < count($assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE])) {
+      return $assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE];
+    }
+    else {
+      return $assigned[MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED];
+    }
+
+    return $assigned;
+  }
+
+
+  function completeTask($qid, $status = 1) {
+    $pid = db_query("SELECT process_id FROM {maestro_queue} WHERE id = :qid",
+    array(':qid' => $qid))->fetchField();
+
+    if (empty($pid)) {
+      watchdog('maestro',"Task ID #$qid no longer exists in queue table.  It was potenially removed by an admin from outstanding tasks.");
+      return FALSE;
+    }
+
+    $trackingId = db_query("SELECT tracking_id FROM {maestro_process} WHERE id = :pid",
+    array(':pid' => $pid))->fetchField();
+
+    if ($this->_debug ) {
+      watchdog('maestro',"Complete_task - updating queue item: $qid, project (tracking id): $trackingId");
+    }
+
+    //check if this task is interactive.  If interactive, assigned_uid is the user assigned.  else, its a 0 as its engine run.
+    $is_interactive = db_query("SELECT is_interactive FROM {maestro_queue} WHERE id = :qid",
+    array(':qid' => $qid))->fetchField();
+    if($is_interactive == MaestroInteractiveFlag::IS_INTERACTIVE) {
+      if ($this->_userId == '' or $this->_userId == null ) {
+        $assigned_uid = db_query("SELECT uid FROM {maestro_production_assignments} WHERE task_id = :qid",
+        array(':qid' => $qid))->fetchField();
+      } else {
+        $assigned_uid = $this->_userId;
+      }
+    }
+    else {
+      $assigned_uid = 0;
+    }
+
+    db_update('maestro_queue')
+    ->fields(array('uid' => $assigned_uid , 'status' => $status, 'run_once' => 0))
+    ->condition('id',$qid,'=')
+    ->execute();
+
+    //notify before deleting the production assignment record
+    $this->sendTaskCompletionNotifications($qid);
+
+    // Self Prune Production Assignment table - delete the now completed task assignment record
+    db_delete('maestro_production_assignments')
+    ->condition('task_id',$qid,'=')
+    ->execute();
+
+  }
+
+  function archiveTask($qid) {
+    db_update('maestro_queue')
+    ->fields(array('completed_date' => time(), 'archived' => 1))
+    ->condition('id',$qid,'=')
+    ->execute();
+
+    // Self Prune Production Assignment table - delete the now completed task assignment record
+    db_delete('maestro_production_assignments')
+    ->condition('task_id',$qid,'=')
+    ->execute();
+  }
+
+
+  function cancelTask($queueId) {
+    db_update('maestro_queue')
+    ->fields(array('status' => $status, 'completed_date' => time(), 'archived' => 1))
+    ->condition('id',$qid,'=')
+    ->execute();
+  }
+
+  function getQueue($show_system_tasks = FALSE) {
+    if (!empty($this->_userId) AND $this->_userId > 0) {
+      /* Instance where the user id is known.  need to see if there is a processID given.
+       * This means that the mode in which we're working is user based.. we only care about a user in this case
+       */
+      if ($this->_mode != 'admin') {
+        $this->_mode = 'user';
+      }
+      if ($this->_debug ) {
+        watchdog('maestro',"Entering getQueue - {$this->mode} mode");
+      }
+      $this->_userTaskCount = 0;
+      $query = db_select('maestro_queue', 'a');
+      $query->join('maestro_template_data', 'b', 'a.template_data_id = b.id');
+      $query->leftJoin('maestro_production_assignments', 'c', 'a.id = c.task_id');
+      $query->join('maestro_process', 'd', 'a.process_id = d.id');
+      $query->fields('a',array('id','template_data_id','process_id','is_interactive','handler','task_data','created_date','started_date'));
+      $query->fields('b',array('task_class_name','template_id','taskname','is_dynamic_taskname','dynamic_taskname_variable_id'));
+      if ($this->_mode == 'admin') {
+        $query->fields('c',array('uid'));
+        $query->fields('e',array('name'));
+        $query->leftJoin('users', 'e', 'c.uid = e.uid');
+      }
+      $query->addField('d','pid','parent_process_id');
+      $query->fields('d',array('tracking_id','flow_name'));
+      if ($this->_mode != 'admin') {
+        $query->condition('c.uid',$this->_userId,'=');
+      }
+      if ($show_system_tasks == FALSE) {
+        $query->condition('a.is_interactive', MaestroInteractiveFlag::IS_INTERACTIVE);
+      }
+      $query->condition(db_or()->condition('a.archived',0)->condition('a.archived',NULL));
+      $query->condition(db_and()->condition('a.status', 0, '>='));
+      $query->orderBy('a.id','DESC');
+      $userTaskResult = $query->execute();
+      $numTaskRows = $query->countQuery()->execute()->fetchField();
+      if ($numTaskRows == 0) {
+        if ($this->_debug ) {
+          watchdog('maestro',"getQueue - 0 rows returned.  Nothing in queue for this user: {$this->_userId}.");
+        }
+      }
+      else {
+        // Return a semi-colon delimited list of queue id's for that user.
+        foreach ($userTaskResult as $userTaskRecord) {
+          if ($this->_queueId == '' ) {
+            $this->_queueId = $userTaskRecord->id;
+          } else {
+            $this->_queueId .= ";" . $userTaskRecord->id;
+          }
+
+          // Simple test to determine if the task ID already exists for this user
+          $flag = 0;
+          for($flagcntr = 0;$flagcntr <= $this->_userTaskCount;$flagcntr++ ) {
+            if (isset($this->_userTaskObject[$flagcntr]->queue_id) AND $this->_userTaskObject[$flagcntr]->queue_id == $userTaskRecord->id ) {
+              $flag = 1;
+            }
+          }
+          if ($flag == 0 ) {
+            $taskObject = new stdClass();
+            $templatename = db_query("SELECT template_name FROM {maestro_template} WHERE id = :tid",
+            array(':tid' => $userTaskRecord->template_id))->fetchField();
+
+            // Determine if this task is for a regenerated workflow and we need to update the main project/request record
+            $taskObject->regen = FALSE;
+            if ($userTaskRecord->parent_process_id > 0) {
+              // Now check if this same template task id was executed in the previous process - if so then it is a recycled task
+              // Don't show the re-generated attribute if in this instance of the process we proceed further and are executing new tasks
+              $regenquery = db_select('maestro_queue', 'a');
+              $regenquery->addExpression('COUNT(id)','rec_count');
+              $regenquery->condition('a.process_id', $userTaskRecord->parent_process_id,'=');
+              $regenquery->condition(db_and()->condition('a.template_data_id', $userTaskRecord->template_data_id,'='));
+              if ($regenquery->execute()->fetchField() > 0 ) {
+                $taskObject->regen = TRUE;
+              }
+            }
+
+            $queueRecDates = array('created' => $userTaskRecord->created_date, 'started' => $userTaskRecord->started_date);
+            $queueRecFlags = array('is_interactive' => $userTaskRecord->is_interactive);
+            $taskObject->task_data = $userTaskRecord->task_data;
+            $taskObject->queue_id = $userTaskRecord->id;
+            $taskObject->task_id = $userTaskRecord->template_data_id;
+            $taskObject->process_id = $userTaskRecord->process_id;
+            $taskObject->parent_process_id = $userTaskRecord->parent_process_id;
+            $taskObject->template_id = $userTaskRecord->template_id;
+            $taskObject->template_name = $templatename;
+            $taskObject->flow_name = $userTaskRecord->flow_name;
+            $taskObject->tracking_id = $userTaskRecord->tracking_id;
+            $taskObject->url = $userTaskRecord->handler;
+            $taskObject->dates = $queueRecDates;
+            $taskObject->flags = $queueRecFlags;
+            if ($this->_mode == 'admin') {
+              $taskObject->uid = $userTaskRecord->uid;
+              $taskObject->username = ($userTaskRecord->name != '') ? $userTaskRecord->name : '[' . t('nobody assigned') . ']';
+            }
+
+            // Handle dynamic task name based on a variable's value
+            $taskname = '';
+            if($userTaskRecord->is_dynamic_taskname == 1) {
+              $q2 = db_select('maestro_process_variables', 'a');
+              $q2->addField('a','variable_value');
+              $q2->condition('a.process_id',$userTaskRecord->process_id,'=');
+              $q2->condition('a.template_variable_id',$userTaskRecord->dynamic_taskname_variable_id,'=');
+              $res1 = $query->execute()->fetchObject();
+              if ($res1) {
+                $userTaskRecord->taskname = $res1->variable_value;
+              }
+            }
+            /* @TODO: Need to look at using a module HOOK that can be used in a similar way to define an custom taskname */
+            /*
+             if (function_exists('PLG_Nexflow_taskname')) {
+             $parms = array('pid' => $A['nf_processID'], 'tid' => $A['nf_templateDataID'], 'qid' => $A['id'], 'user' => $this->_nfUserId);
+             if (!empty($taskame)) {
+             $apiRetval = PLG_Nexflow_taskname($parms,$taskname);
+             } else {
+             $apiRetval = PLG_Nexflow_taskname($parms,$A['taskname']);
+             }
+             $taskname = $apiRetval['taskname'];
+             }
+             */
+
+            $taskObject->taskname = $userTaskRecord->taskname;
+            $taskObject->tasktype = $userTaskRecord->task_class_name;
+            $this->_userTaskObject[$this->_userTaskCount] = $taskObject;
+            $this->_userTaskCount += 1; // Increment the total user task counter
+          }
+        }
+      }
+    }
+
+    if ($this->_debug ) {
+      watchdog('maestro',"Exiting getQueue - user mode");
+    }
+    return $this->_userTaskObject;
+  }
+
+  //gets the highest level parent process id for a process, aka the 'initiating_pid'
+  function getParentProcessId($pid) {
+    $retpid = $pid;
+
+    while ($pid != 0) {
+      $query = db_select('maestro_process', 'a');
+      $query->fields('a', array('pid'));
+      $query->condition('a.id', $pid, '=');
+      $res = $query->execute();
+      $rec = current($res->fetchAll());
+      if ($rec != '') {
+        $pid = $rec->pid;
+        if ($pid != 0) {
+          $retpid = $pid;
+        }
+      }
+      else {
+        $pid = 0;
+      }
+    }
+
+    return $retpid;
+  }
+
+  //readd production assignment records for a deleted task
+  function reviveTask($qid) {
+    if ($qid > 0) {
+      $query = db_select('maestro_queue', 'a');
+      $query->fields('b', array('assigned_by_variable'));
+      $query->leftJoin('maestro_template_data', 'b', 'a.template_data_id=b.id');
+      $query->condition('a.id', $qid, '=');
+      $assigned_by_variable = current($query->execute()->fetchAll())->assigned_by_variable;
+
+      $assigned = $this->getAssignedUID($qid);
+      foreach ($assigned as $pv_id => $assigned_uid) {
+        $rec = new stdClass();
+        $rec->task_id = $qid;
+        $rec->uid = $assigned_uid;
+        $rec->process_variable = ($assigned_by_variable == 1) ? $pv_id:0;
+        $rec->assign_back_uid = 0;
+        $rec->last_updated = time();
+        drupal_write_record('maestro_production_assignments', $rec);
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/maestro_engine_version2.class.php b/sites/all/modules/maestro/maestro_engine_version2.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..6b976bda45b0b3ca7d98b23adf2fb73dbc44b32b
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_engine_version2.class.php
@@ -0,0 +1,37 @@
+<?php
+  
+  /* Using Drupal OO Coding Standards as described: http://drupal.org/node/608152 */
+  
+  class MaestroEngineVersion2 extends MaestroEngine {
+      
+      var $_version = '2.x';
+      var $_properties;
+      
+      function __construct($options) {
+        echo "<br>Version 2 __constructor";
+        print_r($options);
+        $this->_properties = $options;        
+      }
+      
+      
+      public function getVersion() {
+        return $this->_version;      
+      }   
+    
+      function cleanQueue() {}
+      
+    function assignTask($queueId,$userObject) {}
+    
+    function completeTask($queueId) {}     
+    
+    function archiveTask($queueId) {}    
+    
+    function cancelTask($queueId) {}    
+
+    function getProcessVariable($variable) {}
+    
+    function setProcessVariable($variable,$value) {}    
+
+  }
+  
+  
diff --git a/sites/all/modules/maestro/maestro_interface.class.php b/sites/all/modules/maestro/maestro_interface.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..637ecdc381a1c03a4d0c2493a4ce04903dba8815
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_interface.class.php
@@ -0,0 +1,176 @@
+<?php
+// $Id: maestro_interface.class.php,v 1.25 2010/08/31 15:13:27 chevy Exp $
+
+/**
+ * @file
+ * maestro_task_interface.class.php
+ */
+
+class MaestroInterface {
+  private $_template_id;
+
+  function __construct($template_id) {
+    $this->_template_id = $template_id;
+    $context_options = cache_get('maestro_taskclass_info');
+
+    // Test if context options are cached - if not then we will set it
+    // The class function getContextMenu will read options from the cache
+    if($context_options === FALSE) {
+      $context_options = array();
+      // Scan through each available class type and fetch its corresponding context menu.
+      foreach (module_implements('maestro_get_taskobject_info') as $module) {
+        $function = $module . '_maestro_get_taskobject_info';
+        if ($arr = $function()) {
+          $context_options = maestro_array_add($context_options, $arr);
+        }
+      }
+      cache_set('maestro_taskclass_info', $context_options);
+    }
+
+    $handler_options = cache_get('maestro_handler_options');
+    // Test if task type handler options are cached - if not then we will set it
+    // The class function getHandlerOptions will read options from the cache
+    if($handler_options === FALSE) {
+      // Scan through each available class type and fetch its corresponding context menu.
+      foreach (module_implements('maestro_handler_options') as $module) {
+        $function = $module . '_maestro_handler_options';
+        if ($arr = $function()) {
+          $handler_options = maestro_array_merge_keys($arr,$handler_options);
+        }
+      }
+      cache_set('maestro_handler_options', $handler_options);
+    }
+
+  }
+
+  //displays the main task page
+  function displayPage() {
+    global $base_url;
+    $maestro_url = $base_url . '/' . drupal_get_path('module', 'maestro');
+    $res = db_select('maestro_template', 'a');
+    $res->fields('a', array('template_name', 'canvas_height'));
+    $res->condition('id', $this->_template_id, '=');
+    $t_rec = current($res->execute()->fetchAll());
+
+    $build['workflow_template'] = array(
+      '#theme' => 'maestro_workflow_edit',
+      '#tid' => $this->_template_id,
+      '#mi' => $this,
+      '#maestro_url' => $maestro_url,
+      '#t_rec' => $t_rec
+    );
+    $build['workflow_template']['#attached']['library'][] = array('system', 'ui.draggable');
+    $build['workflow_template']['#attached']['js'][] = array('data' => '(function($){$(function() { $(".maestro_task_container").draggable( {snap: true} ); })})(jQuery);', 'type' => 'inline');
+
+    return drupal_render($build);
+  }
+
+  function displayTasks() {
+    $html = '';
+    $res = db_query('SELECT id, taskname, task_class_name FROM {maestro_template_data} WHERE template_id=:tid', array(':tid' => $this->_template_id));
+
+    foreach ($res as $rec) {
+      $task_type = substr($rec->task_class_name, 15);
+      $task_class = 'MaestroTaskInterface' . $task_type;
+
+      if (class_exists($task_class)) {
+        $ti = new $task_class($rec->id);
+      }
+      else {
+        $ti = new MaestroTaskInterfaceUnknown($rec->id, 0, $task_class);
+      }
+
+      $html .= $ti->displayTask();
+    }
+
+    return $html;
+  }
+
+  //should get the valid task types to create, excluding start and end tasks, from the drupal cache
+  function getContextMenu() {
+    //we need to rebuild the cache in the event it is empty.
+    $options = cache_get('maestro_taskclass_info');
+    return $options;
+  }
+
+  function getContextMenuHTML() {
+    $options = $this->getContextMenu();
+    $html = "<div id=\"maestro_main_context_menu\" class=\"maestro_context_menu\"><ul>\n";
+
+    foreach ($options->data as $key => $option) {
+      $task_type = substr($option['class_name'], 20);
+      $option = t($option['display_name']);
+      $html .= "<li style=\"white-space: nowrap;\" id=\"$task_type\">$option</li>\n";
+    }
+    $html .= "</ul></div>\n";
+
+    return $html;
+  }
+
+  function getContextMenuJS() {
+    $options = $this->getContextMenu();
+    $js  = "(function ($) {\n";
+    $js .= "\$('#maestro_workflow_container').contextMenu('maestro_main_context_menu', {\n";
+    $js .= "menuStyle: {\n";
+    $js .= "width: 175,\n";
+    $js .= "fontSize: 12,\n";
+    $js .= "},\n";
+
+    $js .= "itemStyle: {\n";
+    $js .= "padding: 0,\n";
+    $js .= "paddingLeft: 10,\n";
+    $js .= "},\n";
+
+    $js .= "bindings: {\n";
+
+    foreach ($options->data as $key => $option) {
+      $task_type = substr($option['class_name'], 20);
+      $js .= "'$task_type': function(t) {\n";
+      $js .= "enable_ajax_indicator();\n";
+      $js .= "\$.ajax({
+        type: 'POST',
+        url: ajax_url + 'MaestroTaskInterface$task_type/0/{$this->_template_id}/create/',
+        cache: false,
+        data: {task_type: '$task_type', offset_left: posx, offset_top: posy},
+        dataType: 'json',
+        success: add_task_success,
+        error: editor_ajax_error
+      });\n";
+      $js .= "},\n";
+    }
+
+    $js .= "}\n";
+    $js .= "});\n";
+    $js .= "})(jQuery);\n";
+
+    return $js;
+  }
+
+  function initializeJavascriptArrays() {
+    $js = '';
+    $res = db_query('SELECT id, offset_left, offset_top FROM {maestro_template_data} WHERE template_id=:tid', array(':tid' => $this->_template_id));
+    $i = 0;
+    $j = 0;
+    foreach ($res as $rec) {
+      $js .= "existing_tasks[{$i}] = ['task{$rec->id}', {$rec->offset_left}, {$rec->offset_top}];\n";
+      $i++;
+      $res2 = DB_query("SELECT template_data_to, template_data_to_false FROM {maestro_template_data_next_step} WHERE template_data_from=:tid", array(':tid'=>$rec->id));
+      foreach ($res2 as $rec2) {
+        $to = intval ($rec2->template_data_to);
+        $to_false = intval ($rec2->template_data_to_false);
+        if ($to != 0) {
+          $js .= "line_ids[{$j}] = ['task{$rec->id}', 'task{$to}', true];\n";
+          $j++;
+        }
+        if ($to_false != 0) {
+          $js .= "line_ids[{$j}] = ['task{$rec->id}', 'task{$to_false}', false];\n";
+          $j++;
+        }
+      }
+    }
+
+    return $js;
+  }
+}
+
+?>
diff --git a/sites/all/modules/maestro/maestro_notification.class.php b/sites/all/modules/maestro/maestro_notification.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..0dae44ba215d5566ed6d6b47373f1fa3a8b031bc
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_notification.class.php
@@ -0,0 +1,343 @@
+<?php
+// $Id: maestro_notification.class.php,v 1.18 2010/08/25 19:40:39 chevy Exp $
+
+/**
+ * @file
+ * maestro_notification.class.php
+ */
+
+/*
+ * We are implementing an observer pattern to accomplish our notifications.
+ * Any additional module that would like to create a notification simply
+ * has to subscribe/attach to the main notification object as an observer
+ * and the main notification mechanism will push out the notification to them.
+ * I've included our email observer in this file as well as a Skeletal Twitter observer pattern.
+*/
+
+include_once('maestro_constants.class.php');
+
+abstract class MaestroNotificationObserver {
+  public $displayName;
+
+  function __construct() {
+    $this->displayName = "";  //You must give the observer a friendly display name so that the admin console can display it
+  }
+
+  abstract function notify(MaestroNotification &$obj);
+}
+
+class MaestroNotification {
+  protected $_userIDArray = array();
+  protected $_userEmailArray = array();
+  protected $_observers = array();
+  protected $_message = "";
+  protected $_subject = "";
+  protected $_queueID = 0;
+  protected $_notificationType = "";
+
+  /**
+   * Constructor
+   *
+   * @param $users
+   *   Mandatory - An array of integers or single integer specifying the Drupal users to notify.
+   *
+   * @param $defaultMessage
+   *   String: The default message to send in the email, overridden with the message stored in the template_data record
+   *
+   * @param $defaultSubject
+   *   String: The default email subject, overridden with the message stored in the template_data record
+   *
+   * @param $queueID
+   *   Integer: The QueueID associated with the message you're sending out
+   *
+   * @param $type
+   *   String: The actual notification type using the MaestroNotificationTypes Constants
+   */
+  function __construct($defaultMessage = '', $defaultSubject = '', $queueID = 0, $type = MaestroNotificationTypes::ASSIGNMENT) {
+    $observers = array();
+    $this->_notificationType = $type;
+    $this->_queueID = $queueID;
+    $this->getNotificationUserIDs();
+
+    $this->setNotificationSubjectAndMessage($defaultMessage, $defaultSubject);
+
+    //Now, lets determine if we've got our observers cached.  If not, lets rebuild that observer list
+    //This is how we subscribe to becoming a notification provider for Maestro.
+    $observers = cache_get('maestro_notification_observers');
+    if($observers === FALSE) {  //build the observer cache
+      //need to scan through each available class type and fetch its corresponding context menu.
+      foreach (module_implements('maestro_notification_observer') as $module) {
+        $function = $module . '_maestro_notification_observer';
+        if ($declaredObserver = $function()) {
+          foreach($declaredObserver as $observerToCache) {
+            $observers[] = $observerToCache;
+            $this->_observers[] = $observerToCache;
+          }
+        }
+      }
+      cache_set('maestro_notification_observers', $observers);
+    }
+    else {
+      $this->_observers = ($observers->data);
+    }
+  }
+
+  function setNotificationSubjectAndMessage($defaultMessage, $defaultSubject) {
+    global $base_url;
+
+    $fields = array();
+    $fields[MaestroNotificationTypes::ASSIGNMENT] = 'pre_notify';
+    $fields[MaestroNotificationTypes::COMPLETION] = 'post_notify';
+    $fields[MaestroNotificationTypes::REMINDER] = 'reminder';
+    $fields[MaestroNotificationTypes::ESCALATION] = 'escalation';
+
+    $query = db_select('maestro_queue', 'a');
+    $query->leftJoin('maestro_template_data', 'b', 'a.template_data_id=b.id');
+    $query->leftJoin('maestro_template', 'c', 'b.template_id=c.id');
+    $query->fields('b', array('taskname'));
+    $query->fields('c', array('template_name'));
+    $query->addField('b', $fields[$this->_notificationType] . '_message', 'message');
+    $query->addField('b', $fields[$this->_notificationType] . '_subject', 'subject');
+    $query->condition('a.id', $this->_queueID, '=');
+    $rec = $query->execute()->fetchObject();
+
+    $message = ($rec->message == '') ? $defaultMessage : $rec->message;
+    $subject = ($rec->subject == '') ? $defaultSubject : $rec->subject;
+
+    //now apply the string replace for the tokens
+    $tokens = array('task_console_url' => '[task_console_url]', 'workflow_name' => '[workflow_name]', 'task_name' => '[task_name]', 'task_owner' => '[task_owner]');
+    $replace = array();
+    $replace['task_console_url'] = $base_url . url('maestro/taskconsole');
+    $replace['task_name'] = $rec->taskname;
+    $replace['workflow_name'] = $rec->template_name;
+
+    $userQuery = db_select('maestro_production_assignments', 'a');
+    $userQuery->leftJoin('users', 'b', 'a.uid=b.uid');
+    $userQuery->fields('b', array('name'));
+    $userQuery->condition('a.task_id', $this->_queueID, '=');
+    $userRes = $userQuery->execute()->fetchAll();
+
+    $replace['task_owner'] = '';
+    foreach ($userRes as $userRec) {
+      if ($replace['task_owner'] != '') {
+        $replace['task_owner'] .= ', ';
+      }
+      $replace['task_owner'] .= $userRec->name;
+    }
+
+    $message = str_replace($tokens, $replace, $message);
+    $subject = str_replace($tokens, $replace, $subject);
+
+    $this->_message = $message;
+    $this->_subject = $subject;
+  }
+
+  function getNotificationUserIDs() {
+    if(intval($this->_queueID) > 0 && $this->_notificationType != '') {
+      $query = db_select('maestro_queue', 'a');
+      $query->fields('a', array('process_id', 'template_data_id'));
+      $query->condition('a.id', $this->_queueID, '=');
+      $qRec = current($query->execute()->fetchAll());
+
+      $query = db_select('maestro_template_notification', 'a');
+      $query->leftJoin('users', 'b', 'a.notify_id=b.uid');
+      $query->fields('a', array('notify_id', 'notify_type', 'notify_when', 'notify_by'));
+      $query->fields('b', array('uid', 'mail'));
+      $query->condition('a.notify_when', $this->_notificationType, '=');
+      $query->condition('a.notify_type', MaestroAssignmentTypes::USER, '=');   //@TODO: add support for ROLE and GROUP types
+      $query->condition('a.template_data_id', $qRec->template_data_id);
+      $res = $query->execute()->fetchAll();
+
+      $this->_userIDArray = array();
+      $this->_userEmailArray = array();
+      foreach ($res as $rec) {
+        if ($rec->notify_by == MaestroAssignmentBy::VARIABLE) {
+          $query2 = db_select('maestro_process_variables', 'a');
+          $query2->leftJoin('users', 'b', 'a.variable_value=b.uid');
+          $query2->fields('b', array('uid', 'mail'));
+          $query2->condition('a.process_id', $qRec->process_id, '=');
+          $query2->condition('a.template_variable_id', $rec->notify_id, '=');
+          $userRec = current($query2->execute()->fetchAll());
+
+          $this->_userIDArray[$rec->uid] = $userRec->uid;
+          $this->_userEmailArray[$rec->uid] = $userRec->mail;
+        }
+        else {
+          $this->_userIDArray[$rec->uid] = $rec->uid;
+          $this->_userEmailArray[$rec->uid] = $rec->mail;
+        }
+      }
+    }
+    else {
+      return FALSE;
+    }
+  }
+
+  function getQueueId() {
+    return $this->_queueID;
+  }
+
+  function setQueueId($id) {
+    $this->_queueID = $id;
+  }
+
+  function getNotificationType() {
+    return $this->_notificationType;
+  }
+
+  function setNotificationType($type) {
+    $this->_notificationType = $type;
+  }
+
+  function getSubject() {
+    return $this->_subject;
+  }
+
+  function setSubject($subject) {
+    $this->_subject = $subject;
+  }
+
+  function getMessage() {
+    return $this->_message;
+  }
+
+  function setMessage($message) {
+    $this->_message = $message;
+  }
+
+  function setUserIDs($userIDs) {
+    if(is_array($userIDs) && count($userIDs) > 0) {
+      $this->_userIDArray = $userIDs;
+    }
+    else {
+      $this->_userIDArray = array();
+      $this->_userIDArray[] = $userIDs;
+    }
+  }
+
+  function getUserIDs(){
+    return $this->_userIDArray;
+  }
+
+  function getUserEmailAddresses($userid = 0) {
+    $userid = intval($userid);
+    if ($userid == 0) return $this->_userEmailArray;
+
+    //add the array entry if it doesnt exist (like in some cases with the outstandind task reminder action
+    if (!array_key_exists($userid, $this->_userEmailArray) && $userid > 0) {
+      $query = db_select('users', 'a');
+      $query->fields('a', array('uid', 'mail'));
+      $query->condition('a.uid', $userid, '=');
+      $userRec = current($query->execute()->fetchAll());
+
+      $this->_userIDArray[$userRec->uid] = $userRec->uid;
+      $this->_userEmailArray[$userRec->uid] = $userRec->mail;
+    }
+
+    return $this->_userEmailArray[$userid];
+  }
+
+  public function attach(MaestroNotificationObserver $observer) {
+    $this->_observers[] = $observer;
+  }
+
+  /*
+   * notify method
+   * Responsible for pushing out the notifications to the subscribed notification mechanisms
+   * Notify will be disabled when the configuration option is disabled.
+   */
+  public function notify() {
+    if(variable_get('maestro_enable_notifications',1) == 1) {
+      //we are now going to check if the maestro_enabled_notifiers is set.  If its not set, we will just set all observers to be enabled
+      $enabled_notifiers = variable_get('maestro_enabled_notifiers');
+      if($enabled_notifiers == NULL) {
+        if(is_array($this->_observers) && count($this->_observers) > 0 ) {
+          foreach($this->_observers as $obj) {
+            if(class_exists($obj)) {
+             $notifyObject = new $obj();
+              $notifyObject->notify($this);
+            }
+          }
+        }
+      }
+      else {
+        foreach($enabled_notifiers as $obj) {
+          if(class_exists($obj)) {
+            $notifyObject = new $obj();
+            $notifyObject->notify($this);
+          }
+        }
+      }
+    }
+  }
+}
+
+
+/*
+ * Here is the implementation of the observer pattern where we implement the MaestroNotificationObserver interface.
+ * The only method we MUST implement is the notify where we accept the passed in object by reference to save memory.
+ */
+
+class MaestroEmailNotification extends MaestroNotificationObserver {
+
+  public function __construct() {
+    $this->displayName = "Maestro Email Notifier";
+  }
+
+  public function notify(MaestroNotification &$obj) {
+    //now, we're offloading the notification to this class to do whatever it needs to do.
+    $from = variable_get('site_mail', 'admin@example.com');
+    $send = TRUE;
+    if(is_array($obj->getUserIDs())) {
+      foreach($obj->getUserIDs() as $userID) {
+        $to =  $obj->getUserEmailAddresses($userID);
+        $params = array('message' => $obj->getMessage(), 'subject' => $obj->getSubject(), 'queueID' => $obj->getQueueId());
+        $result = drupal_mail('maestro', $obj->getNotificationType(), $to, language_default(), $params, $from, $send);
+      }
+    }
+  }
+
+}
+
+
+class MaestroWatchDogNotification extends MaestroNotificationObserver {
+
+  public function __construct() {
+    $this->displayName = "Watchdog Notifier";
+  }
+
+  public function notify(MaestroNotification &$obj) {
+    if(is_array($obj->getUserIDs())) {
+      foreach($obj->getUserIDs() as $userID) {
+        watchdog('Maestro', "Notification issued for UserID: ". $userID . " email address: " . $obj->getUserEmailAddresses($userID));
+      }
+    }
+  }
+}
+
+
+/*
+ * This is just a sample stub observer pattern for anyone to use and how simple it is to implement
+ * You need to enable this observer in the maestro.module file in the maestro_maestro_notification_observer function
+ * by adding 'SAMPLEMaestroTwitterNotification' in the return array.  Clear your cache and this observer pattern will
+ * automatically be added and subscribed.
+ * If you are writing your own Maestro task/notification module, please implement your own MODULENAME_maestro_notification_observer hook
+ * and do not edit the main maestro.module file.
+ */
+
+class SAMPLEMaestroTwitterNotification extends MaestroNotificationObserver {
+
+  public function __construct() {
+    $this->displayName = "Sample Twitter Notifier";
+  }
+
+  public function notify(MaestroNotification &$obj) {
+    if(is_array($obj->getUserIDs())) {
+      foreach($obj->getUserIDs() as $userID) {
+        //send a twitter update however that is done :-)
+        //echo "twitter update to userID:" . $userID;
+      }
+    }
+  }
+}
+
diff --git a/sites/all/modules/maestro/maestro_task_interface.class.php b/sites/all/modules/maestro/maestro_task_interface.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..5dc67ced88013f306c5686af4d527ddcea9b745d
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_task_interface.class.php
@@ -0,0 +1,1123 @@
+<?php
+// $Id: maestro_task_interface.class.php,v 1.61 2010/12/23 13:44:02 randy Exp $
+
+/**
+ * @file
+ * maestro_task_interface.class.php
+ */
+
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_notification.class.php';
+
+abstract class MaestroTaskInterface {
+  protected $_task_id;
+  protected $_template_id;
+  protected $_task_type;
+  protected $_is_interactive;
+  protected $_task_data;  //used when fetching task information
+  protected $_task_edit_tabs;
+  protected $_taskname;
+
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_id = $task_id;
+    $this->_task_data = NULL;
+    $this->_task_process_data = NULL;
+
+    if ($template_id == 0 && $task_id > 0) {
+      $res = db_select('maestro_template_data', 'a');
+      $res->fields('a', array('template_id', 'taskname'));
+      $res->condition('a.id', $task_id, '=');
+      $rec = current($res->execute()->fetchAll());
+
+      $this->_taskname = $rec->taskname;
+      $this->_template_id = intval(@($rec->template_id));
+    }
+    else {
+      $this->_template_id = $template_id;
+    }
+
+    if ($this->_is_interactive == MaestroInteractiveFlag::IS_INTERACTIVE) {
+      $this->_task_edit_tabs = array('assignment' => 1, 'notification' => 1);
+    }
+    else {
+      $this->_task_edit_tabs = array();
+    }
+  }
+
+  function get_task_id(){
+    return $this->_task_id;
+  }
+
+  protected function _fetchTaskInformation() {
+    $res = db_select('maestro_template_data', 'a');
+    $res->fields('a', array('task_data'));
+    $res->condition('a.id', $this->_task_id, '=');
+    $td_rec = current($res->execute()->fetchAll());
+    $td_rec->task_data = unserialize($td_rec->task_data);
+
+    $this->_task_data = $td_rec;
+  }
+
+  //create task will insert the shell record of the task, and then the child class will handle the edit.
+  function create() {
+    $rec = new stdClass();
+    $rec->template_id = $this->_template_id;
+    $rec->taskname = t('New Task');
+    $this->_taskname = $rec->taskname;
+    $rec->task_class_name = 'MaestroTaskType' . $this->_task_type;
+    $rec->is_interactive = $this->_is_interactive;
+    if ($this->_is_interactive) {
+      $rec->assigned_by_variable = 1;
+      $rec->show_in_detail = 1;
+    }
+    $rec->first_task = 0;
+    $rec->offset_left = $_POST['offset_left'];
+    $rec->offset_top = $_POST['offset_top'];
+    drupal_write_record('maestro_template_data', $rec);
+    $this->_task_id = $rec->id;
+
+    return array('html' => $this->displayTask());
+  }
+
+  //deletes the task
+  function destroy() {
+    $res = db_select('maestro_queue', 'a');
+    $res->fields('a', array('id'));
+    $res->condition('template_data_id', $this->_task_id, '=');
+    $rec = current($res->execute()->fetchAll());
+
+    if ((array_key_exists('confirm_delete', $_POST) && $_POST['confirm_delete'] == 1) || $rec == '') {
+      db_query("DELETE FROM {maestro_template_data} WHERE id=:tdid", array(':tdid' => $this->_task_id));
+      db_query("DELETE FROM {maestro_template_assignment} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+
+      //RK -- This query has been simplified to remove the db_query replacement facility as it fails in SQL Server
+      $tdID = intval($this->_task_id);
+      db_query("DELETE FROM {maestro_template_data_next_step} WHERE template_data_to={$tdID} OR template_data_to_false={$tdID} OR template_data_from={$tdID}");
+
+      db_query("DELETE FROM {maestro_queue} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+      $retval = '';
+      $success = 1;
+    }
+    else {
+      $retval  = t("There are still outstanding tasks in the queue that depend on this task! Deleting this task will delete the queue records too.");
+      $retval .= '<br>';
+      $retval .= t("Continue with delete?");
+      $retval .= '&nbsp;&nbsp;&nbsp;';
+      $retval .= "<input type=\"button\" value=\"" . t('Yes') . "\" onclick=\"set_tool_tip(''); ";
+      $retval .= "enable_ajax_indicator(); (function($) {\$.ajax({
+        type: 'POST',
+        url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/destroy/',
+        cache: false,
+        data: {confirm_delete: 1},
+        dataType: 'json',
+        success: delete_task,
+        error: editor_ajax_error
+      }); })(jQuery);\">";
+      $retval .= "<input type=\"button\" value=\"" . t('No') . "\" onclick=\"set_tool_tip('');\">";
+      $success = 0;
+    }
+
+    return array('message' => $retval, 'success' => $success, 'task_id' => $this->_task_id);
+  }
+
+  function displayTask() {
+    $res = db_select('maestro_template_data', 'a');
+    $res->fields('a', array('id', 'taskname', 'task_class_name', 'is_interactive', 'offset_left', 'offset_top'));
+    $res->condition('a.id', $this->_task_id, '=');
+    $rec = current($res->execute()->fetchAll());
+
+    $task_type = substr($rec->task_class_name, 15);
+    $task_class = 'MaestroTaskInterface' . $task_type;
+
+    return theme('maestro_workflow_task_frame', array('rec' => $rec, 'ti' => $this, 'task_class' => $task_class));
+  }
+
+  function edit() {
+    global $base_url;
+    $maestro_url = $base_url . '/' . drupal_get_path('module', 'maestro');
+
+    $res = db_select('maestro_template_data', 'a');
+    $res->fields('a', array('task_class_name', 'taskname', 'regenerate', 'regen_all_live_tasks', 'show_in_detail', 'pre_notify_subject', 'pre_notify_message', 'post_notify_subject', 'post_notify_message', 'reminder_subject', 'reminder_message', 'escalation_subject', 'escalation_message', 'reminder_interval', 'escalation_interval'));
+    $res->condition('a.id', $this->_task_id, '=');
+    $vars = current($res->execute()->fetchAll());
+
+    $task_type = substr($vars->task_class_name, 15);
+    $task_class = 'MaestroTaskInterface' . $task_type;
+
+    $uid_options = array();
+    $pv_options = array();
+    $role_options = array();
+    $og_options = array();
+
+    if ((array_key_exists('assignment', $this->_task_edit_tabs) && $this->_task_edit_tabs['assignment'] == 1) ||
+        (array_key_exists('notification', $this->_task_edit_tabs) && $this->_task_edit_tabs['notification'] == 1)) {
+      $res = db_query("SELECT uid AS id, name FROM {users} WHERE uid > 0");
+      foreach ($res as $rec) {
+        $uid_options[$rec->id] = $rec->name;
+      }
+
+      $res = db_query("SELECT id, variable_name AS name FROM {maestro_template_variables} WHERE template_id=:tid", array(':tid' => $this->_template_id));
+      foreach ($res as $rec) {
+        $pv_options[$rec->id] = $rec->name;
+      }
+
+      $res = db_query("SELECT rid AS id, name FROM {role}");
+      foreach ($res as $rec) {
+        $role_options[$rec->id] = $rec->name;
+      }
+
+      //TODO: add $og_option builder logic here
+    }
+
+    //initialize the selected array
+    $types = MaestroAssignmentTypes::getStatusLabel();
+    $bys = MaestroAssignmentBy::getStatusLabel();
+    $whens = MaestroNotificationTypes::getStatusLabel();
+
+    $selected_options = array();
+    for ($i = 1; $i <= 2; $i++) {        //1: assignment / 2: notification
+      $selected_options[$i] = array();
+
+      foreach($types as $j => $opt) {
+        $selected_options[$i][$j] = array();
+
+        foreach($bys as $k => $opt) {
+          $selected_options[$i][$j][$k] = array();
+
+            foreach($whens as $l => $opt) {
+            $selected_options[$i][$j][$k][$l] = array();
+          }
+        }
+      }
+    }
+
+    if (array_key_exists('assignment', $this->_task_edit_tabs) && $this->_task_edit_tabs['assignment'] == 1) {
+      $res = db_query("SELECT assign_type, assign_by, assign_id FROM {maestro_template_assignment} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+      foreach ($res as $rec) {
+        $selected_options[1][$rec->assign_type][$rec->assign_by][1][] = $rec->assign_id;
+      }
+    }
+
+    if (array_key_exists('notification', $this->_task_edit_tabs) && $this->_task_edit_tabs['notification'] == 1) {
+      $res = db_query("SELECT notify_type, notify_by, notify_when, notify_id FROM {maestro_template_notification} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+      foreach ($res as $rec) {
+        $selected_options[2][$rec->notify_type][$rec->notify_by][$rec->notify_when][] = $rec->notify_id;
+      }
+    }
+
+    $optional_parms = array();
+    if (array_key_exists('optional', $this->_task_edit_tabs) && $this->_task_edit_tabs['optional'] == 1) {
+      $res = db_select('maestro_template_data', 'a');
+      $res->fields('a', array('task_data'));
+      $res->condition('a.id', $this->_task_id, '=');
+      $rec = current($res->execute()->fetchAll());
+      $rec->task_data = unserialize($rec->task_data);
+
+      if (is_array($rec->task_data) && array_key_exists('optional_parm', $rec->task_data)) {
+        foreach ($rec->task_data['optional_parm'] as $var_name => $var_value) {
+          $optional_parms[$var_name] = $var_value;
+        }
+      }
+    }
+
+    return array('html' => theme('maestro_workflow_edit_tasks_frame', array('tdid' => $this->_task_id, 'tid' => $this->_template_id, 'form_content' => $this->getEditFormContent(), 'maestro_url' => $maestro_url, 'pv_options' => $pv_options, 'uid_options' => $uid_options, 'role_options' => $role_options, 'og_options' => $og_options, 'selected_options' => $selected_options, 'task_class' => $task_class, 'vars' => $vars, 'task_edit_tabs' => $this->_task_edit_tabs, 'optional_parms' => $optional_parms, 'types' => MaestroAssignmentTypes::getStatusLabel(), 'bys' => MaestroAssignmentBy::getStatusLabel(), 'whens' => MaestroNotificationTypes::getStatusLabel())));
+  }
+
+  function save() {
+    $res = db_select('maestro_template_data', 'a');
+    $res->fields('a', array('id', 'task_data'));
+    $res->condition('a.id', $this->_task_id, '=');
+    $rec = current($res->execute()->fetchAll());
+
+    $types = MaestroAssignmentTypes::getStatusLabel();
+    $bys = MaestroAssignmentBy::getStatusLabel();
+    $whens = MaestroNotificationTypes::getStatusLabel();
+
+    db_query("DELETE FROM {maestro_template_assignment} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+    if (array_key_exists('assignment', $this->_task_edit_tabs) && $this->_task_edit_tabs['assignment'] == 1) {
+      foreach ($types as $type => $opt) {
+        foreach ($bys as $by_var => $opt) {
+          if (array_key_exists("assign_ids_{$type}_{$by_var}_1", $_POST)) {
+            foreach ($_POST["assign_ids_{$type}_{$by_var}_1"] as $id) {
+              db_query("INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:tdid, :type, :by_var, :id)", array(':tdid' => $this->_task_id, ':type' => $type, ':by_var' => $by_var, ':id' => $id));
+            }
+          }
+        }
+      }
+    }
+
+    db_query("DELETE FROM {maestro_template_notification} WHERE template_data_id=:tdid", array(':tdid' => $this->_task_id));
+    if (array_key_exists('notification', $this->_task_edit_tabs) && $this->_task_edit_tabs['notification'] == 1) {
+      foreach ($types as $type => $opt) {
+        foreach ($bys as $by_var => $opt) {
+          foreach ($whens as $when => $opt) {
+            if (array_key_exists("notify_ids_{$type}_{$by_var}_{$when}", $_POST)) {
+              foreach ($_POST["notify_ids_{$type}_{$by_var}_{$when}"] as $id) {
+                db_query("INSERT INTO {maestro_template_notification} (template_data_id, notify_type, notify_by, notify_when, notify_id) VALUES (:tdid, :type, :by_var, :when, :id)", array(':tdid' => $this->_task_id, ':type' => $type, ':by_var' => $by_var, 'when' => $when, ':id' => $id));
+              }
+            }
+          }
+        }
+      }
+
+      $rec->pre_notify_subject = $_POST['pre_notify_subject'];
+      $rec->pre_notify_message = $_POST['pre_notify_message'];
+      $rec->post_notify_subject = $_POST['post_notify_subject'];
+      $rec->post_notify_message = $_POST['post_notify_message'];
+      $rec->reminder_subject = $_POST['reminder_subject'];
+      $rec->reminder_message = $_POST['reminder_message'];
+      $rec->escalation_subject = $_POST['escalation_subject'];
+      $rec->escalation_message = $_POST['escalation_message'];
+      $rec->reminder_interval = $_POST['reminder_interval'];
+      $rec->escalation_interval = $_POST['escalation_interval'];
+    }
+
+    if (array_key_exists('optional', $this->_task_edit_tabs) && $this->_task_edit_tabs['optional'] == 1) {
+      $optional_parms = array();
+
+      if (array_key_exists('op_var_names', $_POST)) {
+        foreach ($_POST['op_var_names'] as $key => $var_name) {
+          if ($var_name != '') {
+            $optional_parms[$var_name] = $_POST['op_var_values'][$key];
+          }
+        }
+      }
+
+      $rec->task_data = unserialize($rec->task_data);
+      $rec->task_data['optional_parm'] = $optional_parms;
+      $rec->task_data = serialize($rec->task_data);
+    }
+
+    $rec->taskname = $_POST['taskname'];
+    if (array_key_exists('regen', $_POST)) {
+      $rec->regenerate = $_POST['regen'];
+    }
+    if (array_key_exists('regenall', $_POST)) {
+      $rec->regen_all_live_tasks = $_POST['regenall'];
+    }
+    if (array_key_exists('showindetail', $_POST)) {
+      $rec->show_in_detail = $_POST['showindetail'];
+    }
+
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return array('task_id' => $this->_task_id);
+  }
+
+  //handles the update for the drag and drop
+  function move() {
+    $offset_left = intval($_POST['offset_left']);
+    $offset_top = intval($_POST['offset_top']);
+
+    if ($offset_left < 0) $offset_left = 0;
+    if ($offset_top < 0) $offset_top = 0;
+
+    db_query("UPDATE {maestro_template_data} SET offset_left=:ofl, offset_top=:ofr WHERE id=:tdid", array(':ofl' => $offset_left, ':ofr' => $offset_top, ':tdid' => $this->_task_id));
+  }
+
+  //handles the update when adding a line (insert the next step record)
+  function drawLine() {
+    $res = db_select('maestro_template_data_next_step', 'a');
+    $res->fields('a', array('id'));
+
+    $cond1 = db_or()->condition('a.template_data_to', $_POST['line_to'], '=')->condition('a.template_data_to_false', $_POST['line_to'], '=');
+    $cond1fin = db_and()->condition('a.template_data_from', $this->_task_id, '=')->condition($cond1);
+
+    $cond2 = db_or()->condition('a.template_data_to', $this->_task_id, '=')->condition('a.template_data_to_false', $this->_task_id, '=');
+    $cond2fin = db_and()->condition('a.template_data_from', $_POST['line_to'], '=')->condition($cond2);
+
+    $cond = db_or()->condition($cond1fin)->condition($cond2fin);
+
+    $res->condition($cond);
+    $rec = current($res->execute()->fetchAll());
+
+    if ($rec == '') {
+      $rec = new stdClass();
+      $rec->template_data_from = $this->_task_id;
+      $rec->template_data_to = $_POST['line_to'];
+      $rec->template_data_to_false = 0;
+      drupal_write_record('maestro_template_data_next_step', $rec);
+    }
+    else {
+      //perhaps return a simple true/false with error message if the select failed
+    }
+  }
+
+  //in theory only the if task will use this method
+  function drawLineFalse() {
+    $res = db_select('maestro_template_data_next_step', 'a');
+    $res->fields('a', array('id'));
+
+    $cond1 = db_or()->condition('a.template_data_to', $_POST['line_to'], '=')->condition('a.template_data_to_false', $_POST['line_to'], '=');
+    $cond1fin = db_and()->condition('a.template_data_from', $this->_task_id, '=')->condition($cond1);
+
+    $cond2 = db_or()->condition('a.template_data_to', $this->_task_id, '=')->condition('a.template_data_to_false', $this->_task_id, '=');
+    $cond2fin = db_and()->condition('a.template_data_from', $_POST['line_to'], '=')->condition($cond2);
+
+    $cond = db_or()->condition($cond1fin)->condition($cond2fin);
+
+    $res->condition($cond);
+    $rec = current($res->execute()->fetchAll());
+
+    if ($rec == '') {
+      $rec = new stdClass();
+      $rec->template_data_from = $this->_task_id;
+      $rec->template_data_to = 0;
+      $rec->template_data_to_false = $_POST['line_to'];
+      drupal_write_record('maestro_template_data_next_step', $rec);
+    }
+    else {
+      //perhaps return a simple true/false with error message if the select failed
+    }
+  }
+
+  //remove any next step records pertaining to this task
+  function clearAdjacentLines() {
+    //RK -- had to change the logic on this delete as PDO for SQL Server was failing for some reason even though the
+    //resulting query was 100% correct.
+    $taskid=intval($this->_task_id);
+    db_query("DELETE FROM {maestro_template_data_next_step} WHERE template_data_from={$taskid} OR template_data_to={$taskid} OR template_data_to_false={$taskid}");
+  }
+
+  //returns an array of options for when the user right-clicks the task
+  function getContextMenu() {
+    $draw_line_msg = t('Select a task to draw the line to.');
+    $options = array (
+      'draw_line' => array(
+        'label' => t('Draw Line'),
+        'js' => "draw_status = 1; draw_type = 1; line_start = document.getElementById('task{$this->_task_id}'); set_tool_tip('$draw_line_msg');\n"
+      ),
+      'clear_lines' => array(
+        'label' => t('Clear Adjacent Lines'),
+        'js' => "clear_task_lines(document.getElementById('task{$this->_task_id}'));\n"
+      ),
+      'edit_task' => array(
+        'label' => t('Edit Task'),
+        'js' => "enable_ajax_indicator(); \$.ajax({
+          type: 'POST',
+          url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/edit/',
+          cache: false,
+          dataType: 'json',
+          success: display_task_panel,
+          error: editor_ajax_error
+        });"
+      ),
+      'delete_task' => array(
+        'label' => t('Delete Task'),
+        'js' => "enable_ajax_indicator(); \$.ajax({
+          type: 'POST',
+          url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/destroy/',
+          cache: false,
+          success: delete_task,
+          dataType: 'json',
+          error: editor_ajax_error
+        });\n"
+      )
+    );
+
+    return $options;
+  }
+
+  function getContextMenuHTML() {
+    $options = $this->getContextMenu();
+    $html = "<div id=\"maestro_task{$this->_task_id}_context_menu\" class=\"maestro_context_menu\"><ul>\n";
+
+    foreach ($options as $key => $option) {
+      $option = t($option);
+      $html .= "<li style=\"white-space: nowrap;\" id=\"$key\">{$option['label']}</li>\n";
+    }
+    $html .= "</ul></div>\n";
+
+    return $html;
+  }
+
+  function getContextMenuJS() {
+    $options = $this->getContextMenu();
+    $js  = "(function ($) {\n";
+    $js .= "\$('#task{$this->_task_id}').contextMenu('maestro_task{$this->_task_id}_context_menu', {\n";
+    $js .= "menuStyle: {\n";
+    $js .= "width: 175,\n";
+    $js .= "fontSize: 12,\n";
+    $js .= "},\n";
+
+    $js .= "itemStyle: {\n";
+    $js .= "padding: 0,\n";
+    $js .= "paddingLeft: 10,\n";
+    $js .= "},\n";
+
+    $js .= "bindings: {\n";
+
+    foreach ($options as $key => $option) {
+      $js .= "'$key': function(t) {\n";
+      $js .= $option['js'];
+      $js .= "},\n";
+    }
+
+    $js .= "}\n";
+    $js .= "});\n";
+    $js .= "})(jQuery);\n";
+
+    return $js;
+  }
+
+  function getAssignmentDisplay() {
+    $display = t('Assigned to:') . ' ';
+
+    $query = db_select('maestro_template_assignment', 'a');
+    $query->leftJoin('maestro_template_variables', 'b', 'a.assign_id=b.id');
+    $query->leftJoin('users', 'c', 'a.assign_id=c.uid');
+    $query->leftJoin('role', 'd', 'a.assign_id=d.rid');
+    $query->fields('a', array('assign_id', 'assign_type', 'assign_by'));
+    $query->fields('b', array('variable_name'));
+    $query->addField('c', 'name', 'username');
+    $query->addField('d', 'name', 'rolename');
+    $query->condition('a.template_data_id', $this->_task_id, '=');
+
+    $res = $query->execute();
+
+    $assigned_list = '';
+    foreach ($res as $rec) {
+      if ($assigned_list != '') {
+        $assigned_list .= ', ';
+      }
+
+      if ($rec->assign_by == MaestroAssignmentBy::FIXED) {
+        switch ($rec->assign_type) {
+        case MaestroAssignmentTypes::USER:
+          $assigned_list .= $rec->username;
+          break;
+
+        case MaestroAssignmentTypes::ROLE:
+          $assigned_list .= $rec->rolename;
+          break;
+
+        case MaestroAssignmentTypes::GROUP:
+          //@TODO: add support for organic groups
+          break;
+        }
+      }
+      else {
+        $assigned_list .= $rec->variable_name;
+      }
+    }
+
+    if ($assigned_list == '') {
+      $assigned_list = '<i>' . t('nobody') . '</i>';
+    }
+    $display .= $assigned_list;
+
+    return $display;
+  }
+
+  function getHandlerOptions() {
+    $all_handler_options = cache_get('maestro_handler_options');
+    $handler_options = array();
+    if (array_key_exists('MaestroTaskType' . $this->_task_type, $all_handler_options->data)) {
+      $handler_options = $all_handler_options->data['MaestroTaskType' . $this->_task_type];
+    }
+
+    return $handler_options;
+  }
+
+  function setCanvasHeight() {
+    $rec = new stdClass();
+    $rec->id = $this->_template_id;
+    $rec->canvas_height = $_POST['height'];
+    drupal_write_record('maestro_template', $rec, array('id'));
+  }
+
+  /*
+   * Receive an incoming serialized data chunk.. return it to the callee serialized.
+   */
+  function modulateExportTaskData($data, $xref_array) {
+    return $data;
+  }
+
+  /*
+   * During the import routine, we take the exported username and try to find the UID.
+   */
+  function modulateExportUser($username) {
+    $query = db_select('users', 'a');
+    $query->fields('a',array('uid'));
+    $query->condition('a.name',$username,'=');
+    $uid=current($query->execute()->fetchAll());
+    if(is_object($uid)) {
+      return intval($uid->uid);
+    }
+    else {
+      return 0;
+    }
+  }
+
+
+  abstract function display();
+  abstract function getEditFormContent();
+}
+
+class MaestroTaskInterfaceUnknown extends MaestroTaskInterface {
+  public $_task_class;
+
+  function __construct($task_id=0, $template_id=0, $task_class) {
+    $this->_task_type = 'Unknown';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+    $this->_task_class = $task_class;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function display() {
+    return theme('maestro_task_unknown', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    return '';
+  }
+
+  function getContextMenu() {
+    $draw_line_msg = t('Select a task to draw the line to.');
+    $options = array (
+      'draw_line' => array(
+        'label' => t('Draw Line'),
+        'js' => "draw_status = 1; draw_type = 1; line_start = document.getElementById('task{$this->_task_id}'); set_tool_tip('$draw_line_msg');\n"
+      ),
+      'clear_lines' => array(
+        'label' => t('Clear Adjacent Lines'),
+        'js' => "clear_task_lines(document.getElementById('task{$this->_task_id}'));\n"
+      ),
+      'delete_task' => array(
+        'label' => t('Delete Task'),
+        'js' => "enable_ajax_indicator(); \$.ajax({
+          type: 'POST',
+          url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/destroy/',
+          cache: false,
+          success: delete_task,
+          dataType: 'json',
+          error: editor_ajax_error
+        });\n"
+      )
+    );
+
+    return $options;
+  }
+}
+
+class MaestroTaskInterfaceStart extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'Start';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function create() {
+    parent::create();
+    $update=db_update('maestro_template_data')
+      ->fields(array( 'taskname' => t('Start'),
+                      'first_task' => 1,
+                      'offset_left' => 34,
+                      'offset_top' => 38
+
+      ))
+      ->condition('id', $this->_task_id)
+      ->execute();
+  }
+
+  function display() {
+    return theme('maestro_task_start', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    return '';
+  }
+
+  function getContextMenu() {
+    $draw_line_msg = t('Select a task to draw the line to.');
+    $options = array (
+      'draw_line' => array(
+        'label' => t('Draw Line'),
+        'js' => "draw_status = 1; draw_type = 1; line_start = document.getElementById('task{$this->_task_id}'); set_tool_tip('$draw_line_msg');\n"
+      ),
+      'clear_lines' => array(
+        'label' => t('Clear Adjacent Lines'),
+        'js' => "clear_task_lines(document.getElementById('task{$this->_task_id}'));\n"
+      )
+    );
+
+    return $options;
+  }
+}
+
+class MaestroTaskInterfaceEnd extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'End';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function create() {
+    parent::create();
+    $update=db_update('maestro_template_data')
+      ->fields(array( 'taskname' => t('End'),
+                      'offset_left' => 280,
+                      'offset_top' => 200
+      ))
+      ->condition('id', $this->_task_id)
+      ->execute();
+  }
+
+  function display() {
+    return theme('maestro_task_end', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    return '';
+  }
+
+  function getContextMenu() {
+    $options = array (
+      'clear_lines' => array(
+        'label' => t('Clear Adjacent Lines'),
+        'js' => "clear_task_lines(document.getElementById('task{$this->_task_id}'));\n"
+      )
+    );
+
+    return $options;
+  }
+}
+
+class MaestroTaskInterfaceIf extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'If';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function modulateExportTaskData($data, $xref_array) {
+    $fixed_data = @unserialize($data);
+    if($fixed_data !== FALSE) {
+      if($fixed_data['if_argument_variable'] != '') $fixed_data['if_argument_variable'] = $xref_array[$fixed_data['if_argument_variable']];
+      return serialize($fixed_data);
+    }
+    else {
+      return $data;
+    }
+  }
+
+  function display() {
+    return theme('maestro_task_if', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+
+    $res = db_query("SELECT id, variable_name, variable_value FROM {maestro_template_variables} WHERE template_id=:tid", array('tid' => $this->_template_id));
+    $argument_variables = "<option></option>";
+    foreach ($res as $rec) {
+      $selected = '';
+      if($this->_task_data->task_data['if_argument_variable'] == $rec->id) $selected = " selected ";
+      $argument_variables .= "<option value='{$rec->id}' {$selected}>{$rec->variable_name}</option>";
+    }
+
+    return theme('maestro_task_if_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'argument_variables' => $argument_variables));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+
+    if(check_plain($_POST['ifTaskArguments']) == 'status'){
+      $rec->task_data = serialize(array(
+                                    'if_operator' => '',
+                                    'if_value' => '',
+                                    'if_process_arguments' => $_POST['ifProcessArguments'],
+                                    'if_argument_variable' => '',
+                                    'if_task_arguments' => $_POST['ifTaskArguments']
+      ));
+    }
+    else {
+      $rec->task_data = serialize(array(
+                                    'if_operator' => $_POST['ifOperator'],
+                                    'if_value' => check_plain($_POST['ifValue']),
+                                    'if_process_arguments' => '',
+                                    'if_argument_variable' => $_POST['argumentVariable'],
+                                    'if_task_arguments' => $_POST['ifTaskArguments']
+      ));
+    }
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+
+  function getContextMenu() {
+    $draw_line_msg = t('Select a task to draw the line to.');
+    $options = array (
+      'draw_line' => array(
+        'label' => t('Draw Success Line'),
+        'js' => "draw_status = 1; draw_type = 1; line_start = document.getElementById('task{$this->_task_id}'); set_tool_tip('$draw_line_msg');\n"
+      ),
+      'draw_line_false' => array(
+        'label' => t('Draw Fail Line'),
+        'js' => "draw_status = 1; draw_type = 2; line_start = document.getElementById('task{$this->_task_id}'); set_tool_tip('$draw_line_msg');\n"
+      ),
+      'clear_lines' => array(
+        'label' => t('Clear Adjacent Lines'),
+        'js' => "clear_task_lines(document.getElementById('task{$this->_task_id}'));\n"
+      ),
+      'edit_task' => array(
+        'label' => t('Edit Task'),
+        'js' => "enable_ajax_indicator(); \$.ajax({
+          type: 'POST',
+          url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/edit/',
+          cache: false,
+          dataType: 'json',
+          success: display_task_panel,
+          error: editor_ajax_error
+        });"
+      ),
+      'delete_task' => array(
+        'label' => t('Delete Task'),
+        'js' => "enable_ajax_indicator(); \$.ajax({
+          type: 'POST',
+          url: ajax_url + 'MaestroTaskInterface{$this->_task_type}/{$this->_task_id}/0/destroy/',
+          cache: false,
+          dataType: 'json',
+          success: delete_task,
+          error: editor_ajax_error
+        });\n"
+      )
+    );
+
+    return $options;
+  }
+}
+
+class MaestroTaskInterfaceBatch extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'Batch';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+
+    $this->_task_edit_tabs = array('notification' => 1);
+  }
+
+  function display() {
+    return theme('maestro_task_batch', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    $this->_task_data->task_data['handler_location'] = variable_get('maestro_batch_script_location', drupal_get_path('module','maestro') . "/batch/");
+    return theme('maestro_task_batch_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array('handler' => $_POST['handler']));
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+}
+
+class MaestroTaskInterfaceBatchFunction extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'BatchFunction';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+
+    $this->_task_edit_tabs = array('optional' => 1, 'notification' => 1);
+  }
+
+  function display() {
+    return theme('maestro_task_batch_function', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    $batch_function = drupal_get_path('module','maestro') . "/batch/batch_functions.php";
+    $this->_task_data->task_data['handler_location'] = $batch_function;
+
+    $handler_options = $this->getHandlerOptions();
+
+    return theme('maestro_task_batch_function_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'handler_options' => $handler_options));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array('handler' => ($_POST['handler'] == '') ? $_POST['handler_other'] : $_POST['handler']));
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+}
+
+class MaestroTaskInterfaceInteractiveFunction extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_is_interactive = MaestroInteractiveFlag::IS_INTERACTIVE;
+    $this->_task_type = 'InteractiveFunction';
+
+    parent::__construct($task_id, $template_id);
+
+    $this->_task_edit_tabs = array('assignment' => 1, 'notification' => 1, 'optional' => 1);
+  }
+
+  function display() {
+    return theme('maestro_task_interactive_function', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    if (@($this->_task_data->optional_parm) == NULL) {
+      $this->_task_data->optional_parm = '';
+    }
+
+    $handler_options = $this->getHandlerOptions();
+
+    return theme('maestro_task_interactive_function_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'handler_options' => $handler_options));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array('handler' => ($_POST['handler'] == '') ? $_POST['handler_other'] : $_POST['handler']));
+
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+}
+
+class MaestroTaskInterfaceSetProcessVariable extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'SetProcessVariable';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function display() {
+    return theme('maestro_task_set_process_variable', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function modulateExportTaskData($data, $xref_array) {
+    $fixed_data = @unserialize($data);
+    if($fixed_data !== FALSE) {
+      $fixed_data['var_to_set'] = $xref_array[$fixed_data['var_to_set']];
+      return serialize($fixed_data);
+    }
+    else {
+      return $data;
+    }
+  }
+
+  function getEditFormContent() {
+    $methods = $this->getSetMethods();
+
+    $this->_fetchTaskInformation();
+    if (!is_array(@($this->_task_data->task_data)) || !array_key_exists('set_type', $this->_task_data->task_data)) {
+      $this->_task_data->task_data['var_to_set'] = '';
+      $this->_task_data->task_data['set_type'] = 0;
+
+      $i = 0;
+      foreach ($methods as $key => $method) {
+        if ($i++ == 0) {
+          $this->_task_data->task_data['set_type'] = $key;
+        }
+        $this->_task_data->task_data[$key . '_value'] = '';
+      }
+    }
+
+    $res = db_query("SELECT id, variable_name FROM {maestro_template_variables} WHERE template_id=:tid", array('tid' => $this->_template_id));
+    foreach ($res as $rec) {
+      $pvars[$rec->id] = $rec->variable_name;
+    }
+
+    return theme('maestro_task_set_process_variable_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'pvars' => $pvars, 'set_methods' => $methods));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $methods = $this->getSetMethods();
+    $task_data = array();
+    foreach ($methods as $key => $method) {
+      $task_data[$key . '_value'] = $_POST[$key . '_value'];
+    }
+    $task_data['var_to_set'] = $_POST['var_to_set'];
+    $task_data['set_type'] = $_POST['set_type'];
+    $rec->task_data = serialize($task_data);
+
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+
+  function getSetMethods() {
+    $set_process_variable_methods = cache_get('maestro_set_process_variable_methods');
+    if($set_process_variable_methods === FALSE) {
+      $set_process_variable_methods = array();
+      foreach (module_implements('maestro_set_process_variable_methods') as $module) {
+        $function = $module . '_maestro_set_process_variable_methods';
+        if ($arr = $function()) {
+          $set_process_variable_methods = maestro_array_merge_keys($set_process_variable_methods, $arr);
+        }
+      }
+      cache_set('maestro_set_process_variable_methods', $set_process_variable_methods);
+    }
+
+    $methods = cache_get('maestro_set_process_variable_methods');
+
+    return $methods->data;
+  }
+}
+
+class MaestroTaskInterfaceAnd extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'And';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function display() {
+    return theme('maestro_task_and', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    return '';
+  }
+}
+
+class MaestroTaskInterfaceManualWeb extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'ManualWeb';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+  }
+
+  function display() {
+    return theme('maestro_task_manual_web', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    return theme('maestro_task_manual_web_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array(
+                                    'handler' => $_POST['handler'],
+                                    'new_window' => $_POST['newWindow'],
+                                    'use_token' => $_POST['useToken'],
+
+      ));
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+}
+
+
+class MaestroTaskInterfaceContentType extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'ContentType';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_INTERACTIVE;
+    parent::__construct($task_id, $template_id);
+  }
+
+  function display() {
+    return theme('maestro_task_content_type', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    $content_types = node_type_get_types();
+
+    return theme('maestro_task_content_type_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'content_types' => $content_types));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array('content_type' => $_POST['content_type']));
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+    $retval = parent::save();
+
+    //clear the cache for maestro_content_types so on page load the new content type task will be added for sure
+    cache_clear_all();
+
+    return $retval;
+  }
+}
+
+
+class MaestroTaskInterfaceFireTrigger extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'FireTrigger';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_NOT_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+
+    $this->_task_edit_tabs = array('optional' => 1);
+  }
+
+  function display() {
+    return theme('maestro_task_fire_trigger', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    $query = db_select('trigger_assignments', 'a');
+    $query->fields('a', array('hook'));
+    $query->fields('b', array('aid', 'label'));
+    $query->leftJoin('actions', 'b', 'a.aid=b.aid');
+    $query->condition('a.hook', "fire_trigger_task{$this->_task_id}", '=');
+    $aa_res = $query->execute();
+
+    $options = array();
+    $functions = array();
+    $hook = 'fire_trigger_task' . $this->_task_id;
+    // Restrict the options list to actions that declare support for this hook.
+    foreach (actions_list() as $func => $metadata) {
+      if (isset($metadata['triggers']) && array_intersect(array($hook, 'any'), $metadata['triggers'])) {
+        $functions[] = $func;
+      }
+    }
+    foreach (actions_get_all_actions() as $aid => $action) {
+      if (in_array($action['callback'], $functions)) {
+        $options[$action['type']][$aid] = $action['label'];
+      }
+    }
+
+    return theme('maestro_task_fire_trigger_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'aa_res' => $aa_res, 'options' => $options));
+  }
+
+  function save() {
+    $actions = $_POST['actions'];
+    $hook = 'fire_trigger_task' . $this->_task_id;
+
+    $res = db_delete('trigger_assignments')
+      ->condition('hook', $hook)
+      ->execute();
+
+    $weight = 1;
+    foreach ($actions as $aid) {
+      $rec = new stdClass();
+      $rec->hook = $hook;
+      $rec->aid = $aid;
+      $rec->weight = $weight++;
+      drupal_write_record('trigger_assignments', $rec);
+    }
+
+    return parent::save();
+  }
+}
+
diff --git a/sites/all/modules/maestro/maestro_tasks.class.php b/sites/all/modules/maestro/maestro_tasks.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..7c1d2556bc0dc0054ee2a004a4e419eca4939df7
--- /dev/null
+++ b/sites/all/modules/maestro/maestro_tasks.class.php
@@ -0,0 +1,750 @@
+<?php
+
+include_once('maestro_constants.class.php');
+
+abstract class MaestroTask {
+  public $_properties = NULL;
+  protected $_message = NULL;
+  protected $_lastTestStatus = 0;
+  public $executionStatus = NULL;   // Did task's execute method execute of was there an error
+  public $completionStatus = NULL;  // Did the task's execution method complete and if so set to one of the defined status code CONST values
+
+  function __construct($properties = NULL) {
+    $this->_properties = $properties;
+  }
+
+
+  /* execute: Nothing much for an interactiveTask to do in the execute method.
+   * For Interactive tasks, we will want to return an executionStatus of FALSE as this task
+   * is really executed from the task console by the user.
+   * The defined function for this task will execute and present the task to the user in the task console.
+   * The taskconsole will call the processInteractiveTask method for this task type.
+   * It's up to the defined interactiveTask function to complete the task.
+   */
+  abstract function execute ();
+
+
+  /* prepareTask: Opportunity to set task specific data that will be used to create the queue record
+   Specifically, the task handler and task_data fields - which is a serialized array of task specific options/data
+   @retval:  associative array (handler => varchar, task_data => serialized array)
+   */
+  abstract function prepareTask ();
+
+  function showInteractiveTask() {
+    return FALSE;
+  }
+
+  function getTaskConsoleURL(){
+    return "#";
+  }
+
+  /* Method called by maestro_node_insert to handle tracking of the node record
+   * The contentType task implements this method for example to handle tracking
+   * of the node that is created when task is executed
+   */
+  function processContent() {
+  }
+
+  /* Method called by taskconsole when task is expanded to show project details
+   * Allows tasks to return any tracked content such as links to nodes for view/edit
+   */
+  function showContentDetail() {
+    return '';
+  }
+
+  function setMessage($msg) {
+    $this->_message = $msg;
+  }
+
+  function getMessage() {
+    return $this->_message;
+  }
+
+  function getLastTestStatus() {
+    return $this->_lastTestStatus;
+  }
+
+  function setLastTestStatus($setval) {
+    $this->_lastTestStatus = $setval;
+  }
+
+  function saveTempData($data) {
+    if ($this->_properties->queue_id > 0) {
+      db_update('maestro_queue')
+      ->fields(array('temp_data' => serialize($data)))
+      ->condition('id', $this->_properties->queue_id, '=')
+      ->execute();
+    }
+  }
+
+  function getTempData() {
+    if ($this->_properties->queue_id > 0) {
+      $data = db_query("SELECT temp_data FROM {maestro_queue} WHERE id = :tid",
+      array(':tid' => $this->_properties->queue_id))->fetchField();
+      $retval = unserialize($data);
+      return $retval;
+    }
+  }
+
+  /*
+   * function saveProjectData saves project data to the project content table.
+   * it uses the content type and tracking id so the data can be brought back for other tasks
+   * in the workflow with the same identifiers.
+   *
+   * array $data - an array containing the data to be saved. structure should be array ('var_name' => 'var_value')
+   * int $tracking_id - the tracking id of this project
+   * string $content_type - a string containing the content type of the data you wish to store
+   */
+  function saveProjectData($data, $tracking_id, $content_type) {
+    global $user;
+
+    $query = db_select('maestro_project_content', 'a');
+    $query->fields('a', array('id', 'nid', 'tracking_id', 'task_id', 'instance', 'content_type', 'task_data', 'created_by_uid', 'status'));
+    $query->condition('a.tracking_id', $tracking_id, '=');
+    $query->condition('a.content_type', $content_type, '=');
+    $rec = $query->execute()->fetchObject();
+
+    if ($rec === FALSE) {
+      $rec = new stdClass();
+      $rec->nid = 0;
+      $rec->tracking_id = $tracking_id;
+      $rec->task_id = $this->_properties->queue_id;
+      $rec->instance = 1;
+      $rec->content_type = $content_type;
+      $rec->task_data = serialize($data);
+      $rec->created_by_uid = $user->uid;
+      $rec->status = 1; //@TODO: add the project content status code to the constants class, and properly update the status throughout the logic
+      drupal_write_record('maestro_project_content', $rec);
+    }
+    else {
+      $rec->task_data = serialize($data);
+      drupal_write_record('maestro_project_content', $rec, array('id'));
+    }
+  }
+
+  function getProjectData($tracking_id, $content_type) {
+    $query = db_select('maestro_project_content', 'a');
+    $query->fields('a', array('task_data'));
+    $query->condition('a.tracking_id', $tracking_id, '=');
+    $query->condition('a.content_type', $content_type, '=');
+    $rec = $query->execute()->fetchObject();
+
+    if ($rec === FALSE) {
+      return $rec;
+    }
+    else {
+      return unserialize($rec->task_data);
+    }
+  }
+
+  function setRunOnceFlag($task_id) {
+    $task_id = intval($task_id);
+    db_update('maestro_queue')
+    ->fields(array('run_once' => 1))
+    ->condition('id', $task_id, '=')
+    ->execute();
+  }
+
+  function setTaskStartedDate($task_id) {
+    $task_id = intval($task_id);
+    db_update('maestro_queue')
+    ->fields(array('started_date' => time()))
+    ->condition('id', $task_id, '=')
+    ->execute();
+  }
+}
+
+
+// Classes can be in their own file or library and included via several options
+
+class MaestroTaskTypeStart extends MaestroTask {
+
+  function execute() {
+    $this->setTaskStartedDate($this->_properties->id);
+    $this->executionStatus = TRUE;
+    $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    return $this;
+  }
+
+  function prepareTask() {}
+
+
+}
+
+class MaestroTaskTypeEnd extends MaestroTask {
+
+  function execute() {
+    $this->setTaskStartedDate($this->_properties->id);
+    $this->executionStatus = TRUE;
+    $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    return $this;
+  }
+
+  function prepareTask() {}
+
+}
+
+
+class MaestroTaskTypeBatch extends MaestroTask {
+
+  function execute() {
+    $success = FALSE;
+    $current_path=variable_get('maestro_batch_script_location',drupal_get_path('module','maestro') . "/batch/");
+
+    if (file_exists($current_path . $this->_properties->handler)) {
+      require($current_path . $this->_properties->handler );
+    } elseif (file_exists($this->_properties->handler)) {  // Check in current directory
+      require($this->_properties->handler);
+    }
+    //Assumption made here that the $success variable is set by the batch task.
+    if ($success) {
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    }
+    else {
+      $this->completionStatus = FALSE;
+    }
+    $this->setTaskStartedDate($this->_properties->id);
+    $this->executionStatus = TRUE;
+    return $this;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('handler' => $taskdata['handler'],'serialized_data' => $serializedData);
+  }
+}
+
+class MaestroTaskTypeBatchFunction extends MaestroTask {
+
+  function execute() {
+    $success = FALSE;
+
+    $function = $this->_properties->handler;
+    if (function_exists($function)) {
+      $this->setTaskStartedDate($this->_properties->id);
+      $success = $function($this->_properties->id,$this->_properties->process_id);
+    } else {
+      watchdog('maestro',"MaestroTaskTypeBatchFunction - unable to find the function: {$this->_properties->handler}");
+    }
+    // Assumption made here that the $success variable is set by the batch task.
+    if ($success) {
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    }
+    else {
+      $this->completionStatus = FALSE;
+    }
+    $this->executionStatus = TRUE;
+    return $this;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('handler' => $taskdata['handler'],'serialized_data' => $serializedData);
+  }
+
+}
+
+
+class MaestroTaskTypeAnd extends MaestroTask {
+
+  function execute() {
+    $this->setTaskStartedDate($this->_properties->id);
+    $numComplete = 0;
+    $numIncomplete = 0;
+
+    $query = db_select('maestro_queue', 'a');
+    $query->join('maestro_template_data_next_step', 'b', 'a.template_data_id = b.template_data_to OR a.template_data_id=b.template_data_to_false');
+    $query->addExpression('COUNT(a.id)','templatecount');
+    $query->condition("a.id",$this->_properties->id,"=");
+    $numComplete = $query->execute()->fetchObject();
+
+    $query = db_select('maestro_queue_from', 'a');
+    $query->join('maestro_queue', 'b', 'a.from_queue_id = b.id');
+    $query->addExpression('COUNT(a.id)','processcount');
+    $query->condition(db_and()->condition("a.queue_id",$this->_properties->id,"=")->condition("b.process_id",$this->_properties->process_id,"="));
+    $numIncomplete = $query->execute()->fetchObject();
+
+    // sounds confusing, but if the processCount is greater than the completed ones, we're ok too
+    $this->executionStatus = TRUE;
+    if ($numIncomplete->processcount == $numComplete->templatecount || $numIncomplete->processcount > $numComplete->templatecount ) {
+      // All of the incoming items done for this AND we can now carry out updating this queue item's information
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    } else {
+      // Not all the incomings for the AND are done - can not complete task yet
+      $this->completionStatus = FALSE;
+      $this->executionStatus = FALSE;
+    }
+    return $this;
+  }
+
+  function prepareTask() {}
+
+}
+
+
+class MaestroTaskTypeIf extends MaestroTask {
+
+  function execute() {
+    $this->setTaskStartedDate($this->_properties->id);
+
+    $serializedData = db_query("SELECT task_data FROM {maestro_queue} WHERE id = :tid",
+    array(':tid' => $this->_properties->id))->fetchField();
+    $taskdata = @unserialize($serializedData);
+
+    $templateVariableID = $taskdata['if_argument_variable'];
+    $operator = $taskdata['if_operator'];
+    $ifValue = $taskdata['if_value'];
+    $ifArgumentProcess = $taskdata['if_process_arguments'];
+
+    if ($templateVariableID == null or $templateVariableID == '' ) { // logical entry it is
+      //this is a logical entry.  that is, not using a variable.. need to see what the last task's status is.
+      $query = db_select('maestro_queue_from', 'a');
+      $query->join('maestro_queue','b','a.from_queue_id=b.id');
+      $query->fields('b', array('status'));
+      $query->condition("a.queue_id", $this->_properties->id,"=");
+      $res = $query->execute();
+      $row=$res->fetchObject();
+      $lastStatus = intval($row->status);
+      $useTrueBranch = null;
+      switch (strtolower($ifArgumentProcess) ) {
+        case 'lasttasksuccess':
+          if ($lastStatus == 0 or $lastStatus == 1) {
+            $useTrueBranch = TRUE;
+          }
+          else {
+            $useTrueBranch = FALSE;
+          }
+          break;
+        case 'lasttaskcancel':
+          if ($lastStatus == 3) {
+            $useTrueBranch = TRUE;
+          }
+          else {
+            $useTrueBranch = FALSE;
+          }
+          break;
+        case 'lasttaskhold':
+          if ($lastStatus == 2) {
+            $useTrueBranch = TRUE;
+          }
+          else {
+            $useTrueBranch = FALSE;
+          }
+          break;
+        case 'lasttaskaborted':
+          if ($lastStatus == 3) {
+            $useTrueBranch = TRUE;
+          }
+          else {
+            $useTrueBranch = FALSE;
+          }
+          break;
+      }
+    }
+    else {    // variableID it is - we're using a variable for testing the IF condition
+
+      /* need to perform a variable to value operation based on the selected operation!
+       * $templateVariableID ,$operator ,$ifValue, $processID
+       * need to select the process variable using the ID from the current process
+       */
+      $query = db_select('maestro_process_variables', 'a');
+      $query->fields('a',array('variable_value'));
+      $query->condition(db_and()->condition("a.process_id",$this->_properties->process_id)->condition('a.template_variable_id',$templateVariableID));
+      $ifRes = $query->execute();
+      $ifQueryNumRows = $query->countQuery()->execute()->fetchField();
+      if ($ifQueryNumRows > 0 ) {
+        $ifArray = $ifRes->fetchObject();
+        $variableValue = $ifArray->variable_value;
+        switch ($operator ) {
+          case '=':
+            if ($variableValue == $ifValue ) {
+              $useTrueBranch = TRUE;
+            } else {
+              $useTrueBranch = FALSE;
+            }
+            break;
+          case '<':
+            if ($variableValue < $ifValue ) {
+              $useTrueBranch = TRUE;
+            } else {
+              $useTrueBranch = FALSE;
+            }
+            break;
+          case '>':
+            if ($variableValue > $ifValue ) {
+              $useTrueBranch = TRUE;
+            } else {
+              $useTrueBranch = FALSE;
+            }
+            break;
+          case '!=':
+            if ($variableValue != $ifValue ) {
+              $useTrueBranch = TRUE;
+            } else {
+              $useTrueBranch = FALSE;
+            }
+
+            break;
+        }
+      }
+      else { // force the branch to the false side since the variable does not exist...
+        $useTrueBranch = FALSE;
+      }
+
+    }
+
+    if ($useTrueBranch === TRUE ) {  // point to the true branch
+      // This task completed successfully but we want to signal to the engine the condition it was testing
+      // for should use the default workflow path in the engines->nextStep method
+      $this->_lastTestStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+      $this->executionStatus = TRUE;
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    }
+    else if ($useTrueBranch === FALSE) { // point to the false branch
+      // This task completed successfully but we want to signal to the engine the condition it was testing
+      // for should branching to the alternate workflow path in the engines->nextStep method
+      $this->_lastTestStatus = MaestroTaskStatusCodes::STATUS_IF_CONDITION_FALSE;
+      $this->executionStatus = TRUE;
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    } else {   // We have an unexpected situation - so flag a task error
+      $this->executionStatus = FALSE;
+    }
+
+    return $this;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('handler' => '' ,'serialized_data' => $serializedData);
+  }
+
+
+}
+
+class MaestroTaskTypeInteractiveFunction extends MaestroTask {
+
+  function execute() {
+    /* Nothing much for an interactiveTask to do in the execute method.
+     * We want to return an executionStatus of FALSE as this task is really executed from the task console by the user.
+     * The defined function for this task will execute and present the task to the user in the task console.
+     * The taskconsole will call the processInteractiveTask method for this task type.
+     * It's up to the defined interactiveTask function to complete the task.
+     */
+    $this->setRunOnceFlag($this->_properties->id);
+    $this->completionStatus = FALSE;
+    $this->executionStatus = TRUE;
+    return $this;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('handler' => $taskdata['handler'],'serialized_data' => $serializedData);
+  }
+
+  function showInteractiveTask() {
+    $retval = '';
+    $serializedData = db_query("SELECT task_data FROM {maestro_queue} WHERE id = :id",
+    array(':id' => $this->_properties->queue_id))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    if (function_exists($taskdata['handler'])) {
+      $ret = $taskdata['handler']('display',$this,$taskdata['optional_parm']);
+      if ($ret->retcode === TRUE) {
+        $retval = $ret->html;
+      }
+    } else {
+      $retval = '<div style="text-align:center;margin:5px;padding:10px;border:1px solid #CCC;font-size:14pt;">';
+      $retval .= t('Interactive Function "@taskname" was  not found.',array('@taskname' => $taskdata['handler']));
+      $retval .= '</div>';
+    }
+    return $retval;
+  }
+
+  function processInteractiveTask($taskid,$taskop) {
+    $ret = new stdClass();
+    $ret->retcode = FALSE;
+    $ret->engineop = '';
+    $serializedData = db_query("SELECT task_data FROM {maestro_queue} WHERE id = :id",
+    array(':id' => $taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    if (function_exists($taskdata['handler'])) {
+      $ret = $taskdata['handler']($taskop,$this,$taskdata['optional_parm']);
+    }
+    return $ret;
+  }
+
+}
+
+
+
+class MaestroTaskTypeSetProcessVariable extends MaestroTask {
+
+  function execute() {
+    $this->executionStatus = FALSE;
+    $this->setTaskStartedDate($this->_properties->id);
+    $query = db_select('maestro_template_data', 'a');
+    $query->fields('a',array('task_data'));
+    $query->condition('a.id', $this->_properties->template_data_id,'=');
+    $taskDefinitionRec = $query->execute()->fetchObject();
+
+    if ($taskDefinitionRec) {   // Needs to be valid variable to set
+      $taskDefinitionRec->task_data = unserialize($taskDefinitionRec->task_data);
+      if ($taskDefinitionRec->task_data['var_to_set'] > 0) {
+        $query = db_select('maestro_process_variables', 'a');
+        $query->addField('a','variable_value');
+        $query->condition('a.process_id', $this->_properties->process_id,'=');
+        $query->condition('a.template_variable_id', $taskDefinitionRec->task_data['var_to_set'],'=');
+        $curvalue = $query->execute()->fetchField();
+        $methods = $this->getSetMethods();
+        $function = $methods[$taskDefinitionRec->task_data['set_type']]['engine_handler'];
+        if (function_exists($function)) {
+          $setvalue = $function($this, $curvalue, $taskDefinitionRec->task_data[$taskDefinitionRec->task_data['set_type'] . '_value']);
+          if ($setvalue === FALSE OR $setvalue == NULL) {
+            $this->executionStatus = FALSE;
+          } else {
+            db_update('maestro_process_variables')
+            ->fields(array('variable_value' => $setvalue))
+            ->condition('process_id', $this->_properties->process_id, '=')
+            ->condition('template_variable_id', $taskDefinitionRec->task_data['var_to_set'], '=')
+            ->execute();
+            $this->executionStatus = TRUE;
+          }
+        }
+        $query = db_select('maestro_process_variables', 'a');
+        $query->addField('a','variable_value');
+        $query->condition('a.process_id', $this->_properties->process_id,'=');
+        $query->condition(db_and()->condition('a.template_variable_id', $taskDefinitionRec->task_data['var_to_set'],'='));
+        $varvalue = $query->execute()->fetchField();
+        if ($varvalue == $setvalue) $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+      }
+    }
+
+    return $this;
+  }
+
+  function getSetMethods() {
+    $set_process_variable_methods = cache_get('maestro_set_process_variable_methods');
+    if($set_process_variable_methods === FALSE) {
+      $set_process_variable_methods = array();
+      foreach (module_implements('maestro_set_process_variable_methods') as $module) {
+        $function = $module . '_maestro_set_process_variable_methods';
+        if ($arr = $function()) {
+          $set_process_variable_methods = maestro_array_merge_keys($set_process_variable_methods, $arr);
+        }
+      }
+      cache_set('maestro_set_process_variable_methods', $set_process_variable_methods);
+    }
+
+    $methods = cache_get('maestro_set_process_variable_methods');
+
+    return $methods->data;
+  }
+
+  function prepareTask() {}
+
+}
+
+
+class MaestroTaskTypeManualWeb extends MaestroTask {
+
+  function execute() {
+    /* Nothing much for us to do for this interactiveTask in the execute method.
+     * We want to return an executionStatus of FALSE as this task is really executed from the task console by the user.
+     * The user will be redirected to create the defined piece of content.
+     * We have a hook_node_insert method that will trigger a completeTask to tell the masesto engine
+     * this task is now complete and it can be archived and crank the engine forward for this w/f instance (process).
+     */
+    $this->completionStatus = FALSE;
+    $this->executionStatus = TRUE;
+    $this->setRunOnceFlag($this->_properties->id);
+    $this->setTaskStartedDate($this->_properties->id);
+    return $this;
+  }
+
+  function getTaskConsoleURL(){
+    global $base_url;
+
+    $prop=unserialize($this->_properties->task_data);
+    $url = $prop['handler'];
+    $url=str_replace('[site_url]',$base_url,$url);
+
+    if(strpos($url, "?")) {
+      $url .= "&queueid=" . $this->_properties->queue_id;
+    }
+    else {
+      $url .= "?queueid=" . $this->_properties->queue_id;
+    }
+    return $url;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('handler' => $taskdata['handler'],'serialized_data' => $serializedData);
+  }
+}
+
+class MaestroTaskTypeContentType extends MaestroTask {
+
+  function execute() {
+    // Check to see if the current status has been set to 1.
+    // If so, completion status is set to true to complete the task.
+
+    if($this->_properties->status == 1) {
+      $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;  //just complete it!
+    }
+    else {
+      $this->completionStatus = FALSE;
+      $this->setMessage( 'Conent Type task -- status is 0.  Will not complete this task yet.');
+    }
+    $this->executionStatus = TRUE;
+    $this->setRunOnceFlag($this->_properties->id);
+    $this->setTaskStartedDate($this->_properties->id);
+    return $this;
+  }
+
+  function getTaskConsoleURL(){
+    global $base_url;
+    $taskdata = unserialize($this->_properties->task_data);
+    /* Drupal wants to see all underscores in content type names as hyphens for URL's
+     * so we need to test for that and update that for any URL link
+     */
+    $content_type = str_replace('_','-',$taskdata['content_type']);
+    $tracking_id = db_select('maestro_process')
+    ->fields('maestro_process', array('tracking_id'))
+    ->condition('id', $this->_properties->process_id, '=')
+    ->execute()->fetchField();
+
+    // Check and see if there is already a record for this content type in our workflow instance - Determine the content nid
+    $query = db_select('maestro_project_content', 'a');
+    $query->addField('a','nid');
+    $query->condition('a.instance', 1,'=');
+    $query->condition('a.tracking_id', $tracking_id,'=');
+    $query->condition(db_and()->condition('a.content_type', $taskdata['content_type'],'='));
+    $nid = $query->execute()->fetchField();
+
+    if ($nid > 0) {
+      $query = db_select('maestro_project_content', 'a');
+      $query->addField('a','nid');
+      $query->condition('a.instance', 1,'=');
+      $query->condition('a.tracking_id', $tracking_id,'=');
+      $query->condition(db_and()->condition('a.content_type', $taskdata['content_type'],'='));
+      $nid = $query->execute()->fetchField();
+      if (variable_get('clean_url')) {
+        $url = $base_url . "/node/$nid/edit/maestro/edit/{$this->_properties->queue_id}/completeonsubmit/";
+      }
+      else {
+        $url = $base_url . "/index.php?q=node/$nid/edit/maestro/edit/{$this->_properties->queue_id}/completeonsubmit/";
+      }
+    } else {
+      if (variable_get('clean_url')) {
+        $url = $base_url . "/node/add/{$content_type}/maestro/{$this->_properties->queue_id}/";
+      }
+      else {
+        $url = url($base_url . "/index.php?q=node/add/{$content_type}/maestro/{$this->_properties->queue_id}");
+      }
+    }
+    return $url;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+    return array('serialized_data' => $serializedData);
+  }
+
+  // Method called by maestro_node_insert to handle tracking of the node record */
+  function processContent($taskid,$op,$object) {
+    watchdog('maestro',"processContent function");
+    $node = $object;  // For this task type, the object passed in, is the node object.
+    $rec = db_select('maestro_queue')
+    ->fields('maestro_queue', array('process_id','template_data_id'))
+    ->condition('id', $node->maestro_taskid, '=')
+    ->execute()->fetchObject();
+
+    if ($node->status == 1) {
+      $status = MaestroContentStatusCodes::STATUS_PUBLISHED;
+    } else {
+      $status = 0;
+    }
+
+    $tracking_id = db_select('maestro_process')
+    ->fields('maestro_process', array('tracking_id'))
+    ->condition('id', $rec->process_id, '=')
+    ->execute()->fetchField();
+
+    if ($op == 'insert') {
+      db_insert('maestro_project_content')
+      ->fields(array(
+      'nid' => $node->nid,
+      'tracking_id' => $tracking_id,
+      'task_id' => $taskid,
+      'content_type' => $node->type,
+      'status'  => $status
+      ))
+      ->execute();
+
+      // Initiate the mestro workflow engine and complete the task
+      // Complete task is an engine method
+      $maestro = Maestro::createMaestroObject(1);
+      $maestro->engine()->completeTask($taskid);
+    }
+  }
+
+  // Method to return HTML formatted content to include in the project detail area
+  function showContentDetail($tracking_id,$task_id) {
+
+    $retval = '';
+    /* Format any content records */
+    $query = db_select('maestro_project_content','content');
+    $query->addField('content','nid');
+    $query->addField('content','status');
+    $query->condition('content.tracking_id',$tracking_id,'=');
+    $query->condition('content.task_id',$task_id,'=');
+    $res = $query->execute();
+    foreach ($res as $record) {
+      $node = node_load($record->nid);
+      $variables['content_records'][$record->nid] = $node->title;
+      $retval .= '<div>' . l($node->title, "node/{$record->nid}/maestro");
+      $retval .= '<span style="padding-left:10px;">' . t('Status') . ': ';
+      $retval .= t(MaestroContentStatusCodes::getStatusLabel($record->status));
+      $retval .= '</span></div>';
+    }
+    return $retval;
+  }
+
+}
+
+class MaestroTaskTypeFireTrigger extends MaestroTask {
+
+  function execute() {
+    $this->setTaskStartedDate($this->_properties->id);
+    $aids = trigger_get_assigned_actions('fire_trigger_task' . $this->_properties->template_data_id);
+
+    $context = array(
+    'group' => 'maestro',
+    'hook' => 'fire_trigger_task' . $this->_properties->template_data_id
+    );
+
+    actions_do(array_keys($aids), (object) $this->_properties, $context);
+
+    $this->completionStatus = MaestroTaskStatusCodes::STATUS_COMPLETE;
+    $this->executionStatus = TRUE;
+
+    return $this;
+  }
+
+  function prepareTask() {}
+
+}
+
+
diff --git a/sites/all/modules/maestro/modules/maestro_common/maestro_common.info b/sites/all/modules/maestro/modules/maestro_common/maestro_common.info
new file mode 100644
index 0000000000000000000000000000000000000000..43cc13740f01c873c91eed22eb93a3a444d4721a
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_common/maestro_common.info
@@ -0,0 +1,17 @@
+; $Id: maestro_common.info,v 1.1 2010/08/05 21:25:15 blainelang Exp $
+name = Common Functions
+description = Common batch and interactive workflow functions provided as part of the core Maestro module
+package = Maestro
+version = 7.x-1.0-dev
+core = 7.x
+dependencies[] = maestro
+files[] = common.module
+
+
+
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/modules/maestro_common/maestro_common.module b/sites/all/modules/maestro/modules/maestro_common/maestro_common.module
new file mode 100644
index 0000000000000000000000000000000000000000..88859f6f34eacbc2f6cb7fc76f56e2b8d7a737ba
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_common/maestro_common.module
@@ -0,0 +1,63 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro__common.module
+ */
+
+/* Maestro HOOK to modules to return info on any new task handlers - ie functions for tasks */
+function maestro_common_maestro_handler_options() {
+
+  $handlers = array(
+    'MaestroTaskTypeInteractiveFunction' => array(
+      'maestro_show_message' => t('Generic Function to display a message. Requires that you use a process variables called "message" that is set to the message string you want displayed.')
+      )
+    );
+    return $handlers;
+}
+
+
+function maestro_common_theme() {
+  return array(
+    'maestro_common_show_message' => array(
+      'template' => 'show_message',
+      'variables' => array('messsage' => NULL),
+    )
+  );
+}
+
+function maestro_show_message($op,&$task,$parms) {
+  global $base_url;
+
+  $retval = new stdClass();
+  $retval->html = '';
+  $retval->retcode = FALSE;
+  $retval->engineop = '';
+
+  switch ($op) {
+    case 'display':
+      if (!isset($parms['message'])) {
+        $maestro = Maestro::createMaestroObject(1);
+        $parms['message'] = $maestro->engine()->getProcessVariable('message', $task->_properties->process_id);
+      }
+      $retval->html = theme('maestro_common_show_message',array('message' => $parms['message']));
+      $retval->retcode = TRUE;
+      $retval->engineop = '';
+      break;
+    case 'complete':
+      $retval->retcode = TRUE;
+      $retval->engineop = 'completetask';
+      break;
+  }
+
+  return $retval;
+
+}
+
+/* Batch function - dummy or test function returns TRUE */
+function maestro_batch_dummy($queue_id, $process_id) {
+  return TRUE;
+}
+
+?>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/modules/maestro_common/show_message.tpl.php b/sites/all/modules/maestro/modules/maestro_common/show_message.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..185ad32d08056be5cfad9ee1fcfc6edc54ce8f1d
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_common/show_message.tpl.php
@@ -0,0 +1,6 @@
+<div style="text-align:center;margin:5px;padding:10px;border:1px solid #CCC;font-size:14pt;"><?php print $message; ?></div>
+<div style="float:right;padding-right;">
+  <form style="margin:0px;">
+    <div style="font-size:10pt;"><input maestro="complete" type="button" value="<?php print t('Complete Task'); ?>"></div>
+  </form>
+</div>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/modules/maestro_content_publish/content_review.tpl.php b/sites/all/modules/maestro/modules/maestro_content_publish/content_review.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..6a41c8ece838d8ac2bd83a9a8ebc5ec51f223fee
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_content_publish/content_review.tpl.php
@@ -0,0 +1,16 @@
+<div style="margin:5px;padding:10px;border:1px solid #CCC;">
+  <form style="margin:0px;">
+    <div style="float:left;width:75%;">
+      <div><?php print t('You have a task to Review and Edit the following content'); ?> <span style="padding-left:5px;"> <?php print $edit_content_link; ?></span></div>
+    </div>
+    <div style="float:right;width:25%;white-space:nowrap">
+      <span style="float:right;padding-left:5px;"><input maestro="complete" type="button" value="<?php print t('Complete Task'); ?>"></span>
+      <span style="float:right;"><input maestro="update" type="button" value="<?php print t('Update'); ?>"></span>
+    </div>
+    <div style="padding-top:20px;"><?php print t('Do you accept this document') ?>?&nbsp;
+      <input type="radio" name="reviewstatus" value="no" <?php print $radio1opt; ?>><?php print t('No'); ?>
+      <span style="padding-left:10px;"><input type="radio" name="reviewstatus" value="yes" <?php print $radio2opt; ?>><?php print t('Yes'); ?></span>
+    </div>
+  </form>
+  <div style="clear:both;"></div>
+</div>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.info b/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.info
new file mode 100644
index 0000000000000000000000000000000000000000..4cb2996b4e1b58cd6b79aac75807665fe5aba035
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.info
@@ -0,0 +1,17 @@
+; $Id: maestro_content_publish.info,v 1.2 2010/08/05 20:42:27 blainelang Exp $
+name = Content Publish
+description = Custom Maestro functions for the Content Publish Workflow
+package = Maestro
+version = 7.x-1.0-dev
+core = 7.x
+dependencies[] = maestro
+files[] = content_publish.module
+
+
+
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.module b/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.module
new file mode 100644
index 0000000000000000000000000000000000000000..fad0e4ff7993a9cf35c135aa92f85f5d4e11b0b9
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_content_publish/maestro_content_publish.module
@@ -0,0 +1,155 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro_content_publish.module
+ */
+
+
+
+/* Maestro HOOK to modules to return info on any new task handlers - ie functions for tasks */
+function maestro_content_publish_maestro_handler_options() {
+
+  $handlers = array(
+    'MaestroTaskTypeInteractiveFunction' => array(
+      'maestro_reviewContentType' => t('Generic Function to display a review form with link to content node. Requires that you use a process variables called "content_type" that is set to the content type this function will review.'),
+      'maestro_dummy' => t('Test interactive function - do nothing')
+      ),
+    'MaestroTaskTypeBatchFunction' => array(
+      'maestro_batch_dummy' => t('Test batch function - do nothing')
+      )
+    );
+    return $handlers;
+}
+
+
+function maestro_content_publish_theme() {
+  return array(
+    'maestro_content_publish_review' => array(
+      'template' => 'content_review',
+      'variables' => array('nid' => NULL, 'queue_id' => NULL, 'title' => NULL, 'data' => NULL),
+    )
+  );
+}
+
+
+function template_preprocess_maestro_content_publish_review(&$variables) {
+  global $base_url;
+
+  $node = node_load($variables['nid']);
+  if ($node !== FALSE) {
+    $variables['edit_content_link'] = l($node->title, "node/{$variables['nid']}/edit/maestro/edit/{$variables['queue_id']}");
+  } else {
+    $variables['edit_content_link'] = '';
+  }
+  $variables['radio1opt'] = '';
+  $variables['radio2opt'] = '';
+  if ($variables['data']['reviewstatus'] == 'accept') {
+    $variables['radio2opt'] = 'CHECKED=checked';
+  } elseif ($variables['data']['reviewstatus'] == 'reject') {
+    $variables['radio1opt'] = 'CHECKED=checked';
+  }
+}
+
+
+function maestro_reviewContentType($op,&$task,$parms) {
+  global $base_url;
+
+  $nid = maestro_getNodeId($task->_properties->process_id,$parms['content_type']);
+
+  if ($nid === FALSE) {
+    $retval->retcode = FALSE;
+    return $retval;
+  }
+
+  $node = node_load($nid);
+  if ($node === FALSE) {
+    $retval->retcode = TRUE;
+    $retval->html = t('Invalid Node: Content possibly has been deleted.');
+    return $retval;
+  }
+  $retval = new stdClass();
+  $retval->html = '';
+  $retval->retcode = FALSE;
+  $retval->engineop = '';  // Optionally set the engineop value if you want to complete the task
+
+  switch ($op) {
+    case 'display':
+      $data = $task->getTempData();
+      $retval->html = theme('maestro_content_publish_review',array(
+        'nid' => $nid,
+        'queue_id' => $task->_properties->queue_id,
+        'title' => $node->title,
+        'data' => $data));
+
+      $retval->retcode = TRUE;
+      $retval->engineop = '';
+      break;
+    case 'complete':
+      $data = $task->getTempData();
+      $tracking_id = maestro_getTaskTrackingId($task->_properties->queue_id);
+      if (empty($data['reviewstatus']) AND !isset($_POST['reviewstatus'])) {
+        $retval->retcode = FALSE;
+
+      } elseif ($data['reviewstatus'] == 'accept' OR $_POST['reviewstatus'] == 'yes') {
+        $data['reviewstatus'] = 'accept';
+        $task->saveTempData($data);
+        $retval->retcode = TRUE;
+        $retval->status = MaestroTaskStatusCodes::STATUS_COMPLETE;
+        $retval->engineop = 'completetask';
+        // Flag the content record as accepted
+        db_update('maestro_project_content')
+          ->fields(array( 'status' => MaestroContentStatusCodes::STATUS_UNDER_REVIEW))
+          ->condition('tracking_id', $tracking_id)
+          ->condition('nid', $nid)
+          ->execute();
+
+      } elseif ($data['reviewstatus'] == 'reject' OR $_POST['reviewstatus'] == 'no') {
+        $data['reviewstatus'] = 'reject';
+        $task->saveTempData($data);
+        $retval->retcode = TRUE;
+        $retval->status = MaestroTaskStatusCodes::STATUS_IF_CONDITION_FALSE;
+        $retval->engineop = 'completetask';
+        // Flag the content record as rejected
+        db_update('maestro_project_content')
+          ->fields(array( 'status' => MaestroContentStatusCodes::STATUS_REJECTED))
+          ->condition('tracking_id', $tracking_id)
+          ->condition('nid', $nid)
+          ->execute();
+
+      } else {
+        $retval->retcode = FALSE;
+      }
+      break;
+    case 'update':
+      if($_POST['reviewstatus'] == 'yes') {
+        $data['reviewstatus'] = 'accept';
+        $task->saveTempData($data);
+      } elseif ($_POST['reviewstatus'] == 'no') {
+        $data['reviewstatus'] = 'reject';
+        $task->saveTempData($data);
+      }
+      $retval->retcode = TRUE;
+      break;
+  }
+
+  return $retval;
+
+}
+
+/* Batch function called to publish article as final workflow task */
+function maestro_publishArticle($queue_id, $process_id) {
+  $nid = maestro_getNodeId($process_id,'article');
+  if ($nid > 0) {
+    $node = node_load($nid);
+    node_publish_action($node);
+    node_save($node);
+    drupal_set_message('New article has been published');
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+?>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.info b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.info
new file mode 100644
index 0000000000000000000000000000000000000000..5b52f981f6ab91570d6a918e42748a93da221b8b
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.info
@@ -0,0 +1,17 @@
+; $Id: maestro_inline_form_api_task.info,v 1.1 2010/08/31 13:09:19 chevy Exp $
+name = Inline Form API Task
+description = Inline Form API task for the Maestro module.
+package = Maestro
+version = 7.x-1.0-dev
+core = 7.x
+dependencies[] = maestro
+files[] = maestro_inline_form_api_task.module
+
+
+
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.module b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.module
new file mode 100644
index 0000000000000000000000000000000000000000..c703702f03f44eb7cd7d944ad312baba89cf9fa2
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/maestro_inline_form_api_task.module
@@ -0,0 +1,242 @@
+<?php
+
+//$Id: maestro_inline_form_api_task.module,v 1.2 2010/08/31 15:13:27 chevy Exp $
+
+/**
+ * @file
+ * maestro_inline_form_api_task.module
+ *
+ * includes all the logic necessary for the inline form api task for maestro.
+ * this file is composed in four main sections: drupal hooks, maestro hooks,
+ * the maestro engine class, and the maestro admin interface class.
+ */
+
+
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_tasks.class.php';
+include_once './' . drupal_get_path('module', 'maestro') . '/maestro_task_interface.class.php';
+
+function maestro_inline_form_api_task_theme() {
+  return array(
+    'maestro_task_inline_form_api' => array(
+      'template' => 'theme/maestro-task-inline-form-api',
+      'variables' => array('tdid' => NULL)
+    ),
+    'maestro_task_inline_form_api_edit' => array(
+      'template' => 'theme/maestro-task-inline-form-api-edit',
+      'variables' => array('tdid' => NULL, 'td_rec' => NULL)
+    ),
+  );
+}
+
+function maestro_inline_form_api_task_maestro_get_taskobject_info() {
+  $options = array(
+    array('display_name' => t('Inline Form API Task'),
+      'class_name' => 'MaestroTaskInterfaceInlineFormAPI'
+    ),
+  );
+  return $options;
+}
+
+
+function maestro_inline_form_api_task_form($form, &$form_state, $dynamic_form) {
+  return $dynamic_form;
+}
+
+function maestro_inline_form_api_task_form_submit($form, &$form_state) {
+  $qid = $form['queue_id']['#value'];
+  $op = ($form['complete']['#value'] == $_POST['op']) ? 'complete' : 'save';
+
+  if ($qid > 0) {
+    $query = db_select('maestro_queue');
+    $query->fields('maestro_queue', array('task_class_name', 'process_id'));
+    $query->condition('id', $qid, '=');
+    $rec = $query->execute()->fetchObject();
+    $tasktype = $rec->task_class_name;
+
+    $data = new stdClass();
+    // Need to pass in data object when instantiating task class and queueid needs to be set in class _properties.
+    $data->process_id = $rec->process_id;
+    $data->queue_id = $qid;
+    $task = new $tasktype($data);
+    $ret = $task->processInteractiveTask($qid, $op);
+
+    if ($ret->retcode === TRUE) {
+      if ($ret->engineop == 'complete') {
+        if (!isset($ret->status)) {
+          $ret->status = 1;    // Just in case interactive function has not set this - set to default 'success'
+        }
+        $maestro = Maestro::createMaestroObject(1);    // Initiate the processing of all tasks of type 1.x
+        $maestro->engine()->completeTask($qid, $ret->status);
+      }
+    }
+  }
+}
+
+
+/**
+ * Maestro Hooks
+ */
+
+function maestro_inline_form_api_task_maestro_set_process_variable_methods() {
+  return array(
+    'maestro_inline_form_api_task' => array (
+      'title' => t('Inline Form API Task Field Result'),
+      'engine_handler' => 'maestro_inline_form_api_task_maestro_set_process_variable_logic'
+    ),
+  );
+}
+
+function maestro_inline_form_api_task_maestro_set_process_variable_logic(&$task_class, $current_value, $arg) {
+  $args = explode(':', $arg);  //$args[0] = content type, $arg[1] = field name
+  $query = db_select('maestro_process', 'a');
+  $query->fields('a', array('tracking_id'));
+  $query->condition('a.id', $task_class->_properties->process_id, '=');
+  $tracking_id = $query->execute()->fetchField();
+
+  $data = $task_class->getProjectData($tracking_id, $args[0]);
+
+  return $data[$args[1]];
+}
+
+
+/**
+ * Maestro Engine Class
+ */
+
+class MaestroTaskTypeInlineFormAPI extends MaestroTask {
+
+  function execute() {
+    $this->setRunOnceFlag($this->_properties->id);
+    $this->completionStatus = FALSE;
+    $this->executionStatus = TRUE;
+    return $this;
+  }
+
+  function prepareTask() {
+    $serializedData = db_query("SELECT task_data FROM {maestro_template_data} WHERE id = :tid",
+    array(':tid' => $this->_properties->taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+
+    return array('form_api_code' => $taskdata['form_api_code'], 'serialized_data' => $serializedData);
+  }
+
+  function showInteractiveTask() {
+    $retval = '';
+    $serializedData = db_query("SELECT task_data FROM {maestro_queue} WHERE id = :id",
+    array(':id' => $this->_properties->queue_id))->fetchField();
+    $taskdata = @unserialize($serializedData);
+
+    $form = array();
+
+    eval($taskdata['form_api_code']);
+    $tracking_id = db_select('maestro_process')
+      ->fields('maestro_process', array('tracking_id'))
+      ->condition('id', $this->_properties->process_id, '=')
+      ->execute()->fetchField();
+    $default_data = $this->getProjectData($tracking_id, $taskdata['content_type']);
+
+    if ($default_data !== FALSE) {
+      $this->updateDefaultFormData($form, $default_data);
+    }
+
+    $form['queue_id'] = array(
+      '#type' => 'hidden',
+      '#default_value' => $this->_properties->queue_id,
+    );
+    $form['taskop'] = array(
+      '#type' => 'hidden',
+      '#default_value' => '',
+    );
+    $form['save'] = array(
+      '#type'           => 'submit',
+      '#default_value'  => t('Save'),
+    );
+    $form['complete'] = array(
+      '#type'           => 'submit',
+      '#default_value'  => t('Complete Task'),
+    );
+
+    $form['#submit'][] = 'maestro_inline_form_api_task_form_submit';
+
+    return drupal_render(drupal_get_form('maestro_inline_form_api_task_form', $form));
+  }
+
+  function updateDefaultFormData(&$form, &$data, $parent='') {
+    $value_handled = FALSE;
+    foreach ($form as $key => $val) {
+      if ($key[0] == '#') {
+        if ($parent != '') {
+          if ($form['#type'] != 'fieldset') {
+            if (!$value_handled) {
+              $form['#default_value'] = $data;
+              $value_handled = TRUE;
+            }
+          }
+        }
+      }
+      else {  //recurse into the next level
+        $this->updateDefaultFormData($form[$key], $data[$key], $key);
+      }
+    }
+  }
+
+  function processInteractiveTask($taskid, $taskop) {
+    $ret = new stdClass();
+    $ret->retcode = TRUE;
+    $ret->engineop = $taskop;
+
+    $serializedData = db_query("SELECT task_data FROM {maestro_queue} WHERE id = :id", array(':id' => $taskid))->fetchField();
+    $taskdata = @unserialize($serializedData);
+
+    $tracking_id = db_select('maestro_process')
+      ->fields('maestro_process', array('tracking_id'))
+      ->condition('id', $this->_properties->process_id, '=')
+      ->execute()->fetchField();
+
+    $this->saveProjectData($_POST, $tracking_id, $taskdata['content_type']);
+
+    return $ret;
+  }
+
+}
+
+
+/**
+ * Maestro Admin Interface Class
+ */
+
+class MaestroTaskInterfaceInlineFormAPI extends MaestroTaskInterface {
+  function __construct($task_id=0, $template_id=0) {
+    $this->_task_type = 'InlineFormAPI';
+    $this->_is_interactive = MaestroInteractiveFlag::IS_INTERACTIVE;
+
+    parent::__construct($task_id, $template_id);
+
+    $this->_task_edit_tabs = array('assignment' => 1, 'notification' => 1);
+  }
+
+  function display() {
+    return theme('maestro_task_inline_form_api', array('tdid' => $this->_task_id, 'taskname' => $this->_taskname, 'ti' => $this));
+  }
+
+  function getEditFormContent() {
+    $this->_fetchTaskInformation();
+    if (!is_array(@($this->_task_data->task_data)) || !array_key_exists('form_api_code', $this->_task_data->task_data)) {
+      $this->_task_data->task_data['form_api_code'] = '';
+    }
+
+    return theme('maestro_task_inline_form_api_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data));
+  }
+
+  function save() {
+    $rec = new stdClass();
+    $rec->id = $_POST['template_data_id'];
+    $rec->task_data = serialize(array('form_api_code' => $_POST['form_api_code'], 'content_type' => $_POST['content_type']));
+
+    drupal_write_record('maestro_template_data', $rec, array('id'));
+
+    return parent::save();
+  }
+}
+
+?>
diff --git a/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api-edit.tpl.php b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..75e40dc261c5246e4ac88ef172af293e45e5bea7
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api-edit.tpl.php
@@ -0,0 +1,25 @@
+<?php
+// $Id: maestro-task-inline-form-api-edit.tpl.php,v 1.1 2010/08/31 13:09:19 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-interactive-function-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td><?php print t('Unique Form Name:'); ?></td>
+    <td><input type="text" name="content_type" value="<?php print $td_rec->task_data['content_type']; ?>"></td>
+  </tr>
+  <tr>
+    <td colspan="2"><?php print t('Form API PHP Array:'); ?></td>
+  </tr>
+  <tr>
+    <td colspan="2"><textarea name="form_api_code" rows="8" style="width: 100%;"><?php print $td_rec->task_data['form_api_code']; ?></textarea></td>
+  </tr>
+  <tr>
+    <td colspan="2" style="font-style: italic; font-size: 0.8em;"><?php print t('Create your form fields in an array variable named $form. Leave out any default values, the system will add them automatically.'); ?></td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api.tpl.php b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..b4eb050048c0667b96ec27457b29f76f5b398103
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_inline_form_api_task/theme/maestro-task-inline-form-api.tpl.php
@@ -0,0 +1,23 @@
+<?php
+// $Id: maestro-task-inline-form-api.tpl.php,v 1.1 2010/08/31 13:09:19 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-interactive-function.tpl.php
+ */
+
+ ?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-bl"><div class="tr-bl">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-bl maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Inline Form API Task'); ?><br />
+      <div id="task_assignment<?php print $tdid; ?>"><?php print $ti->getAssignmentDisplay(); ?></div>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.field b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.field
new file mode 100644
index 0000000000000000000000000000000000000000..270600310392d09cf381b6b3f657bbb4abecfb0d
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.field
@@ -0,0 +1,373 @@
+<?php
+
+/**
+ * Implementation of hook_field_default_fields().
+ */
+function maestro_technical_support_request_workflow_field_default_fields() {
+  $fields = array();
+
+  // Exported field: 'node-technical_support_request-body'
+  $fields['node-technical_support_request-body'] = array(
+    'field_config' => array(
+      'entity_types' => array(
+        '0' => 'node',
+      ),
+      'translatable' => '1',
+      'settings' => array(
+        'max_length' => '',
+      ),
+      'indexes' => array(
+        'format' => array(
+          '0' => 'format',
+        ),
+      ),
+      'field_name' => 'body',
+      'type' => 'text_with_summary',
+      'module' => 'text',
+      'active' => '1',
+      'cardinality' => '1',
+      'deleted' => '0',
+      'bundles' => array(
+        'node' => array(
+          '0' => 'page',
+          '1' => 'article',
+          '2' => 'technical_support_request',
+        ),
+      ),
+    ),
+    'field_instance' => array(
+      'label' => 'Tecnical Support Issue',
+      'widget_type' => 'text_textarea_with_summary',
+      'settings' => array(
+        'text_processing' => '1',
+        'display_summary' => 1,
+      ),
+      'display' => array(
+        'full' => array(
+          'label' => 'hidden',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-4',
+          'module' => 'text',
+        ),
+        'teaser' => array(
+          'label' => 'hidden',
+          'type' => 'text_summary_or_trimmed',
+          'settings' => array(),
+          'weight' => '-4',
+          'module' => 'text',
+        ),
+        'rss' => array(
+          'label' => 'hidden',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-4',
+          'module' => 'text',
+        ),
+        'search_index' => array(
+          'label' => 'hidden',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-4',
+          'module' => 'text',
+        ),
+        'search_result' => array(
+          'label' => 'hidden',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-4',
+          'module' => 'text',
+        ),
+      ),
+      'widget' => array(
+        'weight' => '-4',
+        'type' => 'text_textarea_with_summary',
+        'module' => 'text',
+        'active' => 1,
+        'settings' => array(
+          'rows' => '20',
+          'summary_rows' => 5,
+        ),
+      ),
+      'required' => 1,
+      'description' => '',
+      'weight' => 0,
+      'default_value' => NULL,
+      'field_name' => 'body',
+      'entity_type' => 'node',
+      'bundle' => 'technical_support_request',
+      'deleted' => '0',
+    ),
+  );
+
+  // Exported field: 'node-technical_support_request-field_assignee'
+  $fields['node-technical_support_request-field_assignee'] = array(
+    'field_config' => array(
+      'translatable' => '1',
+      'entity_types' => array(),
+      'settings' => array(
+        'referenceable_roles' => array(
+          '2' => '2',
+          '3' => '3',
+        ),
+        'referenceable_status' => array(
+          '1' => '1',
+          '0' => '0',
+        ),
+      ),
+      'indexes' => array(
+        'uid' => array(
+          '0' => 'uid',
+        ),
+      ),
+      'field_name' => 'field_assignee',
+      'type' => 'user_reference',
+      'module' => 'user_reference',
+      'active' => '1',
+      'cardinality' => '1',
+      'deleted' => '0',
+      'bundles' => array(
+        'node' => array(
+          '0' => 'technical_support_request',
+        ),
+      ),
+    ),
+    'field_instance' => array(
+      'label' => 'Assignee (IT Use Only)',
+      'widget' => array(
+        'weight' => '-2',
+        'type' => 'options_select',
+        'module' => 'options',
+        'active' => 0,
+        'settings' => array(),
+      ),
+      'settings' => array(),
+      'display' => array(
+        'full' => array(
+          'label' => 'above',
+          'type' => 'user_reference_default',
+          'settings' => array(),
+          'weight' => '-2',
+          'module' => 'user_reference',
+        ),
+        'teaser' => array(
+          'label' => 'above',
+          'type' => 'user_reference_default',
+          'settings' => array(),
+          'weight' => '-2',
+          'module' => 'user_reference',
+        ),
+        'rss' => array(
+          'label' => 'above',
+          'type' => 'user_reference_default',
+          'settings' => array(),
+          'weight' => '-2',
+          'module' => 'user_reference',
+        ),
+        'search_index' => array(
+          'label' => 'above',
+          'type' => 'user_reference_default',
+          'settings' => array(),
+          'weight' => '-2',
+          'module' => 'user_reference',
+        ),
+        'search_result' => array(
+          'label' => 'above',
+          'type' => 'user_reference_default',
+          'settings' => array(),
+          'weight' => '-2',
+          'module' => 'user_reference',
+        ),
+      ),
+      'required' => 0,
+      'description' => '',
+      'weight' => 0,
+      'default_value' => NULL,
+      'field_name' => 'field_assignee',
+      'entity_type' => 'node',
+      'bundle' => 'technical_support_request',
+      'deleted' => '0',
+    ),
+  );
+
+  // Exported field: 'node-technical_support_request-field_attachment'
+  $fields['node-technical_support_request-field_attachment'] = array(
+    'field_config' => array(
+      'translatable' => '1',
+      'entity_types' => array(),
+      'settings' => array(
+        'display_field' => 0,
+        'display_default' => 0,
+        'uri_scheme' => 'public',
+      ),
+      'indexes' => array(
+        'fid' => array(
+          '0' => 'fid',
+        ),
+      ),
+      'field_name' => 'field_attachment',
+      'type' => 'file',
+      'module' => 'file',
+      'active' => '1',
+      'cardinality' => '1',
+      'deleted' => '0',
+      'bundles' => array(
+        'node' => array(
+          '0' => 'technical_support_request',
+        ),
+      ),
+    ),
+    'field_instance' => array(
+      'label' => 'Attachment',
+      'widget' => array(
+        'weight' => '-3',
+        'type' => 'file_generic',
+        'module' => 'file',
+        'active' => 1,
+        'settings' => array(
+          'progress_indicator' => 'throbber',
+        ),
+      ),
+      'settings' => array(
+        'file_directory' => '',
+        'file_extensions' => 'jpg jpeg bmp gif png',
+        'max_filesize' => '',
+        'description_field' => 0,
+      ),
+      'display' => array(
+        'full' => array(
+          'label' => 'above',
+          'type' => 'file_default',
+          'settings' => array(),
+          'weight' => '-3',
+          'module' => 'file',
+        ),
+        'teaser' => array(
+          'label' => 'above',
+          'type' => 'file_default',
+          'settings' => array(),
+          'weight' => '-3',
+          'module' => 'file',
+        ),
+        'rss' => array(
+          'label' => 'above',
+          'type' => 'file_default',
+          'settings' => array(),
+          'weight' => '-3',
+          'module' => 'file',
+        ),
+        'search_index' => array(
+          'label' => 'above',
+          'type' => 'file_default',
+          'settings' => array(),
+          'weight' => '-3',
+          'module' => 'file',
+        ),
+        'search_result' => array(
+          'label' => 'above',
+          'type' => 'file_default',
+          'settings' => array(),
+          'weight' => '-3',
+          'module' => 'file',
+        ),
+      ),
+      'required' => 0,
+      'description' => '',
+      'weight' => 0,
+      'default_value' => NULL,
+      'field_name' => 'field_attachment',
+      'entity_type' => 'node',
+      'bundle' => 'technical_support_request',
+      'deleted' => '0',
+    ),
+  );
+
+  // Exported field: 'node-technical_support_request-field_support_response'
+  $fields['node-technical_support_request-field_support_response'] = array(
+    'field_config' => array(
+      'translatable' => '1',
+      'entity_types' => array(),
+      'settings' => array(
+        'max_length' => '512',
+      ),
+      'indexes' => array(
+        'format' => array(
+          '0' => 'format',
+        ),
+      ),
+      'field_name' => 'field_support_response',
+      'type' => 'text_long',
+      'module' => 'text',
+      'active' => '1',
+      'cardinality' => '1',
+      'deleted' => '0',
+      'bundles' => array(
+        'node' => array(
+          '0' => 'technical_support_request',
+        ),
+      ),
+    ),
+    'field_instance' => array(
+      'label' => 'Response (IT Use Only)',
+      'widget' => array(
+        'weight' => '-1',
+        'type' => 'text_textarea',
+        'module' => 'text',
+        'active' => 1,
+        'settings' => array(
+          'rows' => '5',
+        ),
+      ),
+      'settings' => array(
+        'text_processing' => '0',
+      ),
+      'display' => array(
+        'full' => array(
+          'label' => 'above',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-1',
+          'module' => 'text',
+        ),
+        'teaser' => array(
+          'label' => 'above',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-1',
+          'module' => 'text',
+        ),
+        'rss' => array(
+          'label' => 'above',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-1',
+          'module' => 'text',
+        ),
+        'search_index' => array(
+          'label' => 'above',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-1',
+          'module' => 'text',
+        ),
+        'search_result' => array(
+          'label' => 'above',
+          'type' => 'text_default',
+          'settings' => array(),
+          'weight' => '-1',
+          'module' => 'text',
+        ),
+      ),
+      'required' => 0,
+      'description' => '',
+      'weight' => 0,
+      'default_value' => NULL,
+      'field_name' => 'field_support_response',
+      'entity_type' => 'node',
+      'bundle' => 'technical_support_request',
+      'deleted' => '0',
+    ),
+  );
+
+  return $fields;
+}
diff --git a/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.inc b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.inc
new file mode 100644
index 0000000000000000000000000000000000000000..aaab00a89f62a2d06f3cbc0d76544e2af4be1e90
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.features.inc
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * Implementation of hook_node_info().
+ */
+function maestro_technical_support_request_workflow_node_info() {
+  $items = array(
+    'technical_support_request' => array(
+      'name' => t('Technical Support Request'),
+      'base' => 'node_content',
+      'description' => '',
+      'has_title' => '1',
+      'title_label' => t('Title'),
+      'help' => ''
+    ),
+  );
+  return $items;
+}
diff --git a/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.info b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.info
new file mode 100644
index 0000000000000000000000000000000000000000..cffa12c78ed99d4e1003689815a1a46ecd147ac9
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.info
@@ -0,0 +1,26 @@
+name = "Maestro Technical Support Request Workflow"
+description = "The Technical Support Request Workflow for Maestro"
+package = "Maestro"
+features[field][] = "node-technical_support_request-body"
+features[field][] = "node-technical_support_request-field_assignee"
+features[field][] = "node-technical_support_request-field_attachment"
+features[field][] = "node-technical_support_request-field_support_response"
+features[node][] = "technical_support_request"
+project = "maestro_technical_support_request_workflow"
+version = 7.x-1.0-dev
+core = 7.x
+dependencies[] = "features"
+dependencies[] = "file"
+dependencies[] = "maestro"
+dependencies[] = "user_reference"
+files[] = maestro_technical_support_request_workflow.module
+files[] = maestro_technical_support_request_workflow.install
+files[] = maestro_technical_support_request_workflow.features.field
+files[] = maestro_technical_support_request_workflow.features.inc
+
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.install b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.install
new file mode 100644
index 0000000000000000000000000000000000000000..e4654d1d06c961c9b4686f1f59a8fe0c678f6011
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.install
@@ -0,0 +1,449 @@
+<?php
+
+function maestro_technical_support_request_workflow_uninstall() {
+  db_update('node_type')
+  ->fields(array('custom' => 1))
+  ->condition('type', 'technical_support_request', '=')
+  ->execute();
+}
+
+function maestro_technical_support_request_workflow_install() {
+  include(drupal_get_path('module','maestro') . '/maestro.admin.inc');
+
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Technical Support Request", TRUE, TRUE, 700);
+  $variable_xref_array[9] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $variable_xref_array[10] = maestro_createTemplateVariable($templateID, "assignee", "0");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[39] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 46;
+  $rec->offset_top = 19;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[40] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 53;
+  $rec->offset_top = 577;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceContentType(0, $templateID);
+  $ti->create();
+  $task_xref_array[41] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:1:{s:12:"content_type";s:25:"technical_support_request";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Review/Assign Request';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 18;
+  $rec->offset_top = 102;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceContentType(0, $templateID);
+  $ti->create();
+  $task_xref_array[42] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:1:{s:12:"content_type";s:25:"technical_support_request";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Update Support Request';
+  $rec->argument_variable = '';
+  $rec->regenerate = 1;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 271;
+  $rec->offset_top = 301;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceSetProcessVariable(0, $templateID);
+  $ti->create();
+  $task_xref_array[43] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:6:{s:21:"hardcoded_value_value";s:0:"";s:21:"increment_value_value";s:0:"";s:31:"maestro_content_type_task_value";s:40:"technical_support_request:field_assignee";s:34:"maestro_inline_form_api_task_value";s:0:"";s:10:"var_to_set";s:2:"10";s:8:"set_type";s:25:"maestro_content_type_task";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Set Assignee';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 278;
+  $rec->offset_top = 111;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceContentType(0, $templateID);
+  $ti->create();
+  $task_xref_array[44] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:1:{s:12:"content_type";s:25:"technical_support_request";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Technical Support Request';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 262;
+  $rec->offset_top = 201;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[45] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:25:"maestro_reviewContentType";s:13:"optional_parm";a:1:{s:12:"content_type";s:25:"technical_support_request";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Review/Accept Response';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 15;
+  $rec->offset_top = 205;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceIf(0, $templateID);
+  $ti->create();
+  $task_xref_array[46] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:5:{s:11:"if_operator";s:0:"";s:8:"if_value";s:0:"";s:20:"if_process_arguments";s:15:"lasttasksuccess";s:20:"if_argument_variable";s:0:"";s:17:"if_task_arguments";s:6:"status";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'If Accepted';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 64;
+  $rec->offset_top = 310;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInlineFormAPI(0, $templateID);
+  $ti->create();
+  $task_xref_array[48] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:13:"form_api_code";s:196:"$form[\'hours\'] = array(
+    \'#type\' => \'textfield\',
+    \'#title\' => t(\'Hours\'),
+    \'#size\' => 6,
+    \'#maxlength\' => 4,
+    \'#description\' => t(\'Enter the number of hours spent on this support issue.\'),
+  );";s:12:"content_type";s:9:"timesheet";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Update Timesheet';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 37;
+  $rec->offset_top = 394;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceBatchFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[49] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:19:"maestro_batch_dummy";s:13:"optional_parm";a:0:{}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Update Timesheet System';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 12;
+  $rec->offset_top = 498;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[39], 'b1' => $task_xref_array[41], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[41], 'b1' => $task_xref_array[43], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[41],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $ti->modulateExportUser("manager");
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[41],'b1' => 1,'c1' => 1,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[42], 'b1' => $task_xref_array[44], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[42],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[9];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[42],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[43], 'b1' => $task_xref_array[44], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[44], 'b1' => $task_xref_array[45], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[44],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[10];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[44],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[45], 'b1' => $task_xref_array[46], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[45],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[9];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[45],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[46], 'b1' => $task_xref_array[0], 'c1' => $task_xref_array[42]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[46], 'b1' => $task_xref_array[48], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[48], 'b1' => $task_xref_array[49], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[48],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[10];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[48],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[49], 'b1' => $task_xref_array[40], 'c1' => $task_xref_array[0]));
+}
+
diff --git a/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.module b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.module
new file mode 100644
index 0000000000000000000000000000000000000000..356a8bb417752510bac8d7c29c27de9ee1f025a2
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_technical_support_request_workflow/maestro_technical_support_request_workflow.module
@@ -0,0 +1,5 @@
+<?php
+
+include_once('maestro_technical_support_request_workflow.features.inc');
+include_once('maestro_technical_support_request_workflow.features.field');
+
diff --git a/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.info b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.info
new file mode 100644
index 0000000000000000000000000000000000000000..dc6b6fb7efdf9eabccf1e7b657eeedd3d9d65061
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.info
@@ -0,0 +1,15 @@
+; $Id:
+name = Maestro Test Workflow Patterns
+description = Maestro Test Workflow Patterns for use in testing the execution of your Maestro Engine
+package = Maestro
+version = 7.x-1.0-dev
+core = 7.x
+dependencies[] = maestro
+files[] = maestro_test_flows.module
+files[] = maestro_test_flows.install
+; Information added by drupal.org packaging script on January 1, 1970 - 00:00
+version = "7.x-1.0"
+core = "7.x"
+project = "maestro"
+datestamp = "1295363140"
+
diff --git a/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.install b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.install
new file mode 100644
index 0000000000000000000000000000000000000000..51cbf59049bd3db806cdfef46191774f8989f713
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.install
@@ -0,0 +1,1630 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro_test_flows.install
+ */
+
+function maestro_test_flows_install() {
+  include(drupal_get_path('module','maestro') . '/maestro.admin.inc');
+
+  $dt = date("m-d-Y", time());
+  $app_group_id = maestro_createAppGroup("Sample Workflow AppGroup created " . $dt);
+
+	/* Basic Test Workflow Example */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test - Basic Workflow Example", TRUE, TRUE, 500);
+  $variable_xref_array[1] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $variable_xref_array[2] = maestro_createTemplateVariable($templateID, "var1", "0");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[1] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 65;
+  $rec->offset_top = 100;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[2] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 74;
+  $rec->offset_top = 308;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceSetProcessVariable(0, $templateID);
+  $ti->create();
+  $task_xref_array[3] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:6:{s:21:"hardcoded_value_value";s:1:"3";s:21:"increment_value_value";s:0:"";s:31:"maestro_content_type_task_value";s:0:"";s:34:"maestro_inline_form_api_task_value";s:0:"";s:10:"var_to_set";s:1:"2";s:8:"set_type";s:15:"hardcoded_value";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Set Process Variable for Test';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 253;
+  $rec->offset_top = 100;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceIf(0, $templateID);
+  $ti->create();
+  $task_xref_array[4] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:5:{s:11:"if_operator";s:1:">";s:8:"if_value";s:1:"5";s:20:"if_process_arguments";s:0:"";s:20:"if_argument_variable";s:1:"2";s:17:"if_task_arguments";s:8:"variable";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'If var1 > 5';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 311;
+  $rec->offset_top = 200;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[5] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:27:"var1 is not greater than 5.";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'var1 Not Greater';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 268;
+  $rec->offset_top = 299;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[6] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:23:"var1 is greater than 5.";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'var1 Greater';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->show_in_detail = 1;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 46;
+  $rec->offset_top = 189;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[1], 'b1' => $task_xref_array[3], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[3], 'b1' => $task_xref_array[4], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[4], 'b1' => $task_xref_array[6], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[4], 'b1' => $task_xref_array[0], 'c1' => $task_xref_array[5]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[5], 'b1' => $task_xref_array[2], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[5],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[1];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[5],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[6], 'b1' => $task_xref_array[2], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[6],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[1];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[6],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+
+
+  /* Parallel Workflow Test */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test Simple Parallel AND", TRUE, TRUE, 500);
+  maestro_joinAppGroup($templateID, $app_group_id);
+  $variable_xref_array[10] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[28] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 43;
+  $rec->offset_top = 249;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[29] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 914;
+  $rec->offset_top = 250;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[30] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:22:"Third Interactive Task";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Third Interactive Task';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 283;
+  $rec->offset_top = 368;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[31] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:23:"Second Interactive Task";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Second Interactive Task';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 282;
+  $rec->offset_top = 236;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[32] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:22:"First Interactive Task";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'First Interactive Task';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 285;
+  $rec->offset_top = 114;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceAnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[33] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'AND - Wait for all 3 branches to complete.';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 542;
+  $rec->offset_top = 249;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[28], 'b1' => $task_xref_array[32], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[28], 'b1' => $task_xref_array[31], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[28], 'b1' => $task_xref_array[30], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[30], 'b1' => $task_xref_array[33], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[30],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[10];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[30],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[31], 'b1' => $task_xref_array[33], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[31],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[10];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[31],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[32], 'b1' => $task_xref_array[33], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[32],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[10];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[32],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[33], 'b1' => $task_xref_array[29], 'c1' => $task_xref_array[0]));
+
+
+  /* Test Parallel and Sequential Branches Workflow */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test Parallel and Sequential Branches", TRUE, TRUE, 600);
+  maestro_joinAppGroup($templateID, $app_group_id);
+  $variable_xref_array[11] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[34] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 486;
+  $rec->offset_top = 86;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[35] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 497;
+  $rec->offset_top = 594;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[36] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:21:"Serial Branch Task #1";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Serial Branch Task #1';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 209;
+  $rec->offset_top = 181;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[37] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:21:"Serial Branch Task #2";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Serial Branch Task #2';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 211;
+  $rec->offset_top = 290;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[38] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:23:"Parallel Branch Task #1";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Parallel Branch Task #1';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 677;
+  $rec->offset_top = 187;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[39] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:30:"Second Parallel Branch task #1";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Second Parallel Branch Task #1';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 524;
+  $rec->offset_top = 295;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[40] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:30:"Second Parallel Branch Task #2";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Second Parallel Branch Task #2';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 822;
+  $rec->offset_top = 294;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceAnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[41] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'AND the 2nd Parallel Branch together';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 663;
+  $rec->offset_top = 413;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceAnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[42] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'AND the serial and parallel branches together';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 382;
+  $rec->offset_top = 505;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[34], 'b1' => $task_xref_array[36], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[34], 'b1' => $task_xref_array[38], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[36], 'b1' => $task_xref_array[37], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[36],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[11];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[36],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[37], 'b1' => $task_xref_array[42], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[37],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[11];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[37],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[38], 'b1' => $task_xref_array[39], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[38], 'b1' => $task_xref_array[40], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[38],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[11];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[38],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[39], 'b1' => $task_xref_array[41], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[39],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[11];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[39],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[40], 'b1' => $task_xref_array[41], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[40],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[11];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[40],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[41], 'b1' => $task_xref_array[42], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[42], 'b1' => $task_xref_array[35], 'c1' => $task_xref_array[0]));
+
+
+  /* Content Type Workflow Test with Editor and Publisher Review Tasks */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test Content Type Task", TRUE, TRUE, 500);
+  maestro_joinAppGroup($templateID, $app_group_id);
+  $variable_xref_array[12] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $variable_xref_array[13] = maestro_createTemplateVariable($templateID, "content_type", "article");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[43] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 46;
+  $rec->offset_top = 111;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[44] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 652;
+  $rec->offset_top = 496;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceContentType(0, $templateID);
+  $ti->create();
+  $task_xref_array[45] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:1:{s:12:"content_type";s:7:"article";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Create New Article';
+  $rec->argument_variable = '';
+  $rec->regenerate = 1;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 243;
+  $rec->offset_top = 100;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[46] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:25:"maestro_reviewContentType";s:13:"optional_parm";a:1:{s:12:"content_type";s:7:"article";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Editor Review Article';
+  $rec->argument_variable = '';
+  $rec->regenerate = 1;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 480;
+  $rec->offset_top = 99;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceIf(0, $templateID);
+  $ti->create();
+  $task_xref_array[47] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:5:{s:11:"if_operator";s:0:"";s:8:"if_value";s:0:"";s:20:"if_process_arguments";s:15:"lasttasksuccess";s:20:"if_argument_variable";s:0:"";s:17:"if_task_arguments";s:6:"status";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Check if Editor Accepted';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 327;
+  $rec->offset_top = 255;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[48] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:25:"maestro_reviewContentType";s:13:"optional_parm";a:1:{s:12:"content_type";s:7:"article";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Publisher Review Article';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 339;
+  $rec->offset_top = 368;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceIf(0, $templateID);
+  $ti->create();
+  $task_xref_array[49] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:5:{s:11:"if_operator";s:0:"";s:8:"if_value";s:0:"";s:20:"if_process_arguments";s:15:"lasttasksuccess";s:20:"if_argument_variable";s:0:"";s:17:"if_task_arguments";s:6:"status";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Check if Publisher Accepted';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 606;
+  $rec->offset_top = 301;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceBatchFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[50] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:22:"maestro_publishArticle";s:13:"optional_parm";a:0:{}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Publish Article';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 642;
+  $rec->offset_top = 403;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[43], 'b1' => $task_xref_array[45], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[45], 'b1' => $task_xref_array[46], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[45],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[12];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[45],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[46], 'b1' => $task_xref_array[47], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[46],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $ti->modulateExportUser("Editor");
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[46],'b1' => 1,'c1' => 1,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[47], 'b1' => $task_xref_array[0], 'c1' => $task_xref_array[45]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[47], 'b1' => $task_xref_array[48], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[48], 'b1' => $task_xref_array[49], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[48],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $ti->modulateExportUser("Publisher");
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[48],'b1' => 1,'c1' => 1,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[49], 'b1' => $task_xref_array[0], 'c1' => $task_xref_array[46]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[49], 'b1' => $task_xref_array[50], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[50], 'b1' => $task_xref_array[44], 'c1' => $task_xref_array[0]));
+
+
+  /* Sample Batch Task Workflow Example */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test - Basic Batch Task Example", TRUE, TRUE, 500);
+  maestro_joinAppGroup($templateID, $app_group_id);
+  $variable_xref_array[34] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[136] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 91;
+  $rec->offset_top = 152;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[137] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 484;
+  $rec->offset_top = 345;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceBatch(0, $templateID);
+  $ti->create();
+  $task_xref_array[138] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:1:{s:7:"handler";s:31:"maestro_batch_script_sample.php";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Batch Example';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 267;
+  $rec->offset_top = 153;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceIf(0, $templateID);
+  $ti->create();
+  $task_xref_array[139] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('a:5:{s:11:"if_operator";s:0:"";s:8:"if_value";s:0:"";s:20:"if_process_arguments";s:15:"lasttasksuccess";s:20:"if_argument_variable";s:0:"";s:17:"if_task_arguments";s:6:"status";}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'If last task executed without error';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 430;
+  $rec->offset_top = 153;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[140] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:25:"Execution was successful.";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Successful execution of batch task';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 265;
+  $rec->offset_top = 241;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceInteractiveFunction(0, $templateID);
+  $ti->create();
+  $task_xref_array[141] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:2:{s:7:"handler";s:20:"maestro_show_message";s:13:"optional_parm";a:1:{s:7:"message";s:36:"Unsuccessful Execution of Batch Task";}}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Unsuccessful Execution of Batch Task';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 615;
+  $rec->offset_top = 242;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[136], 'b1' => $task_xref_array[138], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[138], 'b1' => $task_xref_array[139], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[139], 'b1' => $task_xref_array[140], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[139], 'b1' => $task_xref_array[0], 'c1' => $task_xref_array[141]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[140], 'b1' => $task_xref_array[137], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[140],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[34];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[140],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[141], 'b1' => $task_xref_array[137], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[141],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[34];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[141],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+
+  /* Manual Web Sample */
+  $_POST['offset_top'] = 0;
+  $_POST['offset_left'] = 0;
+  $variable_xref_array = Array();
+  $variable_xref_array[0] = 0;
+  $task_xref_array = Array();
+  $task_xref_array[0] = 0;
+  $templateID = maestro_createNewTemplate("Test - Manual Web Example", TRUE, TRUE, 500);
+  maestro_joinAppGroup($templateID, $app_group_id);
+  $variable_xref_array[49] = maestro_createTemplateVariable($templateID, "initiator", "");
+  $ti = new MaestroTaskInterfaceStart(0, $templateID);
+  $ti->create();
+  $task_xref_array[212] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 1;
+  $rec->taskname = 'Start';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 164;
+  $rec->offset_top = 169;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceEnd(0, $templateID);
+  $ti->create();
+  $task_xref_array[213] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 0;
+  $fixed_data = $ti->modulateExportTaskData('', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'End';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 559;
+  $rec->offset_top = 174;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $ti = new MaestroTaskInterfaceManualWeb(0, $templateID);
+  $ti->create();
+  $task_xref_array[214] = $ti->get_task_id();
+  $res = db_select('maestro_template_data', 'a');
+  $res->fields('a', array('id', 'task_data'));
+  $res->condition('a.id', $ti->get_task_id(), '=');
+  $rec = current($res->execute()->fetchAll());
+  $rec->is_interactive = 1;
+  $fixed_data = $ti->modulateExportTaskData('a:3:{s:7:"handler";s:49:"[site_url]/index.php?q=maestro_manual_web_example";s:10:"new_window";N;s:9:"use_token";N;}', $variable_xref_array);
+  $rec->task_data = $fixed_data;
+  $rec->handler = '';
+  $rec->first_task = 0;
+  $rec->taskname = 'Sample Manual Web';
+  $rec->argument_variable = '';
+  $rec->regenerate = 0;
+  $rec->regen_all_live_tasks = 0;
+  $rec->is_dynamic_taskname = 0;
+  $rec->dynamic_taskname_variable_id = 0;
+  $rec->reminder_interval = 0;
+  $rec->escalation_interval = 0;
+  $rec->last_updated = 0;
+  $rec->pre_notify_subject = '';
+  $rec->post_notify_subject = '';
+  $rec->reminder_subject = '';
+  $rec->escalation_subject = '';
+  $rec->pre_notify_message = '';
+  $rec->post_notify_message = '';
+  $rec->reminder_message = '';
+  $rec->escalation_message = '';
+  $rec->num_reminders = 0;
+  $rec->offset_left = 351;
+  $rec->offset_top = 161;
+  $rec->surpress_first_notification = 0;
+  drupal_write_record('maestro_template_data', $rec, array('id'));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[212], 'b1' => $task_xref_array[214], 'c1' => $task_xref_array[0]));
+  $sql  = "INSERT INTO {maestro_template_data_next_step} (template_data_from, template_data_to, template_data_to_false) VALUES (:a1, :b1, :c1)";
+  db_query($sql, array('a1' => $task_xref_array[214], 'b1' => $task_xref_array[213], 'c1' => $task_xref_array[0]));
+  $query = db_select('maestro_template_data', 'a');
+  $query->fields('a',array('task_class_name'));
+  $query->condition('a.id',$task_xref_array[214],'=');
+  $name=current($query->execute()->fetchAll());
+  $task_type = substr($name->task_class_name, 15);
+  $task_class = 'MaestroTaskInterface' . $task_type;
+  $ti = new $task_class(0,0);
+  $modulated_id = $variable_xref_array[49];
+  $sql  = "INSERT INTO {maestro_template_assignment} (template_data_id, assign_type, assign_by, assign_id) VALUES (:a1, :b1, :c1, :d1)";
+  db_query($sql, array( 'a1' => $task_xref_array[214],'b1' => 1,'c1' => 2,'d1' => $modulated_id,));
+
+
+
+}
+
+function maestro_test_flows_uninstall() {
+
+}
\ No newline at end of file
diff --git a/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.module b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.module
new file mode 100644
index 0000000000000000000000000000000000000000..ff7f71a945f9113b8c34bb15b1ef588ee6d0ecad
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_test_flows/maestro_test_flows.module
@@ -0,0 +1,40 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro_test_flows.module
+ */
+
+
+function maestro_test_flows_menu() {
+  $items = array();
+  //We're implementing a single menu hook here for the sample Manual Web workflow template.
+  $items['maestro_manual_web_example'] = array(
+    'title' => 'Maestro Manual Web Example',
+    'description' => 'Manual Web example.',
+    'page callback' => 'maestro_manual_web_example',
+    'access arguments' => array('maestro user'),
+    'type' => MENU_CALLBACK,
+    );
+  return $items;
+}
+
+
+function maestro_test_flows_theme() {
+  //We require to theme the output of the manual web example page.
+  return array(
+  'maestro_manual_web_example' => array(
+      'template' => 'theme/maestro-manual-web-example',
+      'variables' => array('queue_id' => 0)
+    ),
+ );
+}
+
+function maestro_manual_web_example() {
+  global $base_url;
+  $maestro_path = $base_url . '/' . drupal_get_path('module', 'maestro');
+  drupal_add_css($maestro_path . '/css/maestro.css');
+  $queue_id=check_plain($_GET['queueid']);
+  return theme('maestro_manual_web_example', array('queue_id' => $queue_id));
+}
diff --git a/sites/all/modules/maestro/modules/maestro_test_flows/theme/maestro-manual-web-example.tpl.php b/sites/all/modules/maestro/modules/maestro_test_flows/theme/maestro-manual-web-example.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..af47635d59f2fd1f461bcd339437dfe023b00256
--- /dev/null
+++ b/sites/all/modules/maestro/modules/maestro_test_flows/theme/maestro-manual-web-example.tpl.php
@@ -0,0 +1,59 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-manual-web-example.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td>Manual Web Task Example page.</td>
+  </tr>
+  <tr>
+    <td>
+        <span id="maestro_completing"></span>
+        <input id="completeButton" type="button" onclick="maestro_completeManualWebExample(<?php print $queue_id; ?>);"
+        value="<?php print(t('Click here to complete your manual web task')); ?>"></input>
+        <div id="completedLink"><a href="<?php print(url('maestro/taskconsole')); ?>">Click here to return to the task console.</a></div>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <span id="manualWebStatus" style="color: red"></span>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+jQuery('#completedLink').addClass('maestro_hide_item');
+function maestro_completeManualWebExample(queueID) {
+	  var errormsg=Drupal.t('There has been an error.  Please try your Complete again.');
+	  jQuery('#maestro_completing').addClass('maestro_working');
+	  jQuery.ajax( {
+	    type : 'POST',
+	    cache : false,
+	    url : '<?php print(url('maestro/taskconsole/ajax') . '/complete_task/'); ?>' + queueID,
+	    dataType : "json",
+	    success : function (data) {
+	      jQuery('#maestro_completing').removeClass('maestro_working');
+	      if (data.status == "0") { // query failed
+	        jQuery('#manualWebStatus').html(errormsg);
+	      } else {
+	        jQuery('#manualWebStatus').html('');
+	        jQuery('#completeButton').addClass('maestro_hide_item');
+	        jQuery('#completedLink').removeClass('maestro_hide_item');
+	        jQuery('#completedLink').addClass('maestro_show_item');
+	      }
+	    },
+	    error : function (request, status, error){
+	    	jQuery('#manualWebStatus').html(Drupal.t('There has been an error in the request.'));
+	    },
+	    data : ''
+	  });
+	}
+
+
+</script>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/maestro-all-flows-display.tpl.php b/sites/all/modules/maestro/theme/maestro-all-flows-display.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..fd5bfc6b60b8471a153096963f65c961e3f6f9f2
--- /dev/null
+++ b/sites/all/modules/maestro/theme/maestro-all-flows-display.tpl.php
@@ -0,0 +1,23 @@
+<table>
+<tr>
+  <th><?php print t('Description'); ?></th>
+  <th><?php print t('Initiator'); ?></th>
+  <th></th>
+</tr>
+<?php
+$cntr = 0;
+foreach ($database_result_set as $record) {
+($cntr%2 == 0 ) ? $rowclass = 'maestroEvenRow' : $rowclass = 'maestroOddRow'; ?>
+  <tr class="<?php print $rowclass; ?>">
+    <td><?php print filter_xss($record->description); ?></td>
+    <td><?php print filter_xss($record->name); ?></td>
+    <td><img title="test" id="maestro_viewdetail_<?php print intval($record->id); ?>" onclick="maestro_get_project_details(this);" src="<?php print $maestro_path?>/images/taskconsole/folder_closed.gif"  pid="<?php print intval($record->id); ?>"></td>
+  </tr>
+  <tr class="maestro_hide_secondary_row <?php print $rowclass; ?>" id="maestro_project_information_row_<?php print intval($record->id); ?>">
+    <td colspan="3">
+      <div id="maestro_project_information_div_<?php print intval($record->id); ?>"></div>
+    </td>
+  </tr>
+<?php $cntr+=1;
+}?>
+</table>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/maestro-all-flows.tpl.php b/sites/all/modules/maestro/theme/maestro-all-flows.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..7a513049b6f59c2fdc8bab98266d88d74812ea0e
--- /dev/null
+++ b/sites/all/modules/maestro/theme/maestro-all-flows.tpl.php
@@ -0,0 +1,20 @@
+<script type="text/javascript">
+var ajax_url='<?php print $ajax_url; ?>';
+var filter_url='<?php print $filter_url; ?>';
+</script>
+
+<div id="maestro_error_message"></div>
+
+<form id="maestroFilterAllFlowsFrm">
+<div id="maestro_all_flows_filter">
+<?php print t('Flow Name: '); ?>
+<input type="text" name="flowNameFilter" id="flowNameFilter"></input>
+<?php print t('User: '); ?>
+<input type="text" name="userNameFilter" id="userNameFilter"></input>
+<input type="button" value="<?php print t('Filter'); ?>" id="filterAllFlows"></input>
+<span id="maestro_filter_working"></span>
+</div>
+</form>
+<div id="maestro_all_flows_display">
+<?php print theme('maestro_all_flows_display', array('ajax_url' => $ajax_url, 'database_result_set' => $database_result_set)); ?>
+</div>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/maestro-outstanding-tasks.tpl.php b/sites/all/modules/maestro/theme/maestro-outstanding-tasks.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..6ca73b90c5ff80677ebace6386b1bc7ff96ff89f
--- /dev/null
+++ b/sites/all/modules/maestro/theme/maestro-outstanding-tasks.tpl.php
@@ -0,0 +1,71 @@
+<?php
+// $Id: maestro-outstanding-tasks.tpl.php,v 1.8 2010/09/03 18:13:13 blainelang Exp $
+
+/**
+ * @file
+ * maestro-outstanding-tasks.tpl.php
+ */
+
+?>
+<fieldset class="form-wrapper">
+  <div style="float: right;">
+    <form id="system_tasks_form" action="<?php print url('maestro/outstanding'); ?>" method="POST">
+    <label for="show_system_tasks"><?php print t('Show Hidden Tasks'); ?></label>
+    <input type="checkbox" id="show_system_tasks" name="show_system_tasks" value="1" onchange="document.getElementById('system_tasks_form').submit();" <?php print ($show_system_tasks == 1) ? 'checked="checked"':''; ?>>
+    </form>
+  </div>
+  <table class="sticky-enabled sticky-table">
+    <thead class="tableheader-processed">
+      <tr>
+        <th><?php print t('Task Name'); ?></th>
+        <th><?php print t('Assigned To'); ?></th>
+        <th style="text-align:right"><?php print t('Operation'); ?></th>
+      </tr>
+    </thead>
+
+    <tbody>
+
+<?php
+  if (is_array($queue)) {
+    $i = 0;
+    foreach ($queue as $task) {
+      $classname = ((++$i % 2) == 0) ? 'even':'odd';
+?>
+      <tr id="ot_row<?php print $i; ?>" class="<?php print $classname; ?>">
+        <td style="vertical-align: top;"><?php print $task->taskname; ?></td>
+        <td style="vertical-align: top;"><?php print $task->username; ?></td>
+        <td style="text-align:right;vertical-align: top; width: 200px;">
+          <?php print l("<img class=\"valigncenter\" src=\"{$maestro_url}/images/taskconsole/reassign.png\">", "maestro/outstanding/reassign/{$task->queue_id}", array('html' => TRUE, 'attributes' => array('title' => t('Reassign this Task'), 'onclick' => "show_reassign(this, '{$task->uid}'); return false;") )); ?>
+          <?php print l("<img class=\"valigncenter\" src=\"{$maestro_url}/images/taskconsole/email.png\">", "maestro/outstanding/email/{$task->queue_id}/{$task->uid}", array('html' => TRUE, 'attributes' => array('title' => t('Send a Reminder to Task Owner')) )); ?>
+          <?php print l("<img class=\"valigncenter\" src=\"{$maestro_url}/images/taskconsole/trace.png\">", "maestro/trace/0/{$task->process_id}/{$task->queue_id}", array('html' => TRUE, 'attributes' => array('title' => t('Trace this Process')) )); ?>
+          <?php print l("<img class=\"valigncenter\" src=\"{$maestro_url}/images/taskconsole/delete.png\">", "maestro/outstanding/delete/{$task->queue_id}", array('html' => TRUE, 'attributes' => array('title' => t('Delete this Task'), 'onclick' => "return confirm('" . t('Are you sure you want to delete this task?') . "');") )); ?>
+        </td>
+      </tr>
+<?php
+    }
+  }
+  else {
+?>
+    <tr>
+      <td colspan="3" style="text-align: center; font-style: italic;"><?php print t('There are no outstanding tasks'); ?></td>
+    </tr>
+<?php
+  }
+?>
+
+    </tbody>
+  </table>
+</fieldset>
+
+<div id="user_select" style="display: none;">
+  <select name="reassign_uid">
+    <option value="0"><?php print t('Select User'); ?></option>
+<?php
+      foreach ($users as $user) {
+?>
+        <option value="<?php print $user->uid; ?>"><?php print $user->name; ?></option>
+<?php
+      }
+?>
+  </select>
+</div>
diff --git a/sites/all/modules/maestro/theme/maestro-taskconsole.tpl.php b/sites/all/modules/maestro/theme/maestro-taskconsole.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..8beb61b271e1fc43d796677be4a2e012fd9c1202
--- /dev/null
+++ b/sites/all/modules/maestro/theme/maestro-taskconsole.tpl.php
@@ -0,0 +1,93 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-taskconsole.tpl.php
+ */
+
+?>
+<script type="text/javascript">
+  var ajax_url = '<?php print $ajax_server_url; ?>';
+</script>
+
+<table width="100%">
+  <tr>
+    <td style="text-align: right">
+      <form method="get" action="<?php print url("maestro/launch"); ?>" id="frmLaunchNewProcess">
+      <?php print t('Start New Process:'); ?>
+      <select name="templateid">
+      <?php foreach($process_dropdown as $optid => $optval){ ?>
+        <option value="<?php print $optid; ?>"><?php print $optval; ?></option>
+      <?php } ?>
+      </select>
+      <input type="button" value="Launch" id="taskConsoleLaunchNewProcess"></input>
+      <div id="newProcessStatusRowSuccess" style="display:none;color: green;">
+        <?php print t('Started Process successfully.'); ?>
+      </div>
+      <div id="newProcessStatusRowFailure" style="display:none;color: green;">
+        <?php print t('Error Starting Process.'); ?>
+      </div>
+      </form>
+    </td>
+  </tr>
+</table>
+
+<table width="100%">
+<tr>
+  <th width="3%"><?php print t(''); ?></th>
+  <th width="30%"><?php print t('Flow Name'); ?></th>
+  <th width="30%"><?php print t('Task Name'); ?></th>
+  <th width="12%"><?php print t('Assigned'); ?></th>
+  <th colspan="2" width="5%">&nbsp;</th>
+</tr>
+
+<?php
+ $rowid = 1;
+ foreach ($variables['formatted_tasks'] as $task) {
+ ?>
+<tr id="maestro_taskcontainer<?php print $task->queue_id; ?>" class="maestro_taskconsole_interactivetask <?php print $zebra ?>">
+    <td width="3%" class="<?php print $task->queue_id; ?>" style="border-left:1px solid white">
+        <img src="<?php print $task->task_icon; ?>" TITLE="<?php print t('Process ID: '); print $task->process_id; print t(', Task ID: '); print $task->queue_id; print $task->task_started; ?>" id="taskIconImg<?php print $rowid; ?>">
+    </td>
+    <td width="30%"><?php print $task->flow_name; ?></td>
+    <td width="30%" class="maestro_taskconsole_interactivetaskName">
+        <a class="info" style="text-decoration:none;" taskid="<?php print $task->queue_id; ?>" href="<?php print $task->task_action_url; ?>"><?php print $task->taskname; ?>
+            <span style="width:300px;display: <?php print $task->hidetaskinfo; ?>;">
+                <?php print $task->onholdnotice; ?>
+                <b><?php print t('Date Assigned:'); ?></b>&nbsp;<?php print $task->assigned_longdate; ?>
+                <div style="display:<?php print $task->showmoretaskdetail; ?>">
+                  <b><?php print t('Description:'); ?></b>&nbsp;<?php print $task->description; ?><br>
+                  <b><?php print t('Comments:'); ?></b>&nbsp;<?php print $task->comment_note; ?>
+                </div>
+            </span>
+        </a>
+    </td>
+    <td width="12%" nowrap><?php print $task->assigned_shortdate; ?></td>
+    <td width="2%" nowrap>
+      <span id="maestro_ajax_indicator<?php print $task->queue_id;?>" class="maestro_ajax_indicator" style="display:none;"><img src="<?php print $module_base_url; ?>/images/admin/status-active.gif"></span>
+    </td>
+    <td width="5%" style="border-right:1px solid white;" nowrap>
+    	<span class="maestro_taskconsole_viewdetail" taskid="<?php print $task->queue_id;?>" rowid="<?php print $rowid;?>">
+         <img id="maestro_viewdetail_foldericon<?php print $task->queue_id; ?>" src="<?php print $module_base_url; ?>/images/taskconsole/folder_closed.gif" TITLE="<?php print t('Click to toggle workflow details'); ?>">
+      </span>
+    </td>
+</tr>
+
+<!-- {inline action record} -->
+  <?php
+    print $task->action_record;
+  ?>
+  <tr  id="maestro_taskconsole_detail_rec<?php print $task->queue_id; ?>" style="display:none;">
+      <td colspan="6" style="padding:10px;">
+          <div id="projectdetail_rec<?php print $rowid; ?>"></div>
+      </td>
+  </tr>
+    <?php
+      $rowid++;
+      $zebra = ($zebra == 'even') ? 'odd': 'even';
+}
+?>
+
+</table>
+
diff --git a/sites/all/modules/maestro/theme/maestro-trace.tpl.php b/sites/all/modules/maestro/theme/maestro-trace.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..e8c49595eda67c00b7ece9e53013cd2df3ed2f87
--- /dev/null
+++ b/sites/all/modules/maestro/theme/maestro-trace.tpl.php
@@ -0,0 +1,183 @@
+<?php
+// $Id: maestro-trace.tpl.php,v 1.7 2010/08/17 14:54:46 chevy Exp $
+
+/**
+ * @file
+ * maestro-trace.tpl.php
+ */
+
+?>
+
+  <div id="maestro_ajax_indicator" class="maestro_ajax_indicator" style="display: none;"><img src="<?php print $maestro_url; ?>/images/admin/status-active.gif"></div>
+
+  <div>
+    <?php print t('Related Workflows'); ?>:
+<?php
+    foreach ($wf_res as $rec) {
+      print l($rec->template_name, "maestro/trace/{$rec->tracking_id}/{$rec->initiating_pid}/0") . '&nbsp;&nbsp;';
+    }
+?>
+  </div>
+
+  <div>
+    <?php print t('Regeneration Instance'); ?>:
+<?php
+    foreach ($proc_res as $rec) {
+      $checked = ($rec->id == $properties->process_id) ? 'checked="checked"':'';
+?>
+      <label for="proc_radio<?php print $rec->id; ?>"><input id="proc_radio<?php print $rec->id; ?>" type="radio" name="regen_instance" <?php print $checked; ?> onclick="switch_process_focus(<?php print $rec->id; ?>);"><?php print $rec->id; ?></label>&nbsp;&nbsp;&nbsp;
+<?php
+    }
+?>
+  </div>
+  <div style="width: 67%; float: left;">
+    <form id="maestro_task_history_form" method="post" action="" onsubmit="save_task_changes(this); return false;">
+      <input type="hidden" name="op" value="save_task_changes">
+      <fieldset class="form-wrapper">
+        <legend>
+          <span class="fieldset-legend">Task History</span>
+        </legend>
+        <div class="fieldset-wrapper">
+          <table class="sticky-enabled sticky-table">
+            <thead class="tableheader-processed">
+              <tr>
+                <th></th>
+                <th><?php print t('Task Name'); ?></th>
+                <th><span title="<?php print t('Owner / Completor'); ?>"><?php print t('Owner'); ?></span></th>
+                <th><?php print t('Status'); ?></th>
+                <th><span title="<?php print t('Archived'); ?>"><?php print t('Ar...'); ?></span></th>
+              </tr>
+            </thead>
+            <tbody>
+<?php
+              $i = 0;
+              foreach ($trace as $rec) {
+                $classname = ($rec->process_id == $properties->process_id) ? 'focused_process':'blurred_process';
+?>
+                <tr class="process<?php print $rec->process_id; ?> <?php print $classname; ?> <?php print ($rec->process_id == $properties->process_id) ? 'odd':'even'; ?>">
+                  <td>
+                    <input type="hidden" id="batch_op<?php print $i; ?>" name="batch_op[]" value="0">
+                    <input type="checkbox" onchange="set_batch_op(this, <?php print $i; ?>);" value="1">
+                  </td>
+                  <td>
+                    <input type="hidden" name="queue_id[]" value="<?php print $rec->id; ?>">
+                    <a href="#" class="info" style="text-decoration: none;" onclick="return false;">
+                      <?php print $rec->id; ?>: <?php print $rec->taskname; ?>
+                      <span style="display: none; margin: 0px 0px 0px 75px;">
+                        <?php print t('Owner'); ?>: <?php print ($rec->username) == '' ? t('N/A') : $rec->username; ?><br />
+                        <?php print t('Created'); ?>: <?php print ($rec->created_date != 0) ? date('Y-m-d H:i:s', $rec->created_date) : t('N/A'); ?><br />
+                        <?php print t('Started'); ?>: <?php print ($rec->started_date != 0) ? date('Y-m-d H:i:s', $rec->started_date) : t('N/A'); ?><br />
+                        <?php print t('Completed'); ?>: <?php print ($rec->completed_date != 0) ? date('Y-m-d H:i:s', $rec->completed_date) : t('N/A'); ?><br />
+                      </span>
+                    </a>
+                  </td>
+                  <td>
+                    <?php print $rec->username; ?>
+                  </td>
+                  <td>
+                    <select name="status[]">
+<?php
+                      foreach ($statuses as $value => $label) {
+?>
+                        <option value="<?php print $value; ?>" <?php print ($value == $rec->status) ? 'selected="selected"':''; ?>><?php print $label; ?></option>
+<?php
+                      }
+?>
+                    </select>
+                  </td>
+                  <td>
+                    <input type="hidden" id="archived<?php print $i; ?>" name="archived[]" value="<?php print $rec->archived; ?>">
+                    <input type="checkbox" value="1" onchange="set_archived(this, <?php print $i; ?>);" <?php print ($rec->archived == 1) ? 'checked="checked"':''; ?>>
+                  </td>
+                </tr>
+<?php
+                $i++;
+              }
+?>
+              <tr class="even">
+                <td><img src="<?php print $maestro_url; ?>/images/taskconsole/arrow_ltr.png"></td>
+                <td>
+                  <select name="batch_op_status">
+<?php
+                    foreach ($statuses as $value => $label) {
+?>
+                      <option value="<?php print $value; ?>"><?php print $label; ?></option>
+<?php
+                    }
+?>
+                  </select>
+                </td>
+                <td></td>
+                <td></td>
+                <td></td>
+              </tr>
+              <tr>
+                <td colspan="5" style="text-align: center;"><input type="submit" value="Save All Task Changes"></td>
+              </tr>
+            </tbody>
+          </table>
+        </div>
+      </fieldset>
+    </form>
+  </div>
+
+  <div style="width: 31%; float: right;">
+    <form id="maestro_process_variables_form" method="post" action="" onsubmit="save_process_variables(this); return false;">
+      <input type="hidden" name="op" value="save_process_variables">
+      <fieldset class="form-wrapper">
+        <legend>
+          <span class="fieldset-legend"><?php print t('Process Variables'); ?></span>
+        </legend>
+        <div class="fieldset-wrapper">
+<?php
+          $i = 0;
+          $prev_rec_pid = 0;
+          foreach ($pv_res as $rec) {
+            if ($prev_rec_pid != $rec->process_id) {
+              $prev_rec_pid = $rec->process_id;
+              if ($i++ > 0) {
+?>
+              <tr>
+                <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print t('Save Process Variables'); ?>"></td>
+              </tr>
+            </tbody>
+          </table>
+<?php
+              }
+?>
+          <table id="process_variables<?php print $rec->process_id; ?>" class="process_variables" style="display: <?php print ($rec->process_id == $properties->process_id) ? '':'none'; ?>;">
+            <thead>
+              <tr>
+                <th><?php print t('Variable Name'); ?></th>
+                <th><?php print t('Value'); ?> </th>
+              </tr>
+            </thead>
+            <tbody>
+<?php
+            }
+?>
+              <tr class="even">
+                <td>
+                  <input type="hidden" name="process_variable_id[]" value="<?php print $rec->id; ?>">
+                  <?php print $rec->variable_name; ?>
+                </td>
+                <td>
+                  <input type="text" name="process_variable_value[]" value="<?php print $rec->variable_value; ?>" size="6">
+                </td>
+              </tr>
+<?php
+          }
+?>
+              <tr>
+                <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print t('Save Process Variables'); ?>"></td>
+              </tr>
+            </tbody>
+          </table>
+        </div>
+      </fieldset>
+    </form>
+  </div>
+
+  <script type="text/javascript">
+    var ajax_url = '<?php print "{$ajax_url}/trace/{$properties->tracking_id}/{$properties->initiating_pid}/{$properties->queue_id}"; ?>';
+  </script>
diff --git a/sites/all/modules/maestro/theme/project_detail_comments.tpl.php b/sites/all/modules/maestro/theme/project_detail_comments.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..fa1461cd08e7f26a1a67c725e98d2ba5211b22f1
--- /dev/null
+++ b/sites/all/modules/maestro/theme/project_detail_comments.tpl.php
@@ -0,0 +1,31 @@
+        <fieldset>
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/collapse.png" border="0" onClick="toggleProjectSection('projectComments','Open',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('projectComments','Open',<?php print $rowid; ?>)"><b><?php print t('Comments'); ?></b></span>
+                </span>
+            </legend>
+            <div style="clear:both;">&nbsp;</div>
+            <?php
+              if (count($comment_records) > 0) {
+              foreach ($comment_records as $rec) {  ?>
+                <div class="maestro_comment">
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/comment.gif" alt="" align="middle" border="0" height="16" width="16">&nbsp; <?php print t('Comment by'); ?>:&nbsp;<?php print $rec->username;?>&nbsp;<?php print t('on'); ?>&nbsp;<?php print $rec->date; ?>
+                    <span style="padding-left:20px;visibility:<?php print $rec->show_delete; ?>">
+                      <a href="#" onClick="ajaxMaestroComment('del',<?php print $rowid; ?>,<?php print $tracking_id; ?>,<?php print $rec->id; ?>);"><img src="<?php print $module_base_url; ?>/images/taskconsole/delete.gif" Title="<?php print t('Delete Comment'); ?>" border="0"></a>
+                    </span>
+                    <span style="padding-left:10px;">
+                      <a href="#" onClick="ajaxMaestroComment('new',<?php print $rowid; ?>);"><img src="<?php print $module_base_url; ?>/images/taskconsole/new_comment.gif" TITLE="<?php print t('Add Comment');?>" border="0"></a>
+                    </span>
+                    <br>
+                    <div style="padding-bottom:5px;"><b><?php print t('Task'); ?>:&nbsp;</b><?php print $rec->taskname; ?></div>
+                    <div class="maestro_boxed elementUpdated"><p><?php print $rec->comment; ?></p></div>
+                </div>
+                <?php
+              }
+              } else {
+                ?><span style="padding-left:10px;"></span><a href="#" onClick="ajaxMaestroComment('new',<?php print $rowid; ?>);"><?php print t('New Comment'); ?></a></span>
+                <?php
+              }
+              ?>
+        </fieldset>
diff --git a/sites/all/modules/maestro/theme/project_detail_container.tpl.php b/sites/all/modules/maestro/theme/project_detail_container.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..99a6ec33787703c1fb9e913c78c26dbb1675a14f
--- /dev/null
+++ b/sites/all/modules/maestro/theme/project_detail_container.tpl.php
@@ -0,0 +1,214 @@
+  <div class="taskconsoleActionRec">
+    <span id="expandProject<?php print $rowid; ?>" style="padding:0px 0px 15px 10px;"><a href="#" onClick='projectDetailToggleAll("expand",<?php print $rowid; ?>);return false;'><?php print t('Expand All'); ?></a></span>
+    <span id="collapseProject<?php print $rowid; ?>" style="padding:0px 0px 15px 10px;display:none;"><a href="#" onClick='projectDetailToggleAll("collapse",<?php print $rowid; ?>);return false;'><?php print t('Collapse All'); ?></a></span>
+    <span style="padding:0px 0px 15px 20px;display:<?php print $hiderequestlink ?>;">[&nbsp;<a href="<?php print $project_link ?>" onclick="alert('Not yet implemented');return false;"><?php print t('Request Link'); ?></a>&nbsp;]</span>
+        <div id="newcomment_container_<?php print $rowid; ?>" style="padding-top:10px;display:none;">
+            <form name="fprjcmt_<?php print $rowid; ?>" id="fprjcmt_<?php print $rowid; ?>" ACTION="" METHOD="post" style="margin:0px;">
+                <fieldset><legend><b><?php print t('New Comment'); ?></b></legend>
+                <div style="padding:5px;"><TEXTAREA id="newcomment_<?php print $tracking_id;?>" name="maestro_comment" cols="100" rows="3"></TEXTAREA></div>
+                <div style="padding-left:50px;">
+                    <input type="button" value="<?php print t('Cancel'); ?>" onClick="document.getElementById('newcomment_container_<?php print $rowid; ?>').style.display='none';">&nbsp;
+                    <input type="button" value="<?php print t('Add Comment'); ?>" onClick="ajaxMaestroComment('add',<?php print $rowid; ?>,<?php print $tracking_id;?>);">
+                </div>
+                </fieldset>
+            </form>
+        </div>
+
+
+        <!-- Project Summary Section -->
+        <div class="taskdetail taskdetailOpenRec<?php print $rowid; ?>" id="summaryOpen_rec<?php print $rowid; ?>">
+        <fieldset>
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/collapse.png" border="0" onClick="toggleProjectSection('summary','Open',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('summary','Open',<?php print $rowid; ?>)"><b><?php print t('Summary'); ?></b></span>
+                </span>
+            </legend>
+            <div style="clear:both;"></div>
+            <table class="maestroDetailSubTable" cellpadding="0" cellspacing="0" width="98%" border="0" >
+                <tr class="taskconsolesummary">
+                    <td width="160"><?php print t('Flow Name'); ?>:</td><td><?php print $flow_description ?></td>
+                </tr>
+                <tr class="taskconsolesummary">
+                    <td width="160"><?php print t('Flow Tracking ID'); ?></td><td><?php print $tracking_id ?></td>
+                </tr>
+                <tr class="taskconsolesummary">
+                    <td width="160"><?php print t('Status'); ?>:</td>
+                    <td nowrap><?php print $variables['project_status']; print $variables['special_status_action']; ?>
+                        <span style="padding-left:20px;"><?php print $variables['delete_project_action'] ?></span>
+                    </td>
+                </tr>
+                <?php print $custom_workflow_summary ?>
+            </table>
+        </fieldset>
+        </div>
+        <div class="taskdetail taskdetailClosedRec<?php print $rowid; ?>" id="summaryClosed_rec<?php print $rowid; ?>" style="padding:5px 19px;display:none;">
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/expand.png" border="0" onClick="toggleProjectSection('summary','Closed',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('summary','Closed',<?php print $rowid; ?>)"><b><?php print t('Summary'); ?></b></span>
+                </span>
+            </legend>
+        </div>
+
+
+        <!-- Project Related Content Section -->
+        <?php
+          if (count($content_records) > 0) { //  Test if there is any content - else don't show this section ?>
+        <div class="taskdetail taskdetailOpenRec<?php print $rowid; ?>" id="projectContentOpen_rec<?php print $rowid; ?>" style="display:none;">
+        <fieldset>
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/collapse.png" border="0" onClick="toggleProjectSection('projectContent','Open',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('projectContent','Open',<?php print $rowid; ?>)"><b><?php print t('Content'); ?></b></span>
+                </span>
+            </legend>
+            <?php
+              foreach ($content_records as $content) {
+                print $content;
+              }
+            ?>
+        </fieldset>
+        </div>
+
+        <div class="taskdetail taskdetailClosedRec<?php print $rowid; ?>" id="projectContentClosed_rec<?php print $rowid; ?>" style="padding:5px 19px;">
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/expand.png" border="0" onClick="toggleProjectSection('projectContent','Closed',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('projectContent','Closed',<?php print $rowid; ?>)"><b><?php print t('Content'); ?></b></span>
+                </span>
+            </legend>
+        </div>
+        <?php }  // End of IF test to see if there is any content to display ?>
+
+        <!-- Outstanding Tasks Section -->
+        <div class="taskdetail taskdetailOpenRec<?php print $rowid; ?>" id="outstandingTasksOpen_rec<?php print $rowid; ?>" style="display:none;">
+        <fieldset>
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/collapse.png" border="0" onClick="toggleProjectSection('outstandingTasks','Open',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('outstandingTasks','Open',<?php print $rowid; ?>)"><b><?php print t('Outstanding Tasks'); ?></b></span>
+                </span>
+            </legend>
+            <div id="outstanding_task_rec<?php print $rowid; ?>">
+                <table class="maestroDetailSubTable" cellpadding="0" cellspacing="1" width="99%" border="0">
+                    <tr>
+                        <th><?php print t('Task Name'); ?></th>
+                        <th><?php print t('Owner'); ?></th>
+                        <th><?php print t('Assigned'); ?></th>
+                        <th style="display:<?php print $show_otaskaction ?>;"><?php print t('Action'); ?></th>
+                    </tr>
+                        <?php
+                        $class = 'odd';
+                        foreach ($outstanding_tasks as $otask) { ?>
+                          <tr class="<?php print $class; ?>">
+                          <td><?php print $otask->taskname ?></td>
+                          <td><?php print $otask->owner ?></td>
+                          <td><?php print $otask->assigned_date ?></td>
+                          <td><?php
+                            if ($workflow_admin) {
+                              ?>
+                              <form id="frmOutstandingTasksRow<?php print $rowid; ?>" style="margin:0px;" method="post" action="" onsubmit="maestro_ajaxUpdateTaskAssignment(<?php print $rowid ?>); return false;">
+                                  <input type="hidden" name="rowid" value="<?php print $rowid; ?>">
+                                  <input type="hidden" name="variable_id" value="<?php print $otask->variable_id; ?>">
+                                  <input type="hidden" name="taskuser" value="<?php print $otask->taskuser ?>">
+                                  <input type="hidden" name="taskassign_mode" value="<?php print $otask->taskassign_mode; ?>">
+                                  <input type="hidden" name="taskid" value="<?php print $otask->task_id; ?>">
+                                  <select name="task_reassign_uid">
+                                      <option value="0"><?php print t('Assign to user'); ?></option>
+                                        <?php
+                                          foreach ($reassign_user_options as $user_id => $user_name) {
+                                        ?>
+                                            <option value="<?php print $user_id; ?>"><?php print $user_name; ?></option>
+                                        <?php
+                                           }
+                                        ?>
+                                  </select>
+                                  <input type="submit" value="<?php print t('Re-Assign'); ?>">
+                              </form>
+                            <?php
+                            } else {
+                              print '&nbsp;';
+                            }
+                            ?>
+                         </td>
+
+                        </tr>
+                        <?php
+                        $class = ($class == 'odd') ? 'even' : 'odd';
+                        }
+                        ?>
+                </table>
+            </div>
+        </fieldset>
+        </div>
+
+        <div class="taskdetail taskdetailClosedRec<?php print $rowid; ?>" id="outstandingTasksClosed_rec<?php print $rowid; ?>" style="padding:5px 19px;">
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/expand.png" border="0" onClick="toggleProjectSection('outstandingTasks','Closed',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('outstandingTasks','Closed',<?php print $rowid; ?>)"><b><?php print t('Outstanding Tasks'); ?></b></span>
+                </span>
+            </legend>
+        </div>
+
+
+        <!-- Task History Section -->
+        <div class="taskdetail taskdetailOpenRec<?php print $rowid; ?>" id="tasklogOpen_rec<?php print $rowid; ?>" style="display:none;">
+        <fieldset>
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/collapse.png" border="0" onClick="toggleProjectSection('tasklog','Open',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('tasklog','Open',<?php print $rowid; ?>)"><b><?php print t('Task History'); ?></b></span>
+                </span>
+            </legend>
+                <table class="maestroDetailSubTable" cellpadding="0" cellspacing="1" width="99%" border="0">
+                    <tr>
+                        <th><?php print t('Task Name'); ?></th>
+                        <th><?php print t('Owner'); ?></th>
+                        <th><?php print t('Assigned'); ?></th>
+                        <th><?php print t('Started'); ?></th>
+                        <th><?php print t('Completed'); ?></th>
+                        <th><?php print t('Status'); ?></th>
+                    </tr>
+                        <?php
+                        $class = 'odd';
+                        foreach ($completed_tasks as $ctask) { ?>
+                          <tr class="<?php print $class; ?>">
+                          <td><?php print $ctask->taskname ?></td>
+                          <td><?php print $ctask->owner ?></td>
+                          <td><?php print $ctask->assigned_date ?></td>
+                          <td><?php print $ctask->started_date ?></td>
+                          <td><?php print $ctask->completed_date ?></td>
+                          <td><?php print $ctask->status ?></td>
+                        </tr>
+                        <?php
+                        $class = ($class == 'odd') ? 'even' : 'odd';
+                        }
+                        ?>
+                </table>
+        </fieldset>
+        </div>
+
+        <div class="taskdetail taskdetailClosedRec<?php print $rowid; ?>" id="tasklogClosed_rec<?php print $rowid; ?>" style="padding:5px 19px;">
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/expand.png" border="0" onClick="toggleProjectSection('tasklog','Closed',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('tasklog','Closed',<?php print $rowid; ?>)"><b><?php print t('Task History'); ?></b></span>
+                </span>
+            </legend>
+        </div>
+        <div class="taskdetail taskdetailOpenRec<?php print $rowid; ?>" id="projectCommentsOpen_rec<?php print $rowid; ?>" style="display:none;">
+          <?php print theme('maestro_project_comments',array('rowid' => $rowid, 'tracking_id' => $tracking_id)); ?>
+        </div>
+        <div class="taskdetail taskdetailClosedRec<?php print $rowid; ?>" id="projectCommentsClosed_rec<?php print $rowid; ?>" style="padding:5px 19px;">
+            <legend>
+                <span>
+                    <img src="<?php print $module_base_url; ?>/images/taskconsole/expand.png" border="0" onClick="toggleProjectSection('projectComments','Closed',<?php print $rowid; ?>)">
+                        <span onClick="toggleProjectSection('projectComments','Closed',<?php print $rowid; ?>)"><b><?php print t('Comments'); ?></b> </span>
+                </span>
+            </legend>
+        </div>
+
+
+    </div>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-assign-notify-select-boxes.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-assign-notify-select-boxes.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..112b39ab6c4fcd0386c3278b50edae4ced7b6d6a
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-assign-notify-select-boxes.tpl.php
@@ -0,0 +1,44 @@
+<?php
+// $Id: maestro-workflow-assign-notify-select-boxes.tpl.php,v 1.1 2010/08/19 19:34:51 chevy Exp $
+
+/**
+ * @file
+ * maestro-workflow-assign-notify-select-boxes.tpl.php
+ */
+
+?>
+
+  <tr class="<?php print "{$row_class} {$type} {$by_variable} {$when}"; ?>" style="display: <?php print $display; ?>;">
+    <td style="width: 200px;">
+      <select size="4" multiple="multiple" style="width: 100%;" id="<?php print "{$row_class}_{$type}_{$by_variable}_{$when}_unselected"; ?>">
+<?php
+        foreach ($options as $value => $label) {
+          if (!in_array($value, $selected_options)) {
+?>
+            <option value="<?php print $value; ?>"><?php print $label; ?></option>
+<?php
+          }
+        }
+?>
+      </select>
+    </td>
+    <td style="text-align: center;">
+      <a href="#" onclick="move_options(<?php print "'{$row_class}_{$type}_{$by_variable}_{$when}', '{$row_class}_{$type}_{$by_variable}_{$when}_unselected'"; ?>); return false;"><img src="<?php print $maestro_url; ?>/images/admin/left-arrow.png"></a>
+      &nbsp;&nbsp;&nbsp;
+      <a href="#" onclick="move_options(<?php print "'{$row_class}_{$type}_{$by_variable}_{$when}_unselected', '{$row_class}_{$type}_{$by_variable}_{$when}'"; ?>); return false;"><img src="<?php print $maestro_url; ?>/images/admin/right-arrow.png"></a>
+    </td>
+    <td style="width: 200px;">
+      <script type="text/javascript"> select_boxes.push('<?php print "{$row_class}_{$type}_{$by_variable}_{$when}"; ?>'); </script>
+      <select size="4" multiple="multiple" style="width: 100%;" id="<?php print "{$row_class}_{$type}_{$by_variable}_{$when}"; ?>" name="<?php print $name; ?>">
+<?php
+        foreach ($options as $value => $label) {
+          if (in_array($value, $selected_options)) {
+?>
+            <option value="<?php print $value; ?>"><?php print $label; ?></option>
+<?php
+          }
+        }
+?>
+      </select>
+    </td>
+  </tr>
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-tasks-frame.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-tasks-frame.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..a99eef13ce3c4652d95ee5b472cb38abbaa1aadb
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-tasks-frame.tpl.php
@@ -0,0 +1,355 @@
+<?php
+// $Id: maestro-workflow-edit-tasks-frame.tpl.php,v 1.21 2010/08/30 16:13:53 blainelang Exp $
+
+/**
+ * @file
+ * maestro-workflow-edit-tasks-frame.tpl.php
+ */
+
+?>
+
+<div>
+  <div style="margin: 0px 0px 0px 10px; float: left;">&nbsp;</div>
+
+  <div id="task_edit_tab_main" class="active"><div class="maestro_task_edit_tab"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-tab"><div class="br-tab"><div class="tl-tab"><div class="tr-tab">
+  <a href="#" onclick="switch_task_edit_section('main'); return false;"><?php print t('Main'); ?></a>
+  </div></div></div></div></div></div></div></div></div></div>
+
+<?php
+  if (array_key_exists('optional', $task_edit_tabs) && $task_edit_tabs['optional'] == 1) {
+?>
+    <div id="task_edit_tab_optional" class="unactive"><div class="maestro_task_edit_tab"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-tab"><div class="br-tab"><div class="tl-tab"><div class="tr-tab">
+    <a href="#" onclick="switch_task_edit_section('optional'); return false;"><?php print t('Optional'); ?></a>
+    </div></div></div></div></div></div></div></div></div></div>
+<?php
+  }
+?>
+
+<?php
+  if (array_key_exists('assignment', $task_edit_tabs) && $task_edit_tabs['assignment'] == 1) {
+?>
+    <div id="task_edit_tab_assignment" class="unactive"><div class="maestro_task_edit_tab"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-tab"><div class="br-tab"><div class="tl-tab"><div class="tr-tab">
+    <a href="#" onclick="switch_task_edit_section('assignment'); set_summary('assign'); return false;"><?php print t('Assignment'); ?></a>
+    </div></div></div></div></div></div></div></div></div></div>
+<?php
+  }
+?>
+
+<?php
+  if (array_key_exists('notification', $task_edit_tabs) && $task_edit_tabs['notification'] == 1) {
+?>
+    <div id="task_edit_tab_notification" class="unactive"><div class="maestro_task_edit_tab"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-tab"><div class="br-tab"><div class="tl-tab"><div class="tr-tab">
+    <a href="#" onclick="switch_task_edit_section('notification'); set_summary('notify'); return false;"><?php print t('Notification'); ?></a>
+    </div></div></div></div></div></div></div></div></div></div>
+<?php
+  }
+?>
+
+  <div style="margin: 0px 10px 0px 0px; float: right;">&nbsp;</div>
+
+  <div class="active"><div class="maestro_task_edit_tab_close" style="float: right;"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-cl"><div class="br-cl"><div class="tl-cl"><div class="tr-cl">
+  <a href="#" onclick="(function($) { $.modal.close(); disable_ajax_indicator(); select_boxes = []; })(jQuery); return false;"><img src="<?php print $maestro_url; ?>/images/admin/close.png"></a>
+  </div></div></div></div></div></div></div></div></div></div>
+
+  <div style="clear: both;"></div>
+
+  <div class="maestro_task_edit_panel">
+    <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl-wht"><div class="br-wht"><div class="tl-wht"><div class="tr-wht">
+      <form id="maestro_task_edit_form" method="post" action="" onsubmit="return save_task(this);">
+        <input type="hidden" name="task_class" value="<?php print $task_class; ?>">
+        <input type="hidden" name="template_data_id" value="<?php print $tdid; ?>">
+
+        <div id="task_edit_main">
+          <div style="float: none;" class="maestro_tool_tip maestro_taskname"><div class="t"><div class="b"><div class="r"><div class="l"><div class="bl-bge"><div class="br-bge"><div class="tl-bge"><div class="tr-bge">
+            <?php print t('Task Name'); ?>: <input id="maestro_task_name" type="text" name="taskname" value="<?php print $vars->taskname; ?>"><br>
+            <label for="regen"><input type="checkbox" id="regen" name="regen" value="1" <?php print ($vars->regenerate == 1) ? 'checked="checked"':''; ?>><?php print t('Regenerate This Task'); ?></label>&nbsp;&nbsp;&nbsp;
+            <label for="regenall"><input type="checkbox" id="regenall" name="regenall" value="1" <?php print ($vars->regen_all_live_tasks == 1) ? 'checked="checked"':''; ?>><?php print t('Regenerate All In-Production Tasks'); ?></label>
+            <label for="showindetail"><input type="checkbox" id="showindetail" name="showindetail" value="1" <?php print ($vars->show_in_detail == 1) ? 'checked="checked"':''; ?>><?php print t('Show in Detail'); ?></label>
+          </div></div></div></div></div></div></div></div></div><br />
+
+          <?php print $form_content; ?>
+        </div>
+
+<?php
+  if (array_key_exists('optional', $task_edit_tabs) && $task_edit_tabs['optional'] == 1) {
+?>
+        <div id="task_edit_optional" style="display: none;">
+          <table style="display: none;">
+            <tbody id="optional_parm_form">
+              <tr>
+                <td width="33%" style="vertical-align: top; white-space: nowrap;">
+                  <input type="text" name="op_var_names[]" value="" style="width: 150px;">
+                </td>
+                <td width="67%" style="vertical-align: top; white-space: nowrap;">
+                  <textarea name="op_var_values[]" rows="1" cols="32"></textarea>
+                  <a href="#" onclick="remove_variable(this); return false;"><img src="<?php print $maestro_url; ?>/images/admin/remove.png" class="valigntop"></a>
+                </td>
+              </tr>
+            </tbody>
+          </table>
+
+          <fieldset class="form-wrapper">
+            <legend><span class="fieldset-legend"><a href="#" onclick="add_variable(); return false;"><?php print t('Add Variable'); ?></a></span></legend>
+
+            <div class="fieldset-wrapper">
+            <table class="sticky-enabled sticky-table">
+              <thead class="tableheader-processed">
+                <tr>
+                  <th><?php print t('Variable Name'); ?></th>
+                  <th><?php print t('Variable Value'); ?></th>
+                </tr>
+              </thead>
+              <tbody id="optional_parm_vars">
+<?php
+                $i = 0;
+                foreach ($optional_parms as $var_name => $var_value) {
+                  $classname = ((++$i % 2) == 0) ? 'even':'odd';
+?>
+                  <tr class="<?php print $classname; ?>">
+                    <td width="33%" style="vertical-align: top; white-space: nowrap;">
+                      <input type="text" name="op_var_names[]" value="<?php print $var_name; ?>" style="width: 150px;">
+                    </td>
+                    <td width="67%" style="vertical-align: top; white-space: nowrap;">
+                      <textarea name="op_var_values[]" rows="1" cols="32"><?php print $var_value; ?></textarea>
+                      <a href="#" onclick="remove_variable(this); return false;"><img src="<?php print $maestro_url; ?>/images/admin/remove.png" class="valigntop"></a>
+                    </td>
+                  </tr>
+<?php
+                }
+?>
+                </tbody>
+              </table>
+            </div>
+          </fieldset>
+        </div>
+<?php
+  }
+
+  if (array_key_exists('assignment', $task_edit_tabs) && $task_edit_tabs['assignment'] == 1) {
+?>
+        <div id="task_edit_assignment" style="display: none;">
+          <table>
+            <tr>
+              <td colspan="3">
+                <?php print t('Assignment Type:'); ?>&nbsp;
+                <select name="assign_type" id="assign_type" onchange="toggle_list_type('assign');">
+<?php
+                  foreach ($types as $opt) {
+?>
+                    <option value="<?php print strtolower($opt['name']); ?>"><?php print $opt['label']; ?></option>
+<?php
+                    break;  //remove when once we add the role / group options
+                  }
+?>
+                  <optgroup style="color: #AAAAAA;" value="role" label="<?php print t('Role'); ?>"></optgroup>
+                  <optgroup style="color: #AAAAAA;" value="organic_group" label="<?php print t('Organic Group'); ?>"></optgroup>
+                </select>&nbsp;
+                <select name="assign_by_variable" id="assign_by_variable" onchange="toggle_list_type('assign');">
+<?php
+                  foreach ($bys as $opt) {
+?>
+                    <option value="<?php print strtolower($opt['name']); ?>"><?php print $opt['label']; ?></option>
+<?php
+                  }
+?>
+                </select>&nbsp;
+              </td>
+            </tr>
+
+            <tr>
+              <td style="text-align: center;"><?php print t('Available'); ?></td>
+              <td></td>
+              <td style="text-align: center;"><?php print t('Assigned'); ?></td>
+            </tr>
+
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => '', 'row_class' => 'assign_row', 'type' => 'user', 'by_variable' => 'fixed', 'when' => '', 'options' => $uid_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::FIXED . '_1[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'assign_row', 'type' => 'user', 'by_variable' => 'variable', 'when' => '', 'options' => $pv_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::VARIABLE . '_1[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'assign_row', 'type' => 'role', 'by_variable' => 'fixed', 'when' => '', 'options' => $role_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::FIXED][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::FIXED . '_1[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'assign_row', 'type' => 'role', 'by_variable' => 'variable', 'when' => '', 'options' => $pv_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::VARIABLE][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::VARIABLE . '_1[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'assign_row', 'type' => 'group', 'by_variable' => 'fixed', 'when' => '', 'options' => $og_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::FIXED][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::FIXED . '_1[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'assign_row', 'type' => 'group', 'by_variable' => 'variable', 'when' => '', 'options' => $pv_options, 'selected_options' => $selected_options[1][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::VARIABLE][1], 'name' => 'assign_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::VARIABLE . '_1[]')); ?>
+
+            <tr>
+              <td colspan="3"><?php print t('Assignment Summary:'); ?>&nbsp;<span id="assign_summary"></span></td>
+            </tr>
+          </table>
+        </div>
+<?php
+  }
+
+  if (array_key_exists('notification', $task_edit_tabs) && $task_edit_tabs['notification'] == 1) {
+?>
+        <div id="task_edit_notification" style="display: none;">
+          <table>
+            <tr>
+              <td colspan="3">
+                <?php print t('Notification Type:'); ?>&nbsp;
+                <select name="notify_type" id="notify_type" onchange="toggle_list_type('notify');">
+<?php
+                  foreach ($types as $opt) {
+?>
+                    <option value="<?php print strtolower($opt['name']); ?>"><?php print $opt['label']; ?></option>
+<?php
+                    break;  //remove when once we add the role / group options
+                  }
+?>
+                  <optgroup style="color: #AAAAAA;" value="role" label="<?php print t('Role'); ?>"></optgroup>
+                  <optgroup style="color: #AAAAAA;" value="organic_group" label="<?php print t('Organic Group'); ?>"></optgroup>
+                </select>&nbsp;
+                <select name="notify_by_variable" id="notify_by_variable" onchange="toggle_list_type('notify');">
+<?php
+                  foreach ($bys as $opt) {
+?>
+                    <option value="<?php print strtolower($opt['name']); ?>"><?php print $opt['label']; ?></option>
+<?php
+                  }
+?>
+                </select>&nbsp;
+                <select name="notify_when" id="notify_when" onchange="toggle_list_type('notify');">
+<?php
+                  foreach ($whens as $opt) {
+?>
+                    <option value="<?php print strtolower($opt['name']); ?>"><?php print $opt['label']; ?></option>
+<?php
+                  }
+?>
+                </select>&nbsp;
+              </td>
+            </tr>
+
+
+            <!-- By User -->
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => '', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'fixed', 'when' => 'assignment', 'options' => $uid_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'variable', 'when' => 'assignment', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'fixed', 'when' => 'completion', 'options' => $uid_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'variable', 'when' => 'completion', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'fixed', 'when' => 'reminder', 'options' => $uid_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'variable', 'when' => 'reminder', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'fixed', 'when' => 'escalation', 'options' => $uid_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'user', 'by_variable' => 'variable', 'when' => 'escalation', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::USER][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::USER . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+
+            <!-- By Role -->
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'fixed', 'when' => 'assignment', 'options' => $role_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'variable', 'when' => 'assignment', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'fixed', 'when' => 'completion', 'options' => $role_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'variable', 'when' => 'completion', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'fixed', 'when' => 'reminder', 'options' => $role_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'variable', 'when' => 'reminder', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'fixed', 'when' => 'escalation', 'options' => $role_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'role', 'by_variable' => 'variable', 'when' => 'escalation', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::ROLE][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::ROLE . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+
+            <!-- By OG -->
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'fixed', 'when' => 'assignment', 'options' => $og_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'variable', 'when' => 'assignment', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ASSIGNMENT], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ASSIGNMENT . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'fixed', 'when' => 'completion', 'options' => $og_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'variable', 'when' => 'completion', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::COMPLETION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::COMPLETION . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'fixed', 'when' => 'reminder', 'options' => $og_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'variable', 'when' => 'reminder', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::REMINDER], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::REMINDER . '[]')); ?>
+
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'fixed', 'when' => 'escalation', 'options' => $og_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::FIXED][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::FIXED . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+            <?php print theme('maestro_workflow_assign_notify_select_boxes', array('maestro_url' => $maestro_url, 'display' => 'none', 'row_class' => 'notify_row', 'type' => 'group', 'by_variable' => 'variable', 'when' => 'escalation', 'options' => $pv_options, 'selected_options' => $selected_options[2][MaestroAssignmentTypes::GROUP][MaestroAssignmentBy::VARIABLE][MaestroNotificationTypes::ESCALATION], 'name' => 'notify_ids_' . MaestroAssignmentTypes::GROUP . '_' . MaestroAssignmentBy::VARIABLE . '_' . MaestroNotificationTypes::ESCALATION . '[]')); ?>
+
+            <tr>
+              <td colspan="3" style="text-align: center;">
+                <i><?php print t('(leave subject and/or message blank for default)'); ?></i>
+              </td>
+            </tr>
+            <tr class="notify_row user role group fixed variable assignment">
+              <td colspan="3">
+                <table width="100%">
+                  <tr>
+                    <td><?php print t('Subject:'); ?></td>
+                    <td style="width: 90%;"><input type="text" name="pre_notify_subject" value="<?php print $vars->pre_notify_subject; ?>"></td>
+                  </tr>
+                  <tr>
+                    <td style="vertical-align: top;"><?php print t('Message:'); ?></td>
+                    <td style="width: 90%;"><textarea style="width: 100%;" rows="4" name="pre_notify_message"><?php print $vars->pre_notify_message; ?></textarea></td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
+
+            <tr class="notify_row user role group fixed variable completion" style="display: none;">
+              <td colspan="3">
+                <table width="100%">
+                  <tr>
+                    <td><?php print t('Subject:'); ?></td>
+                    <td style="width: 90%;"><input type="text" name="post_notify_subject" value="<?php print $vars->post_notify_subject; ?>"></td>
+                  </tr>
+                  <tr>
+                    <td style="vertical-align: top;"><?php print t('Message:'); ?></td>
+                    <td style="width: 90%;"><textarea style="width: 100%;" rows="4" name="post_notify_message"><?php print $vars->post_notify_message; ?></textarea></td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
+
+            <tr class="notify_row user role group fixed variable reminder" style="display: none;">
+              <td colspan="3">
+                <table width="100%">
+                  <tr>
+                    <td nowrap><?php print t('Subject:'); ?></td>
+                    <td style="width: 90%;"><input type="text" name="reminder_subject" value="<?php print $vars->reminder_subject; ?>"></td>
+                  </tr>
+                  <tr>
+                    <td nowrap style="vertical-align: top;"><?php print t('Message:'); ?></td>
+                    <td style="width: 90%;"><textarea style="width: 100%;" rows="4" name="reminder_message"><?php print $vars->reminder_message; ?></textarea></td>
+                  </tr>
+                  <tr>
+                    <td nowrap><?php print t('Reminder Interval (days):'); ?></td>
+                    <td><input type="text" style="width: 30px;" name="reminder_interval" value="<?php print $vars->reminder_interval; ?>"></td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
+
+            <tr class="notify_row user role group fixed variable escalation" style="display: none;">
+              <td colspan="3">
+                <table width="100%">
+                  <tr>
+                    <td nowrap><?php print t('Subject:'); ?></td>
+                    <td style="width: 90%;"><input type="text" name="escalation_subject" value="<?php print $vars->escalation_subject; ?>"></td>
+                  </tr>
+                  <tr>
+                    <td nowrap style="vertical-align: top;"><?php print t('Message:'); ?></td>
+                    <td style="width: 90%;"><textarea style="width: 100%;" rows="4" name="escalation_message"><?php print $vars->escalation_message; ?></textarea></td>
+                  </tr>
+                  <tr>
+                    <td nowrap><?php print t('Escalate After (days):'); ?></td>
+                    <td><input type="text" style="width: 30px;" name="escalation_interval" value="<?php print $vars->escalation_interval; ?>"></td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
+
+            <tr>
+              <td colspan="3">
+                <b><?php print t('On Assign:'); ?></b>&nbsp;<span id="notify_assign_summary"></span>&nbsp;&nbsp;&nbsp;
+                <b><?php print t('On Complete:'); ?></b>&nbsp;<span id="notify_complete_summary"></span>&nbsp;&nbsp;&nbsp;
+                <b><?php print t('On Remind:'); ?></b>&nbsp;<span id="notify_remind_summary"></span>&nbsp;&nbsp;&nbsp;
+                <b><?php print t('On Escalate:'); ?></b>&nbsp;<span id="notify_escalate_summary"></span>
+              </td>
+            </tr>
+
+          </table>
+        </div>
+<?php
+  }
+?>
+        <div class="maestro_task_edit_save_div"><input class="form-submit" type="submit" value="<?php print t('Save'); ?>"></div>
+
+      </form>
+    </div></div></div></div></div></div></div></div>
+  </div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables-list.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables-list.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..a472186255f437ffaa9ded25a71f55fd77412d1d
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables-list.tpl.php
@@ -0,0 +1,39 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-workflow-edit-template-variables-list.tpl.php
+ */
+
+?>
+
+<tr class="<?php print $zebra ?>">
+  <td>
+    <div style="display:<?php print $show_variable_actions; ?>;">
+      <?php print filter_xss($variable_name); ?>
+    </div>
+    <div style="display:<?php print $show_variable_edit_actions; ?>;">
+      <input type="text" name="editVarName_<?php print $var_id; ?>" id="editVarName_<?php print $var_id; ?>" value="<?php print filter_xss($variable_name); ?>" style="border: solid black 1px"></input>
+    </div>
+  </td>
+  <td>
+    <div style="display:<?php print $show_variable_actions; ?>;">
+      <?php print filter_xss($variable_value); ?>
+    </div>
+    <div style="display:<?php print $show_variable_edit_actions; ?>;">
+      <input type="text" name="editVarValue_<?php print $var_id; ?>" id="editVarValue_<?php print $var_id; ?>" value="<?php print filter_xss($variable_value); ?>" style="border: solid black 1px"></input>
+    </div>
+  </td>
+  <td>
+    <div id="showVariableActions" style="display:<?php print $show_variable_actions; ?>;">
+      <input title="<?php print t('Edit the Variable'); ?>" type="image" src="<?php print $module_path; ?>/images/admin/edit_tasks.gif" onclick="maestro_editTemplateVariable(<?php print $tid; ?>,<?php print $var_id; ?>);" >&nbsp;
+      <input title="<?php print t('Delete the Variable'); ?>" type="image" src="<?php print $module_path; ?>/images/admin/delete.gif" onclick="maestro_deleteTemplateVariable(<?php print $tid; ?>,<?php print $var_id; ?>);" >&nbsp;
+    </div>
+    <div id="showVariableEditActions" style="display:<?php print $show_variable_edit_actions; ?>;">
+      <span id="maestro_updating_variable_<?php print $var_id; ?>"  class=""></span>
+      <input type="button" value="<?php print t('Save'); ?>" onClick='maestro_saveTemplateVariable(<?php print $tid; ?>,<?php print $var_id; ?>);'>&nbsp;
+      <input type="button" value="<?php print t('Cancel'); ?>" onClick='maestro_CancelTemplateVariable(<?php print $tid; ?>);'>&nbsp;
+    </div>
+  </td>
+</tr>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..bbc5de284fa4866b5ab0e095624d6faeb33989db
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit-template-variables.tpl.php
@@ -0,0 +1,18 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-workflow-edit-template-variables.tpl.php
+ */
+
+?>
+
+<table border="0">
+<tr>
+  <th width-"25%"><?php print t('Variable'); ?></th>
+  <th width="60%"><?php print t('Default Value'); ?></th>
+  <th width="15%" nowrap><?php print t('Actions'); ?></th>
+</tr>
+<?php print $template_variables; ?>
+</table>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-edit.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..e27f87802324f7d166811d01bc668b5359a26e30
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-edit.tpl.php
@@ -0,0 +1,41 @@
+<?php
+// $Id: maestro-workflow-edit.tpl.php,v 1.6 2010/07/22 21:16:52 chevy Exp $
+
+/**
+ * @file
+ * maestro-workflow-edit.tpl.php
+ */
+
+?>
+
+  <div id="maestro_ajax_indicator" class="maestro_ajax_indicator" style="display: none;"><img src="<?php print $maestro_url; ?>/images/admin/status-active.gif"></div>
+
+  <div class="maestro_heading"><?php print $t_rec->template_name; ?></div>
+
+  <form name="frm_animate" action="#" method="post">
+      <?php print t('Enable Animation'); ?>: <input type="checkbox" name="animateFlag" value="1" checked="checked">&nbsp;&nbsp;&nbsp;
+      <?php print t('Snap to Grid'); ?>: <input type="checkbox" name="snapToGrid" value="1" onclick="update_snap_to_grid();">&nbsp;&nbsp;&nbsp;
+      <?php print t('Snap to Objects'); ?>: <input type="checkbox" name="snapToObjects" value="1" onclick="update_snap_to_objects();" checked="checked">
+  </form>
+
+  <div id="maestro_tool_tip_container" class="maestro_tool_tip" style="display: none;"><div class="t"><div class="b"><div class="r"><div class="l"><div class="bl-bge"><div class="br-bge"><div class="tl-bge"><div class="tr-bge">
+  <div id="maestro_tool_tip" class="maestro_tool_tip_inner"></div>
+  </div></div></div></div></div></div></div></div></div>
+
+  <div id="maestro_workflow_container" class="maestro_workflow_container" style="position: abosolute; height: <?php print $t_rec->canvas_height; ?>px;">
+    <?php print $mi->displayTasks(); ?>
+  </div>
+
+  <?php print $mi->getContextMenuHTML(); ?>
+
+  <div>
+    <a href="#" onClick="grow_canvas(); return false;"><?php print t('Grow Canvas'); ?></a>
+    <a href="#" onClick="shrink_canvas(); return false;"><?php print t('Shrink Canvas'); ?></a>
+  </div>
+
+  <script type="text/javascript">
+    var ajax_url = '<?php print $ajax_url; ?>';
+    var template_id = <?php print $tid; ?>;
+    <?php print $additional_js; ?>
+    <?php print $mi->getContextMenuJS(); ?>
+  </script>
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-list-item.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-list-item.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..b4fb37b5a29d5cc2c05a0bf658ae64b607bf19c9
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-list-item.tpl.php
@@ -0,0 +1,110 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-workflow-list-item.tpl.php
+ */
+
+?>
+    <tr class="<?php print $zebra ?>" id="tview<?php print $cntr; ?>" class="">
+      <td width="5%"  style="padding-left:5px;"><?php print $rec->id; ?></td>
+      <td width="80%" style="padding-left:5px;"><span id="tname<?php print $rec->id; ?>"><?php print filter_xss($rec->template_name); ?></span></td>
+      <td width="15%" style="text-align:right;padding-right:5px;" nowrap>
+      <?php print l('<img src="' . $module_path . '/images/admin/edit_tasks.gif" border="0" title="' . t('Edit Tasks') .'">', 'admin/structure/maestro/edit/' . $rec->id, array('html' => TRUE)); ?>&nbsp;
+      <?php print l('<img src="' . $module_path . '/images/admin/edit_properties.gif" border="0" title="' . t('Edit Template Properties and Variables') .'">', 'admin/structure/maestro/edit_properties/' . $rec->id, array('html' => TRUE)); ?>&nbsp;
+      <input title="<?php print t('Copy Template'); ?>" type="image" src="<?php print $module_path; ?>/images/admin/copy.gif" onclick="maestro_copyTemplate(<?php print $rec->id; ?>);" >&nbsp;
+      <input title="<?php print t('Delete Template'); ?>" type="image" src="<?php print $module_path; ?>/images/admin/delete.gif" onclick="maestro_deleteTemplate(<?php print $rec->id; ?>);" >&nbsp;
+      <?php print l('<img src="' . $module_path . '/images/admin/export.gif" border="0" title="' . t('Export Template') .'">', 'admin/structure/maestro/export/' . $rec->id, array('html' => TRUE)); ?>&nbsp;
+      </td>
+    </tr>
+    <tr id="texport<?php print $cntr; ?>" style="vertical-align:top;display:<?php print $show_export_item; ?>;">
+      <td colspan="3">
+        <table>
+        <tr>
+          <td width="40%">
+            <?php print t('The following is the template creation code for template '); ?><?php print filter_xss($rec->template_name); ?>:<br>
+            <textarea id="templateout<?php print $rec->id; ?>" rows="15" cols="100" style="border: solid gray 1px;"><?php print $export_content; ?></textarea>
+          </td>
+          <td>
+          <table style="border: none; width: 100%;">
+          <tr>
+            <td style="text-align: right;">
+              <?php print l('<input class="form-submit" type="button" value="' . t('Close') . '">', 'admin/structure/maestro', array('html' => TRUE)); ?>
+            </td>
+          </tr>
+          <tr>
+            <td>
+            <?php print t('The output of your template has been generated.  Copy the contents of the output to the left.'); ?>
+            </td>
+          </tr>
+          </table>
+
+
+          </td>
+        </tr>
+        </table>
+      </td>
+
+    </tr>
+    <tr id="tedit<?php print $cntr; ?>" class="" style="vertical-align:top;display:<?php print $show_item; ?>;">
+      <td width="5%" class="" style="padding-left:5px;"></td>
+      <td width="95%" colspan="2" class="">
+        <form id="maestro_template_save_<?php print $cntr; ?>" style="margin:0px;">
+          <table cellspacing="1" cellpadding="1" border="0" width="100%" style="margin-top:5px;">
+            <tr>
+              <td width="60" style="padding-left:10px;" nowrap>
+                <input class="form-text" type="text" name="templateName" size="50" value="<?php print filter_xss($rec->template_name); ?>">
+              </td>
+              <td>
+                <span id="updatename_<?php print $rec->id; ?>" style="display:<?php print $show_item; ?>;"></span>
+              </td>
+              <td width="30%" style="text-align:right;padding-right:5px;" nowrap>
+                <span id="fieldaction_<?php print $rec->id; ?>">
+                  <span id="maestro_updating_<?php print $cntr; ?>"  class=""></span>
+                  <input class="form-submit" type="button" value="<?php print t('Save'); ?>" onClick='maestro_saveTemplateName(<?php print $rec->id; ?>,<?php print $cntr; ?>);'>&nbsp;
+                  <?php print l('<input class="form-submit" id="tcancel_<?php print $cntr; ?>" type="button" value="' . t('Close') . '">', 'admin/structure/maestro', array('html' => TRUE)); ?>
+                </span>
+                <span id="fieldstatus_<?php print $rec->id; ?>" class="pluginInfo"  style="display:none;">&nbsp;</span>
+              </td>
+            </tr>
+            <tr>
+              <td colspan="3" style="vertical-align:top;padding-left:10px;">
+                <div style="float:left;width:75%"><?php print t('Bind Flow to a Flow Application Group'); ?>: </div>
+                <div style="float:right;white-space:nowrap;"> <?php print $template_app_groups; ?> </div>
+              </td>
+            </tr>
+          </table>
+        </form>
+        <div id="addvarlabel<?php print $cntr; ?>" style="padding:5px;">
+          <input class="form-submit" type="button" value="<?php print t('Add Variable'); ?>" onClick="maestro_OpenCloseCreateVariable(<?php print $cntr; ?>);">&nbsp;
+            <div id="variableAdd_<?php print $cntr; ?>" style="display:none">
+              <form id="frmVariableAdd_<?php print $cntr; ?>">
+              <table border=0>
+                <tr>
+                  <td>Variable Name:</td>
+                  <td><input class="form-text" type="text" name="newVariableName" id="newVariableName" size="30" value=""></td>
+                  <td rowspan="2">
+                    <span id="maestro_variable_updating_<?php print $cntr; ?>"></span>
+                    <input class="form-submit" type="button" value="<?php print t('Create'); ?>" onClick='maestro_CreateVariable(<?php print $rec->id; ?>,<?php print $cntr; ?>);'>&nbsp;
+                    <input class="form-submit" type="button" value="<?php print t('Close'); ?>" onClick='maestro_OpenCloseCreateVariable(<?php print $cntr; ?>);'>&nbsp;
+                  </td>
+                </tr>
+                <tr>
+                  <td>Default Value:</td>
+                  <td><input class="form-text" type="text" name="newVariableValue" id="newVariableValue" size="10" value=""></td>
+                </tr>
+              </table>
+              </form>
+            </div>
+        </div>
+        <div id="{vdivid}" style="padding-left:10px;display:{show_vars};">
+          <fieldset style="margin:10px 10px 10px 0px;"><legend><?php print t('Template Variables'); ?></legend>
+              <div id="ajaxReplaceTemplateVars_<?php print $rec->id; ?>">
+                 <?php print $template_variables; ?>
+              </div>
+          </fieldset>
+        </div>
+      </td>
+    </tr>
+
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-list.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-list.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..0ddfbdb04e1d205ed0ffe595f16318f506c1399a
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-list.tpl.php
@@ -0,0 +1,127 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-workflow-list.tpl.php
+ */
+
+?>
+<div id="maestro_template_admin">
+<script type="text/javascript">
+var num_records = <?php print $num_records; ?>;
+var ajax_url = '<?php print filter_xss($ajax_url); ?>';
+</script>
+  <div id="addtemplate" style="padding:10px 0px 10px 10px;">
+    <input class="form-submit" type="button" value="<?php print t('New Template'); ?>" onClick="jQuery('#newtemplate').toggle();">&nbsp;
+    <input class="form-submit" type="button" value="<?php print t('Application Groups'); ?>" onClick="jQuery('#newappgroup').toggle();">&nbsp;
+    <input class="form-submit" type="button" value="<?php print t('Import Template'); ?>" id="importMaestroTemplate">&nbsp;
+  </div>
+
+  <table cellpadding="2" cellspacing="1" border="1" width="100%" style="border:1px solid #CCC;">
+    <tr id="importTemplate" style="display:none;">
+      <td colspan="3">
+        <div style="color: red; font-weight: bold;">
+          <?php print t('Using the import routine will evaluate and execute live PHP code on your site.'); ?><br>
+          <?php print t('Only import workflows from a trusted and reliable source.  You\'ve been warned!'); ?><br>
+        </div>
+        <?php print t('Please paste your import code below:'); ?><br>
+        <div id="importProblemMessage" class="maestro_hide_item" style="color: red; font-size: 1.5em;">
+          <?php print t('Import code has illegal instructions.  Import has been aborted.'); ?>
+          <br></br>
+        </div>
+        <div id="importSuccessMessage" class="maestro_hide_item" style="color: green;">
+          <?php print t('Import completed successfully.'); ?>
+          <?php print t('Click '); ?>
+          <?php print l('here','admin/structure/maestro'); ?>
+          <?php print t(' to continue.'); ?>
+        </div>
+        <div id="importFailureMessage" class="maestro_hide_item" style="color: red;">
+          <?php print t('There has been an error during your import.  Please view the error logs for details.'); ?>
+        </div>
+        <form id="maestroImportTemplateFrm">
+        <textarea id="templatecode" name="templatecode" rows="10" cols="100" style="border: solid gray 1px;"></textarea><br><br>
+        <input class="form-submit" type="button" value="<?php print t('Begin Import'); ?>" id="doMaestroTemplateImport">&nbsp;
+        <input class="form-submit" type="button" value="<?php print t('Close'); ?>" onClick="jQuery('#templatecode').attr('value', '');jQuery('#importTemplate').toggle();">&nbsp;
+        </form>
+        <div id="importSuccessMessage" class="maestro_hide_item" style="color: green;">
+          <?php print t('Import completed successfully.'); ?>
+          <?php print t('Click '); ?>
+          <?php print l('here','admin/structure/maestro'); ?>
+          <?php print t(' to continue.'); ?>
+        </div>
+        <div id="importFailureMessage" class="maestro_hide_item" style="color: red;">
+          <?php print t('There has been an error during your import.  Please view the error logs for details.'); ?>
+        </div>
+
+      </td>
+
+    </tr>
+    <tr>
+      <td colspan="3" class="pluginInfo"><?php print t('Click on desired action to edit template'); ?></td>
+    </tr>
+    <tr>
+      <td class="pluginTitle"><?php print t('ID'); ?></td>
+      <td class="pluginTitle"><?php print t('Template Name'); ?></td>
+      <td class="pluginTitle" ><?php print t('Actions'); ?></td>
+    </tr>
+
+    <tr id="newtemplate" style="display:none;">
+      <td colspan="3" class="pluginRow1">
+          <table cellspacing="1" cellpadding="1" border="0" width="100%" style="border:none;">
+            <tr>
+              <td><?php print t('Name'); ?>:</td>
+              <td><input class="form-text" type="text" id="newTemplateName" value="" size="50"></td>
+              <td style="text-align:right;padding-right:10px;">
+                <span id="maestro_new_template_updating"></span>
+                <input class="form-submit" type="button" value="<?php print t('Create'); ?>" onClick='maestro_CreateTemplate();'>&nbsp;
+                <input class="form-submit" type="button" value="<?php print t('Close'); ?>" onClick="jQuery('#newtemplate').toggle();">&nbsp;
+              </td>
+            </tr>
+          </table>
+      </td>
+    </tr>
+    <tr id="newappgroup" style="display:none;">
+      <td colspan="3" class="pluginRow1">
+          <table cellspacing="1" cellpadding="1" border="0"  width="100%" style="border:none;">
+            <tr>
+              <td width="180"><?php print t('New Application Group Name'); ?>:</td>
+              <td>
+                <input class="form-text" type="text" id="appGroupName" value="" size="50">
+                <input class="form-submit" type="button" value="<?php print t('Create'); ?>" onClick='maestro_CreateAppgroup();'>&nbsp;
+                <span id="maestro_new_appgroup_updating"></span>
+              </td>
+              <td style="text-align:right;padding-right:10px;">
+                <input class="form-submit" type="button" value="<?php print t('Close'); ?>" onClick="jQuery('#newappgroup').toggle();">&nbsp;
+              </td>
+            </tr>
+          </table>
+          <table cellspacing="1" cellpadding="1" border="0" width="100%" style="border:none;">
+            <tr>
+              <td class="aligntop" nowrap width="180"><?php print t('Delete Application Group'); ?>:</td>
+              <td>
+                <div id="replaceDeleteAppGroup">
+                <?php print $app_groups; ?>
+                </div>
+                <input class="form-submit" type="button" value="<?php print t('Delete'); ?>" onClick='maestro_DeleteAppgroup();'>&nbsp;
+                <span id="maestro_del_appgroup_updating"></span>
+              </td>
+              </tr>
+          </table>
+
+      </td>
+    </tr>
+
+    <tr id="maestro_error_row">
+
+      <td  colspan="3" style="color:red;"  >
+          <span id="maestro_error_message"><?php print filter_xss($error_message); ?></span>
+      </td>
+    </tr>
+    <?php print $workflow_list; ?>
+
+  </table>
+</div>
+<script type="text/javascript">
+maestro_hideErrorBar();
+</script>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/structure/maestro-workflow-task-frame.tpl.php b/sites/all/modules/maestro/theme/structure/maestro-workflow-task-frame.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..bfe6ac7827e8c57f9677ca08cb535ab1a5aab8dd
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/maestro-workflow-task-frame.tpl.php
@@ -0,0 +1,13 @@
+<?php
+
+?>
+
+  <div id="task<?php print $rec->id; ?>" class="<?php print $task_class; ?> maestro_task_container" onclick="draw_line_to(this);" style="left: <?php print $rec->offset_left; ?>px; top: <?php print $rec->offset_top; ?>px;">
+    <?php print $ti->display(); ?>
+  </div>
+
+  <?php print $ti->getContextMenuHTML(); ?>
+
+  <script type="text/javascript">
+    <?php print $ti->getContextMenuJS(); ?>
+  </script>
\ No newline at end of file
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-and.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-and.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..35f0579dd6368894ca409b6a0357327421f48953
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-and.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-and.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-and.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-gry"><div class="tr-gry">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-gry maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('AND branches together'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..7bf31bcce4bb2b77593799f6527ffef05f08fa35
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-edit.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-batch-edit.tpl.php,v 1.4 2010/07/21 21:52:54 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-batch-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+   <td colspan="2">
+      <?php print t('Handler base path:'); ?>
+      <?php print $td_rec->task_data['handler_location'];?>
+    </td>
+  </tr>
+  <tr>
+    <td><?php print t('Handler:'); ?></td>
+    <td><input type="text" name="handler" value="<?php print $td_rec->task_data['handler']; ?>"></td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..05b77aebdea332d7b070b2dfbe8ea1a7e59ca25d
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function-edit.tpl.php
@@ -0,0 +1,32 @@
+<?php
+// $Id: maestro-task-batch-function-edit.tpl.php,v 1.4 2010/08/23 19:21:46 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-batch-function-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td nowrap style="vertical-align: top;"><?php print t('Handler:'); ?></td>
+    <td width="90%">
+      <select id="handler_options" name="handler" onchange="change_handler_option();">
+        <option id="handler_" value="" message="<?php print t('Please specify the handler in the text box provided'); ?>"><?php print t('other'); ?></option>
+<?php
+        foreach ($handler_options as $value => $label) {
+?>
+          <option id="handler_<?php print $value; ?>" message="<?php print str_replace('"', '\'', $label); ?>" value="<?php print $value; ?>" <?php print ($td_rec->task_data['handler'] == $value) ? 'selected="selected"':''; ?>><?php print $value; ?></option>
+<?php
+        }
+?>
+      </select>
+      <div id="handler_options_other" style="padding: 5px 0px 0px 0px; display: <?php print (array_key_exists($td_rec->task_data['handler'], $handler_options)) ? 'none':''; ?>"><input id="handler_options_other_text" type="text" name="handler_other" value="<?php print $td_rec->task_data['handler']; ?>"></div>
+    </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td id="handler_options_message"><?php print (array_key_exists($td_rec->task_data['handler'], $handler_options)) ? $handler_options[$td_rec->task_data['handler']] : t('Please specify the handler in the text box provided'); ?></td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..d994c028c3d16ea6f143dc7ae607a4f75853100e
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch-function.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-batch-function.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-batch-function.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-gry"><div class="tr-gry">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-gry maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Batch Function Task'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..372de7561532b728b5137e64d93cac261b7b3261
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-batch.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-batch.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-batch.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-gry"><div class="tr-gry">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-gry maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Batch Task'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..ba9557cad492ff981dc14ca8b1a61dfd11451059
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type-edit.tpl.php
@@ -0,0 +1,24 @@
+<?php
+// $Id:
+
+/**
+ * @file
+ * maestro-task-content-type-edit.tpl.php
+ */
+
+?>
+<br></br>
+<table>
+  <tr>
+    <td>
+      <?php print t('Select the Content Type for this task:'); ?>
+      <select name="content_type">
+        <?php foreach($content_types as $type => $obj) {?>
+        <option value="<?php print $obj->type; ?>" <?php if($obj->type == $td_rec->task_data['content_type']) print "selected"; ?>>
+          <?php print $obj->name; ?>
+        </option>
+        <?php } ?>
+      </select>
+    </td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..929b0a6e61e129374f5625fa3be3c41316c67c8e
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-content-type.tpl.php
@@ -0,0 +1,23 @@
+<?php
+// $Id: maestro-task-content-type.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-content-type.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-bl"><div class="tr-bl">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-bl maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Content Type Task'); ?><br />
+      <div id="task_assignment<?php print $tdid; ?>"><?php print $ti->getAssignmentDisplay(); ?></div>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-end.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-end.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..fae50efaacc135d8b2b7a811494062c5f1565b6c
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-end.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-end.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-end.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-red"><div class="tr-red">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-red maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('End of Workflow'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..de77aad09ee41cde215ce0eff8b2bb84feb293f4
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger-edit.tpl.php
@@ -0,0 +1,103 @@
+<?php
+// $Id: maestro-task-fire-trigger-edit.tpl.php,v 1.1 2010/08/03 14:05:48 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-set-process-variable-edit.tpl.php
+ */
+
+?>
+
+  <fieldset class="form-wrapper">
+    <legend>
+      <span class="fieldset-legend"><?php print t('TRIGGER: WHEN THIS TASK IS EXECUTED'); ?></span>
+    </legend>
+    <div class="fieldset-wrapper">
+      <table id="actions_table" class="sticky-enabled sticky-table">
+        <thead class="tableheader-processed">
+          <tr>
+            <th><?php print t('NAME'); ?></th>
+            <th><?php print t('OPERATION'); ?></th>
+          </tr>
+        </thead>
+        <tbody id="actions">
+<?php
+          $css_row = 1;
+          foreach ($aa_res as $aa_rec) {
+?>
+            <tr class="<?php print (($css_row % 2) == 0) ? 'even' : 'odd'; ?>">
+              <td><?php print $aa_rec->label; ?><input type="hidden" id="actions<?php print $css_row; ?>" name="actions[]" value="<?php print $aa_rec->aid; ?>"></td>
+              <td><a href="#" onclick="delete_action(this); return false;">unassign</a></td>
+            </tr>
+<?php
+            $css_row++;
+          }
+?>
+        </tbody>
+      </table>
+
+      <div class="container-inline">
+        <select id="action_options">
+          <option value=""><?php print t('Choose an action'); ?></option>
+<?php
+          foreach ($options as $group => $optionset) {
+?>
+            <optgroup label="<?php print $group; ?>">
+<?php
+              foreach ($optionset as $key => $option) {
+?>
+                <option value="<?php print $key; ?>"><?php print $option; ?></option>
+<?php
+              }
+?>
+            </optgroup>
+<?php
+          }
+?>
+        </select>
+        <input class="form-submit" type="button" value="<?php print t('Assign'); ?>" onclick="add_action();">
+      </div>
+    </div>
+  </fieldset>
+
+  <script type="text/javascript">
+    function delete_action(handle) {
+      (function($) {
+        $(handle).closest('tr').remove();
+        $('#actions_table').find('tr').each(function(i, el) {
+          if (i > 0) {
+            el.className = ((i % 2) == 1) ? 'odd':'even';
+          }
+        });
+      })(jQuery);
+    }
+
+    function add_action() {
+      (function($) {
+        var i;
+        var key = $("#action_options option:selected").attr('value');
+        var duplicate_flag = 0;
+        if (key != '') {
+          $('#actions_table').find('input').each(function(i, el) {
+            if (el.value == key) {
+              duplicate_flag = 1;
+              return;
+            }
+          });
+
+          if (duplicate_flag == 1) {
+            return;
+          }
+
+          var label = $("#action_options option:selected").text();
+          var rows = $('#actions_table tr').length;
+          var css_row = ((rows % 2) == 1) ? 'odd':'even';
+          var html  = '<tr class="' + css_row + '">';
+          html += '<td>' + label + '<input id="actions' + rows + '" type="hidden" name="actions[]" value="' + key + '"></td>';
+          html += '<td><a href="#" onclick="delete_action(this); return false;"><?php print t('unassign'); ?></a></td>';
+          html += '</tr>';
+          $('#actions').append(html);
+        }
+      })(jQuery);
+    }
+  </script>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..1f69267e377bc7da2f64a1010f5ebcf8b5f72078
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-fire-trigger.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-fire-trigger.tpl.php,v 1.2 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-set-process-variable.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-gry"><div class="tr-gry">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-gry maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Fire Trigger Task'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..0beb2646c858da63adaa01c313a7782cf0dfaa83
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if-edit.tpl.php
@@ -0,0 +1,80 @@
+<?php
+// $Id: maestro-task-if-edit.tpl.php,v 1.6 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-if-edit.tpl.php
+ */
+
+?>
+<table>
+  <tr>
+    <td colspan="2" style="text-align:center;">
+      <?php print t('Set your IF parameters to check by variable OR by Last Task Status below:'); ?><br></br>
+      <label for="ifTaskArguments0"><input type="radio" id="ifTaskArguments0" name="ifTaskArguments" value="variable" <?php if($td_rec->task_data['if_task_arguments'] == 'variable') print 'checked'; ?> onclick="if_task_enable_disable_agruments('variable');"><?php print t('By Variable'); ?></label>&nbsp;&nbsp;&nbsp;
+      <label for="ifTaskArguments1"><input type="radio" id="ifTaskArguments1" name="ifTaskArguments" value="status" <?php if($td_rec->task_data['if_task_arguments'] == 'status') print 'checked'; ?> onclick="if_task_enable_disable_agruments('status');"><?php print t('By Last Task Status'); ?></label>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <?php print t('Argument Variable:'); ?>
+    </td>
+    <td id="ifArgumentVariableRow">
+      <select name="argumentVariable" id="argumentVariable"<?php if($td_rec->task_data['if_task_arguments'] != 'variable') print 'disabled="true"'; ?>>
+      <?php print $argument_variables; ?>
+      </select>
+      <select name="ifOperator" id="ifOperator" <?php if($td_rec->task_data['if_task_arguments'] != 'variable') print 'disabled="true"'; ?>>
+        <option value="0"></option>
+        <option value="=" <?php if($td_rec->task_data['if_operator'] == '=') print 'selected'; ?>>=</option>
+        <option value=">" <?php if($td_rec->task_data['if_operator'] == '>') print 'selected'; ?>>&gt;</option>
+        <option value="<" <?php if($td_rec->task_data['if_operator'] == '<') print 'selected'; ?>>&lt;</option>
+        <option value="!=" <?php if($td_rec->task_data['if_operator'] == '!=') print 'selected'; ?>>!=</option>
+      </select>
+      <input type="text" name="ifValue" id="ifValue" value="<?php print filter_xss($td_rec->task_data['if_value']); ?>" size="3" <?php if($td_rec->task_data['if_task_arguments'] != 'variable') print 'disabled="true"'; ?>></input>
+    </td>
+  </tr>
+    <td>
+      <?php print t('Last Task Status:'); ?>
+    </td>
+    <td id="ifArgumentStatusRow">
+      <select name="ifProcessArguments" id="ifProcessArguments" <?php if($td_rec->task_data['if_task_arguments'] != 'status') print 'disabled="true"'; ?>>
+        <option value="0"></option>
+        <option value="lasttasksuccess" <?php if($td_rec->task_data['if_process_arguments'] == 'lasttasksuccess') print 'selected'; ?>>Last Task Status is Success</option>
+        <option value="lasttaskcancel" <?php if($td_rec->task_data['if_process_arguments'] == 'lasttaskcancel') print 'selected'; ?>>Last Task Status is Cancel</option>
+        <option value="lasttaskhold" <?php if($td_rec->task_data['if_process_arguments'] == 'lasttaskhold') print 'selected'; ?>>Last Task Status is Hold</option>
+        <option value="lasttaskaborted" <?php if($td_rec->task_data['if_process_arguments'] == 'lasttaskaborted') print 'selected'; ?>>Last Task Status is Aborted</option>
+      </select>
+    </td>
+  <tr>
+</table>
+
+<script type="text/javascript">
+  setTimeout(tick, 500);
+
+  function tick() {
+    if_task_enable_disable_agruments('<?php print $td_rec->task_data['if_task_arguments']; ?>');
+  }
+
+  function if_task_enable_disable_agruments(val){
+    (function ($) {
+      switch(val) {
+      case 'status':
+        $('#ifArgumentVariableRow').hide();
+        $('#ifArgumentStatusRow').show();
+        $('#ifOperator').attr('disabled','true');
+        $('#ifValue').attr('disabled','true');
+        $('#argumentVariable').attr('disabled','true');
+        $('#ifProcessArguments').removeAttr('disabled');
+        break;
+      case 'variable':
+        $('#ifArgumentStatusRow').hide();
+        $('#ifArgumentVariableRow').show();
+    	  $('#ifOperator').removeAttr('disabled');
+        $('#ifValue').removeAttr('disabled');
+        $('#argumentVariable').removeAttr('disabled');
+        $('#ifProcessArguments').attr('disabled','true');
+    	  break;
+      }
+    })(jQuery);
+  }
+</script>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..1e9352ed84cf3f6b97f0226cbd4c83d0675083df
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-if.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-if.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-if.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-yel"><div class="tr-yel">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-yel maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('If Condition'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..24a3aa4e8fa8d79db58ae07debe0ce01b800bb1d
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function-edit.tpl.php
@@ -0,0 +1,32 @@
+<?php
+// $Id: maestro-task-interactive-function-edit.tpl.php,v 1.10 2010/08/23 19:21:46 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-interactive-function-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td nowrap style="vertical-align: top;"><?php print t('Handler:'); ?></td>
+    <td width="90%">
+      <select id="handler_options" name="handler" onchange="change_handler_option();">
+        <option id="handler_" value="" message="<?php print t('Please specify the handler in the text box provided'); ?>"><?php print t('other'); ?></option>
+<?php
+        foreach ($handler_options as $value => $label) {
+?>
+          <option id="handler_<?php print $value; ?>" message="<?php print str_replace('"', '\'', $label); ?>" value="<?php print $value; ?>" <?php print ($td_rec->task_data['handler'] == $value) ? 'selected="selected"':''; ?>><?php print $value; ?></option>
+<?php
+        }
+?>
+      </select>
+      <div id="handler_options_other" style="padding: 5px 0px 0px 0px; display: <?php print (array_key_exists($td_rec->task_data['handler'], $handler_options)) ? 'none':''; ?>"><input id="handler_options_other_text" type="text" name="handler_other" value="<?php print $td_rec->task_data['handler']; ?>"></div>
+    </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td id="handler_options_message"><?php print (array_key_exists($td_rec->task_data['handler'], $handler_options)) ? $handler_options[$td_rec->task_data['handler']] : t('Please specify the handler in the text box provided'); ?></td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..7e084a9afe101881c8070871e0354dcc6350cf05
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-interactive-function.tpl.php
@@ -0,0 +1,23 @@
+<?php
+// $Id: maestro-task-interactive-function.tpl.php,v 1.7 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-interactive-function.tpl.php
+ */
+
+ ?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-bl"><div class="tr-bl">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-bl maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Interactive Function Task'); ?><br />
+      <div id="task_assignment<?php print $tdid; ?>"><?php print $ti->getAssignmentDisplay(); ?></div>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..bec5797718dfac27adc283bbcf71eeadc94427da
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web-edit.tpl.php
@@ -0,0 +1,27 @@
+<?php
+// $Id: maestro-task-manual-web-edit.tpl.php,v 1.5 2010/08/24 16:51:55 randy Exp $
+
+/**
+ * @file
+ * maestro-task-manual-web-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td style="vertical-align: top;"><?php print t('Handler URL:'); ?></td>
+    <td>
+    <input type="text" name="handler" value="<?php print filter_xss($td_rec->task_data['handler']); ?>"><br>
+    <?php print t('Use [site_url] to denote your current site.<br>Example:  [site_url]/index.php?q=maestro_manual_web_example'); ?>
+    </td>
+  </tr>
+  <tr>
+    <td><?php print t('Open Link in new window?:'); ?></td>
+    <td><input type="checkbox" name="newWindow" value="1" <?php if($td_rec->task_data['new_window'] == 1) print 'checked'; ?>></td>
+  </tr>
+  <tr>
+    <td><?php print t('Use URL Token?:'); ?></td>
+    <td><input type="checkbox" name="useToken" value="1" <?php if($td_rec->task_data['use_token'] == 1) print 'checked'; ?>></td>
+  </tr>
+</table>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..18808c10697a132c689ef9026460c93e90200d62
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-manual-web.tpl.php
@@ -0,0 +1,23 @@
+<?php
+// $Id: maestro-task-manual-web.tpl.php,v 1.6 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-manual-web.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-bl"><div class="tr-bl">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-bl maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Manual Web Task'); ?><br />
+      <div id="task_assignment<?php print $tdid; ?>"><?php print $ti->getAssignmentDisplay(); ?></div>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable-edit.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable-edit.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..0bca3b03a1b42824e8480a56b907e4dec8e4dbf2
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable-edit.tpl.php
@@ -0,0 +1,62 @@
+<?php
+// $Id: maestro-task-set-process-variable-edit.tpl.php,v 1.5 2010/08/30 21:25:26 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-set-process-variable-edit.tpl.php
+ */
+
+?>
+
+<table>
+  <tr>
+    <td><?php print t('Variable to Set:'); ?></td>
+    <td>
+      <select name="var_to_set">
+<?php
+        foreach ($pvars as $value=>$label) {
+          if ($value == $td_rec->task_data['var_to_set']) {
+?>
+            <option value="<?php print $value;?>" selected="selected"><?php print $label;?></option>
+<?php
+          }
+          else {
+?>
+            <option value="<?php print $value;?>"><?php print $label;?></option>
+<?php
+          }
+        }
+?>
+      </select>
+    </td>
+  </tr>
+<?php
+  foreach ($set_methods as $key => $method) {
+?>
+  <tr>
+    <td>
+      <label for="set_type_opt_<?php print $key; ?>"><input type="radio" id="set_type_opt_<?php print $key; ?>" name="set_type" value="<?php print $key; ?>" onchange="toggle_set_type('<?php print $key; ?>');" <?php print ($td_rec->task_data['set_type'] == $key) ? 'checked="checked"':''; ?>>
+      <?php print $method['title']; ?></label>
+    </td>
+    <td><input class="set_method" id="set_type_<?php print $key; ?>" type="text" name="<?php print $key; ?>_value" value="<?php print $td_rec->task_data[$key . '_value']; ?>"></td>
+  </tr>
+<?php
+  }
+?>
+</table>
+
+<script type="text/javascript">
+  setTimeout(tick, 500);
+
+  function tick() {
+    toggle_set_type('<?php print $td_rec->task_data['set_type']; ?>');
+  }
+
+
+  function toggle_set_type(type) {
+    (function($) {
+      $('.set_method').hide();
+      $('#set_type_' + type).show();
+    })(jQuery);
+  }
+</script>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..c6f3561fd907e582340b0f1e6ab0da9da34477c1
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-set-process-variable.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-set-process-variable.tpl.php,v 1.6 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-set-process-variable.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-gry"><div class="tr-gry">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-gry maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Set Process Variable Task'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-start.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-start.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..28d7c43664acb5e3989fa3a3f21aae4e2184fa69
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-start.tpl.php
@@ -0,0 +1,22 @@
+<?php
+// $Id: maestro-task-start.tpl.php,v 1.5 2010/08/10 19:04:36 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-start.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-grn"><div class="tr-grn">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-grn maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <?php print t('Start of Workflow'); ?>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>
diff --git a/sites/all/modules/maestro/theme/structure/tasks/maestro-task-unknown.tpl.php b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-unknown.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..12ddb46013494282c74e58770607d643d0a5cdc9
--- /dev/null
+++ b/sites/all/modules/maestro/theme/structure/tasks/maestro-task-unknown.tpl.php
@@ -0,0 +1,23 @@
+<?php
+// $Id: maestro-task-unknown.tpl.php,v 1.2 2010/09/02 18:09:08 chevy Exp $
+
+/**
+ * @file
+ * maestro-task-unknown.tpl.php
+ */
+
+?>
+
+<div class="maestro_task">
+  <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl"><div class="br"><div class="tl-red"><div class="tr-red">
+
+    <div id="task_title<?php print $tdid; ?>" class="tm-red maestro_task_title">
+      <?php print $taskname; ?>
+    </div>
+    <div class="maestro_task_body">
+      <b><?php print t('Invalid Task Type:'); ?><br>
+      <?php print $ti->_task_class; ?></b>
+    </div>
+
+  </div></div></div></div></div></div></div></div>
+</div>