Example #1
0
 public function addToolbar()
 {
     $bar = JToolBar::getInstance('toolbar');
     /* @var $bar JToolBar */
     JToolBarHelper::title(JText::_('JOOMDOC_LICENSES'), 'licenses');
     if (JoomDOCAccess::licenses()) {
         JToolBarHelper::addNew(JoomDOCHelper::getTask(JOOMDOC_LICENSE, JOOMDOC_TASK_ADD));
         JToolBarHelper::publishList(JoomDOCHelper::getTask(JOOMDOC_LICENSES, JOOMDOC_TASK_PUBLISH));
         JToolBarHelper::unpublishList(JoomDOCHelper::getTask(JOOMDOC_LICENSES, JOOMDOC_TASK_UNPUBLISH));
         JToolBarHelper::divider();
         JToolBarHelper::deleteList('JOOMDOC_ARE_YOU_SURE_DELETE_LICENSE', JoomDOCHelper::getTask(JOOMDOC_LICENSES, JOOMDOC_TASK_DELETE));
         $bar->appendButton('Confirm', 'JOOMDOC_ARE_YOU_SURE_EMPTY_TRASH', 'trash', 'JTOOLBAR_EMPTY_TRASH', JoomDOCHelper::getTask(JOOMDOC_LICENSES, JOOMDOC_TASK_TRASH), false);
     } else {
         $bar->appendButton('Standard', 'new', 'JTOOLBAR_NEW');
         $bar->appendButton('Standard', 'publish', 'JTOOLBAR_PUBLISH');
         $bar->appendButton('Standard', 'unpublish', 'JTOOLBAR_UNPUBLISH');
         JToolBarHelper::divider();
         $bar->appendButton('Standard', 'remove', 'JTOOLBAR_DELETE');
         $bar->appendButton('Standard', 'trash', 'JTOOLBAR_TRASH');
     }
     if (JoomDOCAccess::admin()) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences(JOOMDOC_OPTION, JOOMDOC_PARAMS_WINDOW_HEIGHT, JOOMDOC_PARAMS_WINDOW_WIDTH);
     }
 }
Example #2
0
 /**
  * Display page with migration setting.
  *
  * @param $tpl used template
  * @return void
  */
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JOOMDOC_MIGRATION'), 'migration');
     JoomDOCHelper::setSubmenu(JOOMDOC_MIGRATION);
     // use the same dialog as during installation
     require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'install.php';
     com_joomdocInstallerScript::install(false, false);
 }
Example #3
0
 public function display($tpl = null)
 {
     if (!JFactory::getUser()->authorise('core.managafields', 'com_joomdoc')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     JoomDOCHelper::setSubmenu(JOOMDOC_FIELDS);
     $this->addToolbar();
     parent::display($tpl);
 }
Example #4
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     JToolBarHelper::title(JText::_('JOOMDOC_DOCUMENT'), 'document');
     if ($this->access->canEdit || $this->access->canCreate) {
         JToolBarHelper::apply(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_APPLY), 'JTOOLBAR_APPLY');
         JToolBarHelper::save(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_SAVE), 'JTOOLBAR_SAVE');
     } else {
         $bar = JToolBar::getInstance('toolbar');
         /* @var $bar JToolBar */
         $bar->appendButton('Standard', 'apply', 'JTOOLBAR_APPLY');
         $bar->appendButton('Standard', 'save', 'JTOOLBAR_SAVE');
     }
     JToolBarHelper::cancel(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_CANCEL), 'JTOOLBAR_CLOSE');
 }
Example #5
0
 /**
  * Add the page title and toolbar.
  * @return void
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     JToolBarHelper::title(JText::_('JOOMDOC_LICENSE'), 'licenses');
     if (JoomDOCAccess::licenses()) {
         JToolBarHelper::apply(JoomDOCHelper::getTask(JOOMDOC_LICENSE, JOOMDOC_TASK_APPLY), 'JTOOLBAR_APPLY');
         JToolBarHelper::save(JoomDOCHelper::getTask(JOOMDOC_LICENSE, JOOMDOC_TASK_SAVE), 'JTOOLBAR_SAVE');
     } else {
         $bar = JToolBar::getInstance('toolbar');
         /* @var $bar JToolBar */
         $bar->appendButton('Standard', 'apply', 'JTOOLBAR_APPLY');
         $bar->appendButton('Standard', 'save', 'JTOOLBAR_SAVE');
     }
     JToolBarHelper::cancel(JoomDOCHelper::getTask(JOOMDOC_LICENSE, JOOMDOC_TASK_CANCEL), 'JTOOLBAR_CLOSE');
 }
Example #6
0
 /**
  * Display page with upgrade setting.
  * 
  * @param $tpl used template
  * @return void
  */
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('Online Upgrade'), 'upgrade');
     if ($this->getLayout() == 'message') {
         $url = sprintf('index.php?option=%s&view=upgrade', ARTIO_UPGRADE_OPTION);
         $redir = JRequest::getVar('redirto', null, 'post');
         if (!is_null($redir)) {
             $url = sprintf('index.php?option=%s&%s', ARTIO_UPGRADE_OPTION, $redir);
         }
         JToolBarHelper::back('Continue', $url);
         $this->assign('url', $url);
     }
     $language = JFactory::getLanguage();
     /* @var $language JLanguage */
     $language->load(sprintf('%s.upgrade', ARTIO_UPGRADE_OPTION), JPATH_ADMINISTRATOR);
     JoomDOCHelper::setSubmenu(JOOMDOC_UPGRADE);
     parent::display($tpl);
 }
