comanage-dev - [comanage-dev] r483 - in registry/trunk/app: Controller View/OrgIdentities
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r483 - in registry/trunk/app: Controller View/OrgIdentities
- Date: Mon, 1 Apr 2013 20:48:46 -0400
- Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none
Author: marie
Date: 2013-04-01 20:48:46 -0400 (Mon, 01 Apr 2013)
New Revision: 483
Modified:
registry/trunk/app/Controller/OrgIdentitiesController.php
registry/trunk/app/View/OrgIdentities/index.ctp
Log:
CO139 Search/Filter by attribute for Org IDs
Modified: registry/trunk/app/Controller/OrgIdentitiesController.php
===================================================================
--- registry/trunk/app/Controller/OrgIdentitiesController.php 2013-03-06
22:59:58 UTC (rev 482)
+++ registry/trunk/app/Controller/OrgIdentitiesController.php 2013-04-02
00:48:46 UTC (rev 483)
@@ -324,6 +324,8 @@
// View all existing Org People?
$p['index'] = ($roles['cmadmin'] || $roles['admin'] ||
$roles['subadmin']);
+ $p['search'] = $p['find'];
+
// View an existing Org Person?
$p['view'] = ($roles['cmadmin'] || $roles['admin'] ||
$roles['subadmin'] || $self);
@@ -345,6 +347,7 @@
// Find an Org Person to add to a CO?
$p['find'] = ($roles['cmadmin'] || $roles['coadmin'] ||
$roles['couadmin']);
+ $p['search'] = $p['find'];
// View all existing Org People?
$p['index'] = ($roles['cmadmin'] || $roles['coadmin'] ||
$roles['couadmin']);
@@ -369,6 +372,67 @@
}
/**
+ * Determine the conditions for pagination of the index view, when
rendered via the UI.
+ *
+ * @since COmanage Registry v0.8
+ * @return Array An array suitable for use in $this->paginate
+ */
+
+ function paginationConditions() {
+ $pagcond = array();
+
+ // Set page title
+ $this->set('title_for_layout', _txt('ct.org_identities.pl'));
+
+ // Use server side pagination
+
+ // Filter by given name
+ if(!empty($this->params['named']['Search.givenName'])) {
+ $searchterm = $this->params['named']['Search.givenName'];
+ $pagcond['Name.given LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by Family name
+ if(!empty($this->params['named']['Search.familyName'])) {
+ $searchterm = $this->params['named']['Search.familyName'];
+ $pagcond['Name.family LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by Organization
+ if(!empty($this->params['named']['Search.organization'])) {
+ $searchterm = $this->params['named']['Search.organization'];
+ $pagcond['OrgIdentity.o LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by given department
+ if(!empty($this->params['named']['Search.department'])) {
+ $searchterm = $this->params['named']['Search.department'];
+ $pagcond['OrgIdentity.ou LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by title
+ if(!empty($this->params['named']['Search.title'])) {
+ $searchterm = $this->params['named']['Search.title'];
+ $pagcond['OrgIdentity.title LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by affiliation
+ if(!empty($this->params['named']['Search.affiliation'])) {
+ $searchterm = $this->params['named']['Search.affiliation'];
+ $pagcond['OrgIdentity.affiliation LIKE'] = "%$searchterm%";
+ }
+
+ // Filter by Organization ID
+ if(!empty($this->params['named']['Search.organizationID'])) {
+ $searchterm = $this->params['named']['Search.organizationID'];
+ $pagcond['OrgIdentity.organization_id LIKE'] = "%$searchterm%";
+ }
+
+ return($pagcond);
+ }
+
+
+ /**
* Perform a redirect back to the controller's default view.
* - postcondition: Redirect generated
*
@@ -387,7 +451,23 @@
else
parent::performRedirect();
}
+
+ 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/org_identities/index/Search.givenName:albert/Search.familyName:einstein
+ foreach ($this->data['Search'] as $field=>$value){
+ if(!empty($value))
+ $url['Search.'.$field] = $value;
+ }
+ // redirect the user to the url
+ $this->redirect($url, null, true);
+ }
+
function selectvialdap()
{
// XXX need to
Modified: registry/trunk/app/View/OrgIdentities/index.ctp
===================================================================
--- registry/trunk/app/View/OrgIdentities/index.ctp 2013-03-06 22:59:58
UTC (rev 482)
+++ registry/trunk/app/View/OrgIdentities/index.ctp 2013-04-02 00:48:46
UTC (rev 483)
@@ -21,7 +21,18 @@
* @license Apache License, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0)
* @version $Id$
*/
+?>
+<script>
+ $(function() {
+ $( "#accordion" ).accordion({
+ collapsible: true,
+ active : false
+ });
+ });
+</script>
+
+<?php
// Globals
global $cm_lang, $cm_texts;
@@ -45,7 +56,35 @@
$this->set('sidebarButtons', $sidebarButtons);
}
?>
+<div id="accordion">
+ <h3>Search</h3>
+ <div>
+ <?php print
$this->Form->create('OrgIdentity',array('action'=>'search'));?>
+ <fieldset>
+ <legend><?php __('OrgIdentity Search');?></legend>
+ <?php
+ print $this->Form->input('Search.givenName');
+ print $this->Form->input('Search.familyName');
+
+ print $this->Form->input('Search.organization');
+ print $this->Form->input('Search.department');
+ print $this->Form->input('Search.title');
+ $searchOptions = $cm_texts[ $cm_lang ]['en.affil'];
+ $formParams = array('options' => $searchOptions,
+ 'type' => 'select',
+ 'empty' => '',
+ 'label' => 'Affiliation');
+ print $this->Form->input('Search.affiliation', $formParams);
+ print $this->Form->input('Search.organizationID');
+
+ print $this->Form->submit('Search');
+ ?>
+ </fieldset>
+ <?php print $this->Form->end();?>
+ </div>
+</div>
+
<table id="org_identities" class="ui-widget">
<thead>
<tr class="ui-widget-header">
- [comanage-dev] r483 - in registry/trunk/app: Controller View/OrgIdentities, svnlog, 04/01/2013
Archive powered by MHonArc 2.6.16.