Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r656 - registry/trunk/app/Controller

Subject: COmanage Developers List

List archive

[comanage-dev] r656 - registry/trunk/app/Controller


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r656 - registry/trunk/app/Controller
  • Date: Tue, 14 Jan 2014 18:07:47 -0500

Author: skoranda
Date: 2014-01-14 18:07:47 -0500 (Tue, 14 Jan 2014)
New Revision: 656

Modified:
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Controller/CoGroupsController.php
registry/trunk/app/Controller/CoPeopleController.php
registry/trunk/app/Controller/HistoryRecordsController.php
registry/trunk/app/Controller/OrgIdentitiesController.php
registry/trunk/app/Controller/StandardController.php
Log:
Update Paginator use limit SQL queries (CO-262)

Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2014-01-05 21:34:51
UTC (rev 655)
+++ registry/trunk/app/Controller/AppController.php 2014-01-14 23:07:47
UTC (rev 656)
@@ -41,7 +41,8 @@
'RequestHandler', // For REST
'Role',
'Security',
- 'Session');
+ 'Session',
+ 'Paginator');

// Determine if controller requires a CO to be selected
public $requires_co = false;

Modified: registry/trunk/app/Controller/CoGroupsController.php
===================================================================
--- registry/trunk/app/Controller/CoGroupsController.php 2014-01-05
21:34:51 UTC (rev 655)
+++ registry/trunk/app/Controller/CoGroupsController.php 2014-01-14
23:07:47 UTC (rev 656)
@@ -437,7 +437,8 @@
'CoGroup.co_id' => $this->cur_co['Co']['id']
);

- $this->set('co_groups', $this->paginate('CoGroup'));
+ $this->Paginator->settings = $this->paginate;
+ $this->set('co_groups', $this->Paginator->paginate('CoGroup'));
}

/**

Modified: registry/trunk/app/Controller/CoPeopleController.php
===================================================================
--- registry/trunk/app/Controller/CoPeopleController.php 2014-01-05
21:34:51 UTC (rev 655)
+++ registry/trunk/app/Controller/CoPeopleController.php 2014-01-14
23:07:47 UTC (rev 656)
@@ -382,6 +382,13 @@
|| isset($this->request->query['family']))) {
$this->match();
} else {
+ // Set containable behavior for Paginator since parent will call
+ // Paginator->paginate('CoPerson') and the view for index does not need
+ // all the information returned.
+ //
+ // Fixes CO-262 https://bugs.internet2.edu/jira/browse/CO-262
+ $this->paginate['contain'] = array('Co.id', 'PrimaryName',
'EmailAddress', 'CoInvite.CoPetition', 'CoPersonRole');
+
parent::index();
// Set page title
$this->set('title_for_layout', _txt('fd.people',
array($this->cur_co['Co']['name'])));
@@ -636,6 +643,7 @@

return($pagcond);
}
+
/**
* Perform a redirect back to the controller's default view.
* - postcondition: Redirect generated

Modified: registry/trunk/app/Controller/HistoryRecordsController.php
===================================================================
--- registry/trunk/app/Controller/HistoryRecordsController.php 2014-01-05
21:34:51 UTC (rev 655)
+++ registry/trunk/app/Controller/HistoryRecordsController.php 2014-01-14
23:07:47 UTC (rev 656)
@@ -86,7 +86,8 @@
$args[] = 'HistoryRecord.co_person_role_id IS NULL';
}

- $this->set('history_records', $this->paginate('HistoryRecord',
$args));
+ $this->Paginator->settings = $this->paginate;
+ $this->set('history_records',
$this->Paginator->paginate('HistoryRecord', $args));
} elseif(!empty($this->params['named']['orgidentityid'])) {
// Org ID is a bit tricky when org identities are pooled, because we
shouldn't pull
// history for that Org ID related to COs other than the current one.
@@ -113,7 +114,8 @@
$args[] = 'HistoryRecord.co_person_role_id IS NULL';
}

- $this->set('history_records', $this->paginate('HistoryRecord',
$args));
+ $this->Paginator->settings = $this->paginate;
+ $this->set('history_records',
$this->Paginator->paginate('HistoryRecord', $args));
} else {
// Throw an error. This controller doesn't permit retrieve all
history via the UI.


Modified: registry/trunk/app/Controller/OrgIdentitiesController.php
===================================================================
--- registry/trunk/app/Controller/OrgIdentitiesController.php 2014-01-05
21:34:51 UTC (rev 655)
+++ registry/trunk/app/Controller/OrgIdentitiesController.php 2014-01-14
23:07:47 UTC (rev 656)
@@ -167,13 +167,14 @@

// Use server side pagination

+ $this->Paginator->settings = $this->paginate;
if(!isset($this->viewVars['pool_org_identities'])
|| !$this->viewVars['pool_org_identities']) {
$this->set('org_identities',
- $this->paginate('OrgIdentity',
- array("OrgIdentity.co_id" =>
$this->cur_co['Co']['id'])));
+ $this->Paginator->paginate('OrgIdentity',
+ array("OrgIdentity.co_id" =>
$this->cur_co['Co']['id'])));
} else {
- $this->set('org_identities', $this->paginate('OrgIdentity'));
+ $this->set('org_identities', $this->Paginator->
paginate('OrgIdentity'));
}

// Don't user server side pagination

Modified: registry/trunk/app/Controller/StandardController.php
===================================================================
--- registry/trunk/app/Controller/StandardController.php 2014-01-05
21:34:51 UTC (rev 655)
+++ registry/trunk/app/Controller/StandardController.php 2014-01-14
23:07:47 UTC (rev 656)
@@ -667,23 +667,23 @@
$this->set('title_for_layout', _txt('ct.' . $modelpl . '.pl'));

// Use server side pagination
-
if($this->requires_person)
{
+ $this->Paginator->settings = $this->paginate;
if(!empty($this->params['named']['copersonid']))
{
$q = $req . ".co_person_id = ";
- $this->set($modelpl, $this->paginate($req, array($q =>
$this->params['named']['copersonid'])));
+ $this->set($modelpl, $this->Paginator->paginate($req, array($q =>
$this->params['named']['copersonid'])));
}
elseif(!empty($this->params['named']['copersonroleid']))
{
$q = $req . ".co_person_role_id = ";
- $this->set($modelpl, $this->paginate($req, array($q =>
$this->params['named']['copersonroleid'])));
+ $this->set($modelpl, $this->Paginator->paginate($req, array($q =>
$this->params['named']['copersonroleid'])));
}
elseif(!empty($this->params['named']['orgidentityid']))
{
$q = $req . ".org_identity_id = ";
- $this->set($modelpl, $this->paginate($req, array($q =>
$this->params['named']['orgidentityid'])));
+ $this->set($modelpl, $this->Paginator->paginate($req, array($q =>
$this->params['named']['orgidentityid'])));
}
else
{
@@ -697,8 +697,9 @@
{
// Configure pagination
$this->paginate['conditions'] = $this->paginationConditions();
+ $this->Paginator->settings = $this->paginate;

- $this->set($modelpl, $this->paginate($req));
+ $this->set($modelpl, $this->Paginator->paginate($req));
}
}
}



  • [comanage-dev] r656 - registry/trunk/app/Controller, svnlog, 01/14/2014

Archive powered by MHonArc 2.6.16.

Top of Page