Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r619 - in registry/trunk/app: Controller Lib View/CoPetitions View/Elements View/Layouts

Subject: COmanage Developers List

List archive

[comanage-dev] r619 - in registry/trunk/app: Controller Lib View/CoPetitions View/Elements View/Layouts


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r619 - in registry/trunk/app: Controller Lib View/CoPetitions View/Elements View/Layouts
  • Date: Wed, 16 Oct 2013 20:42:21 -0400

Author: marie
Date: 2013-10-16 20:42:21 -0400 (Wed, 16 Oct 2013)
New Revision: 619

Added:
registry/trunk/app/View/CoPetitions/search.inc
Modified:
registry/trunk/app/Controller/CoPetitionsController.php
registry/trunk/app/Controller/StandardController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/View/CoPetitions/index.ctp
registry/trunk/app/View/Elements/dropMenu.ctp
registry/trunk/app/View/Layouts/default.ctp
Log:
CO680 - copetition index to only show pending, add popup to filter list

Modified: registry/trunk/app/Controller/CoPetitionsController.php
===================================================================
--- registry/trunk/app/Controller/CoPetitionsController.php 2013-10-11
22:38:41 UTC (rev 618)
+++ registry/trunk/app/Controller/CoPetitionsController.php 2013-10-17
00:42:21 UTC (rev 619)
@@ -442,6 +442,9 @@
// View all existing CO Petitions?
$p['index'] = ($roles['cmadmin'] || $roles['coadmin'] ||
$roles['couadmin']);

+ // Search all existing CO Petitions?
+ $p['search'] = $p['index'];
+
// Resend invitations?
$p['resend'] = ($roles['cmadmin']
|| ($flowAuthorized && ($roles['coadmin'] ||
$roles['couadmin'])));
@@ -465,6 +468,30 @@
return $p[$this->action];
}

+ /**
+ * Determine the conditions for pagination of the index view, when
rendered via the UI.
+ *
+ * @since COmanage Registry v0.8.3
+ * @return Array An array suitable for use in $this->paginate
+ */
+
+ function paginationConditions() {
+ $pagcond = array();
+
+ // Use server side pagination
+
+ if($this->requires_co) {
+ $pagcond['CoPetition.co_id'] = $this->cur_co['Co']['id'];
+ }
+
+ // Filter by status
+ if(!empty($this->params['named']['Search.status'])) {
+ $searchterm = $this->params['named']['Search.status'];
+ $pagcond['CoPetition.status'] = $searchterm;
+ }
+ return($pagcond);
+ }
+
/**
* Perform a redirect back to the controller's default view.
* - postcondition: Redirect generated

Modified: registry/trunk/app/Controller/StandardController.php
===================================================================
--- registry/trunk/app/Controller/StandardController.php 2013-10-11
22:38:41 UTC (rev 618)
+++ registry/trunk/app/Controller/StandardController.php 2013-10-17
00:42:21 UTC (rev 619)
@@ -829,8 +829,37 @@

return true;
}
-
+
/**
+ * Insert search parameters into URL for index.
+ * - postcondition: Redirect generated
+ *
+ * @since COmanage Registry v0.8.3
+ */
+ function search() {
+
+ // the page we will redirect to
+ $url['action'] = 'index';
+
+ // build a URL will all the search elements in it
+ // the resulting URL will be
+ //
example.com/registry/co_people/index/Search.givenName:albert/Search.familyName:einstein
+ if(isset($this->data['Search'])) {
+ foreach ($this->data['Search'] as $field=>$value){
+ if(!empty($value))
+ $url['Search.'.$field] = $value;
+ }
+ }
+
+ // Insert CO into URL
+ if(isset($this->cur_co['Co']['id']))
+ $url['co'] = $this->cur_co['Co']['id'];
+
+ // redirect the user to the url
+ $this->redirect($url, null, true);
+ }
+
+ /**
* Retrieve a Standard Object.
* - precondition: <id> must exist
* - postcondition: $<object>s set (with one member)

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-10-11 22:38:41 UTC (rev 618)
+++ registry/trunk/app/Lib/lang.php 2013-10-17 00:42:21 UTC (rev 619)
@@ -689,6 +689,7 @@
'op.edit-a' => 'Edit %1$s',
'op.edit-f' => 'Edit %1$s for %2$s',
'op.enroll' => 'Enroll',
+ 'op.filter.status' => 'Filter by Status',
'op.find.inv' => 'Find a Person to Invite to %1$s',
'op.gr.memadd' => 'Manage %1$s Group Memberships',
'op.grm.edit' => 'Edit Members of %1$s Group %2$s',

Modified: registry/trunk/app/View/CoPetitions/index.ctp
===================================================================
--- registry/trunk/app/View/CoPetitions/index.ctp 2013-10-11 22:38:41
UTC (rev 618)
+++ registry/trunk/app/View/CoPetitions/index.ctp 2013-10-17 00:42:21
UTC (rev 619)
@@ -22,20 +22,96 @@
* @version $Id$
*/
-->
+<script>
+ $(function() {
+ $( "#statusfilterdialog" ).dialog({
+ autoOpen: false,
+ height: 300,
+ width: 350,
+ height: 265,
+ modal: true
+ });
+
+ $( "#statusfilter" ).click(function() {
+ $( "#statusfilterdialog" ).dialog( "open" );
+ });
+ });
+</script>
+
+<style>
+ #filters {
+ width: 50%;
+ margin: 0 0 0 2px;
+ }
+
+ #statusfilter {
+ overflow: hidden;
+ }
+
+ #statusfilter .input>label {
+ float: left;
+ }
+</style>
+
<?php
+// Globals
+global $cm_lang, $cm_texts;
+
$params = array('title' => $cur_co['Co']['name'] . " Petitions"); // XXX
I18N
print $this->element("pageTitle", $params);

