Commit 8bbd36ec by Dirk Benkert

fixed #2 and #3

parent 31a57c45
......@@ -60,6 +60,16 @@ class Module {
$em = $e->getApplication()->getEventManager();
$em->attach(\Zend\Mvc\MvcEvent::EVENT_ROUTE, array($this, 'checkAcl'));
$em->attach(\Zend\Mvc\MvcEvent::EVENT_ROUTE, array($this, 'initLocale'));
$em->attach(
'dispatch',
function($e) {
$request = $e->getRequest();
$viewModel = $e->getViewModel();
$viewModel->setVariable('requestParams', $request->getQuery()->toArray());
},
-100
);
}
public function getConfig() {
......
......@@ -131,7 +131,7 @@ class FilesController extends ControllerAbstract {
$headers = new \Zend\Http\Headers();
$headers->addHeaderLine('Content-Type', $file->type)
->addHeaderLine('Content-Disposition', 'inline; filename="' . $file->name . '"')
->addHeaderLine('Content-Disposition', 'attachment; filename="' . $file->name . '"')
->addHeaderLine('Content-Length', $file->size);
$response->setHeaders($headers);
......
......@@ -128,6 +128,13 @@ class JsonController extends ControllerAbstract {
$authService = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
$translator = $this->getServiceLocator()->get('translator');
$currentUrl = $this->getRequest()->getRequestUri();
$enUri = new \Zend\Uri\Http($currentUrl);
$enUri->setQuery(array_merge($this->getRequest()->getQuery()->toArray(), array('lang' => 'en_US')));
$deUri = new \Zend\Uri\Http($currentUrl);
$deUri->setQuery(array_merge($this->getRequest()->getQuery()->toArray(), array('lang' => 'de_DE')));
$json = array(
'identifier' => '.menubar',
'navigation' => array(
......@@ -135,11 +142,11 @@ class JsonController extends ControllerAbstract {
'label' => '<i class="fa fa-language"></i> ' . $translator->translate('Language'),
'children' => array(
array(
'href' => '?lang=en_US',
'href' => '?' . $enUri->getQuery(),
'label' => 'English',
),
array(
'href' => '?lang=de_DE',
'href' => '?' . $deUri->getQuery(),
'label' => 'Deutsch',
),
),
......
......@@ -33,7 +33,7 @@ final class Version
/**
* Application version identification - see compareVersion()
*/
const VERSION = '1.0.1';
const VERSION = '1.0.2';
/**
* Compare the specified Zend Framework version string $version
......
......@@ -26,14 +26,19 @@
<h4 class="modal-title" id="myModalLabel"><?php echo $this->translate('Upload file'); ?></h4>
</div>
<form method="post" action="<?php echo $this->url('application/default', array('controller' => 'files', 'action' => 'save')); ?>">
<div class="modal-body">
<?php
<div class="modal-body">
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<p><?php echo $this->translate('The upload of larger files may take some time, depending on your internet connection. Do not close this window!'); ?></p>
</div>
</div>
<?php
$form->prepare();
echo $this->formElement($form->get('id'));
echo $this->formElement($form->get('csrf'));
echo $this->formElement($form->get('folder'));
?>
<?php
?>
<?php
$element = $form->get('upload');
$messages = $element->getMessages();
$errorClass = '';
......@@ -41,18 +46,17 @@
if (!empty($messages)) {
$errorClass = 'error';
$errorMessages = sprintf('%s',
$this->formElementErrors($element)
$errorMessages = sprintf('%s', $this->formElementErrors($element)
);
}
?>
<div class="form-group <?php echo $errorClass; ?>">
<?php echo $errorMessages; ?>
<input id="input-id" name="upload" type="file" class="file" data-preview-file-type="text">
?>
<div class="form-group <?php echo $errorClass; ?>">
<?php echo $errorMessages; ?>
<input id="input-id" name="upload" type="file" class="file" data-preview-file-type="text">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->translate('cancel'); ?></button>
<button type="submit" class="btn btn-primary" data-submitmode="ajax"><?php echo $this->translate('save'); ?></button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->translate('cancel'); ?></button>
<button type="submit" class="btn btn-primary" data-submitmode="ajax"><?php echo $this->translate('save'); ?></button>
</div>
</form>
\ No newline at end of file
......@@ -52,7 +52,7 @@ list($language, $dialect) = explode('_', $locale);
<div class="navbar-header">
<a class="navbar-brand" href="<?php echo $this->basePath(); ?>"><i class="fa fa-share-alt"></i> Share</a>
</div>
<ul class="menubar nav navbar-nav navbar-right" data-render="true" data-target="<?php echo $this->url('application/default', array('controller' => 'json', 'action' => 'menubar')); ?>">
<ul class="menubar nav navbar-nav navbar-right" data-render="true" data-target="<?php echo $this->url('application/default', array('controller' => 'json', 'action' => 'menubar'), array('query' => $this->requestParams)); ?>">
</ul>
</div>
</nav>
......
{
"name": "share-application",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache License, Version 2.0",
"description": "simple filesharing application",
"main": "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment