Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r402 - in registry/trunk/app: Config Config/Schema Console/Command Controller Lib Model Model/Behavior Plugin Plugin/LdapProvisioner Plugin/LdapProvisioner/Config Plugin/LdapProvisioner/Config/Schema Plugin/LdapProvisioner/Console Plugin/LdapProvisioner/Console/Command Plugin/LdapProvisioner/Console/Command/Task Plugin/LdapProvisioner/Controller Plugin/LdapProvisioner/Controller/Component Plugin/LdapProvisioner/Lib Plugin/LdapProvisioner/Model Plugin/LdapProvisioner/Model/Behavior Plugin/LdapProvisioner/Model/Datasource Plugin/LdapProvisioner/Test Plugin/LdapProvisioner/Test/Case Plugin/LdapProvisioner/Test/Case/Controller Plugin/LdapProvisioner/Test/Case/Controller/Component Plugin/LdapProvisioner/Test/Case/Model Plugin/LdapProvisioner/Test/Case/Model/Behavior Plugin/LdapProvisioner/Test/Case/View Plugin/LdapProvisioner/Test/Case/View/Helper Plugin/LdapProvisioner/Test/Fixture Plugin/LdapProvisioner/Vendor Plugin/LdapProvisioner/View Plugin/LdapProvisioner/View/CoLd apProvisionerTargets Plugin/LdapProvisioner/View/Helper Plugin/LdapProvisioner/webroot View View/CoProvisioningTargets View/Elements View/Standard

Subject: COmanage Developers List

List archive

[comanage-dev] r402 - in registry/trunk/app: Config Config/Schema Console/Command Controller Lib Model Model/Behavior Plugin Plugin/LdapProvisioner Plugin/LdapProvisioner/Config Plugin/LdapProvisioner/Config/Schema Plugin/LdapProvisioner/Console Plugin/LdapProvisioner/Console/Command Plugin/LdapProvisioner/Console/Command/Task Plugin/LdapProvisioner/Controller Plugin/LdapProvisioner/Controller/Component Plugin/LdapProvisioner/Lib Plugin/LdapProvisioner/Model Plugin/LdapProvisioner/Model/Behavior Plugin/LdapProvisioner/Model/Datasource Plugin/LdapProvisioner/Test Plugin/LdapProvisioner/Test/Case Plugin/LdapProvisioner/Test/Case/Controller Plugin/LdapProvisioner/Test/Case/Controller/Component Plugin/LdapProvisioner/Test/Case/Model Plugin/LdapProvisioner/Test/Case/Model/Behavior Plugin/LdapProvisioner/Test/Case/View Plugin/LdapProvisioner/Test/Case/View/Helper Plugin/LdapProvisioner/Test/Fixture Plugin/LdapProvisioner/Vendor Plugin/LdapProvisioner/View Plugin/LdapProvisioner/View/CoLd apProvisionerTargets Plugin/LdapProvisioner/View/Helper Plugin/LdapProvisioner/webroot View View/CoProvisioningTargets View/Elements View/Standard


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r402 - in registry/trunk/app: Config Config/Schema Console/Command Controller Lib Model Model/Behavior Plugin Plugin/LdapProvisioner Plugin/LdapProvisioner/Config Plugin/LdapProvisioner/Config/Schema Plugin/LdapProvisioner/Console Plugin/LdapProvisioner/Console/Command Plugin/LdapProvisioner/Console/Command/Task Plugin/LdapProvisioner/Controller Plugin/LdapProvisioner/Controller/Component Plugin/LdapProvisioner/Lib Plugin/LdapProvisioner/Model Plugin/LdapProvisioner/Model/Behavior Plugin/LdapProvisioner/Model/Datasource Plugin/LdapProvisioner/Test Plugin/LdapProvisioner/Test/Case Plugin/LdapProvisioner/Test/Case/Controller Plugin/LdapProvisioner/Test/Case/Controller/Component Plugin/LdapProvisioner/Test/Case/Model Plugin/LdapProvisioner/Test/Case/Model/Behavior Plugin/LdapProvisioner/Test/Case/View Plugin/LdapProvisioner/Test/Case/View/Helper Plugin/LdapProvisioner/Test/Fixture Plugin/LdapProvisioner/Vendor Plugin/LdapProvisioner/View Plugin/LdapProvisioner/View/CoLd apProvisionerTargets Plugin/LdapProvisioner/View/Helper Plugin/LdapProvisioner/webroot View View/CoProvisioningTargets View/Elements View/Standard
  • Date: Wed, 12 Dec 2012 00:36:10 -0500

Author: benno
Date: 2012-12-12 00:36:10 -0500 (Wed, 12 Dec 2012)
New Revision: 402

Added:
registry/trunk/app/Controller/CoProvisioningTargetsController.php
registry/trunk/app/Model/Behavior/ProvisionerBehavior.php
registry/trunk/app/Model/CoProvisioningTarget.php
registry/trunk/app/Plugin/LdapProvisioner/
registry/trunk/app/Plugin/LdapProvisioner/Config/
registry/trunk/app/Plugin/LdapProvisioner/Config/Schema/
registry/trunk/app/Plugin/LdapProvisioner/Config/Schema/empty
registry/trunk/app/Plugin/LdapProvisioner/Config/Schema/schema.xml
registry/trunk/app/Plugin/LdapProvisioner/Console/
registry/trunk/app/Plugin/LdapProvisioner/Console/Command/
registry/trunk/app/Plugin/LdapProvisioner/Console/Command/Task/
registry/trunk/app/Plugin/LdapProvisioner/Console/Command/Task/empty
registry/trunk/app/Plugin/LdapProvisioner/Controller/

registry/trunk/app/Plugin/LdapProvisioner/Controller/CoLdapProvisionerTargetsController.php
registry/trunk/app/Plugin/LdapProvisioner/Controller/Component/
registry/trunk/app/Plugin/LdapProvisioner/Controller/Component/empty

registry/trunk/app/Plugin/LdapProvisioner/Controller/LdapProvisionerAppController.php
registry/trunk/app/Plugin/LdapProvisioner/Lib/
registry/trunk/app/Plugin/LdapProvisioner/Lib/empty
registry/trunk/app/Plugin/LdapProvisioner/Lib/lang.php
registry/trunk/app/Plugin/LdapProvisioner/Model/
registry/trunk/app/Plugin/LdapProvisioner/Model/Behavior/
registry/trunk/app/Plugin/LdapProvisioner/Model/Behavior/empty
registry/trunk/app/Plugin/LdapProvisioner/Model/CoLdapProvisionerTarget.php
registry/trunk/app/Plugin/LdapProvisioner/Model/Datasource/
registry/trunk/app/Plugin/LdapProvisioner/Model/Datasource/empty
registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisioner.php
registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisionerAppModel.php
registry/trunk/app/Plugin/LdapProvisioner/Test/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Controller/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Controller/Component/

registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Controller/Component/empty
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Model/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Model/Behavior/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/Model/Behavior/empty
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/View/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/View/Helper/
registry/trunk/app/Plugin/LdapProvisioner/Test/Case/View/Helper/empty
registry/trunk/app/Plugin/LdapProvisioner/Test/Fixture/
registry/trunk/app/Plugin/LdapProvisioner/Test/Fixture/empty
registry/trunk/app/Plugin/LdapProvisioner/Vendor/
registry/trunk/app/Plugin/LdapProvisioner/Vendor/empty
registry/trunk/app/Plugin/LdapProvisioner/View/
registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/

registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/add.ctp

registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/edit.ctp

registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/fields.inc
registry/trunk/app/Plugin/LdapProvisioner/View/Helper/
registry/trunk/app/Plugin/LdapProvisioner/View/Helper/empty
registry/trunk/app/Plugin/LdapProvisioner/webroot/
registry/trunk/app/Plugin/LdapProvisioner/webroot/empty
registry/trunk/app/View/CoProvisioningTargets/
registry/trunk/app/View/CoProvisioningTargets/add.ctp
registry/trunk/app/View/CoProvisioningTargets/edit.ctp
registry/trunk/app/View/CoProvisioningTargets/fields.inc
registry/trunk/app/View/CoProvisioningTargets/index.ctp
registry/trunk/app/View/CoProvisioningTargets/view.ctp
Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Config/bootstrap.php
registry/trunk/app/Console/Command/DatabaseShell.php
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Controller/StandardController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/CoPerson.php
registry/trunk/app/View/Elements/dropMenu.ctp
registry/trunk/app/View/Standard/add.ctp
registry/trunk/app/View/Standard/edit.ctp
registry/trunk/app/View/Standard/view.ctp
Log:
Initial plugin infrastructure (CO-354)

Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/Config/Schema/schema.xml 2012-12-12 05:36:10 UTC (rev
402)
@@ -787,4 +787,42 @@
<col>org_identity_id</col>
</index>
</table>
+
+ <table name="co_provisioning_targets">
+ <field name="id" type="I">
+ <key />
+ <autoincrement />
+ </field>
+ <field name="co_id" type="I">
+ <constraint>REFERENCES cm_cos(id)</constraint>
+ </field>
+ <field name="description" type="C" size="256" />
+ <field name="plugin" type="C" size="32" />
+ <field name="status" type="C" size="2" />
+ <field name="created" type="T" />
+ <field name="modified" type="T" />
+
+ <!-- XXX almost certainly need to create some indexes here -->
+ </table>
+
+ <table name="co_provisioning_queued_events">
+ <field name="id" type="I">
+ <key />
+ <autoincrement />
+ </field>
+ <field name="co_id" type="I">
+ <constraint>REFERENCES cm_cos(id)</constraint>
+ </field>
+ <field name="co_person_id" type="I">
+ <constraint>REFERENCES cm_co_people(id)</constraint>
+ </field>
+ <field name="co_provisioning_target_id" type="I">
+ <constraint>REFERENCES co_provisioning_targets(id)</constraint>
+ </field>
+ <field name="status" type="C" size="2" />
+ <field name="created" type="T" />
+ <field name="modified" type="T" />
+
+ <!-- XXX almost certainly need to create some indexes here -->
+ </table>
</schema>

Modified: registry/trunk/app/Config/bootstrap.php
===================================================================
--- registry/trunk/app/Config/bootstrap.php 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/Config/bootstrap.php 2012-12-12 05:36:10 UTC (rev
402)
@@ -75,3 +75,5 @@
include APP."Lib/enum.php";
include APP."Lib/lang.php";
include APP."Lib/util.php";
+
+CakePlugin::loadAll();

Modified: registry/trunk/app/Console/Command/DatabaseShell.php
===================================================================
--- registry/trunk/app/Console/Command/DatabaseShell.php 2012-12-04
02:13:15 UTC (rev 401)
+++ registry/trunk/app/Console/Command/DatabaseShell.php 2012-12-12
05:36:10 UTC (rev 402)
@@ -49,45 +49,66 @@
$db->config['login'],
$db->config['password'],
$db->config['database'])) {
- $schema = new adoSchema($dbc);
- $schema->setPrefix($db->config['prefix']);
- // ParseSchema is generating bad SQL for Postgres. eg:
- // ALTER TABLE cm_cos ALTER COLUMN id SERIAL
- // which (1) should be ALTER TABLE cm_cos ALTER COLUMN id TYPE SERIAL
- // and (2) SERIAL isn't usable in an ALTER TABLE statement
- // So we continue on error
- $schema->ContinueOnError(true);
-
- // Parse the database XML schema from file unless we are targeting
MySQL
- // in which case we use an XSL style sheet to first modify the schema
- // so that boolean columns are cast to TINYINT(1) and the cakePHP
- // automagic works. See
- //
- // https://bugs.internet2.edu/jira/browse/CO-175
- //
- if ($db_driver[1] != 'Mysql') {
- $sql = $schema->ParseSchema(APP . '/Config/Schema/schema.xml');
- }
- else {
- $xml = new DOMDocument;
- $xml->load(APP . '/Config/Schema/schema.xml');
-
- $xsl = new DOMDocument;
- $xsl->load(APP . '/Config/Schema/boolean_mysql.xsl');
-
- $proc = new XSLTProcessor;
- $proc->importStyleSheet($xsl);
-
- $sql = $schema->ParseSchemaString($proc->transformToXML($xml));
- }
+ // Plugins can have their own schema files, so we need to account
for that

- switch($schema->ExecuteSchema($sql)) {
- case 2: // !!!
- $this->out(_txt('op.db.ok'));
- break;
- default:
- $this->out(_txt('er.db.schema'));
- break;
+ $schemaSources = array_merge(array("."),
+ AppController::availablePlugins('all',
'simple', false));
+
+ foreach($schemaSources as $schemaSource) {
+ $schemaFile = APP . '/Config/Schema/schema.xml';
+
+ if($schemaSource != ".") {
+ // Use the Plugin schema file instead.
+ $schemaFile = APP . '/Plugin/' . $schemaSource .
'/Config/Schema/schema.xml';
+
+ // See if the file exists. If it doesn't, there's no schema to
load.
+ if(!is_readable($schemaFile)) {
+ continue;
+ }
+ }
+
+ $this->out(_txt('op.db.schema', array($schemaFile)));
+
+ $schema = new adoSchema($dbc);
+ $schema->setPrefix($db->config['prefix']);
+ // ParseSchema is generating bad SQL for Postgres. eg:
+ // ALTER TABLE cm_cos ALTER COLUMN id SERIAL
+ // which (1) should be ALTER TABLE cm_cos ALTER COLUMN id TYPE
SERIAL
+ // and (2) SERIAL isn't usable in an ALTER TABLE statement
+ // So we continue on error
+ $schema->ContinueOnError(true);
+
+ // Parse the database XML schema from file unless we are targeting
MySQL
+ // in which case we use an XSL style sheet to first modify the
schema
+ // so that boolean columns are cast to TINYINT(1) and the cakePHP
+ // automagic works. See
+ //
+ // https://bugs.internet2.edu/jira/browse/CO-175
+ //
+ if ($db_driver[1] != 'Mysql') {
+ $sql = $schema->ParseSchema($schemaFile);
+ }
+ else {
+ $xml = new DOMDocument;
+ $xml->load($schemaFile);
+
+ $xsl = new DOMDocument;
+ $xsl->load(APP . '/Config/Schema/boolean_mysql.xsl');
+
+ $proc = new XSLTProcessor;
+ $proc->importStyleSheet($xsl);
+
+ $sql = $schema->ParseSchemaString($proc->transformToXML($xml));
+ }
+
+ switch($schema->ExecuteSchema($sql)) {
+ case 2: // !!!
+ $this->out(_txt('op.db.ok'));
+ break;
+ default:
+ $this->out(_txt('er.db.schema'));
+ break;
+ }
}

$dbc->Disconnect();

Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2012-12-04 02:13:15
UTC (rev 401)
+++ registry/trunk/app/Controller/AppController.php 2012-12-12 05:36:10
UTC (rev 402)
@@ -56,6 +56,47 @@
public $requires_person = false;

/**
+ * Determine which plugins of a given type are available.
+ * - postcondition: Primary Plugin Models are loaded (if requested)
+ *
+ * @param String Plugin type, or 'all' for all available plugins
+ * @param String Format to return in: 'list' for list format (suitable
for formhelper selects) or 'simple' for a simple list
+ * @param Boolean Whether or not to load the models for the available
plugins (may only be false if $pluginType is 'all')
+ * @since COmanage Registry v0.8
+ * @return Array Available plugins
+ */
+
+ public function availablePlugins($pluginType, $format='list',
$loadModels=true) {
+ // Note the logic in this function is set as is in order that this can
be called
+ // from the database console command. Be sure to retest that command if
it changes.
+
+ $ret = array();
+
+ foreach(App::objects('plugin') as $p) {
+ if($pluginType != 'all' || $loadModels) {
+ $this->loadModel($p . "." . $p);
+ }
+
+ if($pluginType == 'all'
+ || (isset($this->$p->cmPluginType) && $this->$p->cmPluginType ==
$pluginType)) {
+ // We do this so that formhelper returns the plugin name instead of
a useless index position
+
+ switch($format) {
+ case 'list':
+ $ret[$p] = $p;
+ break;
+ case 'simple':
+ default:
+ $ret[] = $p;
+ break;
+ }
+ }
+ }
+
+ return($ret);
+ }
+
+ /**
* Callback before other controller methods are invoked or views are
rendered.
* - precondition:
* - postcondition: Auth component is configured
@@ -67,6 +108,11 @@
*/

public function beforeFilter() {
+ // Load plugin specific texts. We have to do this here because when
lang.php is
+ // processed by bootstrap.php, AppController isn't loaded yet.
+ // XXX CO-351 may take care of this.
+ _bootstrap_plugin_txt();
+
// Tell the Auth module to call the controller's isAuthorized() function.
$this->Auth->authorize = array('Controller');

@@ -1230,6 +1276,8 @@
$p['menu']['orgidentities'] = $cmr['admin'] || $cmr['subadmin'];

// Manage any CO (or COU) population?
+ // XXX This permission is somewhat confusingly named (implies cmp admin
managing COs)
+ // as is 'admin' below (which really implies cmadmin)
$p['menu']['cos'] = $cmr['admin'] || $cmr['subadmin'];

// Select from available enrollment flows?
@@ -1253,6 +1301,9 @@
// Manage CO enrollment flow definitions?
$p['menu']['coef'] = $cmr['admin'];

+ // Manage CO provisioning targets?
+ $p['menu']['coprovtargets'] = $cmr['admin'];
+
// Admin COmanage?
$p['menu']['admin'] = $cmr['cmadmin'];

@@ -1303,7 +1354,16 @@
foreach($this->Session->read('Auth.User.cos') as $name => $data)
$menu['cos'][ $data['co_id'] ] = $data['co_name'];
}
-
+
+ // Determine what menu contents plugins want available
+ $plugins = $this->availablePlugins('all', 'simple');
+
+ foreach($plugins as $plugin) {
+ if(isset($this->$plugin->cmPluginMenus)) {
+ $menu['plugins'][$plugin] = $this->$plugin->cmPluginMenus;
+ }
+ }
+
$this->set('menuContent', $menu);
}
}

Modified: registry/trunk/app/Controller/StandardController.php
===================================================================
--- registry/trunk/app/Controller/StandardController.php 2012-12-04
02:13:15 UTC (rev 401)
+++ registry/trunk/app/Controller/StandardController.php 2012-12-12
05:36:10 UTC (rev 402)
@@ -207,7 +207,9 @@
return;
}

- $op = $model->read(); // read() populates $this->request->data
+ // read() populates $this->request->data. Note it also resets any model
associations
+ // set via bindModel().
+ $op = $model->read();

if(empty($op))
{

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2012-12-04 02:13:15 UTC (rev 401)
+++ registry/trunk/app/Lib/lang.php 2012-12-12 05:36:10 UTC (rev 402)
@@ -1,6 +1,6 @@
<?php
/**
- * COmanage Registry Default Layout
+ * COmanage Registry Language File
*
* Copyright (C) 2011-12 University Corporation for Advanced Internet
Development, Inc.
*
@@ -81,6 +81,8 @@
'ct.co_person_roles.pl' => 'CO Person Roles',
'ct.co_petitions.1' => 'CO Petition',
'ct.co_petitions.pl' => 'CO Petitions',
+ 'ct.co_provisioning_targets.1' => 'Provisioning Target',
+ 'ct.co_provisioning_targets.pl' => 'Provisioning Targets',
'ct.cos.1' => 'CO',
'ct.cos.pl' => 'COs',
'ct.cous.1' => 'COU',
@@ -308,6 +310,7 @@
'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.plugin.prov.none' => 'There are no suitable plugins available. No
provisioning targets can be added.',
'er.pt.status' => 'Change of petition status from %1$s to %2$s is not
permitted',
'er.pt.resend.status' => 'Cannot resend an invitation not in Pending
Confirmation status',
'er.reply.unk' => 'Unknown Reply',
@@ -466,6 +469,7 @@
'fd.parent' => 'Parent COU',
'fd.perms' => 'Permissions',
'fd.petitioner' => 'Petitioner',
+ 'fd.plugin' => 'Plugin',
'fd.req' => '* denotes required field',
'fd.required' => 'Required',
'fd.roles' => 'Roles',
@@ -490,9 +494,11 @@
// Menu
'me.account' => 'My Account',
'me.changepassword' => 'Change Password',
+ 'me.configuration' => 'Configuration',
'me.for' => 'For %1$s',
'me.identity' => 'Identity',
'me.label' => 'Manage:',
+ 'me.people' => 'People',
'me.platform' => 'Platform',
'me.population' => 'My Population',

@@ -506,8 +512,10 @@
'op.begin' => 'Begin',
'op.cancel' => 'Cancel',
'op.compare' => 'Compare',
+ 'op.config' => 'Configure',
'op.confirm' => 'Confirm',
'op.db.ok' => 'Database schema update successful',
+ 'op.db.schema' => 'Loading schema from file %1$s...',
'op.decline' => 'Decline',
'op.delete' => 'Delete',
'op.delete.consfdemographics' => 'this NSF demographic entry',
@@ -584,6 +592,8 @@
'se.users.view' => 'Creating users view'
);

+// Attempt to add in any definitions created by plugins
+
/**
* Render localized text
*
@@ -620,3 +630,31 @@
return($s);
}
}
+
+/**
+ * Bootstrap plugin texts
+ *
+ * @since COmanage Registry v0.8
+ */
+
+
+function _bootstrap_plugin_txt()
+{
+ global $cm_lang, $cm_texts;
+
+ $plugins = AppController::availablePlugins('all', 'simple', false);
+
+ foreach($plugins as $plugin) {
+ $langfile = APP. '/Plugin/' . $plugin . '/Lib/lang.php';
+
+ if(is_readable($langfile)) {
+ // Include the file
+ include $langfile;
+
+ // And merge its texts for the current language
+ $varName = 'cm_' . Inflector::underscore($plugin) . '_texts';
+
+ $cm_texts[$cm_lang] = array_merge($cm_texts[$cm_lang],
${$varName}[$cm_lang]);
+ }
+ }
+}
\ No newline at end of file

Modified: registry/trunk/app/Model/CoPerson.php
===================================================================
--- registry/trunk/app/Model/CoPerson.php 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/Model/CoPerson.php 2012-12-12 05:36:10 UTC (rev
402)
@@ -30,7 +30,7 @@
public $version = "1.0";

// Add behaviors
- public $actsAs = array('Containable');
+ public $actsAs = array('Containable', 'Provisioner');

// Association rules from this model to other models
public $belongsTo = array("Co"); // A CO Person Source
is attached to one CO


Property changes on:
registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/add.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on:
registry/trunk/app/Plugin/LdapProvisioner/View/CoLdapProvisionerTargets/edit.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on: registry/trunk/app/View/CoProvisioningTargets/add.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on: registry/trunk/app/View/CoProvisioningTargets/edit.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on: registry/trunk/app/View/CoProvisioningTargets/view.ctp
___________________________________________________________________
Added: svn:special
+ *

Modified: registry/trunk/app/View/Elements/dropMenu.ctp
===================================================================
--- registry/trunk/app/View/Elements/dropMenu.ctp 2012-12-04 02:13:15
UTC (rev 401)
+++ registry/trunk/app/View/Elements/dropMenu.ctp 2012-12-12 05:36:10
UTC (rev 402)
@@ -25,6 +25,38 @@
$cos = $this->viewVars['menuContent']['cos'];
else
$cos = array();
+
+if(isset($menuContent['plugins'])) {
+ $plugins = $menuContent['plugins'];
+} else {
+ $plugins = array();
+}
+
+/**
+ * Render menu links for plugin-defined menu items.
+ * - postcondition: HTML emitted
+ *
+ * @param HtmlHelper Helper to use to render links
+ * @param Array Array of plugins as created by AppController
+ * @param String Which menu items to render
+ * @param Integer CO ID to render
+ */
+
+function render_plugin_menus($htmlHelper, $plugins, $menu, $coId) {
+ foreach(array_keys($plugins) as $plugin) {
+ if(isset($plugins[$plugin][$menu])) {
+ foreach(array_keys($plugins[$plugin][$menu]) as $label) {
+ $args = $plugins[$plugin][$menu][$label];
+
+ $args['plugin'] = Inflector::underscore($plugin);
+ if($menu != 'cmp') { $args['co'] = $coId; }
+
+ print "<li>" . $htmlHelper->link($label, $args) . "</li>\n";
+ }
+ }
+ }
+}
+
?>

<div class="menubar">
@@ -47,115 +79,152 @@
print '<a>' . $menuCoName . '</a>
<span class="sf-sub-indicator"> »</span>';
print '<ul>';
- if(isset($permissions['menu']['orgidentities']) &&
$permissions['menu']['orgidentities']) {
- print "<li>";
- $args = array(
- 'controller' => 'org_identities',
+
+ print '<li>';
+ print '<a>' . _txt('me.people') . '</a>
+ <span class="sf-sub-indicator"> »</span>';
+ print '<ul>';
+
+ if(isset($permissions['menu']['orgidentities']) &&
$permissions['menu']['orgidentities']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'org_identities',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print $this->Html->link(_txt('ct.org_identities.pl'),
$args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['cos']) &&
$permissions['menu']['cos']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_people',
'action' => 'index',
'co' => $menuCoId
- );
- print $this->Html->link(_txt('ct.org_identities.pl'),
$args);
- print "</li>";
- }
+ );
+ print $this->Html->link(_txt('me.population'), $args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['createpetition']) &&
$permissions['menu']['createpetition']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_enrollment_flows',
+ 'action' => 'select',
+ 'co' => $menuCoId
+ );
+ print $this->Html->link(_txt('op.petition.create'),
$args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['petitions']) &&
$permissions['menu']['petitions']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_petitions',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print $this->Html->link(_txt('ct.co_petitions.pl'),
$args);
+ print "</li>";
+ }
+
+ render_plugin_menus($this->Html, $plugins, 'copeople',
$menuCoId);
+
+ print "</ul>";
+ print "</li>";

