<?php
// PHP Script: index.asp
// Description: *.com index page
// DATE: 26-11-2009
// AUTHOR: 'Eugene Kerner' <ekerner@ekerner.com>
// REVISION: 1.0

require_once('../config/SetEnv.php');
require_once('config/EmailConfig.php');
require_once('EKerner/WebApp/PostValidating.php');

class webpage extends EKerner_WebApp_PostValidating
{

  public function __construct()
  {
    parent::__construct();
    $emailConfig     = new EmailConfig();
    $this->maximumMB = round($emailConfig->maximumBytes / 1000000, 1);
  }

  public function render()
  {
    // html meta data ...
    $this->setMetaDataByActionSwitch($_GET['action']);
    
    $this->panes->head->append('content',
      '<link rel="stylesheet" type="text/css" href="/css/accordion.css" />' . "\n    " .
      '<script type="text/javascript" src="/js/accordion.jq"></script>'

    );
    $this->panes->onload->append('content', 
      "menu.init('mainMenu', ['Contact', 'Submissions']);\n" . 
      $this->validator->getKeypressHandlerJq()
    );
    
    // page content ...
    $this->panes->banner->append('widget', 'ContactLinks');
    $this->panes->left->append('widget', 'GenreMenu');
    $this->panes->heading->append('content', '
                      <img class="floatRight headingImage" src="/images/content/post_box.png" alt="Post Box" title="Send us information or data files" style="cursor:help;" width="118px" height="100px" />
                      <h2><img src="/images/icons/letter_icon.png" alt="Letter Icon" width="25" height="25" />' . $this->title . '</h2>
                      <p>Please use the below form to submit data, files, and information related to your projects.</p>
                      <p>We will reply with receipt confirmation once we have your data in hand.</p>
                      <p>Related information: 
                         <a href="http://www.acma.gov.au/WEB/STANDARD/pc=PC_310294" onclick="window.open(\'http://www.acma.gov.au/WEB/STANDARD/pc=PC_310294\'); return false;" title="SPAM is Illegal">Australian SPAM Law</a> | 
                         <a href="/terms" title="Terms &amp; Conditions">Our Terms &amp; Conditions</a></p>
                      <p class="alignRight"><a href="/contact">all contact meduim &raquo;</a></p>
    ');
    $this->panes->main->append('content', '
                      <div class="p">
                        <h4>Online Contact Form</h4>
                        <p>
                          To send your information or data please use the text area or file upload facilities below.<br />
                          You can add as many files as you like but the total must not exceed ' . $this->maximumMB . 'MB,
                           for files larger than ' . $this->maximumMB . 'MB then please use the below text area
                           to request a different delivery method such as postal, pick-up, or file transfer (FTP).<br /><br />
                        </p>
    ');
    $this->panes->main->append('template', $this->draughtPageRequest());
    $this->panes->main->append('content', '
                      </div>
    ');
    $this->panes->right->append('widget', 'BlockLinks');
    $this->panes->bottom->append('widget', 'Footer');

    $this->write();
  }
  
  private function setMetaDataByActionSwitch($action = '')
  {
    if ($action === 'send') {
      $this->title = 'Thankyou for your upload';
      $this->siteDetails->metaDescription = $this->siteDetails->company . ' have recieved your transmission. Thank you';
      $this->siteDetails->metaKeywords    = $this->siteDetails->company . ', application developer, application, developer, app, software, Australia, AU, AUS, OZ, AUD, information technology, ' .
                                            'submissions, submit, info, details, data, files, information, sent, thankyou, thank you';
    } else {
      $this->title = 'Submit Info or Data';
      $this->siteDetails->metaDescription = $this->siteDetails->company . ' submissions form. Please use the below form to submit details, data, files, and information related to your projects.';
      $this->siteDetails->metaKeywords    = $this->siteDetails->company . ', application developer, application, developer, app, software, Australia, AU, AUS, OZ, AUD, information technology, ' .
                                            'submissions, submit, info, details, data, files, information';
    }
    $this->siteDetails->metaTitle       = $this->title . ' &middot; ' . $this->siteDetails->company . ' &middot; ' . $this->siteDetails->caption;
  }
    
  protected function formFieldsValid()
  {
    return ($_POST['comments'] && $_POST['fullName']);
  }
    
}


try {
  $webpage = new webpage();
  $webpage->render();
} catch (Exception $e) {
  die($e->getMessage());
}

?>