Example #7
0
 /**
  * Display page with folder content.
  *
  * @param $tpl used template
  * @return void
  */
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JSite */
     $document = JFactory::getDocument();
     /* @var $documents JDocumentHTML */
     $config = JoomDOCConfig::getInstance();
     /* @var $config JoomDOCConfig */
     $modelDocument = JModelLegacy::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_MODEL_PREFIX);
     /* @var $modelDocument JoomDOCModelDocument */
     $modelDocuments = JModelLegacy::getInstance(JOOMDOC_DOCUMENTS, JOOMDOC_MODEL_SITE_PREFIX);
     /* @var $modelDocuments JoomDOCSiteModelDocuments */
     $modelFile = JModelLegacy::getInstance(JOOMDOC_FILE, JOOMDOC_MODEL_PREFIX);
     /* @var $modelFile JoomDOCModelFile */
     $this->filter = $this->getLayout() == 'modal' ? $mainframe->getUserStateFromRequest(JoomDOCRequest::getSessionPrefix() . 'filter', 'filter', '', 'string') : '';
     $path = JoomDOCRequest::getPath();
     // convert to absolute path, if path si empty use document root path
     $path = $path ? JoomDOCFileSystem::getFullPath($path) : $config->path;
     // request path value isn't subfolder of document root
     if (!JoomDOCFileSystem::isSubFolder($path, $config->path)) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR ' . $path . ' ' . $config->path));
     }
     $this->searchablefields = $this->get('searchablefields');
     $this->publishedfields = $this->get('publishedfields');
     foreach ($this->searchablefields as $field) {
         $field->name = 'joomdoc_field' . $field->id;
     }
     if ($config->useSearch || $this->getLayout() == 'modal') {
         $this->search = new JObject();
         // load setting from request or Joomla session storage (server session, database, apc etc.)
         $this->search->search = $this->getSearchParam('joomdoc_search', 0, 'int');
         if ($config->searchKeyword == 1) {
             $this->search->keywords = $this->getSearchParam('joomdoc_keywords', $this->filter, 'string');
         } elseif ($config->searchKeyword == 2) {
             // separate keywords for each area
             $this->search->keywords_title = $this->getSearchParam('joomdoc_keywords_title', $this->filter, 'string');
             $this->search->keywords_text = $this->getSearchParam('joomdoc_keywords_text', $this->filter, 'string');
             $this->search->keywords_meta = $this->getSearchParam('joomdoc_keywords_meta', $this->filter, 'string');
             $this->search->keywords_full = $this->getSearchParam('joomdoc_keywords_full', $this->filter, 'string');
             foreach ($this->searchablefields as $field) {
                 if ($field->type == JOOMDOC_FIELD_TEXT || $field->type == JOOMDOC_FIELD_TEXTAREA || $field->type == JOOMDOC_FIELD_EDITOR) {
                     $this->search->set('keywords_field' . $field->id, $this->getSearchParam('joomdoc_keywords_field' . $field->id, $this->filter, 'string'));
                 }
             }
         }
         // selected parent (folder)
         $this->search->parent = $config->searchShowParent ? $this->getSearchParam('path', '', 'string') : '';
         // path to load items list, if not select parent use document root
         $this->search->path = JoomDOCFileSystem::getFullPath($this->search->parent);
         // search areas (document title or file path), text and metadata, file content
         $this->search->areaTitle = $config->searchShowTitle ? $this->getSearchParam('joomdoc_area_title', 1, 'int', true, 'joomdoc_search') : 0;
         $this->search->areaText = $config->searchShowText ? $this->getSearchParam('joomdoc_area_text', 1, 'int', true, 'joomdoc_search') : 0;
         $this->search->areaMeta = $config->searchShowMetadata ? $this->getSearchParam('joomdoc_area_meta', 1, 'int', true, 'joomdoc_search') : 0;
         $this->search->areaFull = $config->searchShowFulltext ? $this->getSearchParam('joomdoc_area_full', 1, 'int', true, 'joomdoc_search') : 0;
         // searching type (any/all word, complet phrase, regular expresion
         $this->search->type = $this->getSearchParam('joomdoc_type', $config->searchDefaultType, 'int');
         // ordering
         $this->search->ordering = $this->getSearchParam('joomdoc_ordering', $config->searchDefaultOrder, 'string');
         foreach ($this->searchablefields as $field) {
             if ($field->type == JOOMDOC_FIELD_TEXT) {
                 $this->search->fields[$field->id] = array('type' => $field->type, 'value' => $this->getSearchParam($field->name, 1, 'int', true, 'joomdoc_search'));
             } elseif ($field->type == JOOMDOC_FIELD_CHECKBOX || $field->type == JOOMDOC_FIELD_MULTI_SELECT || $field->type == JOOMDOC_FIELD_SUGGEST) {
                 $this->search->fields[$field->id] = array('type' => $field->type, 'value' => $this->getSearchParam($field->name, array(), 'array'));
             } else {
                 $this->search->fields[$field->id] = array('type' => $field->type, 'value' => $this->getSearchParam($field->name, '', 'string'));
             }
         }
         // set ordering from search setting
         switch ($this->search->ordering) {
             case JOOMDOC_ORDER_NEWEST:
                 /* Newest items */
                 // files order upload date and documents order publish up date descending
                 $documentOrdering = JOOMDOC_ORDER_PUBLISH_UP;
                 $fileOrdering = JOOMDOC_ORDER_UPLOAD;
                 $orderingDirection = JOOMDOC_ORDER_DESC;
                 break;
             case JOOMDOC_ORDER_OLDEST:
                 /* Oldest items */
                 // files order upload date and documents order publish up date ascending
                 $documentOrdering = JOOMDOC_ORDER_PUBLISH_UP;
                 $fileOrdering = JOOMDOC_ORDER_UPLOAD;
                 $orderingDirection = JOOMDOC_ORDER_ASC;
                 break;
             case JOOMDOC_ORDER_HITS:
                 /* Most popular (downloaded) */
                 // files order hits descending
                 $documentOrdering = null;
                 $fileOrdering = JOOMDOC_ORDER_HITS;
                 $orderingDirection = JOOMDOC_ORDER_DESC;
                 break;
             case JOOMDOC_ORDER_TITLE:
                 /* Alphabetical */
                 // files order path and documents order title ascending
                 $documentOrdering = JOOMDOC_ORDER_TITLE;
                 $fileOrdering = JOOMDOC_ORDER_PATH;
                 $orderingDirection = JOOMDOC_ORDER_ASC;
                 break;
         }
     }
     $searchActive = $config->useSearch && $this->search->search;
     if (!$searchActive) {
         // if search isnt't set use ordering from configuration
         $documentOrdering = $config->documentOrdering;
         $fileOrdering = $config->fileOrdering;
         $orderingDirection = $config->orderingDirection;
     }
     // get content of selected folder
     $this->root = JoomDOCFileSystem::getFolderContent($path, '', $searchActive);
     if (JoomDOCFileSystem::isFolder($this->root)) {
         // selected path is folder
         $modelDocuments->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_PATHS), $this->root->getPaths(false));
         // get child documents
         $modelDocuments->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_SEARCH), $config->useSearch || $this->getLayout() == 'modal' ? $this->search : null);
         $this->documents = $modelDocuments->getItems($searchActive);
         $this->listfields = $modelDocuments->getListFields();
         $this->state = $modelDocuments->getState();
         // add documents to given subfolders and files
         $this->root->setDocuments($this->documents);
         $this->access = new JoomDOCAccessHelper($this->root);
         // control permissions to access folder
         if (!$this->access->canEnterFolder) {
             JError::raiseError(403, JText::_('JOOMDOC_UNABLE_ACCESS_FOLDER'));
         }
         $this->pagination = new JPagination($modelDocuments->getTotal($searchActive), $mainframe->getUserStateFromRequest('com_joomdoc.documents.limitstart', 'limitstart', 0, 'int'), $mainframe->getUserStateFromRequest('com_joomdoc.documents.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'));
         // reorder
         $this->root->reorder($documentOrdering, $fileOrdering, $orderingDirection, $this->pagination->limitstart, $this->pagination->limit, $this->pagination->total, $config->foldersFirstSite);
         // set root parent
         $this->root->parent = $modelDocument->getParent(JoomDOCFileSystem::getParentPath($this->root->getRelativePath()));
         $this->root->document = $modelDocument->getItemByPath($this->root->getRelativePath());
     } elseif (JoomDOCFileSystem::isFile($this->root)) {
         // use different layout
         $this->setLayout('file');
         // search document by path
         $this->root->document = $modelDocument->getItemByPath($this->root->getRelativePath());
         $this->publishedfields = $modelDocument->getPublishedFields();
         $this->access = new JoomDOCAccessHelper($this->root);
         // document unpublished
         $this->root->parent = $modelDocument->getParent(JoomDOCFileSystem::getParentPath($this->root->getRelativePath()));
     } else {
         JError::raiseError(404, JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'));
     }
     // control root access
     if ($this->access->docid) {
         // item with document
         if (!$this->access->canAnyEditOp && $this->root->document->published == JOOMDOC_STATE_UNPUBLISHED) {
             // root unpublished and user hasn't admin rights
             JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         }
         if ($this->root->document->state == JOOMDOC_STATE_TRASHED) {
             // root trashed
             JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     } elseif (isset($this->root->document->file_state)) {
         // item without document but with file
         if ($this->root->document->file_state == JOOMDOC_STATE_TRASHED) {
             // file is trashed
             JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     } elseif (!$this->access->inRoot && !$searchActive && $this->getLayout() != 'modal') {
         // item without file can be total root but it's not root
         JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // take a configuration of an active menu item
     $active = $mainframe->getMenu()->getActive();
     $this->pageHeading = $this->pageclassSfx = '';
     if ($active) {
         if ($active->params->get('show_page_heading')) {
             $this->pageHeading = JString::trim($active->params->get('page_heading'));
             if (!$this->pageHeading) {
                 $this->pageHeading = JString::trim($active->params->get('page_title'));
             }
         }
         $this->pageclassSfx = JString::trim($active->params->get('pageclass_sfx'));
         $titles[] = JString::trim($active->params->get('page_title'));
         $metakeywords[] = JString::trim($active->params->get('menu-meta_keywords'));
         $metadescriptions[] = JString::trim($active->params->get('menu-meta_description'));
     }
     // take candidates for metadata sort on priority
     if ($this->access->docid and $this->root->document->published == JOOMDOC_STATE_PUBLISHED) {
         //use document only if published. (but for owner is published always).
         // from document data
         $params = new JRegistry($this->root->document->params);
         $titles[] = JString::trim($this->root->document->title);
         $metakeywords[] = JString::trim($params->get('metakeywords'));
         $metadescriptions[] = JString::trim($params->get('metadescription'));
         $metadescriptions[] = JoomDOCHelper::getMetaDescriptions($this->root->document->description);
     }
     // default candidates
     $titles[] = $this->access->name;
     $titles[] = $config->defaultTitle;
     $metakeywords[] = $config->defaultMetakeywords;
     $metadescriptions[] = $config->defaultMetadescription;
     // set meta data from candidates acording to priority
     // set meta keywords
     $document->setMetaData('keywords', JoomDOCHelper::getFirstNoEmpty($metakeywords));
     // set page title
     $document->setTitle(JoomDOCHelper::getCompletTitle(JoomDOCHelper::getFirstNoEmpty($titles)));
     // set head meta description
     $document->setDescription(JoomDOCHelper::getFirstNoEmpty($metadescriptions));
     $modelDocuments->setPathway($this->root->getRelativePath());
     if ($this->access->canCopyMove) {
         JoomDOCHelper::clipboardInfo();
     }
     parent::display($tpl);
 }
Example #8
0
 * @package		Joomla.Administrator
 * @subpackage	JoomDOC
 * @author      ARTIO s.r.o., info@artio.net, http:://www.artio.net
 * @copyright	Copyright (C) 2011 Artio s.r.o.. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
$document = JFactory::getDocument();
/* @var $document JDocumentHTML */
$config = JoomDOCConfig::getInstance();
$params['joomDOCTaskUploadFile'] = JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_UPLOADFILE);
$params['joomDOCmsgEmpty'] = JText::_('JOOMDOC_UPLOAD_EMPTY');
$params['joomDOCmsgOverwrite'] = JText::_('JOOMDOC_UPLOAD_OVERWRITE');
$params['joomDOCmsgDirExists'] = JText::_('JOOMDOC_UPLOAD_DIR_EXISTS');
$params['joomDOCmsgAreYouSure'] = JText::_('JOOMDOC_ARE_YOU_SURE');
$params['joomDOCmsgAddKeywords'] = JText::_('JOOMDOC_SEARCH_ADD_KEYWORDS');
$params['joomDOCmsgAddArea'] = JText::_('JOOMDOC_SEARCH_ADD_WHERE');
$params['joomDOCmsgMkdirEmpty'] = JText::_('JOOMDOC_MKDIR_EMPTY');
$params['joomDOCmsgMkdirFileExists'] = JText::_('JOOMDOC_MKDIR_FILE_EXISTS');
$params['joomDOCmsgMkdirDirExists'] = JText::_('JOOMDOC_MKDIR_DIR_EXISTS');
$params['joomDOCmsgMkdirCreateDocument'] = JText::_('JOOMDOC_MKDIR_CREATE_DOCUMENT');
$params['joomDOCmsgMkdirTask'] = "'" . addslashes(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_NEWFOLDER)) . "'";
$params['joomDOCsearchDefaultType'] = $config->searchDefaultType;
$params['joomDOCsearchDefaultOrder'] = $config->searchDefaultOrder;
foreach ($params as $param => $value) {
    $document->addScriptDeclaration('var ' . $param . ' = "' . addslashes($value) . '";');
}
?>


Example #9
0
                      <script>
                        jQuery(\'#modal-symlink-'.$i.'\').on(\'show\', function () {
        
                            document.getElementById(\'modal-symlink-container-'.$i.'\').innerHTML = \'<div class="modal-body"><iframe class="iframe" src="'.JUri::root().'administrator/index.php?option=com_joomdoc&view=documents&layout=modal&tmpl=component&addSymLink=source&symLinkSource='.$this->escape($access->relativePath).'" height="480" width="640"></iframe></div>\';
        
                        });
                      </script>';*/
        echo '</div>';
        $i++;
    }
}
echo '<input type="hidden" name="task" value="" />';
echo '<input type="hidden" name="boxchecked" value="" />';
echo '<input type="hidden" name="filter_order" value="' . $listOrder . '" />';
echo '<input type="hidden" name="filter_order_Dir" value="' . $listDirn . '" />';
echo '<input type="hidden" name="renamePath" value="" />';
echo '<input type="hidden" name="newName" value="" />';
echo '<input type="hidden" name="doccreate" value="0" />';
echo JHtml::_('form.token');
echo '</form>';
echo '</div>';
//css fix. if error messages container is before component code (see isis template), left .span2 have margin-left 15, because it is not first-child
//so move mesages container inside right span10
if (JOOMDOC_ISJ3) {
    echo '<script type="text/javascript">if ($("system-message-container")) $("system-message-container").inject($("joomdoc"), "top")</script>';
}
JoomDOCHelper::jsArray('joomDOCFiles', $files);
JoomDOCHelper::jsArray('joomDOCFolders', $folders);
if ($this->access->canWebDav) {
    JoomDOCWebDav::add();
}
Example #10
0
 /**
  * Get URL to update tree explorer via Ajax.
  *
  * @param string $path
  * @return string
  */
 public static function updatemootree()
 {
     return 'index.php?option=' . JOOMDOC_OPTION . '&task=' . JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_UPDATEMOOTREE);
 }