- if(isset($permissions['menu']['cos']) &&
$permissions['menu']['cos']) {
+ if(isset($permissions['menu']['cogroups']) &&
$permissions['menu']['cogroups']) {
print "<li>";
$args = array(
- 'controller' => 'co_people',
+ 'controller' => 'co_groups',
'action' => 'index',
'co' => $menuCoId
);
- print $this->Html->link(_txt('me.population'), $args);
+ print $this->Html->link(_txt('ct.co_groups.pl'), $args);
print "</li>";
}
+
+ render_plugin_menus($this->Html, $plugins, 'cos', $menuCoId);
+
+ if($permissions['menu']['cos']) {
+ print '<li>';
+ print '<a>' . _txt('me.configuration') . '</a>
+ <span class="sf-sub-indicator"> »</span>';
+ print '<ul>';

- if(isset($permissions['menu']['createpetition']) &&
$permissions['menu']['createpetition']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_enrollment_flows',
- 'action' => 'select',
- 'co' => $menuCoId
- );
- print $this->Html->link(_txt('op.petition.create'),
$args);
- print "</li>";
- }
+ if(isset($permissions['menu']['coef']) &&
$permissions['menu']['coef']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_enrollment_flows',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print
$this->Html->link(_txt('ct.co_enrollment_flows.pl'), $args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['cous']) &&
$permissions['menu']['cous']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'cous',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print $this->Html->link(_txt('ct.cous.pl'), $args);
+ print "</li>";
+ }

- if(isset($permissions['menu']['petitions']) &&
$permissions['menu']['petitions']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_petitions',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print $this->Html->link(_txt('ct.co_petitions.pl'),
$args);
+ if(isset($permissions['menu']['extattrs']) &&
$permissions['menu']['extattrs']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_extended_attributes',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print
$this->Html->link(_txt('ct.co_extended_attributes.pl'), $args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['exttypes']) &&
$permissions['menu']['exttypes']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_extended_types',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print
$this->Html->link(_txt('ct.co_extended_types.pl'), $args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['idassign']) &&
$permissions['menu']['idassign']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_identifier_assignments',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print
$this->Html->link(_txt('ct.co_identifier_assignments.pl'), $args);
+ print "</li>";
+ }
+
+ if(isset($permissions['menu']['coprovtargets']) &&
$permissions['menu']['coprovtargets']) {
+ print "<li>";
+ $args = array(
+ 'controller' => 'co_provisioning_targets',
+ 'action' => 'index',
+ 'co' => $menuCoId
+ );
+ print
$this->Html->link(_txt('ct.co_provisioning_targets.pl'), $args);
+ print "</li>";
+ }
+
+ render_plugin_menus($this->Html, $plugins, 'coconfig',
$menuCoId);
+
+ print "</ul>";
print "</li>";
}
-
- if(isset($permissions['menu']['idassign']) &&
$permissions['menu']['idassign']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_identifier_assignments',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print
$this->Html->link(_txt('ct.co_identifier_assignments.pl'), $args);
- print "</li>";
- }
-
- if(isset($permissions['menu']['extattrs']) &&
$permissions['menu']['extattrs']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_extended_attributes',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print
$this->Html->link(_txt('ct.co_extended_attributes.pl'), $args);
- print "</li>";
- }
-
- if(isset($permissions['menu']['exttypes']) &&
$permissions['menu']['exttypes']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_extended_types',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print $this->Html->link(_txt('ct.co_extended_types.pl'),
$args);
- print "</li>";
- }
-
- if(isset($permissions['menu']['coef']) &&
$permissions['menu']['coef']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_enrollment_flows',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print
$this->Html->link(_txt('ct.co_enrollment_flows.pl'), $args);
- print "</li>";
- }
-
- if(isset($permissions['menu']['cous']) &&
$permissions['menu']['cous']) {
- print "<li>";
- $args = array(
- 'controller' => 'cous',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print $this->Html->link(_txt('ct.cous.pl'), $args);
- print "</li>";
- }
-
- if(isset($permissions['menu']['cogroups']) &&
$permissions['menu']['cogroups']) {
- print "<li>";
- $args = array(
- 'controller' => 'co_groups',
- 'action' => 'index',
- 'co' => $menuCoId
- );
- print $this->Html->link(_txt('ct.co_groups.pl'), $args);
- print "</li>";
- }
+
print "</ul>";
}
print "</li>";
@@ -198,6 +267,7 @@
print
$this->Html->link(_txt('ct.cmp_enrollment_configurations.pl'), $params);
?>
</li>
+ <?php render_plugin_menus($this->Html, $plugins, 'cmp',
$menuCoId); ?>
</ul>
</li>
<?php endif; ?>
@@ -261,13 +331,31 @@
}
?>

