
      <table width="100%" bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center">
        <tr>
          <td>
            <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
              {literal}
              <script language="JavaScript">
              <!--
              function validateForm(f)
              {
                  checkLeadSelection(f);
                  if (isWhitespace(f.title.value)) {
                      selectField(f, 'title');
                      alert('{/literal}{t escape=js}Please enter the title of this project.{/t}{literal}');
                      return false;
                  }
                  if (!hasOneSelected(f, 'users[]')) {
                      selectField(f, 'users[]');
                      alert('{/literal}{t escape=js}Please assign the users for this project.{/t}{literal}');
                      return false;
                  }
                  if (!hasOneSelected(f, 'statuses[]')) {
                      selectField(f, 'statuses[]');
                      alert('{/literal}{t escape=js}Please assign the statuses for this project.{/t}{literal}');
                      return false;
                  }
                  // the selected initial status should be one of the selected assigned statuses
                  initial_status = getSelectedOption(f, 'initial_status');
                  assigned_statuses = getFormElement(f, 'statuses[]');
                  var found = 0;
                  for (var i = 0; i < assigned_statuses.options.length; i++) {
                      if ((assigned_statuses.options[i].selected) && (initial_status == assigned_statuses.options[i].value)) {
                          found = 1;
                      }
                  }
                  if (!found) {
                      selectField(f, 'initial_status');
                      alert('{/literal}{t escape=js}Please choose the initial status from one of the assigned statuses of this project.{/t}{literal}');
                      return false;
                  }
                  if (!isEmail(f.outgoing_sender_email.value)) {
                      selectField(f, 'outgoing_sender_email');
                      alert('{/literal}{t escape=js}Please enter a valid outgoing sender address for this project.{/t}{literal}');
                      return false;
                  }
                  if (f.mail_aliases.value) {
                      aliases = f.mail_aliases.value.split(',');
                      for (idx in aliases) {
	                      if (!isEmail(aliases[idx])) {
	                          selectField(f, 'mail_aliases');
	                          alert('{/literal}{t escape=js}Please enter a comma separated list of valid mail address aliases for this project{/t}{literal}');
	                          return false;
	                      }
                      }
		  }
                  return true;
              }
              function checkLeadSelection(f)
              {
                  var selection = f.lead_usr_id.options[f.lead_usr_id.selectedIndex].value;
                  selectOption(f, 'users[]', selection);
              }
              //-->
              </script>
              {/literal}
              <form name="project_form" onSubmit="javascript:return validateForm(this);" method="post" action="{$smarty.server.PHP_SELF}">
              {if $smarty.get.cat == 'edit'}
              <input type="hidden" name="cat" value="update">
              <input type="hidden" name="id" value="{$smarty.get.id}">
              {else}
              <input type="hidden" name="cat" value="new">
              {/if}
              <tr>
                <td colspan="2" class="default">
                  <b>{t}Manage Projects{/t}</b>
                </td>
              </tr>
              {if $result != ""}
              <tr>
                <td colspan="2" bgcolor="{$cell_color}" align="center" class="error">
                  {if $smarty.post.cat == "new"}
                    {if $result == -1}
                      {t}An error occurred while trying to add the new project.{/t}
                    {elseif $result == -2}
                      {t}Please enter the title for this new project.{/t}
                    {elseif $result == 1}
                      {t}Thank you, the project was added successfully.{/t}
                    {/if}
                  {elseif $smarty.post.cat == "update"}
                    {if $result == -1}
                      {t}An error occurred while trying to update the project information.{/t}
                    {elseif $result == -2}
                      {t}Please enter the title for this project.{/t}
                    {elseif $result == 1}
                      {t}Thank you, the project was updated successfully.{/t}
                    {/if}
                  {/if}
                </td>
              </tr>
              {/if}
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Title{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <input type="text" name="title" size="40" class="default" value="{$info.prj_title|escape:"html"}">
                  {include file="error_icon.tpl.html" field="title"}
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Status{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="status" class="default">
                    <option value="active" {if $info.prj_status == 'active'}selected{/if}>{t}Active{/t}</option>
                    <option value="archived" {if $info.prj_status == 'archived'}selected{/if}>{t}Archived{/t}</option>
                  </select>
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Customer Integration Backend{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="customer_backend" class="default">
                    <option value="">{t}No Customer Integration{/t}</option>
                    {html_options options=$customer_backends selected=$info.prj_customer_backend}
                  </select>
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Workflow Backend{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="workflow_backend" class="default">
                    <option value="">{t}No Workflow Management{/t}</option>
                    {html_options options=$workflow_backends selected=$info.prj_workflow_backend}
                  </select>
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Project Lead{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="lead_usr_id" class="default" onChange="javascript:checkLeadSelection(this.form);">
                    {html_options options=$user_options selected=$info.prj_lead_usr_id}
                  </select>
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Users{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="users[]" multiple size="3" class="default">
                    {html_options options=$user_options selected=$info.prj_assigned_users}
                  </select>
                  {include file="error_icon.tpl.html" field="users[]"}
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Statuses{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="statuses[]" multiple size="3" class="default">
                    {html_options options=$status_options selected=$info.assigned_statuses}
                  </select>
                  {include file="error_icon.tpl.html" field="statuses[]"}
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Initial Status for New Issues{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <select name="initial_status" class="default">
                    {html_options options=$status_options selected=$info.prj_initial_sta_id}
                  </select>
                  {include file="error_icon.tpl.html" field="initial_status"}
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Outgoing Email Sender Name{/t}:</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <input type="text" name="outgoing_sender_name" size="40" class="default" value="{$info.prj_outgoing_sender_name|escape:"html"}">
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Outgoing Email Sender Address{/t}: *</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <input type="text" name="outgoing_sender_email" size="40" class="default" value="{$info.prj_outgoing_sender_email|escape:"html"}">
                  {include file="error_icon.tpl.html" field="outgoing_sender_email"}
                </td>
              </tr>
              <tr>
                <td width="120" bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Project mail aliases{/t}:</b>
                </td>
                <td bgcolor="{$light_color}" width="80%">
                  <input type="text" name="mail_aliases" size="40" class="default" value="{$info.prj_mail_aliases|escape:"html"}">
                  {include file="error_icon.tpl.html" field="mail_aliases"}
                </td>
              </tr>
              <tr>
                <td width="120" nowrap bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Remote Invocation{/t}:</b>
                </td>
                <td width="80%" bgcolor="{$light_color}" class="default">
                  <input type="radio" name="remote_invocation" value="enabled" {if $info.prj_remote_invocation == 'enabled'}checked{/if}> 
                  <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('project_form', 'remote_invocation', 0);">{t}Enabled{/t}</a>&nbsp;&nbsp;
                  <input type="radio" name="remote_invocation" value="disabled" {if $info.prj_remote_invocation != 'enabled'}checked{/if}> 
                  <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('project_form', 'remote_invocation', 1);">{t}Disabled{/t}</a>
                </td>
              </tr>
              <tr>
                <td width="120" nowrap bgcolor="{$cell_color}" class="default_white">
                  <b>{t}Segregate Reporters{/t}:</b> {include file="help_link.tpl.html" topic="segregate_reporter"}
                </td>
                <td width="80%" bgcolor="{$light_color}" class="default">
                  <input type="radio" name="segregate_reporter" value="1" {if $info.prj_segregate_reporter == 1}checked{/if}> 
                  <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('project_form', 'segregate_reporter', 0);">{t}Yes{/t}</a>&nbsp;&nbsp;
                  <input type="radio" name="segregate_reporter" value="0" {if $info.prj_segregate_reporter != 1}checked{/if}> 
                  <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('project_form', 'segregate_reporter', 1);">{t}No{/t}</a>
                </td>
              </tr>
              <tr>
                <td colspan="2" bgcolor="{$cell_color}" align="center">
                  {if $smarty.get.cat == 'edit'}
                  <input class="button" type="submit" value="{t}Update Project{/t}">
                  {else}
                  <input class="button" type="submit" value="{t}Create Project{/t}">
                  {/if}
                  <input class="button" type="reset" value="{t}Reset{/t}">
                </td>
              </tr>
              </form>
              <tr>
                <td colspan="2" class="default">
                  <b>{t}Existing Projects{/t}:</b>
                </td>
              </tr>
              <tr>
                <td colspan="2">
                  {literal}
                  <script language="JavaScript">
                  <!--
                  function checkDelete(f)
                  {
                      var total_selected = getTotalCheckboxesChecked(f, 'items[]');
                      var total = getTotalCheckboxes(f, 'items[]');
                      if (total == total_selected) {
                          alert('{/literal}{t escape=js}You cannot remove all of the projects in the system.{/t}{literal}');
                          return false;
                      }
                      if (!hasOneChecked(f, 'items[]')) {
                          alert('{/literal}{t escape=js}Please select at least one of the projects.{/t}{literal}');
                          return false;
                      }
                      if (!confirm('{/literal}{t escape=js}WARNING: This action will remove the selected projects permanently.{/t}{literal}\n{/literal}{t}It will remove all of its associated entries as well (issues, notes, attachments,\netc), so please click OK to confirm.{/t}{literal}')) {
                          return false;
                      } else {
                          return true;
                      }
                  }
                  //-->
                  </script>
                  {/literal}
                  <table border="0" width="100%" cellpadding="1" cellspacing="1">
                    <form onSubmit="javascript:return checkDelete(this);" method="post" action="{$smarty.server.PHP_SELF}">
                    <input type="hidden" name="cat" value="delete">
                    <tr>
                      <td width="4" bgcolor="{$cell_color}" nowrap><input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'items[]');"></td>
                      <td bgcolor="{$cell_color}" class="default_white">&nbsp;<b>{t}Title{/t}</b></td>
                      <td bgcolor="{$cell_color}" class="default_white">&nbsp;<b>{t}Project Lead{/t}</b></td>
                      <td bgcolor="{$cell_color}" class="default_white">&nbsp;<b>{t}Status{/t}</b></td>
                      <td bgcolor="{$cell_color}" nowrap class="default_white" align="center">&nbsp;<b>{t}Actions{/t}</b></td>
                    </tr>
                    {section name="i" loop=$list}
                    {cycle values=$cycle assign="row_color"}
                    <tr>
                      <td width="4" align="center" nowrap bgcolor="{$row_color}"><input type="checkbox" name="items[]" value="{$list[i].prj_id}"></td>
                      <td width="30%" bgcolor="{$row_color}" class="default">
                        &nbsp;<a class="link" href="{$smarty.server.PHP_SELF}?cat=edit&id={$list[i].prj_id}" title="{t}update this entry{/t}">{$list[i].prj_title}</a>
                      </td>
                      <td width="20%" bgcolor="{$row_color}" class="default">&nbsp;{$list[i].usr_full_name}</td>
                      <td bgcolor="{$row_color}" class="default">&nbsp;{$list[i].prj_status|capitalize}</td>
                      <td width="30%" bgcolor="{$row_color}" nowrap class="default">
                        <ul>
                          <li><a href="{$rel_url}manage/releases.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Releases{/t}</a></li>
                          <li><a href="{$rel_url}manage/categories.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Categories{/t}</a></li>
                          <li><a href="{$rel_url}manage/priorities.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Priorities{/t}</a></li>
                          <li><a href="{$rel_url}manage/phone_categories.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Phone Support Categories{/t}</a></li>
                          <li><a href="{$rel_url}manage/anonymous.php?prj_id={$list[i].prj_id}" class="link">{t}Anonymous Reporting{/t}</a></li>
                          <li><a href="{$rel_url}manage/field_display.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Fields to Display{/t}</a></li>
                          <li><a href="{$rel_url}manage/column_display.php?prj_id={$list[i].prj_id}" class="link">{t}Edit Columns to Display{/t}</a></li>
                        </ul>
                      </td>
                    </tr>
                    {sectionelse}
                    <tr>
                      <td colspan="5" bgcolor="{$light_color}" align="center" class="default">
                        <i>{t}No projects could be found.{/t}</i>
                      </td>
                    </tr>
                    {/section}
                    <tr>
                      <td width="4" bgcolor="{$cell_color}" align="center">
                        <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'items[]');">
                      </td>
                      <td colspan="4" bgcolor="{$cell_color}" align="center">
                        <input type="submit" value="{t}Delete{/t}" class="button">
                      </td>
                    </tr>
                    </form>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>