Example #11
0
 * @package		Joomla.Administrator
 * @subpackage	JoomDOC
 * @author      ARTIO s.r.o., info@artio.net, http:://www.artio.net
 * @copyright	Copyright (C) 2011 Artio s.r.o.. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
/* @var $this JoomDOCViewLicense */
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
jimport('joomla.html.pane');
$document = JFactory::getDocument();
/* @var $document JDocumentHTML */
$js[] = 'Joomla.submitbutton = function (task) {';
$js[] = '	var form = document.getElementById(\'item-form\');';
$js[] = '	if (task == \'' . JoomDOCHelper::getTask(JOOMDOC_LICENSE, JOOMDOC_TASK_CANCEL) . '\' || document.formvalidator.isValid(form))';
$js[] = '		Joomla.submitform(task, form);';
$js[] = '	else alert(\'' . JText::_('JGLOBAL_VALIDATION_FORM_FAILED', true) . '\');';
$js[] = '}';
$js[] = 'function submitform(pressbutton){Joomla.submitbutton(pressbutton);}';
$document->addScriptDeclaration(PHP_EOL . implode(PHP_EOL, $js) . PHP_EOL);
echo '<form action="' . JRoute::_(JoomDOCRoute::saveLicense($this->license->id)) . '" method="post" name="adminForm" id="item-form" class="form-validate">';
echo '<div class="fltlft col"><fieldset class="adminform"><legend>' . JText::_('JOOMDOC_DOCUMENT') . '</legend><table class="admintable">';
echo '<tr><td class="key">' . $this->form->getLabel('title') . '</td><td>' . $this->form->getInput('title') . '</td></tr>';
echo '<tr><td class="key">' . $this->form->getLabel('alias') . '</td><td>' . $this->form->getInput('alias') . '</td></tr>';
echo '<tr><td class="key">' . $this->form->getLabel('default') . '</td><td>' . $this->form->getInput('default') . '</td></tr>';
echo '<tr><td class="key">' . $this->form->getLabel('state') . '</td><td>' . $this->form->getInput('state') . '</td></tr>';
echo '</table><div class="clr"></div>';
echo $this->form->getLabel('text') . '<div class="clr"></div>';
echo JoomDOCAccess::licenses() ? $this->form->getInput('text') : $this->form->getValue('text');
echo '<div class="clr"></div></fieldset></div>';
Example #12
0
 /**
  * Add page main toolbar.
  *
  * @return void
  */
 protected function addToolbar()
 {
     JToolBarHelper::title(JText::sprintf('JOOMDOC_FILE_PATH', $this->filter->path), 'file');
     if ($this->access->canManageVersions) {
         JToolBarHelper::deleteList('JOOMDOC_ARE_YOU_SURE_TRASH_VERSION', JoomDOCHelper::getTask(JOOMDOC_FILE, JOOMDOC_TASK_TRASH), 'JTOOLBAR_TRASH');
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_FILE, JOOMDOC_TASK_RESTORE), JOOMDOC_ISJ3 ? 'refresh' : JOOMDOC_TASK_RESTORE, JOOMDOC_TASK_RESTORE, JText::_('JTOOLBAR_RESTORE'));
         JToolBarHelper::divider();
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_FILE, JOOMDOC_TASK_REVERT), JOOMDOC_ISJ3 ? 'redo' : JOOMDOC_TASK_REVERT, JOOMDOC_TASK_REVERT, JText::_('JTOOLBAR_REVERT'));
         JToolBarHelper::divider();
     }
     if (JOOMDOC_ISJ3) {
         //has icon in J3
         JToolBarHelper::cancel(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_CANCEL), 'JTOOLBAR_CLOSE');
     } else {
         JToolBarHelper::back('Back', JRoute::_(JoomDOCRoute::viewDocuments()));
     }
 }
