comanage-dev - [comanage-dev] r277 - in registry/trunk/app: Controller Lib Model View/CoPeople View/CoPetitions View/Layouts
Subject: COmanage Developers List
List archive
[comanage-dev] r277 - in registry/trunk/app: Controller Lib Model View/CoPeople View/CoPetitions View/Layouts
Chronological Thread
- From:
- To:
- Subject: [comanage-dev] r277 - in registry/trunk/app: Controller Lib Model View/CoPeople View/CoPetitions View/Layouts
- Date: Mon, 9 Apr 2012 10:26:00 -0400
Author: benno
Date: 2012-04-09 10:26:00 -0400 (Mon, 09 Apr 2012)
New Revision: 277
Modified:
registry/trunk/app/Controller/CoPetitionsController.php
registry/trunk/app/Lib/enum.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/CoPerson.php
registry/trunk/app/Model/CoPersonRole.php
registry/trunk/app/Model/CoPetition.php
registry/trunk/app/Model/CoPetitionHistoryRecord.php
registry/trunk/app/View/CoPeople/fields.inc
registry/trunk/app/View/CoPeople/index.ctp
registry/trunk/app/View/CoPetitions/fields.inc
registry/trunk/app/View/Layouts/default.ctp
Log:
Basic approvals for CO-208
Modified: registry/trunk/app/Controller/CoPetitionsController.php
===================================================================
--- registry/trunk/app/Controller/CoPetitionsController.php 2012-04-08
18:17:52 UTC (rev 276)
+++ registry/trunk/app/Controller/CoPetitionsController.php 2012-04-09
14:26:00 UTC (rev 277)
@@ -33,6 +33,12 @@
'limit' => 25,
'order' => array(
'modified' => 'asc'
+ ),
+ 'contain' => array(
+ 'ApproverCoPerson' => 'Name',
+ 'EnrolleeCoPerson' => 'Name',
+ 'PetitionerCoPerson' => 'Name',
+ 'SponsorCoPerson' => 'Name'
)
);
@@ -62,6 +68,7 @@
* - postcondition: $co_enrollment_attributes may be set.
*
* @since COmanage Registry v0.5
+ * @throws RuntimeException
*/
function add() {
@@ -147,7 +154,7 @@
// Start a transaction
$dbc = $this->CoPetition->getDataSource();
- $dbc->begin($this);
+ $dbc->begin();
// We need to manually construct an Org Identity, at least for now
until
// they're populated some other way (eg: SAML/LDAP). We'll need to add
a
@@ -197,7 +204,7 @@
$coData = array();
$coData['EnrolleeCoPerson'] = $this->request->data['EnrolleeCoPerson'];
$coData['EnrolleeCoPerson']['co_id'] = $this->cur_co['Co']['id'];
- $coData['EnrolleeCoPerson']['status'] = StatusEnum::Pending;
+ $coData['EnrolleeCoPerson']['status'] = StatusEnum::PendingApproval;
// Filter the data to pull related models up a level and, if optional
and
// not provided, drop the model entirely to avoid validation errors.
@@ -217,7 +224,7 @@
$coRoleData = array();
$coRoleData['EnrolleeCoPersonRole'] =
$this->request->data['EnrolleeCoPersonRole'];
- $coRoleData['EnrolleeCoPersonRole']['status'] = StatusEnum::Pending;
+ $coRoleData['EnrolleeCoPersonRole']['status'] =
StatusEnum::PendingApproval;
$coRoleData['EnrolleeCoPersonRole']['co_person_id'] = $coPersonID;
// Filter the data to pull related models up a level and, if optional
and
@@ -299,7 +306,7 @@
$petitioner = $this->Session->read('Auth.User.co_person_id');
$coPetitionData['CoPetition']['petitioner_co_person_id'] =
$petitioner;
- $coPetitionData['CoPetition']['status'] = StatusEnum::Pending;
+ $coPetitionData['CoPetition']['status'] =
StatusEnum::PendingApproval;
if($this->CoPetition->save($coPetitionData)) {
$coPetitionID = $this->CoPetition->id;
@@ -517,19 +524,18 @@
// Add a co_petition_history_record.
if(!$fail) {
- $coPetitionHistoryData = array();
- $coPetitionHistoryData['CoPetitionHistoryRecord']['co_petition_id']
= $coPetitionID;
-
$coPetitionHistoryData['CoPetitionHistoryRecord']['actor_co_person_id'] =
$petitioner;
- $coPetitionHistoryData['CoPetitionHistoryRecord']['action'] =
PetitionActionEnum::Created;
- $coPetitionHistoryData['CoPetitionHistoryRecord']['comment'] =
_txt('rs.pt.create');
-
-
if(!$this->CoPetition->CoPetitionHistoryRecord->save($coPetitionHistoryData))
{
- $fail = true;
+ try {
+ $this->CoPetition->CoPetitionHistoryRecord->record($coPetitionID,
+ $petitioner,
+
PetitionActionEnum::Created);
}
+ catch(Exception $e) {
+ $fail = false;
+ }
}
if(!$fail) {
- $dbc->commit($this);
+ $dbc->commit();
$this->Session->setFlash(_txt('rs.pt.create'), '', array(),
'success');
$this->performRedirect();
@@ -537,7 +543,7 @@
// Roll back and allow the form to re-render
$this->Session->setFlash(_txt('er.fields'), '', array(), 'error');
- $dbc->rollback($this);
+ $dbc->rollback();
}
} else {
// REST API gets standard behavior
@@ -547,6 +553,31 @@
}
/**
+ * Approve a petition.
+ * - precondition: $id must exist and be in 'Pending Approval' state
+ * - postcondition: On error, session flash message set
+ * - postcondition: Redirect generated
+ *
+ * @since COmanage Registry v0.5
+ * @param Integer Petition ID
+ */
+
+ function approve($id) {
+ try {
+ $this->CoPetition->updatePetition($id,
+ StatusEnum::Approved,
+
$this->Session->read('Auth.User.co_person_id'));
+
+ $this->Session->setFlash(_txt('rs.pt.approve'), '', array(),
'success');
+ }
+ catch(Exception $e) {
+ $this->Session->setFlash($e->getMessage(), '', array(), 'error');
+ }
+
+ $this->performRedirect();
+ }
+
+ /**
* Callback before other controller methods are invoked or views are
rendered.
* - postcondition: If invalid enrollment flow provided, session flash
message set
*
@@ -612,6 +643,31 @@
}
/**
+ * Deny a petition.
+ * - precondition: $id must exist and be in 'Pending Approval' state
+ * - postcondition: On error, session flash message set
+ * - postcondition: Redirect generated
+ *
+ * @since COmanage Registry v0.5
+ * @param Integer Petition ID
+ */
+
+ function deny($id) {
+ try {
+ $this->CoPetition->updatePetition($id,
+ StatusEnum::Denied,
+
$this->Session->read('Auth.User.co_person_id'));
+
+ $this->Session->setFlash(_txt('rs.pt.deny'), '', array(), 'success');
+ }
+ catch (Exception $e) {
+ $this->Session->setFlash($e->getMessage(), '', array(), 'error');
+ }
+
+ $this->performRedirect();
+ }
+
+ /**
* Determine the requested Enrollment Flow ID.
* - precondition: An enrollment flow ID should be specified as a named
query parameter or in form data.
*
@@ -648,6 +704,10 @@
// Add a new CO Petition?
$p['add'] = ($cmr['cmadmin'] || $cmr['coadmin'] ||
!empty($cmr['couadmin']));
+ // Approve a CO Petition?
+ $p['approve'] = ($cmr['cmadmin'] || $cmr['coadmin'] ||
!empty($cmr['couadmin']));
+ $p['deny'] = $p['approve'];
+
// Delete an existing CO Petition?
$p['delete'] = ($cmr['cmadmin'] || $cmr['coadmin'] ||
!empty($cmr['couadmin']));
Modified: registry/trunk/app/Lib/enum.php
===================================================================
--- registry/trunk/app/Lib/enum.php 2012-04-08 18:17:52 UTC (rev 276)
+++ registry/trunk/app/Lib/enum.php 2012-04-09 14:26:00 UTC (rev 277)
@@ -173,10 +173,11 @@
class PetitionActionEnum
{
- const Approved = 'PY';
- const Created = 'PC';
- const Declined = 'PX';
- const Denied = 'PN';
+ const Approved = 'PY';
+ const Created = 'PC';
+ const Declined = 'PX';
+ const Denied = 'PN';
+ const Finalized = 'PF';
}
class RequiredEnum
@@ -200,14 +201,15 @@
class StatusEnum
{
- const Active = 'A';
- const Approved = 'Y';
- const Deleted = 'D';
- const Denied = 'N';
- const Invited = 'I';
- const Pending = 'P';
- const Suspended = 'S';
- const Declined = 'X';
+ const Active = 'A';
+ const Approved = 'Y';
+ const Deleted = 'D';
+ const Denied = 'N';
+ const Invited = 'I';
+ const Pending = 'P';
+ const PendingApproval = 'PA';
+ const Suspended = 'S';
+ const Declined = 'X';
/*
public $from_api = array(
"Active" => Active,
@@ -325,23 +327,25 @@
);
$status_t = array(
- 'A' => 'Active',
- 'D' => 'Deleted',
- 'I' => 'Invited',
- 'N' => 'Denied',
- 'P' => 'Pending',
- 'S' => 'Suspended',
- 'X' => 'Declined',
- 'Y' => 'Approved'
+ 'A' => 'Active',
+ 'D' => 'Deleted',
+ 'I' => 'Invited',
+ 'N' => 'Denied',
+ 'P' => 'Pending',
+ 'PA' => 'PendingApproval',
+ 'S' => 'Suspended',
+ 'X' => 'Declined',
+ 'Y' => 'Approved'
);
$status_ti = array(
- 'Active' => 'A',
- 'Deleted' => 'D',
- 'Invited' => 'I',
- 'Denied' => 'N',
- 'Pending' => 'P',
- 'Suspended' => 'S',
- 'Declined' => 'X',
- 'Approved' => 'Y'
+ 'Active' => 'A',
+ 'Deleted' => 'D',
+ 'Invited' => 'I',
+ 'Denied' => 'N',
+ 'Pending' => 'P',
+ 'PendingApproval' => 'PA',
+ 'Suspended' => 'S',
+ 'Declined' => 'X',
+ 'Approved' => 'Y'
);
Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2012-04-08 18:17:52 UTC (rev 276)
+++ registry/trunk/app/Lib/lang.php 2012-04-09 14:26:00 UTC (rev 277)
@@ -147,13 +147,14 @@
RequiredEnum::Optional => 'Optional',
RequiredEnum::NotPermitted => 'Not Permitted'),
- 'en.status' => array(StatusEnum::Active => 'Active',
- StatusEnum::Approved => 'Approved',
- StatusEnum::Declined => 'Declined',
- StatusEnum::Denied => 'Denied',
- StatusEnum::Invited => 'Invited',
- StatusEnum::Pending => 'Pending',
- StatusEnum::Suspended => 'Suspended'),
+ 'en.status' => array(StatusEnum::Active => 'Active',
+ StatusEnum::Approved => 'Approved',
+ StatusEnum::Declined => 'Declined',
+ StatusEnum::Denied => 'Denied',
+ StatusEnum::Invited => 'Invited',
+ StatusEnum::Pending => 'Pending',
+ StatusEnum::PendingApproval => 'Pending
Approval',
+ StatusEnum::Suspended => 'Suspended'),
// Demographics
'en.nsf.gender' => array(NSFGenderEnum::Male => 'Male',
@@ -215,6 +216,7 @@
'er.deleted-a' => 'Deleted "%1$s"',
'er.db.connect' => 'Failed to connect to database: %1$s',
'er.db.schema' => 'Possibly failed to update database schema',
+ 'er.db.save' => 'Database save failed',
'er.ea.alter' => 'Failed to alter table for attribute',
'er.ea.exists' => 'An attribute named "%1$s" already exists within the
CO',
'er.ea.index' => 'Failed to update index for attribute',
@@ -236,12 +238,14 @@
'er.notprov.id' => '%1$s ID Not Provided',
'er.person.noex' => 'Person does not exist',
'er.person.none' => 'No CO Person, CO Person Role, or Org Identity
specified',
+ 'er.pt.status' => 'Change of petition status from %1$s to %2$s is not
permitted',
'er.reply.unk' => 'Unknown Reply',
'er.timeout' => 'Your session has expired. Please login again.',
'er.orgp.nomail' => '%1$s (Org Identity %2$s) has no known email
address.<br />Add an email address and then resend the invitation.',
'er.orgp.pool' => 'Failed to pool organizational identities',
'er.orgp.unk-a' => 'Unknown Org Identity "%1$s"',
'er.orgp.unpool' => 'Failed to unpool organizational identities',
+ 'er.unknown' => 'Unknown value "%1$s"',
// Fields
'fd.action' => 'Action',
@@ -382,6 +386,7 @@
'op.add' => 'Add',
'op.add-a' => 'Add "%1$s"',
'op.add.new' => 'Add a New %1$s',
+ 'op.approve' => 'Approve',
'op.back' => 'Back',
'op.begin' => 'Begin',
'op.cancel' => 'Cancel',
@@ -390,6 +395,7 @@
'op.delete' => 'Delete',
'op.delete.consfdemographics' => 'this NSF demographic entry',
'op.delete.ok' => 'Are you sure you wish to remove "%1$s"? This action
cannot be undone.',
+ 'op.deny' => 'Deny',
'op.edit' => 'Edit',
'op.edit.ea' => 'Edit Enrollment Attributes',
'op.edit-a' => 'Edit "%1$s"',
@@ -422,7 +428,9 @@
'rs.added-a' => '"%1$s" Added',
'rs.inv.conf' => 'Invitation Confirmed',
'rs.inv.dec' => 'Invitation Declined',
+ 'rs.pt.approve' => 'Petition Approved',
'rs.pt.create' => 'Petition Created',
+ 'rs.pt.deny' => 'Petition Denied',
'rs.updated' => '"%1$s" Updated',
// Setup
Modified: registry/trunk/app/Model/CoPerson.php
===================================================================
--- registry/trunk/app/Model/CoPerson.php 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/Model/CoPerson.php 2012-04-09 14:26:00 UTC (rev
277)
@@ -85,7 +85,8 @@
public $displayField = "CoPerson.id";
// Default ordering for find operations
- public $order = array("CoPerson.id");
+// XXX CO-296 Toss default order?
+// public $order = array("CoPerson.id");
// Validation rules for table elements
public $validate = array(
@@ -96,11 +97,14 @@
),
'status' => array(
'rule' => array('inList', array(StatusEnum::Active,
+ StatusEnum::Approved,
+ StatusEnum::Declined,
StatusEnum::Deleted,
+ StatusEnum::Denied,
StatusEnum::Invited,
StatusEnum::Pending,
- StatusEnum::Suspended,
- StatusEnum::Declined)),
+ StatusEnum::PendingApproval,
+ StatusEnum::Suspended)),
'required' => true,
'message' => 'A valid status must be selected'
)
Modified: registry/trunk/app/Model/CoPersonRole.php
===================================================================
--- registry/trunk/app/Model/CoPersonRole.php 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/Model/CoPersonRole.php 2012-04-09 14:26:00 UTC (rev
277)
@@ -100,11 +100,14 @@
),
'status' => array(
'rule' => array('inList', array(StatusEnum::Active,
+ StatusEnum::Approved,
+ StatusEnum::Declined,
StatusEnum::Deleted,
+ StatusEnum::Denied,
StatusEnum::Invited,
StatusEnum::Pending,
- StatusEnum::Suspended,
- StatusEnum::Declined))
+ StatusEnum::PendingApproval,
+ StatusEnum::Suspended))
),
'sponsor_co_person_id' => array(
'rule' => array('numeric'),
Modified: registry/trunk/app/Model/CoPetition.php
===================================================================
--- registry/trunk/app/Model/CoPetition.php 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/Model/CoPetition.php 2012-04-09 14:26:00 UTC (rev
277)
@@ -128,8 +128,7 @@
StatusEnum::Declined,
StatusEnum::Denied,
StatusEnum::Invited,
- StatusEnum::Pending,
- StatusEnum::Suspended)),
+ StatusEnum::PendingApproval)),
'required' => true,
'message' => 'A valid status must be selected'
)
@@ -140,4 +139,130 @@
public $cm_enum_types = array(
'status' => 'status_t'
);
+
+ /**
+ * Update the status of a CO Petition.
+ * - precondition: The Petition must be in a state suitable for the
desired new status.
+ *
+ * @since COmanage Registry v0.5
+ * @param Integer CO Petition ID
+ * @param StatusEnum Target status
+ * @param Integer CO Person ID of person causing update
+ * @throws InvalidArgumentException
+ * @throws RuntimeException
+ */
+
+ function updatePetition($id, $newStatus, $actorCoPersonID) {
+ // Try to find the status of the requested petition
+
+ $this->id = $id;
+ $curStatus = $this->field('status');
+
+ if(!$curStatus) {
+ throw new InvalidArgumentException(_txt('er.notfound',
array(_txt('ct.co_petitions.1'), $id)));
+ }
+
+ // Do we have a valid new status? If so, do we need to update CO Person
status?
+ $valid = false;
+ $newCoPersonStatus = null;
+
+ if($curStatus == StatusEnum::PendingApproval) {
+ // A Petition can go from PendingApproval to Approved or Denied
+
+ if($newStatus == StatusEnum::Approved
+ || $newStatus == StatusEnum::Denied) {
+ $valid = true;
+ $newCoPersonStatus = $newStatus;
+ }
+ }
+
+ if($valid) {
+ // Process the new status
+ $fail = false;
+
+ // Start a tronsaction
+ $dbc = $this->getDataSource();
+ $dbc->begin();
+
+ // Update the Petition status
+
+ $this->saveField('status', $newStatus);
+
+ // If this is an approval, update the approver field as well
+
+ if($newStatus == StatusEnum::Approved) {
+ $this->saveField('approver_co_person_id', $actorCoPersonID);
+ }
+
+ // Write a Petition History Record
+
+ if(!$fail) {
+ $petitionAction = null;
+
+ switch($newStatus) {
+ case StatusEnum::Approved:
+ $petitionAction = PetitionActionEnum::Approved;
+ break;
+ case StatusEnum::Denied:
+ $petitionAction = PetitionActionEnum::Denied;
+ break;
+ }
+
+ try {
+ $this->CoPetitionHistoryRecord->record($id,
+ $actorCoPersonID,
+ $petitionAction);
+ }
+ catch (Exception $e) {
+ $fail = true;
+ }
+ }
+
+ // Update CO Person Role state
+
+ if(!$fail && isset($newCoPersonStatus)) {
+ $coPersonRoleID = $this->field('enrollee_co_person_role_id');
+
+ if($coPersonRoleID) {
+ $this->EnrolleeCoPersonRole->id = $coPersonRoleID;
+ $this->EnrolleeCoPersonRole->saveField('status',
$newCoPersonStatus);
+ } else {
+ $fail = true;
+ }
+ }
+
+ // Maybe update CO Person state, but only if it's currently Pending
Approval
+
+ if(!$fail && isset($newCoPersonStatus)) {
+ $coPersonID = $this->field('enrollee_co_person_id');
+
+ if($coPersonID) {
+ $this->EnrolleeCoPerson->id = $coPersonID;
+
+ $curCoPersonStatus = $this->EnrolleeCoPerson->field('status');
+
+ if(isset($curCoPersonStatus)
+ && ($curCoPersonStatus == StatusEnum::PendingApproval)) {
+ $this->EnrolleeCoPerson->saveField('status', $newCoPersonStatus);
+ }
+ // else not a fail
+ } else {
+ $fail = true;
+ }
+ }
+
+ if(!$fail) {
+ // Commit
+
+ $dbc->commit();
+ } else {
+ // Rollback
+
+ $dbc->rollback();
+ throw new RuntimeException(_txt('er.db.save'));
+ }
+ } else {
+ throw new InvalidArgumentException(_txt('er.pt.status'),
array($curStatus, $newStatus));
+ }
+ }
}
Modified: registry/trunk/app/Model/CoPetitionHistoryRecord.php
===================================================================
--- registry/trunk/app/Model/CoPetitionHistoryRecord.php 2012-04-08
18:17:52 UTC (rev 276)
+++ registry/trunk/app/Model/CoPetitionHistoryRecord.php 2012-04-09
14:26:00 UTC (rev 277)
@@ -45,4 +45,48 @@
// Validation rules for table elements
public $validate = array(
);
+
+ /**
+ * Create a CO Petition History Record.
+ *
+ * @since COmanage Registry v0.5
+ * @param Integer CO Petition ID
+ * @param Integer Actor CO Person ID
+ * @param PetitionActionEnum Action
+ * @param String Comment (if not provided, default comment for $action is
used)
+ * @throws InvalidArgumentException
+ * @throws RuntimeException
+ */
+
+ function record($coPetitionID, $actorCoPersonID, $action, $comment=null) {
+ $coPetitionHistoryData = array();
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['co_petition_id'] =
$coPetitionID;
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['actor_co_person_id']
= $actorCoPersonID;
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['action'] = $action;
+
+ if(isset($comment)) {
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['comment'] =
$comment;
+ } else {
+ // Figure out a default value
+
+ switch($action) {
+ case PetitionActionEnum::Approved:
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['comment'] =
_txt('rs.pt.approve');
+ break;
+ case PetitionActionEnum::Created:
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['comment'] =
_txt('rs.pt.create');
+ break;
+ case PetitionActionEnum::Denied:
+ $coPetitionHistoryData['CoPetitionHistoryRecord']['comment'] =
_txt('rs.pt.deny');
+ break;
+ default:
+ throw new InvalidArgumentException(_txt('er.unknown',
array($action)));
+ break;
+ }
+ }
+
+ if(!$this->save($coPetitionHistoryData)) {
+ throw new RuntimeException(_txt('er.db.save'));
+ }
+ }
}
Modified: registry/trunk/app/View/CoPeople/fields.inc
===================================================================
--- registry/trunk/app/View/CoPeople/fields.inc 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/View/CoPeople/fields.inc 2012-04-09 14:26:00 UTC (rev
277)
@@ -423,7 +423,7 @@
// so give them an edit button, too.
if($permissions['enroll']
- && $r['status'] == StatusEnum::Pending) {
+ && $r['status'] == StatusEnum::PendingApproval) {
print $this->Html->link(_txt('op.petition'),
array('controller' =>
'co_petitions',
'action' => 'view',
Modified: registry/trunk/app/View/CoPeople/index.ctp
===================================================================
--- registry/trunk/app/View/CoPeople/index.ctp 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/View/CoPeople/index.ctp 2012-04-09 14:26:00 UTC (rev
277)
@@ -62,6 +62,7 @@
$myPerson = false;
// We look at COU here if set for the role
+ // XXX this should really be calculated in the controller
if($permissions['edit']
&& (!isset($pr['cou_id'])
|| $pr['cou_id'] == ''
@@ -90,7 +91,7 @@
foreach ($p['CoPersonRole'] as $pr) {
if($myPerson) {
if($permissions['enroll']
- && $pr['status'] == StatusEnum::Pending
+ && $pr['status'] == StatusEnum::PendingApproval
&& !empty($pr['CoPetition'])) {
print $this->Html->link(_txt('op.petition'),
array('controller' => 'co_petitions',
Modified: registry/trunk/app/View/CoPetitions/fields.inc
===================================================================
--- registry/trunk/app/View/CoPetitions/fields.inc 2012-04-08 18:17:52
UTC (rev 276)
+++ registry/trunk/app/View/CoPetitions/fields.inc 2012-04-09 14:26:00
UTC (rev 277)
@@ -72,7 +72,37 @@
<tbody>
<tr class="line<?php print ($l % 2); $l++; ?>">
<th><?php print _txt('fd.status'); ?></th>
- <td><?php print _txt('en.status', null,
$co_petitions[0]['CoPetition']['status']); ?></td>
+ <td>
+ <?php
+ print _txt('en.status', null,
$co_petitions[0]['CoPetition']['status']);
+
+ if($co_petitions[0]['CoPetition']['status'] ==
StatusEnum::PendingApproval) {
+ if($permissions['approve']) {
+ print $this->Html->link(
+ _txt('op.approve'),
+ array('controller' => 'co_petitions',
+ 'action' => 'approve',
+ $co_petitions[0]['CoPetition']['id'],
+ 'co' => $co_petitions[0]['CoPetition']['co_id'],
+ 'coef' =>
$co_petitions[0]['CoPetition']['co_enrollment_flow_id']),
+ array('class' => 'checkbutton')
+ );
+ }
+
+ if($permissions['deny']) {
+ print $this->Html->link(
+ _txt('op.deny'),
+ array('controller' => 'co_petitions',
+ 'action' => 'deny',
+ $co_petitions[0]['CoPetition']['id'],
+ 'co' => $co_petitions[0]['CoPetition']['co_id'],
+ 'coef' =>
$co_petitions[0]['CoPetition']['co_enrollment_flow_id']),
+ array('class' => 'cancelbutton')
+ );
+ }
+ }
+ ?>
+ </td>
</tr>
<tr class="line<?php print ($l % 2); $l++; ?>">
<th><?php print _txt('fd.petitioner'); ?></th>
Modified: registry/trunk/app/View/Layouts/default.ctp
===================================================================
--- registry/trunk/app/View/Layouts/default.ctp 2012-04-08 18:17:52 UTC (rev
276)
+++ registry/trunk/app/View/Layouts/default.ctp 2012-04-09 14:26:00 UTC (rev
277)
@@ -142,7 +142,13 @@
primary: 'ui-icon-circle-close'
}
});
-
+
+ $(".checkbutton").button({
+ icons: {
+ primary: 'ui-icon-circle-check'
+ }
+ });
+
$(".comparebutton").button({
icons: {
primary: 'ui-icon-person'
- [comanage-dev] r277 - in registry/trunk/app: Controller Lib Model View/CoPeople View/CoPetitions View/Layouts, svnlog, 04/09/2012
Archive powered by MHonArc 2.6.16.