Exemplo n.º 1
0
/**
 * Output the html for the edit site form
 *
 * @param int $site ID of the site
 * @param string $mode whether this is internal or external facing, defaults to internal
 * @return string $html edit site form html
 * @author Kieran Hogg
 */
function show_edit_site($site, $mode = 'internal')
{
    global $CONFIG;
    $sql = "SELECT * FROM `{$GLOBALS['dbSites']}` WHERE id='{$site}' ";
    $siteresult = mysql_query($sql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    while ($siterow = mysql_fetch_array($siteresult)) {
        if ($mode == 'internal') {
            $html .= "<h2>" . icon('site', 32) . " {$GLOBALS['strEditSite']}: {$site} - ";
            $html .= site_name($site) . "</h2>";
        } else {
            $html .= "<h2>" . icon('site', 32) . " " . site_name($site) . "</h2>";
        }
        $html .= "<form name='edit_site' action='{$_SERVER['PHP_SELF']}";
        $html .= "?action=update' method='post' onsubmit='return ";
        $html .= "confirm_action(\"{$GLOBALS['strAreYouSureMakeTheseChanges']}\")'>";
        $html .= "<table align='center' class='vertical'>";
        $html .= "<tr><th>{$GLOBALS['strName']}:</th>";
        $html .= "<td><input class='required' maxlength='50' name='name' size='40' value='{$siterow['name']}' />";
        $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n";
        if ($mode == 'internal') {
            $html .= "<tr><th>{$GLOBALS['strTags']}:</th><td><textarea rows='2' cols='60' name='tags'>";
            $html .= list_tags($site, TAG_SITE, false) . "</textarea>\n";
        }
        $html .= "<tr><th>{$GLOBALS['strDepartment']}:</th>";
        $html .= "<td><input maxlength='50' name='department' size='40' value='{$siterow['department']}' />";
        $html .= "</td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strAddress1']}:</th>";
        $html .= "<td><input maxlength='50' name='address1'";
        $html .= "size='40' value='{$siterow['address1']}' />";
        $html .= "</td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strAddress2']}: </th><td><input maxlength='50' name='address2' size='40' value='{$siterow['address2']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strCity']}:</th><td><input maxlength='255' name='city' size='40' value='{$siterow['city']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strCounty']}:</th><td><input maxlength='255' name='county' size='40' value='{$siterow['county']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strPostcode']}:</th><td><input maxlength='255' name='postcode' size='40' value='{$siterow['postcode']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strCountry']}:</th><td>" . country_drop_down('country', $siterow['country']) . "</td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strTelephone']}:</th><td>";
        $html .= "<input class='required' maxlength='255' name='telephone' size='40' value='{$siterow['telephone']}' />";
        $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strFax']}:</th><td>";
        $html .= "<input maxlength='255' name='fax' size='40' value='{$siterow['fax']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strEmail']}:</th><td>";
        $html .= "<input class='required' maxlength='255' name='email' size='40' value='{$siterow['email']}' />";
        $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strWebsite']}:</th><td>";
        $html .= "<input maxlength='255' name='websiteurl' size='40' value='{$siterow['websiteurl']}' /></td></tr>\n";
        $html .= "<tr><th>{$GLOBALS['strSiteType']}:</th><td>\n";
        $html .= sitetype_drop_down('typeid', $siterow['typeid']);
        $html .= "</td></tr>\n";
        if ($mode == 'internal') {
            $html .= "<tr><th>{$GLOBALS['strSalesperson']}:</th><td>";
            $html .= user_drop_down('owner', $siterow['owner'], $accepting = FALSE, '', '', TRUE);
            $html .= "</td></tr>\n";
        }
        if ($mode == 'internal') {
            $html .= "<tr><th>{$GLOBALS['strIncidentPool']}:</th>";
            $incident_pools = explode(',', "{$GLOBALS['strNone']},{$CONFIG['incident_pools']}");
            if (array_key_exists($siterow['freesupport'], $incident_pools) == FALSE) {
                array_unshift($incident_pools, $siterow['freesupport']);
            }
            $html .= "<td>" . array_drop_down($incident_pools, 'incident_poolid', $siterow['freesupport']) . "</td></tr>";
            $html .= "<tr><th>{$GLOBALS['strActive']}:</th><td><input type='checkbox' name='active' ";
            if ($siterow['active'] == 'true') {
                $html .= "checked='" . $siterow['active'] . "'";
            }
            $html .= " value='true' /></td></tr>\n";
            $html .= "<tr><th>{$GLOBALS['strNotes']}:</th><td>";
            $html .= "<textarea rows='5' cols='30' name='notes'>{$siterow['notes']}</textarea>";
            $html .= "</td></tr>\n";
        }
        plugin_do('edit_site_form');
        $html .= "</table>\n";
        $html .= "<input name='site' type='hidden' value='{$site}' />";
        $html .= "<p><input name='submit' type='submit' value='{$GLOBALS['strSave']}' /></p>";
        $html .= "</form>";
    }
    return $html;
}
Exemplo n.º 2
0
 echo "value='{$_SESSION['formdata']['add_site']['telephone']}' /></td></tr>\n";
 echo "<tr><th>{$strEmail}</th><td>";
 echo "<input class='required' maxlength='255' name='email' size='30'";
 echo "value='{$_SESSION['formdata']['add_site']['email']}' />";
 echo " <span class='required'>{$strRequired}</span></td></tr>\n";
 echo "<tr><th></th><td><a href=\"javascript:void(0);\" onclick=\"\$('hidden').toggle();\">{$strMore}</a></td></tr>\n";
 echo "<tbody id='hidden' class='hidden' style='display:none'>";
 echo "<tr><th>{$strFax}</th><td><input maxlength='255' name='fax' size='30'";
 echo "value='{$_SESSION['formdata']['add_site']['fax']}' /></td></tr>\n";
 echo "<tr><th>{$strWebsite}</th><td><input maxlength='255' name='websiteurl' size='30'";
 echo "value='{$_SESSION['formdata']['add_site']['websiteurl']}' /></td></tr>\n";
 echo "<tr><th>{$strSiteType}</th><td>";
 if ($_SESSION['formdata']['add_site']['typeid'] != '') {
     echo sitetype_drop_down('typeid', $_SESSION['formdata']['add_site']['typeid']) . "</td></tr>\n";
 } else {
     echo sitetype_drop_down('typeid', 1) . "</td></tr>\n";
 }
 echo "<tr><th>{$strSalesperson}</th><td>";
 if ($_SESSION['formdata']['add_site']['owner'] != '') {
     user_drop_down('owner', $_SESSION['formdata']['add_site']['owner'], FALSE);
 } else {
     user_drop_down('owner', 0, FALSE);
 }
 echo "</td></tr>\n";
 echo "<tr><th>{$strNotes}</th><td><textarea cols='30' name='notes' rows='5'>";
 echo $_SESSION['formdata']['add_site']['notes'];
 echo "</textarea></td></tr>\n";
 echo "</tbody>";
 echo "</table>\n";
 echo "<p><input name='submit' type='submit' value='{$strAddSite}' /></p>";
 echo "<p class='warning'>{$strAvoidDupes}</p>\n";
//
$permission = 37;
// Run Reports
$title = $strSiteProducts;
require 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
// This page requires authentication
require APPLICATION_LIBPATH . 'auth.inc.php';
if (empty($_REQUEST['mode'])) {
    include APPLICATION_INCPATH . 'htmlheader.inc.php';
    echo "<h2>{$title}</h2>";
    echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>";
    echo "<table class='vertical'>";
    echo "<tr><th>{$strSiteType}:</td>";
    echo "<td>";
    echo sitetype_drop_down('type', 0);
    echo "</td></tr>";
    echo "<tr><th>{$strOutput}:</th>";
    echo "<td>";
    echo "<select name='output'>";
    echo "<option value='screen'>{$strScreen}</option>";
    echo "<option value='csv'>{$strCSVfile}</option>";
    echo "</select>";
    echo "</td></tr>";
    echo "</table>";
    echo "<p align='center'>";
    echo "<input type='hidden' name='table1' value='{$_POST['table1']}' />";
    echo "<input type='hidden' name='mode' value='report' />";
    echo "<input type='submit' value=\"{$strRunReport}\" />";
    echo "</p>";
    echo "</form>";