Example #13
0
 public function run()
 {
     $db = JFactory::getDbo();
     /* @var $db JDatabase */
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JApplication */
     // selected source docman or joomdoc
     $component = JRequest::getString('component');
     // current database prefix
     $pr = $mainframe->getCfg('dbprefix');
     // all DocMAN or JoomDOC2 tables
     if ($component == 'docman') {
         $tables = array($pr . 'docman', $pr . 'docman_groups', $pr . 'docman_history', $pr . 'docman_licenses', $pr . 'docman_log');
     } else {
         $tables = array($pr . 'joomdoc2', $pr . 'joomdoc2_groups', $pr . 'joomdoc2_history', $pr . 'joomdoc2_licenses', $pr . 'joomdoc2_log');
     }
     // all tables in Joomla database
     $joomla = $db->getTableList();
     // check if all tables exists, are required
     if (array_intersect($tables, $joomla) != $tables) {
         return $this->setRedirect(JoomDOCRoute::viewJoomDOC(), JText::sprintf('JOOMDOC_MIGRATION_TABLES_UNAVAILABLE', implode(', ', $tables)), 'error');
     }
     // relative path folder where DocMAN or JoomDOC stored files, is required
     $docbase = JPath::clean(JPATH_ROOT . '/' . JRequest::getString('docbase'));
     if (!JFolder::exists($docbase)) {
         return $this->setRedirect(JoomDOCRoute::viewJoomDOC(), JText::sprintf('JOOMDOC_MIGRATION_DOCBASE_UNAVAILABLE', $docbase), 'error');
     }
     // statictis counters
     $newFolders = $newFiles = 0;
     /* copy DocMAN or JoomDOC2 licenses into JoomDOC3 */
     $license = JTable::getInstance(JOOMDOC_LICENSE, JOOMDOC_TABLE_PREFIX);
     /* @var $license JoomDOCTableLicense */
     $table = $component == 'docman' ? 'docman_licenses ' : 'joomdoc2_licenses ';
     // total of licenses in DocMAN or JoomDOC2
     $db->setQuery('SELECT COUNT(*) FROM #__' . $table);
     $total = $db->loadResult();
     // map Ids of licenses from DocMAN or JoomDOC2 into Ids of licenses in new JoomDOC3 structure
     $licensesMap = array();
     for ($i = 0; $i < $total; $i += 100) {
         // migrate licenses in batch process
         $db->setQuery('SELECT * FROM #__' . $table, $i, 100);
         $items = $db->loadObjectList();
         foreach ($items as $item) {
             // prepare new JoomDOC3 license
             $license->id = 0;
             $license->alias = null;
             $license->state = JOOMDOC_STATE_PUBLISHED;
             // copy data from DocMAN or JoomDOC2 license into JoomDOC3
             $license->title = $item->name;
             $license->text = $item->license;
             $license->store();
             // store licenses maping for using in new JoomDOC3 documents
             $licensesMap[$item->id] = $license->id;
         }
     }
     $document = JTable::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_TABLE_PREFIX);
     /* @var $document JoomDOCTableDocument */
     // convert DocMAN or JoomDOC categories into JoomDOC3 folders
     $parents = array(0 => '');
     // root of categories tree
     // do for levels of categories tree
     // store map of Joomla categories and DocMAN/JoomDOC2 documents to JoomDOC3 paths
     $categoriesMap = $documentsMap = array();
     do {
         // name of Joomla category section - identify component
         $section = $db->quote($component == 'docman' ? 'com_docman' : 'com_joomdoc');
         $parentsIds = implode(', ', array_keys($parents));
         // load total of DocMAN or JoomDOC2 categories in one level of categories tree
         if ($component == 'docman' && in_array($pr . 'docman_categories', $joomla)) {
             // since DocMAN 1.5
             $db->setQuery('SELECT COUNT(*) FROM #__docman_categories WHERE parent_id IN (' . $parentsIds . ')');
         } else {
             $db->setQuery('SELECT COUNT(*) FROM #__categories WHERE section = ' . $section . ' AND parent_id IN (' . $parentsIds . ')');
         }
         try {
             $total = $db->loadResult();
         } catch (Exception $e) {
             // new format of table jos_categories without section column
             $c = $db->replacePrefix('#__categories');
             $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_MIGRATION_OLD_CATEGORIES', $c, $c, $c, $c), 'notice');
             return;
         }
         $nextLevel = isset($nextLevel) ? array() : array(0 => '');
         // in the first batch process uncategorized documents
         for ($i = 0; $i < $total; $i += 100) {
             // load DocMAN or JoomDOC2 categories tree level full node list in batch process
             if ($component == 'docman' && in_array($pr . 'docman_categories', $joomla)) {
                 // since DocMAN 1.5
                 $db->setQuery('SELECT id, title, parent_id, description, published, ordering, access FROM #__docman_categories WHERE parent_id IN (' . $parentsIds . ')', $i, 100);
             } else {
                 $db->setQuery('SELECT id, title, parent_id, description, published, ordering, access FROM #__categories WHERE section = ' . $section . ' AND parent_id IN (' . $parentsIds . ')', $i, 100);
             }
             $children = $db->loadObjectList('id');
             foreach ($children as $id => $kid) {
                 /* @var $kid JTableCategory */
                 // create folder name from category title
                 $folder = JFilterOutput::stringURLSafe($kid->title);
                 // create document for folder
                 $document->id = 0;
                 $document->parent_path = $parents[$kid->parent_id];
                 $document->path = ($document->parent_path ? $document->parent_path . DIRECTORY_SEPARATOR : '') . $folder;
                 // copy data form category into document
                 $document->title = $kid->title;
                 $document->alias = null;
                 $document->description = $kid->description;
                 $document->state = $kid->published == JOOMDOC_STATE_PUBLISHED ? JOOMDOC_STATE_PUBLISHED : JOOMDOC_STATE_UNPUBLISHED;
                 $document->ordering = $kid->ordering;
                 $document->access = $kid->access ? $kid->access : 1;
                 if (!JFolder::exists(JoomDOCFileSystem::getFullPath($document->path))) {
                     // create folder only if doesn't exists
                     JoomDOCFileSystem::newFolder($document->parent_path, $folder, false, false);
                 } else {
                     // folder exist, search last exists document
                     $db->setQuery('SELECT id FROM #__joomdoc WHERE path = ' . $db->Quote($document->path) . ' ORDER BY version DESC');
                     $document->id = $db->loadResult();
                 }
                 if (JFolder::exists(JoomDOCFileSystem::getFullPath($document->path))) {
                     if ($document->store(false, false)) {
                         $newFolders++;
                         // current kid will be in parents for next level of categories tree
                         $nextLevel[$id] = $document->path;
                         $categoriesMap[$kid->id] = $document->path;
                     }
                 }
             }
         }
         // next level parents
         $parents = $nextLevel;
         if (count($parents)) {
             /* Convert DocMAN or JoomDOC2 categories documents into JoomDOC3 files in folder */
             $table = $component == 'docman' ? 'docman' : 'joomdoc2';
             $parentsIds = implode(', ', array_keys($parents));
             // load total of DocMAN or JoomDOC2 documents for categories in current level
             $db->setQuery('SELECT COUNT(*) FROM #__' . $table . ' WHERE catid IN (' . $parentsIds . ')');
             $total = $db->loadResult();
             // DocMAN or JoomDOC2 documents from categories in current tree level - batch process
             for ($i = 0; $i < $total; $i += 100) {
                 $db->setQuery('SELECT * FROM #__' . $table . ' WHERE catid IN (' . $parentsIds . ')', $i, 100);
                 $items = $db->loadObjectList();
                 foreach ($items as $item) {
                     // create document for successfully uploaded file
                     $document->id = 0;
                     $document->parent_path = $parents[$item->catid];
                     $document->path = $document->parent_path . DIRECTORY_SEPARATOR . $item->dmfilename;
                     // copy data from DocMAN or JoomDOC2 document into JoomDOC3 document
                     $document->title = $item->dmname;
                     $document->alias = null;
                     $document->description = $item->dmdescription;
                     $document->publish_up = $item->dmdate_published;
                     $document->created_by = $item->dmsubmitedby;
                     $document->state = $item->published == JOOMDOC_STATE_PUBLISHED ? JOOMDOC_STATE_PUBLISHED : JOOMDOC_STATE_UNPUBLISHED;
                     $document->modified = $item->dmlastupdateon;
                     $document->modified_by = $item->dmlastupdateby;
                     $document->access = $item->access ? $item->access : 1;
                     $document->license = isset($licensesMap[$item->dmlicense_id]) ? $licensesMap[$item->dmlicense_id] : 0;
                     if (JFile::exists(JoomDOCFileSystem::getFullPath($document->path))) {
                         // if file exists search for last document
                         $db->setQuery('SELECT id FROM #__joomdoc WHERE path = ' . $db->quote($document->path) . ' ORDER BY version DESC');
                         $document->id = $db->loadResult();
                     }
                     if (JoomDOCFileSystem::uploadFile(JoomDOCFileSystem::getFullPath($parents[$item->catid]), $docbase . DIRECTORY_SEPARATOR . $item->dmfilename, $item->dmfilename, true, false)) {
                         // upload into JoomDOC3 tree structure
                         if ($document->store(false, false)) {
                             $newFiles++;
                             // copy document hits into JoomDOC3 file
                             $db->setQuery('UPDATE #__joomdoc_file SET hits = ' . $item->dmcounter . ' WHERE path = ' . $db->quote($document->path));
                             $db->query();
                             $documentsMap[$item->id] = $document->path;
                         }
                     }
                 }
             }
         }
     } while (count($parents));
     // reindex at the end
     JModelLegacy::getInstance(JOOMDOC_DOCUMENTS, JOOMDOC_MODEL_PREFIX)->flat();
     /* Migrate DocMAN/JoomDOC2 URLs to JoomDOC3 in JoomSEF and Joomla tables*/
     $entities = array(array('table' => 'menu', 'html' => false, 'columns' => array('link', 'params'), 'where' => ' WHERE client_id != 1 '), array('table' => 'content', 'html' => true, 'columns' => array('introtext', '`fulltext`')), array('table' => 'modules', 'html' => true, 'columns' => array('content')), array('table' => 'sefurls', 'html' => false, 'columns' => array('origurl')));
     foreach ($entities as $entity) {
         // check if table is available
         // backup table with name eq. jos_content_joomdoc3_migration_backup
         $backup = $pr . $entity['table'] . '_joomdoc3_migration_backup';
         // check if backup already exists
         $db->setQuery('SHOW TABLES LIKE ' . $db->quote($backup));
         if ($db->loadResult() === null) {
             // create clone of backuped table
             $db->setQuery('CREATE TABLE IF NOT EXISTS ' . $backup . ' LIKE #__' . $entity['table']);
             try {
                 $db->query();
             } catch (Exception $e) {
                 continue;
                 // JoomSEF not installed
             }
             // copy data of table into backup
             $db->setQuery('INSERT INTO ' . $backup . ' SELECT * FROM #__' . $entity['table']);
             $db->query();
             // inform user about backup available
             $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_MIGRATION_BACKUPED', $pr . $entity['table'], $backup));
         }
         // get total of rows
         $db->setQuery('SELECT COUNT(*) FROM #__' . $entity['table'] . (empty($entity['where']) ? '' : $entity['where']));
         $total = $db->loadResult();
         for ($i = 0; $i < $total; $i += 500) {
             // load URLs in batch process
             $db->setQuery('SELECT id, ' . implode(', ', $entity['columns']) . ' FROM #__' . $entity['table'] . (empty($entity['where']) ? '' : $entity['where']), $i, 500);
             // load as multidimensional array
             $items = $db->loadRowList();
             foreach ($items as $item) {
                 // information if any change was made
                 $affected = false;
                 $count = count($item);
                 // process columns without id
                 for ($j = 1; $j < $count; $j++) {
                     $urls = array();
                     if ($entity['html']) {
                         // content is HTML code from editor (article, module)
                         $matches = array();
                         if (preg_match_all('/href="([^"]*)"/', $item[$j], $matches)) {
                             $urls = $matches[1];
                         }
                     } else {
                         // URL is whole content (JoomSEF, menu)
                         $urls = array($item[$j]);
                     }
                     // analyse URLs
                     foreach ($urls as $url) {
                         $uri = JFactory::getURI($url);
                         /* @var $uri JURI Joomla support for working with URLs */
                         if ($uri->getVar('option') == 'com_joomdoc' || $uri->getVar('option') == 'com_docman') {
                             // JoomDOC3 option same as JoomDOC2
                             $uri->setVar('option', 'com_joomdoc');
                             // ID of DocMAN/JoomDOC2 category or document
                             $gid = $uri->getVar('gid');
                             // unused in new URL
                             $uri->delVar('gid');
                             // analyse DocMAN/JoomDOC task value to recognise typoe of URL
                             switch ($uri->getVar('task')) {
                                 case 'cat_view':
                                     /* display DocMAN/JoomDOC2 category */
                                     $uri->setVar('view', JOOMDOC_DOCUMENTS);
                                     $uri->delVar('task');
                                     // don't use task wit wire together
                                     break;
                                 case 'doc_details':
                                     /* display DocMAN/JoomDOC2 document */
                                 /* display DocMAN/JoomDOC2 document */
                                 case 'doc_view':
                                     $uri->setVar('view', JOOMDOC_DOCUMENTS);
                                     $uri->delVar('task');
                                     // don't use task with view together
                                     break;
                                 case 'doc_download':
                                     $uri->setVar('task', JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_DOWNLOAD));
                                     break;
                                 case 'doc_edit':
                                     $uri->setVar('task', JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_EDIT));
                                     break;
                                 case 'doc_delete':
                                     $uri->setVar('task', JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_DELETE));
                                     break;
                                 default:
                                     /* URLs not supported by JoomDOC3 redirect to root */
                                     $uri->setVar('view', JOOMDOC_DOCUMENTS);
                                     break;
                             }
                             if (isset($documentsMap[$gid])) {
                                 $uri->setVar('path', $documentsMap[$gid]);
                             }
                             // menu items to open documents list store for using in next entities
                             if ($entity['table'] == 'menu' && $uri->getVar('view') == JOOMDOC_DOCUMENTS) {
                                 $registry = new JRegistry($item[2]);
                                 // load menu item configuration
                                 $registry->set('virtual_folder', 0);
                                 // disable JoomDOC3 virtual folder
                                 $item[2] = $registry->toString();
                                 /* back to database format */
                             }
                             $new = $uri->toString();
                             // back to string
                             if ($entity['html']) {
                                 // safe for valid HTML code
                                 $new = str_replace('&', '&amp;', $new);
                             }
                             // remove encoding in path added with JURI - prevent for making duplicity with JoomSEF
                             $new = str_replace('%2F', '/', $new);
                             $item[$j] = str_replace($url, $new, $item[$j]);
                             // update in data
                             // row will be updated
                             $affected = true;
                         }
                     }
                 }
                 if ($affected) {
                     $cols = array();
                     for ($j = 1; $j < $count; $j++) {
                         $cols[] = $entity['columns'][$j - 1] . ' = ' . $db->quote($item[$j]);
                     }
                     $db->setQuery('UPDATE #__' . $entity['table'] . ' SET ' . implode(', ', $cols) . ' WHERE id = ' . $item[0]);
                     $db->query();
                 }
             }
         }
     }
     // final report
     $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_MIGRATION_REPORT', $newFolders, $newFiles));
     $this->setRedirect(JoomDOCRoute::viewMigration());
 }