- <!-- Needs to be implemented
- <li>
- <a href="#">
- <?php print _txt('me.changepassword'); // XXX Needs to be
implemented ?>
- </a>
- </li>
- -->
+ <?php // Plugin submenus
+ // This rendering is a bit different from how
render_plugin_menus() does it...
+ foreach(array_keys($plugins) as $plugin) {
+ if(isset($plugins[$plugin]['coperson'])) {
+ foreach(array_keys($plugins[$plugin]['coperson']) as $label) {
+ print '<li>
+ <a href="#">'.$label.'</a>
+ <span class="sf-sub-indicator"> »</span>
+ <ul>';
+
+ foreach ($mycos as $co) {
+ $args = $plugins[$plugin]['coperson'][$label];
+
+ $args[] = $co['co_person_id'];
+ $args['plugin'] = $plugin;
+ $args['co'] = $co['co_id'];
+
+ print "<li>" . $this->Html->link(_txt('me.for',
array($co['co_name'])), $args) . "</li>\n";
+ }
+
+ print "</ul></li>";
+ }
+ }
+ }
+ ?>
</ul>
</li>
</ul>

Modified: registry/trunk/app/View/Standard/add.ctp
===================================================================
--- registry/trunk/app/View/Standard/add.ctp 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/View/Standard/add.ctp 2012-12-12 05:36:10 UTC (rev
402)
@@ -64,6 +64,11 @@
)
);

