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 {
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"));
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkIndForm()
{
msg = new Array();
@ -76,9 +56,9 @@ function checkIndForm()
function checkGrpForm()
{
msg = new Array();
// if (document.form1.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.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
// if (document.form2.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>");
if (document.form2.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.form2.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "")
{
noty({
@ -94,9 +74,40 @@ function checkGrpForm()
else
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
} /* }}} */
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();
@ -118,7 +129,7 @@ function checkGrpForm()
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'); ?>
<table>
<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'); ?>
<table>
<tr><td><?php printMLText("comment")?>:</td>

View File

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

View File

@ -43,7 +43,7 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
} /* }}} */
function htmlStartPage($title="", $bodyClass="") { /* {{{ */
if(method_exists($this, 'js')) {
if(1 || method_exists($this, 'js')) {
/* We still need unsafe-eval, because printDocumentChooserHtml and
* printFolderChooserHtml will include a javascript file with ajax
* 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.'/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.'/application.css" rel="stylesheet">'."\n";
if($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 '<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 {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
document.form1.newpassword.focus();
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$referuri = $this->params['referuri'];
@ -43,7 +50,7 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
$this->pageNavigation(getMLText("change_password"));
$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
if ($referuri) {
echo "<input type='hidden' name='referuri' value='".$referuri."'/>";
@ -80,7 +87,6 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
</table>
</form>
<?php $this->contentContainerEnd(); ?>
<script language="JavaScript">document.form1.newpassword.focus();</script>
<p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p>
<?php
$this->contentEnd();

View File

@ -31,21 +31,10 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_EditComment extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$version = $this->params['version'];
function js() { /* {{{ */
$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);
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -70,13 +59,32 @@ 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'];
$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->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'); ?>
<input type="Hidden" name="documentid" value="<?php print $document->getID();?>">
<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 {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$event = $this->params['event'];
function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck'];
$this->htmlStartPage(getMLText("calendar"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("calendar"), "calendar");
$this->contentHeading(getMLText("edit_event"));
$this->contentContainerStart();
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array()
@ -71,9 +60,31 @@ function checkForm()
else
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'); ?>
<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 {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$attrdefs = $this->params['attrdefs'];
$rootfolderid = $this->params['rootfolderid'];
function js() { /* {{{ */
$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);
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -72,13 +60,32 @@ 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'];
$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->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="showtree" value="<?php echo showtree();?>">
<table class="table-condensed">

View File

@ -36,6 +36,32 @@ class SeedDMS_View_EditOnline extends SeedDMS_Bootstrap_Style {
var $file_count;
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() { /* {{{ */
$dms = $this->params['dms'];
$document = $this->params['document'];
@ -91,27 +117,6 @@ echo "<div class=\"row-fluid\">\n";
echo "<div class=\"span6\">\n";
$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">
<input type="hidden" name="documentid" value="<?= $document->getId() ?>" />
<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 {
function js() { /* {{{ */
header('Content-Type: application/javascript');
?>
$(document).ready( function() {
$( "#selector" ).change(function() {
$('#form').submit();
});
});
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -75,15 +86,15 @@ class SeedDMS_View_GroupView extends SeedDMS_Bootstrap_Style {
if($manager->getId() == $member->getId())
echo ", ".getMLText("manager");
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>";
}
if($ismanager) {
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 "<select name=\"userid\" onChange=\"javascript: submit();\">";
echo "<select id=\"selector\" name=\"userid\" _onChange=\"javascript: submit();\">";
echo "<option value=\"\"></option>";
foreach($allUsers as $u) {
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 {
function js() { /* {{{ */
header('Content-Type: application/javascript');
$this->printFolderChooserJs("form1");
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -46,12 +52,12 @@ class SeedDMS_View_MoveFolder extends SeedDMS_Bootstrap_Style {
?>
<form action="../op/op.MoveFolder.php" name="form1">
<input type="Hidden" name="folderid" value="<?php print $folder->getID();?>">
<input type="Hidden" name="showtree" value="<?php echo showtree();?>">
<input type="hidden" name="folderid" value="<?php print $folder->getID();?>">
<input type="hidden" name="showtree" value="<?php echo showtree();?>">
<table class="table-condensed">
<tr>
<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>
<td></td>

View File

@ -31,26 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_OverrideContentStatus extends SeedDMS_Bootstrap_Style {
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"));
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -70,14 +53,38 @@ 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'];
$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();
// 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">
<tr><td><?php echo(printMLText("comment")); ?>:</td>
<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 {
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() { /* {{{ */
$referrer = $this->params['referrer'];
@ -41,7 +73,7 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
?>
<?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
if ($referrer) {
echo "<input type='hidden' name='referuri' value='".$referrer."'/>";
@ -64,7 +96,6 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
</table>
</form>
<?php $this->contentContainerEnd(); ?>
<script language="JavaScript">document.form1.email.focus();</script>
<p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p>
<?php
$this->contentEnd();

View File

@ -47,7 +47,7 @@ class SeedDMS_View_RemoveWorkflow extends SeedDMS_Bootstrap_Style {
<div class="row-fluid">
<div class="span4">
<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'); ?>
<table>
<tr><td></td><td>

View File

@ -69,7 +69,7 @@ class SeedDMS_View_RemoveWorkflowFromDocument extends SeedDMS_Bootstrap_Style {
<div class="row-fluid">
<div class="span4">
<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'); ?>
<table>
<tr><td></td><td>

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_ReturnFromSubWorkflow extends SeedDMS_Bootstrap_Style {
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"));
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -65,9 +52,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'];
$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();
$wkflog = $latestContent->getWorkflowLog();
@ -93,7 +100,7 @@ function checkForm()
?>
<div class="row-fluid">
<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'); ?>
<table>
<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 {
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"));
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkIndForm()
{
msg = new Array();
@ -75,20 +56,57 @@ function checkIndForm()
function checkGrpForm()
{
msg = "";
if (document.form1.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.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (document.form2.reviewGroup.value == "") msg += "<?php printMLText("js_no_review_group");?>\n";
if (document.form2.reviewStatus.value == "") msg += "<?php printMLText("js_no_review_status");?>\n";
if (document.form2.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
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
} /* }}} */
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();
// Display the Review form.
@ -109,7 +127,7 @@ function checkGrpForm()
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'); ?>
<table class="table-condensed">
<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'); ?>
<table class="table-condensed">
<tr>

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_SearchForm extends SeedDMS_Bootstrap_Style {
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"), "");
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array()
@ -71,7 +58,32 @@ function checkForm()
else
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">
<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>
@ -82,7 +94,7 @@ function checkForm()
<?php
$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">
<tr>
<td><?php printMLText("search_query");?>:</td>
@ -160,7 +172,7 @@ function checkForm()
</tr>
<tr>
<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>
<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 {
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() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -48,18 +70,6 @@ class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style {
$this->contentContainerStart();
// 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="span4">
<?php
@ -78,7 +88,7 @@ function showWorkflow(selectObj) {
</td>
<td>
<?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();
$workflows=$dms->getAllWorkflows();
foreach ($workflows as $workflow) {

View File

@ -219,7 +219,7 @@ class SeedDMS_View_Statistic extends SeedDMS_Bootstrap_Style {
$this->contentContainerEnd();
$this->contentEnd();
$this->htmlEndPage();
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -31,22 +31,9 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_TriggerWorkflow extends SeedDMS_Bootstrap_Style {
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"));
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm()
{
msg = new Array();
@ -65,6 +52,32 @@ function checkForm()
else
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>
<?php
@ -93,7 +106,7 @@ function checkForm()
?>
<div class="row-fluid">
<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'); ?>
<table>
<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 {
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");
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
obj = -1;
function showKeywords(selectObj) {
if (obj != -1)
@ -54,15 +46,40 @@ function showKeywords(selectObj) {
obj = document.getElementById("keywords" + id);
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
} /* }}} */
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"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select onchange="showKeywords(this)" id="selector">
<select id="selector">
<option value="-1"><?php echo getMLText("choose_category")?>
<option value="0"><?php echo getMLText("new_default_keyword_category")?>
<?php
@ -181,14 +198,6 @@ function showKeywords(selectObj) {
</div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showKeywords(sel);
</script>
<?php
$this->contentEnd();
$this->htmlEndPage();

View File

@ -31,27 +31,14 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Bootstrap_Style {
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");
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm(num)
{
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 != "")
{
noty({
@ -68,79 +55,26 @@ function checkForm(num)
return true;
}
obj = -1;
function showWorkflowAction(selectObj) {
if (obj != -1) {
obj.style.display = "none";
}
id = selectObj.options[selectObj.selectedIndex].value;
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
$(document).ready( function() {
$('body').on('submit', '#form', function(ev){
if(checkForm()) return;
event.preventDefault();
});
$( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowactionid: $(this).val()});
});
});
<?php
$this->contentHeading(getMLText("workflow_actions_management"));
?>
} /* }}} */
<div class="row-fluid">
<div class="span4">
<div class="well">
<?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>
function info() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
} /* }}} */
<div class="span8">
<div class="well">
<table class="table-condensed">
<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()) {
function showWorkflowActionForm($action) { /* {{{ */
if($action) {
if($action->isUsed()) {
?>
<p><?php echo getMLText('workflow_action_in_use') ?></p>
<?php
@ -148,43 +82,88 @@ function showWorkflowAction(selectObj) {
?>
<form class="form-inline" action="../op/op.RemoveWorkflowAction.php" method="post">
<?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>
</form>
<?php
}
}
?>
</td>
</tr>
<form action="../op/op.WorkflowActionsMgr.php" method="post" name="form<?php print $currWorkflowAction->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowAction->getID();?>');">
<?php echo createHiddenFieldWithKey('editworkflowaction'); ?>
<input type="Hidden" name="workflowactionid" value="<?php print $currWorkflowAction->getID();?>">
<input type="Hidden" name="action" value="editworkflowaction">
<tr>
<td><?php printMLText("workflow_action_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowAction->getName());?>"></td>
</tr>
<tr>
<td></td>
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td>
</tr>
<form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal">
<?php
if($action) {
echo createHiddenFieldWithKey('editworkflowaction');
?>
<input type="hidden" name="workflowactionid" value="<?php print $action->getID();?>">
<input type="hidden" name="action" value="editworkflowaction">
<?php
} else {
echo createHiddenFieldWithKey('addworkflowaction');
?>
<input type="hidden" name="action" value="addworkflowaction">
<?php
}
?>
<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>
</table>
</td>
<?php } ?>
</tr></table>
</div>
<?php
} /* }}} */
function form() { /* {{{ */
$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 class="ajax" data-view="WorkflowActionsMgr" data-action="info" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showWorkflowAction(sel);
</script>
<div class="span8">
<div class="well">
<div class="ajax" data-view="WorkflowActionsMgr" data-action="form" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
</div>
</div>
</div>
<?php
$this->contentEnd();
$this->htmlEndPage();

View File

@ -31,6 +31,39 @@ require_once("class.Bootstrap.php");
*/
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() { /* {{{ */
$transitions = $this->workflow->getTransitions();
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_graph.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->contentContainerStart();
?>
<div id="canvas" style="width: 100%; height:480px; _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>
<div id="canvas" style="width: 100%; height:546px; _border: 1px solid #bbb;"></div>
<?php
// $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";
} /* }}} */
}

View File

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

View File

@ -31,27 +31,15 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_WorkflowStatesMgr extends SeedDMS_Bootstrap_Style {
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");
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
<script language="JavaScript">
function checkForm(num)
{
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 != "")
{
noty({
@ -68,87 +56,26 @@ function checkForm(num)
return true;
}
obj = -1;
function showWorkflowState(selectObj) {
if (obj != -1) {
obj.style.display = "none";
}
id = selectObj.options[selectObj.selectedIndex].value;
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
$( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowstateid: $(this).val()});
});
});
<?php
$this->contentHeading(getMLText("workflow_states_management"));
?>
} /* }}} */
<div class="row-fluid">
<div class="span4">
<div class="well">
<?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>
function info() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
} /* }}} */
<div class="span8">
<div class="well">
<table class="table-condensed">
<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()) {
function showWorkflowStateForm($state) { /* {{{ */
if($state) {
if($state->isUsed()) {
?>
<p><?php echo getMLText('workflow_state_in_use') ?></p>
<?php
@ -156,51 +83,97 @@ function showWorkflowState(selectObj) {
?>
<form class="form-inline" action="../op/op.RemoveWorkflowState.php" method="post">
<?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>
</form>
<?php
}
}
?>
</td>
</tr>
<form action="../op/op.WorkflowStatesMgr.php" method="post" name="form<?php print $currWorkflowState->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowState->getID();?>');">
<?php echo createHiddenFieldWithKey('editworkflowstate'); ?>
<input type="Hidden" name="workflowstateid" value="<?php print $currWorkflowState->getID();?>">
<form action="../op/op.WorkflowStatesMgr.php" method="post" class="form-horizontal">
<?php
if($state) {
echo createHiddenFieldWithKey('editworkflowstate');
?>
<input type="Hidden" name="workflowstateid" value="<?php print $state->getID();?>">
<input type="Hidden" name="action" value="editworkflowstate">
<tr>
<td><?php printMLText("workflow_state_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowState->getName());?>"></td>
</tr>
<tr>
<td><?php printMLText("workflow_state_docstatus");?>:</td>
<td><select name="docstatus">
<?php
} else {
echo createHiddenFieldWithKey('addworkflowstate');
?>
<input type="hidden" name="action" value="addworkflowstate">
<?php
}
?>
<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 echo S_RELEASED; ?>" <?php if($currWorkflowState->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>
</select></td>
</tr>
<tr>
<td></td>
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td>
</tr>
<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($state && $state->getDocumentStatus() == S_REJECTED) echo "selected"; ?>><?php printMLText('rejected'); ?></option>
</select>
</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>
</table>
</td>
<?php } ?>
</tr></table>
</div>
<?php
} /* }}} */
function form() { /* {{{ */
$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 class="ajax" data-view="WorkflowStatesMgr" data-action="info" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showWorkflowState(sel);
</script>
<div class="span8">
<div class="well">
<div class="ajax" data-view="WorkflowStatesMgr" data-action="form" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
</div>
</div>
</div>
<?php
$this->contentEnd();