Example #14
0
    echo '<td>' . $item->version . '</td>';
    if ($showDownload) {
        echo '<td>';
        if ($item->state == JOOMDOC_STATE_PUBLISHED) {
            echo '<a href="' . JRoute::_(JoomDOCRoute::download($item->path, null, $item->version)) . '" title="" target="_blank">';
            echo $download;
            echo '</a>';
        } elseif ($item->state == JOOMDOC_STATE_TRASHED) {
            echo $trashed;
        }
        echo '</td>';
    }
    echo '<td nowrap="nowrap">' . JoomDOCFileSystem::getFileSize(JoomDOCFileSystem::getFullPath($item->path)) . '</td>';
    echo '<td nowrap="nowrap">' . JoomDOCHelper::uploaded($item->upload, false) . '</td>';
    echo '<td nowrap="nowrap">' . $item->name . '</td>';
    echo '<td class="center" nowrap="nowrap">' . JoomDOCHelper::number($item->hits) . '</td>';
    echo '</tr>';
}
echo '</tbody>';
echo '<tfoot>';
echo '<tr>';
$pagination = new JPagination($this->filter->total, $this->filter->offset, $this->filter->limit);
echo '<td colspan="20">' . $pagination->getListFooter() . '</td>';
echo '</tr>';
echo '</tfoot>';
echo '</table>';
echo JHtml::_('form.token');
echo '<input type="hidden" name="task" value="" />';
echo '<input type="hidden" name="boxchecked" value="" />';
echo '<input type="hidden" name="filter_order" value="' . $this->filter->listOrder . '" />';
echo '<input type="hidden" name="filter_order_Dir" value="' . $this->filter->listDirn . '" />';
Example #15
0
<?php

