function pathos_workflow_processApproval($id, $datatype, $response, $comment = "") { global $db; $info = $db->selectObject($datatype . "_wf_info", "real_id=" . $id); $latest = $db->selectObject($datatype . "_wf_revision", "wf_original=" . $id . " AND wf_major=" . $info->current_major . " AND wf_minor=" . $info->current_minor); $policy = $db->selectObject("approvalpolicy", "id=" . $info->policy_id); $state = unserialize($latest->wf_state_data); $latest->wf_minor++; $latest->wf_comment = $comment; $dataobj = new $datatype(); // usually a static class, but we cant do that with var class name global $user; $revoketype = SYS_WORKFLOW_REVOKE_NONE; $latest->wf_type = -1; $latest->wf_user_id = $user->id; // FIXME - need to check for repeat approvers / poster if (!in_array($user->id + 0, $state[0])) { $state[0][] = $user->id + 0; $info->open_slots = $policy->max_approvers + 1 - count($state[0]); } switch ($response) { case SYS_WORKFLOW_APPROVE_EDIT: $revoketype = $policy->on_edit; $latest->wf_type = SYS_WORKFLOW_ACTION_APPROVED_EDITED; $latest = call_user_func(array($datatype, "update"), $_POST, $latest); // Update the comment, also entered on the form. #$latest->wf_comment = $_POST['wf_comment']; $state[1][$user->id] = 1; break; case SYS_WORKFLOW_APPROVE_APPROVE: $revoketype = $policy->on_approve; $latest->wf_type = SYS_WORKFLOW_ACTION_APPROVED_APPROVED; $state[1][$user->id] = 1; break; case SYS_WORKFLOW_APPROVE_DENY: $revoketype = $policy->on_deny; $state[1][$user->id] = 0; if ($policy->delete_on_deny == 1) { $latest->wf_type = SYS_WORKFLOW_ACTION_DELETED; pathos_workflow_deleteRevisionPath($datatype, $latest->wf_original); } else { if ($user->is_acting_admin == 1) { // Admin denials always end up in deletion. It saves them the extra step. $latest->wf_type = SYS_WORKFLOW_ACTION_DELETED; pathos_workflow_deleteRevisionPath($datatype, $latest->wf_original); } else { $latest->wf_type = SYS_WORKFLOW_ACTION_APPROVED_DENIED; #$latest->wf_comment = $comment; } } break; } $state = pathos_workflow_revoke($state, $revoketype); $latest->wf_state_data = serialize($state); $info = pathos_workflow_updateInfoFromRevision($latest, $info); global $user; if (pathos_workflow_checkApprovalState($state, $policy) || $user->is_acting_admin == 1) { // Final approval given. pathos_workflow_handleApprovedRevision($latest, $datatype, $info); } else { if ($latest->wf_type != SYS_WORKFLOW_ACTION_DELETED) { // only handle revisions if we have not deleted the revision Path pathos_workflow_handleRevision($latest, $datatype, $info); } // run actions for $latest->wf_type pathos_workflow_runActions($policy, $latest->wf_type, $latest); } }
# without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU # General Public License along with Exponent; if # not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: delete.php,v 1.5 2005/04/18 15:33:05 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } $info = $db->selectObject($_GET['datatype'] . "_wf_info", "real_id=" . $_GET['id']); $object = $db->selectObject($_GET['datatype'] . "_wf_revision", "wf_original=" . $_GET['id'] . " AND wf_major=" . $info->current_major . " AND wf_minor=" . $info->current_minor); $state = unserialize($object->wf_state_data); $rloc = unserialize($object->location_data); if (pathos_permissions_check("manage_approval", $rloc)) { if (!defined('SYS_WORKFLOW')) { require_once BASE . 'subsystems/workflow.php'; } pathos_workflow_deleteRevisionPath($_GET['datatype'], $_GET['id']); } else { echo SITE_403_HTML; }