Ejemplo n.º 1
0
    public function actionTeam()
    {
        global $urlRequestRoot, $moduleFolder, $sourceFolder, $templateFolder, $cmsFolder, $STARTSCRIPTS;
        $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts";
        $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images";
        $mcid = $this->moduleComponentId;
        require_once $sourceFolder . "/upload.lib.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/qaos_common.php";
        $teamAction = "";
        if (isset($_GET['subaction']) && $_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) {
            echo $this->getFormSuggestions(escape($_GET['forwhat']));
            exit;
        }
        if (isset($_POST['eventNameForDownload'])) {
            downloadAsZipFile($mcid, getEventIdFromName(escape($_POST['eventNameForDownload']), $mcid));
        }
        if (isset($_POST['eventName'])) {
            if ($_POST['eventName'] == "") {
                displayerror("Event Name Field is empty");
            } else {
                $uploadFile = upload($mcid, "qaos1", $this->userId, "uploadBill");
                $evtId = getEventIdFromName(escape($_POST['eventName']), $mcid);
                if ($evtId != 0) {
                    foreach ($uploadFile as $image) {
                        addToBills($image, $evtId, $mcid);
                    }
                } else {
                    displayerror("Invalid Event Name.Contact QA Team");
                }
            }
        }
        $teamAction .= displayBills($mcid);
        $fileUploadForm = getMultipleFileUploadField("uploadBill", "qaos1", UPLOAD_SIZE_LIMIT, '= "multiple"');
        $txtBoxForDownload = displaySuggestionBox("eventNameForDownload", "suggestionsBoxForDownload", "team", "userBox1");
        $txtBoxForUpload = displaySuggestionBox("eventName", "suggestionsBox", "team", "userBox");
        $teamAction .= <<<FORMTOADD
      <form action="./+team" method="post" enctype="multipart/form-data">
      <table>
        <tr>
         <td>Event Name: </td>
\t <td>{$txtBoxForUpload}</td>
       </tr>
       <tr>
         <td>Upload File:</td>
         <td>{$fileUploadForm}</td>
       </tr>
       <tr>
        <td colspan="2"><input type="submit" value="submit" /></td>
       </tr>
     </table>
   </form>
   <form action="./+team" method="post" enctype="multipart/form-data">
     <table>
       <tr>
         <td>Event Name(Blank if u want to download all bills): </td>
         <td>{$txtBoxForDownload}</td>
      </tr>
      <tr><td colspan="2"><input type="submit" value="submit" /></td></tr>
    </table>
  </form>
FORMTOADD;
        return $teamAction;
    }
Ejemplo n.º 2
0
/**
 * Function handleIconManagement 
 * @description Returns the Icon Admin page html and handles AJAX requests for page /+admin$subaction=i
 * 
 * @return HTML of the FORM
 */