/**
 * @version		$Id$
 * @package		Joomla.Administrator
 * @subpackage	JoomDOC
 * @author      ARTIO s.r.o., info@artio.net, http:://www.artio.net
 * @copyright	Copyright (C) 2011 Artio s.r.o.. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
/* @var $this JoomDOCViewLicense */
// test if property realy exist in request
$path = JRequest::getVar('path', false) !== false ? JoomDOCRequest::getPath() : null;
echo '<h1>' . $this->license->title . '</h1>';
if ($path) {
    echo '<h2>' . JText::_('JOOMDOC_MUST_CONFIRM') . '</h2>';
}
echo JoomDOCHelper::applyContentPlugins($this->license->text);
if ($path) {
    echo '<div class="confirm">';
    echo '<input type="checkbox" name="confirm" id="confirm" value="1" onclick="JoomDOC.confirmLicense(this)" />';
    echo '<label for="confirm">' . JText::_('JOOMDOC_CONFIRM') . '</label>';
    echo '<a id="download" class="blind" href="' . JRoute::_(JoomDOCRoute::download($path)) . '" title="">' . JText::_('JOOMDOC_DOWNLOAD_FILE') . '</a>';
    echo '</div>';
}
Example #16
0
 /**
  * Add page main toolbar.
  *
  * @return void
  */
 protected function addToolbar()
 {
     $bar = JToolBar::getInstance('toolbar');
     /* @var $bar JToolBar */
     JToolBarHelper::title(JText::_('JOOMDOC_DOCUMENTS'), 'documents');
     if ($this->access->canEditStates) {
         JToolBarHelper::publish(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_PUBLISH));
         JToolBarHelper::unpublish(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_UNPUBLISH));
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_CHECKIN), 'checkin', '', 'JTOOLBAR_CHECKIN', true);
     } else {
         $bar->appendButton('Standard', 'publish', 'JTOOLBAR_PUBLISH');
         $bar->appendButton('Standard', 'unpublish', 'JTOOLBAR_UNPUBLISH');
         $bar->appendButton('Standard', 'checkin', 'JTOOLBAR_CHECKIN');
     }
     JToolBarHelper::divider();
     if ($this->access->canCopyMove && !JoomDOCFileSystem::haveOperation()) {
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_COPY), 'copy', '', 'JTOOLBAR_COPY', true);
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_MOVE), 'move', '', 'JTOOLBAR_MOVE', true);
     } else {
         //$bar->appendButton('Standard', 'copy', 'JTOOLBAR_COPY');
         //$bar->appendButton('Standard', 'move', 'JTOOLBAR_MOVE');
     }
     if ($this->access->canCopyMove && JoomDOCFileSystem::haveOperation()) {
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_PASTE), 'save', '', 'JTOOLBAR_PASTE', false);
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_RESET), 'remove', '', 'JTOOLBAR_RESET', false);
     } else {
         //$bar->appendButton('Standard', 'save', 'JTOOLBAR_PASTE');
         //$bar->appendButton('Standard', 'remove', 'JTOOLBAR_RESET');
     }
     JToolBarHelper::divider();
     // Document delete
     //if ($this->access->canDeleteDocs)
     //$bar->appendButton('Confirm', 'JOOMDOC_ARE_YOU_SURE_DELETE_DOCUMETS', 'docs-delete', 'JOOMDOC_DELETE_DOCUMENT', JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_DELETE), true);
     //else
     //$bar->appendButton('Standard', 'docs-delete', 'JOOMDOC_DELETE_DOCUMENT');
     // Item delete
     if ($this->access->canDeleteFile) {
         JToolBarHelper::deleteList('JOOMDOC_ARE_YOU_SURE_DELETE_ITEMS', JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_DELETEFILE), 'JTOOLBAR_DELETE');
     } else {
         $bar->appendButton('Standard', 'delete', 'JOOMDOC_DELETE_ITEM');
     }
     if (JoomDOCHelper::trashedItemsCount() >= 1) {
         if ($this->access->canDeleteDocs && $this->access->canDeleteFile) {
             $bar->appendButton('Confirm', 'JOOMDOC_ARE_YOU_SURE_EMPTY_TRASH', 'trash', 'JTOOLBAR_EMPTY_TRASH', JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_TRASH), false);
         } else {
             $bar->appendButton('Standard', 'trash', 'JTOOLBAR_TRASH');
         }
     }
     if (JoomDOCAccessFileSystem::refresh()) {
         JToolBarHelper::divider();
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_REFRESH), 'refresh', '', 'JTOOLBAR_REFRESH', false);
         JHtml::_('joomdoc.tooltip', 'toolbar-refresh', 'JTOOLBAR_REFRESH', 'JOOMDOC_REFRESH_TIP');
         JToolBarHelper::custom(JoomDOCHelper::getTask(JOOMDOC_DOCUMENTS, JOOMDOC_TASK_FLAT), 'reflat', '', 'JOOMDOC_REFLAT', false);
         JHtml::_('joomdoc.tooltip', 'toolbar-reflat', 'JOOMDOC_REFLAT', 'JOOMDOC_REFLAT_TIP');
     }
     if (JoomDOCAccess::admin()) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences(JOOMDOC_OPTION, JOOMDOC_PARAMS_WINDOW_HEIGHT, JOOMDOC_PARAMS_WINDOW_WIDTH);
     }
 }
