Ejemplo n.º 1
0
 /**
  * Ajax tab action
  *
  * @return mixed
  */
 public function ajaxtabAction()
 {
     //This is the same Hack as in the $this->homeAction,
     //The MarcFormatter is using a ServiceManager in a static
     // function in an XSLT-Template
     //This call injects the ServiceManager indirectly
     $this->getServiceLocator()->get("MarcFormatter");
     return parent::ajaxtabAction();
 }
Ejemplo n.º 2
0
 /**
  * Display a particular tab.
  *
  * @param string $tab  Name of tab to display
  * @param bool   $ajax Are we in AJAX mode?
  *
  * @return mixed
  */
 protected function showTab($tab, $ajax = false)
 {
     // Special case -- handle lightbox login request if login has already been
     // done
     if ($this->params()->fromQuery('layout', 'false') == 'lightbox' && $this->params()->fromQuery('catalogLogin', 'false') == 'true' && is_array($patron = $this->catalogLogin())) {
         $response = $this->getResponse();
         $response->setStatusCode(205);
         return $response;
     }
     return parent::showTab($tab, $ajax);
 }
Ejemplo n.º 3
0
 /**
  * Load the record requested by the user; note that this is not done in the
  * init() method since we don't want to perform an expensive search twice
  * when homeAction() forwards to another method.
  *
  * @return AbstractRecordDriver
  */
 protected function loadRecord()
 {
     $id = $this->params()->fromRoute('id', $this->params()->fromQuery('id'));
     // 0 = preview record
     if ($id != '0') {
         return parent::loadRecord();
     }
     $data = $this->params()->fromPost('data', $this->params()->fromQuery('data', ''));
     $format = $this->params()->fromPost('format', $this->params()->fromQuery('format', ''));
     $source = $this->params()->fromPost('source', $this->params()->fromQuery('source', ''));
     if (!$data) {
         // Support marc parameter for Voyager compatibility
         $format = 'marc';
         if (!$source) {
             $source = '_marc_preview';
         }
         $data = $this->params()->fromPost('marc', $this->params()->fromQuery('marc'));
         // For some strange reason recent Voyager versions double-encode the data
         // with encodeURIComponent
         if (substr($data, -3) == '%1D') {
             $data = urldecode($data);
         }
         // Voyager doesn't tell the proper encoding, so it's up to the browser to
         // decide. Try to handle both UTF-8 and ISO-8859-1.
         $len = substr($data, 0, 5);
         if (strlen($data) != $len) {
             $data = utf8_decode($data);
         }
     }
     if (!$data || !$format || !$source) {
         throw new \Exception('Missing parameters');
     }
     return $this->loadPreviewRecord($data, $format, $source);
 }