add javascript into external file

This commit is contained in:
Uwe Steinmann 2016-03-16 20:10:59 +01:00
parent 29de2282a3
commit efbf85e34e
3 changed files with 88 additions and 39 deletions

View File

@ -39,21 +39,9 @@ class SeedDMS_View_FolderAccess extends SeedDMS_Bootstrap_Style {
print "</select>\n";
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$rootfolderid = $this->params['rootfolderid'];
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array()
@ -74,9 +62,28 @@ 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'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$rootfolderid = $this->params['rootfolderid'];
$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("edit_folder_access"));
$this->contentContainerStart();
@ -227,7 +234,7 @@ function checkForm()
print "</table><br>";
}
?>
<form action="../op/op.FolderAccess.php" name="form1" onsubmit="return checkForm();">
<form action="../op/op.FolderAccess.php" id="form1" name="form1">
<?php echo createHiddenFieldWithKey('folderaccess'); ?>
<input type="Hidden" name="folderid" value="<?php print $folder->getID()?>">
<input type="Hidden" name="action" value="addaccess">

View File

@ -31,24 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_FolderNotify extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$strictformcheck = $this->params['strictformcheck'];
$notifyList = $folder->getNotifyList();
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -69,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'];
$allUsers = $this->params['allusers'];
$allGroups = $this->params['allgroups'];
$strictformcheck = $this->params['strictformcheck'];
$notifyList = $folder->getNotifyList();
$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("edit_existing_notify"));
$this->contentContainerStart();
@ -125,7 +131,7 @@ function checkForm()
?>
<br>
<form action="../op/op.FolderNotify.php" method="post" name="form1" onsubmit="return checkForm();">
<form action="../op/op.FolderNotify.php" method="post" id="form1" name="form1">
<?php echo createHiddenFieldWithKey('foldernotify'); ?>
<input type="Hidden" name="folderid" value="<?php print $folder->getID()?>">
<input type="Hidden" name="action" value="addnotify">

View File

@ -31,6 +31,42 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_ForcePasswordChange extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck'];
header('Content-Type: application/javascript');
?>
function checkForm()
{
msg = new Array();
if($("#currentpwd").val() == "") msg.push("<?php printMLText("js_no_pwd");?>");
if($("#pwd").val() == "") msg.push("<?php printMLText("js_no_pwd");?>");
if($("#pwd").val() != $("#pwdconf").val()) msg.push("<?php printMLText("js_pwd_not_conf");?>");
if (msg != "") {
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
$(document).ready( function() {
$('body').on('submit', '#form', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -43,7 +79,7 @@ class SeedDMS_View_ForcePasswordChange extends SeedDMS_Bootstrap_Style {
echo "<div class=\"alert\">".getMLText('password_expiration_text')."</div>";
$this->contentContainerStart();
?>
<form action="../op/op.EditUserData.php" method="post" name="form1" onsubmit="return checkForm();">
<form action="../op/op.EditUserData.php" method="post" id="form" name="form1">
<table>
<tr>
<td><?php printMLText("current_password");?>:</td>
@ -51,7 +87,7 @@ class SeedDMS_View_ForcePasswordChange extends SeedDMS_Bootstrap_Style {
</tr>
<tr>
<td><?php printMLText("password");?>:</td>
<td><input class="pwd" type="Password" rel="strengthbar" name="pwd" size="30"></td>
<td><input id="pwd" class="pwd" type="Password" rel="strengthbar" name="pwd" size="30"></td>
</tr>
<tr>
<td><?php printMLText("password_strength");?>:</td>