seperate javascript from html

This commit is contained in:
Uwe Steinmann 2015-12-15 21:02:47 +01:00
parent dfeac6843f
commit bdc3a28dcf
6 changed files with 59 additions and 39 deletions

View File

@ -51,7 +51,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'allusers'=>$allUsers, 'allgroups'=>$allGroups));
if($view) {
$view->setParam('accessobject', $accessop);
$view->show();
$view($_GET);
exit;
}

View File

@ -49,7 +49,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'sortusersinlist'=>$settings->_sortUsersInList));
if($view) {
$view->setParam('accessobject', $accessop);
$view->show();
$view($_GET);
exit;
}

View File

@ -68,7 +68,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'target'=>$target));
if($view) {
$view->setParam('accessobject', $accessop);
$view->show();
$view($_GET);
exit;
}

View File

@ -40,23 +40,9 @@ class SeedDMS_View_DocumentAccess extends SeedDMS_Bootstrap_Style {
print "</select>\n";
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$document = $this->params['document'];
$folder = $this->params['folder'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$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);
function js() { /* {{{ */
header('Content-Type: application/json');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -78,9 +64,29 @@ function checkForm()
else
return true;
}
</script>
$(document).ready( function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$document = $this->params['document'];
$folder = $this->params['folder'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$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);
$this->contentHeading(getMLText("edit_document_access"));
$this->contentContainerStart();
@ -233,7 +239,7 @@ function checkForm()
print "</table><br>";
}
?>
<form action="../op/op.DocumentAccess.php" name="form1" onsubmit="return checkForm();">
<form action="../op/op.DocumentAccess.php" name="form1" id="form1">
<?php echo createHiddenFieldWithKey('documentaccess'); ?>
<input type="Hidden" name="documentid" value="<?php print $document->getId()?>">
<input type="Hidden" name="action" value="addaccess">

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_DocumentNotify extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$sortusersinlist = $this->params['sortusersinlist'];
$notifyList = $document->getNotifyList();
$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);
function js() { /* {{{ */
header('Content-Type: application/json');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -67,9 +54,30 @@ function checkForm()
else
return true;
}
</script>
$(document).ready( function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$sortusersinlist = $this->params['sortusersinlist'];
$notifyList = $document->getNotifyList();
$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);
$this->contentHeading(getMLText("edit_existing_notify"));
$this->contentContainerStart();
@ -107,7 +115,7 @@ function checkForm()
?>
<br>
<form action="../op/op.DocumentNotify.php" name="form1" onsubmit="return checkForm();">
<form action="../op/op.DocumentNotify.php" name="form1" id="form1">
<input type="hidden" name="documentid" value="<?php print $document->getID()?>">
<input type="hidden" name="action" value="addnotify">
<table class="table-condensed">

View File

@ -31,6 +31,12 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_MoveDocument extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/json');
$this->printFolderChooserJs("form1");
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -50,7 +56,7 @@ class SeedDMS_View_MoveDocument extends SeedDMS_Bootstrap_Style {
<table>
<tr>
<td><?php printMLText("choose_target_folder");?>:</td>
<td><?php $this->printFolderChooser("form1", M_READWRITE, -1, $target);?></td>
<td><?php $this->printFolderChooserHtml("form1", M_READWRITE, -1, $target);?></td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="btn" value="<?php printMLText("move");?>"></td>