seeddms-code/views/bootstrap/class.AddFile.php

141 lines
3.6 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of AddFile view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for AddFile view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_AddFile extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
function js() { /* {{{ */
2016-02-17 10:43:19 +00:00
header('Content-Type: application/javascript');
2012-12-14 07:53:13 +00:00
?>
function checkForm()
{
2013-05-23 14:07:00 +00:00
msg = new Array();
if ($("#userfile").val() == "") msg.push("<?php printMLText("js_no_file");?>");
if ($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
2012-12-14 07:53:13 +00:00
<?php
if (isset($settings->_strictFormCheck) && $settings->_strictFormCheck) {
2013-05-23 14:07:00 +00:00
?>
if ($("#comment").val() == "") msg.push("<?php printMLText("js_no_comment");?>");
2012-12-14 07:53:13 +00:00
<?php
}
?>
if (msg != "")
{
2013-05-23 14:07:00 +00:00
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
2012-12-14 07:53:13 +00:00
return false;
}
else
return true;
}
$(document).ready( function() {
$('body').on('submit', '#fileupload', function(ev){
if(checkForm()) return;
2016-03-22 13:47:13 +00:00
ev.preventDefault();
});
});
2012-12-14 07:53:13 +00:00
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$strictformcheck = $this->params['strictformcheck'];
$enablelargefileupload = $this->params['enablelargefileupload'];
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
2012-12-14 07:53:13 +00:00
$this->contentHeading(getMLText("linked_files"));
?>
<div class="alert alert-warning">
<?php echo getMLText("max_upload_size").": ".ini_get( "upload_max_filesize"); ?>
<?php
if($enablelargefileupload) {
printf('<p>'.getMLText('link_alt_updatedocument').'</p>', "out.AddFile2.php?documentid=".$document->getId());
2012-12-14 07:53:13 +00:00
}
?>
</div>
<?php
$this->contentContainerStart();
?>
<form class="form-horizontal" action="../op/op.AddFile.php" enctype="multipart/form-data" method="post" name="form1" id="fileupload">
2014-07-03 10:04:11 +00:00
<input type="hidden" name="documentid" value="<?php print $document->getId(); ?>">
<div class="control-group">
<label class="control-label"><?php printMLText("local_file");?>:</label>
<div class="controls">
<?php $this->printFileChooser('userfile', false); ?>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php printMLText("name");?>:</label>
<div class="controls">
<input type="text" name="name" id="name" size="60">
</div>
</div>
<div class="control-group">
<label class="control-label"><?php printMLText("comment");?>:</label>
<div class="controls">
<textarea name="comment" id="comment" rows="4" cols="80"></textarea>
</div>
</div>
<div class="controls">
<input class="btn" type="submit" value="<?php printMLText("add");?>">
</div>
2012-12-14 07:53:13 +00:00
</form>
<?php
$this->contentContainerEnd();
$this->contentEnd();
2012-12-14 07:53:13 +00:00
$this->htmlEndPage();
} /* }}} */
}
?>