- include(APP . "View/" . $model . "/fields.inc");
+ if(!empty($this->plugin)) {
+ include(APP . "Plugin/" . $this->plugin . "/View/" . $model .
"/fields.inc");
+ } else {
+ include(APP . "View/" . $model . "/fields.inc");
+ }
+
print $this->Form->end();
?>

Modified: registry/trunk/app/View/Standard/edit.ctp
===================================================================
--- registry/trunk/app/View/Standard/edit.ctp 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/View/Standard/edit.ctp 2012-12-12 05:36:10 UTC (rev
402)
@@ -61,6 +61,10 @@
echo $this->Form->create($req,
array('action' => 'edit',
'inputDefaults' => array('label' => false,
'div' => false)));
- include(APP . "View/" . $model . "/fields.inc");
+ if(!empty($this->plugin)) {
+ include(APP . "Plugin/" . $this->plugin . "/View/" . $model .
"/fields.inc");
+ } else {
+ include(APP . "View/" . $model . "/fields.inc");
+ }
echo $this->Form->end();
?>

Modified: registry/trunk/app/View/Standard/view.ctp
===================================================================
--- registry/trunk/app/View/Standard/view.ctp 2012-12-04 02:13:15 UTC (rev
401)
+++ registry/trunk/app/View/Standard/view.ctp 2012-12-12 05:36:10 UTC (rev
402)
@@ -61,7 +61,11 @@
print $this->element("pageTitle", $params);

