* Contributor(s): Chris Nojima
 ********************************************************************************/
global $theme;
global $mod_strings;
global $app_list_strings;
global $current_user;
require_once 'modules/InboundEmail/InboundEmail.php';
require_once 'XTemplate/xtpl.php';
require_once "data/Tracker.php";
require_once 'themes/' . $theme . '/layout_utils.php';
require_once 'include/ListView/ListView.php';
$focus = new InboundEmail();
$focus->checkImap();
////	handle saving case macros
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 'true') {
    $focus->saveMacro('Case', $_REQUEST['inbound_email_case_macro']);
}
if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
    $ListView->setHeaderText("<a href='index.php?action=index&module=DynamicLayout&from_action=ListView&from_module=" . $_REQUEST['module'] . "'>" . get_image($image_path . "EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>");
}
$where = '';
$limit = '0';
$orderBy = 'date_entered';
$varName = $focus->object_name;
$allowByOverride = true;
$listView = new ListView();
$listView->initNewXTemplate('modules/InboundEmail/ListView.html', $mod_strings);
$listView->setHeaderTitle($mod_strings['LBL_MODULE_TITLE']);
echo $focus->getCaseMacroForm();
$listView->show_export_button = false;
$listView->setQuery($where, $limit, $orderBy, 'InboundEmail', $allowByOverride);