put javascript into its own file and turn on content security policy

This commit is contained in:
Uwe Steinmann 2016-03-18 15:33:18 +01:00
parent 889a080339
commit ca6f0303b2
25 changed files with 758 additions and 659 deletions

View File

@ -31,29 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_ApproveDocument extends SeedDMS_Bootstrap_Style { class SeedDMS_View_ApproveDocument extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$latestContent = $document->getLatestContent();
$approvals = $latestContent->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $_GET['approveid']) {
$approvalStatus = $approval;
break;
}
}
$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("add_approval"));
?> ?>
<script language="JavaScript">
function checkIndForm() function checkIndForm()
{ {
msg = new Array(); msg = new Array();
@ -76,9 +56,9 @@ function checkIndForm()
function checkGrpForm() function checkGrpForm()
{ {
msg = new Array(); msg = new Array();
// if (document.form1.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>"); // if (document.form2.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>");
if (document.form1.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>"); if (document.form2.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>"); if (document.form2.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "") if (msg != "")
{ {
noty({ noty({
@ -94,9 +74,40 @@ function checkGrpForm()
else else
return true; return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkIndForm()) return;
event.preventDefault();
});
$('body').on('submit', '#form2', function(ev){
if(checkGrpForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$latestContent = $document->getLatestContent();
$approvals = $latestContent->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $_GET['approveid']) {
$approvalStatus = $approval;
break;
}
}
$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("add_approval"));
$this->contentContainerStart(); $this->contentContainerStart();
@ -118,7 +129,7 @@ function checkGrpForm()
print "</tr></tbody></table><br>\n"; print "</tr></tbody></table><br>\n";
} }
?> ?>
<form method="post" action="../op/op.ApproveDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();"> <form method="post" action="../op/op.ApproveDocument.php" id="form1" name="form1" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?> <?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table> <table>
<tr> <tr>
@ -170,7 +181,7 @@ function checkGrpForm()
} }
?> ?>
<form method="POST" action="../op/op.ApproveDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkGrpForm();"> <form method="POST" action="../op/op.ApproveDocument.php" id="form2" name="form2" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?> <?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table> <table>
<tr><td><?php printMLText("comment")?>:</td> <tr><td><?php printMLText("comment")?>:</td>

View File

@ -162,7 +162,7 @@ $(document).ready( function() {
<?php <?php
} }
?> ?>
<table class="table-condensed"> <table class="table table-condensed">
<tr> <tr>
<td> <td>
<?php printMLText("attrdef_name");?>: <?php printMLText("attrdef_name");?>:
@ -315,6 +315,8 @@ $(document).ready( function() {
</div> </div>
</div> </div>
</div>
<?php <?php
$this->contentEnd(); $this->contentEnd();
$this->htmlEndPage(); $this->htmlEndPage();

View File

@ -43,7 +43,7 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
} /* }}} */ } /* }}} */
function htmlStartPage($title="", $bodyClass="") { /* {{{ */ function htmlStartPage($title="", $bodyClass="") { /* {{{ */
if(method_exists($this, 'js')) { if(1 || method_exists($this, 'js')) {
/* We still need unsafe-eval, because printDocumentChooserHtml and /* We still need unsafe-eval, because printDocumentChooserHtml and
* printFolderChooserHtml will include a javascript file with ajax * printFolderChooserHtml will include a javascript file with ajax
* which is evaled by jquery * which is evaled by jquery
@ -67,9 +67,9 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
echo '<link href="../styles/'.$this->theme.'/datepicker/css/datepicker.css" rel="stylesheet">'."\n"; echo '<link href="../styles/'.$this->theme.'/datepicker/css/datepicker.css" rel="stylesheet">'."\n";
echo '<link href="../styles/'.$this->theme.'/chosen/css/chosen.css" rel="stylesheet">'."\n"; echo '<link href="../styles/'.$this->theme.'/chosen/css/chosen.css" rel="stylesheet">'."\n";
echo '<link href="../styles/'.$this->theme.'/jqtree/jqtree.css" rel="stylesheet">'."\n"; echo '<link href="../styles/'.$this->theme.'/jqtree/jqtree.css" rel="stylesheet">'."\n";
echo '<link href="../styles/'.$this->theme.'/application.css" rel="stylesheet">'."\n";
if($this->extraheader['css']) if($this->extraheader['css'])
echo $this->extraheader['css']; echo $this->extraheader['css'];
echo '<link href="../styles/'.$this->theme.'/application.css" rel="stylesheet">'."\n";
// echo '<link href="../styles/'.$this->theme.'/jquery-ui-1.10.4.custom/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">'."\n"; // echo '<link href="../styles/'.$this->theme.'/jquery-ui-1.10.4.custom/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">'."\n";
echo '<script type="text/javascript" src="../styles/'.$this->theme.'/jquery/jquery.min.js"></script>'."\n"; echo '<script type="text/javascript" src="../styles/'.$this->theme.'/jquery/jquery.min.js"></script>'."\n";

View File

@ -31,6 +31,13 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style { class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
document.form1.newpassword.focus();
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$referuri = $this->params['referuri']; $referuri = $this->params['referuri'];
@ -43,7 +50,7 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
$this->pageNavigation(getMLText("change_password")); $this->pageNavigation(getMLText("change_password"));
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<form action="../op/op.ChangePassword.php" method="post" name="form1" onsubmit="return checkForm();"> <form action="../op/op.ChangePassword.php" method="post" name="form1">
<?php <?php
if ($referuri) { if ($referuri) {
echo "<input type='hidden' name='referuri' value='".$referuri."'/>"; echo "<input type='hidden' name='referuri' value='".$referuri."'/>";
@ -80,7 +87,6 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
</table> </table>
</form> </form>
<?php $this->contentContainerEnd(); ?> <?php $this->contentContainerEnd(); ?>
<script language="JavaScript">document.form1.newpassword.focus();</script>
<p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p> <p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p>
<?php <?php
$this->contentEnd(); $this->contentEnd();

View File

@ -31,21 +31,10 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_EditComment extends SeedDMS_Bootstrap_Style { class SeedDMS_View_EditComment extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$version = $this->params['version'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
header('Content-Type: application/javascript; charset=UTF-8');
$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);
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -70,13 +59,32 @@ function checkForm()
} }
else return true; else return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$version = $this->params['version'];
$strictformcheck = $this->params['strictformcheck'];
$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_comment")); $this->contentHeading(getMLText("edit_comment"));
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<form action="../op/op.EditComment.php" name="form1" onsubmit="return checkForm();" method="POST"> <form action="../op/op.EditComment.php" id="form1" name="form1" method="post">
<?php echo createHiddenFieldWithKey('editcomment'); ?> <?php echo createHiddenFieldWithKey('editcomment'); ?>
<input type="Hidden" name="documentid" value="<?php print $document->getID();?>"> <input type="Hidden" name="documentid" value="<?php print $document->getID();?>">
<input type="Hidden" name="version" value="<?php print $version->getVersion();?>"> <input type="Hidden" name="version" value="<?php print $version->getVersion();?>">

View File

@ -31,21 +31,10 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_EditEvent extends SeedDMS_Bootstrap_Style { class SeedDMS_View_EditEvent extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$event = $this->params['event'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
header('Content-Type: application/javascript; charset=UTF-8');
$this->htmlStartPage(getMLText("calendar"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("calendar"), "calendar");
$this->contentHeading(getMLText("edit_event"));
$this->contentContainerStart();
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array() msg = new Array()
@ -71,9 +60,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.EditEvent.php" name="form1" onsubmit="return checkForm();" method="POST"> function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$event = $this->params['event'];
$strictformcheck = $this->params['strictformcheck'];
$this->htmlStartPage(getMLText("calendar"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("calendar"), "calendar");
$this->contentHeading(getMLText("edit_event"));
$this->contentContainerStart();
?>
<form action="../op/op.EditEvent.php" id="form1" name="form1" method="POST">
<?php echo createHiddenFieldWithKey('editevent'); ?> <?php echo createHiddenFieldWithKey('editevent'); ?>
<input type="Hidden" name="eventid" value="<?php echo (int) $event["id"]; ?>"> <input type="Hidden" name="eventid" value="<?php echo (int) $event["id"]; ?>">

View File

@ -31,22 +31,10 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_EditFolder extends SeedDMS_Bootstrap_Style { class SeedDMS_View_EditFolder extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$attrdefs = $this->params['attrdefs'];
$rootfolderid = $this->params['rootfolderid'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
$orderby = $this->params['orderby']; header('Content-Type: application/javascript; charset=UTF-8');
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -72,13 +60,32 @@ function checkForm()
else else
return true; return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$attrdefs = $this->params['attrdefs'];
$rootfolderid = $this->params['rootfolderid'];
$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("edit_folder_props")); $this->contentHeading(getMLText("edit_folder_props"));
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<form action="../op/op.EditFolder.php" name="form1" onsubmit="return checkForm();" method="POST"> <form action="../op/op.EditFolder.php" id="form1" name="form1" method="post">
<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();?>">
<table class="table-condensed"> <table class="table-condensed">

View File

@ -36,6 +36,32 @@ class SeedDMS_View_EditOnline extends SeedDMS_Bootstrap_Style {
var $file_count; var $file_count;
var $storage_size; var $storage_size;
function js() { /* {{{ */
$document = $this->params['document'];
header('Content-Type: application/javascript; charset=UTF-8');
?>
$(document).ready(function() {
$('#markdown').markItUp(mySettings);
$('#update').click(function(event) {
event.preventDefault();
$.post("../op/op.EditOnline.php", $('#form1').serialize(), function(response) {
noty({
text: response.message,
type: response.success === true ? 'success' : 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
$('div.ajax').trigger('update', {documentid: <?= $document->getId() ?>});
}, "json");
return false;
});
});
<?php
} /* }}} */
function preview() { /* {{{ */ function preview() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$document = $this->params['document']; $document = $this->params['document'];
@ -91,27 +117,6 @@ echo "<div class=\"row-fluid\">\n";
echo "<div class=\"span6\">\n"; echo "<div class=\"span6\">\n";
$this->contentHeading(getMLText("content")); $this->contentHeading(getMLText("content"));
?> ?>
<script language="javascript">
$(document).ready(function() {
$('#markdown').markItUp(mySettings);
$('#update').click(function(event) {
event.preventDefault();
$.post("../op/op.EditOnline.php", $('#form1').serialize(), function(response) {
noty({
text: response.message,
type: response.success === true ? 'success' : 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
$('div.ajax').trigger('update', {documentid: <?= $document->getId() ?>});
}, "json");
return false;
});
});
</script>
<form action="../op/op.EditOnline.php" id="form1" method="post"> <form action="../op/op.EditOnline.php" id="form1" method="post">
<input type="hidden" name="documentid" value="<?= $document->getId() ?>" /> <input type="hidden" name="documentid" value="<?= $document->getId() ?>" />
<textarea id="markdown" name="data" width="100%" rows="20"> <textarea id="markdown" name="data" width="100%" rows="20">

View File

@ -31,6 +31,17 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_GroupView extends SeedDMS_Bootstrap_Style { class SeedDMS_View_GroupView extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript');
?>
$(document).ready( function() {
$( "#selector" ).change(function() {
$('#form').submit();
});
});
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -75,15 +86,15 @@ class SeedDMS_View_GroupView extends SeedDMS_Bootstrap_Style {
if($manager->getId() == $member->getId()) if($manager->getId() == $member->getId())
echo ", ".getMLText("manager"); echo ", ".getMLText("manager");
if($ismanager) { if($ismanager) {
echo ' <a href="../op/op.GroupView.php?action=del&groupid='.$group->getId().'&userid='.$member->getId().'"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> '.getMLText("rm_user").'</a>'; echo ' <a href="../op/op.GroupView.php?action=del&groupid='.$group->getId().'&userid='.$member->getId().'" class="btn btn-mini"><i class="icon-remove"></i> '.getMLText("rm_user").'</a>';
} }
echo "</li>"; echo "</li>";
} }
if($ismanager) { if($ismanager) {
echo "<li>".getMLText("add_user_to_group").":"; echo "<li>".getMLText("add_user_to_group").":";
echo "<form action=\"../op/op.GroupView.php\">"; echo "<form id=\"form\" action=\"../op/op.GroupView.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"add\" /><input type=\"hidden\" name=\"groupid\" value=\"".$group->getId()."\" />"; echo "<input type=\"hidden\" name=\"action\" value=\"add\" /><input type=\"hidden\" name=\"groupid\" value=\"".$group->getId()."\" />";
echo "<select name=\"userid\" onChange=\"javascript: submit();\">"; echo "<select id=\"selector\" name=\"userid\" _onChange=\"javascript: submit();\">";
echo "<option value=\"\"></option>"; echo "<option value=\"\"></option>";
foreach($allUsers as $u) { foreach($allUsers as $u) {
if(!$u->isAdmin() && !$u->isGuest() && !in_array($u->getId(), $memberids)) if(!$u->isAdmin() && !$u->isGuest() && !in_array($u->getId(), $memberids))

View File

@ -31,6 +31,12 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_MoveFolder extends SeedDMS_Bootstrap_Style { class SeedDMS_View_MoveFolder extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript');
$this->printFolderChooserJs("form1");
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -46,12 +52,12 @@ class SeedDMS_View_MoveFolder extends SeedDMS_Bootstrap_Style {
?> ?>
<form action="../op/op.MoveFolder.php" name="form1"> <form action="../op/op.MoveFolder.php" name="form1">
<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();?>">
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>
<td><?php printMLText("choose_target_folder");?>:</td> <td><?php printMLText("choose_target_folder");?>:</td>
<td><?php $this->printFolderChooser("form1", M_READWRITE, $folder->getID(), $target);?></td> <td><?php $this->printFolderChooserHtml("form1", M_READWRITE, $folder->getID(), $target);?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>

View File

@ -31,26 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_OverrideContentStatus extends SeedDMS_Bootstrap_Style { class SeedDMS_View_OverrideContentStatus extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$overallStatus = $content->getStatus();
$reviewStatus = $content->getReviewStatus();
$approvalStatus = $content->getApprovalStatus();
$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("change_status"));
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -70,14 +53,38 @@ function checkForm()
else else
return true; return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$overallStatus = $content->getStatus();
$reviewStatus = $content->getReviewStatus();
$approvalStatus = $content->getApprovalStatus();
$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("change_status"));
$this->contentContainerStart(); $this->contentContainerStart();
// Display the Review form. // Display the Review form.
?> ?>
<form method="post" action="../op/op.OverrideContentStatus.php" name="form1" onsubmit="return checkForm();"> <form method="post" action="../op/op.OverrideContentStatus.php" id="form1" name="form1">
<table class="table-condensed"> <table class="table-condensed">
<tr><td><?php echo(printMLText("comment")); ?>:</td> <tr><td><?php echo(printMLText("comment")); ?>:</td>
<td><textarea name="comment" cols="40" rows="4"></textarea> <td><textarea name="comment" cols="40" rows="4"></textarea>

View File

@ -31,6 +31,38 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style { class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
function checkForm()
{
msg = new Array();
if (document.form1.login.value == "") msg.push("<?php printMLText("js_no_login");?>");
if (document.form1.email.value == "") msg.push("<?php printMLText("js_no_email");?>");
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', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
document.form1.email.focus();
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$referrer = $this->params['referrer']; $referrer = $this->params['referrer'];
@ -41,7 +73,7 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
?> ?>
<?php $this->contentContainerStart(); ?> <?php $this->contentContainerStart(); ?>
<form action="../op/op.PasswordForgotten.php" method="post" name="form1" onsubmit="return checkForm();"> <form action="../op/op.PasswordForgotten.php" method="post" id="form1" name="form1">
<?php <?php
if ($referrer) { if ($referrer) {
echo "<input type='hidden' name='referuri' value='".$referrer."'/>"; echo "<input type='hidden' name='referuri' value='".$referrer."'/>";
@ -64,7 +96,6 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
</table> </table>
</form> </form>
<?php $this->contentContainerEnd(); ?> <?php $this->contentContainerEnd(); ?>
<script language="JavaScript">document.form1.email.focus();</script>
<p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p> <p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p>
<?php <?php
$this->contentEnd(); $this->contentEnd();

View File

@ -47,7 +47,7 @@ class SeedDMS_View_RemoveWorkflow extends SeedDMS_Bootstrap_Style {
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<p><?php printMLText("rm_workflow_warning"); ?></p> <p><?php printMLText("rm_workflow_warning"); ?></p>
<form method="post" action="../op/op.RemoveWorkflow.php" name="form1" onsubmit="return checkForm();"> <form method="post" action="../op/op.RemoveWorkflow.php" name="form1">
<?php echo createHiddenFieldWithKey('removeworkflow'); ?> <?php echo createHiddenFieldWithKey('removeworkflow'); ?>
<table> <table>
<tr><td></td><td> <tr><td></td><td>

View File

@ -69,7 +69,7 @@ class SeedDMS_View_RemoveWorkflowFromDocument extends SeedDMS_Bootstrap_Style {
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<p><?php printMLText("rm_workflow_warning"); ?></p> <p><?php printMLText("rm_workflow_warning"); ?></p>
<form method="post" action="../op/op.RemoveWorkflowFromDocument.php" name="form1" onsubmit="return checkForm();"> <form method="post" action="../op/op.RemoveWorkflowFromDocument.php" name="form1">
<?php echo createHiddenFieldWithKey('removeworkflowfromdocument'); ?> <?php echo createHiddenFieldWithKey('removeworkflowfromdocument'); ?>
<table> <table>
<tr><td></td><td> <tr><td></td><td>

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_ReturnFromSubWorkflow extends SeedDMS_Bootstrap_Style { class SeedDMS_View_ReturnFromSubWorkflow extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$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("return_from_subworkflow"));
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -65,9 +52,29 @@ function checkForm()
else else
return true; return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$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("return_from_subworkflow"));
$currentstate = $latestContent->getWorkflowState(); $currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog(); $wkflog = $latestContent->getWorkflowLog();
@ -93,7 +100,7 @@ function checkForm()
?> ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<form method="post" action="../op/op.ReturnFromSubWorkflow.php" name="form1" onsubmit="return checkForm();"> <form method="post" action="../op/op.ReturnFromSubWorkflow.php" id="form1" name="form1">
<?php echo createHiddenFieldWithKey('returnfromsubworkflow'); ?> <?php echo createHiddenFieldWithKey('returnfromsubworkflow'); ?>
<table> <table>
<tr><td><?php printMLText("comment")?>:</td> <tr><td><?php printMLText("comment")?>:</td>
@ -140,4 +147,3 @@ function checkForm()
} /* }}} */ } /* }}} */
} }
?> ?>

View File

@ -31,28 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_ReviewDocument extends SeedDMS_Bootstrap_Style { class SeedDMS_View_ReviewDocument extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $_GET['reviewid']) {
$reviewStatus = $review;
break;
}
}
$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("submit_review"));
?> ?>
<script language="JavaScript">
function checkIndForm() function checkIndForm()
{ {
msg = new Array(); msg = new Array();
@ -75,20 +56,57 @@ function checkIndForm()
function checkGrpForm() function checkGrpForm()
{ {
msg = ""; msg = "";
if (document.form1.reviewGroup.value == "") msg += "<?php printMLText("js_no_review_group");?>\n"; if (document.form2.reviewGroup.value == "") msg += "<?php printMLText("js_no_review_group");?>\n";
if (document.form1.reviewStatus.value == "") msg += "<?php printMLText("js_no_review_status");?>\n"; if (document.form2.reviewStatus.value == "") msg += "<?php printMLText("js_no_review_status");?>\n";
if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n"; if (document.form2.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "") if (msg != "")
{ {
alert(msg); noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false; return false;
} }
else else
return true; return true;
} }
</script> $(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkIndForm()) return;
event.preventDefault();
});
$('body').on('submit', '#form2', function(ev){
if(checkGrpForm()) return;
event.preventDefault();
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $_GET['reviewid']) {
$reviewStatus = $review;
break;
}
}
$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("submit_review"));
$this->contentContainerStart(); $this->contentContainerStart();
// Display the Review form. // Display the Review form.
@ -109,7 +127,7 @@ function checkGrpForm()
print "</tr></tbody></table><br>"; print "</tr></tbody></table><br>";
} }
?> ?>
<form method="post" action="../op/op.ReviewDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();"> <form method="post" action="../op/op.ReviewDocument.php" id="form1" name="form1" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?> <?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>
@ -167,7 +185,7 @@ function checkGrpForm()
} }
?> ?>
<form method="post" action="../op/op.ReviewDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkGrpForm();"> <form method="post" action="../op/op.ReviewDocument.php" id="form2" name="form2" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?> <?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_SearchForm extends SeedDMS_Bootstrap_Style { class SeedDMS_View_SearchForm extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$attrdefs = $this->params['attrdefs'];
$allCats = $this->params['allcategories'];
$allUsers = $this->params['allusers'];
$enablefullsearch = $this->params['enablefullsearch'];
$workflowmode = $this->params['workflowmode'];
$this->htmlStartPage(getMLText("search"));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation(getMLText("search"), "");
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array() msg = new Array()
@ -71,7 +58,32 @@ function checkForm()
else else
return true; return true;
} }
</script>
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
<?php
$this->printFolderChooserJs("form1");
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$attrdefs = $this->params['attrdefs'];
$allCats = $this->params['allcategories'];
$allUsers = $this->params['allusers'];
$enablefullsearch = $this->params['enablefullsearch'];
$workflowmode = $this->params['workflowmode'];
$this->htmlStartPage(getMLText("search"));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation(getMLText("search"), "");
?>
<ul class="nav nav-tabs" id="searchtab"> <ul class="nav nav-tabs" id="searchtab">
<li class="active"><a data-target="#database" data-toggle="tab"><?php printMLText('databasesearch'); ?></a></li> <li class="active"><a data-target="#database" data-toggle="tab"><?php printMLText('databasesearch'); ?></a></li>
<li><a data-target="#full" data-toggle="tab"><?php printMLText('fullsearch'); ?></a></li> <li><a data-target="#full" data-toggle="tab"><?php printMLText('fullsearch'); ?></a></li>
@ -82,7 +94,7 @@ function checkForm()
<?php <?php
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<form action="../op/op.Search.php" name="form1" onsubmit="return checkForm();"> <form action="../op/op.Search.php" id="form1" name="form1">
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>
<td><?php printMLText("search_query");?>:</td> <td><?php printMLText("search_query");?>:</td>
@ -160,7 +172,7 @@ function checkForm()
</tr> </tr>
<tr> <tr>
<td><?php printMLText("under_folder")?>:</td> <td><?php printMLText("under_folder")?>:</td>
<td><?php $this->printFolderChooser("form1", M_READ, -1, $folder);?></td> <td><?php $this->printFolderChooserHtml("form1", M_READ, -1, $folder);?></td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("creation_date");?>:</td> <td><?php printMLText("creation_date");?>:</td>

View File

@ -31,6 +31,28 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style { class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$document = $this->params['document'];
header('Content-Type: application/javascript; charset=UTF-8');
?>
function showWorkflow(selectObj) {
id = selectObj.options[selectObj.selectedIndex].value;
if (id > 0) {
$('#workflowgraph').show();
$('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?documentid=<?php echo $document->getID(); ?>&workflow='+id);
} else {
$('#workflowgraph').hide();
}
}
$(document).ready( function() {
$( "#selector" ).change(function() {
showWorkflow(this);
});
});
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -48,18 +70,6 @@ class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style {
$this->contentContainerStart(); $this->contentContainerStart();
// Display the Workflow form. // Display the Workflow form.
?> ?>
<script language="JavaScript">
function showWorkflow(selectObj) {
id = selectObj.options[selectObj.selectedIndex].value;
if (id > 0) {
$('#workflowgraph').show();
$('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?documentid=<?php echo $document->getID(); ?>&workflow='+id);
} else {
$('#workflowgraph').hide();
}
}
</script>
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<?php <?php
@ -78,7 +88,7 @@ function showWorkflow(selectObj) {
</td> </td>
<td> <td>
<?php <?php
echo "<select onchange=\"showWorkflow(this)\" class=\"_chzn-select-deselect\" name=\"workflow\" data-placeholder=\"".getMLText('select_workflow')."\">"; echo "<select id=\"selector\" class=\"_chzn-select-deselect\" name=\"workflow\" data-placeholder=\"".getMLText('select_workflow')."\">";
$mandatoryworkflow = $user->getMandatoryWorkflow(); $mandatoryworkflow = $user->getMandatoryWorkflow();
$workflows=$dms->getAllWorkflows(); $workflows=$dms->getAllWorkflows();
foreach ($workflows as $workflow) { foreach ($workflows as $workflow) {

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_TriggerWorkflow extends SeedDMS_Bootstrap_Style { class SeedDMS_View_TriggerWorkflow extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$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("trigger_workflow"));
?> ?>
<script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -65,6 +52,32 @@ function checkForm()
else else
return true; return true;
} }
$(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'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$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("trigger_workflow"));
?>
<script language="JavaScript">
</script> </script>
<?php <?php
@ -93,7 +106,7 @@ function checkForm()
?> ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<form method="POST" action="../op/op.TriggerWorkflow.php" name="form1" onsubmit="return checkForm();"> <form method="POST" action="../op/op.TriggerWorkflow.php" id="form1" name="form1">
<?php echo createHiddenFieldWithKey('triggerworkflow'); ?> <?php echo createHiddenFieldWithKey('triggerworkflow'); ?>
<table> <table>
<tr><td><?php printMLText("comment")?>:</td> <tr><td><?php printMLText("comment")?>:</td>

View File

@ -31,17 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_UserDefaultKeywords extends SeedDMS_Bootstrap_Style { class SeedDMS_View_UserDefaultKeywords extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$categories = $this->params['categories'];
$this->htmlStartPage(getMLText("edit_default_keywords"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("my_account"), "my_account");
?> ?>
<script language="JavaScript">
obj = -1; obj = -1;
function showKeywords(selectObj) { function showKeywords(selectObj) {
if (obj != -1) if (obj != -1)
@ -54,15 +46,40 @@ function showKeywords(selectObj) {
obj = document.getElementById("keywords" + id); obj = document.getElementById("keywords" + id);
obj.style.display = ""; obj.style.display = "";
} }
</script>
sel = document.getElementById("selector");
sel.selectedIndex=0; //<?php print $selected ?>;
showKeywords(sel);
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
$( "#selector" ).change(function() {
showKeywords(this);
// $('div.ajax').trigger('update', {userid: $(this).val()});
});
});
<?php <?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$categories = $this->params['categories'];
$this->htmlStartPage(getMLText("edit_default_keywords"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("my_account"), "my_account");
$this->contentHeading(getMLText("edit_default_keywords")); $this->contentHeading(getMLText("edit_default_keywords"));
?> ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span4">
<div class="well"> <div class="well">
<?php echo getMLText("selection")?>: <?php echo getMLText("selection")?>:
<select onchange="showKeywords(this)" id="selector"> <select id="selector">
<option value="-1"><?php echo getMLText("choose_category")?> <option value="-1"><?php echo getMLText("choose_category")?>
<option value="0"><?php echo getMLText("new_default_keyword_category")?> <option value="0"><?php echo getMLText("new_default_keyword_category")?>
<?php <?php
@ -181,14 +198,6 @@ function showKeywords(selectObj) {
</div> </div>
</div> </div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showKeywords(sel);
</script>
<?php <?php
$this->contentEnd(); $this->contentEnd();
$this->htmlEndPage(); $this->htmlEndPage();

View File

@ -31,27 +31,14 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Bootstrap_Style { class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$selworkflowaction = $this->params['selworkflowaction'];
$workflowactions = $dms->getAllWorkflowActions();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?> ?>
<script language="JavaScript">
function checkForm(num) function checkForm(num)
{ {
msg = new Array() msg = new Array()
eval("var formObj = document.form" + num + ";");
if (formObj.name.value == "") msg.push("<?php printMLText("js_no_name");?>"); if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
if (msg != "") if (msg != "")
{ {
noty({ noty({
@ -68,79 +55,26 @@ function checkForm(num)
return true; return true;
} }
$(document).ready( function() {
obj = -1; $('body').on('submit', '#form', function(ev){
function showWorkflowAction(selectObj) { if(checkForm()) return;
if (obj != -1) { event.preventDefault();
obj.style.display = "none"; });
} $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowactionid: $(this).val()});
id = selectObj.options[selectObj.selectedIndex].value; });
if (id == -1) });
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php <?php
$this->contentHeading(getMLText("workflow_actions_management")); } /* }}} */
?>
<div class="row-fluid"> function info() { /* {{{ */
<div class="span4"> $dms = $this->params['dms'];
<div class="well"> $user = $this->params['user'];
<?php echo getMLText("selection")?>: } /* }}} */
<select onchange="showWorkflowAction(this)" id="selector" class="span9">
<option value="-1"><?php echo getMLText("choose_workflow_action")?>
<option value="0"><?php echo getMLText("add_workflow_action")?>
<?php
$selected=0;
$count=2;
foreach ($workflowactions as $currWorkflowAction) {
if ($selworkflowaction && $currWorkflowAction->getID()==$selworkflowaction->getID()) $selected=$count;
print "<option value=\"".$currWorkflowAction->getID()."\">" . htmlspecialchars($currWorkflowAction->getName());
$count++;
}
?>
</select>
</div>
</div>
<div class="span8"> function showWorkflowActionForm($action) { /* {{{ */
<div class="well"> if($action) {
<table class="table-condensed"> if($action->isUsed()) {
<tr>
<td id="keywords0" style="display : none;">
<form action="../op/op.WorkflowActionsMgr.php" method="post" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflowaction'); ?>
<input type="Hidden" name="action" value="addworkflowaction">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_action_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow_action");?>"></td>
</tr>
</table>
</form>
</td>
<?php
foreach ($workflowactions as $currWorkflowAction) {
print "<td id=\"keywords".$currWorkflowAction->getID()."\" style=\"display : none;\">";
?>
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflowAction->isUsed()) {
?> ?>
<p><?php echo getMLText('workflow_action_in_use') ?></p> <p><?php echo getMLText('workflow_action_in_use') ?></p>
<?php <?php
@ -148,43 +82,88 @@ function showWorkflowAction(selectObj) {
?> ?>
<form class="form-inline" action="../op/op.RemoveWorkflowAction.php" method="post"> <form class="form-inline" action="../op/op.RemoveWorkflowAction.php" method="post">
<?php echo createHiddenFieldWithKey('removeworkflowaction'); ?> <?php echo createHiddenFieldWithKey('removeworkflowaction'); ?>
<input type="hidden" name="workflowactionid" value="<?php print $currWorkflowAction->getID();?>"> <input type="hidden" name="workflowactionid" value="<?php print $action->getID();?>">
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow_action");?></button> <button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow_action");?></button>
</form> </form>
<?php <?php
} }
}
?> ?>
</td> <form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal">
</tr> <?php
<form action="../op/op.WorkflowActionsMgr.php" method="post" name="form<?php print $currWorkflowAction->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowAction->getID();?>');"> if($action) {
<?php echo createHiddenFieldWithKey('editworkflowaction'); ?> echo createHiddenFieldWithKey('editworkflowaction');
<input type="Hidden" name="workflowactionid" value="<?php print $currWorkflowAction->getID();?>"> ?>
<input type="Hidden" name="action" value="editworkflowaction"> <input type="hidden" name="workflowactionid" value="<?php print $action->getID();?>">
<tr> <input type="hidden" name="action" value="editworkflowaction">
<td><?php printMLText("workflow_action_name");?>:</td> <?php
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowAction->getName());?>"></td> } else {
</tr> echo createHiddenFieldWithKey('addworkflowaction');
<tr> ?>
<td></td> <input type="hidden" name="action" value="addworkflowaction">
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td> <?php
</tr> }
?>
<div class="control-group">
<label class="control-label" for="login"><?php printMLText("workflow_action_name");?>:</label>
<div class="controls">
<input type="text" id="name" name="name" value="<?php print $action ? htmlspecialchars($action->getName()) : '';?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="login"></label>
<div class="controls">
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
</div>
</div>
</form> </form>
</table> <?php
</td> } /* }}} */
<?php } ?>
</tr></table> function form() { /* {{{ */
</div> $selworkflowaction = $this->params['selworkflowaction'];
$this->showWorkflowActionForm($selworkflowaction);
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflowaction = $this->params['selworkflowaction'];
$workflowactions = $dms->getAllWorkflowActions();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("workflow_actions_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select id="selector" class="span9">
<option value="-1"><?php echo getMLText("choose_workflow_action")?>
<option value="0"><?php echo getMLText("add_workflow_action")?>
<?php
foreach ($workflowactions as $currWorkflowAction) {
print "<option value=\"".$currWorkflowAction->getID()."\" ".($selworkflowaction && $currWorkflowAction->getID()==$selworkflowaction->getID() ? 'selected' : '').">" . htmlspecialchars($currWorkflowAction->getName());
}
?>
</select>
</div> </div>
<div class="ajax" data-view="WorkflowActionsMgr" data-action="info" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
</div> </div>
<script language="JavaScript"> <div class="span8">
<div class="well">
sel = document.getElementById("selector"); <div class="ajax" data-view="WorkflowActionsMgr" data-action="form" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
sel.selectedIndex=<?php print $selected ?>; </div>
showWorkflowAction(sel); </div>
</script>
</div>
<?php <?php
$this->contentEnd(); $this->contentEnd();
$this->htmlEndPage(); $this->htmlEndPage();

View File

@ -31,6 +31,39 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style { class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$this->workflow = $this->params['workflow'];
header('Content-Type: application/javascript; charset=UTF-8');
?>
$(document).ready(function() {
var width = $('#canvas').width();
var height = $('#canvas').height();;
var ggg = new Graph();
ggg.edgeFactory.template.style.directed = true;
var render_action = function(r, n) {
/* the Raphael set is obligatory, containing all you want to display */
var set = r.set().push(
/* custom objects go here */
r.rect(n.point[0]-45, n.point[1]-13, 90, 44).attr({"fill": (n.color == undefined ? "#feb" : n.color), r : "12px", "stroke-width" : "1px" })).push(
r.text(n.point[0], n.point[1] + 10, (n.label || n.id) + "\n(" + (n.maxtime == undefined ? "Infinity" : n.maxtime) + ")"));
return set;
};
<?php
$this->seentrans = array();
$state = $this->workflow->getInitState();
$this->states = array();
$this->actions = array();
$this->printGraph();
?>
var layouter = new Graph.Layout.Spring(ggg);
var renderer = new Graph.Renderer.Raphael('canvas', ggg, width, height);
});
<?php
} /* }}} */
function printGraph() { /* {{{ */ function printGraph() { /* {{{ */
$transitions = $this->workflow->getTransitions(); $transitions = $this->workflow->getTransitions();
if($transitions) { if($transitions) {
@ -112,42 +145,20 @@ class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style {
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graffle.js"></script>'."\n". '<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graffle.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graph.js"></script>'."\n". '<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graph.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_algorithms.js"></script>'."\n"); '<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_algorithms.js"></script>'."\n");
$this->htmlAddHeader('
<style type="text/css">
body {padding: 0px;}
</style>
', 'css');
$this->htmlStartPage(getMLText("admin_tools")); $this->htmlStartPage(getMLText("admin_tools"));
// $this->contentContainerStart(); // $this->contentContainerStart();
?> ?>
<div id="canvas" style="width: 100%; height:480px; _border: 1px solid #bbb;"></div> <div id="canvas" style="width: 100%; height:546px; _border: 1px solid #bbb;"></div>
<script language="JavaScript">
$(document).ready(function() {
var width = $('#canvas').width();
var height = $('#canvas').height();;
var ggg = new Graph();
ggg.edgeFactory.template.style.directed = true;
var render_action = function(r, n) {
/* the Raphael set is obligatory, containing all you want to display */
var set = r.set().push(
/* custom objects go here */
r.rect(n.point[0]-45, n.point[1]-13, 90, 44).attr({"fill": (n.color == undefined ? "#feb" : n.color), r : "12px", "stroke-width" : "1px" })).push(
r.text(n.point[0], n.point[1] + 10, (n.label || n.id) + "\n(" + (n.maxtime == undefined ? "Infinity" : n.maxtime) + ")"));
return set;
};
<?php
$this->seentrans = array();
$state = $this->workflow->getInitState();
$this->states = array();
$this->actions = array();
$this->printGraph();
?>
var layouter = new Graph.Layout.Spring(ggg);
var renderer = new Graph.Renderer.Raphael('canvas', ggg, width, height);
});
</script>
<?php <?php
// $this->contentContainerEnd(); // $this->contentContainerEnd();
if(method_exists($this, 'js'))
echo '<script src="../out/out.'.$this->params['class'].'.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
echo "</body>\n</html>\n"; echo "</body>\n</html>\n";
} /* }}} */ } /* }}} */
} }

View File

@ -31,20 +31,9 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_WorkflowMgr extends SeedDMS_Bootstrap_Style { class SeedDMS_View_WorkflowMgr extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$selworkflow = $this->params['selworkflow'];
$workflows = $this->params['allworkflows'];
$workflowstates = $this->params['allworkflowstates'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?> ?>
<script language="JavaScript">
function checkForm(num) function checkForm(num)
{ {
@ -68,104 +57,38 @@ function checkForm(num)
return true; return true;
} }
$(document).ready(function() {
obj = -1; $('body').on('submit', '#form1', function(ev){
function showWorkflow(selectObj) { if(checkForm()) return;
if (obj != -1) { event.preventDefault();
obj.style.display = "none"; });
} $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowid: $(this).val()});
id = selectObj.options[selectObj.selectedIndex].value; });
if (id > 0) { });
$('#workflowgraph').show();
$('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?workflow='+id);
} else {
$('#workflowgraph').hide();
}
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php <?php
$this->contentHeading(getMLText("workflow_management")); } /* }}} */
?>
<div class="row-fluid"> function info() { /* {{{ */
<div class="span4"> $dms = $this->params['dms'];
<div class="well"> $user = $this->params['user'];
<?php echo getMLText("selection")?>: $selworkflow = $this->params['selworkflow'];
<select onchange="showWorkflow(this)" id="selector" class="span9"> if($selworkflow) { ?>
<option value="-1"><?php echo getMLText("choose_workflow")?> <div id="workflowgraph">
<option value="0"><?php echo getMLText("add_workflow")?> <iframe src="out.WorkflowGraph.php?workflow=<?php echo $selworkflow->getID(); ?>" width="100%" height="550" style="border: 1px solid #AAA;"></iframe>
<?php
$selected=0;
$count=2;
foreach ($workflows as $currWorkflow) {
if (isset($selworkflow) && $currWorkflow->getID()==$selworkflow->getID()) $selected=$count;
print "<option value=\"".$currWorkflow->getID()."\">" . htmlspecialchars($currWorkflow->getName());
$count++;
}
?>
</select>
</div>
<div id="workflowgraph" class="well">
<iframe src="out.WorkflowGraph.php?workflow=1" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
</div>
</div> </div>
<?php }
} /* }}} */
<div class="span8"> function showWorkflowForm($workflow) { /* {{{ */
<div class="well"> $dms = $this->params['dms'];
<table class="table-condensed"> $user = $this->params['user'];
<tr> $workflows = $this->params['allworkflows'];
<td id="keywords0" style="display : none;"> $workflowstates = $this->params['allworkflowstates'];
<?php
if($workflowstates) {
?>
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflow'); ?>
<input type="Hidden" name="action" value="addworkflow">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><?php printMLText("workflow_initstate");?>:</td>
<td><select name="initstate">
<?php
foreach($workflowstates as $workflowstate) {
echo "<option value=\"".$workflowstate->getID()."\"";
echo ">".htmlspecialchars($workflowstate->getName())."</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow");?>"></td>
</tr>
</table>
</form>
<?php
} else {
?>
<p><?php printMLText("workflow_no_states"); ?></p>
<?php
}
?>
</td>
<?php if($workflow) {
foreach ($workflows as $currWorkflow) { $transitions = $workflow->getTransitions();
$initstate = $workflow->getInitState();
print "<td id=\"keywords".$currWorkflow->getID()."\" style=\"display : none;\">";
$transitions = $currWorkflow->getTransitions();
$initstate = $currWorkflow->getInitState();
$hasinitstate = true; $hasinitstate = true;
$missesug = false; $missesug = false;
if($transitions) { if($transitions) {
@ -184,31 +107,37 @@ function showWorkflow(selectObj) {
$this->errorMsg('One of the transitions has neither a user nor a group!'); $this->errorMsg('One of the transitions has neither a user nor a group!');
if(!$hasinitstate) if(!$hasinitstate)
$this->errorMsg('None of the transitions starts with the initial state of the workflow!'); $this->errorMsg('None of the transitions starts with the initial state of the workflow!');
?>
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data" name="form<?php print $currWorkflow->getID();?>" onsubmit="return checkForm('<?php print $currWorkflow->getID();?>');"> if($workflow->isUsed()) {
<?php echo createHiddenFieldWithKey('editworkflow'); ?>
<input type="Hidden" name="workflowid" value="<?php print $currWorkflow->getID();?>">
<input type="Hidden" name="action" value="editworkflow">
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflow->isUsed()) {
?> ?>
<p><?php echo getMLText('workflow_in_use') ?></p> <p><?php echo getMLText('workflow_in_use') ?></p>
<?php <?php
} else { } else {
?> ?>
<a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $currWorkflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a> <a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $workflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a>
<?php
}
}
?>
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data">
<?php
if($workflow) {
echo createHiddenFieldWithKey('editworkflow');
?>
<input type="Hidden" name="workflowid" value="<?php print $workflow->getID();?>">
<input type="Hidden" name="action" value="editworkflow">
<?php
} else {
echo createHiddenFieldWithKey('addworkflow');
?>
<input type="hidden" name="action" value="addworkflow">
<?php <?php
} }
?> ?>
</td> <table class="table-condensed">
</tr>
<tr> <tr>
<td><?php printMLText("workflow_name");?>:</td> <td><?php printMLText("workflow_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflow->getName());?>"></td> <td><input type="text" name="name" value="<?php print ($workflow ? htmlspecialchars($workflow->getName()) : "");?>"></td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("workflow_initstate");?>:</td> <td><?php printMLText("workflow_initstate");?>:</td>
@ -216,7 +145,7 @@ function showWorkflow(selectObj) {
<?php <?php
foreach($workflowstates as $workflowstate) { foreach($workflowstates as $workflowstate) {
echo "<option value=\"".$workflowstate->getID()."\""; echo "<option value=\"".$workflowstate->getID()."\"";
if($currWorkflow->getInitState()->getID() == $workflowstate->getID()) if($workflow && $workflow->getInitState()->getID() == $workflowstate->getID())
echo " selected=\"selected\""; echo " selected=\"selected\"";
echo ">".htmlspecialchars($workflowstate->getName())."</option>\n"; echo ">".htmlspecialchars($workflowstate->getName())."</option>\n";
} }
@ -231,11 +160,12 @@ function showWorkflow(selectObj) {
</table> </table>
</form> </form>
<?php <?php
if($workflow) {
$actions = $dms->getAllWorkflowActions(); $actions = $dms->getAllWorkflowActions();
if($actions) { if($actions) {
$transitions = $currWorkflow->getTransitions(); $transitions = $workflow->getTransitions();
echo "<table class=\"table table-condensed\">"; echo "<table class=\"table table-condensed\"><thead>";
echo "<tr><th>".getMLText('state_and_next_state')."</th><th>".getMLText('action')."</th><th>".getMLText('users_and_groups')."</th></tr>"; echo "<tr><th>".getMLText('state_and_next_state')."</th><th>".getMLText('action')."</th><th>".getMLText('users_and_groups')."</th><th></th></tr></thead><tbody>";
if($transitions) { if($transitions) {
foreach($transitions as $transition) { foreach($transitions as $transition) {
$state = $transition->getState(); $state = $transition->getState();
@ -273,7 +203,7 @@ function showWorkflow(selectObj) {
?> ?>
<form class="form-inline" action="../op/op.RemoveTransitionFromWorkflow.php" method="post"> <form class="form-inline" action="../op/op.RemoveTransitionFromWorkflow.php" method="post">
<?php echo createHiddenFieldWithKey('removetransitionfromworkflow'); ?> <?php echo createHiddenFieldWithKey('removetransitionfromworkflow'); ?>
<input type="hidden" name="workflow" value="<?php print $currWorkflow->getID();?>"> <input type="hidden" name="workflow" value="<?php print $workflow->getID();?>">
<input type="hidden" name="transition" value="<?php print $transition->getID(); ?>"> <input type="hidden" name="transition" value="<?php print $transition->getID(); ?>">
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("delete");?></button> <button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("delete");?></button>
</form> </form>
@ -282,9 +212,11 @@ function showWorkflow(selectObj) {
echo "</tr>\n"; echo "</tr>\n";
} }
} }
echo "</tbody></table>";
?> ?>
<form class="form-inline" action="../op/op.AddTransitionToWorkflow.php" method="post"> <form class="form-inline" action="../op/op.AddTransitionToWorkflow.php" method="post">
<?php <?php
echo "<table class=\"table table-condensed\"><thead></thead><tbody>";
echo "<tr>"; echo "<tr>";
echo "<td>"; echo "<td>";
echo "<select name=\"state\">"; echo "<select name=\"state\">";
@ -325,31 +257,62 @@ function showWorkflow(selectObj) {
echo "<td>"; echo "<td>";
?> ?>
<?php echo createHiddenFieldWithKey('addtransitiontoworkflow'); ?> <?php echo createHiddenFieldWithKey('addtransitiontoworkflow'); ?>
<input type="hidden" name="workflow" value="<?php print $currWorkflow->getID();?>"> <input type="hidden" name="workflow" value="<?php print $workflow->getID();?>">
<input type="submit" class="btn" value="<?php printMLText("add");?>"> <input type="submit" class="btn" value="<?php printMLText("add");?>">
<?php <?php
echo "</td>"; echo "</td>";
echo "</tr>\n"; echo "</tr>\n";
echo "</tbody></table>";
?> ?>
</form> </form>
<?php <?php
echo "</table>"; }
}
} /* }}} */
function form() { /* {{{ */
$selworkflow = $this->params['selworkflow'];
$this->showWorkflowForm($selworkflow);
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflow = $this->params['selworkflow'];
$workflows = $this->params['allworkflows'];
$workflowstates = $this->params['allworkflowstates'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("workflow_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select id="selector" class="span9">
<option value="-1"><?php echo getMLText("choose_workflow")?>
<option value="0"><?php echo getMLText("add_workflow")?>
<?php
foreach ($workflows as $currWorkflow) {
print "<option value=\"".$currWorkflow->getID()."\" ".($selworkflow && $currWorkflow->getID()==$selworkflow->getID() ? 'selected' : '').">" . htmlspecialchars($currWorkflow->getName());
} }
?> ?>
</td> </select>
<?php } ?>
</tr></table>
</div>
</div> </div>
<div class="ajax" data-view="WorkflowMgr" data-action="info" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div>
</div> </div>
<script language="JavaScript"> <div class="span8">
<div class="well">
sel = document.getElementById("selector"); <div class="ajax" data-view="WorkflowMgr" data-action="form" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div>
sel.selectedIndex=<?php print $selected ?>; </div>
showWorkflow(sel); </div>
</div>
</script>
<?php <?php
$this->contentEnd(); $this->contentEnd();

View File

@ -31,27 +31,15 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_WorkflowStatesMgr extends SeedDMS_Bootstrap_Style { class SeedDMS_View_WorkflowStatesMgr extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms']; header('Content-Type: application/javascript; charset=UTF-8');
$user = $this->params['user'];
$selworkflowstate = $this->params['selworkflowstate'];
$workflowstates = $dms->getAllWorkflowStates();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?> ?>
<script language="JavaScript">
function checkForm(num) function checkForm(num)
{ {
msg = new Array(); msg = new Array();
eval("var formObj = document.form" + num + ";");
if (formObj.name.value == "") msg.push("<?php printMLText("js_no_name");?>"); if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
if (msg != "") if (msg != "")
{ {
noty({ noty({
@ -68,87 +56,26 @@ function checkForm(num)
return true; return true;
} }
$(document).ready(function() {
obj = -1; $('body').on('submit', '#form1', function(ev){
function showWorkflowState(selectObj) { if(checkForm()) return;
if (obj != -1) { event.preventDefault();
obj.style.display = "none"; });
} $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowstateid: $(this).val()});
id = selectObj.options[selectObj.selectedIndex].value; });
if (id == -1) });
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php <?php
$this->contentHeading(getMLText("workflow_states_management")); } /* }}} */
?>
<div class="row-fluid"> function info() { /* {{{ */
<div class="span4"> $dms = $this->params['dms'];
<div class="well"> $user = $this->params['user'];
<?php echo getMLText("selection")?>: } /* }}} */
<select onchange="showWorkflowState(this)" id="selector" class="span9">
<option value="-1"><?php echo getMLText("choose_workflow_state")?>
<option value="0"><?php echo getMLText("add_workflow_state")?>
<?php
$selected=0;
$count=2;
foreach ($workflowstates as $currWorkflowState) {
if ($selworkflowstate && $currWorkflowState->getID()==$selworkflowstate->getID()) $selected=$count;
print "<option value=\"".$currWorkflowState->getID()."\">" . htmlspecialchars($currWorkflowState->getName());
$count++;
}
?>
</select>
</div>
</div>
<div class="span8"> function showWorkflowStateForm($state) { /* {{{ */
<div class="well"> if($state) {
<table class="table-condensed"> if($state->isUsed()) {
<tr>
<td id="keywords0" style="display : none;">
<form action="../op/op.WorkflowStatesMgr.php" method="post" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflowstate'); ?>
<input type="Hidden" name="action" value="addworkflowstate">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_state_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><?php printMLText("workflow_state_docstatus");?>:</td>
<td><select name="docstatus">
<option value=""><?php printMLText('keep_doc_status'); ?></option>
<option value="<?php echo S_RELEASED; ?>"><?php printMLText('released'); ?></option>
<option value="<?php echo S_REJECTED; ?>"><?php printMLText('rejected'); ?></option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow_state");?>"></td>
</tr>
</table>
</form>
</td>
<?php
foreach ($workflowstates as $currWorkflowState) {
print "<td id=\"keywords".$currWorkflowState->getID()."\" style=\"display : none;\">";
?>
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflowState->isUsed()) {
?> ?>
<p><?php echo getMLText('workflow_state_in_use') ?></p> <p><?php echo getMLText('workflow_state_in_use') ?></p>
<?php <?php
@ -156,51 +83,97 @@ function showWorkflowState(selectObj) {
?> ?>
<form class="form-inline" action="../op/op.RemoveWorkflowState.php" method="post"> <form class="form-inline" action="../op/op.RemoveWorkflowState.php" method="post">
<?php echo createHiddenFieldWithKey('removeworkflowstate'); ?> <?php echo createHiddenFieldWithKey('removeworkflowstate'); ?>
<input type="hidden" name="workflowstateid" value="<?php print $currWorkflowState->getID();?>"> <input type="hidden" name="workflowstateid" value="<?php print $state->getID();?>">
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow_state");?></button> <button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow_state");?></button>
</form> </form>
<?php <?php
} }
}
?> ?>
</td> <form action="../op/op.WorkflowStatesMgr.php" method="post" class="form-horizontal">
</tr> <?php
<form action="../op/op.WorkflowStatesMgr.php" method="post" name="form<?php print $currWorkflowState->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowState->getID();?>');"> if($state) {
<?php echo createHiddenFieldWithKey('editworkflowstate'); ?> echo createHiddenFieldWithKey('editworkflowstate');
<input type="Hidden" name="workflowstateid" value="<?php print $currWorkflowState->getID();?>"> ?>
<input type="Hidden" name="workflowstateid" value="<?php print $state->getID();?>">
<input type="Hidden" name="action" value="editworkflowstate"> <input type="Hidden" name="action" value="editworkflowstate">
<tr> <?php
<td><?php printMLText("workflow_state_name");?>:</td> } else {
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowState->getName());?>"></td> echo createHiddenFieldWithKey('addworkflowstate');
</tr> ?>
<tr> <input type="hidden" name="action" value="addworkflowstate">
<td><?php printMLText("workflow_state_docstatus");?>:</td> <?php
<td><select name="docstatus"> }
?>
<div class="control-group">
<label class="control-label" for="login"><?php printMLText("workflow_state_name");?>:</label>
<div class="controls">
<input type="text" id="name" name="name" value="<?php print $state ? htmlspecialchars($state->getName()) : '';?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="login"><?php printMLText("workflow_state_docstatus");?>:</label>
<div class="controls">
<select name="docstatus">
<option value=""><?php printMLText('keep_doc_status'); ?></option> <option value=""><?php printMLText('keep_doc_status'); ?></option>
<option value="<?php echo S_RELEASED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_RELEASED) echo "selected"; ?>><?php printMLText('released'); ?></option> <option value="<?php echo S_RELEASED; ?>" <?php if($state && $state->getDocumentStatus() == S_RELEASED) echo "selected"; ?>><?php printMLText('released'); ?></option>
<option value="<?php echo S_REJECTED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_REJECTED) echo "selected"; ?>><?php printMLText('rejected'); ?></option> <option value="<?php echo S_REJECTED; ?>" <?php if($state && $state->getDocumentStatus() == S_REJECTED) echo "selected"; ?>><?php printMLText('rejected'); ?></option>
</select></td> </select>
</tr> </div>
</div>
<tr> <div class="control-group">
<td></td> <label class="control-label" for="login"></label>
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td> <div class="controls">
</tr> <button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
</div>
</div>
</form> </form>
</table> <?php
</td> } /* }}} */
<?php } ?>
</tr></table> function form() { /* {{{ */
</div> $selworkflowstate = $this->params['selworkflowstate'];
$this->showWorkflowStateForm($selworkflowstate);
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflowstate = $this->params['selworkflowstate'];
$workflowstates = $dms->getAllWorkflowStates();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("workflow_states_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select id="selector" class="span9">
<option value="-1"><?php echo getMLText("choose_workflow_state")?>
<option value="0"><?php echo getMLText("add_workflow_state")?>
<?php
foreach ($workflowstates as $currWorkflowState) {
print "<option value=\"".$currWorkflowState->getID()."\" ".($selworkflowstate && $currWorkflowState->getID()==$selworkflowstate->getID() ? 'selected' : '').">" . htmlspecialchars($currWorkflowState->getName());
}
?>
</select>
</div> </div>
<div class="ajax" data-view="WorkflowStatesMgr" data-action="info" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
</div> </div>
<script language="JavaScript"> <div class="span8">
<div class="well">
sel = document.getElementById("selector"); <div class="ajax" data-view="WorkflowStatesMgr" data-action="form" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
sel.selectedIndex=<?php print $selected ?>; </div>
showWorkflowState(sel); </div>
</div>
</script>
<?php <?php
$this->contentEnd(); $this->contentEnd();