print '<div style="float:left">';
+ if(!empty($this->plugin)) {
+ include(APP . "Plugin/" . $this->plugin . "/View/" . $model .
"/fields.inc");
+ } else {
include(APP . "View/" . $model . "/fields.inc");
+ }
print '</div>';

print '<div style = "float:right">';



  • [comanage-dev] r402 - in registry/trunk/app: Config Config/Schema Console/Command Controller Lib Model Model/Behavior Plugin Plugin/LdapProvisioner Plugin/LdapProvisioner/Config Plugin/LdapProvisioner/Config/Schema Plugin/LdapProvisioner/Console Plugin/LdapProvisioner/Console/Command Plugin/LdapProvisioner/Console/Command/Task Plugin/LdapProvisioner/Controller Plugin/LdapProvisioner/Controller/Component Plugin/LdapProvisioner/Lib Plugin/LdapProvisioner/Model Plugin/LdapProvisioner/Model/Behavior Plugin/LdapProvisioner/Model/Datasource Plugin/LdapProvisioner/Test Plugin/LdapProvisioner/Test/Case Plugin/LdapProvisioner/Test/Case/Controller Plugin/LdapProvisioner/Test/Case/Controller/Component Plugin/LdapProvisioner/Test/Case/Model Plugin/LdapProvisioner/Test/Case/Model/Behavior Plugin/LdapProvisioner/Test/Case/View Plugin/LdapProvisioner/Test/Case/View/Helper Plugin/LdapProvisioner/Test/Fixture Plugin/LdapProvisioner/Vendor Plugin/LdapProvisioner/View Plugin/LdapProvisioner/View/CoLd apProvisionerTargets Plugin/LdapProvisioner/View/Helper Plugin/LdapProvisioner/webroot View View/CoProvisioningTargets View/Elements View/Standard, svnlog, 12/12/2012

Archive powered by MHonArc 2.6.16.

Top of Page