diff --git a/.htaccess b/.htaccess index ecf0a26..099c905 100755 --- a/.htaccess +++ b/.htaccess @@ -1,10 +1,8 @@ - - RewriteEngine on - # SEO redirect - RewriteBase / - RewriteCond %{HTTP_HOST} ^www.boxmeupapp.com$ [NC] - RewriteRule ^(.*)$ http://boxmeupapp.com/$1 [R=301,L] +RewriteEngine on +# SEO redirect +RewriteBase / +RewriteCond %{HTTP_HOST} ^www.boxmeupapp.com$ [NC] +RewriteRule ^(.*)$ http://boxmeupapp.com/$1 [R=301,L] - RewriteRule ^$ app/webroot/ [L] - RewriteRule (.*) app/webroot/$1 [L] - +RewriteRule ^$ app/webroot/ [L] +RewriteRule (.*) app/webroot/$1 [L] diff --git a/app/.htaccess b/app/.htaccess index e0ab93e..577e1a8 100755 --- a/app/.htaccess +++ b/app/.htaccess @@ -1,8 +1,6 @@ php_value newrelic.appname "Boxmeup" - - RewriteEngine on - RewriteBase /app/ - RewriteRule ^$ webroot/ [L] - RewriteRule (.*) webroot/$1 [L] - +RewriteEngine on +RewriteBase /app/ +RewriteRule ^$ webroot/ [L] +RewriteRule (.*) webroot/$1 [L] diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php index 5fe8a43..4a43a36 100755 --- a/app/Config/bootstrap.php +++ b/app/Config/bootstrap.php @@ -47,7 +47,7 @@ // Configure::write('Site.theme', 'default'); // Mobile themes -Configure::write('Site.mobile_theme', Configure::read('Env.Site.mobile_theme') ?: 'mobile'); +Configure::write('Site.mobile_theme', Configure::read('Env.Site.mobile_theme') ?: 'Mobile'); Configure::write('Site.jquery_mobile_theme', Configure::read('Env.Site.jquery_mobile_theme') ?: 'b'); // Analytics diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index ee2e63a..904d847 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -125,9 +125,7 @@ protected function checkSsl() { protected function setupMobile() { if($this->isMobile()) { - $this->theme = Configure::read('Site.mobile_theme') ? - Configure::read('Site.mobile_theme') : - 'mobile'; + $this->theme = Configure::read('Site.mobile_theme'); $this->layout = $this->RequestHandler->isAjax() && $this->isMobileDialog ? 'dialog' : 'mobile'; $this->autoLayout = true; $this->autoRender = true; diff --git a/app/Controller/ContainersController.php b/app/Controller/ContainersController.php index 7882469..05e4ae3 100644 --- a/app/Controller/ContainersController.php +++ b/app/Controller/ContainersController.php @@ -8,6 +8,8 @@ class ContainersController extends AppController { public $_secure = true; + public $uses = ['Container', 'Location']; + public function beforeFilter() { parent::beforeFilter(); $this->set('active', 'containers.index'); @@ -17,7 +19,7 @@ public function dashboard() { $this->helpers[] = 'Time'; $total_containers = $this->Container->getTotalContainersPerUser($this->Auth->user('id')); $total_container_items = $this->Container->getTotalContainerItemsPerUser($this->Auth->user('id')); - $total_locations = ClassRegistry::init('Location')->getTotalLocationsPerUser($this->Auth->user('id')); + $total_locations = $this->Location->getTotalLocationsPerUser($this->Auth->user('id')); // Recent items $recent_items = $this->Container->ContainerItem->getRecentItems($this->Auth->user('id')); @@ -40,14 +42,14 @@ public function index() { $this->Session->setFlash('Start by creating a container.', 'notification/notice'); $this->redirect(array('action' => 'add')); } - + // Check the cookie and render the view depending on what was selected - $location_list = ClassRegistry::init('Location')->getLocationList($this->Auth->user('id'), true); + $location_list = $this->Location->getLocationList($this->Auth->user('id'), true); array_unshift($location_list, array('__UNASSIGNED__' => '-- Unassigned --')); $this->set(compact('containers', 'control', 'location_list')); $this->request->data['Location']['uuid'] = !empty($this->request->params['named']['location']) ? $this->request->params['named']['location'] : null; } - + public function change_view($view) { $this->Session->write('Feature.change_view', $view == 'list' ? 'list' : 'grid'); $this->redirect($this->referer()); @@ -71,20 +73,27 @@ public function view($slug=null) { } public function add() { - $this->set('title_for_layout', __('Add New Container')); + $location_list = $this->Location->getLocationList($this->Auth->user('id'), true); + $this->set(array( + 'title_for_layout' => __('Add New Container'), + 'location_list' => $location_list + )); if(!empty($this->request->data)) { $this->request->data['Container']['user_id'] = $this->Auth->user('id'); - $results = $this->Container->save($this->request->data); + if (!empty($this->request->data['Container']['location_id'])) { + $this->request->data['Container']['location_id'] = $this->Location->getIdByUUID($this->request->data['Container']['location_id']); + } + $this->Container->set($this->request->data); + $results = $this->Container->save(); if($results) { $this->Session->setFlash('Successfully added new container', 'notification/success'); - $page = (int) ceil($this->Container->getTotalContainersPerUser($this->Auth->user('id')) / $this->Container->pagination_limit); $this->redirect(array('controller' => 'containers', 'action' => 'view', $results['Container']['slug'])); } else { $this->Session->setFlash('There was a problem saving your container.', 'notification/error'); } } } - + public function ajax_add($container_item_id) { $this->helpers[] = 'Time'; $item = $this->Container->ContainerItem->find('first', array( @@ -112,7 +121,7 @@ public function edit($container_uuid='') { $this->Session->setFlash(__('Unable to update the container.'), 'notification/error'); } } else { - $location_list = ClassRegistry::init('Location')->getLocationList($this->Auth->user('id')); + $location_list = $this->Location->getLocationList($this->Auth->user('id')); $this->request->data = $this->Container->find('first', array( 'conditions' => array('uuid' => $container_uuid), 'contain' => array() @@ -147,7 +156,7 @@ public function print_label($container_uuid) { 'contain' => array() ))); } - + public function export($container_uuid) { $this->helpers[] = 'Csv'; $this->layout = false; @@ -164,7 +173,7 @@ public function export($container_uuid) { )); $this->set(compact('data')); } - + public function bulk_print() { if(!empty($this->request->data)) { $this->helpers[] = 'GChart.QR'; diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php index 834c8ee..4a9d423 100644 --- a/app/Controller/UsersController.php +++ b/app/Controller/UsersController.php @@ -108,6 +108,7 @@ public function account() { if(empty($this->request->data['User']['password'])) { unset($this->request->data['User']['password']); } + $this->Cookie->write('language', $this->request->data['User']['locale'], false, '1 week'); if($this->User->save($this->request->data)) { $this->Session->setFlash(__('Successfully updated account settings.'), 'notification/success'); $this->redirect(array('action' => 'account')); @@ -117,6 +118,7 @@ public function account() { } else { $this->request->data['User']['email'] = $this->User->field('email', array('id' => $this->Auth->user('id'))); } + $this->request->data['User']['locale'] = $this->Cookie->read('language'); $api_key = ClassRegistry::init('Api.ApiUser')->getApiKey($this->Auth->user('id')); $secret_key = ClassRegistry::init('Api.ApiUser')->getSecretKey($api_key); $this->set(compact('api_key', 'secret_key')); diff --git a/app/View/Containers/add.ctp b/app/View/Containers/add.ctp index 6fc11bb..f69e27a 100755 --- a/app/View/Containers/add.ctp +++ b/app/View/Containers/add.ctp @@ -6,6 +6,14 @@
Form->input('name', array('label' => false, 'class' => 'focus form-control')); ?> +
+ +
+ +
+ Form->input('location_id', array('label' => false, 'options' => $location_list, 'empty' => '-- Unassigned --', 'class' => 'form-control')); + ?>
diff --git a/app/View/Elements/app/account.ctp b/app/View/Elements/app/account.ctp index c86328a..5c1ffee 100755 --- a/app/View/Elements/app/account.ctp +++ b/app/View/Elements/app/account.ctp @@ -14,9 +14,6 @@ Form->create('Language', array('id' => 'change-language', 'url' => array('controller' => 'users', 'action' => 'change_language'), 'class' => 'navbar-form navbar-right')); - echo $this->Form->input('locale', array('id' => 'change-language-locale', 'label' => false, 'div' => false, 'class' => 'form-control', 'options' => $availableLanguages, 'empty' => __('Choose Language'))); - echo $this->Form->end(); echo $this->Form->create('Search', array('url' => array('controller' => 'searches', 'action' => 'find'), 'autocomplete' => 'off', 'class' => 'navbar-form pull-right')); echo $this->Form->input('query', array('label' => false, 'type' => 'text', 'div' => false, 'autocomplete' => 'off', 'class' => 'form-control', 'placeholder' => __('Search'))); echo $this->Form->end(); diff --git a/app/View/Elements/app/navigation.ctp b/app/View/Elements/app/navigation.ctp index 41ff607..18d29a1 100755 --- a/app/View/Elements/app/navigation.ctp +++ b/app/View/Elements/app/navigation.ctp @@ -54,5 +54,11 @@ + +
  • + +
  • diff --git a/app/View/Elements/nav.ctp b/app/View/Elements/nav.ctp index 52ec984..fcf0b54 100755 --- a/app/View/Elements/nav.ctp +++ b/app/View/Elements/nav.ctp @@ -20,10 +20,7 @@ Form->create('Language', array('id' => 'change-language', 'url' => array('controller' => 'users', 'action' => 'change_language'), 'class' => 'navbar-form navbar-right')); - echo $this->Form->input('locale', array('id' => 'change-language-locale', 'label' => false, 'div' => false, 'class' => 'form-control', 'options' => $availableLanguages, 'empty' => __('Choose Language'), 'style' => 'width: 200px;')); - echo $this->Form->end(); ?> -