Example #17
0
// import CSS and JS assets
$document->addStyleSheet(JOOMDOC_ASSETS . 'css/general.css?' . JOOMDOC_VERSION_ALIAS);
$document->addScript(JOOMDOC_ASSETS . 'js/script.js?' . JOOMDOC_VERSION_ALIAS);
// Load the CSS
if (JOOMDOC_ISJ3) {
    $document->addStyleSheet(JOOMDOC_ASSETS . 'css/joomla3.css?' . JOOMDOC_VERSION_ALIAS);
}
//$document->addStyleSheet(JOOMDOC_ASSETS . 'css/joomla-ico.css');
// language constants for javascript
include_once JPATH_COMPONENT_SITE . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'script.php';
$config = JoomDOCConfig::getInstance();
define('ARTIO_UPGRADE_DOWNLOAD_ID', $config->downloadId);
if (class_exists('JToolBar')) {
    $bar = JToolBar::getInstance('toolbar');
    /* @var $bar JToolBar */
    $bar->addButtonPath(JOOMDOC_BUTTONS);
}
// start controller
$controller = JControllerLegacy::getInstance(JOOMDOC);
if (JOOMDOC_LOG) {
    JFactory::getDbo()->debug(1);
}
$controller->execute(JFactory::getApplication()->input->get('task'));
if (JOOMDOC_LOG) {
    JFactory::getDbo()->debug(0);
    JoomDOCHelper::showLog();
}
$controller->redirect();
if ($config->displaySignature) {
    //echo '<p style="clear: both; padding-top: 20px;">' . JText::_('JOOMDOC_SIGNATURE') . '</p>';
}
Example #18
0
 public function __construct(&$item)
 {
     $config = JoomDOCConfig::getInstance();
     /* @var $config JoomDOCConfig */
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JApplication */
     $user = JFactory::getUser();
     $this->isFile = JoomDOCFileSystem::isFile($item);
     $this->isFolder = JoomDOCFileSystem::isFolder($item);
     $isFileSystemItem = $this->isFile || $this->isFolder;
     $this->docid = $isFileSystemItem ? JoomDOCHelper::getDocumentID($item) : $item->id;
     if (isset($item->document)) {
         $document = new JObject();
         $document->setProperties($item->document);
     } elseif (!$isFileSystemItem) {
         if ($item instanceof JObject) {
             $document = $item;
         } else {
             $document = new JObject($item);
             $document->setProperties($item);
         }
     } else {
         $document = new JObject();
     }
     $this->isTrashed = $isFileSystemItem ? @$item->file_state == JOOMDOC_STATE_TRASHED : $document->get('file_state') == JOOMDOC_STATE_TRASHED;
     if ($mainframe->isSite() && $document->get('state') == JOOMDOC_STATE_TRASHED) {
         $this->docid = null;
     }
     $this->relativePath = $isFileSystemItem ? $item->getRelativePath() : $item->path;
     $this->absolutePath = $isFileSystemItem ? $item->getAbsolutePath() : JoomDOCFileSystem::getFullPath($this->relativePath);
     $this->inRoot = $this->absolutePath == $config->path;
     $this->name = $isFileSystemItem ? $item->getFileName() : JFile::getName($this->relativePath);
     $this->alias = JoomDOCHelper::getDocumentAlias($item);
     $this->isChecked = JoomDOCHelper::isChecked($item);
     $this->isLocked = false;
     $this->fileType = JoomDOCHelper::getFileType($this->name);
     $this->canViewFileInfo = JoomDOCAccessFileSystem::viewFileInfo($this->docid, $this->relativePath);
     $this->fileVersion = JoomDOCHelper::getMaxVersion($this->relativePath);
     $this->canRename = JoomDOCAccessFileSystem::rename($this->docid, $this->relativePath);
     $this->canWebDav = JoomDOCAccessFileSystem::editWebDav($this->docid, $this->relativePath);
     $this->canEdit = $this->docid && JoomDOCAccessDocument::canEdit($document);
     $this->canCreate = !$this->docid && JoomDOCAccessDocument::create($this->relativePath);
     if ($config->documentAccess == 2 && $mainframe->isSite()) {
         $this->canDownload = $this->isFile && $document && $user->id == $document->get('access') && $document->get('download');
     } else {
         $this->canDownload = $this->isFile && JoomDOCAccessFileSystem::download($this->docid, $this->relativePath);
     }
     $this->canEnterFolder = JoomDOCAccessFileSystem::enterFolder($this->docid, $this->relativePath);
     $this->canOpenFolder = $this->isFolder && $this->canEnterFolder;
     $this->canOpenFile = $this->isFile;
     $this->canEditStates = JoomDOCAccessDocument::editState($this->docid, $document->get('checked_out'));
     $this->canEditState = $this->docid && JoomDOCAccessDocument::editState($this->docid, $document->get('checked_out'));
     if ($mainframe->isAdmin()) {
         $this->canEditState = JoomDOCAccessDocument::editState();
     }
     $this->canCopyMove = JoomDOCAccessFileSystem::copyMove($this->docid, $this->relativePath);
     $this->canDeleteDocs = JoomDOCAccessDocument::delete($this->docid);
     $this->canDeleteDoc = $this->docid && JoomDOCAccessDocument::delete($this->docid);
     $this->canDeleteFile = JoomDOCAccessFileSystem::deleteFile($this->docid, $this->relativePath);
     $this->canUpload = JoomDOCAccessFileSystem::uploadFile($this->docid, $this->relativePath);
     $this->canCreateFolder = JoomDOCAccessFileSystem::newFolder($this->docid, $this->relativePath);
     $this->canViewVersions = JoomDOCAccessDocument::viewVersions($this->docid);
     $this->canShowFileDates = $config->showCreated || $config->showModified;
     $this->canShowFileInfo = $config->showFilesize || $config->showHits;
     $this->canShowAllDesc = $config->showFolderDesc && $config->showFileDesc;
     $this->isFavorite = $document->get('favorite') == 1;
     $this->canDisplayFavorite = $this->isFavorite && $config->displayFavorite;
     $this->canAnyEditOp = $config->accessHandling && ($this->canEdit || $this->canWebDav || $this->canEditState || $this->canCreate || $this->canDeleteFile || $this->canDeleteDoc);
     if (!$this->docid || !$document->get('license_id')) {
         $license = JoomDOCHelper::license($this->relativePath);
         if ($license) {
             $this->licenseID = $license->id;
             $this->licenseAlias = $license->alias;
             $this->licenseTitle = $license->title;
         }
     } elseif ($document->get('license_state') == JOOMDOC_STATE_PUBLISHED) {
         $this->licenseID = $document->get('license_id');
         $this->licenseAlias = $document->get('license_alias');
         $this->licenseTitle = $document->get('license_title');
     }
     $this->canManageVersions = false;
     $this->canUntrash = JoomDOCAccessFileSystem::untrash($this->docid, $this->relativePath);
 }
Example #19
0
 /**
  * Access item by document ID or file path.
  * If document ID not available search last parent with document to inherit access.
  * If parent document not found use global setting.
  *
  * @param string $task accessed task name
  * @param mixed $docid document ID if null search parent, if false search document ID by path
  * @param string $path file path
  * @return boolean
  */
 public static function authorise($task, $docid, $path, $sessionid = null)
 {
     static $model;
     /* @var $model JoomDOCModelDocument */
     if (is_null($model)) {
         $model = JModelLegacy::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_MODEL_PREFIX);
     }
     if ($docid === null) {
         // search last parent document ID
         $docid = $model->getParentDocumentID($path);
     }
     if ($docid === false) {
         // search document ID by path
         $docid = $model->searchIdByPath($path);
     }
     if ($docid) {
         // get access from file document or inherit from last parent
         return JoomDOCAccess::authorise($task, JoomDOCHelper::getDocumentAsset($docid), $sessionid);
     }
     // get global access
     return JoomDOCAccess::authorise($task, JOOMDOC_OPTION, $sessionid);
 }
