diff --git a/controllers/app_controller.php b/controllers/app_controller.php index 7317b544..90210e03 100755 --- a/controllers/app_controller.php +++ b/controllers/app_controller.php @@ -35,7 +35,7 @@ class AppController extends Controller { */ function isAdmin() { $currentuser = $this->getCurrentUser(); - if($currentuser['access_level'] == 1) { + if($currentuser['access_level'] == 'admin') { return true; } else { diff --git a/controllers/email_attachments_controller.php b/controllers/email_attachments_controller.php index 3189850e..f87c92d1 100755 --- a/controllers/email_attachments_controller.php +++ b/controllers/email_attachments_controller.php @@ -5,29 +5,62 @@ class EmailAttachmentsController extends AppController { var $helpers = array('Html', 'Form'); + + function download($id) { - $file = $this->EmailAttachment->findById($id); - if(file_exists($file['EmailAttachment']['filename'])) { + $file = $this->EmailAttachment->findById($id); + + $file_path = Configure::read('email_directory'); + + if(file_exists($file_path."/".$file['EmailAttachment']['name'])) { - Configure::write('debug', 0); - - header('Content-type: ' . $file['EmailAttachment']['type']); - header('Content-length: ' . $file['EmailAttachment']['size']); - header('Content-Disposition: attachment; filename='.$file['EmailAttachment']['name']); - - // ob_clean(); - // flush(); - readfile($file['EmailAttachment']['filename']); - // echo $file['EmailAttachment']['filename'] - exit(); - } - else { - echo "ERROR!! : File Not Found"; - echo $file['EmailAttachment']['filename']; - } + Configure::write('debug', 0); + + if(!$file['EmailAttachment']['filename']) { + $filename = 'vault_'.time(); + } + else { + $filename = $file['EmailAttachment']['filename']; + } + + header('Content-type: ' . $file['EmailAttachment']['type']); + header('Content-length: ' . $file['EmailAttachment']['size']); + header('Content-Disposition: attachment; filename='.$filename); + + readfile($file_path."/".$file['EmailAttachment']['name']); + + exit(); + } + else { + echo "ERROR!! : File Not Found"; + echo $file['EmailAttachment']['filename']; + die(); + } } + function view($id = null) { + Configure::write('debug', 0); + $this->layout = 'minimal'; + if(!$id) { + return; + } + else { + + $file = $this->EmailAttachment->find('first', array('conditions'=>array('EmailAttachment.id'=>$id))); + //$this->set('attachment', $file); + + $file_path = Configure::read('email_directory'); + + $contents = file_get_contents($file_path."/".$file['EmailAttachment']['name']); + + $this->set('contents', $contents); + + } + + } + + } diff --git a/controllers/email_recipients_controller.php b/controllers/email_recipients_controller.php index e8c41fa0..ccbc1b5b 100755 --- a/controllers/email_recipients_controller.php +++ b/controllers/email_recipients_controller.php @@ -5,5 +5,7 @@ class EmailRecipientsController extends AppController { var $helpers = array('Html', 'Form', 'Number'); + + } ?> diff --git a/controllers/emails_controller.php b/controllers/emails_controller.php index 51a508c1..be36d12c 100755 --- a/controllers/emails_controller.php +++ b/controllers/emails_controller.php @@ -1,55 +1,105 @@ Email->recursive = 0; - $this->set('emails', $this->paginate()); + var $name = 'Emails'; + var $helpers = array('Html', 'Form', 'Number', 'Text', 'Link'); + var $components = array('RequestHandler'); + + + + var $paginate = array( + + 'contain' => false, + 'limit' => 150, + 'order'=>array('Email.id' => 'desc') + + ); + + + function index() { + $this->Email->recursive = 0; + $this->set('emails', $this->paginate()); + } + + function view($id = null) { + + if (!$id) { + $this->Session->setFlash(__('Invalid Email.', true)); + $this->redirect(array('action'=>'index')); } - function view($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid Email.', true)); - $this->redirect(array('action'=>'index')); - } - $this->set('email', $this->Email->read(null, $id)); - } - - function add() { - if (!empty($this->data)) { - $this->Email->create(); - if ($this->Email->save($this->data)) { - $this->Session->setFlash(__('The Email has been saved', true)); - $this->redirect(array('action'=>'index')); - } else { - $this->Session->setFlash(__('The Email could not be saved. Please, try again.', true)); - } - } - $enquiries = $this->Email->Enquiry->find('list'); - $this->set(compact('enquiries')); - } - - function frame($id = null) { - $this->set('id', $id); - $this->set('attachments', $this->Email->EmailAttachment->findAllByEmailId($id)); - } - - function show($id = null) { - $this->layout = 'minimal'; - $this->set('email', $this->Email->read(null, $id)); - } + $email = $this->Email->read(null, $id); + $this->set('email', $email); - /* Violates DRY. Should probably clean this up at some point */ - function printview($id = null) { - $this->layout = 'minimal'; - $this->set('email', $this->Email->read(null, $id)); + $this->set('recipients', $this->Email->EmailRecipient->getRecipients($id)); + /*$recQuery = array("OR" => array("User.id"=> array())); + foreach($email['EmailRecipient'] as $rec) { + $recQuery["OR"]["User.id"][] = $rec['id']; } - + $users = $this->Email->User->find('all', array('conditions'=>$recQuery)); + $this->set('users',$users);/* + * + */ + + + +//print_r($users); + //print_r($recQuery); + + + $body_ID = $this->findBodyID($email['EmailAttachment']); + $this->set('body_ID', $body_ID); + } + + /** + * Returns the email_attachment ID of the first HTML attachment. + * + * + * @param $email_attachments + * @return + */ + function findBodyID($email_attachments) { + foreach($email_attachments as $attachment) { + if($attachment['is_message_body'] == 1) { + return $attachment['id']; + } + } + return false; + + } + + function frame($id = null) { + $email = $this->Email->find('first', array('conditions'=>array('Email.id'=>$id))); + + $body_ID = $this->findBodyID($email['EmailAttachment']); + $this->set('body_ID', $body_ID); + $this->set('recipients', $this->Email->EmailRecipient->getRecipients($id)); + + $this->set('email', $email); + } + + + + + /* old shit here, Might be useful */ + + function show($id = null) { + $this->layout = 'minimal'; + $this->set('email', $this->Email->read(null, $id)); + } + + + /* Violates DRY. Should probably clean this up at some point */ + function printview($id = null) { + $this->layout = 'minimal'; + $this->set('email', $this->Email->read(null, $id)); + + } + + } ?> diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index 353f6c1c..979a5fc6 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -7,9 +7,9 @@ class EnquiriesController extends AppController { var $paginate = array( - 'contain' => false, - 'limit' => 150, - 'order'=>array('Enquiry.id' => 'desc') + 'contain' => false, + 'limit' => 150, + 'order'=>array('Enquiry.id' => 'desc') ); @@ -18,81 +18,67 @@ class EnquiriesController extends AppController { //var $cacheAction = "1 hour"; - function index() { - $this->Enquiry->recursive = 0; - $this->set('enquiries', $this->paginate()); - $statuses = $this->Enquiry->Status->find('all', array('recursive'=>0)); - $status_list = array(); - foreach ($statuses as $status) { - $statusid = $status['Status']['id']; - $status_list[$statusid] = $status['Status']['name']; - } - $this->set('status_list', $status_list); - //debug($this->paginate()); - // $this->set('status_list', $this->Enquiry->Status->find('list')); + function index() { + $this->Enquiry->recursive = 0; + $this->set('enquiries', $this->paginate()); + $statuses = $this->Enquiry->Status->find('all', array('recursive'=>0)); + $status_list = array(); + foreach ($statuses as $status) { + $statusid = $status['Status']['id']; + $status_list[$statusid] = $status['Status']['name']; + } + $this->set('status_list', $status_list); + + //debug($this->paginate()); + // $this->set('status_list', $this->Enquiry->Status->find('list')); } function view($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid Enquiry.', true)); - $this->redirect(array('action'=>'index')); - } - //$enquiry = $this->Enquiry->read(null, $id); - $enquiry = $this->Enquiry->find('first', array('recursive' => 0, 'conditions' => array('Enquiry.id'=>$id) - )); - $this->set('enquiry', $enquiry); - - //$this->set('quotes', $enquiry['Quote']); - $this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC'))); - - $this->set('invoices', $this->Enquiry->Invoice->find('all', array('conditions' => array('Invoice.enquiry_id' => $id)))); - - - - $this->pageTitle = "Enquiry: ".$enquiry['Enquiry']['title']; + if (!$id) { + $this->Session->setFlash(__('Invalid Enquiry.', true)); + $this->redirect(array('action'=>'index')); + } + //$enquiry = $this->Enquiry->read(null, $id); + $enquiry = $this->Enquiry->find('first', array('recursive' => 1, 'conditions' => array('Enquiry.id'=>$id))); - - //$this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC'))); - - /* Trying to optimise the queries for this part of the view - it's currently getting bogged down checking Email Attachments. - * Going to create an array describing whether a particular email ID has an attachment. Trying to avoid checking binary data in a find('all') call - * - * WTF was I thinking. Binary data in the database. Fucking oath. - */ - - /* - $emails = $this->Enquiry->Email->find('all', array( - 'recursive' => 0, - 'contain' => 'EmailAttachment.id', 'EmailAttachment.email_id', - 'fields' => array('Email.id', 'Email.created', 'Email.subject', 'Email.to', 'Email.from', 'Email.cc', 'Email.date'), - 'conditions' => array('Email.enquiry_id'=>$id), 'order' => 'Email.created DESC')); - - $this->set('emails', $emails); + $this->set('enquiry', $enquiry); - TO DO: - * Fix up Email Attachment icon on email box. Currently broken -KC 6/8/09 - $this->set('number_of_emails', $this->Enquiry->Email->find('count', array('conditions'=>array('Email.enquiry_id'=>$id)))); - */ - - - //$this->set('emails', $this->Enquiry->Email->find('all', array('conditions'=>array('Email.enquiry_id' => $id)))); - $this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id)))); - //$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id)))); - $this->set('principle_emails', $this->Enquiry->Principle->PrincipleContact->findAllByPrincipleId($enquiry['Enquiry']['principle_id'])); - - $this->set('jobs', $this->Enquiry->Job->find('all', array('conditions'=>array('Job.enquiry_id'=>$id)))); + $emailIDs = array(); + foreach($enquiry['Email'] as $email) { + $emailIDs[] = $email['id']; + } - if($enquiry['Enquiry']['billing_address_id'] != 0) { - $this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id'])); - } + $emails = $this->Enquiry->Email->find('all', array('conditions'=>array('Email.id'=>$emailIDs))); - if($enquiry['Enquiry']['shipping_address_id'] != 0) { - $this->set('shippingaddress', $this->Enquiry->ShippingAddress->findById($enquiry['Enquiry']['shipping_address_id'])); - } + $this->set('emails', $emails); + + //$this->set('quotes', $enquiry['Quote']); + $this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC'))); + + $this->set('invoices', $this->Enquiry->Invoice->find('all', array('conditions' => array('Invoice.enquiry_id' => $id)))); + + + $this->pageTitle = "Enquiry: ".$enquiry['Enquiry']['title']; + + + $this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id)))); + //$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id)))); + $this->set('principle_emails', $this->Enquiry->Principle->PrincipleContact->findAllByPrincipleId($enquiry['Enquiry']['principle_id'])); + + $this->set('jobs', $this->Enquiry->Job->find('all', array('conditions'=>array('Job.enquiry_id'=>$id)))); + + + if($enquiry['Enquiry']['billing_address_id'] != 0) { + $this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id'])); + } + + if($enquiry['Enquiry']['shipping_address_id'] != 0) { + $this->set('shippingaddress', $this->Enquiry->ShippingAddress->findById($enquiry['Enquiry']['shipping_address_id'])); + } } @@ -100,70 +86,70 @@ class EnquiriesController extends AppController { function add() { - if(empty($this->data)) { - if(isset($this->params['named']['customerid'])) { - $customer = $this->Enquiry->Customer->findById($this->params['named']['customerid']); - } - else { - $this->Session->setFlash(__('The customer must already exist in the database. Please add Enquiries to an existing Customer', true)); - $this->redirect(array('action'=>'index')); - } - } + if(empty($this->data)) { + if(isset($this->params['named']['customerid'])) { + $customer = $this->Enquiry->Customer->findById($this->params['named']['customerid']); + } + else { + $this->Session->setFlash(__('The customer must already exist in the database. Please add Enquiries to an existing Customer', true)); + $this->redirect(array('action'=>'index')); + } + } - if(isset($customer)) { - /* Check if the customer exists in the database - otherwise send the user back to step 1*/ - if(!$customer) { - $this->Session->setFlash(__('The customer must already exist in the database. Please try again', true)); - $this->redirect(array('action'=>'add')); - } + if(isset($customer)) { + /* Check if the customer exists in the database - otherwise send the user back to step 1*/ + if(!$customer) { + $this->Session->setFlash(__('The customer must already exist in the database. Please try again', true)); + $this->redirect(array('action'=>'add')); + } - $this->__showPage2($customer); - $this->render(); + $this->__showPage2($customer); + $this->render(); - } + } - if (!empty($this->data)) { - $customer = $this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id']); - $principle = $this->Enquiry->Principle->findById($this->data['Enquiry']['principle_id']); - $this->data['Enquiry']['principle_code'] = $principle['Principle']['code']; //Store which principle code this enquiry belongs to. - //Sanitize::clean($this->data); - if(isset($this->data['Contact']['new'])) { - if($this->data['Contact']['new']) { - $this->Enquiry->Contact->save($this->data); - $this->data['Enquiry']['contact_id'] = $this->Enquiry->Contact->id; - } - } - $this->Enquiry->set($this->data); - if($this->Enquiry->validates()) { + if (!empty($this->data)) { + $customer = $this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id']); + $principle = $this->Enquiry->Principle->findById($this->data['Enquiry']['principle_id']); + $this->data['Enquiry']['principle_code'] = $principle['Principle']['code']; //Store which principle code this enquiry belongs to. + //Sanitize::clean($this->data); + if(isset($this->data['Contact']['new'])) { + if($this->data['Contact']['new']) { + $this->Enquiry->Contact->save($this->data); + $this->data['Enquiry']['contact_id'] = $this->Enquiry->Contact->id; + } + } + $this->Enquiry->set($this->data); + if($this->Enquiry->validates()) { - $enquiryno = $this->__generateEnquiryNumber($this->data); - $this->data['Enquiry']['title'] = $enquiryno; - $this->Enquiry->create(); - if ($this->Enquiry->save($this->data)) { - $id = $this->Enquiry->id; - if($this->data['Enquiry']['send_enquiry_email'] == 1) { - $this->__sendNewEnquiryEmail($id); //Will change this to be the queue at some point. - } - else { - $this->Session->setFlash(__('The Enquiry has been saved but the Contact has NOT been emailed, as you requested.', true)); - $this->redirect(array('action'=>'view/'.$id), null, false); - } - } - else { - $this->Session->setFlash(__('The Enquiry could not be saved. Please, try again.', true)); - $this->__showPage2($this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id'])); - } - } - else { + $enquiryno = $this->__generateEnquiryNumber($this->data); + $this->data['Enquiry']['title'] = $enquiryno; + $this->Enquiry->create(); + if ($this->Enquiry->save($this->data)) { + $id = $this->Enquiry->id; + if($this->data['Enquiry']['send_enquiry_email'] == 1) { + $this->__sendNewEnquiryEmail($id); //Will change this to be the queue at some point. + } + else { + $this->Session->setFlash(__('The Enquiry has been saved but the Contact has NOT been emailed, as you requested.', true)); + $this->redirect(array('action'=>'view/'.$id), null, false); + } + } + else { + $this->Session->setFlash(__('The Enquiry could not be saved. Please, try again.', true)); + $this->__showPage2($this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id'])); + } + } + else { - $this->set('errors', $this->Enquiry->invalidFields()); - $this->__showPage2($customer); - $this->render(); + $this->set('errors', $this->Enquiry->invalidFields()); + $this->__showPage2($customer); + $this->render(); - } + } - } + } } /* Internal function to display page 2 of the Add Enquiry Form Wizard @@ -171,34 +157,34 @@ class EnquiriesController extends AppController { * */ function __showPage2($customer) { - /* Combine the first_name and last_name for the Contact Drop Down Box */ - $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id']))); - $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); - $states = $this->Enquiry->State->find('list'); - $countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc')); - $principles = $this->Enquiry->Principle->find('list', array('order' => 'Principle.name asc')); - $statuses = $this->Enquiry->Status->find('list'); - $users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'))); - $this->set(compact('users', 'customers', 'states', 'countries', 'principles', 'statuses', 'contacts', 'customer')); - $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id']))); - $this->set('billing_addresses', $customerAddresses); - $this->set('shipping_addresses', $customerAddresses); - $this->set('errors', $this->Enquiry->invalidFields()); - /* Feels like an ugly hack. But it gets the desired effect and it will do for now */ + /* Combine the first_name and last_name for the Contact Drop Down Box */ + $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id']))); + $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); + $states = $this->Enquiry->State->find('list'); + $countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc')); + $principles = $this->Enquiry->Principle->find('list', array('order' => 'Principle.name asc')); + $statuses = $this->Enquiry->Status->find('list'); + $users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'))); + $this->set(compact('users', 'customers', 'states', 'countries', 'principles', 'statuses', 'contacts', 'customer')); + $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id']))); + $this->set('billing_addresses', $customerAddresses); + $this->set('shipping_addresses', $customerAddresses); + $this->set('errors', $this->Enquiry->invalidFields()); + /* Feels like an ugly hack. But it gets the desired effect and it will do for now */ - if(isset($customerAddresses[0]['BillingAddress'])) { - $billing_address_list[0] = "No Address Selected"; - foreach ($customerAddresses as $address) { - $i = $address['BillingAddress']['id']; - $billing_address_list[$i] = $address['BillingAddress']['address'].'
'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'
'.up($address['Country']['name']).'

'; - } - $this->set('billing_addresses_list', $billing_address_list); - $this->set('shipping_addresses_list', $billing_address_list); - } - else { - $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); - $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); - } + if(isset($customerAddresses[0]['BillingAddress'])) { + $billing_address_list[0] = "No Address Selected"; + foreach ($customerAddresses as $address) { + $i = $address['BillingAddress']['id']; + $billing_address_list[$i] = $address['BillingAddress']['address'].'
'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'
'.up($address['Country']['name']).'

'; + } + $this->set('billing_addresses_list', $billing_address_list); + $this->set('shipping_addresses_list', $billing_address_list); + } + else { + $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); + $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); + } } @@ -206,211 +192,211 @@ class EnquiriesController extends AppController { /* Add enquiry_id to the Email Queue */ function __addToQueue($id) { - $enquiry = $this->Enquiry->read(null, $id); - $this->Enquiry->EnquiryEmailQueue->create(); - $this->data['EnquiryEmailQueue']['enquiry_id'] = $enquiry['Enquiry']['id']; - if ($this->Enquiry->EnquiryEmailQueue->save($this->data)) { - $this->Session->setFlash(__('The Enquiry has been saved and the Enquiry notification email has been added to the Queue', true)); - $this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false); + $enquiry = $this->Enquiry->read(null, $id); + $this->Enquiry->EnquiryEmailQueue->create(); + $this->data['EnquiryEmailQueue']['enquiry_id'] = $enquiry['Enquiry']['id']; + if ($this->Enquiry->EnquiryEmailQueue->save($this->data)) { + $this->Session->setFlash(__('The Enquiry has been saved and the Enquiry notification email has been added to the Queue', true)); + $this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false); - } - else { - $this->Session->setFlash(__('The Enquiry has been saved but the notification email could not be added to the Queue.', true)); - $this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false); - } + } + else { + $this->Session->setFlash(__('The Enquiry has been saved but the notification email could not be added to the Queue.', true)); + $this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false); + } } /* Generate Enquiry number and return it as a string */ function __generateEnquiryNumber($data) { - $state = $this->Enquiry->State->findById($data['Enquiry']['state_id']); - $principle = $this->Enquiry->Principle->findById($data['Enquiry']['principle_id']); - /* Generate the enquiry number for this enquiry */ - /* CMC Enquiry number format is: + $state = $this->Enquiry->State->findById($data['Enquiry']['state_id']); + $principle = $this->Enquiry->Principle->findById($data['Enquiry']['principle_id']); + /* Generate the enquiry number for this enquiry */ + /* CMC Enquiry number format is: * CMCE- * eg. CMC1245NE351234-456 */ - $enquiryid = $this->Enquiry->findCount(); /* Find what number we are - CMCXXXX */ - $enquiryoffset = 7882; //What Number Enquiry we were at before using this package. - $enquiryid += $enquiryoffset; - $enquiryid++; - /* Find how many enquiries have been for this principle code */ - $principleenquiries = $this->Enquiry->findCount('principle_code ='. $principle['Principle']['code']); + $enquiryid = $this->Enquiry->findCount(); /* Find what number we are - CMCXXXX */ + $enquiryoffset = 7882; //What Number Enquiry we were at before using this package. + $enquiryid += $enquiryoffset; + $enquiryid++; + /* Find how many enquiries have been for this principle code */ + $principleenquiries = $this->Enquiry->findCount('principle_code ='. $principle['Principle']['code']); - /* Principle Code Offsets - Existing Number of Enquiries for each Principle Code */ - $principlecode_offset = array( 15 => 207, //ELMAC, AMAL - 20 => 51, //T and B Electronic - 25 => 2062, //ATEX,Brilex,Marston - 35 => 2067, //Mid-West Instrument, DP - 36 => 47, //Reading Technologies - 37 => 2040, //Eldridge, Smart Measurement, Alia - 65 => 2212, //Papenmeier, Herberts Industrieglas - 85 => 586, //Analytical Systems, Misc - 95 => 181); //Comet, T and D. - $principleenquiries += $principlecode_offset[$principle['Principle']['code']]; //Add the offset. - $principleenquiries++; + /* Principle Code Offsets - Existing Number of Enquiries for each Principle Code */ + $principlecode_offset = array( 15 => 207, //ELMAC, AMAL + 20 => 51, //T and B Electronic + 25 => 2062, //ATEX,Brilex,Marston + 35 => 2067, //Mid-West Instrument, DP + 36 => 47, //Reading Technologies + 37 => 2040, //Eldridge, Smart Measurement, Alia + 65 => 2212, //Papenmeier, Herberts Industrieglas + 85 => 586, //Analytical Systems, Misc + 95 => 181); //Comet, T and D. + $principleenquiries += $principlecode_offset[$principle['Principle']['code']]; //Add the offset. + $principleenquiries++; - /* Find how many enquiries have been for this principle code in this state */ - /* This aspect of the enquiry number is not useful anymore. Made redundant thanks to mySQL queries. + /* Find how many enquiries have been for this principle code in this state */ + /* This aspect of the enquiry number is not useful anymore. Made redundant thanks to mySQL queries. * But this has been done for backwards-compatablity with existing enquiry numbers */ - $principleconditions = array - ( - "Enquiry.principle_code" => $principle['Principle']['code'], - "Enquiry.state_id" => $data['Enquiry']['state_id'] - ); + $principleconditions = array + ( + "Enquiry.principle_code" => $principle['Principle']['code'], + "Enquiry.state_id" => $data['Enquiry']['state_id'] + ); - $stateprincipleenquiries = $this->Enquiry->findCount($principleconditions); + $stateprincipleenquiries = $this->Enquiry->findCount($principleconditions); - /*Add the offsets for the State Principle Enquiries for each Code */ - $stateprinciple_offset = array( - //Elmac, Amal - 15 => array("NSW" => 39, "VIC" => 38, "TAS" => 58, - "ACT" => 0, "QLD" => 30, "NT" => 0, - "WA" => 19, "SA" => 8, "Overseas" => 1), - //T and B Electronic - 20 => array("NSW" => 14, "VIC" => 6, "TAS" => 0, - "ACT" => 0, "QLD" => 8, "NT" => 0, - "WA" => 12, "SA" => 1, "Overseas" => 5), - //ATEX,Brilex,Marston - 25 => array("NSW" => 580, "VIC" => 599, "TAS" => 186, - "ACT" => 0, "QLD" => 254, "NT" => 3, - "WA" => 541, "SA" => 72, "Overseas" => 625), - //Mid-West Instrument, DP - 35 => array("NSW" => 549, "VIC" => 851, "TAS" => 9, - "ACT" => 0, "QLD" => 245, "NT" => 15, - "WA" => 470, "SA" => 508, "Overseas" => 154), - //Reading Technologies - 36 => array("NSW" => 1, "VIC" => 3, "TAS" => 0, - "ACT" => 0, "QLD" => 7, "NT" => 0, - "WA" => 0, "SA" => 4, "Overseas" => 2), - //Eldridge, Smart Measurement, Alia - 37 => array("NSW" => 204, "VIC" => 60, "TAS" => 1, - "ACT" => 0, "QLD" => 130, "NT" => 1, - "WA" => 44, "SA" => 25, "Overseas" => 18), - //Papenmeier, Herberts Industrieglas - 65 => array("NSW" => 498, "VIC" => 537, "TAS" => 44, - "ACT" => 0, "QLD" => 158, "NT" => 12, - "WA" => 138, "SA" => 25, "Overseas" => 174), - //Analytical Systems, Misc - 85 => array("NSW" => 3, "VIC" => 6, "TAS" => 0, - "ACT" => 0, "QLD" => 1, "NT" => 0, - "WA" => 2, "SA" => 2, "Overseas" => 0), - //Comet, T and D. - 95 => array("NSW" => 34, "VIC" => 28, "TAS" => 6, - "ACT" => 0, "QLD" => 29, "NT" => 0, - "WA" => 9, "SA" => 8, "Overseas" => 31), - ); - $stateprincipleenquiries += $stateprinciple_offset[$principle['Principle']['code']][$state['State']['shortform']]; - $stateprincipleenquiries++; - /* Generate/set the enquiry number */ - $enquiryno = 'CMC'.$enquiryid.$state['State']['enqform'].'E'.$principle['Principle']['code'].$principleenquiries. - '-'.$stateprincipleenquiries; - return $enquiryno; + /*Add the offsets for the State Principle Enquiries for each Code */ + $stateprinciple_offset = array( + //Elmac, Amal + 15 => array("NSW" => 39, "VIC" => 38, "TAS" => 58, + "ACT" => 0, "QLD" => 30, "NT" => 0, + "WA" => 19, "SA" => 8, "Overseas" => 1), + //T and B Electronic + 20 => array("NSW" => 14, "VIC" => 6, "TAS" => 0, + "ACT" => 0, "QLD" => 8, "NT" => 0, + "WA" => 12, "SA" => 1, "Overseas" => 5), + //ATEX,Brilex,Marston + 25 => array("NSW" => 580, "VIC" => 599, "TAS" => 186, + "ACT" => 0, "QLD" => 254, "NT" => 3, + "WA" => 541, "SA" => 72, "Overseas" => 625), + //Mid-West Instrument, DP + 35 => array("NSW" => 549, "VIC" => 851, "TAS" => 9, + "ACT" => 0, "QLD" => 245, "NT" => 15, + "WA" => 470, "SA" => 508, "Overseas" => 154), + //Reading Technologies + 36 => array("NSW" => 1, "VIC" => 3, "TAS" => 0, + "ACT" => 0, "QLD" => 7, "NT" => 0, + "WA" => 0, "SA" => 4, "Overseas" => 2), + //Eldridge, Smart Measurement, Alia + 37 => array("NSW" => 204, "VIC" => 60, "TAS" => 1, + "ACT" => 0, "QLD" => 130, "NT" => 1, + "WA" => 44, "SA" => 25, "Overseas" => 18), + //Papenmeier, Herberts Industrieglas + 65 => array("NSW" => 498, "VIC" => 537, "TAS" => 44, + "ACT" => 0, "QLD" => 158, "NT" => 12, + "WA" => 138, "SA" => 25, "Overseas" => 174), + //Analytical Systems, Misc + 85 => array("NSW" => 3, "VIC" => 6, "TAS" => 0, + "ACT" => 0, "QLD" => 1, "NT" => 0, + "WA" => 2, "SA" => 2, "Overseas" => 0), + //Comet, T and D. + 95 => array("NSW" => 34, "VIC" => 28, "TAS" => 6, + "ACT" => 0, "QLD" => 29, "NT" => 0, + "WA" => 9, "SA" => 8, "Overseas" => 31), + ); + $stateprincipleenquiries += $stateprinciple_offset[$principle['Principle']['code']][$state['State']['shortform']]; + $stateprincipleenquiries++; + /* Generate/set the enquiry number */ + $enquiryno = 'CMC'.$enquiryid.$state['State']['enqform'].'E'.$principle['Principle']['code'].$principleenquiries. + '-'.$stateprincipleenquiries; + return $enquiryno; } /* Autocomplete the customer name - Used in: add.ctp */ function completeCustomer() { - $this->set('customers', $this->Enquiry->Customer->find('all', array( - 'conditions' => array( - 'Customer.name LIKE' => '%'.$this->data['Customer']['name'].'%' - ),'fields' => array('Customer.name') - ))); - $this->layout = 'ajax'; + $this->set('customers', $this->Enquiry->Customer->find('all', array( + 'conditions' => array( + 'Customer.name LIKE' => '%'.$this->data['Customer']['name'].'%' + ),'fields' => array('Customer.name') + ))); + $this->layout = 'ajax'; } /* Moving this to the new Enquiry email sender. */ function __sendNewEnquiryEmail($id) { - //Setup the SMTP Options - $this->Email->smtpOptions = array( - 'port' => '25', - 'timeout' => '30', - 'host' => '192.168.0.8', - 'username' => 'sales', - 'password' => '2seng33+02'); - $this->Email->delivery = 'smtp'; + //Setup the SMTP Options + $this->Email->smtpOptions = array( + 'port' => '25', + 'timeout' => '30', + 'host' => '192.168.0.8', + 'username' => 'sales', + 'password' => '2seng33+02'); + $this->Email->delivery = 'smtp'; - $enquiry = $this->Enquiry->read(null, $id); - $this->Email->to = $enquiry['Contact']['email']; - $this->Email->cc = array($enquiry['User']['email']); - $this->Email->bcc = array('carpis@cmctechnologies.com.au'); + $enquiry = $this->Enquiry->read(null, $id); + $this->Email->to = $enquiry['Contact']['email']; + $this->Email->cc = array($enquiry['User']['email']); + $this->Email->bcc = array('carpis@cmctechnologies.com.au'); - $this->Email->subject = $enquiry['Enquiry']['title'].' - Your Enquiry has been Entered in our System - CMC Technologies'; - $this->Email->replyTo = $enquiry['User']['email']; - $this->Email->from = 'CMC Technologies - Sales '; - $this->Email->template = 'enquiry_added'; - $this->Email->sendAs = 'both'; - $this->Email->charset = 'iso-8859-1'; - $this->set('enquiry', $enquiry); - if($this->Email->send()) { - $this->Session->setFlash(__('The Enquiry has been added and the Contact has been emailed', true)); - $this->redirect(array('action'=>'view/'.$id), null, false); - } - else { - $this->set('smtp_errors', $this->Email->smtpError); - $this->Session->setFlash(__('The Enquiry has been added but email to the contact has NOT been sent. Something went wrong.', true)); - $this->redirect(array('action'=>'view/'.$id), null, false); + $this->Email->subject = $enquiry['Enquiry']['title'].' - Your Enquiry has been Entered in our System - CMC Technologies'; + $this->Email->replyTo = $enquiry['User']['email']; + $this->Email->from = 'CMC Technologies - Sales '; + $this->Email->template = 'enquiry_added'; + $this->Email->sendAs = 'both'; + $this->Email->charset = 'iso-8859-1'; + $this->set('enquiry', $enquiry); + if($this->Email->send()) { + $this->Session->setFlash(__('The Enquiry has been added and the Contact has been emailed', true)); + $this->redirect(array('action'=>'view/'.$id), null, false); + } + else { + $this->set('smtp_errors', $this->Email->smtpError); + $this->Session->setFlash(__('The Enquiry has been added but email to the contact has NOT been sent. Something went wrong.', true)); + $this->redirect(array('action'=>'view/'.$id), null, false); - } + } } function edit($id = null) { - if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid Enquiry', true)); - $this->redirect(array('action'=>'index')); - } - if (!empty($this->data)) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid Enquiry', true)); + $this->redirect(array('action'=>'index')); + } + if (!empty($this->data)) { - if ($this->Enquiry->save($this->data)) { - $this->Session->setFlash(__('The Enquiry has been saved', true)); - $this->redirect(array('action'=>'index')); - } else { - $this->Session->setFlash(__('The Enquiry could not be saved. Please try again.', true)); - $this->set('dump', $this->data); - } - } - if (empty($this->data)) { - $this->data = $this->Enquiry->read(null, $id); - } - $enquiry = $this->Enquiry->read(null, $id); - $users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'))); - //$customer = $this->Enquiry->Customer->findById($enquiry['Enquiry']['customer_id']); + if ($this->Enquiry->save($this->data)) { + $this->Session->setFlash(__('The Enquiry has been saved', true)); + $this->redirect(array('action'=>'index')); + } else { + $this->Session->setFlash(__('The Enquiry could not be saved. Please try again.', true)); + $this->set('dump', $this->data); + } + } + if (empty($this->data)) { + $this->data = $this->Enquiry->read(null, $id); + } + $enquiry = $this->Enquiry->read(null, $id); + $users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'))); + //$customer = $this->Enquiry->Customer->findById($enquiry['Enquiry']['customer_id']); - $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $enquiry['Enquiry']['customer_id']))); - $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); - //$state = $this->Enquiry->State->findById($enquiry['Enquiry']['state_id']); - //$country = $this->Enquiry->Country->findById($enquiry['Enquiry']['country_id']); - //$principle = $this->Enquiry->Principle->findById($enquiry['Enquiry']['principle_id']); - $statuses = $this->Enquiry->Status->find('list'); - $principles = $this->Enquiry->Principle->find('list', array('conditions' => array('Principle.code' => $enquiry['Principle']['code']))); - $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $enquiry['Customer']['id']))); - $this->set('billing_addresses', $customerAddresses); - $this->set('shipping_addresses', $customerAddresses); + $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $enquiry['Enquiry']['customer_id']))); + $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); + //$state = $this->Enquiry->State->findById($enquiry['Enquiry']['state_id']); + //$country = $this->Enquiry->Country->findById($enquiry['Enquiry']['country_id']); + //$principle = $this->Enquiry->Principle->findById($enquiry['Enquiry']['principle_id']); + $statuses = $this->Enquiry->Status->find('list'); + $principles = $this->Enquiry->Principle->find('list', array('conditions' => array('Principle.code' => $enquiry['Principle']['code']))); + $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $enquiry['Customer']['id']))); + $this->set('billing_addresses', $customerAddresses); + $this->set('shipping_addresses', $customerAddresses); - /* Feels like an ugly hack. But it gets the desired effect and it will do for now */ + /* Feels like an ugly hack. But it gets the desired effect and it will do for now */ - if(isset($customerAddresses[0]['BillingAddress'])) { - $billing_address_list[0] = "No Address Selected"; - foreach ($customerAddresses as $address) { - $i = $address['BillingAddress']['id']; - $billing_address_list[$i] = $address['BillingAddress']['address'].'
'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'
'.up($address['Country']['name']).'

'; - } - $this->set('billing_addresses_list', $billing_address_list); - $this->set('shipping_addresses_list', $billing_address_list); - } - else { - $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); - $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); - } + if(isset($customerAddresses[0]['BillingAddress'])) { + $billing_address_list[0] = "No Address Selected"; + foreach ($customerAddresses as $address) { + $i = $address['BillingAddress']['id']; + $billing_address_list[$i] = $address['BillingAddress']['address'].'
'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'
'.up($address['Country']['name']).'

'; + } + $this->set('billing_addresses_list', $billing_address_list); + $this->set('shipping_addresses_list', $billing_address_list); + } + else { + $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); + $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); + } - $this->set(compact('enquiry', 'users','contacts','principles','statuses', 'addresses')); + $this->set(compact('enquiry', 'users','contacts','principles','statuses', 'addresses')); } /* function update_status($enquiryid) { @@ -429,14 +415,14 @@ class EnquiriesController extends AppController { function update_status() { - if($this->data) { - App::import('Core', 'Sanitize'); - $new_status = Sanitize::clean($this->data['Enquiry']['status_id']); - $this->Enquiry->id = $this->data['Enquiry']['id']; - $this->Enquiry->saveField('status_id', $new_status); - $this->set('enquiry', $this->Enquiry->findById($this->data['Enquiry']['id'])); + if($this->data) { + App::import('Core', 'Sanitize'); + $new_status = Sanitize::clean($this->data['Enquiry']['status_id']); + $this->Enquiry->id = $this->data['Enquiry']['id']; + $this->Enquiry->saveField('status_id', $new_status); + $this->set('enquiry', $this->Enquiry->findById($this->data['Enquiry']['id'])); - } + } } @@ -452,68 +438,68 @@ class EnquiriesController extends AppController { * Actually performs the searches */ function doSearch() { - if(!empty($this->data)) { - $searchQuery = trim($this->data['Enquiry']['search_string']); + if(!empty($this->data)) { + $searchQuery = trim($this->data['Enquiry']['search_string']); - $custConditions = array('Customer.name LIKE' => "%$searchQuery%"); - $enqConditions = array('Enquiry.title LIKE' => "%$searchQuery%"); - - $words = explode(" ", $searchQuery); + $custConditions = array('Customer.name LIKE' => "%$searchQuery%"); + $enqConditions = array('Enquiry.title LIKE' => "%$searchQuery%"); - if(count($words) == 2) { - $contactConditions = array('AND'=>array('Contact.first_name LIKE' => "%$words[0]%", - 'Contact.last_name LIKE' => "%$words[1]%")); - } - else { - $contactConditions = array('OR'=>array('Contact.first_name LIKE' => "%$searchQuery%", - 'Contact.last_name LIKE' => "%$searchQuery%")); - } + $words = explode(" ", $searchQuery); - $customerResults = $this->Enquiry->Customer->find('all', array('conditions' => $custConditions, 'recursive'=>0)); - $enquiryResults = $this->Enquiry->find('all', array('conditions'=>$enqConditions, 'recursive'=>0)); - $contactResults = $this->Enquiry->Contact->find('all', array('conditions'=>$contactConditions, 'recursive'=>0)); + if(count($words) == 2) { + $contactConditions = array('AND'=>array('Contact.first_name LIKE' => "%$words[0]%", + 'Contact.last_name LIKE' => "%$words[1]%")); + } + else { + $contactConditions = array('OR'=>array('Contact.first_name LIKE' => "%$searchQuery%", + 'Contact.last_name LIKE' => "%$searchQuery%")); + } - $searchDone = true; + $customerResults = $this->Enquiry->Customer->find('all', array('conditions' => $custConditions, 'recursive'=>0)); + $enquiryResults = $this->Enquiry->find('all', array('conditions'=>$enqConditions, 'recursive'=>0)); + $contactResults = $this->Enquiry->Contact->find('all', array('conditions'=>$contactConditions, 'recursive'=>0)); - $statuses = $this->Enquiry->Status->find('all', array('recursive'=>0)); - $status_list = array(); - foreach ($statuses as $status) { - $statusid = $status['Status']['id']; - $status_list[$statusid] = $status['Status']['name']; - } - $this->set('status_list', $status_list); + $searchDone = true; + + $statuses = $this->Enquiry->Status->find('all', array('recursive'=>0)); + $status_list = array(); + foreach ($statuses as $status) { + $statusid = $status['Status']['id']; + $status_list[$statusid] = $status['Status']['name']; + } + $this->set('status_list', $status_list); - $jobConditions = array('OR' =>array("Job.title LIKE" =>"%$searchQuery%", - "Job.customer_order_number LIKE" =>"%$searchQuery%")); + $jobConditions = array('OR' =>array("Job.title LIKE" =>"%$searchQuery%", + "Job.customer_order_number LIKE" =>"%$searchQuery%")); - $jobResults = $this->Enquiry->Job->find('all', array('conditions'=>$jobConditions, 'recursive'=>1)); + $jobResults = $this->Enquiry->Job->find('all', array('conditions'=>$jobConditions, 'recursive'=>1)); - $this->set(compact('customerResults', 'enquiryResults', 'contactResults', 'searchDone', 'status_list', - 'jobResults')); - $this->layout = 'ajax'; + $this->set(compact('customerResults', 'enquiryResults', 'contactResults', 'searchDone', 'status_list', + 'jobResults')); + $this->layout = 'ajax'; - } + } } function mark_submitted($id = null) { - if($id == null) { - $this->Session->setFlash('Invalid Enquiry ID'); - $this->redirect(array('action'=>'index')); - } - else { - $this->Enquiry->id = $id; - $today = date("Y-m-d"); - $this->Enquiry->saveField('submitted', $today); - $this->Session->setFlash('The Enquiry has been marked as submitted today ('.date('j M Y').')'); - $this->redirect(array('action'=>'index')); - } + if($id == null) { + $this->Session->setFlash('Invalid Enquiry ID'); + $this->redirect(array('action'=>'index')); + } + else { + $this->Enquiry->id = $id; + $today = date("Y-m-d"); + $this->Enquiry->saveField('submitted', $today); + $this->Session->setFlash('The Enquiry has been marked as submitted today ('.date('j M Y').')'); + $this->redirect(array('action'=>'index')); + } diff --git a/controllers/principles_controller.php b/controllers/principles_controller.php index 5240c761..5b995064 100755 --- a/controllers/principles_controller.php +++ b/controllers/principles_controller.php @@ -23,7 +23,7 @@ class PrinciplesController extends AppController { $this->set('principle', $this->Principle->read(null, $id)); $this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.principle_id' => $id))); $this->set('addresses', $this->Principle->PrincipleAddress->findAllByPrincipleId($id)); - $this->set('principleContacts', $this->Principle->PrincipleContact->findAllByPrincipleId($id)); + $this->set('principleContacts', $this->Principle->PrincipleContact->find('all', array('conditions'=>array('PrincipleContact.principle_id'=>$id)))); $statuses = $this->Principle->Enquiry->Status->find('all'); $status_list = array(); foreach ($statuses as $status) { diff --git a/controllers/users_controller.php b/controllers/users_controller.php index e9215cdd..9a197f0c 100755 --- a/controllers/users_controller.php +++ b/controllers/users_controller.php @@ -41,7 +41,7 @@ class UsersController extends AppController { if ($this->Auth->login($cookie)) { // Clear auth message, just in case we use it. - // $this->Session->setFlash(__('Welcome back '.$cookie['username']), true); + // $this->Session->setFlash(__('Welcome back '.$cookie['username']), true); $this->Session->del('Message.auth'); $this->redirect($this->Auth->redirect()); } else { // Delete invalid Cookie @@ -80,7 +80,7 @@ class UsersController extends AppController { $this->set('user', $user); switch($user['User']['type']) { - case 'contact': + case 'contact': $this->render('viewContact'); break; @@ -89,7 +89,7 @@ class UsersController extends AppController { $this->render('viewPrinciple'); break; - case 'user': + case 'user': $this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id))); @@ -118,8 +118,37 @@ class UsersController extends AppController { } - function add_contact() { + function add_user() { + + Configure::write('debug', 0); + $this->layout = 'ajax'; if (!empty($this->data)) { + $this->User->create(); + $this->User->set($this->data['User']); + if($this->User->validates()) { + if ($this->User->save($this->data)) { + $message = __('The User has been saved.', true); + $data = $this->data; + $this->set('success', compact('message', 'data')); + } + } + else { + $message = __('The User could not be saved. Please, try again.', true); + $User = $this->User->invalidFields(); + $data = compact('User'); + $this->set('errors', compact('message', 'data')); + } + + + } + else { + $this->redirect('/'); + } + } + + + + /*if (!empty($this->data)) { $this->User->create(); if ($this->User->save($this->data)) { $this->Session->setFlash(__('The User has been saved', true)); @@ -128,7 +157,7 @@ class UsersController extends AppController { $this->Session->setFlash(__('The User could not be saved. Please, try again.', true)); } } - } + }*/ @@ -163,7 +192,6 @@ class UsersController extends AppController { } if (empty($this->data)) { $this->data = $this->User->read(null, $id); - $this->set('groups', $this->User->Group->find('list')); } } diff --git a/models/customer.php b/models/customer.php index 4bf211a0..94f8fc81 100755 --- a/models/customer.php +++ b/models/customer.php @@ -47,7 +47,7 @@ class Customer extends AppModel { 'finderQuery' => '', 'counterQuery' => '' ), - 'Contact' => array('className' => 'Contact', //Change this back to Contact for user_import.php + 'Contact' => array('className' => 'User', 'foreignKey' => 'customer_id', 'dependent' => false, 'conditions' => '', diff --git a/models/email.php b/models/email.php index 63d898f7..dcbe0cfb 100755 --- a/models/email.php +++ b/models/email.php @@ -4,24 +4,29 @@ class Email extends AppModel { var $name = 'Email'; + var $recursive = 1; + + var $order = "Email.udate DESC"; + var $hasMany = array( 'EmailAttachment' => array('className' => 'EmailAttachment', 'foreignKey' => 'email_id', - 'dependent' => false), + 'dependent' => true, + 'counterCache'=>'email_attachment_count'), 'EmailRecipient' => array('className' => 'EmailRecipient', - 'foreignKey' => 'email_id', - 'dependent'=>true) + 'foreignKey' => 'email_id', + 'dependent'=>true) ); - - var $hasOne = array( - 'FromUser' => array('className' => 'User', - 'foreign_key'=>'from_user_id') + //Email 'From' this user. + var $belongsTo = array( + 'User' => array('className' => 'User', + 'foreign_key'=>'user_id') ); - - + + var $hasAndBelongsToMany = array ( 'Enquiry' => array('className' => 'Enquiry', @@ -33,8 +38,17 @@ class Email extends AppModel { 'PurchaseOrder' => array('className' => 'PurchaseOrder', 'joinTable' => 'emails_purchase_orders' + ), + 'Job' => array('className' => 'Job', + 'joinTable' => 'emails_jobs' ) ); + function getEnquiryEmails($id) { + + return $this->find('first', array('Enquiry.id'=>$id)); + } + + } ?> diff --git a/models/email_attachment.php b/models/email_attachment.php index 94793a0d..b0329957 100755 --- a/models/email_attachment.php +++ b/models/email_attachment.php @@ -1,16 +1,16 @@ array('className' => 'Email', - 'foreignKey' => 'email_id', - 'counterCache' => true, - 'conditions' => '', - 'fields' => '', - 'order' => '' - )); - - } + var $name = 'EmailAttachment'; + + var $belongsTo = array( + 'Email' => array('className' => 'Email', + 'foreignKey' => 'email_id', + 'counterCache' => true, + 'conditions' => '', + 'fields' => '', + 'order' => '' + )); + +} ?> diff --git a/models/email_recipient.php b/models/email_recipient.php index f42a36c1..4a30b9ea 100755 --- a/models/email_recipient.php +++ b/models/email_recipient.php @@ -3,13 +3,45 @@ class EmailRecipient extends AppModel { var $name = 'EmailRecipient'; - var $hasOne = array ( - 'User' => array('className' => 'User', - 'foreign_key' =>'user_id' ) - ); var $belongsTo = array( - 'Email' => array('className'=>'Email', 'foreign_key'=>'email_id') + 'Email' => array('className'=>'Email', 'foreign_key'=>'email_id'), + 'User' => array('className' => 'User', 'foreign_key' =>'user_id' + ) ); + + /** + * Given an Email ID, return a formatted array of the Users. + * + * $recipients['to']=> array(0=>array('first_name'=>'Bill Smith')) etc. + * $recipients['from']=> array(... + * + * @param $id + */ + function getRecipients($id) { + $recipients = $this->find('all', array( + 'fields' => array('EmailRecipient.id','EmailRecipient.user_id', 'EmailRecipient.type', 'User.id', 'User.first_name', 'User.last_name','User.email', 'User.principle_id','User.type', 'User.customer_id'), + 'conditions'=>array('Email.id'=>$id))); + + $recipientFormatted = array(); + foreach($recipients as $recipient) { + switch($recipient['EmailRecipient']['type']) { + case 'to': + $recipientFormatted['to'][] = $recipient['User']; + break; + + case 'cc': $recipientFormatted['cc'][] = $recipient['User']; + break; + + default: + + } + + } + + return $recipientFormatted; + } + + } -?> +?> \ No newline at end of file diff --git a/models/enquiry.php b/models/enquiry.php index c57646d1..1bd645d1 100755 --- a/models/enquiry.php +++ b/models/enquiry.php @@ -3,73 +3,71 @@ class Enquiry extends AppModel { var $name = 'Enquiry'; - //var $recursive = 2; - var $validate = array( - 'user_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'User ID must be selected', - 'on' => 'create' - ), - 'customer_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Customer for this Enquiry', - 'on' => 'create' - ), + 'user_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'User ID must be selected', + 'on' => 'create' + ), + 'customer_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Customer for this Enquiry', + 'on' => 'create' + ), - 'contact_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Contact for this Enquiry', - //'on' => 'create' - ), + 'contact_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Contact for this Enquiry', + //'on' => 'create' + ), - 'customer_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Customer for this Enquiry', - 'on' => 'create' - ), + 'customer_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Customer for this Enquiry', + 'on' => 'create' + ), - 'state_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a State for this Enquiry', - 'on' => 'create' - ), + 'state_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a State for this Enquiry', + 'on' => 'create' + ), - 'country_id' => array( - 'numeric' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Country for this Enquiry', - 'on' => 'create' - ), - 'checkStates' => array( - 'rule' => array('checkStates'), - 'message' => 'Australian Enquiries must be assigned to Australian States. Overseas Enquiries must be assigned to other Countries', - 'on' => 'create')), + 'country_id' => array( + 'numeric' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Country for this Enquiry', + 'on' => 'create' + ), + 'checkStates' => array( + 'rule' => array('checkStates'), + 'message' => 'Australian Enquiries must be assigned to Australian States. Overseas Enquiries must be assigned to other Countries', + 'on' => 'create')), - 'principle_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Principle for this Enquiry', - 'on' => 'create' - ), + 'principle_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Principle for this Enquiry', + 'on' => 'create' + ), - 'status_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Status for this Enquiry' - ), - 'gst' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must select whether GST is applicable for this Enquiry', - 'on' => 'create' - ) + 'status_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Status for this Enquiry' + ), + 'gst' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must select whether GST is applicable for this Enquiry', + 'on' => 'create' + ) ); /*Custom Validation Rule to Check that Enquiries with Australian States are assigned to Australia. @@ -79,118 +77,118 @@ class Enquiry extends AppModel { */ function checkStates($data) { - if($this->data['Enquiry']['country_id'] != 1) { //This Enquiry is not for Australia. State must be set to overseas. - if($this->data['Enquiry']['state_id'] != 9) { //The State isn't set to Overseas. Return false - return FALSE; - } - else { - return TRUE; - } - } - if($this->data['Enquiry']['country_id'] == 1) { //This enquiry is for Australia. State must be for an Australian State - if($this->data['Enquiry']['state_id'] == 9) { - return FALSE; - } - else { - return TRUE; - } - } + if($this->data['Enquiry']['country_id'] != 1) { //This Enquiry is not for Australia. State must be set to overseas. + if($this->data['Enquiry']['state_id'] != 9) { //The State isn't set to Overseas. Return false + return FALSE; + } + else { + return TRUE; + } + } + if($this->data['Enquiry']['country_id'] == 1) { //This enquiry is for Australia. State must be for an Australian State + if($this->data['Enquiry']['state_id'] == 9) { + return FALSE; + } + else { + return TRUE; + } + } } //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( - 'User' => array('className' => 'User', - 'foreignKey' => 'user_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Customer' => array('className' => 'Customer', - 'foreignKey' => 'customer_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - /* 'Contact' => array('className' => 'Contact', + 'User' => array('className' => 'User', + 'foreignKey' => 'user_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Customer' => array('className' => 'Customer', + 'foreignKey' => 'customer_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + /* 'Contact' => array('className' => 'Contact', 'foreignKey' => 'contact_id', 'conditions' => '', 'fields' => '', 'order' => '' ),*/ - 'Contact' => array('className' => 'User', - 'foreignKey' => 'contact_user_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), + 'Contact' => array('className' => 'User', + 'foreignKey' => 'contact_user_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), - 'State' => array('className' => 'State', - 'foreignKey' => 'state_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Country' => array('className' => 'Country', - 'foreignKey' => 'country_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Principle' => array('className' => 'Principle', - 'foreignKey' => 'principle_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Status' => array('className' => 'Status', - 'foreignKey' => 'status_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'BillingAddress' => array('className' => 'Address', - 'foreignKey' => 'billing_address_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'ShippingAddress' => array('className' => 'Address', - 'foreignKey' => 'shipping_address_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), + 'State' => array('className' => 'State', + 'foreignKey' => 'state_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Country' => array('className' => 'Country', + 'foreignKey' => 'country_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Principle' => array('className' => 'Principle', + 'foreignKey' => 'principle_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Status' => array('className' => 'Status', + 'foreignKey' => 'status_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'BillingAddress' => array('className' => 'Address', + 'foreignKey' => 'billing_address_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'ShippingAddress' => array('className' => 'Address', + 'foreignKey' => 'shipping_address_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), ); var $hasMany = array( - 'Quote' => array('className' => 'Quote', - 'foreignKey' => 'enquiry_id', - 'dependent' => false, - 'conditions' => '', - 'fields' => '', - 'order' => '', - 'limit' => '', - 'offset' => '', - 'exclusive' => '', - 'finderQuery' => '', - 'counterQuery' => '' - ), - - 'Invoice' => array('className' => 'Invoice', - 'foreignKey'=>'enquiry_id'), + 'Quote' => array('className' => 'Quote', + 'foreignKey' => 'enquiry_id', + 'dependent' => false, + 'conditions' => '', + 'fields' => '', + 'order' => '', + 'limit' => '', + 'offset' => '', + 'exclusive' => '', + 'finderQuery' => '', + 'counterQuery' => '' + ), - 'Job' => array('className' => 'Job', - 'foreignKey' =>'enquiry_id'), + 'Invoice' => array('className' => 'Invoice', + 'foreignKey'=>'enquiry_id'), + + 'Job' => array('className' => 'Job', + 'foreignKey' =>'enquiry_id'), - 'Document' => array('className'=>'Document', - 'foreignKey'=>'enquiry_id') + 'Document' => array('className'=>'Document', + 'foreignKey'=>'enquiry_id') - /* 'EnquiryFile' => array('className' => 'EnquiryFile', + /* 'EnquiryFile' => array('className' => 'EnquiryFile', 'foreignKey' => 'enquiry_id', 'dependent' => false ),*/ @@ -198,6 +196,16 @@ class Enquiry extends AppModel { ); - + + + var $hasAndBelongsToMany = array ( + 'Email' => array( + 'className' => 'Email', + 'joinTable' => 'emails_enquiries', + ) + ); + + + } ?> diff --git a/models/principle.php b/models/principle.php index da144117..9e0468e3 100755 --- a/models/principle.php +++ b/models/principle.php @@ -3,6 +3,8 @@ class Principle extends AppModel { var $name = 'Principle'; + var $recursive = 0; + //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Country' => array('className' => 'Country', @@ -48,7 +50,7 @@ class Principle extends AppModel { 'foreignKey' => 'principle_id' ), - 'PrincipleContact' => array('className' => 'PrincipleContact', + 'PrincipleContact' => array('className' => 'Users', 'foreignKey' => 'principle_id' ), ); diff --git a/models/user.php b/models/user.php index 815b7eeb..766aa436 100755 --- a/models/user.php +++ b/models/user.php @@ -6,6 +6,13 @@ class User extends AppModel { var $displayField = 'username'; + var $validate = array( + 'first_name' => array('notEmpty'), + 'last_name' => array('notEmpty'), + 'email' => array('email') + + ); + /* TO DO: Fix up this validation stuff var $validate = array( 'username' => array( @@ -32,21 +39,29 @@ class User extends AppModel { 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' + ), + 'Email' => array('className'=> 'Email', + 'foreignKey'=> 'user_id', ) ); var $belongsTo = array( - 'Principle' => array('className'=>'Principle', - 'foreignKey' =>'principle_id', + 'Principle' => array('className'=>'Principle', + 'foreignKey' =>'principle_id', ), - 'Customer' => array('className'=>'Customer', - 'foreignKey' =>'customer_id', + 'Customer' => array('className'=>'Customer', + 'foreignKey' =>'customer_id', ) ); + + function getPrincipleContacts($principleID) { + return $this->find('all', array('conditions'=>array('User.principle_id'=>$principleID))); + } + } ?> \ No newline at end of file diff --git a/vendors/shells/vault_two.php b/vendors/shells/vault_two.php index 3e7cd754..0bc95031 100755 --- a/vendors/shells/vault_two.php +++ b/vendors/shells/vault_two.php @@ -12,6 +12,7 @@ class VaultTwoShell extends Shell { var $uses = array('Enquiry', 'Contact', 'Invoice', 'PurchaseOrder', 'User', 'Email', 'EmailRecipient', 'Job'); + // var $email_dir = '/var/www/cakephp/app/emails'; function main() { @@ -22,17 +23,21 @@ class VaultTwoShell extends Shell { /* Setup Connection to the IMAP server */ $username = 'vault'; $password = 'xjdYOsmJWc37'; /* The password for the account to be checked */ - $email_dir = '/var/www/cakephp/app/emails'; - if($testing == 0) { + + if($testing == 1) { //$username = 'karl'; //$password = '72seng89'; - + $ripmime_path = '/opt/local/bin/ripmime'; $email_dir = '/Users/karlcordes/Sites/quotenik/app/emails'; - $mbox = imap_open("{mail.cmctechnologies.com.au:143}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); + //$mbox = imap_open("{mail.cmctechnologies.com.au:143}INBOX", $username, $password) or die("can't connect: " . imap_last_error() + //); + $mbox = imap_open("{192.168.0.8:143}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); } else { + $ripmime_path = '/usr/local/bin/ripmime'; + $email_dir = '/var/www/cakephp/app/emails'; $mbox = imap_open("{192.168.0.8:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); } @@ -43,16 +48,6 @@ class VaultTwoShell extends Shell { echo "Number of messages to Process ".$number_of_messages."\n"; - for($i=0;$i<20;$i++) { - - $uuid = String::uuid(); - $length = strlen($uuid); - - echo "{$uuid} is $length \n"; - - } - die(); - if($number_of_messages == 0) { exit(0); } @@ -84,6 +79,12 @@ class VaultTwoShell extends Shell { $userMap = $this->makeMap($users, 'User', 'email'); $jobMap = $this->makeMap($jobs, 'Job', 'title'); + + $store = array(); + $discard = array(); + + + /** * Loop through the messages. * @@ -99,18 +100,24 @@ class VaultTwoShell extends Shell { */ for($i=$number_of_messages; $i > 0; $i--) { if(!imap_ping($mbox)) { - echo "Connection to Mailserver dropped. Attempting to reconnect"; + echo "Connection to Mailserver dropped. Attempting to reconnect\n"; $mbox = imap_open("{mail.cmctechnologies.com.au:143}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); } $this_header = imap_headerinfo($mbox, $i); + + $this_uid = imap_uid($mbox, $i); + + + $unix_time = $this_header->udate; //Used for filing attachments into month-year folders. + //MM-YYYY used For lack of a better option really. + //$message = $this->getMessage($mbox, $i, $this_header); $recipients = $this->getRecipients($this_header, true); - // continue; //die(); $saveThis = false; //Set to true, if To,From,CC is a Known User. @@ -145,9 +152,11 @@ class VaultTwoShell extends Shell { $found_invoices = $this->checkValidIdentifier($sub->text, $invoiceMap, 'invoice'); $foundIdent = $this->foundIdentifier($found_invoices); + $found_pos = $this->checkValidIdentifier($sub->text, $poMap, 'purchaseorder'); $foundIdent = $this->foundIdentifier($found_pos); + $found_jobs = $this->checkValidIdentifier($sub->text, $jobMap, 'job'); $foundIdent = $this->foundIdentifier($found_jobs); @@ -174,15 +183,18 @@ class VaultTwoShell extends Shell { */ foreach($recipients as $type => $recipientArray) { foreach($recipientArray as $recEmail) { - if(isset($userMap[$recEmail])) { - $recipientsIDs[$type][] = $userMap[$recEmail]; //Existing User ID. + + $recEmailLC = strtolower($recEmail); + + if(isset($userMap[$recEmailLC])) { + $recipientsIDs[$type][] = $userMap[$recEmailLC]; //Existing User ID. } else { //$recipientsIDs[$type][] = "NEW User: $recEmail"; //Need to make a new user ID. - echo "Making a new User for: '{$recEmail}'\n"; + echo "Making a new User for: '{$recEmailLC}'\n"; $newUser['User'] = array( 'type' => 'contact', - 'email' => $recEmail, + 'email' => $recEmailLC, 'by_vault' => 1 ); @@ -193,10 +205,10 @@ class VaultTwoShell extends Shell { $recipientsIDs[$type][] = $newID; //Add it to the userMap - $userMap[$recEmail] = $newID; + $userMap[$recEmailLC] = $newID; } else { - echo "Fatal Error: Unable to create user for email '{$recEmail}'\n"; + echo "Fatal Error: Unable to create user for email '{$recEmailLC}'\n"; die(); } @@ -209,30 +221,10 @@ class VaultTwoShell extends Shell { - echo "--------------------------\n"; + echo "---------START MESSAGE -----------------\n"; echo "Email No: $i\n"; echo "Subject: ".$subjDecoded[0]->text."\n"; - if(count($found_jobs) > 0) { - echo "Found Job IDs: \n"; - print_r($found_jobs); - } - - - if(count($found_pos) > 0) { - echo "Found PO IDs: \n"; - print_r($found_pos); - } - - if(count($found_enquiries) > 0) { - echo "Found enquiry IDs: \n"; - print_r($found_enquiries); - } - - if(count($found_invoices) > 0) { - echo "Found Invoice IDs: \n"; - print_r($found_invoices); - } @@ -240,60 +232,169 @@ class VaultTwoShell extends Shell { $structure = imap_fetchstructure($mbox, $i); - print_r($recipients); - print_r($recipientsIDs); - + //print_r($recipients); + //print_r($recipientsIDs); //print_r($structure); - // continue; - $attachments = $this->extract_attachments($mbox,$structure, $i); - foreach($attachments as $attachment) { - if(isset($attachment['is_attachment'])) { - $name = false; - $result = false; - if(!empty($attachment['filename'])) { - echo "\tfilename: ".$attachment['filename']."\n"; - $name = $attachment['filename']; - } - if(!empty($attachment['name'])) { - echo "\tname: ".$attachment['name']."\n"; - $name = $attachment['name']; - } - if($name != false) { - echo "\t".$email_dir."/".$name."\n"; + /** Testing creating the Email, Recipient and Attachments */ + $newEmail['Email'] = array(); - /*$result = file_put_contents($email_dir."/".$name, $attachment['attachment']); - if($result === false) { - echo "Failed to write $name\n"; - } - else { - $kb_result = $result / 1024; - echo "Wrote $result kilobytes for $name\n"; - }*/ - } - else { - continue; + + if(isset($recipientsIDs['from'][0])) { + $newEmail['Email']['user_id'] = $recipientsIDs['from'][0]; //We should never have more than one 'from' user ID. + } + else { + die("Email has no from Recipient!! Critical Failure"); //Change this to logging for deployment. + } + + +// $newEmail['Email']['date'] = $this_header->date; + $newEmail['Email']['udate'] = $this_header->udate; + $newEmail['Email']['subject'] = $subjDecoded[0]->text; //Hacky. Will probably fix this quickly. + + $recipientCount = 0; + foreach($recipientsIDs as $type => $typeEmails) { + foreach($typeEmails as $userID) { + + $newEmail['EmailRecipient'][$recipientCount]['user_id'] = $userID; + switch($type) { + case 'to': + $newEmail['EmailRecipient'][$recipientCount]['type'] = 'to'; + $recipientCount++; + break; + + case 'cc': + $newEmail['EmailRecipient'][$recipientCount]['type'] = 'cc'; + $recipientCount++; + break; + default: } } } - echo "--------\n"; + + /** End Email creation **/ + + + /** Start Attachments **/ + + $relative_path = $this->getAttachmentDirectory($email_dir, $unix_time); + $attachments = $this->fetchBodyAttachments($mbox, $i, $email_dir, $relative_path, $ripmime_path); + + $attachmentCount = 0; + + $biggestHTML = 0; + + foreach($attachments as $attachment) { + $newEmail['EmailAttachment'][$attachmentCount]['name'] = $attachment['name']; + $newEmail['EmailAttachment'][$attachmentCount]['type'] = $attachment['type']; + $newEmail['EmailAttachment'][$attachmentCount]['size'] = $attachment['size']; + $newEmail['EmailAttachment'][$attachmentCount]['filename'] = $attachment['filename']; + $newEmail['EmailAttachment'][$attachmentCount]['is_message_body'] = $attachment['is_message_body']; + + $attachmentCount++; + } + + /** End attachments */ + + + /* If we found Identifiers for this Email. Create the HABTM associations. + * + */ + if(count($found_jobs) > 0) { + // echo "Found Job IDs: \n"; + // print_r($found_jobs); + + foreach($found_jobs as $jobID) { + $newEmail['Job'][] = array('job_id'=> $jobID); + } + + } + + + if(count($found_pos) > 0) { + // echo "Found PO IDs: \n"; + // print_r($found_pos); + foreach($found_pos as $poID) { + $newEmail['PurchaseOrder'][] = array('purchase_order_id'=> $poID); + } + } + + if(count($found_enquiries) > 0) { + // echo "Found enquiry IDs: \n"; + // print_r($found_enquiries); + foreach($found_enquiries as $enqID) { + $newEmail['Enquiry'][] = array('enquiry_id'=> $enqID); + } + } + + if(count($found_invoices) > 0) { + // echo "Found Invoice IDs: \n"; + // print_r($found_invoices); + foreach($found_invoices as $invID) { + $newEmail['Invoice'][] = array('invoice_id'=> $invID); + } + } + + + print_r($newEmail); + + $this->Email->create(); + $emailID = $this->Email->saveAll($newEmail); + if(!empty($emailID)) { + echo "Success. We made an email. Storing Email UID $this_uid\n"; + } + else { + + echo "Error! Didn't save the email\n"; + } + $store[] = $this_uid; + + + echo "--------END MESSAGE ------\n"; } else { + $discard[] = $this_uid; echo "email {$i} will not be saved. Subject: ".$subjDecoded[0]->text."\n"; } // print_r($recipients); // echo "----------------------\n"; + } + + reset($discard); + reset($store); + + $numberToStore = count($store); + $numberToDiscard= count($discard); + + + if($numberToStore > 0) { + echo "Got $numberToStore messages to store\n"; + $storeSet = implode(",", $store); + imap_mail_move($mbox, $storeSet, 'INBOX/Stored', 1); + } + + if($numberToDiscard > 0) { + echo "Going to discard $numberToDiscard messages\n"; + $discardSet = implode(",",$discard); + + imap_mail_move($mbox, $discardSet, 'INBOX/Discarded', 1); + } + + + imap_expunge($mbox); imap_close($mbox); } + + /** * Make a 'HashMap' (array) in the format. * $newMap[$key] = $obj[$modelName]['id']; @@ -380,7 +481,7 @@ class VaultTwoShell extends Shell { return true; } else { - return false; + return; } } @@ -445,68 +546,145 @@ class VaultTwoShell extends Shell { } - /** - * Adapted from - * http://www.electrictoolbox.com/function-extract-email-attachments-php-imap/ - * @param $connection - * @param $message_number - * @return - */ - function extract_attachments($connection, $structure, $message_number) { - $attachments = array(); - if(isset($structure->parts)) { - $numberOfParts = count($structure->parts); - } - if(isset($structure->parts) && $numberOfParts) { + /* + * Fetches the body and attachments from a MIME encoded email. Uses ripmime to do the decoding + * + */ - for($i = 0; $i < $numberOfParts; $i++) { + function fetchBodyAttachments($mailbox, $msg_number, $email_dir, $relative_path, $ripmime_path) { - $attachments[$i] = array( - 'is_attachment' => false, - 'filename' => '', - 'name' => '', - 'attachment' => '' - ); + $uuid = String::uuid(); + $email_file = $email_dir.'/'.$uuid.'.eml'; + imap_savebody($mailbox, $email_file, $msg_number); + $command = "$ripmime_path -i $email_file -d $email_dir/$relative_path --prefix --paranoid -v --verbose-contenttype"; - if($structure->parts[$i]->ifdparameters) { - foreach($structure->parts[$i]->dparameters as $object) { - if(strtolower($object->attribute) == 'filename') { - $attachments[$i]['is_attachment'] = true; - $attachments[$i]['filename'] = $object->value; - } - } + $output = array(); + exec($command, $output, $status); + + /* Check the $output array and find the filenames of the attachments */ + + if($status == 0) { + $attachments = array(); + + $biggestHTML_num = 999; //Determine the likely HTML body of this email. Guessing, but hopefully reasonably correctly. + $biggestHTML_size = 0; + $biggestPlain_num = 999; //I dont think we'll get legit emails with >999 attachments. + $biggestPlain_size =0; + + for($i=0, $j=0; $i< count($output); $i++, $j++) { + $words = explode(' ', $output[$i]); + $type = explode('=', $words[1]); + $name = explode('=', $words[2]); + + if(count($type) < 1) { + continue; } - if($structure->parts[$i]->ifparameters) { - foreach($structure->parts[$i]->parameters as $object) { - if(strtolower($object->attribute) == 'name') { - $attachments[$i]['is_attachment'] = true; - $attachments[$i]['name'] = $object->value; - } + $oldNamePath = $email_dir.'/'.$relative_path.'/'.$name[1]; + $newNamePath = $email_dir.'/'.$relative_path.'/'.$uuid.'-'.$name[1]; + $newName = $relative_path.'/'.$uuid.'-'.$name[1]; + rename($oldNamePath, $newNamePath); + $size = filesize($newNamePath); + $attachments[$j]['type'] = $type[1]; + + + $attachments[$j]['name'] = $newName; + $attachments[$j]['filename'] = $name[1]; + $attachments[$j]['size'] = $size; + $attachments[$j]['is_message_body'] = 0; + echo "in message number $msg_number: found attachment ".$attachments[$j]['name'].' '.$attachments[$j]['type']."\n"; + + + /** Record the array ID and size of the largest HTML & plain attachments **/ + if($attachments[$j]['type'] == 'text/html') { + if($size > $biggestHTML_size) { + $biggestHTML_num = $j; + $biggestHTML_size = $size; } } - - if($attachments[$i]['is_attachment']) { - $attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1); - if($structure->parts[$i]->encoding == 3) { // 3 = BASE64 - $attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']); - } - elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE - $attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']); + else if($attachments[$j]['type'] == 'text/plain') { + if($size > $biggestPlain_size) { + $biggestPlain_num = $j; + $biggestPlain_size = $size; } } - + } + if($biggestHTML_num != 999) { //We found an HTML attachment. + $attachments[$biggestHTML_num]['is_message_body'] = 1; + } + else if($biggestPlain_num != 999) { + $attachments[$biggestPlain_num]['is_message_body'] = 1; } + unlink($email_file); + return $attachments; } + else { + unlink($email_file); + return 1; + } + } - return $attachments; + + /** + * Passed the configured $email_dir and the unix time of this message. + * + * 1. Checks to see if the /emails/MM-YYYY/ directory exists. + * 2a. If not, creates it and returns the full path to this directory. + * 2b. If exists, returns the path to this directory. + * + * @param $email_dir + * @param $unix_time + */ + function getAttachmentDirectory($email_dir, $unix_time) { + + $month_year = date('m-Y', $unix_time); + $path = $email_dir."/".$month_year; + + if(!file_exists($path)) { //Directory doesn't exist Lets make it! + if(mkdir($path)) { + return $month_year; + } + else { + die("Unable to make directory $email_dir/$month_year"); + } + } + else { + return $month_year; + } } + /** + * The attachments have been decoded and written to disk by ripmime. + * + * 1. Generate a uuid for this email + * 2. Is there a month-year folder this this current month? If not, make one. + * 3. Move the attachments to the correct month-year Folder. Prefix their new names with uuid. + * 4. + * + * @param $attachments + */ + function moveAttachments($attachments, $email_dir, $unix_time) { + + $month_year = date('m-Y'); + + + $uuid = String::uuid(); + + + + + foreach($attachments as $attachment) { + echo $email_dir.'/'.$attachment['name']."\n"; + } + die(); + + } + } diff --git a/views/contacts/add.ctp b/views/contacts/add.ctp deleted file mode 100755 index 4c5e8161..00000000 --- a/views/contacts/add.ctp +++ /dev/null @@ -1,30 +0,0 @@ -
-create('Contact');?> -
- - input('customer_id'); - echo $form->input('first_name'); - echo $form->input('last_name'); - echo $form->input('email'); - echo $form->input('phone'); - echo $form->input('phone_extension'); - echo $form->input('direct_phone'); - echo $form->input('mobile'); - echo $form->input('fax'); - echo $form->input('contact_category_id'); - echo $form->input('job_title'); - echo $form->input('notes'); - ?> -
-end('Submit');?> -
-
-
    -
  • link(__('List Contacts', true), array('action'=>'index'));?>
  • -
  • link(__('List Customers', true), array('controller'=> 'customers', 'action'=>'index')); ?>
  • -
  • link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • -
-
diff --git a/views/contacts/add_another.ctp b/views/contacts/add_another.ctp deleted file mode 100755 index 8a203036..00000000 --- a/views/contacts/add_another.ctp +++ /dev/null @@ -1,22 +0,0 @@ - - link('Remove this', array('controller' => 'contacts', 'action' => 'remove_another', $increment), array('update' => 'contacts'.$increment)); - - ?> - input("Contact.$increment.first_name"); - echo $form->input("Contact.$increment.last_name"); - echo $form->input("Contact.$increment.email"); - echo $form->input("Contact.$increment.phone"); - echo $form->input("Contact.$increment.phone_extension"); - echo $form->input("Contact.$increment.direct_phone"); - echo $form->input("Contact.$increment.mobile"); - echo $form->input("Contact.$increment.fax"); - echo $form->input("Contact.$increment.contact_category_id", array('options' => $contact_categories, 'label' => 'Contact Department')); - echo $form->input("Contact.$increment.notes"); - - $next = $increment; - $next++; - echo $ajax->link('Add another Contact to this New Customer', array('controller' => 'contacts', 'action' => 'add_another',$next), array('update'=>'contacts'.$next)); - ?> -
diff --git a/views/contacts/add_one.ctp b/views/contacts/add_one.ctp deleted file mode 100755 index e1b368a7..00000000 --- a/views/contacts/add_one.ctp +++ /dev/null @@ -1,21 +0,0 @@ - - - link('Remove this', array('controller' => 'contacts', 'action' => 'remove_one', $customerid), array('update' => 'contact')); - - ?> - input("Contact.new", array('type'=>'hidden', 'value' => 'yes')); - echo $form->input("Contact.first_name"); - echo $form->input("Contact.last_name"); - echo $form->input("Contact.email"); - echo $form->input("Contact.phone"); - echo $form->input('Contact.phone_extension'); - echo $form->input('Contact.direct_phone'); - echo $form->input("Contact.mobile"); - echo $form->input("Contact.fax"); - echo $form->input("Contact.contact_category_id", array('options' => $contact_categories, 'label' => 'Contact Department')); - echo $form->input("Contact.job_title"); - echo $form->input("Contact.notes"); - echo $form->input("Contact.customer_id", array('type'=>'hidden', 'value' => $customerid)); - ?> diff --git a/views/contacts/add_to_customer.ctp b/views/contacts/add_to_customer.ctp deleted file mode 100755 index 79716bdc..00000000 --- a/views/contacts/add_to_customer.ctp +++ /dev/null @@ -1,31 +0,0 @@ -
-create('Contact', array('action'=>'add_to_customer/customerid:'.$customer['Customer']['id']));?> -
- - hidden('customer_id', array('value' => $customer['Customer']['id'])); - echo $form->input('first_name', array('label' => 'First Name', 'title'=>'The first name of this Contact')); - echo $form->input('last_name', array('label' => 'Last Name', 'title'=>'The last name of this Contact')); - echo $form->input('email'); - echo $form->input('phone', array('label' => 'Phone Number', 'title'=>'Phone Number')); - echo $form->input('phone_extension', array('label' => 'Phone Extension', 'title'=>'If the Contact is on an extension enter it here. No Need enter EXT or similar - numbers only')); - echo $form->input('direct_phone', array('label' => 'Direct Phone', 'title'=>'Direct Phone number for this Contact')); - echo $form->input('mobile'); - echo $form->input('fax'); - echo $form->input('contact_category_id', array('label'=>'Contact Department', 'empty' => 'Please Choose a Department')); - echo $form->input('job_title'); - echo $form->input('notes'); - -?> -
-end('Submit');?> -
-
-
    -
  • link(__('List Contacts', true), array('action'=>'index'));?>
  • -
  • link(__('List Customers', true), array('controller'=> 'customers', 'action'=>'index')); ?>
  • -
  • link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • -
-
diff --git a/views/contacts/edit.ctp b/views/contacts/edit.ctp deleted file mode 100755 index ce396ca2..00000000 --- a/views/contacts/edit.ctp +++ /dev/null @@ -1,32 +0,0 @@ -
-create('Contact');?> -
- - input('customer_id', array('type'=>'hidden')); - echo $form->input('id'); - echo $form->input('first_name'); - echo $form->input('last_name'); - echo $form->input('email'); - echo $form->input('phone'); - echo $form->input('phone_extension'); - echo $form->input('direct_phone'); - echo $form->input('mobile'); - echo $form->input('fax'); - echo $form->input('contact_category_id', array('label' => 'Department', 'empty' => 'Please Choose a Department')); - echo $form->input('job_title'); - echo $form->input('notes'); - ?> -
-end('Submit');?> -
-
-
    -
  • link(__('Delete', true), array('action'=>'delete', $form->value('Contact.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Contact.id'))); ?>
  • -
  • link(__('List Contacts', true), array('action'=>'index'));?>
  • -
  • link(__('List Customers', true), array('controller'=> 'customers', 'action'=>'index')); ?>
  • -
  • link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • -
-
diff --git a/views/contacts/index.ctp b/views/contacts/index.ctp deleted file mode 100755 index d10195aa..00000000 --- a/views/contacts/index.ctp +++ /dev/null @@ -1,74 +0,0 @@ -
-

-

-counter(array( -'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) -)); -?>

- - - - - - - - - - - - - > - - - - - - - - - - - - -
sort('customer_id');?>sort('first_name');?>sort('last_name');?>sort('email');?>sort('phone');?>sort('fax');?>sort('notes');?>
- link($contact['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $contact['Customer']['id'])); ?> - - - - - - link($contact['Contact']['email'], 'mailto:'.$contact['Contact']['email']); ?> - - - - - - - - link(__('View', true), array('action'=>'view', $contact['Contact']['id'])); ?> - link(__('Edit', true), array('action'=>'edit', $contact['Contact']['id'])); ?> - -
-
-
- prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> - | numbers();?> - next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> -
-
-
    -
  • link(__('New Contact', true), array('action'=>'add')); ?>
  • -
  • link(__('List Customers', true), array('controller'=> 'customers', 'action'=>'index')); ?>
  • -
  • link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • -
-
diff --git a/views/contacts/remove_another.ctp b/views/contacts/remove_another.ctp deleted file mode 100755 index 8ca2ff6f..00000000 --- a/views/contacts/remove_another.ctp +++ /dev/null @@ -1,8 +0,0 @@ -link('Add A Contact to this New Customer', array('controller' => 'contacts', 'action' => 'add_another',0), array('update'=>'contacts0')); - echo $html->image('contact-new.png'); -} -?> - diff --git a/views/contacts/remove_one.ctp b/views/contacts/remove_one.ctp deleted file mode 100755 index cd3d1e05..00000000 --- a/views/contacts/remove_one.ctp +++ /dev/null @@ -1,6 +0,0 @@ -input('contact_id', array('options' => $contacts, 'div' => false)); -echo '
'; -echo $ajax->link('New Contact', array('controller' => 'contacts', 'action' => 'add_one', $customerid), array('update'=>'contact')); -echo $html->image('contact-new.png'); -?> diff --git a/views/contacts/view.ctp b/views/contacts/view.ctp deleted file mode 100755 index eb2e187a..00000000 --- a/views/contacts/view.ctp +++ /dev/null @@ -1,87 +0,0 @@ -
-

image('system-users.png'); ?>

-
- > - > - link($contact['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $contact['Customer']['id'])); ?> -   - - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - - > - > - -   - - - > - > - -   - - - > - > - -   - -
-
-
-
    -
  • link(__('Edit Contact', true), array('action'=>'edit', $contact['Contact']['id'])); ?>
  • -
  • link(__('New Contact', true), array('action'=>'add')); ?>
  • -
  • link(__('List Customers', true), array('controller'=> 'customers', 'action'=>'index')); ?>
  • -
-
- diff --git a/views/customers/view.ctp b/views/customers/view.ctp index 90fb46fc..a9d44581 100755 --- a/views/customers/view.ctp +++ b/views/customers/view.ctp @@ -1,176 +1,199 @@ + +
-

-
- > - > - -   - +

+
+ > + > + +   + - > - > - -   - + > + > + +   + - > - > - link($this->element('abn', array('abn'=>$customer['Customer']['abn'])), 'http://www.abr.business.gov.au/abnDetails.aspx?ABN='.$customer['Customer']['abn'], - array('target'=>'_blank')); ?> -   - - > - > - nice($customer['Customer']['created']); ?> -   - - - > - > - link($customer['Country']['name'], array('controller'=>'countries', 'action'=>'view', $customer['Country']['id'])); ?> -   - - - > - > - -   - - > - > - -   - + > + > + link($this->element('abn', array('abn'=>$customer['Customer']['abn'])), 'http://www.abr.business.gov.au/abnDetails.aspx?ABN='.$customer['Customer']['abn'], + array('target'=>'_blank')); ?> +   + + > + > + nice($customer['Customer']['created']); ?> +   + - > - > - -   - + > + > + link($customer['Country']['name'], array('controller'=>'countries', 'action'=>'view', $customer['Country']['id'])); ?> +   + + + > + > + +   + + > + > + +   + + + > + > + +   + - > - > - link($customer['Customer']['url'], $customer['Customer']['url'], array('target'=>'_blank'));; ?> -   - + > + > + link($customer['Customer']['url'], $customer['Customer']['url'], array('target'=>'_blank'));; ?> +   + - > - > - -   - - -
+ > + > + +   + + +
-
    -
  • link(__('Edit Customer', true), array('action'=>'edit', $customer['Customer']['id'])); ?>
  • - -
+
    +
  • link(__('Edit Customer', true), array('action'=>'edit', $customer['Customer']['id'])); ?>
  • + +
- - - - - - - + + + + +link('add_user'); ?> +
+ + create('User');?> + + input('first_name'); + echo $form->input('last_name'); + echo $form->input('email'); + echo $form->input('job_title'); + echo $form->input('phone'); + echo $form->input('mobile'); + echo $form->input('fax'); + echo $form->input('phone_extension'); + echo $form->input('direct_phone'); + echo $form->input('notes'); + echo $form->input('type', array('type'=>'hidden', 'value'=>'contact')); + echo $form->input('customer_id', array('type'=>'hidden', 'value'=>$customer['Customer']['id'])); + echo $form->submit('Add Contact', array('id'=>'submitUserButton')); + ?> + + + +
+ + + + + + diff --git a/views/elements/email_attachments.ctp b/views/elements/email_attachments.ctp index 181d7d56..e7cb68f6 100755 --- a/views/elements/email_attachments.ctp +++ b/views/elements/email_attachments.ctp @@ -1,57 +1,73 @@ diff --git a/views/elements/email_table_ajax.ctp b/views/elements/email_table_ajax.ctp index 5608493c..2ab28446 100755 --- a/views/elements/email_table_ajax.ctp +++ b/views/elements/email_table_ajax.ctp @@ -7,12 +7,8 @@ - - - - > - - + - - - - - - -
image('attach.png'); ?>
0) { - echo $html->image('attach.png'); - } - ?> + link($email['User']['first_name'].' '.$email['User']['last_name'], array('controller'=>'users','action'=>'view', $email['User']['id'])); + } + else { + echo $html->link($email['User']['email'], array('controller'=>'users','action'=>'view', $email['User']['id'])); - - highlight($html->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id'])), 'Quotation'); + } + ?> + highlight($html->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id'])), 'Quotation'); echo $text->highlight($html->link($email['Email']['subject'], '#', array('class'=>'viewLink', 'id'=>$email['Email']['id'])), 'Quotation'); ?>
@@ -56,4 +48,7 @@
-
\ No newline at end of file + + + + \ No newline at end of file diff --git a/views/elements/enquiry_table.ctp b/views/elements/enquiry_table.ctp index 8e79f3e0..0645f9a8 100755 --- a/views/elements/enquiry_table.ctp +++ b/views/elements/enquiry_table.ctp @@ -249,4 +249,4 @@ ENDJS; next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> - \ No newline at end of file + \ No newline at end of file diff --git a/views/email_attachments/view.ctp b/views/email_attachments/view.ctp new file mode 100644 index 00000000..f1eca315 --- /dev/null +++ b/views/email_attachments/view.ctp @@ -0,0 +1 @@ + diff --git a/views/emails/frame.ctp b/views/emails/frame.ctp index e5124660..a24a7fff 100755 --- a/views/emails/frame.ctp +++ b/views/emails/frame.ctp @@ -1,10 +1,94 @@ +link('email_frame'); ?> + +
+
-
- +
+
+ link($email['User']['first_name'].' '.$email['User']['last_name'], + array('controller'=>'users', 'action'=>'view', $email['User']['id'])); ?> +   + link($email['User']['email'], array('controller'=>'users','action'=>'view',$email['User']['id'])); ?> +
+ + + + +
To
+ 1) { + $class="additionalDD"; + } + else { + $class= ""; + } + ?> +
+ link($recipient['first_name'].' '.$recipient['last_name'], + array('controller'=>'users', 'action'=>'view', $recipient['id'])); + } ?> + + link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?> +
+ + + + + +
cc
+ 1) { + $class="additionalDD"; + } + else { + $class= ""; + } + ?> +
+ link($recipient['first_name'].' '.$recipient['last_name'], + array('controller'=>'users', 'action'=>'view', $recipient['id'])); + } ?> + link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?> +
+ + + +
+
+ + +   +
+
+
+ +   +
+
+
+ + +
+
-element('email_attachments', $attachments); ?> + element('email_attachments', array('attachments' => $email['EmailAttachment'])); ?>
+ + + \ No newline at end of file diff --git a/views/emails/index.ctp b/views/emails/index.ctp index bae91cd7..d96c71a3 100755 --- a/views/emails/index.ctp +++ b/views/emails/index.ctp @@ -8,18 +8,14 @@ echo $paginator->counter(array( ?>

- - - - - - - - - - + + + + + + > + + + - - - - - - - - @@ -71,12 +49,3 @@ foreach ($emails as $email): | numbers();?> next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> -
-
    -
  • link(__('New Email', true), array('action'=>'add')); ?>
  • -
  • link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?>
  • -
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • -
  • link(__('List Email Attachments', true), array('controller'=> 'email_attachments', 'action'=>'index')); ?>
  • -
  • link(__('New Email Attachment', true), array('controller'=> 'email_attachments', 'action'=>'add')); ?>
  • -
-
diff --git a/views/emails/view.ctp b/views/emails/view.ctp index be954fba..e950bd43 100755 --- a/views/emails/view.ctp +++ b/views/emails/view.ctp @@ -1,80 +1,134 @@
-

- - -
- > - > - link($email['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $email['Enquiry']['id'])); ?> -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > -
+

+ +
+ + + > + > + link($email['User']['first_name'].' '.$email['User']['last_name'], + array('controller'=>'users', 'action'=>'view', $email['User']['id'])); ?> +   + link($email['User']['email'], array('controller'=>'users','action'=>'view',$email['User']['id'])); ?> +
+ + + + + >To + > + link($recipient['first_name'].' '.$recipient['last_name'], + array('controller'=>'users', 'action'=>'view', $recipient['id'])); ?> +   + link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?> + + + + + + + + >cc + > + link($recipient['first_name'].' '.$recipient['last_name'], + array('controller'=>'users', 'action'=>'view', $recipient['id'])); ?> +   + link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?> + + + + + > + > + + +   + + > + > + +   + + +   - - -
+ * + */?> + + +
+ + + +
sort('enquiry_id');?>sort('id');?>sort('to');?>sort('from');?>sort('cc');?>sort('created');?>sort('date');?>sort('subject');?>sort('content-type');?>sort('Date');?>sort('From');?>sort('Subject');?>
+ + - link($email['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $email['Enquiry']['id'])); ?> - - - - - - - - - - - - + link($email['User']['email'], array('controller'=>'users','action'=>'view', $email['User']['id'])); ?> - - link(__('View', true), array('action'=>'view', $email['Email']['id'])); ?> - link(__('Edit', true), array('action'=>'edit', $email['Email']['id'])); ?> link(__('Delete', true), array('action'=>'delete', $email['Email']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $email['Email']['id'])); ?>
+

Attachments

+ +
- - - - - + + + + + - - > - - - - - - - - - -
toReadableSize($emailAttachment['size']);?> - link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id'])); ?> -
- + > + + + + toReadableSize($emailAttachment['size']);?> + + + + View'; + } + else { + echo ''; + //echo $html->link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id'])); + } ?> + + + + + + + + + + + +'; +debug($email); +?> \ No newline at end of file diff --git a/views/enquiries/view.ctp b/views/enquiries/view.ctp index 18886270..bf5fcdc5 100755 --- a/views/enquiries/view.ctp +++ b/views/enquiries/view.ctp @@ -303,11 +303,12 @@ $class = ' class="altrow"';?> - \ No newline at end of file + \ No newline at end of file diff --git a/views/layouts/default.ctp b/views/layouts/default.ctp index 04c000e1..22b14f4e 100755 --- a/views/layouts/default.ctp +++ b/views/layouts/default.ctp @@ -190,7 +190,7 @@ ?> - + diff --git a/views/principles/view.ctp b/views/principles/view.ctp index 7378cdc9..bcef08d7 100755 --- a/views/principles/view.ctp +++ b/views/principles/view.ctp @@ -45,14 +45,10 @@ @@ -120,3 +116,29 @@ + +link('add_user'); ?> +
+ + create('User');?> + + input('first_name'); + echo $form->input('last_name'); + echo $form->input('email'); + echo $form->input('job_title'); + echo $form->input('phone'); + echo $form->input('mobile'); + echo $form->input('fax'); + echo $form->input('phone_extension'); + echo $form->input('direct_phone'); + echo $form->input('notes'); + echo $form->input('type', array('type'=>'hidden', 'value'=>'principle')); + echo $form->input('principle_id', array('type'=>'hidden', 'value'=>$principle['Principle']['id'])); + echo $form->submit('Add Principle Contact', array('id'=>'submitUserButton')); + ?> + + + +
+ \ No newline at end of file diff --git a/views/users/add_user.ctp b/views/users/add_user.ctp new file mode 100644 index 00000000..1f8be5a1 --- /dev/null +++ b/views/users/add_user.ctp @@ -0,0 +1,29 @@ +validationErrors) { + $output = Set::insert($output, 'errors', array('message' => $errors['message'])); + $errorMessages = array( + 'Post' => array( + 'title' => array( + 'required' => __("This field cannot be left blank.", true), + 'maxlength' => sprintf(__("Maximum length of %d characters.", true), 30) + ), + 'body' => array( + 'required' => __("This field cannot be left blank.", true), + 'maxlength' => sprintf(__("Maximum length of %d characters.", true), 200) + ) + ) + ); + foreach ($errors['data'] as $model => $errs) { + foreach ($errs as $field => $message) { + $output['errors']['data'][$model][$field] = $errorMessages[$model][$field][$message]; + } + } + } elseif ($success) { + $output = Set::insert($output, 'success', array( + 'message' => $success['message'], + 'data' => $success['data'] + )); + } + echo $javascript->object($output); +?> diff --git a/views/users/view_contact.ctp b/views/users/view_contact.ctp index 6fb5e198..ae8724d9 100644 --- a/views/users/view_contact.ctp +++ b/views/users/view_contact.ctp @@ -62,4 +62,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 00000000..5b5dab2a Binary files /dev/null and b/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/webroot/css/images/ui-bg_flat_55_fbec88_40x100.png b/webroot/css/images/ui-bg_flat_55_fbec88_40x100.png new file mode 100755 index 00000000..47acaadd Binary files /dev/null and b/webroot/css/images/ui-bg_flat_55_fbec88_40x100.png differ diff --git a/webroot/css/images/ui-bg_glass_75_d0e5f5_1x400.png b/webroot/css/images/ui-bg_glass_75_d0e5f5_1x400.png new file mode 100755 index 00000000..9fb564f8 Binary files /dev/null and b/webroot/css/images/ui-bg_glass_75_d0e5f5_1x400.png differ diff --git a/webroot/css/images/ui-bg_glass_85_dfeffc_1x400.png b/webroot/css/images/ui-bg_glass_85_dfeffc_1x400.png new file mode 100755 index 00000000..01495152 Binary files /dev/null and b/webroot/css/images/ui-bg_glass_85_dfeffc_1x400.png differ diff --git a/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png b/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100755 index 00000000..4443fdc1 Binary files /dev/null and b/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/webroot/css/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png b/webroot/css/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png new file mode 100755 index 00000000..81ecc362 Binary files /dev/null and b/webroot/css/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png differ diff --git a/webroot/css/images/ui-bg_inset-hard_100_f5f8f9_1x100.png b/webroot/css/images/ui-bg_inset-hard_100_f5f8f9_1x100.png new file mode 100755 index 00000000..4f3faf8a Binary files /dev/null and b/webroot/css/images/ui-bg_inset-hard_100_f5f8f9_1x100.png differ diff --git a/webroot/css/images/ui-bg_inset-hard_100_fcfdfd_1x100.png b/webroot/css/images/ui-bg_inset-hard_100_fcfdfd_1x100.png new file mode 100755 index 00000000..38c38335 Binary files /dev/null and b/webroot/css/images/ui-bg_inset-hard_100_fcfdfd_1x100.png differ diff --git a/webroot/css/images/ui-icons_217bc0_256x240.png b/webroot/css/images/ui-icons_217bc0_256x240.png new file mode 100755 index 00000000..6f4bd87c Binary files /dev/null and b/webroot/css/images/ui-icons_217bc0_256x240.png differ diff --git a/webroot/css/images/ui-icons_2e83ff_256x240.png b/webroot/css/images/ui-icons_2e83ff_256x240.png index 45e8928e..09d1cdc8 100755 Binary files a/webroot/css/images/ui-icons_2e83ff_256x240.png and b/webroot/css/images/ui-icons_2e83ff_256x240.png differ diff --git a/webroot/css/images/ui-icons_469bdd_256x240.png b/webroot/css/images/ui-icons_469bdd_256x240.png new file mode 100755 index 00000000..bd2cf079 Binary files /dev/null and b/webroot/css/images/ui-icons_469bdd_256x240.png differ diff --git a/webroot/css/images/ui-icons_6da8d5_256x240.png b/webroot/css/images/ui-icons_6da8d5_256x240.png new file mode 100755 index 00000000..9f3eafaa Binary files /dev/null and b/webroot/css/images/ui-icons_6da8d5_256x240.png differ diff --git a/webroot/css/images/ui-icons_cd0a0a_256x240.png b/webroot/css/images/ui-icons_cd0a0a_256x240.png new file mode 100755 index 00000000..2ab019b7 Binary files /dev/null and b/webroot/css/images/ui-icons_cd0a0a_256x240.png differ diff --git a/webroot/css/images/ui-icons_d8e7f3_256x240.png b/webroot/css/images/ui-icons_d8e7f3_256x240.png new file mode 100755 index 00000000..ad2dc6f9 Binary files /dev/null and b/webroot/css/images/ui-icons_d8e7f3_256x240.png differ diff --git a/webroot/css/images/ui-icons_f9bd01_256x240.png b/webroot/css/images/ui-icons_f9bd01_256x240.png new file mode 100755 index 00000000..78625024 Binary files /dev/null and b/webroot/css/images/ui-icons_f9bd01_256x240.png differ diff --git a/webroot/css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png b/webroot/css/imagesOld/ui-bg_diagonals-thick_90_eeeeee_40x40.png similarity index 100% rename from webroot/css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png rename to webroot/css/imagesOld/ui-bg_diagonals-thick_90_eeeeee_40x40.png diff --git a/webroot/css/imagesOld/ui-bg_flat_0_aaaaaa_40x100.png b/webroot/css/imagesOld/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 00000000..5b5dab2a Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/webroot/css/images/ui-bg_flat_15_cd0a0a_40x100.png b/webroot/css/imagesOld/ui-bg_flat_15_cd0a0a_40x100.png similarity index 100% rename from webroot/css/images/ui-bg_flat_15_cd0a0a_40x100.png rename to webroot/css/imagesOld/ui-bg_flat_15_cd0a0a_40x100.png diff --git a/webroot/css/imagesOld/ui-bg_flat_55_fbec88_40x100.png b/webroot/css/imagesOld/ui-bg_flat_55_fbec88_40x100.png new file mode 100755 index 00000000..47acaadd Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_flat_55_fbec88_40x100.png differ diff --git a/webroot/css/images/ui-bg_glass_100_e4f1fb_1x400.png b/webroot/css/imagesOld/ui-bg_glass_100_e4f1fb_1x400.png similarity index 100% rename from webroot/css/images/ui-bg_glass_100_e4f1fb_1x400.png rename to webroot/css/imagesOld/ui-bg_glass_100_e4f1fb_1x400.png diff --git a/webroot/css/images/ui-bg_glass_50_3baae3_1x400.png b/webroot/css/imagesOld/ui-bg_glass_50_3baae3_1x400.png similarity index 100% rename from webroot/css/images/ui-bg_glass_50_3baae3_1x400.png rename to webroot/css/imagesOld/ui-bg_glass_50_3baae3_1x400.png diff --git a/webroot/css/imagesOld/ui-bg_glass_75_d0e5f5_1x400.png b/webroot/css/imagesOld/ui-bg_glass_75_d0e5f5_1x400.png new file mode 100755 index 00000000..9fb564f8 Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_glass_75_d0e5f5_1x400.png differ diff --git a/webroot/css/images/ui-bg_glass_80_d7ebf9_1x400.png b/webroot/css/imagesOld/ui-bg_glass_80_d7ebf9_1x400.png similarity index 100% rename from webroot/css/images/ui-bg_glass_80_d7ebf9_1x400.png rename to webroot/css/imagesOld/ui-bg_glass_80_d7ebf9_1x400.png diff --git a/webroot/css/imagesOld/ui-bg_glass_85_dfeffc_1x400.png b/webroot/css/imagesOld/ui-bg_glass_85_dfeffc_1x400.png new file mode 100755 index 00000000..01495152 Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_glass_85_dfeffc_1x400.png differ diff --git a/webroot/css/imagesOld/ui-bg_glass_95_fef1ec_1x400.png b/webroot/css/imagesOld/ui-bg_glass_95_fef1ec_1x400.png new file mode 100755 index 00000000..4443fdc1 Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/webroot/css/imagesOld/ui-bg_gloss-wave_55_5c9ccc_500x100.png b/webroot/css/imagesOld/ui-bg_gloss-wave_55_5c9ccc_500x100.png new file mode 100755 index 00000000..81ecc362 Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_gloss-wave_55_5c9ccc_500x100.png differ diff --git a/webroot/css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png b/webroot/css/imagesOld/ui-bg_highlight-hard_100_f2f5f7_1x100.png similarity index 100% rename from webroot/css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png rename to webroot/css/imagesOld/ui-bg_highlight-hard_100_f2f5f7_1x100.png diff --git a/webroot/css/images/ui-bg_highlight-hard_70_000000_1x100.png b/webroot/css/imagesOld/ui-bg_highlight-hard_70_000000_1x100.png similarity index 100% rename from webroot/css/images/ui-bg_highlight-hard_70_000000_1x100.png rename to webroot/css/imagesOld/ui-bg_highlight-hard_70_000000_1x100.png diff --git a/webroot/css/images/ui-bg_highlight-soft_100_deedf7_1x100.png b/webroot/css/imagesOld/ui-bg_highlight-soft_100_deedf7_1x100.png similarity index 100% rename from webroot/css/images/ui-bg_highlight-soft_100_deedf7_1x100.png rename to webroot/css/imagesOld/ui-bg_highlight-soft_100_deedf7_1x100.png diff --git a/webroot/css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png b/webroot/css/imagesOld/ui-bg_highlight-soft_25_ffef8f_1x100.png similarity index 100% rename from webroot/css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png rename to webroot/css/imagesOld/ui-bg_highlight-soft_25_ffef8f_1x100.png diff --git a/webroot/css/imagesOld/ui-bg_inset-hard_100_f5f8f9_1x100.png b/webroot/css/imagesOld/ui-bg_inset-hard_100_f5f8f9_1x100.png new file mode 100755 index 00000000..4f3faf8a Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_inset-hard_100_f5f8f9_1x100.png differ diff --git a/webroot/css/imagesOld/ui-bg_inset-hard_100_fcfdfd_1x100.png b/webroot/css/imagesOld/ui-bg_inset-hard_100_fcfdfd_1x100.png new file mode 100755 index 00000000..38c38335 Binary files /dev/null and b/webroot/css/imagesOld/ui-bg_inset-hard_100_fcfdfd_1x100.png differ diff --git a/webroot/css/imagesOld/ui-icons_217bc0_256x240.png b/webroot/css/imagesOld/ui-icons_217bc0_256x240.png new file mode 100755 index 00000000..6f4bd87c Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_217bc0_256x240.png differ diff --git a/webroot/css/images/ui-icons_2694e8_256x240.png b/webroot/css/imagesOld/ui-icons_2694e8_256x240.png similarity index 100% rename from webroot/css/images/ui-icons_2694e8_256x240.png rename to webroot/css/imagesOld/ui-icons_2694e8_256x240.png diff --git a/webroot/css/imagesOld/ui-icons_2e83ff_256x240.png b/webroot/css/imagesOld/ui-icons_2e83ff_256x240.png new file mode 100755 index 00000000..45e8928e Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_2e83ff_256x240.png differ diff --git a/webroot/css/images/ui-icons_3d80b3_256x240.png b/webroot/css/imagesOld/ui-icons_3d80b3_256x240.png similarity index 100% rename from webroot/css/images/ui-icons_3d80b3_256x240.png rename to webroot/css/imagesOld/ui-icons_3d80b3_256x240.png diff --git a/webroot/css/imagesOld/ui-icons_469bdd_256x240.png b/webroot/css/imagesOld/ui-icons_469bdd_256x240.png new file mode 100755 index 00000000..bd2cf079 Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_469bdd_256x240.png differ diff --git a/webroot/css/imagesOld/ui-icons_6da8d5_256x240.png b/webroot/css/imagesOld/ui-icons_6da8d5_256x240.png new file mode 100755 index 00000000..9f3eafaa Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_6da8d5_256x240.png differ diff --git a/webroot/css/images/ui-icons_72a7cf_256x240.png b/webroot/css/imagesOld/ui-icons_72a7cf_256x240.png similarity index 100% rename from webroot/css/images/ui-icons_72a7cf_256x240.png rename to webroot/css/imagesOld/ui-icons_72a7cf_256x240.png diff --git a/webroot/css/imagesOld/ui-icons_cd0a0a_256x240.png b/webroot/css/imagesOld/ui-icons_cd0a0a_256x240.png new file mode 100755 index 00000000..2ab019b7 Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_cd0a0a_256x240.png differ diff --git a/webroot/css/imagesOld/ui-icons_d8e7f3_256x240.png b/webroot/css/imagesOld/ui-icons_d8e7f3_256x240.png new file mode 100755 index 00000000..ad2dc6f9 Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_d8e7f3_256x240.png differ diff --git a/webroot/css/imagesOld/ui-icons_f9bd01_256x240.png b/webroot/css/imagesOld/ui-icons_f9bd01_256x240.png new file mode 100755 index 00000000..78625024 Binary files /dev/null and b/webroot/css/imagesOld/ui-icons_f9bd01_256x240.png differ diff --git a/webroot/css/images/ui-icons_ffffff_256x240.png b/webroot/css/imagesOld/ui-icons_ffffff_256x240.png similarity index 100% rename from webroot/css/images/ui-icons_ffffff_256x240.png rename to webroot/css/imagesOld/ui-icons_ffffff_256x240.png diff --git a/webroot/css/jquery-ui.custom-old.css b/webroot/css/jquery-ui.custom-old.css new file mode 100755 index 00000000..6a112ae4 --- /dev/null +++ b/webroot/css/jquery-ui.custom-old.css @@ -0,0 +1,477 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* +* jQuery UI CSS Framework +* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=04_highlight_hard.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=02_glass.png&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=02_glass.png&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=01_flat.png&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=04_highlight_hard.png&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #dddddd; background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } +.ui-widget-content a { color: #362b36; } +.ui-widget-header { border: 1px solid #aed0ea; background: #deedf7 url(images/ui-bg_highlight-soft_100_deedf7_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #aed0ea; background: #d7ebf9 url(images/ui-bg_glass_80_d7ebf9_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2779aa; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2779aa; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #74b2e2; background: #e4f1fb url(images/ui-bg_glass_100_e4f1fb_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #0070a3; } +.ui-state-hover a, .ui-state-hover a:hover { color: #0070a3; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #2694e8; background: #3baae3 url(images/ui-bg_glass_50_3baae3_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #f9dd34; background: #ffef8f url(images/ui-bg_highlight-soft_25_ffef8f_1x100.png) 50% top repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #cd0a0a url(images/ui-bg_flat_15_cd0a0a_40x100.png) 50% 50% repeat-x; color: #ffffff; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_3d80b3_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_2694e8_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } +.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } + +/* Overlays */ +.ui-widget-overlay { background: #eeeeee url(images/ui-bg_diagonals-thick_90_eeeeee_40x40.png) 50% 50% repeat; opacity: .80;filter:Alpha(Opacity=80); } +.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #000000 url(images/ui-bg_highlight-hard_70_000000_1x100.png) 50% top repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete +----------------------------------*/ +.ui-autocomplete-menu { position: absolute; cursor: default; } + +.ui-autocomplete-loading { background: white url('images/ui-anim.basic.16x16.gif') right center no-repeat; } +.ui-autocomplete-over { background-color: #0A246A; color: white; } + +/* Menu +----------------------------------*/ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + margin: -1px; +} +/* Button +----------------------------------*/ + +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3em; } +button.ui-button-icons-only { width: 3.2em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 1.8em; } +.ui-button-text-icons .ui-button-text { padding-right: 1.8em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon .ui-icon-primary, .ui-button-text-icons .ui-icon-primary, .ui-button-icons-only .ui-icon-primary { left: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-button-set { margin-right: 7px; } +.ui-button-set .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ + + + + + +/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* Dialog +----------------------------------*/ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs +----------------------------------*/ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } diff --git a/webroot/css/jquery-ui.custom.css b/webroot/css/jquery-ui.custom.css index 6a112ae4..996472b7 100755 --- a/webroot/css/jquery-ui.custom.css +++ b/webroot/css/jquery-ui.custom.css @@ -1,13 +1,17 @@ /* -* jQuery UI CSS Framework -* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) -* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. -*/ + * jQuery UI CSS Framework 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .ui-helper-clearfix { display: inline-block; } @@ -38,56 +42,61 @@ /* -* jQuery UI CSS Framework -* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) -* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. -* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=04_highlight_hard.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=02_glass.png&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=02_glass.png&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=01_flat.png&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=04_highlight_hard.png&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px -*/ + * jQuery UI CSS Framework 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ /* Component containers ----------------------------------*/ -.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 0.8em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #dddddd; background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } -.ui-widget-content a { color: #362b36; } -.ui-widget-header { border: 1px solid #aed0ea; background: #deedf7 url(images/ui-bg_highlight-soft_100_deedf7_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } -.ui-widget-header a { color: #222222; } +.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } +.ui-widget-header a { color: #ffffff; } /* Interaction states ----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #aed0ea; background: #d7ebf9 url(images/ui-bg_glass_80_d7ebf9_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2779aa; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2779aa; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #74b2e2; background: #e4f1fb url(images/ui-bg_glass_100_e4f1fb_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #0070a3; } -.ui-state-hover a, .ui-state-hover a:hover { color: #0070a3; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #2694e8; background: #3baae3 url(images/ui-bg_glass_50_3baae3_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; } +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; } +.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; } .ui-widget :active { outline: none; } /* Interaction Cues ----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #f9dd34; background: #ffef8f url(images/ui-bg_highlight-soft_25_ffef8f_1x100.png) 50% top repeat-x; color: #363636; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } -.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #cd0a0a url(images/ui-bg_flat_15_cd0a0a_40x100.png) 50% 50% repeat-x; color: #ffffff; } -.ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } /* Icons ----------------------------------*/ /* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_72a7cf_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } -.ui-state-default .ui-icon { background-image: url(images/ui-icons_3d80b3_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_2694e8_256x240.png); } -.ui-state-active .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); } .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } /* positioning */ .ui-icon-carat-1-n { background-position: 0 0; } @@ -271,20 +280,58 @@ ----------------------------------*/ /* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } -.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } +.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; } +.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; } +.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; } +.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; } +.ui-corner-right { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; } +.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; } +.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } /* Overlays */ -.ui-widget-overlay { background: #eeeeee url(images/ui-bg_diagonals-thick_90_eeeeee_40x40.png) 50% 50% repeat; opacity: .80;filter:Alpha(Opacity=80); } -.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #000000 url(images/ui-bg_highlight-hard_70_000000_1x100.png) 50% top repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Accordion -----------------------------------*/ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } .ui-accordion .ui-accordion-li-fix { display: inline; } .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } @@ -292,20 +339,36 @@ .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete -----------------------------------*/ -.ui-autocomplete-menu { position: absolute; cursor: default; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } -.ui-autocomplete-loading { background: white url('images/ui-anim.basic.16x16.gif') right center no-repeat; } -.ui-autocomplete-over { background-color: #0A246A; color: white; } +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ -/* Menu -----------------------------------*/ +/* + * jQuery UI Menu 1.8.10 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; + float: left; } .ui-menu .ui-menu { margin-top: -3px; @@ -313,6 +376,9 @@ .ui-menu .ui-menu-item { margin:0; padding: 0; + zoom: 1; + float: left; + clear: left; width: 100%; } .ui-menu .ui-menu-item a { @@ -320,49 +386,123 @@ display:block; padding:.2em .4em; line-height:1.5; + zoom:1; } .ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; margin: -1px; } -/* Button -----------------------------------*/ - +/* + * jQuery UI Button 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3em; } -button.ui-button-icons-only { width: 3.2em; } +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } /*button text element */ .ui-button .ui-button-text { display: block; line-height: 1.4; } .ui-button-text-only .ui-button-text { padding: .4em 1em; } .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 1.8em; } -.ui-button-text-icons .ui-button-text { padding-right: 1.8em; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; } /*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon .ui-icon-primary, .ui-button-text-icons .ui-icon-primary, .ui-button-icons-only .ui-icon-primary { left: .5em; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } /*button sets*/ -.ui-button-set { margin-right: 7px; } -.ui-button-set .ui-button { margin-left: 0; margin-right: -.3em; } +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } - - - -/* Datepicker -----------------------------------*/ -.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } @@ -420,58 +560,14 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad left: -4px; /*must have*/ width: 200px; /*must have*/ height: 200px; /*must have*/ -}/* Dialog -----------------------------------*/ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* Progressbar -----------------------------------*/ +}/* + * jQuery UI Progressbar 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ .ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable -----------------------------------*/ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider -----------------------------------*/ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs -----------------------------------*/ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 1a9db522..6a26940c 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -140,7 +140,7 @@ ul.principle-emails { #header{ /* background: #E9E9E9 url(../img/top-gradient2.png) repeat-x bottom; */ - /* background: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */ + /* background: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */ background: #4686c3; /* background: #6BBA70; */ padding-bottom: 2%; @@ -210,13 +210,13 @@ ul.principle-emails { #nav li a { display:block; width: 90px; - /*width: 6em;*/ + /*width: 6em;*/ padding:8px 5px 0 5px; height:23px; text-decoration:none; color:#fff; text-align:center; - + } #nav li a:hover { @@ -240,12 +240,12 @@ ul.principle-emails { #nav ul li { float:left; - - border-top:1px solid #000; - border-left:1px solid #000; - border-right:1px solid #000; - - /* border: 1px solid #000;*/ + + border-top:1px solid #000; + border-left:1px solid #000; + border-right:1px solid #000; + + /* border: 1px solid #000;*/ } /* used in the nav. so the borders are clean and 1px without doubling up */ @@ -300,7 +300,7 @@ a#mailheaders { font-size: 80%; clear: both; display: block; - + } @@ -322,11 +322,11 @@ a#mailheaders { clear: both; display: block; - + } #emailattachments { - + } dl#showemail { @@ -344,7 +344,7 @@ dl#showemail { } div.pageview { - + overflow: scroll; border: black 2px solid; width: 21cm; @@ -411,9 +411,9 @@ table tr td { padding: 1px; } table tr.altrow td { - /* background: #f4f4f4; - background-color: #98cbfe;*/ - background: #d1f0ff; + /* background: #f4f4f4; + background-color: #98cbfe;*/ + background: #d1f0ff; } table tr.customer-suspect td { @@ -635,14 +635,7 @@ div.paging span a { dl { line-height: 2em; margin: 0em 0em; - -} -dl.mailheaders { - line-height: 2em; - margin: 0em 0em; - width: 100%; - color: #000000; } dl.altrow { @@ -657,14 +650,29 @@ dt { dt.altrow { background: #E6F0F0; } -dd.mailheaders { - margin-top: -2em; - vertical-align: top; + +#emailHeaders { + font-size: 80%; } -dd.mailheaders-altrow { - margin-top: -2em; - vertical-align: top; - background: #E6F0F0; + +#emailHeaders dl { + line-height: 1em; + float: left; +} + +#emailHeaders dd { + clear: right; + margin-left: 5em; + margin-top: -1em; + margin-bottom: 0.5em; +} + +#emailHeaders dd.additionalDD { + margin-top: 0.5em; +} + +#emailHeaders dt { + } dd { @@ -682,7 +690,6 @@ form { clear: left; margin-right: 20px; padding: 0; - width: 40%; } @@ -698,7 +705,6 @@ fieldset { padding: 16px 20px; } fieldset legend { - background:#fff; color: #e32; font-size: 160%; font-weight: bold; @@ -1054,8 +1060,8 @@ div.tipbox { li.selected { background-color: #ffb; } span { - - + + } span.note { @@ -1248,4 +1254,9 @@ span.addLineItem { .tinytext { font-size: 60%; -} \ No newline at end of file +} +/* style the iframe for viewing HTML email */ +#viewHTMLbody { + width: 60%; + height: 30em; +} diff --git a/webroot/js/add_user.js b/webroot/js/add_user.js new file mode 100644 index 00000000..c1e4205c --- /dev/null +++ b/webroot/js/add_user.js @@ -0,0 +1,109 @@ +/** + * JS for adding a Contact to a company. + * + * 1. open a new model window on the add form. + * + * 2. When the submit button is clicked, check it for errors + * + * 3. If it passes the first validation, submit it to PHP controller via AJAX. + * + * 4a. If PHP reports sucessful save + * i. close the Modal Window + * ii. add the new contacts user details to the contact table. + * + * 4b. If PHP reports validation error. Display error. Set error class to the fields that failed. + * + */ + +$(function() { + + + //Style the Button + $( "#addUser" ).button({ + text: true, + icons: { + primary: "ui-icon-plus" + } + + }) + + //The diaglog box for Adding a contact. + $("#addUserDiv").dialog({ + autoOpen: false, + width: 450, + modal: true, + title: 'Add a Contact' + }); + + $("#addUser").click(function() { + $("#addUserDiv").dialog('open'); + return false; + }); + + + var _loadingDiv = $("#ajaxLoading"); + + $('#UserAddForm, #UserEditForm').submit(function(){ + _loadingDiv.show(); + $.post('/users/add_user', + $(this).serializeArray(), + afterValidate, + "json" + ); + return false; + }); + + + + // Post-submit callback + function afterValidate(data, status) { + $(".message").remove(); + $(".error-message").remove(); + + if (data.errors) { + onError(data.errors); + } else if (data.success) { + onSuccess(data.success); + } + } + + function onSuccess(data) { + flashMessage(data.message); + _loadingDiv.hide(); + window.setTimeout(function() { + // window.location.href = '/posts'; + window.location.reload(true); + }, 2000); + }; + + function onError(data) { + flashMessage(data.message); + $.each(data.data, function(model, errors) { + for (fieldName in this) { + var element = $("#" + camelize(model + '_' + fieldName)); + var _insert = $(document.createElement('div')).insertAfter(element); + _insert.addClass('error-message').text(this[fieldName]) + } + _loadingDiv.hide(); + }); + }; + + function flashMessage(message) { + var _insert = $(document.createElement('div')).css('display', 'none'); + _insert.attr('id', 'flashMessage').addClass('message').text(message); + _insert.insertAfter($("#UserAddForm")).fadeIn(); + } + + function camelize(string) { + var a = string.split('_'), i; + s = []; + for (i=0; i