-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved form to fields.inc file, updates to lang file
- Loading branch information
Showing
7 changed files
with
286 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
<?php | ||
$PRIVELAGES = array('READ', 'VIEW', 'OPTIN', 'OPTOUT', 'ATTRIBUTE_READ'); | ||
?> | ||
|
||
<script type="text/javascript"> | ||
$(function() { | ||
var form = $('#form'); | ||
var selector = $('#template-select') | ||
selector.on('change', function(ev) { | ||
if (ev.target.value && ev.target.value !== '') { | ||
form.removeClass('d-none'); | ||
} else { | ||
form.addClass('d-none'); | ||
} | ||
}); | ||
|
||
var users = new Bloodhound({ | ||
datumTokenizer: Bloodhound.tokenizers.whitespace, | ||
queryTokenizer: Bloodhound.tokenizers.whitespace, | ||
// url points to a json file that contains an array of country names, see | ||
// https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json | ||
remote: '/files/users.json', | ||
identify: function(obj) { | ||
return obj.email; | ||
} | ||
}); | ||
|
||
var subscribers = []; | ||
|
||
// passing in `null` for the `options` arguments will result in the default | ||
// options being used | ||
var typeahead = $('#userselect .typeahead').typeahead({ | ||
hint: true, | ||
highlight: true, | ||
minLength: 1 | ||
}, { | ||
name: 'users', | ||
display: function(obj) { | ||
return obj.name; | ||
}, | ||
source: users | ||
}); | ||
|
||
var list = $('#subscriber-list'); | ||
|
||
typeahead.on('typeahead:select', function(ev, selection) { | ||
ev.preventDefault(); | ||
typeahead.typeahead('val', null); | ||
addSubscriber(selection); | ||
}); | ||
|
||
list.delegate('.typeahead-remove', 'click', function(ev) { | ||
var email = $(ev.currentTarget).data('subscriber'); | ||
removeSubscriber(email); | ||
}); | ||
|
||
function removeSubscriber(email) { | ||
subscribers = subscribers.filter(function(s) { | ||
return email !== s.email; | ||
}); | ||
updateSubscriberList(); | ||
} | ||
|
||
function addSubscriber(sub) { | ||
subscribers.push(sub); | ||
updateSubscriberList(); | ||
} | ||
|
||
function updateSubscriberList() { | ||
list.empty(); | ||
list.html(subscribers.map(function(s) { | ||
|
||
var button = [ | ||
'<button class="btn btn-text btn-icon ml-2 typeahead-remove" type="button" data-subscriber="' + s.email + '">', | ||
'<span class="sr-only">', | ||
<?php echo _txt('pl.grouperlite.action.remove') ?>, | ||
'</span>', | ||
'<i class="fa fa-times"></i>', | ||
'</button>' | ||
].join(''); | ||
|
||
return [ | ||
'<span class="badge badge-pill badge-primary d-inline-flex align-items-center mr-2">', | ||
s.name, | ||
button, | ||
'<input type="hidden" name="subscribers[]" value="' + s.email + '" />', | ||
'</span>' | ||
].join(''); | ||
})); | ||
} | ||
|
||
}); | ||
</script> | ||
|
||
<div class="form-group row py-2 bg-lighter"> | ||
<?php echo $this->Form->label(false, _txt('pl.grouperlite.form.group.template.label'), array( | ||
'for' => 'template-select', | ||
'class' => "col-sm-3 col-form-label" | ||
)); ?> | ||
<div class="col-sm-9"> | ||
<?php echo $this->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') | ||
)); ?> | ||
</div> | ||
</div> | ||
<fieldset id="form" class=""> | ||
<div class="form-group row py-2 bg-light"> | ||
<?php echo $this->Form->label(false, _txt('pl.grouperlite.form.group.name.label'), array( | ||
'for' => 'name', | ||
'class' => "col-sm-3 col-form-label" | ||
)); ?> | ||
<div class="col-sm-9"> | ||
<?php echo $this->Form->input('name', array( | ||
'label' => false, | ||
'class' => 'form-control', | ||
'id' => 'name' | ||
)); ?> | ||
<small id="nameHelp" class="form-text text-muted"> | ||
<?php echo _txt('pl.grouperlite.form.group.name.help'); ?> | ||
</small> | ||
</div> | ||
</div> | ||
<div class="form-group row py-2 bg-lighter"> | ||
<?php echo $this->Form->label(false, _txt('pl.grouperlite.form.group.stem.label'), array( | ||
'for' => 'folder', | ||
'class' => "col-sm-3 col-form-label" | ||
)); ?> | ||
<div class="col-sm-9"> | ||
<?php echo $this->Form->input('grouptemplate', array( | ||
'label' => false, | ||
'class' => 'form-control', | ||
'id' => 'folder', | ||
'default' => 'sandbox:org:unicon:', | ||
'readonly' => true | ||
)); ?> | ||
<small id="folderHelp" class="form-text text-muted"> | ||
<?php echo _txt('pl.grouperlite.form.group.stem.help'); ?> | ||
</small> | ||
</div> | ||
</div> | ||
<div class="form-group row py-2 bg-light"> | ||
<?php echo $this->Form->label(false, 'Description:', array( | ||
'for' => 'descr', | ||
'class' => "col-sm-3 col-form-label" | ||
)); ?> | ||
<div class="col-sm-9"> | ||
<?php echo $this->Form->textarea('description', array( | ||
'class' => 'form-control', | ||
'id' => 'descr', | ||
'rows' => 5 | ||
)); ?> | ||
<small id="descrHelp" class="form-text text-muted"> | ||
Description contains notes about the group, which could include: what the group represents, why it was created, etc. | ||
</small> | ||
</div> | ||
</div> | ||
<div class="form-group row py-2 bg-lighter"> | ||
<legend class="col-form-label col-sm-3 pt-0">Privileges:</legend> | ||
<div class="col-sm-9"> | ||
<div class="d-flex"> | ||
<?php foreach ($PRIVELAGES as $opt) : ?> | ||
<div class="form-check mr-4"> | ||
<?php echo $this->Form->checkbox('privelages', array( | ||
'value' => $OPT, | ||
'class' => 'form-check-input', | ||
'id' => 'assign-' . $opt, | ||
'hiddenField' => false | ||
)); ?> | ||
<?php echo $this->Form->label(false, _txt('pl.grouperlite.form.group.privs.label.' . $opt), array( | ||
'for' => 'assign-' . $opt, | ||
'class' => "form-check-label" | ||
)); ?> | ||
</div> | ||
<?php endforeach; ?> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="form-group row py-2 bg-light"> | ||
<?php echo $this->Form->label(false, _txt('pl.grouperlite.form.group.subs.label'), array( | ||
'for' => 'subscribers', | ||
'class' => "col-sm-3 col-form-label" | ||
)); ?> | ||
<div class="col-sm-9" id="userselect"> | ||
<?php echo $this->Form->input('grouptemplate', array( | ||
'label' => false, | ||
'class' => 'typeahead form-control', | ||
'id' => 'name', | ||
'placeholder' => _txt('pl.grouperlite.form.group.subs.placeholder') | ||
)); ?> | ||
<small id="descrHelp" class="form-text text-muted"> | ||
<?php echo _txt('pl.grouperlite.form.group.subs.help'); ?> | ||
</small> | ||
<div id="subscriber-list" class="my-2"></div> | ||
</div> | ||
</div> | ||
<div class="form-group row py-2 bg-lighter"> | ||
<div class="col-sm-9 offset-sm-3"> | ||
<?php echo $this->Form->button(_txt('pl.grouperlite.form.group.action.save'), array( | ||
'type' => 'submit', | ||
'class' => 'btn btn-primary btn-lg btn-raised' | ||
)); ?> | ||
</div> | ||
</div> | ||
</fieldset> |
Oops, something went wrong.