function handleIconManagement()
{
    /*
     *	Upload a new icon
     */
    if (isset($_POST['FileUploadForm'])) {
        global $userId, $sourceFolder;
        require_once "{$sourceFolder}/upload.lib.php";
        $allowableTypes = array('jpeg', 'jpg', 'png', 'gif');
        $result = submitFileUploadForm($userId, 'iconman', $userId, false, $allowableTypes, 'iconUpload');
    }
    /**
     * If user is setting an icon to a page, then generate an ajax response
     */
    if (isset($_GET['iconURL'])) {
        $rootUri = hostURL();
        global $cmsFolder, $templateFolder;
        if (isset($_GET["iconURL"]) && isset($_GET['targetId'])) {
            ///Security checks
            $iconURL = $_GET["iconURL"];
            $iconURL = str_replace($rootUri, "", $iconURL);
            $parse = strstr($iconURL, "{$cmsFolder}/{$templateFolder}/common/icons/");
            if ($parse == "") {
                $parse = strstr($iconURL, "{$cmsFolder}/uploads/iconman/");
            }
            $iconURL = $parse;
            $iconURL = escape($iconURL);
            $target = escape($_GET["targetId"]);
            /**
             * Save the Icon in Database - The following entries are saved
             * icon URL - path relative to the website installation folder on the server
             */
            mysql_query("UPDATE `" . MYSQL_DATABASE_PREFIX . "pages` SET `page_image`='{$iconURL}' WHERE `page_id`='{$target}'");
            $pageDetails = getPageInfo($target);
            if ($pageDetails['page_image'] != NULL) {
                echo "<img src=\"{$rootUri}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/status/weather-clear.png\" /> ";
            } else {
                echo "<img src=\"{$rootUri}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/status/dialog-error.png\" width=12 height=12/> ";
            }
            echo $pageDetails["page_name"];
        } else {
            if (isset($_GET['iconAction'])) {
                $action = $_GET['iconAction'];
            } else {
                die("Restricted access");
            }
        }
        exit(0);
    }
    /**
     * @description Icon Management Form Generation Code Starts here
     */
    $iconForm = "";
    $iconForm .= <<<ICONFORM
\t\t<style type="text/css">
\t\t.myIconForm div {
\t\t\tpadding: 5px;
\t\t}
\t\t.myIconForm div a{
\t\t\ttext-decoration: none!important;
\t\t}\t
\t\t</style>
\t\t
ICONFORM;
    global $cmsFolder;
    global $sourceFolder;
    global $templateFolder;
    global $userId;
    $myhostURL = hostURL();
    ///Ajax handler functions, drag and drop handlers defined in icon.event.handler.js
    $iconForm .= "<script type=\"text/javascript\" src=\"{$myhostURL}/{$cmsFolder}/{$templateFolder}/common/scripts/icon.event.handler.js\"></script>";
    $iconForm .= <<<STYLES
\t\t<style type="text/css">
\t\t.myIconForm {
\t\t\tmargin:0;
\t\t\tpadding:0;
\t\t}
\t\t#iconTreeMenu {
\t\t\tposition:relative;
\t\t}
\t\t.myIconForm ul {
\t\t\tmargin: 5px;
\t\t\twidth: 100%;
\t\t\tmargin-left: 10px;
\t\t\tpadding: 0;
\t\t\tborder-left: solid 1px #333;
\t\t}
\t\t.myFormIcon ul li a {
\t\t\tpadding: 5px;
\t\t}
\t\t.myIconList {
\t\t\theight:500px;
\t\t\toverflow:scroll;
\t\t\tmax-width:100%;
\t\t}
\t\t</style>
STYLES;
    ///This contains file upload functions of CMS. Look into upload.lib.php documentation for more
    require_once "{$sourceFolder}/upload.lib.php";
    ///Just a duplicate copy for sending it to the upload functions.
    $fakeid = $userId;
    ///get the html for upload - input tag
    $imageUploadField = getMultipleFileUploadField('iconUpload', 'iconman', 512 * 1024);
    //$iconForm .= $imageUploadField;
    $uploadForm = <<<FORM
\t<form method="POST" action="./+admin&subaction=icon" enctype="multipart/form-data">
\t{$imageUploadField}
\t<input type="submit" />
\t</form>
\t
FORM;
    ///Display Icons
    $iconForm .= "<table class=\"myIconForm\"><tr><td id=\"iconTreeMenu\">";
    ///Fetch the site's complete tree structure of pages.
    ///The elements here are the ones on which icons are dropped.
    $iconForm .= getTreeView(0, -1, $myhostURL, $userId, 1);
    $iconForm .= "</td>";
    $iconForm .= "<td>";
    ///Fetch Icon file list and get as html
    $selectionList = getIconList();
    ///Gather the html and append the iconform html
    $iconForm .= <<<SELECTION
\t\t<div class="selection" id="targetIcon">
\t\t\t<h3>Upload new icons</h3>
\t\t\t\t<p align="left">
\t\t\t\t\t{$uploadForm}<br/>
\t\t\t\t\t- Select Multiple files
\t\t\t\t</p>
\t\t\t<h3>List of available icons</h3>
\t\t\t<p align="left">
\t\t\t\tUsage : <br />
\t\t\t\t- Drag and drop<br />
\t\t\t\t- Select an icon and then choose the target.
\t\t\t\t</p>
\t\t\t<div class="selectlist">
\t\t\t\t{$selectionList}
\t\t\t</div>
\t\t</div>
SELECTION;
    $iconForm .= "</td>";
    $iconForm .= "</tr></table>";
    return $iconForm;
}