if($permissions['add']) {
print $this->Html->link(_txt('op.enroll'),
array('controller' => 'co_enrollment_flows',
'action' => 'select', 'co' => $cur_co['Co']['id']),
- array('class' => 'addbutton')) . '
- <br />
- <br />
- ';
+ array('class' => 'addbutton'));
}
?>
-
+
+<button id="statusfilter" class = "searchbutton">
+ <?php print _txt('op.filter.status');?>
+</button>
+
+<div id="statusfilterdialog" title="Filter by Status">
+ <?php
+ print $this->Form->create('CoPetition',array('action'=>'search'));
+ print $this->Form->hidden('CoPetition.co_id', array('default' =>
$cur_co['Co']['id'])). "\n";
+
+ // Build array of options based on model validation
+ $statusOptions = array(StatusEnum::Active,
+ StatusEnum::Approved,
+ StatusEnum::Declined,
+ StatusEnum::Deleted,
+ StatusEnum::Denied,
+ StatusEnum::Invited,
+ StatusEnum::Pending,
+ StatusEnum::PendingApproval,
+ StatusEnum::PendingConfirmation,
+ StatusEnum::Suspended);
+
+ foreach ($statusOptions as $s) {
+ $searchOptions[ $s ] = $cm_texts[ $cm_lang ]['en.status'][ $s ];
+ }
+
+ // Build array to check off actively used filters on the page
+ $selected = array();
+ if (isset($this->passedArgs['Search.status'])) {
+ foreach($this->passedArgs['Search.status'] as $a) {
+ $selected[] = $a;
+ }
+ }
+
+ // Collect parameters and print checkboxes
+ $formParams = array('options' => $searchOptions,
+ 'multiple' => 'checkbox',
+ 'label' => false,
+ 'selected' => $selected);
+ print $this->Form->input('Search.status', $formParams);
+
+ print $this->Form->submit('Search');
+ print $this->Form->end();
+ ?>
+</div>
+
<table id="co_people" class="ui-widget">
<thead>
<tr class="ui-widget-header">

Modified: registry/trunk/app/View/Elements/dropMenu.ctp
===================================================================
--- registry/trunk/app/View/Elements/dropMenu.ctp 2013-10-11 22:38:41
UTC (rev 618)
+++ registry/trunk/app/View/Elements/dropMenu.ctp 2013-10-17 00:42:21
UTC (rev 619)
@@ -131,7 +131,10 @@
$args['controller'] = 'co_petitions';
$args['action'] = 'index';
$args['co'] = $menuCoId;
-
+ $args['sort'] = 'created';
+ $args['Search.status'][] = StatusEnum::PendingApproval;
+ $args['Search.status'][] =
StatusEnum::PendingConfirmation;
+
print $this->Html->link(_txt('ct.co_petitions.pl'),
$args);
print "</li>";
}

Modified: registry/trunk/app/View/Layouts/default.ctp
===================================================================
--- registry/trunk/app/View/Layouts/default.ctp 2013-10-11 22:38:41 UTC (rev
618)
+++ registry/trunk/app/View/Layouts/default.ctp 2013-10-17 00:42:21 UTC (rev
619)
@@ -264,6 +264,12 @@
},
});

+ $(".searchbutton").button({
+ icons: {
+ primary: 'ui-icon-search'
+ },
+ });
+
$(".petitionbutton").button({
icons: {
primary: 'ui-icon-script'



  • [comanage-dev] r619 - in registry/trunk/app: Controller Lib View/CoPetitions View/Elements View/Layouts, svnlog, 10/16/2013

Archive powered by MHonArc 2.6.16.

Top of Page