/** * Delete document's (move to trash). * Method expected array cid in request with document's id's. * On end redirect to document's list view. * * @return void */ public function delete() { //parent::delete(); why it was here? JRequest::checkToken() or die(JText::_('JINVALID_TOKEN')); $mainframe = JFactory::getApplication(); /* @var $mainframe JAdministrator */ $cid = JRequest::getVar('cid', array(), '', 'array'); if (!is_array($cid) || !count($cid)) { JError::raiseWarning(500, JText::_('COM_JOOMDOC_ERROR_NO_ITEMS_SELECTED')); } else { $model = $this->getModel(); /* @var $model JoomDOCModelDocument */ JArrayHelper::toInteger($cid); foreach ($cid as $id) { JoomDOCAccessDocument::delete($id) ? $canDelete[] = $id : ($cannotDelete[] = $id); } if (isset($cannotDelete)) { $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_UNABLE_DELETE_DOCUMENTS', implode(',', $cannotDelete)), 'error'); } if (isset($canDelete)) { $mainframe->enqueueMessage(JText::sprintf('COM_JOOMDOC_N_ITEMS_DELETED', $model->trash($canDelete))); } } $this->setRedirect(JoomDOCRoute::viewDocuments()); }
/** * Create new subfolder in current parent folder. * * @return void */ public function newFolder() { $app = JFactory::getApplication(); $success = JoomDOCFileSystem::newFolder(); if ($success && JRequest::getInt('doccreate')) { $this->setRedirect(JoomDOCRoute::addDocument($app->getUserState('com_joomdoc.new.folder'))); } else { $this->setRedirect(JoomDOCRoute::viewDocuments(JoomDOCRequest::getPath(), false)); } }
/** * Rename file/folder. */ public function rename() { $renamePath = JString::trim(JRequest::getString('renamePath')); if (JoomDOCAccessFileSystem::rename(false, $renamePath)) { if ($success = JoomDOCFileSystem::rename($renamePath, JString::trim($newName = JRequest::getString('newName')))) { //if renamed directory, do refresh, else it will appear empty $newPath = ($parentPath = JoomDOCFileSystem::getParentPath($renamePath)) ? $parentPath . DIRECTORY_SEPARATOR . JRequest::getString('newName') : $newName; if (JFolder::exists(JoomDOCFileSystem::getFullPath($newPath))) { $mainfrane = JFactory::getApplication(); $mainfrane->enqueueMessage(JText::sprintf('JOOMDOC_REFRESHED', JoomDOCFileSystem::refresh())); } } $this->setRedirect(JoomDOCRoute::viewDocuments(), JText::_($success ? 'JOOMDOC_RENAME_SUCCESS' : 'JOOMDOC_RENAME_FAILED'), $success ? 'message' : 'error'); } else { JError::raiseError(403, JText::_('JOOMDOC_UNABLE_RENAME')); } }
/** * Set component submenu. * * @param string $view opened view page * @return void */ public static function setSubmenu($view = JOOMDOC_JOOMDOC, $asJ3Sidebar = false) { if ($asJ3Sidebar and JOOMDOC_ISJ3) { //J3: if we want to add own things to sidebar, we need to set up own html grid-12, so build own left submenu, which we will display $object = 'JHtmlSidebar'; } else { //else (if j3), its added to default submenu which is displayed as left sidebar automatically $object = 'JSubMenuHelper'; } $object::addEntry(JText::_('JOOMDOC_CONTROL_PANEL'), JoomDOCRoute::viewJoomDOC(), $view == JOOMDOC_JOOMDOC); $object::addEntry(JText::_('JOOMDOC_DOCUMENTS'), JoomDOCRoute::viewDocuments(), $view == JOOMDOC_DOCUMENTS); $object::addEntry(JText::_('JOOMDOC_LICENSES'), JoomDOCRoute::viewLicenses(), $view == JOOMDOC_LICENSES); if (JFactory::getUser()->authorise('core.managafields', 'com_joomdoc')) { $object::addEntry(JText::_('JOOMDOC_FIELDS'), JoomDOCRoute::viewFields(), $view == JOOMDOC_FIELDS); } $object::addEntry(JText::_('JOOMDOC_UPGRADE'), JoomDOCRoute::viewUpgrade(), $view == JOOMDOC_UPGRADE); $object::addEntry(JText::_('JOOMDOC_MIGRATION'), JoomDOCRoute::viewMigration(), $view == JOOMDOC_MIGRATION); }
/** * Display the button. * * @param string $name field name * @return JObject button settings */ function onDisplay($name) { $doc = JFactory::getDocument(); /* @var $doc JDocumentHTML */ $script[] = '//<![CDATA['; $script[] = 'function jSelectJoomdocDocument(id, title, url) {'; $script[] = ' var tag = \'<a href="\' + url + \'" title="">\' + title + \'</a>\';'; $script[] = ' jInsertEditorText(tag, \'' . addslashes($name) . '\');'; $script[] = ' SqueezeBox.close();'; $script[] = '}'; $script[] = '//]]>'; $script = implode(PHP_EOL, $script); $doc->addScriptDeclaration($script); $button = new JObject(); $button->set('modal', true); $button->set('link', str_replace('&', '&', JoomDOCRoute::modalDocuments(null, true))); $button->set('text', JText::_('PLG_EDITORS-XTD_JOOMDOC_BTN')); $button->set('name', 'file-add'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); $button->set('class', 'btn'); return $button; }
function getObjectInfo($id, $language = null) { $info = new JCommentsObjectInfo(); $routerHelper = JPATH_ROOT . '/administrator/components/com_joomdoc/libraries/joomdoc/application/route.php'; if (is_file($routerHelper)) { require_once JPATH_ROOT . '/administrator/components/com_joomdoc/defines.php'; require_once $routerHelper; $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('a.id, a.title, a.alias, a.access, a.created_by, a.path'); $query->from('#__joomdoc AS a'); $query->where('a.id = ' . (int) $id); $db->setQuery($query); $row = $db->loadObject(); if (!empty($row)) { $slug = $row->alias ? $row->id . ':' . $row->alias : $row->id; $info->title = $row->title; $info->access = $row->access; $info->userid = $row->created_by; $info->link = JRoute::_(JoomDOCRoute::viewDocuments($row->path, false)); } } return $info; }
/** * Get URL to view License Text. * * @param int $id License ID * @param string $alias License Alias * @param string $path Path to File if License has to be confirmed before dovnloading * @return string */ public static function viewLicense($id, $alias, $path = null, $docAlias = null) { $itemID = null; JoomDOCRoute::frontend($path, $docAlias, $itemID); return JRoute::_('index.php?option=' . JOOMDOC_OPTION . '&view=license&id=' . $id . ':' . $alias . '&tmpl=component' . ($path ? '&path=' . JoomDOCString::urlencode($path) : '') . ($itemID ? '&Itemid=' . $itemID : '')); }
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('&', '&', $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()); }
/** * 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())); } }
/** * Delete trashed license's. * * @return void */ public function trash() { if (JoomDOCAccess::licenses()) { $model = $this->getModel(); $count = $model->trash(); $this->setRedirect(JoomDOCRoute::viewLicenses(), JText::sprintf('JOOMDOC_TRASH_EMPTY', $count)); } }
/** * Revert selected Version as last Version. * * @return void */ public function revert() { $path = JoomDOCRequest::getPath(); $result = false; if (JoomDOCAccessFileSystem::manageVersions(false, $path)) { JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $cid = JRequest::getVar('cid', array(), 'default', 'array'); $id = reset($cid); $model = $this->getModel(); $result = $model->revert($id, $path); } $msg = $result ? JText::sprintf('JOOMDOC_REVERT_SUCCESS', $result->revertVersion, $result->newLastVersion, $result->oldLastVersion) : JText::_('JOOMDOC_REVERT_UNSUCCESS'); $type = $result ? 'message' : 'error'; $this->setRedirect(JoomDOCRoute::viewFileInfo($path), $msg, $type); }
/** * Download file by request param path (relative path from doc root). * * @param booelan $saveHits if true increment file download counter * @return void */ public static function download($saveHits = true) { $mainframe = JFactory::getApplication(); /* @var $mainframe JApplication */ $modelDocument = JModelLegacy::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_MODEL_PREFIX); /* @var $modelDocument JoomDOCModelDocument */ $modelFile = JModelLegacy::getInstance(JOOMDOC_FILE, JOOMDOC_MODEL_PREFIX); /* @var $modelFile JoomDOCModelFile */ $config = JoomDOCConfig::getInstance(); $user = JFactory::getUser(); // get file path from request $path = JoomDOCRequest::getPath(); $version = null; // control user access to download file if ($config->documentAccess == 1 && !JoomDOCAccessFileSystem::download(false, $path)) { jexit(JText::_('JOOMDOC_DOWNLOAD_NOT_ALLOWED')); } // get document by file relative path $document = $modelDocument->getItemByPath($path); if ($config->documentAccess == 2 && ($user->id != $document->access || !$document->download)) { jexit(JText::_('JOOMDOC_DOWNLOAD_NOT_ALLOWED')); } $file = $modelFile->getItem($path, $version); $fullPath = JoomDOCFileSystem::getFullPath($path); // open file to reading $content = JFile::read($fullPath); // control file access $fileNotAvailable = !$file || is_null($file->id) || $file->state == JOOMDOC_STATE_TRASHED; $documentUnpublished = $document && $document->id && $document->published == JOOMDOC_STATE_UNPUBLISHED; if ($mainframe->isSite() && $documentUnpublished || !JFile::exists($fullPath) || $content === false || $fileNotAvailable) { // file document unpublish or file doesn't exists or cannot read JError::raiseWarning(404, JText::_('JOOMDOC_FILE_NO_AVAILABLE')); $mainframe->redirect(JoomDOCRoute::viewDocuments()); return; } if ($saveHits) { // save file downloading $modelFile->saveHits($path, 1); } // clean output ob_clean(); // prepare packet head if (function_exists('mime_content_type')) { header('Content-Type: ' . mime_content_type($fullPath) . '; charset=UTF-8'); } else { $ext = JFile::getExt($fullPath); // Open mime types $mimemap['pdf'] = 'application/pdf'; // MS Office mime types $mimemap['doc'] = 'application/msword'; $mimemap['xls'] = 'application/vnd.ms-excel'; $mimemap['ppt'] = 'application/vnd.ms-powerpoint'; // MS Office mime types XML $mimemap['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $mimemap['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $mimemap['pptx'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; // Archives $mimemap['zip'] = 'application/zip'; $mimemap['tar'] = 'application/x-tar'; // Open Office $mimemap['odb'] = 'application/vnd.oasis.opendocument.database'; $mimemap['odc'] = 'application/vnd.oasis.opendocument.chart'; $mimemap['odf'] = 'application/vnd.oasis.opendocument.formula'; $mimemap['odg'] = 'application/vnd.oasis.opendocument.graphics'; $mimemap['odi'] = 'application/vnd.oasis.opendocument.image'; $mimemap['odm'] = 'application/vnd.oasis.opendocument.text-master'; $mimemap['odp'] = 'application/vnd.oasis.opendocument.presentation'; $mimemap['ods'] = 'application/vnd.oasis.opendocument.spreadsheet'; $mimemap['odt'] = 'application/vnd.oasis.opendocument.text'; $mimemap['otg'] = 'application/vnd.oasis.opendocument.graphics-template'; $mimemap['oth'] = 'application/vnd.oasis.opendocument.text-web'; $mimemap['otp'] = 'application/vnd.oasis.opendocument.presentation-template'; $mimemap['ots'] = 'application/vnd.oasis.opendocument.spreadsheet-template'; $mimemap['ott'] = 'application/vnd.oasis.opendocument.text-template'; if (isset($mimemap[$ext])) { header('Content-Type: ' . $mimemap[$ext] . '; charset=UTF-8'); } } header('Content-Transfer-Encoding: 8bit'); header('Content-Disposition: attachment; filename="' . JFile::getName($fullPath) . '";'); $fileSize = @filesize($fullPath); if ($fileSize) { header('Content-Length: ' . $fileSize); } // flush file die($content); }
echo '<th>' . JHtml::_('grid.sort', 'JOOMDOC_UPLOADER', 'name', $this->filter->listDirn, $this->filter->listOrder) . '</th>'; echo '<th>' . JHtml::_('grid.sort', 'JOOMDOC_HITS', 'hits', $this->filter->listDirn, $this->filter->listOrder) . '</th>'; echo '</tr>'; echo '</thead>'; echo '<tbody>'; foreach ($this->data as $i => $item) { echo '<tr class="row' . $i % 2 . '">'; if ($this->access->canManageVersions) { //echo $i.' | '.$item->id.' | '.$item->version.' | '.$this->maxVersion; echo '<td>' . JHtml::_('grid.id', ++$i, $item->id, $item->version == $this->maxVersion) . '</td>'; } 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>';
public function setPathway($path) { $pieces = explode(DIRECTORY_SEPARATOR, $path); foreach ($pieces as $offset => $piece) { $crumbs[] = implode(DIRECTORY_SEPARATOR, array_slice($pieces, 0, $offset + 1)); } if (!empty($crumbs)) { $crumbs = $this->getDbo()->setQuery('SELECT path, title, full_alias FROM #__joomdoc_flat WHERE path IN (' . implode(', ', array_map(array($this->getDBO(), 'quote'), $crumbs)) . ')')->loadObjectList(); $pathway = JFactory::getApplication()->getPathway(); foreach ($crumbs as $crumb) { $pathway->addItem($crumb->title ? $crumb->title : JFile::getName($crumb->path), JoomDOCRoute::viewDocuments($crumb->path), $crumb->full_alias); } } }
} } if ($this->access->canCreate) { echo '<a class="add" href="' . JRoute::_(JoomDOCRoute::add($this->access->relativePath, $this->access->alias)) . '" title="">' . JText::_('JOOMDOC_ADD_DOCUMENT') . '</a>'; } if ($this->access->canEdit) { echo '<a class="edit" href="' . JRoute::_(JoomDOCRoute::edit($this->access->relativePath, $this->access->alias)) . '" title="">' . JText::_('JOOMDOC_EDIT_DOC') . '</a>'; } if ($this->access->canEditState) { if ($this->root->document->state == JOOMDOC_STATE_UNPUBLISHED) { echo '<a class="publish" href="' . JRoute::_(JoomDOCRoute::publish($this->access->relativePath, $this->access->alias)) . '" title="">' . JText::_('JOOMDOC_PUBLISH') . '</a>'; } elseif ($this->root->document->state == JOOMDOC_STATE_PUBLISHED) { echo '<a class="unpublish" href="' . JRoute::_(JoomDOCRoute::unpublish($this->access->relativePath, $this->access->alias)) . '" title="">' . JText::_('JOOMDOC_UNPUBLISH') . '</a>'; } } if ($this->access->canDeleteFile) { echo '<a class="delete" href="javascript:void(0)" onclick="JoomDOC.confirm(\'' . addslashes(JRoute::_(JoomDOCRoute::deletefile($this->access->relativePath, $this->access->alias))) . '\')" title="">' . JText::_('JOOMDOC_DELETE_ITEM') . '</a>'; } if ($this->access->canDeleteDoc) { echo '<a class="deleteDocument" href="javascript:void(0)" onclick="JoomDOC.confirm(\'' . addslashes(JRoute::_(JoomDOCRoute::delete($this->access->relativePath, $this->access->alias))) . '\')" title="">' . JText::_('JOOMDOC_DELETE_DOCUMENT') . '</a>'; } echo '<div class="clr"></div>'; echo '</div>'; } } echo '<input type="hidden" id="joomdocToken" name="' . JSession::getFormToken() . '" value="1" />'; echo '</div>'; echo '</form>'; if ($this->access->canWebDav) { JoomDOCWebDav::add(); }
<?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>'; }
$js[] = ' // others task are for version table'; $js[] = ' document.versionForm.submit();'; $js[] = ' }'; $js[] = ' if (typeof document.adminForm.onsubmit == "function") {'; $js[] = ' document.adminForm.onsubmit();'; $js[] = ' }'; $js[] = ' if (pressbutton) {'; $js[] = ' // toolbar work with document edit form'; $js[] = ' document.adminForm.submit();'; $js[] = ' }'; $js[] = '}'; $document->addScriptDeclaration(PHP_EOL . implode(PHP_EOL, $js) . PHP_EOL); require_once JOOMDOC_ADMINISTRATOR . '/libraries/joomdoc/html/joomdoc.php'; echo JHtmlJoomDOC::startTabs('tabone', 'details'); echo JHtmlJoomDOC::addTab('JOOMDOC_DOCUMENT_DETAILS', 'details', 'tabone'); echo '<form action="' . JRoute::_(JoomDOCRoute::saveDocument($this->document->id)) . '" method="post" name="adminForm" id="item-form" class="form-validate">'; echo '<div class="fltlft col" style="width:60%">'; echo '<fieldset class="adminform">'; echo '<legend>' . JText::_('JOOMDOC_DOCUMENT') . '</legend>'; echo '<table class="admintable">'; echo '<tr><td class="key">' . $this->form->getLabel('title') . '</td>'; echo '<td>' . $this->form->getInput('title') . '</td></tr>'; echo '<tr><td class="key">' . $this->form->getLabel('alias') . '</td>'; echo '<td>' . $this->form->getInput('alias') . '</td></tr>'; echo '<tr><td class="key">' . $this->form->getLabel('state') . '</td>'; echo '<td>' . $this->form->getInput('state') . '</td></tr>'; echo '<tr><td class="key">' . $this->form->getLabel('favorite') . '</td>'; echo '<td>' . $this->form->getInput('favorite') . '</td></tr>'; echo '<tr><td class="key">' . $this->form->getLabel('access') . '</td>'; echo '<td>' . $this->form->getInput('access') . '</td></tr>'; if ($this->form->getField('download')) {
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>'; if ($this->license->id) { echo '<div class="fltlft col">'; require_once JOOMDOC_ADMINISTRATOR . '/libraries/joomdoc/html/joomdoc.php'; echo JHtmlJoomDOC::startSliders('license', 'publishing'); echo JHtmlJoomDOC::addSlide('license', 'JOOMDOC_PUBLISHING', 'publishing'); echo '<fieldset class="panelform"><table class="admintable">';
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { if (!JString::trim($text) || is_array($areas) && !array_intersect($areas, array_keys(plgSearchJoomDOC::onContentSearchAreas()))) { return array(); } // import component JoomDOC framework $jdcAdm = JPATH_ADMINISTRATOR . '/components/com_joomdoc/'; $jdcSit = JPATH_SITE . '/components/com_joomdoc/'; $jdcLib = $jdcAdm . 'libraries/joomdoc/'; $includes['JoomDOCRoute'] = $jdcLib . 'application/route.php'; $includes['JoomDOCMenu'] = $jdcLib . 'application/menu.php'; $includes['JoomDOCConfig'] = $jdcLib . 'application/config.php'; $includes['JoomDOCFileSystem'] = $jdcLib . 'filesystem/filesystem.php'; $includes['JoomDOCString'] = $jdcLib . 'utilities/string.php'; $includes['JoomDOCHelper'] = $jdcLib . 'utilities/helper.php'; $includes['JoomDOCModelList'] = $jdcLib . 'application/component/modellist.php'; $includes[] = $jdcAdm . 'defines.php'; foreach ($includes as $classname => $include) { $include = JPath::clean($include); if (!JFile::exists($include)) { // JoomDOC is propably uninstalled or corupted return array(); } is_string($classname) ? JLoader::register($classname, $include) : (include_once $include); } JModelLegacy::addIncludePath(JPath::clean($jdcAdm . 'models')); JTable::addIncludePath(JPath::clean($jdcAdm . 'tables')); $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); // prepare SQL WHERE criteria $wheres = array(); // according to type of searching switch ($phrase) { case 'exact': // exactly phrase $keywords = $db->q('%' . JString::strtolower(JString::trim($text)) . '%'); $items[] = 'LOWER(`document`.`title`) LIKE ' . $keywords; $items[] = 'LOWER(`document`.`description`) LIKE ' . $keywords; $items[] = 'LOWER(`document`.`path`) LIKE ' . $keywords; $items[] = 'LOWER(`document`.`content`) LIKE ' . $keywords; $where[] = '(' . implode(') OR (', $items) . ') '; break; case 'all': case 'any': default: // all words or any word or default $keywords = explode(' ', $text); // split to words $wheres = array(); // search for each word foreach ($keywords as $keyword) { $keyword = JString::trim($keyword); if ($keyword) { $keyword = $db->q('%' . JString::strtolower($keyword) . '%'); $items[] = 'LOWER(`document`.`title`) LIKE ' . $keyword; $items[] = 'LOWER(`document`.`description`) LIKE ' . $keyword; $items[] = 'LOWER(`document`.`path`) LIKE ' . $keyword; $items[] = 'LOWER(`document`.`content`) LIKE ' . $keyword; $parts[] = implode(' OR ', $items); } } if (isset($parts)) { if ($phrase == 'all') { $where[] = '(' . implode(') AND (', $parts) . ') '; } else { $where[] = '(' . implode(') OR (', $parts) . ') '; } } break; } $where[] = '(' . JoomDOCModelList::getDocumentPublished() . ')'; $where = ' WHERE ' . implode(' AND ', $where) . ' '; // prepare SQL ORDER BY criteria switch ($ordering) { case 'oldest': // oldest items first (oldest documents created or oldest file uploaded) $order = ' ORDER BY `document`.`created` ASC, `document`.`upload` ASC '; break; case 'popular': // most hits items first $order = ' ORDER BY `document`.`hits` DESC, `document`.`title` ASC, `document`.`path` ASC '; break; case 'alpha': // alphabetically (document title or file name) $order = ' ORDER BY `document`.`title` ASC, `document`.`path` ASC '; break; case 'category': // by parent folder (parent folder name or document title) $order = ' ORDER BY `parent`.`title` ASC, `parent`.`path` ASC '; break; case 'newest': default: // newest items first (newest documents created or file uploaded) $order = ' ORDER BY `document`.`created` DESC, `document`.`upload` DESC '; break; } $query = 'SELECT `document`.`title`,`document`.`path`, '; $query .= '`document`.`description`, `document`.`content`, '; $query .= '`document`.`created`,`document`.`upload`, '; $query .= '`parent`.`title` AS `ptitle`, '; // document folder title $query .= '`document`.`full_alias` '; $query .= 'FROM `#__joomdoc_flat` AS `document` '; $query .= 'LEFT JOIN `#__joomdoc_flat` AS `parent` ON `document`.`parent_path` = `parent`.`path` '; // document folder $query .= $where . ' GROUP BY `document`.`path` ' . $order; $rows = $db->setQuery($query)->loadObjectList(); foreach ($rows as $row) { $GLOBALS['joomDOCPath'] = $row->path; $row->title = JString::trim($row->title) ? $row->title : JFile::getName($row->path); $row->text = JString::trim($row->description) ? $row->description : $row->content; $row->created = $row->created == $nullDate ? $row->upload : $row->created; $row->section = JString::trim($row->ptitle) ? $row->ptitle : JoomDOCFileSystem::getParentPath($row->path); if ($this->params->get('document_link', 1) == 1) { $row->href = JRoute::_(JoomDOCRoute::viewDocuments($row->path, empty($row->full_alias) ? $row->path : $row->full_alias)); } else { $row->href = JRoute::_(JoomDOCRoute::download($row->path, empty($row->full_alias) ? $row->path : $row->full_alias)); } $row->browsernav = 2; // open document title in the same window } unset($GLOBALS['joomDOCPath']); return $rows; }
$name = $access->isTrashed ? JText::sprintf('JOOMDOC_TRASHED_ITEM', $access->name) : $access->name; if ($access->isFolder) { $size = $access->isFolder ? '-' : $item->getFileSize(); $update = isset($item->upload) ? JoomDOCHelper::uploaded($item->upload, false) : ''; $of = JText::_('JOOMDOC_DOCUMENTS_OPEN_FOLDER'); if ($access->canEnterFolder && !$access->isTrashed) { echo '<a onclick="JoomDOC.checkCheckBox(cb' . $i . ');JoomDOC.check(cb' . $i . ',' . $i . ');" style="display: block; width: 140px; height: 90px; text-align: center;" class="hasTip folder-big dblc" href="' . JRoute::_(JoomDOCRoute::viewDocuments($access->relativePath)) . '" title="' . $this->getTooltip($access->relativePath, $of . '<br />' . $update . '/' . $size) . '"><span style="float: left; clear: both; display: inline-block; margin-top: 53px; width: 100%;">' . $access->name . '</span></a>'; } else { echo '<a class="folder noLink" href="javascript:void(0)" title="">' . $name . '</a>'; } } else { if ($access->canDownload && !$access->isTrashed) { $size = $access->isFolder ? '-' : $item->getFileSize(); $update = isset($item->upload) ? JoomDOCHelper::uploaded($item->upload, false) : ''; $of = JText::_('JOOMDOC_DOWNLOAD_FILE'); echo '<a onclick="JoomDOC.checkCheckBox(cb' . $i . ');JoomDOC.check(cb' . $i . ',' . $i . ');" style="display: block; width: 140px; height: 90px; padding: 0px; text-align: center;" href="' . JRoute::_(JoomDOCRoute::download($access->relativePath)) . '" class="hasTip dblc file ico-big-' . $access->fileType . '" title="' . $this->getTooltip($access->relativePath, $of . '<br />' . $update . '/' . $size) . '"><span style="float: left; clear: both; display: inline-block; margin-top: 53px; width: 100%;">' . $access->name . '</span></a>'; } else { echo '<a href="javascript:void(0)" class="file noLink" title="">' . $name . '</a>'; } } /*if ($access->canRename && !$access->isTrashed) { echo '<div class="rename blind" style="width: 302px; padding: 5px 5px 0px; background: none repeat scroll 0px 0px rgb(255, 255, 255);">'; echo '<input class="pull-left" style="position: relative; width: 165px;" type="text" name="rename" value="' . $this->escape($access->name) . '" />'; //echo '<div class="btn-group pull-left">'; echo '<button class="btn" style="position: relative;" onclick="return JoomDOC.rename(this, \'' . addslashes(JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_RENAME)) . '\', \'' . addslashes($access->name) . '\', \'' . addslashes($access->relativePath) . '\',\'' . JText::_('JOOMDOC_RENAME_SAME_NAME', true) . '\',\'' . JText::_('JOOMDOC_RENAME_EMPTY_NAME', true) . '\', \'' . JText::_('JOOMDOC_RENAME_FILE_EXISTS', true) . '\', \'' . JText::_('JOOMDOC_RENAME_DIR_EXISTS', true) . '\')">' . JText::_('JOOMDOC_RENAME_SAVE') . '</button>'; echo '<button class="btn" style="position: relative;" onclick="return JoomDOC.closeRename(this, \'' . addslashes($access->name) . '\')">' . JText::_('JOOMDOC_RENAME_CLOSE') . '</button>'; //echo '</div>'; echo '</div>'; }*/ /*if ($access->isTrashed && $access->canUntrash) {
/** * Reset operation from clipboard. */ public function reset() { JoomDOCFileSystem::resetOperation(); $this->setRedirect(JoomDOCRoute::viewDocuments(JoomDOCRequest::getPath(), false)); }
/** * Reset operation from clipboard. */ public function reset() { JoomDOCFileSystem::resetOperation(); $this->setRedirect(JoomDOCRoute::viewDocuments()); }
echo '<th>' . JHtml::_('grid.sort', 'JOOMDOC_TITLE', 'lcs.title', $listDirn, $listOrder) . '</th>'; echo '<th width="5%">' . JHtml::_('grid.sort', 'JSTATUS', 'lcs.state', $listDirn, $listOrder) . '</th>'; echo '<th width="5%">' . JHtml::_('grid.sort', 'JOOMDOC_DEFAULT', 'lcs.default', $listDirn, $listOrder) . '</th>'; echo '<th width="8%">' . JHtml::_('grid.sort', 'JGRID_HEADING_CREATED_BY', 'lcs.created_by', $listDirn, $listOrder) . '</th>'; echo '<th width="7%">' . JHtml::_('grid.sort', 'JDATE', 'lcs..created', $listDirn, $listOrder) . '</th>'; echo '<th width="1%">' . JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'lcs.id', $listDirn, $listOrder) . '</th>'; echo '</tr></thead>'; echo '<tfoot><tr><td colspan="20">' . $this->pagination->getListFooter() . '</td></tr></tfoot><tbody>'; $canManage = JoomDOCAccess::licenses(); $dateFormat = JText::_('DATE_FORMAT_LC4'); foreach ($this->licenses as $i => $license) { echo '<tr class="row' . $i % 2 . '">'; echo '<td class="center">'; echo $license->checked_out ? JHtml::_('jgrid.checkedout', $i, $license->editor, $license->checked_out_time, JOOMDOC_LICENSES . '.', $canManage) : JHtml::_('grid.id', $i, $license->id); echo '</td>'; echo '<td><a href="' . JRoute::_(JoomDOCRoute::editLicense($license->id)) . '" title="">' . $license->title . '</a></td>'; echo '<td class="center" align="center">'; echo JHtml::_('jgrid.published', $license->state, $i, JOOMDOC_LICENSES . '.', $canManage, 'cb'); echo '</td>'; echo '<td class="center" align="center">' . JHtml::_('joomdoc.defaults', $license->default, $i, JOOMDOC_LICENSES, $canManage) . '</td>'; echo '<td nowrap="nowrap">' . $license->creator . '</td>'; echo '<td nowrap="nowrap">' . JHtml::_('date', $license->created, $dateFormat) . '</td>'; echo '<td>' . $license->id . '</td>'; echo '</tr>'; } if (!$this->pagination->total) { echo '<tr><td colspan="20">' . JText::_('JOOMDOC_NO_LICENSES') . '</td></tr>'; } echo '</tbody></table>'; echo '<input type="hidden" name="task" value="" /><input type="hidden" name="boxchecked" value="" />'; echo '<input type="hidden" name="filter_order" value="' . $listOrder . '" /><input type="hidden" name="filter_order_Dir" value="' . $listDirn . '" />';
/** * Filter folder list for frontend (published, ACL etc) * * @param JoomDOCFolder $root * @param string $parent * @return array */ public static function folders($root, $parent) { $folders = array(); $root->initIteration(); $parents = array(JoomDOCFileSystem::getRelativePath($parent)); while ($root->hasNext()) { $item = $root->getNext(); $access = new JoomDOCAccessHelper($item); $itemParent = JoomDOCFileSystem::getParentPath($access->relativePath); if (!(empty($itemParent) || in_array($itemParent, $parents))) { // parent has to be visible continue; } if ($access->docid && $item->document->published == JOOMDOC_STATE_UNPUBLISHED) { // item has to published continue; } $folder = new JObject(); // prepare data for MooTree $folder->set('ident', $access->relativePath); $folder->set('route', JoomDOCRoute::viewDocuments($access->relativePath, $access->alias)); $folder->set('title', $access->docid ? $item->document->title : $item->getFileName()); $folder->set('entry', $access->canEnterFolder); $folders[] = $folder; $parents[] = $access->relativePath; // save into visible parents } return $folders; }
$i = 0; while ($this->root->hasNext()) { $item = $this->root->getNext(); $access = new JoomDOCAccessHelper($item); echo '<tr class="row' . $i % 2 . '">'; echo '<td>'; // backspashes doing bad in js pass $id = str_replace(DIRECTORY_SEPARATOR, '/', $this->escape($access->relativePath)); $title = $this->escape($access->docid ? $item->document->title : str_replace(DIRECTORY_SEPARATOR, '/', $access->relativePath)); $url = JRoute::_($linkType == JOOMDOC_LINK_TYPE_DOWNLOAD && $access->isFile ? JoomDOCRoute::download(str_replace(DIRECTORY_SEPARATOR, '/', $access->relativePath), $access->alias) : JoomDOCRoute::viewDocuments(str_replace(DIRECTORY_SEPARATOR, '/', $access->relativePath), $access->alias)); if (JString::strpos($url, $prefix) === 0) { $url = JString::substr($url, $prefixLength); } echo '<a href="javascript:window.parent.jSelectJoomdocDocument(\'' . addslashes(JoomDOCString::dsEncode($id)) . '\', \'' . addslashes($title) . '\', \'' . addslashes($url) . '\')" class="hasTip addDocument" title="' . $this->getTooltip('JOOMDOC_SET_DOCUMENT') . '"></a>'; if ($access->isFolder) { echo '<a class="hasTip folder" href="' . JRoute::_(JoomDOCRoute::modalDocuments($access->relativePath, $useLinkType, $addSymLink, $symLinkSource)) . '" title="' . $this->getTooltip($access->relativePath, 'JOOMDOC_DOCUMENTS_OPEN_FOLDER') . '">' . $this->escape($access->name) . '</a>'; } else { echo '<span class="file">' . $this->escape($access->name) . '</span>'; } echo '</td>'; echo '<td>' . ($access->docid ? $this->escape($item->document->title) : '-') . '</td>'; echo '</tr>'; $i++; } if ($i === 0) { echo '<tr><td>This folder contains no items.</td></tr>'; } else { echo ''; } echo '</tbody>'; echo '</table>';
/** * @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; ?> <div id="joomdocSearch" class="<?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?> "> <form name="mod_joomdoc_search_form" method="post" action="<?php echo JRoute::_(JoomDOCRoute::viewDocuments()); ?> " onsubmit="JoomDOCSearch.submit()"> <div class="input-append"> <input type="text" name="mod_joomdoc_search" id="mod_joomdoc_search" value="" class="input-small" /> <button class="btn btn-primary"><?php echo JText::_('JOOMDOC_SEARCH_SUBMIT'); ?> </button> </div> <input type="hidden" name="joomdoc_search" value="1" /> <?php foreach ($fields as $field) { ?> <input type="hidden" name="<?php echo $field;
echo '<img src="' . JOOMDOC_IMAGES . 'icon-48-migration.png" alt="" />'; echo '<span>' . JText::_('JOOMDOC_MIGRATION') . '</span>'; echo '</a>'; echo '</div>'; echo '</div>'; echo JHtmlJoomDOC::endTab(); echo JHtmlJoomDOC::addTab('COM_DOC_HANDS', 'help', 'doc-cpanel-tabs'); echo '<div class="icon-wrapper" style="float: left">'; echo '<div class="hasTip icon" title="' . $this->getTooltip('JOOMDOC_CHANGELOG') . '">'; echo '<a href="' . JRoute::_(JoomDOCRoute::viewChangelog()) . '" title="" >'; echo '<img src="' . JOOMDOC_IMAGES . 'icon-48-changelog.png" alt="" />'; echo '<span>' . JText::_('JOOMDOC_CHANGELOG') . '</span>'; echo '</a>'; echo '</div>'; echo '<div class="hasTip icon" title="' . $this->getTooltip('JOOMDOC_SUPPORT') . '">'; echo '<a href="' . JRoute::_(JoomDOCRoute::viewSupport()) . '" title="" >'; echo '<img src="' . JOOMDOC_IMAGES . 'icon-48-help_header.png" alt="" />'; echo '<span>' . JText::_('JOOMDOC_SUPPORT') . '</span>'; echo '</a>'; echo '</div>'; echo '</div>'; echo JHtmlJoomDOC::endTab(); echo JHtmlJoomDOC::endTabs(); echo '</div>'; echo '</div>'; ?> <div class="doc-width-40 fltrt"> <?php echo JHtmlJoomDOC::startSliders('doc-info-pane', 'info-panel');
$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(); } if ($moduleConfig->show_filesize) { echo '<strong>' . JText::sprintf('JOOMDOC_MODULE_FILESIZE', JoomDOCFileSystem::getFileSize($access->absolutePath)) . '</strong>'; } if ($moduleConfig->show_listfields) { echo '<table class="fields"><tbody>'; foreach ($listFields as $field) {
* @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 */ // no direct access defined('_JEXEC') or die; JHtml::_('behavior.multiselect'); $user = JFactory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; ?> <form action="<?php echo JRoute::_(JoomDOCRoute::viewFields()); ?> " method="post" name="adminForm" id="adminForm"> <fieldset id="filter-bar" class="btn-toolbar filter-bar"> <div class="filter-search fltlft btn-group pull-left input-append"> <?php if (!JOOMDOC_ISJ3) { ?> <label class="filter-search-lbl" for="filter_search"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?> </label> <?php } ?> <input type="text" name="filter_search" id="filter_search" value="<?php