Skip to content

Commit

Permalink
5.1.5 (#92)
Browse files Browse the repository at this point in the history
* Added list and listitem role attributes for frontens lists as required by ARIA accessibility rules

* Update README.md

* Restored frontend backlink

* Minor fixes

* Source code adapted in according to JED rules
  • Loading branch information
gmansillo authored Apr 4, 2018
1 parent f936da4 commit e442412
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ The code in this project is licensed under the **GNU General Public License v3.0

All bugs, feature requests, pull requests, feedback, etc., are welcome. If you encountered an error, [create an issue](https://github.com/gmansillo/simple/issues/new).

If you liked Simple File Manager or you found it useful for your purposes, you can help me rating it on the <a href="https://extensions.joomla.org/extension/simple-file-manager/">Joomla! Extension Directory</a> :heart:
If you liked Simple File Manager or you found it useful for your purposes, you can help me rating it on the <a href="https://extensions.joomla.org/extension/simple-file-manager/">Joomla! Extension Directory</a> :heart:
9 changes: 3 additions & 6 deletions admin/controllers/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public function save($key = null, $urlVar = null) {
jimport('joomla.filesystem.file');
jimport('joomla.utilities.date');

define('DS', DIRECTORY_SEPARATOR);

// Load data
$input = JFactory::getApplication()->input;
$this->form = $input->post->get('jform', null, 'RAW');
Expand All @@ -45,8 +43,7 @@ public function save($key = null, $urlVar = null) {
$uploadFieldName = $isNew ? "select_file" : "replace_file";

if ($isNew && !$this->files[$uploadFieldName]["size"]) {
JError::raiseError(403, JText::_('COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE'));
return;
throw new Exception(JText::_('COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE'), 403);
}

// File management
Expand All @@ -58,7 +55,7 @@ public function save($key = null, $urlVar = null) {

// Upload file
$file_name = $this->files[$uploadFieldName]["name"];
$dest = JPATH_COMPONENT_ADMINISTRATOR . DS . "uploads" . DS . uniqid("", true) . DS . JFile::makeSafe(JFile::getName($file_name));
$dest = JPATH_COMPONENT_ADMINISTRATOR . "/uploads/" . uniqid("", true) . "/". JFile::makeSafe(JFile::getName($file_name));
$upload = JFile::upload($this->files[$uploadFieldName]["tmp_name"], $dest) ? $dest : false;

if (!$upload || $this->form["file_name"] == $upload) {
Expand Down Expand Up @@ -94,7 +91,7 @@ public function save($key = null, $urlVar = null) {
$this->form["state"] = 0;
}

// Save data back to the $_POST global variable
// Save data back to the POST global variable
JFactory::getApplication()->input->post->set('jform', $this->form);

parent::save($key, $urlVar);
Expand Down
2 changes: 1 addition & 1 deletion admin/language/en-GB/en-GB.com_simplefilemanager.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COM_SIMPLEFILEMANAGER_MENU = "Simple File Manager"
COM_SIMPLEFILEMANAGER_MENU_DOCUMENTS = "Documents"
COM_SIMPLEFILEMANAGER_MENU_CATEGORIES = "Categories"
COM_SIMPLEFILEMANAGER_PREFLIGHT_VERSION_ERROR = "Cannot install Simple File Manager %s in a Joomla! release prior to <b>%s</b> (current version: <b>%s</b>). Please update Joomla! and retry."
COM_SIMPLEFILEMANAGER_INSTALL_TEXT = "<h1>Awesome!</h1><p>Now you are ready to create beautiful download centers. <br/ ><b>Please remember:</b> you can manage your documents in <b>Components > Simple File Manager > Documents.</b></p> <p><a href='./index.php?option=com_simplefilemanager' class='button btn btn-default'><i class='icon icon-archive'></i> Manage documents</a> <a href='https://extensions.joomla.org/extension/simple-file-manager/' class='button btn btn-default' target="_blank"><i class='icon icon-heart'></i> Rate this extension</a> <br><br></p>"
COM_SIMPLEFILEMANAGER_INSTALL_TEXT = "<h1>Awesome!</h1><p class='lead'>Now you are ready to create beautiful download centers. </p> <p><a href='./index.php?option=com_simplefilemanager' class='button btn btn-default'><i class='icon icon-archive'></i> Manage documents</a> <a href='https://extensions.joomla.org/extension/simple-file-manager/' class='button btn btn-default' target="_blank"><i class='icon icon-heart'></i> Rate this extension</a> <br><br></p>"

[Frontend views]
COM_SIMPLEFILEMANAGER_CATEGORIES_VIEW_DEFAULT_DESC = "Shows a list of document categories within a category."
Expand Down
2 changes: 1 addition & 1 deletion admin/language/it-IT/it-IT.com_simplefilemanager.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COM_SIMPLEFILEMANAGER_MENU = "Simple File Manager"
COM_SIMPLEFILEMANAGER_MENU_DOCUMENTS = "Documenti"
COM_SIMPLEFILEMANAGER_MENU_CATEGORIES = "Categorie"
COM_SIMPLEFILEMANAGER_PREFLIGHT_VERSION_ERROR = "Impossibile installare Simple File Manager %s in una versione di Joomla! precedente alla <b>%s</b> (versione attuale: <b>%s</b>). Per favore aggiorna Joomla! e prova nuovamente."
COM_SIMPLEFILEMANAGER_INSTALL_TEXT = "<h1>Fantastico!</h1><p>Ora sei pronto per creare magnifiche aree download. <br/ ><b>Ricorda:</b> puoi gestire i tuoi documenti da <b>Componenti > Simple File Manager > Documenti.</b></p> <p><a href='./index.php?option=com_simplefilemanager' class='button btn btn-default'><i class='icon icon-archive'></i> Gestisci documenti</a> <a href='https://extensions.joomla.org/extension/simple-file-manager/' class='button btn btn-default' target="_blank"><i class='icon icon-heart'></i> > Valuta questa estensione </a> <br><br></p>"
COM_SIMPLEFILEMANAGER_INSTALL_TEXT = "<h1>Fantastico!</h1><p class='lead'>Ora sei pronto per creare magnifiche aree download. </p> <p><a href='./index.php?option=com_simplefilemanager' class='button btn btn-default'><i class='icon icon-archive'></i> Gestisci documenti</a> <a href='https://extensions.joomla.org/extension/simple-file-manager/' class='button btn btn-default' target="_blank"><i class='icon icon-heart'></i> > Valuta questa estensione </a> <br><br></p>"

[Frontend views]
COM_SIMPLEFILEMANAGER_CATEGORIES_VIEW_DEFAULT_DESC = "Mostra una lista di categorie di documenti all'interno di una categoria."
Expand Down
3 changes: 1 addition & 2 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function preflight($type, $parent) {
// abort if the current Joomla release is older
if (version_compare($jversion->getShortVersion(), $minimum_joomla_release, 'lt')) {
$errorMessage = sprintf(JText::_('COM_SIMPLEFILEMANAGER_PREFLIGHT_VERSION_ERROR'), $current_simple_version, $minimum_joomla_release, $jversion->getShortVersion());
Jerror::raiseWarning(null, $errorMessage);

JFactory::getApplication()->enqueueMessage($errorMessage, 'warning');
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion simplefilemanager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 3 or later</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://www.simplefilemanager.eu</authorUrl>
<version>5.1.4</version>
<version>5.1.5</version>
<description><![CDATA[]]></description>
<scriptfile>script.php</scriptfile>
<install>
Expand Down
11 changes: 3 additions & 8 deletions site/controllers/documentform.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
require_once(JPATH_COMPONENT_ADMINISTRATOR . '/helpers/simplefilemanager.php');
require_once JPATH_COMPONENT . '/controller.php';

define('DS', DIRECTORY_SEPARATOR);

/**
* Simplefilemanager controller class.
*/
Expand Down Expand Up @@ -72,9 +70,7 @@ public function save() {
// Validate the posted data.
$form = $model->getForm();
if (!$form) {
JError::raiseError(500, $model->getError());

return false;
throw new Exception($model->getError(), 500);
}

// Validate the posted data.
Expand Down Expand Up @@ -162,8 +158,7 @@ protected function prepareDataBeforeSave(&$data, $files) {

if ($files["select_file"]["size"] <= 0) {
if ($isNew) {
JError::raiseError(403, JText::_('COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE'));
return;
throw new Exception(JText::_('COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE'), 503);
}
} else {

Expand All @@ -176,7 +171,7 @@ protected function prepareDataBeforeSave(&$data, $files) {
// TODO: Implement file extension check
// File upload
$file_name = $files["select_file"]["name"];
$dest = JPATH_COMPONENT_ADMINISTRATOR . DS . "uploads" . DS . uniqid("", true) . DS . JFile::makeSafe(JFile::getName($file_name));
$dest = JPATH_COMPONENT_ADMINISTRATOR . "/uploads/" . uniqid("", true) . "/". JFile::makeSafe(JFile::getName($file_name));
$data["file_name"] = JFile::upload($files["select_file"]["tmp_name"], $dest) ? $dest : false;

if (!$data["file_name"]) {
Expand Down
2 changes: 1 addition & 1 deletion site/language/en-GB/en-GB.com_simplefilemanager.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COM_SIMPLEFILEMANAGER_VISIBILITY_4_GROUP = "Selected groups"
COM_SIMPLEFILEMANAGER_VISIBILITY_5_AUTHOR = "Author"

[Messages]
COM_SIMPLEFILEMANAGER_CREDITS = "Powered by <a target='_blank' href='http://www.simplefilemanager.eu/'>Simple</a>"
COM_SIMPLEFILEMANAGER_CREDITS = "<small>Powered by <a target='_blank' href='http://www.simplefilemanager.eu/'>Simple</a></small>"
COM_SIMPLEFILEMANAGER_NO_DOCUMENTS = "No document found."
COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND = "Document not found."
COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE = "You forgot to select a file or there was an issue during file upload."
Expand Down
2 changes: 1 addition & 1 deletion site/language/it-IT/it-IT.com_simplefilemanager.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COM_SIMPLEFILEMANAGER_VISIBILITY_4_GROUP = "Gruppi selezionati"
COM_SIMPLEFILEMANAGER_VISIBILITY_5_AUTHOR = "Autore"

[Messages]
COM_SIMPLEFILEMANAGER_CREDITS = "Powered by <a target='_blank' href='http://www.simplefilemanager.eu/'>Simple</a>"
COM_SIMPLEFILEMANAGER_CREDITS = "<small>Powered by <a target='_blank' href='http://www.simplefilemanager.eu/'>Simple</a></small>"
COM_SIMPLEFILEMANAGER_NO_DOCUMENTS = "Nessun documento trovato."
COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND = "Documento non trovato."
COM_SIMPLEFILEMANAGER_NO_FILE_ERROR_MESSAGE = "Hai dimenticato di selezionare un file o si &egrave; verificato un errore durante l'upload."
Expand Down
4 changes: 2 additions & 2 deletions site/models/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ public function &getItem($pk = null) {
$data = $db->loadObject();

if (empty($data)) {
JError::raiseError(404, JText::_('COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND'));
throw new Exception(JText::_('COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND'), 404);
}

// Process document icon
SimplefilemanagerHelper::processDocumentIcon($data);

// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived))) {
JError::raiseError(404, JText::_('COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND'));
throw new Exception(JText::_('COM_SIMPLEFILEMANAGER_ERROR_DOCUMENT_NOT_FOUND'), 404);
}

/**
Expand Down
10 changes: 3 additions & 7 deletions site/models/documentform.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ public function save($data) {
}

if ($authorised !== true) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));

return false;
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

$table = $this->getTable();
Expand All @@ -146,9 +144,7 @@ public function save($data) {
function delete($data) {
$id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('document.id');
if (JFactory::getUser()->authorise('core.delete', 'com_simplefilemanager') !== true) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));

return false;
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

$table = $this->getTable();
Expand Down Expand Up @@ -231,7 +227,7 @@ public function &getData($id = null) {
}

if (!$canEdit) {
JError::raiseError('500', JText::_('JERROR_ALERTNOAUTHOR'));
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

// Check published state.
Expand Down
3 changes: 2 additions & 1 deletion site/views/categories/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
});
});");
?>
<div class="categories-list<?php echo $this->pageclass_sfx; ?>">
<div class="categories-list<?php echo $this->pageclass_sfx; ?>" role="list">
<?php
echo JLayoutHelper::render('joomla.content.categories_default', $this);
echo $this->loadTemplate('items');
echo JText::_('COM_SIMPLEFILEMANAGER_CREDITS');
?>
</div>
5 changes: 3 additions & 2 deletions site/views/categories/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$class = ' class="last"';
}
?>
<div <?php echo $class; ?> >
<div <?php echo $class; ?> role="listitem">
<?php $class = ''; ?>
<h3 class="page-header item-title">
<a href="<?php echo JRoute::_(SimplefilemanagerHelperRoute::getCategoryRoute($item->id, $item->language)); ?>">
Expand Down Expand Up @@ -55,4 +55,5 @@
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?><?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
1 change: 1 addition & 0 deletions site/views/category/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

$this->subtemplatename = 'items';
echo JLayoutHelper::render('joomla.content.category_default', $this);
echo JText::_('COM_SIMPLEFILEMANAGER_CREDITS');
6 changes: 3 additions & 3 deletions site/views/category/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ function tableOrdering(order, dir, task)
};
</script>

<ul class="category row-striped">
<ul class="category row-striped" role="list">
<?php foreach ($this->items as $i => $item) : ?>

<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<li class="row-fluid system-unpublished cat-list-row<?php echo $i % 2; ?>">
<li class="row-fluid system-unpublished cat-list-row<?php echo $i % 2; ?>" role="listitem" >
<?php else : ?>
<li class="row-fluid cat-list-row<?php echo $i % 2; ?>" >
<li class="row-fluid cat-list-row<?php echo $i % 2; ?>" role="listitem" >
<?php endif; ?>

<?php if ($this->params->get('category_show_document_icon') == 1): ?>
Expand Down
2 changes: 2 additions & 0 deletions site/views/document/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@
<a href="<?php echo $downloadLink; ?>" class="btn btn-default"><?php echo JText::_('COM_SIMPLEFILEMANAGER_DOWNLOAD_BUTTON') ?></a>

<?php echo $this->item->event->afterDisplayContent; ?>

<?php echo JText::_('COM_SIMPLEFILEMANAGER_CREDITS'); ?>
</div>
4 changes: 1 addition & 3 deletions site/views/document/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public function display($tpl = null) {

// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));

return false;
throw new Exception(implode("\n", $errors), 500);
}

// Check if access is not public
Expand Down
4 changes: 1 addition & 3 deletions site/views/document/view.raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public function display($tpl = null) {

// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));

return false;
throw new Exception(implode("\n", $errors), 500);
}

JFactory::getDocument()->setMimeEncoding('application/octet-stream', true);
Expand Down
3 changes: 3 additions & 0 deletions site/views/documentform/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ class="form-validate"
<input type="hidden" name="task" value="documentform.save"/>
<?php echo JHtml::_('form.token'); ?>
</form>

<?php echo JText::_('COM_SIMPLEFILEMANAGER_CREDITS'); ?>

</div>

0 comments on commit e442412

Please sign in to comment.