Example #20
0
 /**
  * Display date uploade in human readable format without wrap.
  *
  * @param int $date unix timestamp
  * @return string
  */
 public static function uploaded($date, $timestamp = true)
 {
     if (!$timestamp && $date == '0000-00-00 00:00:00') {
         return '';
     }
     return JoomDOCHelper::nowrap(JHtml::date($timestamp ? date('Y-m-d H:i:s', $date) : $date, JText::_('JOOMDOC_UPLOADED_DATE_J16')));
 }
Example #21
0
    }
}
if ($this->document->created) {
    echo '<tr><td class="key">' . $this->form->getLabel('created') . '</td>';
    echo '<td>' . JHtml::date($this->form->getValue('created'), JText::_('DATE_FORMAT_LC2')) . '</td></tr>';
}
$modifierID = $this->form->getValue('modified_by');
if ($modifierID) {
    $modifier = JFactory::getUser($modifierID);
    /* @var $modifier JUser */
    if ($modifier->id) {
        echo '<tr><td class="key">' . $this->form->getLabel('modified_by') . '</td>';
        echo '<td>' . $modifier->name . '</td></tr>';
    }
}
if (JoomDOCHelper::canViewModified($this->document->created, $this->document->modified)) {
    echo '<tr><td class="key">' . $this->form->getLabel('modified') . '</td>';
    echo '<td>' . JHtml::date($this->form->getValue('modified'), JText::_('DATE_FORMAT_LC2')) . '</td></tr>';
}
if ($this->access->canEditState) {
    echo '<tr><td class="key">' . $this->form->getLabel('publish_up') . '</td><td>' . $this->date('publish_up') . '</td></tr>';
    echo '<tr><td class="key">' . $this->form->getLabel('publish_down') . '</td><td>' . $this->date('publish_down') . '</td></tr>';
}
echo '</table>';
echo '</fieldset>';
echo JHtmlJoomDOC::endSlide();
foreach ($this->form->getFieldsets('params') as $name => $fieldSet) {
    echo JHtmlJoomDOC::addSlide('content-sliders-' . $this->document->id, $fieldSet->label, $name . '-options');
    if (isset($fieldSet->description) && JString::trim($fieldSet->description)) {
        echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
    }
Example #22
0
    if ($this->access->canDisplayFavorite) {
        echo '<span class="favorite">' . JText::_('JOOMDOC_FAVORITE') . '</span>';
    }
    if ($config->showFilesize && !$this->access->isFolder) {
        echo '<span class="filesize">' . JText::sprintf('JOOMDOC_FILESIZE', JoomDOCFileSystem::getFileSize($this->root->getAbsolutePath())) . '</span>';
    }
    if ($this->access->docid) {
        if ($config->showCreated && !is_null($this->root->document->created)) {
            echo '<span class="created">' . JText::sprintf('JOOMDOC_CREATED', JHtml::date($this->root->document->created, JText::_('JOOMDOC_UPLOADED_DATE_J16'))) . '</span>';
        }
        if ($config->showModified && JoomDOCHelper::canViewModified($this->root->document->created, $this->root->document->modified)) {
            echo '<span class="modified">' . JText::sprintf('JOOMDOC_MODIFIED', JHtml::date($this->root->document->modified, JText::_('JOOMDOC_UPLOADED_DATE_J16'))) . '</span>';
        }
    }
    if ($config->showHits && !$this->access->isFolder) {
        echo '<span class="hits">' . JText::sprintf('JOOMDOC_HITS_INFO', JoomDOCHelper::number($this->root->document->hits)) . '</span>';
    }
    echo '<div class="clr"></div>';
    echo '</div>';
}
echo '<table class="fields">';
echo '<tbody>';
foreach ($this->publishedfields as $field) {
    $name = 'field' . $field->id;
    if (isset($this->root->document->{$name})) {
        $value = JHtml::_('joomdoc.showfield', $field, $this->root->document);
        if ($value) {
            echo '<tr><th>' . $field->title . ':</th><td>' . $value . '</td></tr>';
        }
    }
}
Example #23
0
 /**
  * Show document field value on frontend
  * 
  * @param stdClass $field
  * @param stdClass $document
  * @return string
  */
 public static function showfield($field, $document)
 {
     $name = 'field' . $field->id;
     if (isset($document->{$name})) {
         $value = JString::trim($document->{$name});
         switch ($field->type) {
             case JOOMDOC_FIELD_TEXT:
                 return $value;
             case JOOMDOC_FIELD_TEXTAREA:
                 return $value ? nl2br($value) : '';
             case JOOMDOC_FIELD_EDITOR:
                 return $value ? JoomDOCHelper::applyContentPlugins($value) : '';
             case JOOMDOC_FIELD_DATE:
                 switch ($value) {
                     case '':
                     case '0000-00-00':
                     case '0000-00-00 00:00:00':
                         return '';
                     default:
                         return JHtml::date($value, JText::_('DATE_FORMAT_LC4'));
                 }
             case JOOMDOC_FIELD_RADIO:
                 switch ($value) {
                     case '0':
                         return JText::_('JNO');
                     case '1':
                         return JText::_('JYES');
                     default:
                         return '';
                 }
             case JOOMDOC_FIELD_CHECKBOX:
             case JOOMDOC_FIELD_MULTI_SELECT:
             case JOOMDOC_FIELD_SUGGEST:
                 $registry = new JRegistry($value);
                 $array = $registry->toArray();
                 $data = array();
                 if (is_array($array)) {
                     foreach ($array as $var => $val) {
                         foreach ($field->options as $option) {
                             if ($option->value == $val && JString::trim($option->label)) {
                                 $data[] = $option->label;
                             }
                         }
                     }
                 }
                 return implode(', ', $data);
             case JOOMDOC_FIELD_SELECT:
                 foreach ($field->options as $option) {
                     if ($option->value == $value && JString::trim($option->label)) {
                         return $option->label;
                     }
                 }
         }
     }
     return '';
 }
Example #24
0
 /**
  * Display page with component cpanel.
  * 
  * @param $tpl used template
  * @return void
  */
 public function display($tpl = null)
 {
     $this->addToolbar();
     JoomDOCHelper::setSubmenu(JOOMDOC_JOOMDOC);
     parent::display($tpl);
 }
Example #25
0
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
echo '<div id="joomdocModule" ' . ($moduleConfig->moduleclass_sfx ? 'class="' . htmlspecialchars($moduleConfig->moduleclass_sfx, ENT_QUOTES) . '"' : '') . '><ul>';
$root->initIteration();
while ($root->hasNext()) {
    $item = $root->getNext();
    $access = new JoomDOCAccessHelper($item);
    if ($access->docid && $item->document->published == JOOMDOC_STATE_UNPUBLISHED) {
        // Document is unpublished
        continue;
    }
    $class = '';
    if ($moduleConfig->show_icons) {
        // File mime type icon.
        $class = JoomDOCHelper::getFileIconClass($access->isFile ? $access->relativePath : 'folder', null, 16);
    }
    echo '<li' . ($class ? ' class="icon ' . $class . '"' : '') . '>';
    if ($moduleConfig->link_type == 'detail') {
        $url = JoomDOCRoute::viewDocuments($access->relativePath, $access->alias);
    } elseif ($moduleConfig->link_type == 'download' && $access->canDownload) {
        // download link is displayed only if file can be download in ACL setting
        $url = JoomDOCRoute::download($access->relativePath, $access->alias);
    } else {
        $url = null;
    }
    if ($url) {
        echo '<a href="' . JRoute::_($url) . '" title="">' . ($access->docid ? $item->document->title : $item->getFileName()) . '</a>';
    } else {
        // Name is displayed as document title or file path.
        echo $access->docid ? $item->document->title : $item->getFileName();
Example #26
0
 /**
  * Method to compute the default name of the asset.
  * The default name is in the form `table_name.id`
  * where id is the value of the primary key of the table.
  *
  * @return	string
  * @since	1.6
  */
 protected function _getAssetName()
 {
     return JoomDOCHelper::getDocumentAsset($this->id);
 }