add files
Dieser Commit ist enthalten in:
Ursprung
935ba6e5d9
Commit
b75948a709
37 geänderte Dateien mit 4890 neuen und 0 gelöschten Zeilen
453
includes/config.plugin.php
Normale Datei
453
includes/config.plugin.php
Normale Datei
|
|
@ -0,0 +1,453 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Workflow allocation class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.5
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* @todo move functions to own file and add autoloader (Ortwin)
|
||||
*
|
||||
* $Id: config.plugin.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflow.php');
|
||||
plugin_include('workflow', 'includes/functions.workflow.php');
|
||||
|
||||
global $lngAct, $modidartlang;
|
||||
|
||||
$lngAct["workflow"]["workflow_delete"] = i18n("Delete workflow", "workflow");
|
||||
$lngAct["con_workflow"]["workflow_task_user_select"] = i18n("Select workflow task", "workflow");
|
||||
$lngAct["workflow_common"]["workflow_show"] = i18n("Show workflow", "workflow");
|
||||
$lngAct["workflow_common"]["workflow_create"] = i18n("Create workflow", "workflow");
|
||||
$lngAct["workflow_common"]["workflow_save"] = i18n("Edit workflow", "workflow");
|
||||
$lngAct["con"]["workflow_do_action"] = i18n("Process workflow step", "workflow");
|
||||
$lngAct["str"]["workflow_inherit_down"] = i18n("Inherit workflow down", "workflow");
|
||||
$lngAct["str"]["workflow_inherit_down"] = i18n("Inherit workflow down", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_step_edit"] = i18n("Edit workflow step", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_step_up"] = i18n("Move workflowstep up", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_step_down"] = i18n("Move workflowstep down", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_save_step"] = i18n("Save Workflowstep", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_create_step"] = i18n("Create workflowstep", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_step_delete"] = i18n("Delete workflowstep", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_user_up"] = i18n("Move workflowstepuser up", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_user_down"] = i18n("Move workflowstepuser down", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_create_user"] = i18n("Create Workflowstepuser", "workflow");
|
||||
$lngAct["workflow_steps"]["workflow_user_delete"] = i18n("Delete Workflowstepuser", "workflow");
|
||||
$lngAct["str"]["workflow_cat_assign"] = i18n("Associate workflow with category", "workflow");
|
||||
|
||||
$_cecRegistry->addChainFunction("Contenido.ArticleCategoryList.ListItems", "piworkflowCreateTasksFolder");
|
||||
$_cecRegistry->addChainFunction("Contenido.ArticleList.Columns", "piworkflowProcessArticleColumns");
|
||||
$_cecRegistry->addChainFunction("Contenido.ArticleList.Actions", "piworkflowProcessActions");
|
||||
$_cecRegistry->addChainFunction("Contenido.ArticleList.RenderColumn", "piworkflowRenderColumn");
|
||||
$_cecRegistry->addChainFunction("Contenido.ArticleList.RenderAction", "piworkflowRenderAction");
|
||||
$_cecRegistry->addChainFunction("Contenido.CategoryList.Columns", "piworkflowCategoryColumns");
|
||||
$_cecRegistry->addChainFunction("Contenido.CategoryList.RenderColumn", "piworkflowCategoryRenderColumn");
|
||||
$_cecRegistry->addChainFunction("Contenido.Frontend.AllowEdit", "piworkflowAllowArticleEdit");
|
||||
|
||||
function prepareWorkflowItems ()
|
||||
{
|
||||
|
||||
global $action, $lang, $modidcat, $workflowSelectBox, $workflowworkflows, $client, $tpl, $cfg;
|
||||
|
||||
$workflowworkflows = new Workflows;
|
||||
|
||||
if ($action === 'workflow_inherit_down')
|
||||
{
|
||||
$tmp = strDeeperCategoriesArray($modidcat);
|
||||
$asworkflow = getWorkflowForCat($modidcat);
|
||||
|
||||
$wfa = new WorkflowAllocations;
|
||||
|
||||
foreach ($tmp as $tmp_cat)
|
||||
{
|
||||
$idcatlang = getCatLang ($tmp_cat, $lang);
|
||||
|
||||
if ($asworkflow == 0)
|
||||
{
|
||||
$wfa->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($item = $wfa->next())
|
||||
{
|
||||
$wfa->delete($item->get("idallocation"));
|
||||
# delete user sequences for listing in tasklist for each included article
|
||||
$oArticles = new ArticleCollection(array('idcat' => $idcatlang, 'start' => true, 'offline' => true));
|
||||
while ($oArticle = $oArticles->nextArticle()) {
|
||||
setUserSequence($oArticle->getField('idartlang'), -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$wfa->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($item = $wfa->next())
|
||||
{
|
||||
$item->setWorkflow($asworkflow);
|
||||
$item->store();
|
||||
} else {
|
||||
$wfa->create($asworkflow, $idcatlang);
|
||||
# generate user sequences for listing in tasklist for each included article
|
||||
$oArticles = new ArticleCollection(array('idcat' => $tmp_cat, 'start' => true, 'offline' => true));
|
||||
while ($oArticle = $oArticles->nextArticle()) {
|
||||
setUserSequence($oArticle->getField('idartlang'), $asworkflow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == "workflow_cat_assign")
|
||||
{
|
||||
$seltpl = "wfselect".$modidcat;
|
||||
|
||||
$wfa = new WorkflowAllocations;
|
||||
$idcatlang = getCatLang($modidcat, $lang);
|
||||
|
||||
#associate workflow with category
|
||||
if ($GLOBALS[$seltpl] != 0)
|
||||
{
|
||||
$wfa->select("idcatlang = '$idcatlang'");
|
||||
if ($item = $wfa->next())
|
||||
{
|
||||
$item->setWorkflow($GLOBALS[$seltpl]);
|
||||
$item->store();
|
||||
} else {
|
||||
$wfa->create($GLOBALS[$seltpl], $idcatlang);
|
||||
}
|
||||
|
||||
# generate user sequences for listing in tasklist for each included article
|
||||
$oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true));
|
||||
while ($oArticle = $oArticles->nextArticle()) {
|
||||
setUserSequence($oArticle->getField('idartlang'), $GLOBALS[$seltpl]);
|
||||
}
|
||||
#unlink workflow with category
|
||||
} else {
|
||||
$wfa->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($item = $wfa->next())
|
||||
{
|
||||
$alloc = $item->get("idallocation");
|
||||
}
|
||||
$wfa->delete($alloc);
|
||||
|
||||
# delete user sequences for listing in tasklist for each included article
|
||||
$oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true));
|
||||
while ($oArticle = $oArticles->nextArticle()) {
|
||||
setUserSequence($oArticle->getField('idartlang'), -1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$workflowSelectBox = new cHTMLSelectElement("foo");
|
||||
$workflowSelectBox->setClass("text_medium");
|
||||
$workflowworkflows->select("idclient = '$client' AND idlang = '".Contenido_Security::escapeDB($lang, null)."'");
|
||||
|
||||
$workflowOption = new cHTMLOptionElement("--- ".i18n("None", "workflow")." ---", 0);
|
||||
$workflowSelectBox->addOptionElement(0,$workflowOption);
|
||||
|
||||
while ($workflow = $workflowworkflows->next())
|
||||
{
|
||||
$workflowOption = new cHTMLOptionElement($workflow->get("name"), $workflow->get("idworkflow"));
|
||||
$workflowSelectBox->addOptionElement($workflow->get("idworkflow"),$workflowOption);
|
||||
}
|
||||
|
||||
$workflowSelectBox->updateAttributes(array("id" => "wfselect{IDCAT}"));
|
||||
$workflowSelectBox->updateAttributes(array("name" => "wfselect{IDCAT}"));
|
||||
|
||||
$tpl->set('s', 'PLUGIN_WORKFLOW', $workflowSelectBox->render().'<a href="javascript:setWorkflow({IDCAT}, \\\'wfselect{IDCAT}\\\')"><img src="'.$cfg["path"]["images"].'submit.gif" class="spaced"></a>');
|
||||
$tpl->set('s', 'PLUGIN_WORKFLOW_TRANSLATION', i18n("Inherit workflow down", "workflow"));
|
||||
}
|
||||
|
||||
function piworkflowCategoryRenderColumn ($idcat, $type)
|
||||
{
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case "workflow":
|
||||
$value = workflowInherit($idcat).'<script type="text/javascript" id="wf'.$idcat.'">printWorkflowSelect('.$idcat.', '.(int)getWorkflowForCat($idcat).');</script>';
|
||||
break;
|
||||
}
|
||||
|
||||
return ($value);
|
||||
}
|
||||
|
||||
function piworkflowCategoryColumns ($array)
|
||||
{
|
||||
prepareWorkflowItems();
|
||||
$myarray = array("workflow" => i18n("Workflow", "workflow"));
|
||||
|
||||
return ($myarray);
|
||||
}
|
||||
|
||||
function piworkflowProcessActions ($array)
|
||||
{
|
||||
global $idcat;
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
|
||||
if ($defaultidworkflow != 0)
|
||||
{
|
||||
$narray = array("todo",
|
||||
"wfartconf",
|
||||
"wftplconf",
|
||||
"wfonline",
|
||||
"wflocked",
|
||||
"duplicate",
|
||||
"delete",
|
||||
"usetime");
|
||||
} else {
|
||||
$narray = $array;
|
||||
}
|
||||
|
||||
return ($narray);
|
||||
}
|
||||
|
||||
function piworkflowRenderAction ($idcat, $idart, $idartlang, $type)
|
||||
{
|
||||
global $area, $frame, $idtpl, $cfg, $alttitle, $tmp_articletitle;
|
||||
global $tmp_artconf, $onlinelink, $lockedlink, $tplconf_link;
|
||||
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
|
||||
$idusersequence = getCurrentUserSequence($idartlang,$defaultidworkflow);
|
||||
$associatedUserSequence = new WorkflowUserSequence;
|
||||
$associatedUserSequence->loadByPrimaryKey($idusersequence);
|
||||
|
||||
$currentEditor = $associatedUserSequence->get("iduser");
|
||||
$workflowItem = $associatedUserSequence->getWorkflowItem();
|
||||
|
||||
if (isCurrentEditor($associatedUserSequence->get("iduser")))
|
||||
{
|
||||
/* Query rights for this user */
|
||||
$wfRights = $workflowItem->getStepRights();
|
||||
$mayEdit = true;
|
||||
} else {
|
||||
$wfRights = "";
|
||||
$mayEdit = false;
|
||||
}
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case "wfartconf":
|
||||
if ($wfRights["propertyedit"] == true)
|
||||
{
|
||||
return $tmp_artconf;
|
||||
}
|
||||
break;
|
||||
case "wfonline":
|
||||
if ($wfRights["publish"] == true)
|
||||
{
|
||||
return $onlinelink;
|
||||
}
|
||||
break;
|
||||
case "wflocked":
|
||||
if ($wfRights["lock"] == true)
|
||||
{
|
||||
return $lockedlink;
|
||||
}
|
||||
break;
|
||||
case "wftplconf":
|
||||
if ($wfRights["templateedit"] == true)
|
||||
{
|
||||
return $tplconf_link;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
function piworkflowProcessArticleColumns ($array)
|
||||
{
|
||||
global $idcat, $action, $modidartlang;
|
||||
|
||||
if ($action == "workflow_do_action")
|
||||
{
|
||||
$selectedAction = "wfselect".$modidartlang;
|
||||
doWorkflowAction($modidartlang, $GLOBALS[$selectedAction]);
|
||||
|
||||
}
|
||||
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
|
||||
if ($defaultidworkflow != 0)
|
||||
{
|
||||
$narray = array();
|
||||
$bInserted = false;
|
||||
foreach ($array as $sKey => $sValue) {
|
||||
$narray[$sKey] = $sValue;
|
||||
if ($sKey == 'title' && !$bInserted) {
|
||||
$narray["wftitle"] = $array["title"];
|
||||
$narray["wfstep"] = i18n("Workflow Step", "workflow");
|
||||
$narray["wfaction"] = i18n("Workflow Action", "workflow");
|
||||
$narray["wfeditor"] = i18n("Workflow Editor", "workflow");
|
||||
$narray["wflaststatus"] = i18n("Last status", "workflow");
|
||||
$bInserted = true;
|
||||
}
|
||||
}
|
||||
unset ($narray['title']);
|
||||
unset ($narray['changeddate']);
|
||||
unset ($narray['publisheddate']);
|
||||
unset ($narray['sortorder']);
|
||||
} else {
|
||||
$narray = $array;
|
||||
}
|
||||
|
||||
return ($narray);
|
||||
}
|
||||
|
||||
function piworkflowAllowArticleEdit ($idlang, $idcat, $idart, $user)
|
||||
{
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
|
||||
if ($defaultidworkflow == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$idartlang = getArtLang($idart, $idlang);
|
||||
$idusersequence = getCurrentUserSequence($idartlang,$defaultidworkflow);
|
||||
$associatedUserSequence = new WorkflowUserSequence;
|
||||
$associatedUserSequence->loadByPrimaryKey($idusersequence);
|
||||
|
||||
$currentEditor = $associatedUserSequence->get("iduser");
|
||||
|
||||
$workflowItem = $associatedUserSequence->getWorkflowItem();
|
||||
|
||||
if (isCurrentEditor($associatedUserSequence->get("iduser")))
|
||||
{
|
||||
$wfRights = $workflowItem->getStepRights();
|
||||
$mayEdit = true;
|
||||
} else {
|
||||
$wfRights = "";
|
||||
$mayEdit = false;
|
||||
}
|
||||
|
||||
if ($wfRights["articleedit"] == true)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
function piworkflowRenderColumn ($idcat, $idart, $idartlang, $column)
|
||||
{
|
||||
global $area, $frame, $idtpl, $cfg, $alttitle, $tmp_articletitle;
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
|
||||
$idusersequence = getCurrentUserSequence($idartlang,$defaultidworkflow);
|
||||
$associatedUserSequence = new WorkflowUserSequence;
|
||||
$associatedUserSequence->loadByPrimaryKey($idusersequence);
|
||||
|
||||
$currentEditor = $associatedUserSequence->get("iduser");
|
||||
|
||||
$workflowItem = $associatedUserSequence->getWorkflowItem();
|
||||
|
||||
if (isCurrentEditor($associatedUserSequence->get("iduser")))
|
||||
{
|
||||
$wfRights = $workflowItem->getStepRights();
|
||||
$mayEdit = true;
|
||||
} else {
|
||||
$wfRights = "";
|
||||
$mayEdit = false;
|
||||
}
|
||||
|
||||
switch ($column)
|
||||
{
|
||||
case "wftitle":
|
||||
if ($wfRights["articleedit"] == true)
|
||||
{
|
||||
$mtitle = $tmp_articletitle;
|
||||
} else {
|
||||
$mtitle = strip_tags($tmp_articletitle);
|
||||
}
|
||||
return ($mtitle);
|
||||
case "wfstep":
|
||||
if ($workflowItem === false)
|
||||
{
|
||||
return "nobody";
|
||||
}
|
||||
|
||||
return ($workflowItem->get("position").".) ".$workflowItem->get("name"));
|
||||
case "wfeditor":
|
||||
$sEditor = getGroupOrUserName($currentEditor);
|
||||
if (!$sEditor) {
|
||||
$sEditor = "nobody";
|
||||
}
|
||||
return $sEditor;
|
||||
case "wfaction":
|
||||
$defaultidworkflow = getWorkflowForCat($idcat);
|
||||
$idusersequence = getCurrentUserSequence($idartlang,$defaultidworkflow);
|
||||
|
||||
$sActionSelect = getActionSelect($idartlang, $idusersequence);
|
||||
if (!$sActionSelect) {
|
||||
$mayEdit = false;
|
||||
}
|
||||
|
||||
$form = new UI_Form("wfaction".$idartlang, "main.php", "get");
|
||||
$form->setVar("area",$area);
|
||||
$form->setVar("action","workflow_do_action");
|
||||
$form->setVar("frame", $frame);
|
||||
$form->setVar("idcat", $idcat);
|
||||
$form->setVar("modidartlang", $idartlang);
|
||||
$form->setVar("idtpl", $idtpl);
|
||||
$form->add("select", '<table cellspacing="0" border="0"><tr><td>'.$sActionSelect.'</td><td>');
|
||||
$form->add("button", '<input type="image" src="'.$cfg["path"]["htmlpath"].$cfg["path"]["images"]."submit.gif".'"></tr></table>');
|
||||
|
||||
if ($mayEdit == true)
|
||||
{
|
||||
return ($form->render(true));
|
||||
} else {
|
||||
return '--- ' . i18n("None") . ' ---';
|
||||
}
|
||||
|
||||
case "wflaststatus":
|
||||
$sStatus = getLastWorkflowStatus($idartlang);
|
||||
if (!$sStatus) {
|
||||
$sStatus = '--- ' . i18n("None") . ' ---';
|
||||
}
|
||||
return $sStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function piworkflowCreateTasksFolder ()
|
||||
{
|
||||
global $sess, $cfg;
|
||||
|
||||
$item = array();
|
||||
/* Create workflow tasks folder */
|
||||
$tmp_mstr = '<a href="javascript://" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
|
||||
|
||||
$mstr = sprintf($tmp_mstr, 'right_bottom',
|
||||
$sess->url("main.php?area=con_workflow&frame=4"),
|
||||
'right_top',
|
||||
$sess->url("main.php?area=con_workflow&frame=3"),
|
||||
'Workflow / Todo');
|
||||
|
||||
$item["image"] = '<img src="'.$cfg["path"]["contenido_fullhtml"].$cfg["path"]["plugins"].'workflow/images/workflow_erstellen.gif">';
|
||||
$item["title"] = $mstr;
|
||||
|
||||
|
||||
return ($item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
552
includes/functions.workflow.php
Normale Datei
552
includes/functions.workflow.php
Normale Datei
|
|
@ -0,0 +1,552 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Workflow functions
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.8.1
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2003-07-28
|
||||
* modified 2009-11-06, Murat Purc, replaced deprecated functions (PHP 5.3 ready)
|
||||
*
|
||||
* $Id: functions.workflow.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
cInclude("includes", "functions.con.php");
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflowitems.php');
|
||||
|
||||
function getUsers ($listid, $default)
|
||||
{
|
||||
global $idclient, $cfg, $auth;
|
||||
|
||||
$userlist = new Users;
|
||||
$users = $userlist->getAccessibleUsers(explode(',', $auth->auth['perm']));
|
||||
$grouplist = new Groups;
|
||||
$groups = $grouplist->getAccessibleGroups(explode(',', $auth->auth['perm']));
|
||||
|
||||
$tpl2 = new Template;
|
||||
$tpl2->set('s', 'NAME', 'user'.$listid);
|
||||
$tpl2->set('s', 'CLASS', 'text_small');
|
||||
$tpl2->set('s', 'OPTIONS', 'size=1');
|
||||
|
||||
$tpl2->set('d', 'VALUE', 0);
|
||||
$tpl2->set('d', 'CAPTION', '--- '.i18n("None", "workflow").' ---');
|
||||
if ($default == 0)
|
||||
{
|
||||
$tpl2->set('d', 'SELECTED', 'SELECTED');
|
||||
} else {
|
||||
$tpl2->set('d', 'SELECTED', '');
|
||||
}
|
||||
$tpl2->next();
|
||||
|
||||
if ( is_array($users) )
|
||||
{
|
||||
|
||||
foreach ($users as $key => $value)
|
||||
{
|
||||
|
||||
$tpl2->set('d', 'VALUE', $key);
|
||||
$tpl2->set('d', 'CAPTION', $value["realname"] . " (".$value["username"].")");
|
||||
|
||||
if ($default == $key)
|
||||
{
|
||||
$tpl2->set('d', 'SELECTED', 'SELECTED');
|
||||
} else {
|
||||
$tpl2->set('d', 'SELECTED', '');
|
||||
}
|
||||
|
||||
$tpl2->next();
|
||||
}
|
||||
}
|
||||
|
||||
$tpl2->set('d', 'VALUE', '0');
|
||||
$tpl2->set('d', 'CAPTION', '------------------------------------');
|
||||
$tpl2->set('d', 'SELECTED', 'disabled');
|
||||
$tpl2->next();
|
||||
|
||||
if ( is_array($groups) )
|
||||
{
|
||||
|
||||
foreach ($groups as $key => $value)
|
||||
{
|
||||
|
||||
$tpl2->set('d', 'VALUE', $key);
|
||||
$tpl2->set('d', 'CAPTION', $value["groupname"]);
|
||||
|
||||
if ($default == $key)
|
||||
{
|
||||
$tpl2->set('d', 'SELECTED', 'SELECTED');
|
||||
} else {
|
||||
$tpl2->set('d', 'SELECTED', '');
|
||||
}
|
||||
|
||||
$tpl2->next();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $tpl2->generate($cfg['path']['templates'].$cfg['templates']['generic_select'], true);
|
||||
|
||||
}
|
||||
|
||||
function isCurrentEditor ($uid)
|
||||
{
|
||||
global $auth, $cfg;
|
||||
|
||||
/* Check if the UID is a group. If yes, check if we are in it */
|
||||
$user = new User;
|
||||
if ($user->loadUserByUserID($uid) == false)
|
||||
{
|
||||
$db2 = new DB_ConLite;
|
||||
|
||||
/* Yes, it's a group. Let's try to load the group members! */
|
||||
$sql = "SELECT user_id FROM "
|
||||
.$cfg["tab"]["groupmembers"]."
|
||||
WHERE group_id = '".Contenido_Security::escapeDB($uid,$db2)."'";
|
||||
|
||||
$db2->query($sql);
|
||||
|
||||
while ($db2->next_record())
|
||||
{
|
||||
if ($db2->f("user_id") == $auth->auth["uid"])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($uid == $auth->auth["uid"])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getActionSelect ($idartlang, $idusersequence)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$workflowActions = new WorkflowActions;
|
||||
|
||||
$allActions = $workflowActions->getAvailableWorkflowActions();
|
||||
|
||||
$wfSelect = new Template;
|
||||
$wfSelect->set('s', 'NAME', 'wfselect'.$idartlang);
|
||||
$wfSelect->set('s', 'CLASS', 'text_medium');
|
||||
|
||||
$userSequence = new WorkflowUserSequence;
|
||||
$userSequence->loadByPrimaryKey($idusersequence);
|
||||
|
||||
$workflowItem = $userSequence->getWorkflowItem();
|
||||
|
||||
if ($workflowItem === false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$wfRights = $workflowItem->getStepRights();
|
||||
|
||||
$artAllocation = new WorkflowArtAllocations;
|
||||
$artAllocation->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($obj = $artAllocation->next())
|
||||
{
|
||||
$laststep = $obj->get("lastusersequence");
|
||||
}
|
||||
|
||||
$bExistOption = false;
|
||||
if ($laststep != $idusersequence)
|
||||
{
|
||||
$wfSelect->set('d', 'VALUE', 'next');
|
||||
$wfSelect->set('d', 'CAPTION', i18n("Confirm", "workflow"));
|
||||
$wfSelect->set('d', 'SELECTED', 'SELECTED');
|
||||
$wfSelect->next();
|
||||
$bExistOption = true;
|
||||
}
|
||||
|
||||
if ($wfRights["last"] == true)
|
||||
{
|
||||
$wfSelect->set('d', 'VALUE', 'last');
|
||||
$wfSelect->set('d', 'CAPTION', i18n("Back to last editor", "workflow"));
|
||||
$wfSelect->set('d', 'SELECTED', '');
|
||||
$wfSelect->next();
|
||||
$bExistOption = true;
|
||||
}
|
||||
|
||||
if ($wfRights["reject"] == true)
|
||||
{
|
||||
$wfSelect->set('d', 'VALUE', 'reject');
|
||||
$wfSelect->set('d', 'CAPTION', i18n("Reject article", "workflow"));
|
||||
$wfSelect->set('d', 'SELECTED', '');
|
||||
$wfSelect->next();
|
||||
$bExistOption = true;
|
||||
}
|
||||
|
||||
if ($wfRights["revise"] == true)
|
||||
{
|
||||
$wfSelect->set('d', 'VALUE', 'revise');
|
||||
$wfSelect->set('d', 'CAPTION', i18n("Revise article", "workflow"));
|
||||
$wfSelect->set('d', 'SELECTED', '');
|
||||
$wfSelect->next();
|
||||
$bExistOption = true;
|
||||
}
|
||||
|
||||
if ($bExistOption)
|
||||
return ($wfSelect->generate($cfg['path']['templates'].$cfg['templates']['generic_select'], true));
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#function for inserting todos in wokflow_art_allocation used, when a workflow is associated with a category in content->category
|
||||
function setUserSequence ($idartlang, $defaultidworkflow) {
|
||||
$wfaa = new WorkflowArtAllocations;
|
||||
$wfaa->select("idartlang = '$idartlang'");
|
||||
$idusersequence = 0;
|
||||
|
||||
if ($associatedUserSequence = $wfaa->next())
|
||||
{
|
||||
$idartallocation = $associatedUserSequence->get("idartallocation");
|
||||
$wfaa->delete($idartallocation);
|
||||
}
|
||||
|
||||
if ($defaultidworkflow != -1) {
|
||||
$newObj = $wfaa->create($idartlang);
|
||||
|
||||
if (!$newObj)
|
||||
{
|
||||
/* Try to load */
|
||||
$newObj = new WorkflowArtAllocation;
|
||||
|
||||
echo $wfaa->lasterror;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the first idusersequence for the new item */
|
||||
$workflowItems = new WorkflowItems;
|
||||
$workflowItems->select("idworkflow = '$defaultidworkflow' AND position = '1'");
|
||||
|
||||
if ($obj = $workflowItems->next())
|
||||
{
|
||||
$firstitem = $obj->get("idworkflowitem");
|
||||
}
|
||||
|
||||
$workflowUserSequences = new WorkflowUserSequences;
|
||||
$workflowUserSequences->select("idworkflowitem = '$firstitem' AND position = '1'");
|
||||
|
||||
if ($obj = $workflowUserSequences->next())
|
||||
{
|
||||
$firstIDUserSequence = $obj->get("idusersequence");
|
||||
}
|
||||
|
||||
$newObj->set("idusersequence", $firstIDUserSequence);
|
||||
$newObj->store();
|
||||
|
||||
$idusersequence = $newObj->get("idusersequence");
|
||||
$associatedUserSequence = $newObj;
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentUserSequence ($idartlang, $defaultidworkflow)
|
||||
{
|
||||
$wfaa = new WorkflowArtAllocations;
|
||||
$wfaa->select("idartlang = '$idartlang'");
|
||||
$idusersequence = 0;
|
||||
|
||||
if ($associatedUserSequence = $wfaa->next())
|
||||
{
|
||||
$idusersequence = $associatedUserSequence->get("idusersequence");
|
||||
}
|
||||
|
||||
if ($idusersequence == 0)
|
||||
{
|
||||
if ($associatedUserSequence != false)
|
||||
{
|
||||
$newObj = $associatedUserSequence;
|
||||
} else {
|
||||
$newObj = $wfaa->create($idartlang);
|
||||
|
||||
if (!$newObj)
|
||||
{
|
||||
/* Try to load */
|
||||
$newObj = new WorkflowArtAllocation;
|
||||
|
||||
echo $wfaa->lasterror;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the first idusersequence for the new item */
|
||||
$workflowItems = new WorkflowItems;
|
||||
$workflowItems->select("idworkflow = '$defaultidworkflow' AND position = '1'");
|
||||
|
||||
if ($obj = $workflowItems->next())
|
||||
{
|
||||
$firstitem = $obj->get("idworkflowitem");
|
||||
}
|
||||
|
||||
$workflowUserSequences = new WorkflowUserSequences;
|
||||
$workflowUserSequences->select("idworkflowitem = '$firstitem' AND position = '1'");
|
||||
|
||||
if ($obj = $workflowUserSequences->next())
|
||||
{
|
||||
$firstIDUserSequence = $obj->get("idusersequence");
|
||||
}
|
||||
|
||||
$newObj->set("idusersequence", $firstIDUserSequence);
|
||||
$newObj->store();
|
||||
|
||||
$idusersequence = $newObj->get("idusersequence");
|
||||
$associatedUserSequence = $newObj;
|
||||
}
|
||||
|
||||
return ($idusersequence);
|
||||
}
|
||||
|
||||
function getLastWorkflowStatus ($idartlang)
|
||||
{
|
||||
$wfaa = new WorkflowArtAllocations;
|
||||
|
||||
$wfaa->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($associatedUserSequence = $wfaa->next())
|
||||
{
|
||||
$laststatus = $associatedUserSequence->get("laststatus");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($laststatus)
|
||||
{
|
||||
case "reject":
|
||||
return (i18n("Rejected", "workflow"));
|
||||
break;
|
||||
case "revise":
|
||||
return (i18n("Revised", "workflow"));
|
||||
break;
|
||||
case "last":
|
||||
return (i18n("Last", "workflow"));
|
||||
break;
|
||||
case "confirm":
|
||||
return (i18n("Confirmed", "workflow"));
|
||||
break;
|
||||
default:
|
||||
return (i18n("None", "workflow"));
|
||||
break;
|
||||
}
|
||||
return ("");
|
||||
}
|
||||
|
||||
function doWorkflowAction ($idartlang, $action)
|
||||
{
|
||||
global $cfg, $idcat;
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case "last":
|
||||
$artAllocations = new WorkflowArtAllocations;
|
||||
$artAllocations->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($obj = $artAllocations->next())
|
||||
{
|
||||
$usersequence = new WorkflowUserSequence;
|
||||
$usersequence->loadByPrimaryKey($obj->get("idusersequence"));
|
||||
|
||||
$workflowitem = $usersequence->getWorkflowItem();
|
||||
|
||||
$idworkflow = $workflowitem->get("idworkflow");
|
||||
$newpos = $workflowitem->get("position") - 1;
|
||||
|
||||
if ($newpos < 1)
|
||||
{
|
||||
$newpos = 1;
|
||||
}
|
||||
|
||||
$workflowitems = new WorkflowItems;
|
||||
$workflowitems->select("idworkflow = '$idworkflow' AND position = '".Contenido_Security::escapeDB($newpos, NULL)."'");
|
||||
|
||||
if ($nextObj = $workflowitems->next())
|
||||
{
|
||||
$userSequences = new WorkflowUserSequences;
|
||||
$idworkflowitem = $nextObj->get("idworkflowitem");
|
||||
$userSequences->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($nextSeqObj = $userSequences->next())
|
||||
{
|
||||
$obj->set("lastusersequence", $obj->get("idusersequence"));
|
||||
$obj->set("idusersequence",$nextSeqObj->get("idusersequence"));
|
||||
$obj->set("laststatus", "last");
|
||||
$obj->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "next":
|
||||
$artAllocations = new WorkflowArtAllocations;
|
||||
$artAllocations->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($obj = $artAllocations->next())
|
||||
{
|
||||
$usersequence = new WorkflowUserSequence;
|
||||
$usersequence->loadByPrimaryKey($obj->get("idusersequence"));
|
||||
|
||||
$workflowitem = $usersequence->getWorkflowItem();
|
||||
|
||||
$idworkflow = $workflowitem->get("idworkflow");
|
||||
$newpos = $workflowitem->get("position") + 1;
|
||||
|
||||
$workflowitems = new WorkflowItems;
|
||||
$workflowitems->select("idworkflow = '$idworkflow' AND position = '".Contenido_Security::escapeDB($newpos, NULL)."'");
|
||||
|
||||
if ($nextObj = $workflowitems->next())
|
||||
{
|
||||
$userSequences = new WorkflowUserSequences;
|
||||
$idworkflowitem = $nextObj->get("idworkflowitem");
|
||||
$userSequences->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($nextSeqObj = $userSequences->next())
|
||||
{
|
||||
$obj->set("lastusersequence", '10');
|
||||
$obj->set("idusersequence",$nextSeqObj->get("idusersequence"));
|
||||
$obj->set("laststatus", "confirm");
|
||||
$obj->store();
|
||||
}
|
||||
} else {
|
||||
$workflowitems->select("idworkflow = '$idworkflow' AND position = '".Contenido_Security::escapeDB($workflowitem->get("position"), NULL)."'");
|
||||
if ($nextObj = $workflowitems->next())
|
||||
{
|
||||
$userSequences = new WorkflowUserSequences;
|
||||
$idworkflowitem = $nextObj->get("idworkflowitem");
|
||||
$userSequences->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($nextSeqObj = $userSequences->next())
|
||||
{
|
||||
$obj->set("lastusersequence", $obj->get("idusersequence"));
|
||||
$obj->set("idusersequence",$nextSeqObj->get("idusersequence"));
|
||||
$obj->set("laststatus", "confirm");
|
||||
$obj->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "reject":
|
||||
$artAllocations = new WorkflowArtAllocations;
|
||||
$artAllocations->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($obj = $artAllocations->next())
|
||||
{
|
||||
$usersequence = new WorkflowUserSequence;
|
||||
$usersequence->loadByPrimaryKey($obj->get("idusersequence"));
|
||||
|
||||
$workflowitem = $usersequence->getWorkflowItem();
|
||||
|
||||
$idworkflow = $workflowitem->get("idworkflow");
|
||||
$newpos = 1;
|
||||
|
||||
$workflowitems = new WorkflowItems;
|
||||
$workflowitems->select("idworkflow = '$idworkflow' AND position = '".Contenido_Security::escapeDB($newpos, NULL)."'");
|
||||
|
||||
if ($nextObj = $workflowitems->next())
|
||||
{
|
||||
$userSequences = new WorkflowUserSequences;
|
||||
$idworkflowitem = $nextObj->get("idworkflowitem");
|
||||
$userSequences->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($nextSeqObj = $userSequences->next())
|
||||
{
|
||||
$obj->set("lastusersequence", $obj->get("idusersequence"));
|
||||
$obj->set("idusersequence",$nextSeqObj->get("idusersequence"));
|
||||
$obj->set("laststatus", "reject");
|
||||
$obj->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "revise":
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT idart, idlang FROM ".$cfg["tab"]["art_lang"] ." WHERE idartlang = '".Contenido_Security::escapeDB($idartlang, $db)."'";
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
$idart = $db->f("idart");
|
||||
$idlang = $db->f("idlang");
|
||||
|
||||
$newidart = conCopyArticle($idart,$idcat, "foo");
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
function getWorkflowForUserSequence ($usersequence)
|
||||
{
|
||||
$usersequences = new WorkflowUserSequences;
|
||||
$workflowitems = new WorkflowItems;
|
||||
$usersequences->select("idusersequence = '$usersequence'");
|
||||
|
||||
if ($obj = $usersequences->next())
|
||||
{
|
||||
$idworkflowitem = $obj->get("idworkflowitem");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$workflowitems->select("idworkflowitem = '$idworkflowitem'");
|
||||
if ($obj = $workflowitems->next())
|
||||
{
|
||||
return $obj->get("idworkflow");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function workflowSelect ($listid, $default, $idcat)
|
||||
{
|
||||
global $idclient, $cfg, $frame, $area, $workflowworkflows, $client, $lang, $wfcache, $workflowSelectBox;
|
||||
|
||||
$oSelectBox = new cHTMLSelectElement('workflow');
|
||||
$oSelectBox = $workflowSelectBox;
|
||||
|
||||
$default = (int) $default;
|
||||
$workflowSelectBox->updateAttributes(array("id" => "wfselect" . $idcat));
|
||||
$workflowSelectBox->updateAttributes(array("name" => "wfselect" . $idcat));
|
||||
$workflowSelectBox->setDefault($default);
|
||||
|
||||
$sButton ='<a href="javascript:setWorkflow('.$idcat.', \''."wfselect".$idcat.'\')"><img src="'.$cfg["path"]["images"].'submit.gif" class="spaced"></a>';
|
||||
|
||||
return $workflowSelectBox->render().$sButton;
|
||||
}
|
||||
|
||||
function workflowInherit ($idcat)
|
||||
{
|
||||
global $idclient, $cfg, $frame, $area, $workflowworkflows, $sess;
|
||||
$sUrl = $sess->url("main.php?area=$area&frame=$frame&modidcat=$idcat&action=workflow_inherit_down");
|
||||
$sButton ='<a href="'.$sUrl.'"><img src="'.$cfg["path"]["images"].'pfeil_runter.gif" class="spaced"></a>';
|
||||
return $sButton;
|
||||
}
|
||||
|
||||
?>
|
||||
109
includes/include.workflow_edit.php
Normale Datei
109
includes/include.workflow_edit.php
Normale Datei
|
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Contains workflow editing functions
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.3
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2003-05-20
|
||||
*
|
||||
* $Id: include.workflow_edit.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflow.php');
|
||||
|
||||
$form = new UI_Table_Form("workflow_edit");
|
||||
$userclass = new User;
|
||||
$workflows = new Workflows;
|
||||
|
||||
$workflow = $workflows->loadItem($idworkflow);
|
||||
|
||||
if ($action == "workflow_save")
|
||||
{
|
||||
if ($idworkflow == "-1")
|
||||
{
|
||||
$workflow = $workflows->create();
|
||||
}
|
||||
|
||||
$workflow->set("name",clHtmlSpecialChars($wfname));
|
||||
$workflow->set("description",clHtmlSpecialChars($wfdescription));
|
||||
$idworkflow = $workflow->get("idworkflow");
|
||||
$workflow->store();
|
||||
}
|
||||
|
||||
if ((int) $idworkflow == 0) {
|
||||
$idworkflow = $_GET['idworkflow'];
|
||||
}
|
||||
|
||||
if ($idworkflow) {
|
||||
$sReloadScript = "<script type=\"text/javascript\">
|
||||
var left_bottom = top.content.frames['left'].frames['left_bottom'];
|
||||
var right_top = top.content.frames['right'].frames['right_top'];
|
||||
if (left_bottom) {
|
||||
var href = left_bottom.location.href;
|
||||
href = href.replace(/&action=workflow_delete/, '');
|
||||
left_bottom.location.href = href+'&idworkflow='+".$idworkflow.";
|
||||
}
|
||||
|
||||
if (right_top) {
|
||||
right_top.location.href = right_top.location.href+'&idworkflow='+".$idworkflow.";
|
||||
}
|
||||
</script>";
|
||||
} else {
|
||||
$sReloadScript = '';
|
||||
}
|
||||
|
||||
|
||||
//function formGenerateField ($type, $name, $initvalue, $width, $maxlen)
|
||||
$form->setVar("area",$area);
|
||||
$form->setVar("action","workflow_save");
|
||||
$form->setVar("idworkflow", $idworkflow);
|
||||
$form->setVar("frame", $frame);
|
||||
|
||||
if ($workflow->virgin)
|
||||
{
|
||||
$name = i18n("New Workflow", "workflow");
|
||||
$header = i18n("Create new workflow", "workflow");
|
||||
} else {
|
||||
$header = i18n("Edit workflow", "workflow");
|
||||
$description = $workflow->get("description");
|
||||
$name = $workflow->get("name");
|
||||
$created = $workflow->get("created");
|
||||
$author = $userclass->getRealname($workflow->get("idauthor"));
|
||||
}
|
||||
|
||||
$form->addHeader($header);
|
||||
$form->add(i18n("Workflow name", "workflow"),formGenerateField("text","wfname",$name,40,255));
|
||||
$form->add(i18n("Description", "workflow"),formGenerateField("textbox","wfdescription",$description,50,10));
|
||||
$form->add(i18n("Author", "workflow"),$author);
|
||||
$form->add(i18n("Created", "workflow"),$created);
|
||||
|
||||
$page = new UI_Page;
|
||||
$page->setContent($form->render(true));
|
||||
$page->addScript('reload', $sReloadScript);
|
||||
|
||||
$page->render();
|
||||
|
||||
|
||||
?>
|
||||
48
includes/include.workflow_left_top.php
Normale Datei
48
includes/include.workflow_left_top.php
Normale Datei
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Workflow allocation class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.5
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2003-07-18
|
||||
*
|
||||
* $Id: include.workflow_left_top.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$create = new Link;
|
||||
$create->setMultiLink("workflow","","workflow_common","workflow_create");
|
||||
//$create->setCLink("workflow_common",4,"workflow_create");
|
||||
$create->setContent(i18n("Create workflow", "workflow"));
|
||||
$create->setCustom("idworkflow","-1");
|
||||
|
||||
$aAttributes = array();
|
||||
$aAttributes['class'] = "addfunction";
|
||||
$create->updateAttributes($aAttributes);
|
||||
|
||||
$ui = new UI_Left_Top;
|
||||
$ui->setLink($create);
|
||||
$ui->render();
|
||||
|
||||
?>
|
||||
129
includes/include.workflow_list.php
Normale Datei
129
includes/include.workflow_list.php
Normale Datei
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Workflow list
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.5
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2006-01-13
|
||||
*
|
||||
* $Id: include.workflow_list.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$iIdMarked = (int) $_GET['idworkflow'];
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflow.php');
|
||||
|
||||
$workflows = new Workflows;
|
||||
$sScript = '';
|
||||
if ($action == "workflow_delete")
|
||||
{
|
||||
$workflows->delete($idworkflow);
|
||||
$sScript = '<script type="text/javascript">
|
||||
var right_top = top.content.frames["right"].frames["right_top"];
|
||||
var right_bottom = top.content.frames["right"].frames["right_bottom"];
|
||||
|
||||
if (right_top) {
|
||||
right_top.location.href = "'.$sess->url('main.php?area=workflow&frame=3').'";
|
||||
}
|
||||
if (right_bottom) {
|
||||
right_bottom.location.href = "'.$sess->url('main.php?area=workflow&frame=4').'";
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
$ui = new UI_Menu;
|
||||
$workflows->select("idclient = '$client' AND idlang = '$lang'");
|
||||
|
||||
while ($workflow = $workflows->next())
|
||||
{
|
||||
$wfid = $workflow->getField("idworkflow");
|
||||
$wfname = $workflow->getField("name");
|
||||
$wfdescription = $workflow->getField("description");
|
||||
|
||||
/* Create the link to show/edit the workflow */
|
||||
$link = new Link;
|
||||
$link->setMultiLink("workflow","","workflow_common","workflow_show");
|
||||
$link->setAlt($wfdescription);
|
||||
$link->setCustom("idworkflow",$wfid);
|
||||
|
||||
$delTitle = i18n("Delete workflow", "workflow");
|
||||
$delDescr = sprintf(i18n("Do you really want to delete the following workflow:<br><br>%s<br>", "workflow"),$wfname);
|
||||
$delete = '<a title="'.$delTitle.'" href="javascript://" onclick="box.confirm(\''.$delTitle.'\', \''.$delDescr.'\', \'deleteWorkflow(\\\''.$wfid.'\\\')\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$delTitle.'" alt="'.$delTitle.'"></a>';
|
||||
|
||||
$ui->setTitle($wfid, $wfname);
|
||||
$ui->setLink($wfid, $link);
|
||||
|
||||
$ui->setActions($wfid, 'delete', $delete);
|
||||
|
||||
if ($wfid == $iIdMarked) {
|
||||
$ui->setExtra ($wfid, 'id="marked" ');
|
||||
}
|
||||
|
||||
}
|
||||
$content = $ui->render(false);
|
||||
|
||||
$delScript = '
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function foo(){return true;}
|
||||
|
||||
/* Session-ID */
|
||||
var sid = "'.$sess->id.'";
|
||||
|
||||
/* Create messageBox
|
||||
instance */
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
/* Function for deleting
|
||||
modules */
|
||||
|
||||
function deleteWorkflow(idworkflow) {
|
||||
url = "main.php?area=workflow";
|
||||
url += "&action=workflow_delete";
|
||||
url += "&frame=2";
|
||||
url += "&idworkflow=" + idworkflow;
|
||||
url += "&contenido=" + sid;
|
||||
parent.left_bottom.location.href = url;
|
||||
|
||||
}
|
||||
</script>';
|
||||
|
||||
$sInitRowMark = "<script type=\"text/javascript\">
|
||||
if (document.getElementById('marked')) {
|
||||
row.markedRow = document.getElementById('marked');
|
||||
}
|
||||
</script>";
|
||||
|
||||
$msgboxInclude = ' <script type="text/javascript" src="scripts/messageBox.js.php?contenido='.$sess->id.'"></script>';
|
||||
$page = new UI_Page;
|
||||
$page->addScript('include', $msgboxInclude);
|
||||
$page->addScript('del',$delScript);
|
||||
$page->addScript('refresh', $sScript);
|
||||
$page->setMargin(0);
|
||||
$page->setContent($content.$sInitRowMark);
|
||||
$page->render();
|
||||
|
||||
?>
|
||||
405
includes/include.workflow_steps.php
Normale Datei
405
includes/include.workflow_steps.php
Normale Datei
|
|
@ -0,0 +1,405 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Class for workflow allocation management
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.0
|
||||
* @author Unknwon
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* @modified 2008-12-05 Andreas Lindner, make select box values for time unit selection language independent
|
||||
|
||||
* {@internal
|
||||
* created
|
||||
*
|
||||
* $Id: include.workflow_steps.php 128 2019-07-03 11:58:28Z oldperl $:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflow.php');
|
||||
plugin_include('workflow', 'includes/functions.workflow.php');
|
||||
cInclude("includes", "functions.encoding.php");
|
||||
|
||||
$iIdMarked = (int) $_GET['idworkflowitem'];
|
||||
|
||||
$availableWorkflowActions= WorkflowActions :: getAvailableWorkflowActions();
|
||||
|
||||
$sCurrentEncoding = getEncodingByLanguage ($db, $lang, $cfg);
|
||||
|
||||
if (clHtmlEntities($adduser, ENT_COMPAT, $sCurrentEncoding) == i18n("Add User", "workflow")) {
|
||||
$action= "workflow_create_user";
|
||||
}
|
||||
|
||||
/* Function: Move step up */
|
||||
if ($action == "workflow_step_up") {
|
||||
$workflowitems= new WorkflowItems;
|
||||
$workflowitems->swap($idworkflow, $position, $position -1);
|
||||
}
|
||||
|
||||
/* Function: Move step down */
|
||||
if ($action == "workflow_step_down") {
|
||||
$workflowitems= new WorkflowItems;
|
||||
$workflowitems->swap($idworkflow, $position, $position +1);
|
||||
}
|
||||
|
||||
/* Function: Move user up */
|
||||
if ($action == "workflow_user_up") {
|
||||
$workflowitems= new WorkflowUserSequences;
|
||||
$workflowitems->swap($idworkflowitem, $position, $position -1);
|
||||
}
|
||||
|
||||
/* Function: Move step down */
|
||||
if ($action == "workflow_user_down") {
|
||||
$workflowitems= new WorkflowUserSequences;
|
||||
$workflowitems->swap($idworkflowitem, $position, $position +1);
|
||||
}
|
||||
|
||||
/* Function: Create new step */
|
||||
if ($action == "workflow_create_step") {
|
||||
$workflowitems= new WorkflowItems;
|
||||
$item= $workflowitems->create($idworkflow);
|
||||
$item->set("name", i18n("New Workflow Step", "workflow"));
|
||||
$item->store();
|
||||
$idworkflowitem= $item->get("idworkflowitem");
|
||||
}
|
||||
|
||||
/* Function: Delete step */
|
||||
if ($action == "workflow_step_delete") {
|
||||
$workflowitems= new WorkflowItems;
|
||||
$workflowitems->delete($idworkflowitem);
|
||||
}
|
||||
|
||||
/* Function: Add user */
|
||||
if ($action == "workflow_create_user") {
|
||||
$workflowusers= new WorkflowUserSequences;
|
||||
$new= $workflowusers->create($idworkflowitem);
|
||||
}
|
||||
|
||||
/* Function: Remove user */
|
||||
if ($action == "workflow_user_delete") {
|
||||
$workflowusers= new WorkflowUserSequences;
|
||||
$workflowusers->delete($idusersequence);
|
||||
}
|
||||
|
||||
/* Function: Save step */
|
||||
if ($action == "workflow_save_step" || $action == "workflow_create_user") {
|
||||
$workflowactions= new WorkflowActions;
|
||||
|
||||
foreach ($availableWorkflowActions as $key => $value) {
|
||||
if ($wfactions[$key] == 1) {
|
||||
$workflowactions->set($idworkflowitem, $key);
|
||||
} else {
|
||||
$workflowactions->remove($idworkflowitem, $key);
|
||||
}
|
||||
}
|
||||
|
||||
$workflowitem= new WorkflowItem;
|
||||
$workflowitem->loadByPrimaryKey($idworkflowitem);
|
||||
$workflowitem->setField('idtask', $wftaskselect);
|
||||
$workflowitem->setField('name', $wfstepname);
|
||||
$workflowitem->setField('description', $wfstepdescription);
|
||||
$workflowitem->store();
|
||||
|
||||
$usersequences= new WorkflowUserSequences;
|
||||
$usersequences->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
while ($usersequence= $usersequences->next()) {
|
||||
$wftime= "time" . $usersequence->get("idusersequence");
|
||||
$wfuser= "user" . $usersequence->get("idusersequence");
|
||||
|
||||
$wftimelimit= "wftimelimit" . $usersequence->get("idusersequence");
|
||||
$usersequence->set("timeunit", $$wftime);
|
||||
$usersequence->set("iduser", $$wfuser);
|
||||
$usersequence->set("timelimit", $$wftimelimit);
|
||||
$usersequence->set("emailnoti", $wfemailnoti[$usersequence->get("idusersequence")]);
|
||||
$usersequence->set("escalationnoti", $wfescalnoti[$usersequence->get("idusersequence")]);
|
||||
$usersequence->store();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getTimeUnitSelector($listid, $default) {
|
||||
global $idclient, $cfg, $auth;
|
||||
|
||||
$timeunits = array ();
|
||||
$timeunits['Seconds'] = i18n("Seconds", "workflow");
|
||||
$timeunits['Minutes'] = i18n("Minutes", "workflow");
|
||||
$timeunits['Hours'] = i18n("Hours", "workflow");
|
||||
$timeunits['Days'] = i18n("Days", "workflow");
|
||||
$timeunits['Weeks'] = i18n("Weeks", "workflow");
|
||||
$timeunits['Months'] = i18n("Months", "workflow");
|
||||
$timeunits['Years'] = i18n("Years", "workflow");
|
||||
|
||||
$tpl2= new Template;
|
||||
$tpl2->set('s', 'NAME', 'time' . $listid);
|
||||
$tpl2->set('s', 'CLASS', 'text_small');
|
||||
$tpl2->set('s', 'OPTIONS', 'size=1');
|
||||
|
||||
foreach ($timeunits as $key => $value) {
|
||||
|
||||
$tpl2->set('d', 'VALUE', $key);
|
||||
$tpl2->set('d', 'CAPTION', $value);
|
||||
|
||||
if ($default == $key) {
|
||||
$tpl2->set('d', 'SELECTED', 'SELECTED');
|
||||
} else {
|
||||
$tpl2->set('d', 'SELECTED', '');
|
||||
}
|
||||
|
||||
$tpl2->next();
|
||||
}
|
||||
|
||||
return $tpl2->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true);
|
||||
|
||||
}
|
||||
|
||||
function getWorkflowList() {
|
||||
global $idworkflow, $cfg;
|
||||
|
||||
$ui= new UI_Menu;
|
||||
$workflowitems= new WorkflowItems;
|
||||
|
||||
$workflowitems->select("idworkflow = '$idworkflow'", "", "position ASC");
|
||||
|
||||
while ($workflowitem= $workflowitems->next()) {
|
||||
$pos= $workflowitem->get("position");
|
||||
$name= $workflowitem->get("name");
|
||||
$id= $workflowitem->get("idworkflowitem");
|
||||
|
||||
$edititem= new Link;
|
||||
$edititem->setCLink("workflow_steps", 4, "workflow_step_edit");
|
||||
$edititem->setCustom("idworkflowitem", $id);
|
||||
$edititem->setCustom("idworkflow", $idworkflow);
|
||||
|
||||
|
||||
$moveup= new Link;
|
||||
$moveup->setCLink("workflow_steps", 4, "workflow_step_up");
|
||||
$moveup->setCustom("idworkflowitem", $id);
|
||||
$moveup->setCustom("idworkflow", $idworkflow);
|
||||
$moveup->setCustom("position", $pos);
|
||||
$moveup->setAlt(i18n("Move step up", "workflow"));
|
||||
$moveup->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/no_verschieben.gif" . '">');
|
||||
|
||||
$movedown= new Link;
|
||||
$movedown->setCLink("workflow_steps", 4, "workflow_step_down");
|
||||
$movedown->setCustom("idworkflowitem", $id);
|
||||
$movedown->setCustom("idworkflow", $idworkflow);
|
||||
$movedown->setCustom("position", $pos);
|
||||
$movedown->setAlt(i18n("Move step down", "workflow"));
|
||||
$movedown->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/nu_verschieben.gif" . '">');
|
||||
|
||||
|
||||
|
||||
$deletestep= new Link;
|
||||
$deletestep->setCLink("workflow_steps", 4, "workflow_step_delete");
|
||||
$deletestep->setCustom("idworkflowitem", $id);
|
||||
$deletestep->setCustom("idworkflow", $idworkflow);
|
||||
$deletestep->setCustom("position", $pos);
|
||||
$deletestep->setAlt(i18n("Delete step", "workflow"));
|
||||
$deletestep->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_step_delete.gif" . '">');
|
||||
|
||||
$ui->setTitle($id, "$pos. $name");
|
||||
$ui->setLink($id, $edititem);
|
||||
|
||||
if ($pos > 1) {
|
||||
$ui->setActions($id, "moveup", $moveup->render());
|
||||
} else {
|
||||
$ui->setActions($id, "moveup", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
|
||||
}
|
||||
|
||||
if ($pos < $workflowitems->count()) {
|
||||
$ui->setActions($id, "movedown", $movedown->render());
|
||||
} else {
|
||||
$ui->setActions($id, "movedown", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
|
||||
}
|
||||
|
||||
$ui->setActions($id, "delete", $deletestep->render());
|
||||
|
||||
if ($_GET['idworkflowitem'] == $id) {
|
||||
$ui->setExtra ($id, 'id="marked" ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$content= $ui->render(false);
|
||||
|
||||
return ($content);
|
||||
}
|
||||
|
||||
function createNewWorkflow() {
|
||||
global $idworkflow, $cfg;
|
||||
$content= "";
|
||||
$ui= new UI_Menu;
|
||||
$rowmark = false;
|
||||
|
||||
$createstep= new Link;
|
||||
$createstep->setCLink("workflow_steps", 4, "workflow_create_step");
|
||||
$createstep->setCustom("idworkflow", $idworkflow);
|
||||
|
||||
#$ui->setLink("spacer", NULL);
|
||||
$ui->setTitle("create", i18n("Create new step", "workflow"));
|
||||
$ui->setImage("create", $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_step_new.gif");
|
||||
$ui->setLink("create", $createstep);
|
||||
$ui->setRowmark ($rowmark);
|
||||
$ui->setBgColor("create", $cfg['color']['table_header']);
|
||||
|
||||
$content= $ui->render(false);
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
function editWorkflowStep($idworkflowitem) {
|
||||
global $area, $idworkflow, $idworkflowitem, $frame, $availableWorkflowActions;
|
||||
global $notification;
|
||||
$workflowitem= new WorkflowItem;
|
||||
|
||||
if ($workflowitem->loadByPrimaryKey($idworkflowitem) == false) {
|
||||
return " ";
|
||||
}
|
||||
|
||||
$workflowactions= new WorkflowActions;
|
||||
|
||||
$stepname= $workflowitem->get("name");
|
||||
$stepdescription= $workflowitem->get("description");
|
||||
$id= $workflowitem->get("idworkflowitem");
|
||||
$task= $workflowitem->get("idtask");
|
||||
|
||||
$form= new UI_Table_Form("workflow_edit");
|
||||
|
||||
$form->setVar("area", $area);
|
||||
$form->setVar("action", "workflow_save_step");
|
||||
$form->setVar("idworkflow", $idworkflow);
|
||||
$form->setVar("idworkflowitem", $idworkflowitem);
|
||||
$form->setVar("frame", $frame);
|
||||
|
||||
$form->addHeader(i18n("Edit workflow step", "workflow"));
|
||||
$form->add(i18n("Step name", "workflow"), formGenerateField("text", "wfstepname", $stepname, 40, 255));
|
||||
$form->add(i18n("Step description", "workflow"), formGenerateField("textbox", "wfstepdescription", $stepdescription, 60, 10));
|
||||
|
||||
foreach ($availableWorkflowActions as $key => $value) {
|
||||
$actions .= formGenerateCheckbox("wfactions[" . $key . "]", "1", $workflowactions->get($id, $key)) . '<label for="wfactions[' . $key . ']1">' . $value . '</label>' . "<br>";
|
||||
}
|
||||
|
||||
$form->add(i18n("Actions", "workflow"), $actions);
|
||||
$form->add(i18n("Assigned users", "workflow"), getWorkflowUsers($idworkflowitem));
|
||||
|
||||
return $form->render(true);
|
||||
}
|
||||
|
||||
function getWorkflowUsers($idworkflowitem) {
|
||||
global $idworkflow, $cfg;
|
||||
|
||||
$ui= new UI_Menu;
|
||||
$workflowusers= new WorkflowUserSequences;
|
||||
|
||||
$workflowusers->select("idworkflowitem = '$idworkflowitem'", "", "position ASC");
|
||||
|
||||
while ($workflowitem= $workflowusers->next()) {
|
||||
$pos= $workflowitem->get("position");
|
||||
$iduser= $workflowitem->get("iduser");
|
||||
$timelimit= $workflowitem->get("timelimit");
|
||||
$timeunit= $workflowitem->get("timeunit");
|
||||
$email= $workflowitem->get("emailnoti");
|
||||
$escalation= $workflowitem->get("escalationnoti");
|
||||
$timeunit= $workflowitem->get("timeunit");
|
||||
$id= $workflowitem->get("idusersequence");
|
||||
|
||||
$moveup= new Link;
|
||||
$moveup->setCLink("workflow_steps", 4, "workflow_user_up");
|
||||
$moveup->setCustom("idworkflowitem", $idworkflowitem);
|
||||
$moveup->setCustom("idworkflow", $idworkflow);
|
||||
$moveup->setCustom("position", $pos);
|
||||
$moveup->setAlt(i18n("Move user up", "workflow"));
|
||||
#$moveup->setContent('<img border="0" style="padding-left: 2px" src="images/pfeil_hoch.gif">');
|
||||
$moveup->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/no_verschieben.gif" . '">');
|
||||
|
||||
$movedown= new Link;
|
||||
$movedown->setCLink("workflow_steps", 4, "workflow_user_down");
|
||||
$movedown->setCustom("idworkflowitem", $idworkflowitem);
|
||||
$movedown->setCustom("idworkflow", $idworkflow);
|
||||
$movedown->setCustom("position", $pos);
|
||||
$movedown->setAlt(i18n("Move user down", "workflow"));
|
||||
$movedown->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/nu_verschieben.gif" . '">');
|
||||
|
||||
|
||||
|
||||
$deletestep= new Link;
|
||||
$deletestep->setCLink("workflow_steps", 4, "workflow_user_delete");
|
||||
$deletestep->setCustom("idworkflowitem", $idworkflowitem);
|
||||
$deletestep->setCustom("idworkflow", $idworkflow);
|
||||
$deletestep->setCustom("position", $pos);
|
||||
$deletestep->setCustom("idusersequence", $id);
|
||||
$deletestep->setAlt(i18n("Delete user", "workflow"));
|
||||
$deletestep->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_step_delete.gif" . '">');
|
||||
|
||||
$title= "$pos. " . getUsers($id, $iduser);
|
||||
$title .= formGenerateField("text", "wftimelimit" . $id, $timelimit, 3, 6);
|
||||
$title .= getTimeUnitSelector($id, $timeunit);
|
||||
$altmail= i18n("Notify this user via E-Mail", "workflow");
|
||||
$altnoti= i18n("Escalate to this user via E-Mail", "workflow");
|
||||
$title .= formGenerateCheckbox("wfemailnoti[" . $id . "]", "1", $email) . '<label for="wfemailnoti[' . $id . ']1"><img alt="' . $altmail . '" title="' . $altmail . '" style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_email_noti.gif" . '"></label>';
|
||||
$title .= formGenerateCheckbox("wfescalnoti[" . $id . "]", "1", $escalation) . '<label for="wfescalnoti[' . $id . ']1"><img alt="' . $altnoti . '" title="' . $altnoti . '" style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_escal_noti.gif" . '"></label>';
|
||||
|
||||
$ui->setTitle($id, $title);
|
||||
$ui->setLink($id, NULL);
|
||||
|
||||
if ($pos > 1) {
|
||||
$ui->setActions($id, "moveup", $moveup->render());
|
||||
} else {
|
||||
$ui->setActions($id, "moveup", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
|
||||
}
|
||||
|
||||
if ($pos < $workflowusers->count()) {
|
||||
$ui->setActions($id, "movedown", $movedown->render());
|
||||
} else {
|
||||
$ui->setActions($id, "movedown", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
|
||||
}
|
||||
|
||||
$ui->setActions($id, "delete", $deletestep->render());
|
||||
|
||||
$ui->setImage($id, $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_user.gif");
|
||||
|
||||
}
|
||||
|
||||
$createstep= new Link;
|
||||
$createstep->setCLink("workflow_steps", 4, "workflow_create_user");
|
||||
$createstep->setCustom("idworkflow", $idworkflow);
|
||||
$createstep->setCustom("idworkflowitem", $idworkflowitem);
|
||||
|
||||
$ui->setLink("spacer", NULL);
|
||||
|
||||
$ui->setTitle("create", '<input class="text_medium" type="submit" name="adduser" value="' . i18n("Add User", "workflow") . '">');
|
||||
$ui->setLink("create", NULL);
|
||||
$content= $ui->render(false);
|
||||
|
||||
return ($content);
|
||||
}
|
||||
|
||||
$tpl= new Template;
|
||||
$tpl->set('s', 'NEW', createNewWorkflow());
|
||||
$tpl->set('s', 'STEPS', getWorkflowList());
|
||||
$tpl->set('s', 'EDITSTEP', editWorkflowStep($idworkflowitem));
|
||||
$tpl->set('s', 'BORDERCOLOR', $cfg["color"]["table_border"]);
|
||||
$frame= $tpl->generate($cfg["path"]["contenido"] . $cfg["path"]["plugins"] . "workflow/templates/template.workflow_steps.html", true);
|
||||
|
||||
$page= new UI_Page;
|
||||
$page->setContent($frame);
|
||||
$page->render();
|
||||
?>
|
||||
113
includes/include.workflow_subnav.php
Normale Datei
113
includes/include.workflow_subnav.php
Normale Datei
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Builds the third navigation layer
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1.1
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2003-05-20
|
||||
* modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307]
|
||||
*
|
||||
* $Id: include.workflow_subnav.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$nav = new Contenido_Navigation;
|
||||
|
||||
$parentarea = getParentAreaID($area);
|
||||
$sql = "SELECT
|
||||
idarea
|
||||
FROM
|
||||
".$cfg["tab"]["area"]." AS a
|
||||
WHERE
|
||||
a.name = '".Contenido_Security::escapeDB($parentarea, $db)."' OR
|
||||
a.parent_id = '".Contenido_Security::escapeDB($parentarea, $db)."'
|
||||
ORDER BY
|
||||
idarea";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
$in_str = "";
|
||||
|
||||
while ( $db->next_record() ) {
|
||||
$in_str .= $db->f('idarea') . ',';
|
||||
}
|
||||
|
||||
$len = strlen($in_str)-1;
|
||||
$in_str = substr($in_str, 0, $len);
|
||||
$in_str = '('.$in_str.')';
|
||||
|
||||
$sql = "SELECT
|
||||
b.location AS location,
|
||||
a.name AS name
|
||||
FROM
|
||||
".$cfg["tab"]["area"]." AS a,
|
||||
".$cfg["tab"]["nav_sub"]." AS b
|
||||
WHERE
|
||||
b.idarea IN ".Contenido_Security::escapeDB($in_str, $db)." AND
|
||||
b.idarea = a.idarea AND
|
||||
b.level = 1
|
||||
ORDER BY
|
||||
b.idnavs";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
while ( $db->next_record() ) {
|
||||
|
||||
# Extract caption from
|
||||
# the xml language file
|
||||
$caption = $nav->getName($db->f("location"));
|
||||
|
||||
$tmp_area = $db->f("name");
|
||||
|
||||
# Set template data
|
||||
$tpl->set("d", "ID", 'c_'.$tpl->dyn_cnt);
|
||||
$tpl->set("d", "CLASS", '');
|
||||
$tpl->set("d", "OPTIONS", '');
|
||||
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="'.$sess->url("main.php?area=$tmp_area&frame=4&idworkflow=$idworkflow").'">'.$caption.'</a>');
|
||||
if ($area == $tmp_area)
|
||||
{
|
||||
$tpl->set('s', 'DEFAULT', markSubMenuItem($tpl->dyn_cnt,true));
|
||||
}
|
||||
$tpl->next();
|
||||
|
||||
}
|
||||
|
||||
$tpl->set('s', 'COLSPAN', ($tpl->dyn_cnt * 2) + 2);
|
||||
$tpl->set('s', 'IDCAT', $idcat);
|
||||
$tpl->set('s', 'SESSID', $sess->id);
|
||||
$tpl->set('s', 'CLIENT', $client);
|
||||
$tpl->set('s', 'LANG', $lang);
|
||||
|
||||
|
||||
# Generate the third
|
||||
# navigation layer
|
||||
if ($idworkflow <= 0)
|
||||
{
|
||||
$tpl->generate($cfg["path"]["templates"].$cfg["templates"]["subnav_blank"]);
|
||||
} else {
|
||||
$tpl->generate($cfg["path"]["templates"] . $cfg["templates"]["subnav"]);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
274
includes/include.workflow_tasks.php
Normale Datei
274
includes/include.workflow_tasks.php
Normale Datei
|
|
@ -0,0 +1,274 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Workflow task overview mask
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.4
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2003-07-30
|
||||
*
|
||||
* $Id: include.workflow_tasks.php 128 2019-07-03 11:58:28Z oldperl $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflow.php');
|
||||
plugin_include('workflow', 'includes/functions.workflow.php');
|
||||
|
||||
global $sess;
|
||||
$sSession = $sess->id;
|
||||
|
||||
$wfa = new WorkflowArtAllocations;
|
||||
$wfu = new WorkflowUserSequences;
|
||||
$users = new User;
|
||||
$db2 = new DB_ConLite;
|
||||
|
||||
ob_start();
|
||||
|
||||
if ($usershow == "")
|
||||
{
|
||||
$usershow = $auth->auth["uid"];
|
||||
}
|
||||
|
||||
if (!$perm->have_perm_area_action($area, "workflow_task_user_select"))
|
||||
{
|
||||
$usershow = $auth->auth["uid"];
|
||||
}
|
||||
|
||||
if ($action == "workflow_do_action")
|
||||
{
|
||||
$selectedAction = "wfselect".$modidartlang;
|
||||
doWorkflowAction($modidartlang, $GLOBALS[$selectedAction]);
|
||||
}
|
||||
|
||||
$wfa->select();
|
||||
|
||||
while ($wfaitem = $wfa->next())
|
||||
{
|
||||
$wfaid = $wfaitem->get("idartallocation");
|
||||
$usersequence[$wfaid] = $wfaitem->get("idusersequence");
|
||||
$lastusersequence[$wfaid] = $wfaitem->get("lastusersequence");
|
||||
$article[$wfaid] = $wfaitem->get("idartlang");
|
||||
}
|
||||
|
||||
|
||||
if (is_array($usersequence))
|
||||
{
|
||||
foreach ($usersequence as $key => $value)
|
||||
{
|
||||
$wfu->select("idusersequence = '$value'");
|
||||
if ($obj = $wfu->next())
|
||||
{
|
||||
$userids[$key] = $obj->get("iduser");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($userids))
|
||||
{
|
||||
foreach ($userids as $key=>$value)
|
||||
{
|
||||
$isCurrent[$key] = false;
|
||||
|
||||
if ($usershow == $value)
|
||||
{
|
||||
$isCurrent[$key] = true;
|
||||
}
|
||||
|
||||
if ($users->loadUserByUserID($value) == false)
|
||||
{
|
||||
/* Yes, it's a group. Let's try to load the group members! */
|
||||
$sql = "SELECT user_id FROM "
|
||||
.$cfg["tab"]["groupmembers"]."
|
||||
WHERE group_id = '".$value."'";
|
||||
$db2->query(Contenido_Security::escapeDB($sql, $db2));
|
||||
|
||||
while ($db2->next_record())
|
||||
{
|
||||
if ($db2->f("user_id") == $usershow)
|
||||
{
|
||||
$isCurrent[$key] = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($value == $usershow)
|
||||
{
|
||||
$isCurrent[$key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($lastusersequence[$key] == $usersequence[$key])
|
||||
{
|
||||
$isCurrent[$key] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->reset();
|
||||
$tpl->setEncoding('iso-8859-1');
|
||||
$tpl->set('s', 'SESSID', $sSession);
|
||||
$tpl->set('s', 'SESSNAME', $sess->name);
|
||||
$iIDCat = 0;
|
||||
$iIDTpl = 0;
|
||||
|
||||
if ($perm->have_perm_area_action($area, "workflow_task_user_select"))
|
||||
{
|
||||
$form = new UI_Form("showusers", $sess->url("main.php?area=$area&frame=$frame"));
|
||||
$form->setVar("area",$area);
|
||||
$form->setEvent("submit", "setUsershow();");
|
||||
$form->setVar("frame", $frame);
|
||||
$form->setVar("action", "workflow_task_user_select");
|
||||
$form->add("select",i18n("Show users").": ".getUsers("show",$usershow));
|
||||
$form->add("button", '<input style="vertical-align:middle;" type="image" src="'.$cfg["path"]["htmlpath"].$cfg["path"]["images"]."submit.gif".'">');
|
||||
|
||||
$tpl->set('s', 'USERSELECT', $form->render(true));
|
||||
} else {
|
||||
$tpl->set('s', 'USERSELECT', '');
|
||||
}
|
||||
|
||||
$pageTitle = i18n('Search results').' - '.i18n('Workflow tasks', 'workflow');
|
||||
$tpl->set('s', 'PAGE_TITLE', $pageTitle);
|
||||
|
||||
$tpl->set('s', 'TH_START', i18n("Article"));
|
||||
$tpl->set('s', 'TH_TEMPLATE', i18n("Template"));
|
||||
$tpl->set('s', 'TH_ACTIONS', i18n("Actions"));
|
||||
$tpl->set('s', 'TH_TITLE', i18n("Title"));
|
||||
$tpl->set('s', 'TH_CHANGED', i18n("Changed"));
|
||||
$tpl->set('s', 'TH_PUBLISHED', i18n("Published"));
|
||||
$tpl->set('s', 'TH_WORKFLOW_STEP', i18n("Workflow Step", 'workflow'));
|
||||
$tpl->set('s', 'TH_WORKFLOW_ACTION', i18n("Workflow Action", 'workflow'));
|
||||
$tpl->set('s', 'TH_WORKFLOW_EDITOR', i18n("Workflow Editor"));
|
||||
$tpl->set('s', 'TH_LAST_STATUS', i18n("Last status", 'workflow'));
|
||||
|
||||
$currentUserSequence = new WorkflowUserSequence;
|
||||
|
||||
if (is_array($isCurrent))
|
||||
{
|
||||
|
||||
foreach ($isCurrent as $key => $value)
|
||||
{
|
||||
if ($value == true)
|
||||
{
|
||||
$idartlang = Contenido_Security::toInteger($article[$key]);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
|
||||
$sql = "SELECT B.idcat AS idcat, A.title AS title, A.created AS created, A.lastmodified AS changed,
|
||||
A.idart as idart, E.name as tpl_name, A.idartlang as idartlang, F.idcatlang as idcatlang,
|
||||
B.idcatart as idcatart, A.idlang as art_lang, F.startidartlang as startidartlang
|
||||
FROM (".$cfg["tab"]["art_lang"]." AS A,
|
||||
".$cfg["tab"]["cat_art"]." AS B,
|
||||
".$cfg["tab"]["art"]." AS C)
|
||||
LEFT JOIN ".$cfg['tab']['tpl_conf']." as D ON A.idtplcfg = D.idtplcfg
|
||||
LEFT JOIN ".$cfg['tab']['tpl']." as E ON D.idtpl = E.`idtpl`
|
||||
LEFT JOIN ".$cfg['tab']['cat_lang']." as F ON B.idcat = F.`idcat`
|
||||
WHERE A.idartlang = '$idartlang' AND
|
||||
A.idart = B.idart AND
|
||||
A.idart = C.idart AND
|
||||
A.idlang = '$lang' AND
|
||||
C.idclient = '$client';";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record())
|
||||
{
|
||||
global $area;
|
||||
//$area = "con";
|
||||
$idcat = $db->f("idcat");
|
||||
$idart = $db->f("idart");
|
||||
|
||||
# create javascript multilink
|
||||
$tmp_mstr = '<a href="javascript://" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')" title="idart: '.$db->f('idart').' idcatart: '.$db->f('idcatart').'" alt="idart: '.$db->f('idart').' idcatart: '.$db->f('idcatart').'">%s</a>';
|
||||
|
||||
$mstr = sprintf($tmp_mstr, 'right_top',
|
||||
$sess->url("main.php?area=con&frame=3&idcat=$idcat&idtpl=$idtpl"),
|
||||
'right_bottom',
|
||||
$sess->url("main.php?area=con_editart&action=con_edit&frame=4&idcat=$idcat&idtpl=$idtpl&idart=$idart"),
|
||||
$db->f("title"));
|
||||
|
||||
$laststatus = getLastWorkflowStatus($idartlang);
|
||||
$username = getGroupOrUserName($userids[$key]);
|
||||
$actionSelect = piworkflowRenderColumn($idcat, $idart, $db->f('idartlang'), 'wfaction');
|
||||
|
||||
$currentUserSequence->loadByPrimaryKey($usersequence[$key]);
|
||||
$workflowItem = $currentUserSequence->getWorkflowItem();
|
||||
$step = $workflowItem->get("name");
|
||||
$description = $workflowItem->get("description");
|
||||
|
||||
$sRowId = $db->f('idart').'-'.$db->f('idartlang').'-'.$db->f('idcat').'-'.$db->f('idcatlang').'-'.$db->f('idcatart').'-'.$db->f('art_lang');
|
||||
|
||||
if( $db->f('startidartlang') == $db->f('idartlang') ) {
|
||||
$makeStartarticle = "<img src=\"images/isstart1.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\">";
|
||||
} else {
|
||||
$makeStartarticle = "<img src=\"images/isstart0.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\">";
|
||||
}
|
||||
|
||||
$todoListeSubject = i18n("Reminder");
|
||||
$sReminder = i18n("Set reminder / add to todo list");
|
||||
$sReminderHtml = "<a id=\"m1\" onclick=\"javascript:window.open('main.php?subject=$todoListeSubject&area=todo&frame=1&itemtype=idart&itemid=$idart&contenido=$sSession', 'todo', 'scrollbars=yes, height=300, width=550');\" alt=\"$sReminder\" title=\"$sReminder\" href=\"#\"><img id=\"m2\" style=\"padding-left: 2px; padding-right: 2px;\" alt=\"$sReminder\" src=\"images/but_setreminder.gif\" border=\"0\"></a>";
|
||||
|
||||
$templatename = $db->f('tpl_name');
|
||||
if (!empty($templatename)) {
|
||||
$templatename = clHtmlEntities($templatename);
|
||||
} else {
|
||||
$templatename = '--- ' . i18n("None") . ' ---';
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
$iIDCat = $db->f("idcat");
|
||||
$iIDTpl = $idtpl;
|
||||
$tpl->set('s', 'FIRST_ROWID', $sRowId);
|
||||
}
|
||||
|
||||
$tpl->set('d', 'START', $makeStartarticle);
|
||||
$tpl->set('d', 'TITLE', $mstr);
|
||||
$tpl->set('d', 'LAST_STATUS', $laststatus);
|
||||
$tpl->set('d', 'WORKFLOW_EDITOR', $username);
|
||||
$tpl->set('d', 'WORKFLOW_STEP', $step);
|
||||
$tpl->set('d', 'WORKFLOW_ACTION', $actionSelect);
|
||||
$tpl->set('d', 'TEMPLATE', $templatename);
|
||||
$tpl->set('d', 'BGCOLOR', $cfg['color']['table_dark_offline']);
|
||||
$tpl->set('d', 'ROWID', $sRowId);
|
||||
$tpl->set('d', 'ACTIONS', $sReminderHtml);
|
||||
$tpl->next();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($i > 0) {
|
||||
$tpl->set('s', 'NO_ARTICLES_ROW');
|
||||
} else {
|
||||
$sRow = '<tr><td colspan="8" class="bordercell">' . i18n("No article found.") . '</td></tr>';
|
||||
$tpl->set('s', 'NO_ARTICLES_ROW', $sRow);
|
||||
}
|
||||
|
||||
$sLoadSubnavi = 'parent.parent.frames["right"].frames["right_top"].location.href = \'main.php?area=con&frame=3&idcat=' . $iIDCat . '&idtpl=' . $iIDTpl . '&contenido=' . $sSession . "';";
|
||||
$tpl->set('s', 'SUBNAVI', $sLoadSubnavi);
|
||||
|
||||
$frame = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$tpl->generate($cfg["path"]['contenido'] . $cfg["path"]["plugins"] . "workflow/templates/template.workflow_tasks.html");
|
||||
|
||||
?>
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren