From aceb8d0a4539c06daeb896d94e0f241f2b806536 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 17 Dec 2020 08:19:09 -0700 Subject: [PATCH] moved form to fields.inc file, updates to lang file --- Controller/GrouperGroupsController.php | 28 +-- Lib/lang.php | 38 ++++ View/Elements/Components/search.ctp | 2 +- View/GrouperGroups/base.ctp | 4 +- View/GrouperGroups/fields.inc | 208 +++++++++++++++++++ View/GrouperGroups/groupcreateform.ctp | 274 +++---------------------- View/Layouts/default.ctp | 54 ----- 7 files changed, 286 insertions(+), 322 deletions(-) create mode 100644 View/GrouperGroups/fields.inc delete mode 100644 View/Layouts/default.ctp diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index db63416..9fee013 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -20,7 +20,7 @@ public function index() { public function groupUser() { - $this->set('title', 'Grouper Groups:'); + $this->set('title', _txt('pl.grouperlite.title.root')); //TODO - Change to get userid somehow $this->set('groupergroupsmember', $this->GrouperGroup->optinGroups($this->userId)); } @@ -31,13 +31,13 @@ public function groupInfo() $details = $this->GrouperGroup->groupDescriptions($name); $this->set('groupname', $name); - $this->set('title', 'Group configuration and attributes'); + $this->set('title', _txt('pl.grouperlite.title.groupinfo')); $this->set('groupergroupsdetail', $details[0]); } public function groupOwner() { - $this->set('title', 'Grouper Groups I Manage:'); + $this->set('title', _txt('pl.grouperlite.title.groupowner')); if (isset($this->request->data['search'])){ $searchCriteria = urldecode($this->request->data['search']); $this->set('groupergroupsowner', $this->GrouperGroup->getSearchedGroups($this->userId, $searchCriteria, 'groupOwner')); @@ -49,7 +49,7 @@ public function groupOwner() public function groupOptin() { - $this->set('title', 'Grouper Groups I Can Join:'); + $this->set('title', _txt('pl.grouperlite.title.groupoptin')); if (isset($this->request->data['search'])){ $searchCriteria = urldecode($this->request->data['search']); @@ -62,7 +62,7 @@ public function groupOptin() public function emailListsOptin() { - $this->set('title', 'Email lists'); + $this->set('title', _txt('pl.grouperlite.title.emaillists')); // mock data $this->set('group', array( 'member' => true, @@ -74,7 +74,7 @@ public function emailListsOptin() public function emailListsManaged() { - $this->set('title', 'Email lists I manage'); + $this->set('title', _txt('pl.grouperlite.title.emaillistsmanaged')); // mock data $this->set('group', array( 'member' => true, @@ -86,7 +86,7 @@ public function emailListsManaged() public function emailListInfo() { - $this->set('title', 'Email list configuration and attributes'); + $this->set('title', _txt('pl.grouperlite.title.emaillistsinfo')); // mock data $this->set('groupergroupsdetail', array( 'member' => true, @@ -103,7 +103,7 @@ public function emailListInfo() } public function groupCreateForm() { - $this->set('title', 'Create Grouper Group'); + $this->set('title', _txt('pl.grouperlite.title.groupcreate')); } public function groupCreate() @@ -120,13 +120,13 @@ public function joinGroup() if ($this->request->is('post')) { $name = $this->request->data['GroupName']; if($this->GrouperGroup->joinGroup($this->userId, $name)) { - $this->Flash->success(__('You have been added to the group!')); + $this->Flash->success(__(_txt('You have been added to the group!'))); } else { - $this->Flash->error(__('You are unable to join the group!')); + $this->Flash->error(__(_txt('You are unable to join the group!'))); } return $this->redirect(array('action' => 'groupoptin')); } - $this->Flash->error(__('An error occurred in joining the group, please try again later.')); + $this->Flash->error(__(_txt('An error occurred in joining the group, please try again later.'))); } @@ -135,13 +135,13 @@ public function leaveGroup() if ($this->request->is('post')) { $name = $this->request->data['GroupName']; if($this->GrouperGroup->leaveGroup($this->userId, $name)) { - $this->Flash->success(__('You have been deleted from the group!')); + $this->Flash->success(__(_txt('You have been deleted from the group!'))); } else { - $this->Flash->error(__('You are unable to delete the group!')); + $this->Flash->error(__(_txt('You are unable to delete the group!'))); } return $this->redirect(array('action' => 'groupoptin')); } - $this->Flash->error(__('An error occurred in leaving the group, please try again later.')); + $this->Flash->error(__(_txt('An error occurred in leaving the group, please try again later.'))); } /** diff --git a/Lib/lang.php b/Lib/lang.php index aa89932..a76d0cf 100644 --- a/Lib/lang.php +++ b/Lib/lang.php @@ -2,12 +2,30 @@ $cm_grouper_lite_texts['en_US'] = array( + 'pl.grouperlite.crumb.root' => 'Grouper groups', 'pl.grouperlite.nav.groups' => 'Groups', 'pl.grouperlite.nav.groups-presided' => 'Groups I preside over', 'pl.grouperlite.nav.email-lists' => 'Email lists', 'pl.grouperlite.nav.email-lists-managed' => 'Email lists I manage', 'pl.grouperlite.nav.create-group' => 'Create group', + 'pl.grouperlite.title.root' => 'Grouper Groups:', + 'pl.grouperlite.title.groupinfo' => 'Group configuration and attributes', + 'pl.grouperlite.title.groupowner' => 'Grouper Groups I Manage', + 'pl.grouperlite.title.groupoptin' => 'Grouper Groups I Can Join', + 'pl.grouperlite.title.emaillists' => 'Email lists', + 'pl.grouperlite.title.emaillistsmanaged' => 'Email lists I manage', + 'pl.grouperlite.title.emaillistsinfo' => 'Email list configuration and attributes', + 'pl.grouperlite.title.groupcreate' => 'Create Grouper Group', + + 'pl.grouperlite.message.flash.join-group-success' => 'You have been added to the group!', + 'pl.grouperlite.message.flash.join-group-failed' => 'You are unable to join the group!', + 'pl.grouperlite.message.flash.join-group-error' => 'An error occurred in joining the group, please try again later.', + + 'pl.grouperlite.message.flash.leave-group-success' => 'You have been deleted from the group!', + 'pl.grouperlite.message.flash.leave-group-failed' => 'You are unable to delete the group!', + 'pl.grouperlite.message.flash.leave-group-error' => 'An error occurred in leaving the group, please try again later.', + 'pl.grouperlite.table.name' => 'Name', 'pl.grouperlite.table.description' => 'Description', 'pl.grouperlite.table.status' => 'Status', @@ -24,6 +42,26 @@ 'pl.grouperlite.action.subscribe' => 'Subscribe', 'pl.grouperlite.action.unsubscribe' => 'Unsubscribe', 'pl.grouperlite.action.search' => 'Search', + 'pl.grouperlite.action.remove' => 'Remove', + + 'pl.grouperlite.form.group.template.label' => 'Select a template', + 'pl.grouperlite.form.group.template.empty' => '(choose one)', + 'pl.grouperlite.form.group.name.label' => 'Display name', + 'pl.grouperlite.form.group.name.help' => 'Name is the label that identifies this group, and might change.', + 'pl.grouperlite.form.group.stem.label' => 'Create in this folder:', + 'pl.grouperlite.form.group.stem.help' => 'Enter a folder name.', + 'pl.grouperlite.form.group.description.label' => 'Description:', + 'pl.grouperlite.form.group.description.help' => 'Description contains notes about the group, which could include: what the group represents, why it was created, etc.', + 'pl.grouperlite.form.group.privs.label' => 'Privileges', + 'pl.grouperlite.form.group.privs.label.READ' => 'READ', + 'pl.grouperlite.form.group.privs.label.VIEW' => 'VIEW', + 'pl.grouperlite.form.group.privs.label.OPTIN' => 'OPTIN', + 'pl.grouperlite.form.group.privs.label.OPTOUT' => 'OPTOUT', + 'pl.grouperlite.form.group.privs.label.ATTRIBUTE_READ' => 'ATTRIBUTE READ', + 'pl.grouperlite.form.group.subs.label' => 'Subscribers:', + 'pl.grouperlite.form.group.subs.help' => 'Select subscribers to add to the group.', + 'pl.grouperlite.form.group.subs.placeholder' => 'Search subscribers', + 'pl.grouperlite.form.group.action.save' => 'Save Group', 'pl.grouperlite.search.tags.text' => 'Search', ); \ No newline at end of file diff --git a/View/Elements/Components/search.ctp b/View/Elements/Components/search.ctp index 05d861f..f22b80b 100644 --- a/View/Elements/Components/search.ctp +++ b/View/Elements/Components/search.ctp @@ -1,5 +1,5 @@ + +
+ Form->label(false, _txt('pl.grouperlite.form.group.template.label'), array( + 'for' => 'template-select', + 'class' => "col-sm-3 col-form-label" + )); ?> +
+ Form->input('grouptemplate', array( + 'label' => false, + 'class' => 'custom-select', + 'id' => 'template-select', + 'options' => array('1' => 'Template', '2' => 'Another template', '3' => 'Yet another template'), + 'empty' => _txt('pl.grouperlite.form.group.template.empty') + )); ?> +
+
+
+
+ Form->label(false, _txt('pl.grouperlite.form.group.name.label'), array( + 'for' => 'name', + 'class' => "col-sm-3 col-form-label" + )); ?> +
+ Form->input('name', array( + 'label' => false, + 'class' => 'form-control', + 'id' => 'name' + )); ?> + + + +
+
+
+ Form->label(false, _txt('pl.grouperlite.form.group.stem.label'), array( + 'for' => 'folder', + 'class' => "col-sm-3 col-form-label" + )); ?> +
+ Form->input('grouptemplate', array( + 'label' => false, + 'class' => 'form-control', + 'id' => 'folder', + 'default' => 'sandbox:org:unicon:', + 'readonly' => true + )); ?> + + + +
+
+
+ Form->label(false, 'Description:', array( + 'for' => 'descr', + 'class' => "col-sm-3 col-form-label" + )); ?> +
+ Form->textarea('description', array( + 'class' => 'form-control', + 'id' => 'descr', + 'rows' => 5 + )); ?> + + Description contains notes about the group, which could include: what the group represents, why it was created, etc. + +
+
+
+ Privileges: +
+
+ +
+ Form->checkbox('privelages', array( + 'value' => $OPT, + 'class' => 'form-check-input', + 'id' => 'assign-' . $opt, + 'hiddenField' => false + )); ?> + Form->label(false, _txt('pl.grouperlite.form.group.privs.label.' . $opt), array( + 'for' => 'assign-' . $opt, + 'class' => "form-check-label" + )); ?> +
+ +
+
+
+
+ Form->label(false, _txt('pl.grouperlite.form.group.subs.label'), array( + 'for' => 'subscribers', + 'class' => "col-sm-3 col-form-label" + )); ?> +
+ Form->input('grouptemplate', array( + 'label' => false, + 'class' => 'typeahead form-control', + 'id' => 'name', + 'placeholder' => _txt('pl.grouperlite.form.group.subs.placeholder') + )); ?> + + + +
+
+
+
+
+ Form->button(_txt('pl.grouperlite.form.group.action.save'), array( + 'type' => 'submit', + 'class' => 'btn btn-primary btn-lg btn-raised' + )); ?> +
+
+
\ No newline at end of file diff --git a/View/GrouperGroups/groupcreateform.ctp b/View/GrouperGroups/groupcreateform.ctp index f37d426..8b5b086 100644 --- a/View/GrouperGroups/groupcreateform.ctp +++ b/View/GrouperGroups/groupcreateform.ctp @@ -1,257 +1,29 @@ -extend('/GrouperGroups/base'); ?> -Html->addCrumb('Create a Group'); ?> -
- +$model = $this->name; +?> +
- Form->create(false, array( - 'url' => array('controller' => 'groupergroups', 'action' => 'groupcreate') - )); ?> -
- Form->label(false, 'Select a template', array( - 'for' => 'template-select', - 'class' => "col-sm-3 col-form-label" - )); ?> -
- Form->input('grouptemplate', array( - 'label' => false, - 'class' => 'custom-select', - 'id' => 'template-select', - 'options' => array('1' => 'Template', '2' => 'Another template', '3' => 'Yet another template'), - 'empty' => '(choose one)' - )); ?> -
-
-
-
- Form->label(false, 'Group Name', array( - 'for' => 'name', - 'class' => "col-sm-3 col-form-label" - )); ?> -
- Form->input('grouptemplate', array( - 'label' => false, - 'class' => 'form-control', - 'id' => 'name' - )); ?> - - Name is the label that identifies this group, and might change. - -
-
-
- Form->label(false, 'Create in this folder:', array( - 'for' => 'folder', - 'class' => "col-sm-3 col-form-label" - )); ?> -
- Form->input('grouptemplate', array( - 'label' => false, - 'class' => 'form-control', - 'id' => 'folder', - 'default' => 'sandbox:org:unicon:', - 'readonly' => true - )); ?> - - Enter a folder name. - -
-
-
- Form->label(false, 'Description:', array( - 'for' => 'descr', - 'class' => "col-sm-3 col-form-label" - )); ?> -
- Form->textarea('description', array( - 'class' => 'form-control', - 'id' => 'descr', - 'rows' => 5 - )); ?> - - Description contains notes about the group, which could include: what the group represents, why it was created, etc. - -
-
-
- Privileges: -
-
-
- Form->checkbox('privelages', array( - 'value' => 'READ', - 'class' => 'form-check-input', - 'id' => 'assign-1', - 'hiddenField' => false - )); ?> - Form->label(false, 'READ', array( - 'for' => 'assign-1', - 'class' => "form-check-label" - )); ?> -
-
- Form->checkbox('privelages', array( - 'value' => 'VIEW', - 'class' => 'form-check-input', - 'id' => 'assign-2', - 'hiddenField' => false - )); ?> - Form->label(false, 'VIEW', array( - 'for' => 'assign-2', - 'class' => "form-check-label" - )); ?> -
-
- Form->checkbox('privelages', array( - 'value' => 'OPTIN', - 'class' => 'form-check-input', - 'id' => 'assign-3', - 'hiddenField' => false - )); ?> - Form->label(false, 'OPTIN', array( - 'for' => 'assign-3', - 'class' => "form-check-label" - )); ?> -
-
- Form->checkbox('privelages', array( - 'value' => 'OPTOUT', - 'class' => 'form-check-input', - 'id' => 'assign-4', - 'hiddenField' => false - )); ?> - Form->label(false, 'OPTOUT', array( - 'for' => 'assign-4', - 'class' => "form-check-label" - )); ?> -
-
- Form->checkbox('privelages', array( - 'value' => 'ATTRIBUTE_READ', - 'class' => 'form-check-input', - 'id' => 'assign-5', - 'hiddenField' => false - )); ?> - Form->label(false, 'ATTRIBUTE READ', array( - 'for' => 'assign-5', - 'class' => "form-check-label" - )); ?> -
-
-
-
-
- Form->label(false, 'Subscribers:', array( - 'for' => 'subscribers', - 'class' => "col-sm-3 col-form-label" - )); ?> -
- Form->input('grouptemplate', array( - 'label' => false, - 'class' => 'typeahead form-control', - 'id' => 'name', - 'placeholder' => 'Find subscribers' - )); ?> - - Select subscribers to add to the group. - -
-
-
-
-
- Form->button('Save Group', array( - 'type' => 'submit', - 'class' => 'btn btn-primary btn-lg btn-raised' - )); ?> -
-
-
- Form->end(); ?> + Form->create(false, array( + 'url' => array('controller' => 'groupergroups', 'action' => 'groupcreate') + )); ?> + 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"); + } + ?> + Form->end(); ?> +
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/View/Layouts/default.ctp b/View/Layouts/default.ctp deleted file mode 100644 index fca4ee9..0000000 --- a/View/Layouts/default.ctp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Html->charset(); ?> - - <?php echo $this->fetch('title'); ?> - - Html->css('GrouperLite.fonts/Font-Awesome-4.6.3/css/font-awesome.min') . "\n "; - print $this->Html->css('GrouperLite.bootstrap') . "\n "; - print $this->Html->css('GrouperLite.co-grouper-base') . "\n "; - print $this->Html->css('GrouperLite.co-grouper-plugin') . "\n "; - ?> - - Html->script('GrouperLite.jquery-3.5.1.min.js') . "\n "; - print $this->Html->script('GrouperLite.bootstrap.bundle.js') . "\n "; - print $this->Html->script('GrouperLite.typeahead.bundle.js') . "\n "; - ?> - fetch('GrouperLite.meta'); - echo $this->fetch('GrouperLite.css'); - echo $this->fetch('GrouperLite.script'); - ?> - - -
-
- element('GrouperLite.Flash/container'); ?> - fetch('content'); ?> -
-
- element('sql_dump'); ?> - -