diff --git a/Controller/CoGrouperLitesController.php b/Controller/CoGrouperLitesController.php index 452ae9c..32cb195 100644 --- a/Controller/CoGrouperLitesController.php +++ b/Controller/CoGrouperLitesController.php @@ -14,11 +14,24 @@ class CoGrouperLitesController extends SDWController { "GrouperLite.CoGrouperLite" ); + /** + * Callback after controller methods are invoked but before views are rendered. + * + * @since COmanage Registry v3.2.0 + */ + + function beforeRender() + { + $this->set('title_for_layout', _txt('pl.grouperlite.config.edit.title')); + + parent::beforeRender(); + } + public function display($id) { - //$cfg = $this->CoGrouperLite->getConfig(); + $cfg = $this->CoGrouperLite->getConfig(); - $this->set('title', "Grouper Configuration Settings"); + $this->set('title_for_layout', _txt('pl.grouperlite.config.display.title')); // Pass the config so we know which div to overwrite $this->set('vv_config', $cfg); } @@ -32,8 +45,9 @@ public function display($id) * @since COmanage Registry v3.2.0 * @return Array Permissions */ - /* - function isAuthorized() { + + function isAuthorized() + { $roles = $this->Role->calculateCMRoles(); // Determine what operations this user can perform @@ -43,21 +57,16 @@ function isAuthorized() { // Note that the display permission is set at the Dashboard, not Dashboard Widget level. $p = $this->calculateParentPermissions($roles); - // Delete an existing CO Services Widget? + // Delete an existing CO Announcements Widget? $p['delete'] = ($roles['cmadmin'] || $roles['coadmin']); - // Edit an existing CO Services Widget? + // Edit an existing CO Announcements Widget? $p['edit'] = ($roles['cmadmin'] || $roles['coadmin']); - // View an existing CO Services Widget? + // View an existing CO Announcements Widget? $p['view'] = ($roles['cmadmin'] || $roles['coadmin']); $this->set('permissions', $p); - return($p[$this->action]); - }*/ - - function isAuthorized() - { - return (true); + return ($p[$this->action]); } } \ No newline at end of file diff --git a/Lib/lang.php b/Lib/lang.php index a76d0cf..4f3f031 100644 --- a/Lib/lang.php +++ b/Lib/lang.php @@ -1,6 +1,12 @@ 'Grouper Configuration Settings', + 'pl.grouperlite.config.edit.title' => 'Edit Grouper Configuration Settings', + 'pl.grouperlite.config.grouper-url' => 'Grouper URL', + 'pl.grouperlite.config.grouper-version' => 'Grouper Version', + 'pl.grouperlite.config.grouper-un' => 'Username', + 'pl.grouperlite.config.grouper-pw' => 'Password', 'pl.grouperlite.crumb.root' => 'Grouper groups', 'pl.grouperlite.nav.groups' => 'Groups', diff --git a/Model/CoGrouperLite.php b/Model/CoGrouperLite.php index f276be6..62e2796 100644 --- a/Model/CoGrouperLite.php +++ b/Model/CoGrouperLite.php @@ -30,7 +30,7 @@ class CoGrouperLite extends CoDashboardWidgetBackend { 'rule' => 'numeric', 'required' => true, 'allowEmpty' => false - ), + )/*, 'connUrl' => array( 'rule' => 'alphaNumeric', 'required' => true, @@ -50,7 +50,7 @@ class CoGrouperLite extends CoDashboardWidgetBackend { 'rule' => 'alphaNumeric', 'required' => true, 'allowEmpty' => false - ), + ),*/ ); } \ No newline at end of file diff --git a/View/CoGrouperLites/display.ctp b/View/CoGrouperLites/display.ctp index 508ab77..4a1090b 100644 --- a/View/CoGrouperLites/display.ctp +++ b/View/CoGrouperLites/display.ctp @@ -1 +1 @@ -yoy are home \ No newline at end of file +you are home \ No newline at end of file diff --git a/View/CoGrouperLites/edit.ctp b/View/CoGrouperLites/edit.ctp index e62dcaa..414142a 100644 --- a/View/CoGrouperLites/edit.ctp +++ b/View/CoGrouperLites/edit.ctp @@ -1,14 +1,71 @@ -
-
-

-
-
Form->create('CoGrouperLites'); -echo $this->Form->input('connUrl'); -echo $this->Form->input('connVer'); -echo $this->Form->input('connUser'); -echo $this->Form->input('connPass'); -echo $this->Form->input('id', array('type' => 'hidden')); -echo $this->Form->end('Save Post'); -?> \ No newline at end of file + +/** + * COmanage Registry Standard Edit View + * + * Portions licensed to the University Corporation for Advanced Internet + * Development, Inc. ("UCAID") under one or more contributor license agreements. + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * UCAID licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @link http://www.internet2.edu/comanage COmanage Project + * @package registry + * @since COmanage Registry v0.1 + * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + */ + +// Get a pointer to our model + $model = $this->name; + $req = Inflector::singularize($model); + + // Add page title & page buttons + $params = array(); + $params['title'] = $title_for_layout; + + // For Authenticators during enrollment + if(!empty($vv_co_enrollment_authenticator) + && ($vv_co_enrollment_authenticator['CoEnrollmentAuthenticator']['required'] == RequiredEnum::Optional) + && !empty($this->request->params['named']['onFinish'])) { + $params['topLinks'][] = $this->Html->link(_txt('op.skip'), + urldecode($this->request->params['named']['onFinish']), + array('class' => 'forwardbutton')); + } + + if(!empty($this->plugin)) { + if(file_exists(APP . "Plugin/" . $this->plugin . "/View/" . $model . "/buttons.inc")) { + include(APP . "Plugin/" . $this->plugin . "/View/" . $model . "/buttons.inc"); + } elseif(file_exists(LOCAL . "Plugin/" . $this->plugin . "/View/" . $model . "/buttons.inc")) { + include(LOCAL . "Plugin/" . $this->plugin . "/View/" . $model . "/buttons.inc"); + } + } else { + if(file_exists(APP . "View/" . $model . "/buttons.inc")) { + include(APP . "View/" . $model . "/buttons.inc"); + } + } + print $this->element("pageTitleAndButtons", $params); + + $submit_label = _txt('op.save'); + print $this->Form->create($req, array('inputDefaults' => array('label' => false, 'div' => false))); + if(!empty($this->plugin)) { + if(file_exists(APP . "Plugin/" . $this->plugin . "/View/" . $model . "/fields.inc")) { + include(APP . "Plugin/" . $this->plugin . "/View/" . $model . "/fields.inc"); + } elseif(file_exists(LOCAL . "Plugin/" . $this->plugin . "/View/" . $model . "/fields.inc")) { + include(LOCAL . "Plugin/" . $this->plugin . "/View/" . $model . "/fields.inc"); + } + } else { + include(APP . "View/" . $model . "/fields.inc"); + } + print $this->Form->end(); +?> diff --git a/View/CoGrouperLites/fields.inc b/View/CoGrouperLites/fields.inc new file mode 100644 index 0000000..334da52 --- /dev/null +++ b/View/CoGrouperLites/fields.inc @@ -0,0 +1,209 @@ + +action === "add" && $permissions['add']); +$editable = ($this->action === "edit" && $permissions['edit']); + +$e = (!$addable && !$editable) ? false : true; + +// We shouldn't get here if we don't have at least read permission, but check just in case + +if (!$e && !$permissions['view']) { + return false; +} + +// Add breadcrumbs +print $this->element("coCrumb"); + +$args = array(); +$args['plugin'] = null; +$args['controller'] = 'co_dashboards'; +$args['action'] = 'index'; +$args['co'] = $cur_co['Co']['id']; +$this->Html->addCrumb(_txt('ct.co_dashboards.pl'), $args); + +$args = array(); +$args['plugin'] = null; +$args['controller'] = 'co_dashboards'; +$args['action'] = 'edit'; +$args[] = $co_grouper_lites[0]['CoDashboardWidget']['co_dashboard_id']; +$this->Html->addCrumb(_txt('ct.co_dashboards.1'), $args); + +$args = array(); +$args['plugin'] = null; +$args['controller'] = 'co_dashboard_widgets'; +$args['action'] = 'index'; +$args['codashboard'] = $co_grouper_lites[0]['CoDashboardWidget']['co_dashboard_id']; +$this->Html->addCrumb(_txt('ct.co_dashboard_widgets.1'), $args); + +$crumbTxt = _txt('op.' . $this->action . '-a', array(filter_var($co_grouper_widgets[0]['CoDashboardWidget']['description'], FILTER_SANITIZE_SPECIAL_CHARS))); +$this->Html->addCrumb($crumbTxt); + +print $this->Form->hidden('co_dashboard_widget_id', array('default' => $vv_dwid)) . "\n"; + +?> + + +
+
+

+
+
\ No newline at end of file