place javascript into external file

This commit is contained in:
Uwe Steinmann 2016-03-16 15:04:17 +01:00
parent 7c3bc05d6e
commit a758b29369
2 changed files with 31 additions and 18 deletions

View File

@ -39,9 +39,12 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'strictformcheck'=>$settings->_strictFormCheck, 'orderby'=>$settings->_sortFoldersDefault)); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->show(); $view->setParam('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('orderby', $settings->_sortFoldersDefault);
$view($_GET);
exit; exit;
} }

View File

@ -31,21 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_AddSubFolder extends SeedDMS_Bootstrap_Style { class SeedDMS_View_AddSubFolder extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript');
$user = $this->params['user'];
$folder = $this->params['folder'];
$strictformcheck = $this->params['strictformcheck'];
$orderby = $this->params['orderby'];
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$this->contentHeading(getMLText("add_subfolder"));
$this->contentContainerStart();
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -71,9 +59,31 @@ function checkForm()
else else
return true; return true;
} }
</script> $(document).ready( function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php
} /* }}} */
<form action="../op/op.AddSubFolder.php" name="form1" onsubmit="return checkForm();" method="POST"> function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$strictformcheck = $this->params['strictformcheck'];
$orderby = $this->params['orderby'];
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$this->contentHeading(getMLText("add_subfolder"));
$this->contentContainerStart();
?>
<form action="../op/op.AddSubFolder.php" id="form1" name="form1" method="post">
<?php echo createHiddenFieldWithKey('addsubfolder'); ?> <?php echo createHiddenFieldWithKey('addsubfolder'); ?>
<input type="Hidden" name="folderid" value="<?php print $folder->getId();?>"> <input type="Hidden" name="folderid" value="<?php print $folder->getId();?>">
<input type="Hidden" name="showtree" value="<?php echo showtree();?>"> <input type="Hidden" name="showtree" value="<?php echo showtree();?>">