Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_media
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * HTML View class for the Media component
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_media
  17.  * @since       1.0
  18.  */
  19. {
  20.     public function display($tpl null)
  21.     {
  22.         $app JFactory::getApplication();
  23.  
  24.         if (!$app->isAdmin())
  25.         {
  26.             return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')'warning');
  27.         }
  28.  
  29.         // Do not allow cache
  30.         $app->allowCache(false);
  31.  
  32.         JHtml::_('behavior.framework'true);
  33.  
  34.         JFactory::getDocument()->addScriptDeclaration("
  35.         window.addEvent('domready', function()
  36.         {
  37.             window.parent.document.updateUploader();
  38.             $$('a.img-preview').each(function(el)
  39.             {
  40.                 el.addEvent('click', function(e)
  41.                 {
  42.                     window.top.document.preview.fromElement(el);
  43.                     return false;
  44.                 });
  45.             });
  46.         });");
  47.  
  48.         $images $this->get('images');
  49.         $documents $this->get('documents');
  50.         $folders $this->get('folders');
  51.         $state $this->get('state');
  52.  
  53.         // Check for invalid folder name
  54.         if (empty($state->folder)) {
  55.             $dirname JRequest::getVar('folder''''''string');
  56.             if (!empty($dirname)) {
  57.                 $dirname htmlspecialchars($dirnameENT_COMPAT'UTF-8');
  58.                 JError::raiseWarning(100JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME'$dirname));
  59.             }
  60.         }
  61.  
  62.         $this->baseURL JUri::root();
  63.         $this->images &$images;
  64.         $this->documents &$documents;
  65.         $this->folders &$folders;
  66.         $this->state &$state;
  67.  
  68.         parent::display($tpl);
  69.     }
  70.  
  71.     function setFolder($index 0)
  72.     {
  73.         if (isset($this->folders[$index]))
  74.         {
  75.             $this->_tmp_folder &$this->folders[$index];
  76.         }
  77.         else
  78.         {
  79.             $this->_tmp_folder new JObject;
  80.         }
  81.     }
  82.  
  83.     function setImage($index 0)
  84.     {
  85.         if (isset($this->images[$index]))
  86.         {
  87.             $this->_tmp_img &$this->images[$index];
  88.         }
  89.         else
  90.         {
  91.             $this->_tmp_img new JObject;
  92.         }
  93.     }
  94.  
  95.     function setDoc($index 0)
  96.     {
  97.         if (isset($this->documents[$index]))
  98.         {
  99.             $this->_tmp_doc &$this->documents[$index];
  100.         }
  101.         else
  102.         {
  103.             $this->_tmp_doc new JObject;
  104.         }
  105.     }
  106. }

Documentation generated on Tue, 19 Nov 2013 15:18:11 +0100 by phpDocumentor 1.4.3