$this->deleteRoleCapability('glm_members_edit');
$this->deleteRoleCapability('glm_members_info');
$this->deleteRoleCapability('glm_members_list');
-
+ $this->deleteRoleCapability('glm_members_configure');
/*
* Add user capabilties
*/
);
// Access to Configure menu
- $this->addRoleCapability('glm_members_configure',
+ $this->addRoleCapability('glm_members_settings',
array(
'administrator' => true,
'author' => false,
'force_list' => true,
'use' => 'a'
),
-
+/* Not using for now
// Special Image flag - only one of these
'selected' => array (
'field' => 'selected',
'type' => 'checkbox',
'use' => 'gled'
),
-
+*/
// Featured Image flag
'featured' => array (
'field' => 'featured',
&& is_array($_REQUEST['galleryImage_caption'])
&& count($_REQUEST['galleryImage_caption']) > 0) {
- // Get the ID of the "selected" image - Only one
- $selected = 0;
- if (isset($_REQUEST['galleryImage_selected'])) {
- $selected = ($_REQUEST['galleryImage_selected'] - 0);
+ // Get the ID of the "featured" image - Only one
+ $featured = 0;
+ if (isset($_REQUEST['galleryImage_featured'])) {
+ $featured = ($_REQUEST['galleryImage_featured'] - 0);
}
// Update other data for this image
// Sanitize input
$caption = sanitize_text_field( $_REQUEST['galleryImage_caption'][$k] );
$descr = sanitize_text_field( $_REQUEST['galleryImage_descr'][$k] );
- $featured = (isset($_REQUEST['galleryImage_featured']) && isset($_REQUEST['galleryImage_featured'][$k]) && $_REQUEST['galleryImage_featured'][$k] == 'on' ? 'true' : 'false');
+// $featured = (isset($_REQUEST['galleryImage_featured']) && isset($_REQUEST['galleryImage_featured'][$k]) && $_REQUEST['galleryImage_featured'][$k] == 'on' ? 'true' : 'false');
- // Check if this is the selected image
- $thisSelected = ($selected == $k ? 'true' : 'false');
+ // Check if this is the featured image
+ $thisFeatured = ($featured == $k ? 'true' : 'false');
// Update data for this image
- $sql = "UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX ."images SET caption = '$caption', descr = '$descr', selected = $thisSelected, featured = $featured WHERE id = $id;";
+ $sql = "UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX ."images SET caption = '$caption', descr = '$descr', featured = $thisFeatured WHERE id = $id;";
$this->wpdb->query($sql);
}
// Check for an image deletion
if (isset($_REQUEST['galleryImage_delete']) && count($_REQUEST['galleryImage_delete']) > 0) {
- // For each delete selected
+ // For each delete requested
reset($_REQUEST['galleryImage_delete']);
while (list($k, $v) = each($_REQUEST['galleryImage_delete'])) {
$id = ($k -0);
; Member Access Levels
;
access[30] = 'Display, Updates Moderated'
+access[35] = 'Not Displayed, Updates Moderated'
access[40] = 'Display, Updates Not Moderated'
+access[45] = 'Not Displayed, Updates Not Moderated'
access[20] = 'Display, No Access'
access[10] = 'Not Displayed, No Access'
access[90] = 'Not Displayed, Archived'
access_short[30] = 'Moderated'
+access_short[35] = 'NotDisplayed-Moderated'
access_short[40] = 'Not-Moderated'
+access_short[45] = 'NotDisplayed-NotModerated'
access_short[20] = 'Display'
access_short[10] = 'None'
access_short[90] = 'Archived'
access_numb['NotDisplayed'] = 10
access_numb['NoAccess'] = 20
access_numb['Moderated'] = 30
+access_numb['NotDisplayedModerated'] = 35
access_numb['Full'] = 40
+access_numb['NotDisplayedNotModerated'] = 45
access_numb['Archived'] = 90
;
);
wp_enqueue_style('glm-members-admin-image-upload-css');
+ // jQuery Multi-Select
+
+ wp_register_style(
+ 'glm-members-admin-jquery-select-css',
+ GLM_MEMBERS_PLUGIN_URL . 'js/multiselect/multiselect.css',
+ 'glm-members-admin-jquery-select',
+ GLM_MEMBERS_PLUGIN_VERSION
+ );
+ wp_enqueue_style('glm-members-admin-jquery-select-css');
+ wp_register_script(
+ 'glm-members-admin-jquery-select',
+ GLM_MEMBERS_PLUGIN_URL . 'js/multiselect/multiselect.js',
+ array(
+ 'jquery'
+ ),
+ GLM_MEMBERS_PLUGIN_VERSION
+ );
+ wp_enqueue_script('glm-members-admin-jquery-select');
+
+
}
/**
* Configure WordPress Menus for this Plugin
*
* This method is called by an add_action() hook setup in the contructor. We
- * do it
- * this way so that the menu related functions of WordPress are in scope
- * when creating
- * the additional menu items. WordPress will execute this call-back method
- * when building
- * its Dashboard menus.
+ * do it this way so that the menu related functions of WordPress are in scope
+ * when creating the additional menu items. WordPress will execute this call-back method
+ * when building its Dashboard menus.
*
- * add menu function reference
- * add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position)
- * add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function)
- *
- * (no prameters)
+ * This function searches all add-ons for an "setup/adminMenus.php" file and runs them.
*
* @return void
* @access public
public function configureMenus ()
{
- // If user can manage all members, then show "Members" menu item
- if (apply_filters('glm_members_menu_members', true)) {
-
- $mainMenuSlug = 'glm-members-admin-menu-members';
-
- add_menu_page(
- 'Members',
- 'Members',
- 'glm_members_main_menu',
- 'glm-members-admin-menu-members',
- function() {$this->controller('members');},
- false,
- '91.123'
- );
-
- // Add a submenu for the "Member" section
- if (apply_filters('glm_members_menu_member', true)) {
- add_submenu_page(
- $mainMenuSlug,
- 'Member Dashboard',
- 'Member',
- 'glm_members_member',
- 'glm-members-admin-menu-member',
- function() {$this->controller('member');}
- );
- }
-
- // Otherwise just display "Member" menu item
- } else {
-
- $mainMenuSlug = 'glm-members-admin-menu-member';
-
- add_menu_page(
- 'Member',
- 'Member',
- 'glm_members_main_menu',
- 'glm-members-admin-menu-member',
- function() {$this->controller('member');},
- false,
- '91.123'
- );
-
- }
-
- // Add a submenu for the "Configure" section
- if (apply_filters('glm_members_menu_configure', true)) {
- add_submenu_page(
- 'glm-members-admin-menu-members',
- 'Configure Members Database',
- 'Configure',
- 'glm_members_configure',
- 'glm-members-admin-menu-configure',
- function() {$this->controller('configure');}
- );
- }
-
- // Add a submenu for the "Management" section
- if (apply_filters('glm_members_menu_meanagement', true)) {
- add_submenu_page(
- 'glm-members-admin-menu-members',
- 'Member DB Management',
- 'Management',
- 'glm_members_management',
- 'glm-members-admin-menu-management',
- function() {$this->controller('management');}
- );
- }
-
- // Add a submenu for the "Shortcode Reference" section
- if (apply_filters('glm_members_menu_shortcodes', true)) {
- add_submenu_page(
- 'glm-members-admin-menu-members',
- 'Shortcode Reference',
- 'Shortcodes',
- 'glm_members_shortcodes',
- 'glm-members-admin-menu-shortcodes',
- function() {$this->controller('shortcodes');}
- );
- }
-
// For each add-on, read in their menu additions - These are optional files
foreach ($this->config['addOns'] as $a) {
if (is_file(GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminMenus.php')) {
// NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
-define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Member Database');
+define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Membership Management System');
define('GLM_MEMBERS_PLUGIN_SHORT_NAME', 'GLM Member DB');
define('GLM_MEMBERS_PLUGIN_SLUG', 'glm-member-db');
--- /dev/null
+.ms-options-wrap,
+.ms-options-wrap * {
+ box-sizing: border-box;
+}
+
+.ms-options-wrap > button:focus,
+.ms-options-wrap > button {
+ position: relative;
+ width: 100%;
+ text-align: left;
+ border: 1px solid #aaa;
+ background-color: #fff;
+ padding: 5px 20px 5px 5px;
+ margin-top: 1px;
+ font-size: 13px;
+ color: #aaa;
+ outline: none;
+ white-space: nowrap;
+}
+
+.ms-options-wrap > button:after {
+ content: ' ';
+ height: 0;
+ position: absolute;
+ top: 50%;
+ right: 5px;
+ width: 0;
+ border: 6px solid rgba(0, 0, 0, 0);
+ border-top-color: #999;
+ margin-top: -3px;
+}
+
+.ms-options-wrap > .ms-options {
+ position: absolute;
+ left: 0;
+ width: 100%;
+ margin-top: 1px;
+ margin-bottom: 20px;
+ background: white;
+ z-index: 2000;
+ border: 1px solid #aaa;
+}
+
+.ms-options-wrap > .ms-options > .ms-search input {
+ width: 100%;
+ padding: 4px 5px;
+ border: none;
+ border-bottom: 1px groove;
+ outline: none;
+}
+
+.ms-options-wrap > .ms-options .ms-selectall {
+ display: inline-block;
+ font-size: .9em;
+ text-transform: lowercase;
+ text-decoration: none;
+}
+.ms-options-wrap > .ms-options .ms-selectall:hover {
+ text-decoration: underline;
+}
+
+.ms-options-wrap > .ms-options > .ms-selectall.global {
+ margin: 4px 5px;
+}
+
+.ms-options-wrap > .ms-options > ul {
+ line-height: .2em;
+}
+
+.ms-options-wrap > .ms-options > ul > li.optgroup {
+ padding: 5px;
+}
+.ms-options-wrap > .ms-options > ul > li.optgroup + li.optgroup {
+ border-top: 1px solid #aaa;
+}
+
+.ms-options-wrap > .ms-options > ul > li.optgroup .label {
+ display: block;
+ padding: 5px 0 0 0;
+ font-weight: bold;
+}
+
+.ms-options-wrap > .ms-options > ul label {
+ position: relative;
+ display: inline-block;
+ width: 100%;
+ padding: 4px;
+ margin: 1px 0;
+}
+
+.ms-options-wrap > .ms-options > ul li.selected label,
+.ms-options-wrap > .ms-options > ul label:hover {
+ background-color: #efefef;
+}
+
+.ms-options-wrap > .ms-options > ul input[type="checkbox"] {
+ margin-right: 5px;
+ position: absolute;
+ left: 4px;
+/* top: 7px; */
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Display a nice easy to use multiselect list
+ * @Version: 2.0
+ * @Author: Patrick Springstubbe
+ * @Contact: @JediNobleclem
+ * @Website: springstubbe.us
+ * @Source: https://github.com/nobleclem/jQuery-MultiSelect
+ * @Notes: If select list is hidden on page load use the jquery.actual plugin
+ * to resolve issues with preselected items placeholder text
+ * https://github.com/dreamerslab/jquery.actual
+ *
+ * Usage:
+ * $('select[multiple]').multiselect();
+ * $('select[multiple]').multiselect({ placeholder: 'Select options' });
+ * $('select[multiple]').multiselect('reload');
+ * $('select[multiple]').multiselect( 'loadOption', [{
+ * name : 'Option Name 1',
+ * value : 'option-value-1',
+ * checked: false
+ * },{
+ * name : 'Option Name 2',
+ * value : 'option-value-2',
+ * checked: false
+ * }]);
+ *
+ **/
+(function($){
+ var defaults = {
+ placeholder : 'Select options', // text to use in dummy input
+ columns : 1, // how many columns should be use to show options
+ search : false, // include option search box
+ // search filter options
+ searchOptions : {
+ 'default' : 'Search', // search input placeholder text
+ showOptGroups: false, // show option group titles if no options remaining
+ onSearch : function( element ){} // fires on keyup before search on options happens
+ },
+ selectAll : false, // add select all option
+ selectGroup : false, // select entire optgroup
+ minHeight : 200, // minimum height of option overlay
+ maxHeight : null, // maximum height of option overlay
+ showCheckbox : true, // display the checkbox to the user
+ jqActualOpts : {}, // options for jquery.actual
+
+ // Callbacks
+ onLoad : function( element ) { // fires at end of list initialization
+ $(element).hide();
+ },
+ onOptionClick : function( element, option ){}, // fires when an option is clicked
+
+ // @NOTE: these are for future development
+ maxWidth : null, // maximum width of option overlay (or selector)
+ minSelect : false, // minimum number of items that can be selected
+ maxSelect : false, // maximum number of items that can be selected
+ };
+
+ var msCounter = 1;
+ var placeWidth = 0;
+
+ function MultiSelect( element, options )
+ {
+ this.element = element;
+ this.options = $.extend( {}, defaults, options );
+ this.load();
+ }
+
+ MultiSelect.prototype = {
+ /* LOAD CUSTOM MULTISELECT DOM/ACTIONS */
+ load: function() {
+ var instance = this;
+
+ // make sure this is a select list and not loaded
+ if( (instance.element.nodeName != 'SELECT') || $(instance.element).hasClass('jqmsLoaded') ) {
+ return true;
+ }
+
+ // sanity check so we don't double load on a select element
+ $(instance.element).addClass('jqmsLoaded');
+
+ // add option container
+ $(instance.element).after('<div class="ms-options-wrap"><button>None Selected</button><div class="ms-options"><ul></ul></div></div>');
+ var placeholder = $(instance.element).next('.ms-options-wrap').find('> button:first-child');
+ var optionsWrap = $(instance.element).next('.ms-options-wrap').find('> .ms-options');
+ var optionsList = optionsWrap.find('> ul');
+ var hasOptGroup = $(instance.element).find('optgroup').length ? true : false;
+
+ var maxWidth = null;
+ if( typeof instance.options.width == 'number' ) {
+ optionsWrap.parent().css( 'position', 'relative' );
+ maxWidth = instance.options.width;
+ }
+ else if( typeof instance.options.width == 'string' ) {
+ $( instance.options.width ).css( 'position', 'relative' );
+ maxWidth = '100%';
+ }
+ else {
+ optionsWrap.parent().css( 'position', 'relative' );
+ }
+
+ var maxHeight = ($(window).height() - optionsWrap.offset().top - 20);
+ if( instance.options.maxHeight ) {
+ maxHeight = ($(window).height() - optionsWrap.offset().top - 20);
+ maxHeight = maxHeight < instance.options.minHeight ? instance.options.minHeight : maxheight;
+ }
+
+ maxHeight = maxHeight < instance.options.minHeight ? instance.options.minHeight : maxHeight;
+
+ optionsWrap.css({
+ maxWidth : maxWidth,
+ minHeight: instance.options.minHeight,
+ maxHeight: maxHeight,
+ overflow : 'auto'
+ }).hide();
+
+ // isolate options scroll
+ // @source: https://github.com/nobleclem/jQuery-IsolatedScroll
+ optionsWrap.bind( 'touchmove mousewheel DOMMouseScroll', function ( e ) {
+ if( ($(this).outerHeight() < $(this)[0].scrollHeight) ) {
+ var e0 = e.originalEvent,
+ delta = e0.wheelDelta || -e0.detail;
+
+ if( ($(this).outerHeight() + $(this)[0].scrollTop) > $(this)[0].scrollHeight ) {
+ e.preventDefault();
+ this.scrollTop += ( delta < 0 ? 1 : -1 );
+ }
+ }
+ });
+
+ // hide options menus if click happens off of the list placeholder button
+ $(document).off('click.ms-hideopts').on('click.ms-hideopts', function( event ){
+ if( !$(event.target).closest('.ms-options-wrap').length ) {
+ $('.ms-options-wrap > .ms-options:visible').hide();
+ }
+ });
+
+ // disable button action
+ placeholder.bind('mousedown',function( event ){
+ // ignore if its not a left click
+ if( event.which != 1 ) {
+ return true;
+ }
+
+ // hide other menus before showing this one
+ $('.ms-options-wrap > .ms-options:visible').each(function(){
+ if( $(this).parent().prev()[0] != optionsWrap.parent().prev()[0] ) {
+ $(this).hide();
+ }
+ });
+
+ // show/hide options
+ optionsWrap.toggle();
+
+ // recalculate height
+ if( optionsWrap.is(':visible') ) {
+ optionsWrap.css( 'maxHeight', '' );
+
+ var maxHeight = ($(window).height() - optionsWrap.offset().top - 20);
+ if( instance.options.maxHeight ) {
+ maxHeight = ($(window).height() - optionsWrap.offset().top - 20);
+ maxHeight = maxHeight < instance.options.minHeight ? instance.options.minHeight : maxheight;
+ }
+ maxHeight = maxHeight < instance.options.minHeight ? instance.options.minHeight : maxHeight;
+
+ optionsWrap.css( 'maxHeight', maxHeight );
+ }
+ }).click(function( event ){ event.preventDefault(); });
+
+ // add placeholder copy
+ if( instance.options.placeholder ) {
+ placeholder.text( instance.options.placeholder );
+ }
+
+ // add search box
+ if( instance.options.search ) {
+ optionsList.before('<div class="ms-search"><input type="text" value="" placeholder="'+ instance.options.searchOptions['default'] +'" /></div>');
+
+ var search = optionsWrap.find('.ms-search input');
+ search.on('keyup', function(){
+ // ignore keystrokes that don't make a difference
+ if( $(this).data('lastsearch') == $(this).val() ) {
+ return true;
+ }
+
+ $(this).data('lastsearch', $(this).val() );
+
+ // USER CALLBACK
+ if( typeof instance.options.searchOptions.onSearch == 'function' ) {
+ instance.options.searchOptions.onSearch( instance.element );
+ }
+
+ // search non optgroup li's
+ optionsList.find('li:not(.optgroup)').each(function(){
+ var optText = $(this).text();
+
+ // show option if string exists
+ if( optText.toLowerCase().indexOf( search.val().toLowerCase() ) > -1 ) {
+ $(this).show();
+ }
+ // don't hide selected items
+ else if( !$(this).hasClass('selected') ) {
+ $(this).hide();
+ }
+
+ // hide / show optgroups depending on if options within it are visible
+ if( !instance.options.searchOptions.showOptGroups && $(this).closest('li.optgroup') ) {
+ $(this).closest('li.optgroup').show();
+
+ if( $(this).closest('li.optgroup').find('li:visible').length ) {
+ $(this).closest('li.optgroup').show();
+ }
+ else {
+ $(this).closest('li.optgroup').hide();
+ }
+ }
+ });
+ });
+ }
+
+ // add global select all options
+ if( instance.options.selectAll ) {
+ optionsList.before('<a href="#" class="ms-selectall global">Select all/none</a>');
+ }
+
+ // handle select all option
+ optionsWrap.on('click', '.ms-selectall', function( event ){
+ event.preventDefault();
+
+ if( $(this).hasClass('global') ) {
+ // check if any selected if so then select them
+ if( optionsList.find('li:not(.optgroup)').filter(':not(.selected)').length ) {
+ optionsList.find('li:not(.optgroup)').filter(':not(.selected)').find('input[type="checkbox"]').trigger('click');
+ }
+ // deselect everything
+ else {
+ optionsList.find('li:not(.optgroup).selected input[type="checkbox"]').trigger('click');
+ }
+ }
+ else if( $(this).closest('li').hasClass('optgroup') ) {
+ var optgroup = $(this).closest('li.optgroup');
+
+ // check if any selected if so then select them
+ if( optgroup.find('li:not(.selected)').length ) {
+ optgroup.find('li:not(.selected) input[type="checkbox"]').trigger('click');
+ }
+ // deselect everything
+ else {
+ optgroup.find('li.selected input[type="checkbox"]').trigger('click');
+ }
+ }
+ });
+
+ // add options to wrapper
+ var options = [];
+ $(instance.element).children().each(function(){
+ if( this.nodeName == 'OPTGROUP' ) {
+ var groupOptions = [];
+
+ $(this).children('option').each(function(){
+ groupOptions[ $(this).val() ] = {
+ name : $(this).text(),
+ value : $(this).val(),
+ checked: $(this).prop( 'selected' )
+ };
+ });
+
+ options.push({
+ label : $(this).attr('label'),
+ options: groupOptions
+ });
+ }
+ else if( this.nodeName == 'OPTION' ) {
+ options.push({
+ name : $(this).text(),
+ value : $(this).val(),
+ checked: $(this).prop( 'selected' )
+ });
+ }
+ else {
+ // bad option
+ return true;
+ }
+ });
+ instance.loadOptions( options );
+
+ // COLUMNIZE
+ if( hasOptGroup ) {
+ // float non grouped options
+ optionsList.find('> li:not(.optgroup)').css({
+ float: 'left',
+ width: (100 / instance.options.columns) +'%'
+ });
+
+ // add CSS3 column styles
+ optionsList.find('li.optgroup').css({
+ clear: 'both'
+ }).find('> ul').css({
+ 'column-count' : instance.options.columns,
+ 'column-gap' : 0,
+ '-webkit-column-count': instance.options.columns,
+ '-webkit-column-gap' : 0,
+ '-moz-column-count' : instance.options.columns,
+ '-moz-column-gap' : 0
+ });
+
+ // for crappy IE versions float grouped options
+ if( this._ieVersion() && (this._ieVersion() < 10) ) {
+ optionsList.find('li.optgroup > ul > li').css({
+ float: 'left',
+ width: (100 / instance.options.columns) +'%'
+ });
+ }
+ }
+ else {
+ // add CSS3 column styles
+ optionsList.css({
+ 'column-count' : instance.options.columns,
+ 'column-gap' : 0,
+ '-webkit-column-count': instance.options.columns,
+ '-webkit-column-gap' : 0,
+ '-moz-column-count' : instance.options.columns,
+ '-moz-column-gap' : 0
+ });
+
+ // for crappy IE versions float grouped options
+ if( this._ieVersion() && (this._ieVersion() < 10) ) {
+ optionsList.find('> li').css({
+ float: 'left',
+ width: (100 / instance.options.columns) +'%'
+ });
+ }
+ }
+
+ // BIND SELECT ACTION
+ optionsWrap.on( 'click', 'input[type="checkbox"]', function(){
+ $(this).closest( 'li' ).toggleClass( 'selected' );
+
+ var select = optionsWrap.parent().prev();
+
+ // toggle clicked option
+ select.find('option[value="'+ $(this).val() +'"]').prop(
+ 'selected', $(this).is(':checked')
+ ).closest('select').trigger('change');
+
+ if( typeof instance.options.onOptionClick == 'function' ) {
+ instance.options.onOptionClick();
+ }
+
+ instance._updatePlaceholderText();
+ });
+
+ // hide native select list
+ if( typeof instance.options.onLoad === 'function' ) {
+ instance.options.onLoad( instance.element );
+ }
+ else {
+ $(instance.element).hide();
+ }
+ },
+
+ /* LOAD SELECT OPTIONS */
+ loadOptions: function( options, overwrite ) {
+ overwrite = (typeof overwrite == 'boolean') ? overwrite : true;
+
+ var instance = this;
+ var optionsList = $(instance.element).next('.ms-options-wrap').find('> .ms-options > ul');
+
+ if( overwrite ) {
+ optionsList.find('> li').remove();
+ }
+
+ for( var key in options ) {
+ var thisOption = options[ key ];
+ var container = $('<li></li>');
+
+ // optgroup
+ if( thisOption.hasOwnProperty('options') ) {
+ container.addClass('optgroup');
+ container.append('<span class="label">'+ thisOption.label +'</span>');
+ container.find('> .label').css({
+ clear: 'both'
+ });
+
+ if( instance.options.selectGroup ) {
+ container.append('<a href="#" class="ms-selectall">Select all</a>')
+ }
+
+ container.append('<ul></ul>');
+
+ for( var gKey in thisOption.options ) {
+ var thisGOption = thisOption.options[ gKey ];
+ var gContainer = $('<li></li>').addClass('ms-reflow');
+
+ instance._addOption( gContainer, thisGOption );
+
+ container.find('> ul').append( gContainer );
+ }
+ }
+ // option
+ else if( thisOption.hasOwnProperty('value') ) {
+ container.addClass('ms-reflow')
+
+ instance._addOption( container, thisOption );
+ }
+
+ optionsList.append( container );
+ }
+
+ optionsList.find('.ms-reflow input[type="checkbox"]').each(function( idx ){
+ if( $(this).css('display').match(/block$/) ) {
+ var checkboxWidth = $(this).outerWidth();
+ checkboxWidth = checkboxWidth ? checkboxWidth : 15;
+
+ $(this).closest('label').css(
+ 'padding-left',
+ (parseInt( $(this).closest('label').css('padding-left') ) * 2) + checkboxWidth
+ );
+
+ $(this).closest('.ms-reflow').removeClass('ms-reflow');
+ }
+ });
+
+ instance._updatePlaceholderText();
+ },
+
+ /* RESET THE DOM */
+ unload: function() {
+ $(this.element).next('.ms-options-wrap').remove();
+ $(this.element).show(function(){
+ $(this).css('display','').removeClass('jqmsLoaded');
+ });
+ },
+
+ /* RELOAD JQ MULTISELECT LIST */
+ reload: function() {
+ // remove existing options
+ $(this.element).next('.ms-options-wrap').remove();
+ $(this.element).removeClass('jqmsLoaded');
+
+ // load element
+ this.load();
+ },
+
+ /** PRIVATE FUNCTIONS **/
+ // update selected placeholder text
+ _updatePlaceholderText: function(){
+ var instance = this;
+ var placeholder = $(instance.element).next('.ms-options-wrap').find('> button:first-child');
+ var optionsWrap = $(instance.element).next('.ms-options-wrap').find('> .ms-options');
+ var select = optionsWrap.parent().prev();
+
+ // get selected options
+ var selOpts = [];
+ select.find('option:selected').each(function(){
+ selOpts.push( $(this).text() );
+ });
+
+ // UPDATE PLACEHOLDER TEXT WITH OPTIONS SELECTED
+ placeholder.text( selOpts.join( ', ' ) );
+ var copy = placeholder.clone().css({
+ display : 'inline',
+ width : 'auto',
+ visibility: 'hidden'
+ }).appendTo( optionsWrap.parent() );
+
+ // if the jquery.actual plugin is loaded use it to get the widths
+ var copyWidth = (typeof $.fn.actual !== 'undefined') ? copy.actual( 'width', instance.options.jqActualOpts ) : copy.width();
+// var placeWidth = (typeof $.fn.actual !== 'undefined') ? placeholder.actual( 'width', instance.options.jqActualOpts ) : placeholder.width();
+
+ // Hacked placeWidth to function for me - CPS
+ if (placeWidth == 0) {
+ placeWidth = (typeof $.fn.actual !== 'undefined') ? placeholder.actual( 'width', instance.options.jqActualOpts ) : placeholder.width();
+ if (instance.options.maxWidth < placeWidth) {
+ placeWidth = instance.options.maxWidth;
+ }
+ }
+
+ // if copy is larger than button width use "# selected"
+ if( copyWidth > placeWidth ) {
+ placeholder.text( selOpts.length +' selected' );
+ }
+ // if options selected then use those
+ else if( selOpts.length ) {
+ placeholder.text( selOpts.join( ', ' ) );
+ }
+ // replace placeholder text
+ else {
+ placeholder.text( instance.options.placeholder );
+ }
+
+ // remove dummy element
+ copy.remove();
+ },
+
+ // Add option to the custom dom list
+ _addOption: function( container, option ) {
+ container.text( option.name );
+ container.prepend(
+ $('<input type="checkbox" value="" title="" />')
+ .val( option.value )
+ .attr( 'title', option.name )
+ .attr( 'id', 'ms-opt-'+ msCounter )
+ );
+
+ if( option.checked ) {
+ container.addClass('default');
+ container.addClass('selected');
+ container.find( 'input[type="checkbox"]' ).prop( 'checked', true );
+ }
+
+ var label = $('<label></label>').attr( 'for', 'ms-opt-'+ msCounter );
+ container.wrapInner( label );
+
+
+ if( !this.options.showCheckbox ) {
+ container.find('input[id="ms-opt-'+ msCounter +'"]').hide();
+ }
+
+ msCounter = msCounter + 1;
+ },
+
+ // check ie version
+ _ieVersion: function() {
+ var myNav = navigator.userAgent.toLowerCase();
+ return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
+ }
+ };
+
+ // ENABLE JQUERY PLUGIN FUNCTION
+ $.fn.multiselect = function( options ){
+ var args = arguments;
+ var ret;
+
+ // menuize each list
+ if( (options === undefined) || (typeof options === 'object') ) {
+ return this.each(function(){
+ if( !$.data( this, 'plugin_multiselect' ) ) {
+ $.data( this, 'plugin_multiselect', new MultiSelect( this, options ) );
+ }
+ });
+ } else if( (typeof options === 'string') && (options[0] !== '_') && (options !== 'init') ) {
+ this.each(function(){
+ var instance = $.data( this, 'plugin_multiselect' );
+
+ if( instance instanceof MultiSelect && typeof instance[ options ] === 'function' ) {
+ ret = instance[ options ].apply( instance, Array.prototype.slice.call( args, 1 ) );
+ }
+
+ // special destruct handler
+ if( options === 'unload' ) {
+ $.data( this, 'plugin_multiselect', null );
+ }
+ });
+
+ return ret;
+ }
+ };
+}(jQuery));
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Amenitiess List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-// Load Amenities data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_amenities extends GlmDataAmenities
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveAmenities = false;
- $amenities = false;
- $error = false;
-
-
- $newAmenity = $this->newEntry();
-
- // Check if a category ID is supplied
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- break;
-
- }
-
- }
-
-
-/*
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($newAmenity, 'DataBlock', 'New Amenity Data');
- }
-
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
-
- $amenities = $this->insertEntry();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
- }
- }
-
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['amenityID'])) {
-
- $id = $_REQUEST['amenityID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
- }
-
- }
-
- // Check if a amenity ID is supplied
- if (isset($_REQUEST['amenity_id'])) {
- // Make sure it's a number
- $amenityID = $_REQUEST['amenity_id']-0;
- }
-
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
-*/
-
- // Get a current list of amenities
- $amenities = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveAmenities = false;
- if ($amenities !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($amenities) > 0) {
- $haveAmenities = true;
- }
- }
-
- // If we had a fatal error, redirect to the error page
- if ($error) {
- return array(
- 'status' => $success,
- 'menuItemRedirect' => 'error',
- 'modelRedirect' => 'index',
- 'view' => 'admin/error/index.html',
- 'data' => false
- );
- }
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveAmenities' => $haveAmenities,
- 'amenities' => $amenities,
- 'newAmenity' => $newAmenity
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/amenities.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Categories List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_categories extends GlmDataCategories
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveCategories = false;
- $categories = false;
- $error = false;
-
- // Check if a category ID is supplied
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
-
- // Also delete from member info
- $this->wpdb->delete(
- GLM_MEMBERS_PLUGIN_DB_PREFIX . 'category_member_info',
- array(
- 'category' => $id
- )
- );
- }
- break;
-
- }
-
- }
-
- // Get a current list of categories
- $categories = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($categories, 'DataBlock', 'Category Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveCategories = false;
- if ($categories !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($categories) > 0) {
- $haveCategories = true;
- }
- }
-
- // If we had a fatal error, redirect to the error page
- if ($error) {
- return array(
- 'status' => $success,
- 'menuItemRedirect' => 'error',
- 'modelRedirect' => 'index',
- 'view' => 'admin/error/index.html',
- 'data' => false
- );
- }
-
- // Sort results by higherarchy (Parent/Child and Alpha)
- $categories = $this->sortParentChild($categories);
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($categories, 'DataBlock', 'Categories Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveCategories' => $haveCategories,
- 'categories' => $categories
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/categories.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Cities List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_cities extends GlmDataCities
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveCities = false;
- $cities = false;
- $error = false;
-
- // Check if a city ID is supplied
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- break;
-
- }
-
- }
-
- // Get a current list of members
- $cities = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($cities, 'DataBlock', 'City Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveCities = false;
- if ($cities !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($cities) > 0) {
- $haveCities = true;
- }
- }
-
- // If we had a fatal error, redirect to the error page
- if ($error) {
- return array(
- 'status' => $success,
- 'menuItemRedirect' => 'error',
- 'modelRedirect' => 'index',
- 'view' => 'admin/error/index.html',
- 'data' => false
- );
- }
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($cities, 'DataBlock', 'Cities Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveCities' => $haveCities,
- 'cities' => $cities
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/cities.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Member Type List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_index extends GlmDataMemberTypes
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveMemberTypes = false;
- $memberTypes = false;
- $couldNotDelete = false;
- $error = false;
-
- // Check for member type id
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- // First check if any members are using this type
- $inUse = $this->wpdb->get_var("
- SELECT COUNT(id)
- FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
- WHERE member_type = $id;
- ");
-
- // If there's no members with this type
- if (($inUse-0) == 0) {
- $this->deleteEntry($id, true);
- } else {
- $couldNotDelete = true;
- }
- }
- break;
-
- }
-
- }
-
- // Get a current list of member types
- $memberTypes = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveMemberTypes = false;
- if ($memberTypes !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($memberTypes) > 0) {
- $haveMemberTypes = true;
- }
- }
-
- // If we had a fatal error, redirect to the error page
- if ($error) {
- return array(
- 'status' => $success,
- 'menuItemRedirect' => 'error',
- 'modelRedirect' => 'index',
- 'view' => 'admin/error/index.html',
- 'data' => false
- );
- }
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveMemberTypes' => $haveMemberTypes,
- 'memberTypes' => $memberTypes,
- 'couldNotDelete' => $couldNotDelete
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/index.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Regions List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_regions extends GlmDataRegions
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveRegions = false;
- $regions = false;
- $error = false;
-
- // Check for region id
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- break;
-
- }
-
- }
-
- // Get a current list of members
- $regions = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($regions, 'DataBlock', 'Region Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveRegions = false;
- if ($regions !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($regions) > 0) {
- $haveRegions = true;
- }
- }
-
- // If we had a fatal error, redirect to the error page
- if ($error) {
- return array(
- 'status' => $success,
- 'menuItemRedirect' => 'error',
- 'modelRedirect' => 'index',
- 'view' => 'admin/error/index.html',
- 'data' => false
- );
- }
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($regions, 'DataBlock', 'Regions Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveRegions' => $haveRegions,
- 'regions' => $regions
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/regions.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
public function modelAction ($actionData = false)
{
$settingsUpdated = false;
+ $settingsUpdateError = false;
// General settings are always stored in a record with ID=1.
$id = 1;
// Determine if current user can edit configurations
- if (!current_user_can('glm_members_configure')) {
+ if (!current_user_can('glm_members_settings')) {
return array(
'status' => false,
'menuItemRedirect' => 'error',
$generalSettings = $this->updateEntry(1);
if ($generalSettings['status']) {
$settingsUpdated = true;
+ } else {
+ $settingsUpdateError = true;
}
break;
// Compile template data
$templateData = array(
- 'gitBranch' => $gitBranch,
'reason' => '',
'genSettings' => $generalSettings,
'timezones' => DateTimeZone::listIdentifiers(),
- 'settingsUpdated' => $settingsUpdated
+ 'settingsUpdated' => $settingsUpdated,
+ 'settingsUpdateError' => $settingsUpdateError
);
// Return status, suggested view, and data to controller
$id = 1;
// Determine if current user can edit configurations
- if (!current_user_can('glm_members_configure')) {
+ if (!current_user_can('glm_members_settings')) {
return array(
'status' => false,
'menuItemRedirect' => 'error',
*/
public function modelAction ($actionData = false)
{
+
$where = ' true ';
$filterPending = false;
$filterArchived = false;
- $filterCat = false;
$haveFilter = false;
// Check if this is a request to show archived members
$Categories = new GlmDataCategories($this->wpdb, $this->config);
$categories = $Categories->getListSortedParentChild(false);
- // Check if there is a category filter
- if (isset($_REQUEST['filterCategory'])) {
- $filterCat = ($_REQUEST['filterCategory'] - 0);
+ // Add "selected" element default false;
+ reset($categories);
+ while (list($k, $v) = each($categories)) {
+ $categories[$k]['selected'] = false;
+ }
+
+ // Check if there is a category filter (multi-select)
+ if (isset($_REQUEST['filterCategories']) && count($_REQUEST['filterCategories']) > 0) {
+
+ $cats = '';
+ $catsSep = '';
+
+ // For each selected category
+ foreach($_REQUEST['filterCategories'] as $c) {
+ $cats .= $catsSep.$c;
+ $catsSep = ',';
+ $categories[$c]['selected'] = true;
+ }
+
$where .= " AND T.id in (
SELECT DISTINCT(I.member)
FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I,
".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
WHERE I.id = M.member_info
AND (
- M.category = $filterCat
- OR (C.parent = $filterCat AND M.category = C.id)
+ M.category in ($cats)
+ OR (C.parent in ($cats) AND M.category = C.id)
)
)";
}
-
- // Get a current list of members
- $list = $this->getSimpleMembersList($where);
-
- /*
- * Check for list filters
- *
- * Note that since the pointer processing in the data abstract takes place after the
- * query of the table data, and that the pending value is actually a sum() of the
- * id field values for member_info table generated using the pointer p_sum options,
- * we can't use a common where clause to select it.
- */
+ // Check for "Pending Only
if (isset($_REQUEST['filterPending'])) {
- foreach($list as $k => $v) {
- if ($v['pending'] == 0) {
- unset($list[$k]);
- }
- }
+ // Refine search only to members with pending Info data
+ $where .= " AND (
+ SELECT COUNT(id)
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I
+ WHERE I.status = ".$this->config['status_numb']['Pending']."
+ AND I.member = T.id
+ )";
$filterPending = true;
$haveFilter = true;
}
+ // Get a current list of members
+ $list = $this->getSimpleMembersList($where);
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
}
// If we have any entries
if (count($list) > 0) {
$haveMembers = true;
+
+ $memberCount = count($list);
}
}
$templateData = array(
'haveMembers' => $haveMembers,
'members' => $list,
+ 'memberCount' => $memberCount,
'categories' => $categories,
'haveFilter' => $haveFilter,
'filterArchived' => $filterArchived,
- 'filterPending' => $filterPending,
- 'filterCat' => $filterCat,
-// 'canEdit' => $canEdit
+ 'filterPending' => $filterPending
);
// Return status, suggested view, and data to controller
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Amenitiess List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Amenities data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_amenities extends GlmDataAmenities
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Settings Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $success = true;
+ $haveAmenities = false;
+ $amenities = false;
+ $error = false;
+
+
+ $newAmenity = $this->newEntry();
+
+ // Check if a category ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
+
+
+/*
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($newAmenity, 'DataBlock', 'New Amenity Data');
+ }
+
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+
+ $amenities = $this->insertEntry();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
+ }
+ }
+
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['amenityID'])) {
+
+ $id = $_REQUEST['amenityID']-0;
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
+ }
+
+ }
+
+ // Check if a amenity ID is supplied
+ if (isset($_REQUEST['amenity_id'])) {
+ // Make sure it's a number
+ $amenityID = $_REQUEST['amenity_id']-0;
+ }
+
+ // Check for action option
+ $option = false;
+ if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+ $option = $_REQUEST['option'];
+ }
+*/
+
+ // Get a current list of amenities
+ $amenities = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveAmenities = false;
+ if ($amenities !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($amenities) > 0) {
+ $haveAmenities = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveAmenities' => $haveAmenities,
+ 'amenities' => $amenities,
+ 'newAmenity' => $newAmenity
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/amenities.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Categories List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_categories extends GlmDataCategories
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $success = true;
+ $haveCategories = false;
+ $categories = false;
+ $error = false;
+
+ // Check if a category ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+
+ // Also delete from member info
+ $this->wpdb->delete(
+ GLM_MEMBERS_PLUGIN_DB_PREFIX . 'category_member_info',
+ array(
+ 'category' => $id
+ )
+ );
+ }
+ break;
+
+ }
+
+ }
+
+ // Get a current list of categories
+ $categories = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($categories, 'DataBlock', 'Category Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveCategories = false;
+ if ($categories !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($categories) > 0) {
+ $haveCategories = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ // Sort results by higherarchy (Parent/Child and Alpha)
+ $categories = $this->sortParentChild($categories);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($categories, 'DataBlock', 'Categories Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveCategories' => $haveCategories,
+ 'categories' => $categories
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/categories.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Cities List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_cities extends GlmDataCities
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $success = true;
+ $haveCities = false;
+ $cities = false;
+ $error = false;
+
+ // Check if a city ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
+
+ // Get a current list of members
+ $cities = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($cities, 'DataBlock', 'City Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveCities = false;
+ if ($cities !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($cities) > 0) {
+ $haveCities = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($cities, 'DataBlock', 'Cities Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveCities' => $haveCities,
+ 'cities' => $cities
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/cities.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Type List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_index extends GlmDataMemberTypes
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $success = true;
+ $haveMemberTypes = false;
+ $memberTypes = false;
+ $couldNotDelete = false;
+ $error = false;
+
+ // Check for member type id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ // First check if any members are using this type
+ $inUse = $this->wpdb->get_var("
+ SELECT COUNT(id)
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
+ WHERE member_type = $id;
+ ");
+
+ // If there's no members with this type
+ if (($inUse-0) == 0) {
+ $this->deleteEntry($id, true);
+ } else {
+ $couldNotDelete = true;
+ }
+ }
+ break;
+
+ }
+
+ }
+
+ // Get a current list of member types
+ $memberTypes = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveMemberTypes = false;
+ if ($memberTypes !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($memberTypes) > 0) {
+ $haveMemberTypes = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveMemberTypes' => $haveMemberTypes,
+ 'memberTypes' => $memberTypes,
+ 'couldNotDelete' => $couldNotDelete
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/index.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Regions List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_regions extends GlmDataRegions
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $success = true;
+ $haveRegions = false;
+ $regions = false;
+ $error = false;
+
+ // Check for region id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
+
+ // Get a current list of members
+ $regions = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($regions, 'DataBlock', 'Region Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveRegions = false;
+ if ($regions !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($regions) > 0) {
+ $haveRegions = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($regions, 'DataBlock', 'Regions Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveRegions' => $haveRegions,
+ 'regions' => $regions
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/regions.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Main Mmebers Add-on - Admin Menus
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Added menus or sub-menus examples
+ *
+ * add_submenu_page(
+ * 'glm-members-admin-menu-members', // Parent slug
+ * 'Sample', // Page title
+ * 'Sample', // Menu Title
+ * 'glm_members_edit', // Capability required
+ * 'glm-members-admin-menu-sample', // Menu slug
+ * function() {$this->controller('sample');}
+ * );
+ *
+ * If creating a main menu item with add_menu_page(), please document
+ * that structure here.
+ *
+ */
+
+
+// If user can manage all members, then show "Members" menu item
+if (apply_filters('glm_members_menu_members', true)) {
+
+ $mainMenuSlug = 'glm-members-admin-menu-members';
+
+ add_menu_page(
+ 'Members',
+ 'Members',
+ 'glm_members_main_menu',
+ 'glm-members-admin-menu-members',
+ function() {$this->controller('members');},
+ false,
+ '91.123'
+ );
+
+ // Add a sub-submenu for the "Member" "List" page
+ add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Members List',
+ ' List',
+ 'glm_members_main_menu',
+ 'glm-members-admin-menu-members-list',
+ function() {$this->controller('members', 'list');}
+ );
+
+ // Add a submenu for the "Member" section
+ if (apply_filters('glm_members_menu_member', true)) {
+ add_submenu_page(
+ $mainMenuSlug,
+ 'Member Dashboard',
+ 'Member',
+ 'glm_members_member',
+ 'glm-members-admin-menu-member',
+ function() {$this->controller('member');}
+ );
+ }
+
+// Otherwise just display "Member" menu item
+} else {
+
+ $mainMenuSlug = 'glm-members-admin-menu-member';
+
+ add_menu_page(
+ 'Member',
+ 'Member',
+ 'glm_members_main_menu',
+ 'glm-members-admin-menu-member',
+ function() {$this->controller('member');},
+ false,
+ '91.123'
+ );
+
+}
+
+// Add a submenu for the "Settings" section
+if (apply_filters('glm_members_menu_settings', true)) {
+ add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Settings',
+ 'Settings',
+ 'glm_members_settings',
+ 'glm-members-admin-menu-settings',
+ function() {$this->controller('settings');}
+ );
+}
+
+// Add a submenu for the "Management" section
+if (apply_filters('glm_members_menu_meanagement', true)) {
+ add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Member DB Management',
+ 'Management',
+ 'glm_members_management',
+ 'glm-members-admin-menu-management',
+ function() {$this->controller('management');}
+ );
+}
+
+// Add a submenu for the "Shortcode Reference" section
+if (apply_filters('glm_members_menu_shortcodes', true)) {
+ add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Shortcode Reference',
+ 'Shortcodes',
+ 'glm_members_shortcodes',
+ 'glm-members-admin-menu-shortcodes',
+ function() {$this->controller('shortcodes');}
+ );
+}
'locations' => 'glm-member-db'
)
,
- 'configure' => array(
+ 'settings' => array(
'index' => 'glm-member-db', // Member Types
'categories' => 'glm-member-db',
'cities' => 'glm-member-db',
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add Amenities Button and Dialog Box -->
- <div id="newAmenityButton" class="button button-primary glm-right">Add an Amenity</div>
- <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New Amenity">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="amenities">
- <input type="hidden" name="option" value="addNew">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Amenity Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th class="glm-required">Used With:</th>
- <td>
- <select name="ref_type">
- <option value=""></option>
- {foreach from=$newAmenity.fieldData.ref_type.list item=v}
- <option value="{$v.value}">{$v.name}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <th>Uses a value:</th>
- <td><input type="checkbox" name="uses_value"></td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newAmenityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Amenity" class="button button-primary">
-
- </form>
- </div>
-
- <!-- Delete Amenities Button -->
- <div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete Amenity">
- <center>
- <p>Are you sure you want to delete this amenity?</p>
- <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this amenity</div></p>
- <p><div id="deleteAmenityCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Amenities Dialog Box -->
- <div id="editAmenityDialog" class="glm-dialog-box" title="Edit this Amenity">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="amenities">
- <input type="hidden" name="option" value="update">
- <input id="editAmenityID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Amenity Name:</th>
- <td>
- <input id="editAmenityName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th class="glm-required">Used With:</th>
- <td>
- <select id="editAmenityRef" name="ref_type">
- <option value=""></option>
- {foreach from=$newAmenity.fieldData.ref_type.list item=v}
- <option value="{$v.value}">{$v.name}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <th>Uses a value:</th>
- <td><input id="editAmenityUsesValue" type="checkbox" name="uses_value"></td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editAmenityDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input id="editAmenityShortDescr" type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editAmenityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Amenity">
-
- </form>
- </div>
-
-
- <h2>Amenities</h2>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table"">
- <thead>
- <tr>
- <th>Amenity</th>
- <th>Used With</th>
- <th>Uses Value</th>
- <th>Description</th>
- <th>Short Description</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveAmenities}
- {assign var="i" value="0"}
- {foreach $amenities as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editAmenity" data-amenityID="{$t.id}" data-refTypeID="{$t.ref_type.value}" data-amenityUsesValue="{$t.uses_value.value}">{$t.name}</a>
- </td>
- <td id="editAmenityRefType_{$t.id}">
- {$t.ref_type.name}
- </td>
- <td id="editAmenityUsesValue_{$t.id}" >
- {$t.uses_value.name}
- </td>
- <td id="editAmenityDescr_{$t.id}">
- {$t.descr}
- </td>
- <td id="editAmenityShortDescr_{$t.id}">
- {$t.short_descr}
- </td>
- <td>
- <div class="deleteAmenityButton button button-secondary glm-button-small glm-right" data-amenityID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no amenities listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newAmenityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editAmenityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteAmenityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newAmenityButton').click( function() {
- $("#newAmenityDialog").dialog("open");
- });
- $('.editAmenity').click( function() {
- var amenityID = $(this).attr('data-amenityID');
- var amenityName = $(this).text();
- var amenityRefTypeID = $(this).attr('data-refTypeID');
- var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue'));
- var amenityDescr = $('#editAmenityDescr_' + amenityID).html();
- var amenityShortDescr = $('#editAmenityShortDescr_' + amenityID).html();
- $('#editAmenityID').val(amenityID);
- $('#editAmenityName').val(amenityName.trim());
- $('#editAmenityRef').val(amenityRefTypeID);
- $('#editAmenityUsesValue').prop('checked', amenityUsesValue);
- $('#editAmenityDescr').val(amenityDescr.trim());
- $('#editAmenityShortDescr').val(amenityShortDescr.trim());
- $("#editAmenityDialog").dialog("open");
- });
- $('#editAmenityCancel').click( function() {
- $("#editAmenityDialog").dialog("close");
- });
- $('#newAmenityCancel').click( function() {
- $("#newAmenityDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteAmenityButton').click( function() {
- id = $(this).attr('data-amenityID');
- $("#deleteAmenityDialog").dialog("open");
- });
- $('#deleteAmenityConfirm').click( function() {
- $("#deleteAmenityDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&id=" + id;
- });
- $('#deleteAmenityCancel').click( function() {
- $("#deleteAmenityDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add Categories Button and Dialog Box -->
- <div id="newCategoryButton" class="button button-primary glm-right">Add a Category</div>
- <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="categories">
- <input type="hidden" name="option" value="addNew">
-
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Category Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Parent Category:</th>
- <td>
- <select name="parent">
- <option value="0">(none)</option>
- {if $haveCategories}
- {foreach $categories as $t}
- {if !$t.parent.value} <!-- don't show child categories -->
- <option value="{$t.id}">{$t.name}</option>
- {/if}
- {/foreach}
- {/if}
- </select>
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Category" class="button button-primary">
- </form>
- </div>
-
- <!-- Delete Category Button and Dialog Box -->
- <div id="deleteCategoryDialog" class="glm-dialog-box" title="Delete Category">
- <center>
- <p>Are you sure you want to delete this category?</p>
- <p><div id="deleteCategoryConfirm" class="button button-primary">Yes, delete this category</div></p>
- <p><div id="deleteCategoryCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Category Dialog Box -->
- <div id="editCategoryDialog" class="glm-dialog-box" title="Edit this Category">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="categories">
- <input type="hidden" name="option" value="update">
- <input id="editCategoryID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Category Name:</th>
- <td>
- <input id="editCategoryName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Parent Category:</th>
- <td>
- <select id="editCategoryParent" name="parent">
- <option value="0">(none)</option>
- {if $haveCategories}
- {foreach $categories as $t}
- {if !$t.parent.value} <!-- don't show child categories -->
- <option value="{$t.id}">{$t.name}</option>
- {/if}
- {/foreach}
- {/if}
- </select>
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editCategoryDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input id="editCategoryShortDescr" type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editCategoryCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Category">
- </form>
- </div>
-
- <h2>Categories</h2>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table"">
- <thead>
- <tr>
- <th>ID</th>
- <th>Category</th>
- <th>Description</th>
- <th>Short Description</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveCategories}
- {assign var="i" value="0"}
- {foreach $categories as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>{$t.id}</td>
- <td>
- <div{if $t.parent.value} class="glm-indent"{/if}>
- <a class="editCategory" data-categoryID="{$t.id}" data-categoryParent="{$t.parent.value}">{$t.name}</a>
- </div>
- </td>
- <td id="editCategoryDescr_{$t.id}">
- {$t.descr}
- </td>
- <td id="editCategoryShortDescr_{$t.id}">
- {$t.short_descr}
- </td>
- <td>
- <div class="deleteCategoryButton button button-secondary glm-button-small glm-right" data-categoryID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no categories listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newCategoryDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- width: 'auto',
- dialogClass: "glm-dialog-no-close"
- });
- $("#editCategoryDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- width: 'auto',
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteCategoryDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- width: 'auto',
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newCategoryButton').click( function() {
- $("#newCategoryDialog").dialog("open");
- });
- $('.editCategory').click( function() {
- var catID = $(this).attr('data-categoryID');
- var catName = $(this).text();
- var catParent = $(this).attr('data-categoryParent');
- var catDescr = $('#editCategoryDescr_' + catID).html();
- var catShortDescr = $('#editCategoryShortDescr_' + catID).html();
- $('#editCategoryID').val(catID);
- $('#editCategoryName').val(catName.trim());
- $('#editCategoryParent').val(catParent);
- $('#editCategoryDescr').val(catDescr.trim());
- $('#editCategoryShortDescr').val(catShortDescr.trim());
- $("#editCategoryDialog").dialog("open");
- });
- $('#editCategoryCancel').click( function() {
- $("#editCategoryDialog").dialog("close");
- });
- $('#newCategoryCancel').click( function() {
- $("#newCategoryDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteCategoryButton').click( function() {
- id = $(this).attr('data-categoryID');
- $("#deleteCategoryDialog").dialog("open");
- });
- $('#deleteCategoryConfirm').click( function() {
- $("#deleteCategoryDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&id=" + id;
- });
- $('#deleteCategoryCancel').click( function() {
- $("#deleteCategoryDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add City Button and Dialog Box -->
- <div id="newCityButton" class="button button-primary glm-right">Add a City</div>
- <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="cities">
- <input type="hidden" name="option" value="addNew">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">City Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new City">
- </form>
- </div>
-
- <!-- Delete City Dialog Box -->
- <div id="deleteCityDialog" class="glm-dialog-box" title="Delete City">
- <center>
- <p>Are you sure you want to delete this city?</p>
- <p><div id="deleteCityConfirm" class="button button-primary">Yes, delete this city</div></p>
- <p><div id="deleteCityCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit City Dialog Box -->
- <div id="editCityDialog" class="glm-dialog-box" title="Edit this City">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="cities">
- <input type="hidden" name="option" value="update">
- <input id="editCityID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">City Name:</th>
- <td>
- <input id="editCityName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this City" class="button button-primary">
- </form>
- </div>
-
- <h2>Cities</h2>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table"">
- <thead>
- <tr>
- <th>City</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveCities}
- {assign var="i" value="0"}
- {foreach $cities as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editCity" data-cityID="{$t.id}">{$t.name}</a>
- </td>
- <td>
- <div class="deleteCityButton button button-secondary glm-button-small glm-right" data-cityID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no cities listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newCityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editCityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteCityDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newCityButton').click( function() {
- $("#newCityDialog").dialog("open");
- });
- $('#newCityCancel').click( function() {
- $("#newCityDialog").dialog("close");
- });
- $('.editCity').click( function() {
- var cityID = $(this).attr('data-cityID');
- var cityName = $(this).text();
- $('#editCityID').val(cityID);
- $('#editCityName').val(cityName.trim());
- $("#editCityDialog").dialog("open");
- });
- $('#editCityCancel').click( function() {
- $("#editCityDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteCityButton').click( function() {
- id = $(this).attr('data-cityID');
- $("#deleteCityDialog").dialog("open");
- });
- $('#deleteCityConfirm').click( function() {
- $("#deleteCityDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&id=" + id;
- });
- $('#deleteCityCancel').click( function() {
- $("#deleteCityDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
+++ /dev/null
-<div class="wrap">
-
- <h2>{$glmPluginName} Configuration</h2>
-
- <h2 class="nav-tab-wrapper">
- <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Member Types</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=categories" class="nav-tab{if $thisAction==categories} nav-tab-active{/if}">Member Categories</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=amenities" class="nav-tab{if $thisAction==amenities} nav-tab-active{/if}">Amenities</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities} nav-tab-active{/if}">Cities</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=regions" class="nav-tab{if $thisAction==regions} nav-tab-active{/if}">Regions</a>
-{foreach $addOnTabs as $a}
- <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
-{/foreach}
- </h2>
- <div id="glm-admin-content-container">
-
\ No newline at end of file
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add Member Type Button and Dialog Box -->
- <div id="newMemberTypeButton" class="button button-primary glm-right">Add a Member Type</div>
- <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="index">
- <input type="hidden" name="option" value="addNew">
-
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Member Type Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newMemberTypeCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new member type" class="button button-primary">
- </form>
- </div>
-
- <!-- Delete Member Dialog Box -->
- <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
- <center>
- <p>Are you sure you want to delete this member type?</p>
- <p><div id="deleteMemberTypeConfirm" class="button button-primary">Yes, delete this member type</div></p>
- <p><div id="deleteMemberTypeCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Member Type Dialog Box -->
- <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="index">
- <input type="hidden" name="option" value="update">
- <input id="editMemberTypeID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Member Type Name:</th>
- <td>
- <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editMemberTypeCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this member type">
- </form>
- </div>
-
- <h2>Member Types</h2>
-
-{if $couldNotDelete}
- <h3 class="glm-error">
- Member Type could not be deleted. Type is in use by at least one member.
- <a href="{$thisURL}?page=glm-members-admin-menu-members&glm_action=list">Click here to see the members list.</a>
- </h3>
-
-{/if}
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th>Member Type</th>
- <th>Description</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveMemberTypes}
- {assign var="i" value="0"}
- {foreach $memberTypes as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editMemberType" data-memberTypeID="{$t.id}">{$t.name}</a>
- </td>
- <td id="editMemberTypeDescr_{$t.id}">
- {$t.descr}
- </td>
- <td>
- <div class="deleteMemberTypeButton button button-secondary glm-button-small glm-right" data-memberTypeID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newMemberTypeButton').click( function() {
- $("#newMemberTypeDialog").dialog("open");
- });
- $('.editMemberType').click( function() {
- var typeID = $(this).attr('data-memberTypeID');
- var typeName = $(this).text();
- var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
- $('#editMemberTypeID').val(typeID);
- $('#editMemberTypeName').val(typeName.trim());
- $('#editMemberTypeDescr').val(typeDescr.trim());
- $("#editMemberTypeDialog").dialog("open");
- });
- $('#editMemberTypeCancel').click( function() {
- $("#editMemberTypeDialog").dialog("close");
- });
- $('#newMemberTypeCancel').click( function() {
- $("#newMemberTypeDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteMemberTypeButton').click( function() {
- id = $(this).attr('data-memberTypeID');
- $("#deleteMemberTypeDialog").dialog("open");
- });
- $('#deleteMemberTypeConfirm').click( function() {
- $("#deleteMemberTypeDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=index&option=delete&id=" + id;
- });
- $('#deleteMemberTypeCancel').click( function() {
- $("#deleteMemberTypeDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add Regions Button and Dialog Box -->
- <div id="newRegionButton" class="button button-primary glm-right">Add a Region</div>
- <div id="newRegionDialog" class="glm-dialog-box" title="Enter a New Region">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="regions">
- <input type="hidden" name="option" value="addNew">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Region Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newRegionCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Region" class="button button-primary">
- </form>
- </div>
-
- <!-- Add Regions Button -->
- <div id="deleteRegionDialog" class="glm-dialog-box" title="Delete Region">
- <center>
- <p>Are you sure you want to delete this region?</p>
- <p><div id="deleteRegionConfirm" class="button button-primary">Yes, delete this region</div></p>
- <p><div id="deleteRegionCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Regions Dialog Box -->
- <div id="editRegionDialog" class="glm-dialog-box" title="Edit this Region">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="regions">
- <input type="hidden" name="option" value="update">
- <input id="editRegionID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Region Name:</th>
- <td>
- <input id="editRegionName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editRegionDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input id="editRegionShortDescr" type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editRegionCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Region">
- </form>
- </div>
-
- <h2>Regions</h2>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table"">
- <thead>
- <tr>
- <th>Region</th>
- <th>Description</th>
- <th>Short Description</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveRegions}
- {assign var="i" value="0"}
- {foreach $regions as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editRegion" data-regionID="{$t.id}">{$t.name}</a>
- </td>
- <td id="editRegionDescr_{$t.id}">
- {$t.descr}
- </td>
- <td id="editRegionShortDescr_{$t.id}">
- {$t.short_descr}
- </td>
- <td>
- <div class="deleteRegionButton button button-secondary glm-button-small glm-right" data-regionID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no regions listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newRegionDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editRegionDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteRegionDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newRegionButton').click( function() {
- $("#newRegionDialog").dialog("open");
- });
- $('.editRegion').click( function() {
- var regionID = $(this).attr('data-regionID');
- var regionName = $(this).text();
- var regionDescr = $('#editRegionDescr_' + regionID).html();
- var regionShortDescr = $('#editRegionShortDescr_' + regionID).html();
- $('#editRegionID').val(regionID);
- $('#editRegionName').val(regionName.trim());
- $('#editRegionDescr').val(regionDescr.trim());
- $('#editRegionShortDescr').val(regionShortDescr.trim());
- $("#editRegionDialog").dialog("open");
- });
- $('#editRegionCancel').click( function() {
- $("#editRegionDialog").dialog("close");
- });
- $('#newRegionCancel').click( function() {
- $("#newRegionDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteRegionButton').click( function() {
- id = $(this).attr('data-regionID');
- $("#deleteRegionDialog").dialog("open");
- });
- $('#deleteRegionConfirm').click( function() {
- $("#deleteRegionDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete&id=" + id;
- });
- $('#deleteRegionCancel').click( function() {
- $("#deleteRegionDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
<td rowspan="2">
<table>
<tr><th>Delete:</th><td><input type="checkbox" name="galleryImage_delete[{ id }]" disabled></td></tr>
- <tr><th>Selected Image:</th><td><input type="radio" name="galleryImage_selected" value="{ id }"></td></tr>
- <tr><th>Featured Image:</th><td><input type="checkbox" name="galleryImage_featured[{ id }]"></td></tr>
+ <tr><th>featured Image:</th><td><input type="radio" name="galleryImage_featured" value="{ id }"></td></tr>
<tr><th colspan="2" class="glm-notice" style="font-size: 1.2em;">New Upload</th></tr>
</table>
</td>
<div class="glm-imageDropText glm-imageItemHidden">Drag and drop new images here</div>
<div class="glm-noImageDropText glm-imageItemHidden">HTML5 file drag-and-drop not supported by your browser.<br>Use "Browse" button above to upload an image.</div>
</div>
- <div class="glm-right"><b>No Selected Image:</b> <input type="radio" name="galleryImage_selected" value="0"><br> </div>
+ <div class="glm-right"><b>No Featured Image:</b> <input type="radio" name="galleryImage_featured" value="0"><br> </div>
<ul class="glm-galleryImages">
<!-- Note that id in li is needed for sorting -->
{if $haveImageGallery}
<td rowspan="2">
<table>
<tr><th>Delete:</th><td><input type="checkbox" name="galleryImage_delete[{$i.id}]"></td></tr>
- <tr><th>Selected Image:</th><td><input type="radio" name="galleryImage_selected" value="{$i.id}" {if $i.selected.value}checked="checked"{/if}></td></tr>
- <tr><th>Featured Image:</th><td><input type="checkbox" name="galleryImage_featured[{$i.id}]" {if $i.featured.value}checked="checked"{/if}></td></tr>
+ <tr><th>Featured Image:</th><td><input type="radio" name="galleryImage_featured" value="{$i.id}" {if $i.featured.value}checked="checked"{/if}></td></tr>
</table>
<input type="hidden" name="galleryImage_position[{$i.id}]" value="{$i.position}">
</td>
{include file='admin/members/header.html'}
- <form id="searchForm" class="glm-right" onSubmit="return false;">
- <span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b> </span>
- <input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if}>Show Archived
- <input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if}>Pending Only
- <select id="filterCategories" class="listFilter">
- <option id="categoryNone" value=""></option>
+ <form action="{$thisURL}?page={$thisPage}" method="post" id="searchForm" class="glm-right">
+ <table>
+ <tr>
+ <th>Members Found:</th><td><span style="margin-right: 2em;">{$memberCount}</span></td>
+ <th>Categories:</th>
+ <td style="min-width: 25em; padding-right: 1em;">
+ <select id="filterCategories" name="filterCategories[]" multiple="multiple">
{foreach from=$categories item=v}
- <option value="{$v.id}" data-parent="{$v.parent}"{if $v.id == $filterCat} selected{/if}>
- {if $v.parent_id} {/if}{$v.name}
- </option>
+ <option value="{$v.id}" data-parent="{$v.parent}"{if $v.selected} selected{/if}>
+ {if $v.parent_id} {/if}{$v.name}
+ </option>
{/foreach}
- </select>
- Categories
-
- <input id="glmMembersSearch" type="text" id="autoTest"> Search
+ </select>
+ </td>
+ <td><input type="submit" value="Submit" style="margin-right: 2em;"></td>
+ <th>Show Archived:</th><td><input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if} style="margin-right: 1em;"></td>
+ <th>Pending Only:</th><td><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;"></td>
+ <th>Text Search:</th><td><input id="glmMembersSearch" type="text" id="autoTest"></td>
+ </tr>
+ </table>
</form>
- <br clear="all">
- <h2>List of Members</h2>
+ <h2>List of Members</h2>
<table class="wp-list-table striped glm-admin-table">
<thead>
filter += '&filterPending=true';
}
- // Check for category filter
- cat = $("#filterCategories").val();
- if (cat != '') {
- filter += '&filterCategory=' + cat;
- }
-
window.location.href = "{$thisURL}?page={$thisPage}&glm_action=list" + filter;
return false;
* Also note that autocomplete does not properly render HTML codes, so we
* "unescape" them for HTML in Smarty.
*/
- var availableTags = [
+
+ var availableTags = [
{foreach $members as $m}
{ label: "{$m.name|unescape:'html'}", value: "{$m.name|unescape:'html'}", id: '{$m.id}' },
{/foreach}
}
});
+ // Expand multi-select on hover
+ $('#filterCategories').multiselect({
+ columns: 1,
+ placeholder: 'Click to select categories',
+ search: 1,
+ selectAll: true,
+ maxWidth: 200
+ });
});
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <!-- Add Amenities Button and Dialog Box -->
+ <div id="newAmenityButton" class="button button-primary glm-right">Add an Amenity</div>
+ <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New Amenity">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="amenities">
+ <input type="hidden" name="option" value="addNew">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Amenity Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Used With:</th>
+ <td>
+ <select name="ref_type">
+ <option value=""></option>
+ {foreach from=$newAmenity.fieldData.ref_type.list item=v}
+ <option value="{$v.value}">{$v.name}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Uses a value:</th>
+ <td><input type="checkbox" name="uses_value"></td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newAmenityCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Amenity" class="button button-primary">
+
+ </form>
+ </div>
+
+ <!-- Delete Amenities Button -->
+ <div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete Amenity">
+ <center>
+ <p>Are you sure you want to delete this amenity?</p>
+ <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this amenity</div></p>
+ <p><div id="deleteAmenityCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Amenities Dialog Box -->
+ <div id="editAmenityDialog" class="glm-dialog-box" title="Edit this Amenity">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="amenities">
+ <input type="hidden" name="option" value="update">
+ <input id="editAmenityID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Amenity Name:</th>
+ <td>
+ <input id="editAmenityName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Used With:</th>
+ <td>
+ <select id="editAmenityRef" name="ref_type">
+ <option value=""></option>
+ {foreach from=$newAmenity.fieldData.ref_type.list item=v}
+ <option value="{$v.value}">{$v.name}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Uses a value:</th>
+ <td><input id="editAmenityUsesValue" type="checkbox" name="uses_value"></td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editAmenityDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editAmenityShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editAmenityCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Amenity">
+
+ </form>
+ </div>
+
+
+ <h2>Amenities</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Amenity</th>
+ <th>Used With</th>
+ <th>Uses Value</th>
+ <th>Description</th>
+ <th>Short Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveAmenities}
+ {assign var="i" value="0"}
+ {foreach $amenities as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a class="editAmenity" data-amenityID="{$t.id}" data-refTypeID="{$t.ref_type.value}" data-amenityUsesValue="{$t.uses_value.value}">{$t.name}</a>
+ </td>
+ <td id="editAmenityRefType_{$t.id}">
+ {$t.ref_type.name}
+ </td>
+ <td id="editAmenityUsesValue_{$t.id}" >
+ {$t.uses_value.name}
+ </td>
+ <td id="editAmenityDescr_{$t.id}">
+ {$t.descr}
+ </td>
+ <td id="editAmenityShortDescr_{$t.id}">
+ {$t.short_descr}
+ </td>
+ <td>
+ <div class="deleteAmenityButton button button-secondary glm-button-small glm-right" data-amenityID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no amenities listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newAmenityButton').click( function() {
+ $("#newAmenityDialog").dialog("open");
+ });
+ $('.editAmenity').click( function() {
+ var amenityID = $(this).attr('data-amenityID');
+ var amenityName = $(this).text();
+ var amenityRefTypeID = $(this).attr('data-refTypeID');
+ var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue'));
+ var amenityDescr = $('#editAmenityDescr_' + amenityID).html();
+ var amenityShortDescr = $('#editAmenityShortDescr_' + amenityID).html();
+ $('#editAmenityID').val(amenityID);
+ $('#editAmenityName').val(amenityName.trim());
+ $('#editAmenityRef').val(amenityRefTypeID);
+ $('#editAmenityUsesValue').prop('checked', amenityUsesValue);
+ $('#editAmenityDescr').val(amenityDescr.trim());
+ $('#editAmenityShortDescr').val(amenityShortDescr.trim());
+ $("#editAmenityDialog").dialog("open");
+ });
+ $('#editAmenityCancel').click( function() {
+ $("#editAmenityDialog").dialog("close");
+ });
+ $('#newAmenityCancel').click( function() {
+ $("#newAmenityDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteAmenityButton').click( function() {
+ id = $(this).attr('data-amenityID');
+ $("#deleteAmenityDialog").dialog("open");
+ });
+ $('#deleteAmenityConfirm').click( function() {
+ $("#deleteAmenityDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&id=" + id;
+ });
+ $('#deleteAmenityCancel').click( function() {
+ $("#deleteAmenityDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <!-- Add Categories Button and Dialog Box -->
+ <div id="newCategoryButton" class="button button-primary glm-right">Add a Category</div>
+ <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="categories">
+ <input type="hidden" name="option" value="addNew">
+
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Category Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Parent Category:</th>
+ <td>
+ <select name="parent">
+ <option value="0">(none)</option>
+ {if $haveCategories}
+ {foreach $categories as $t}
+ {if !$t.parent.value} <!-- don't show child categories -->
+ <option value="{$t.id}">{$t.name}</option>
+ {/if}
+ {/foreach}
+ {/if}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Category" class="button button-primary">
+ </form>
+ </div>
+
+ <!-- Delete Category Button and Dialog Box -->
+ <div id="deleteCategoryDialog" class="glm-dialog-box" title="Delete Category">
+ <center>
+ <p>Are you sure you want to delete this category?</p>
+ <p><div id="deleteCategoryConfirm" class="button button-primary">Yes, delete this category</div></p>
+ <p><div id="deleteCategoryCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Category Dialog Box -->
+ <div id="editCategoryDialog" class="glm-dialog-box" title="Edit this Category">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="categories">
+ <input type="hidden" name="option" value="update">
+ <input id="editCategoryID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Category Name:</th>
+ <td>
+ <input id="editCategoryName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Parent Category:</th>
+ <td>
+ <select id="editCategoryParent" name="parent">
+ <option value="0">(none)</option>
+ {if $haveCategories}
+ {foreach $categories as $t}
+ {if !$t.parent.value} <!-- don't show child categories -->
+ <option value="{$t.id}">{$t.name}</option>
+ {/if}
+ {/foreach}
+ {/if}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editCategoryDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editCategoryShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editCategoryCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Category">
+ </form>
+ </div>
+
+ <h2>Categories</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Category</th>
+ <th>Description</th>
+ <th>Short Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveCategories}
+ {assign var="i" value="0"}
+ {foreach $categories as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>{$t.id}</td>
+ <td>
+ <div{if $t.parent.value} class="glm-indent"{/if}>
+ <a class="editCategory" data-categoryID="{$t.id}" data-categoryParent="{$t.parent.value}">{$t.name}</a>
+ </div>
+ </td>
+ <td id="editCategoryDescr_{$t.id}">
+ {$t.descr}
+ </td>
+ <td id="editCategoryShortDescr_{$t.id}">
+ {$t.short_descr}
+ </td>
+ <td>
+ <div class="deleteCategoryButton button button-secondary glm-button-small glm-right" data-categoryID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no categories listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ width: 'auto',
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ width: 'auto',
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ width: 'auto',
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newCategoryButton').click( function() {
+ $("#newCategoryDialog").dialog("open");
+ });
+ $('.editCategory').click( function() {
+ var catID = $(this).attr('data-categoryID');
+ var catName = $(this).text();
+ var catParent = $(this).attr('data-categoryParent');
+ var catDescr = $('#editCategoryDescr_' + catID).html();
+ var catShortDescr = $('#editCategoryShortDescr_' + catID).html();
+ $('#editCategoryID').val(catID);
+ $('#editCategoryName').val(catName.trim());
+ $('#editCategoryParent').val(catParent);
+ $('#editCategoryDescr').val(catDescr.trim());
+ $('#editCategoryShortDescr').val(catShortDescr.trim());
+ $("#editCategoryDialog").dialog("open");
+ });
+ $('#editCategoryCancel').click( function() {
+ $("#editCategoryDialog").dialog("close");
+ });
+ $('#newCategoryCancel').click( function() {
+ $("#newCategoryDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteCategoryButton').click( function() {
+ id = $(this).attr('data-categoryID');
+ $("#deleteCategoryDialog").dialog("open");
+ });
+ $('#deleteCategoryConfirm').click( function() {
+ $("#deleteCategoryDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&id=" + id;
+ });
+ $('#deleteCategoryCancel').click( function() {
+ $("#deleteCategoryDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <!-- Add City Button and Dialog Box -->
+ <div id="newCityButton" class="button button-primary glm-right">Add a City</div>
+ <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="cities">
+ <input type="hidden" name="option" value="addNew">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">City Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new City">
+ </form>
+ </div>
+
+ <!-- Delete City Dialog Box -->
+ <div id="deleteCityDialog" class="glm-dialog-box" title="Delete City">
+ <center>
+ <p>Are you sure you want to delete this city?</p>
+ <p><div id="deleteCityConfirm" class="button button-primary">Yes, delete this city</div></p>
+ <p><div id="deleteCityCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit City Dialog Box -->
+ <div id="editCityDialog" class="glm-dialog-box" title="Edit this City">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="cities">
+ <input type="hidden" name="option" value="update">
+ <input id="editCityID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">City Name:</th>
+ <td>
+ <input id="editCityName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this City" class="button button-primary">
+ </form>
+ </div>
+
+ <h2>Cities</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>City</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveCities}
+ {assign var="i" value="0"}
+ {foreach $cities as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a class="editCity" data-cityID="{$t.id}">{$t.name}</a>
+ </td>
+ <td>
+ <div class="deleteCityButton button button-secondary glm-button-small glm-right" data-cityID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no cities listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newCityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editCityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteCityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newCityButton').click( function() {
+ $("#newCityDialog").dialog("open");
+ });
+ $('#newCityCancel').click( function() {
+ $("#newCityDialog").dialog("close");
+ });
+ $('.editCity').click( function() {
+ var cityID = $(this).attr('data-cityID');
+ var cityName = $(this).text();
+ $('#editCityID').val(cityID);
+ $('#editCityName').val(cityName.trim());
+ $("#editCityDialog").dialog("open");
+ });
+ $('#editCityCancel').click( function() {
+ $("#editCityDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteCityButton').click( function() {
+ id = $(this).attr('data-cityID');
+ $("#deleteCityDialog").dialog("open");
+ });
+ $('#deleteCityConfirm').click( function() {
+ $("#deleteCityDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&id=" + id;
+ });
+ $('#deleteCityCancel').click( function() {
+ $("#deleteCityDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}
--- /dev/null
+<div class="wrap">
+
+ <h2>{$glmPluginName} Settings</h2>
+
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Member Types</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=categories" class="nav-tab{if $thisAction==categories} nav-tab-active{/if}">Member Categories</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=amenities" class="nav-tab{if $thisAction==amenities} nav-tab-active{/if}">Amenities</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities} nav-tab-active{/if}">Cities</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=regions" class="nav-tab{if $thisAction==regions} nav-tab-active{/if}">Regions</a>
+{foreach $addOnTabs as $a}
+ <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
+{/foreach}
+ </h2>
+ <div id="glm-admin-content-container">
+
\ No newline at end of file
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <!-- Add Member Type Button and Dialog Box -->
+ <div id="newMemberTypeButton" class="button button-primary glm-right">Add a Member Type</div>
+ <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ <input type="hidden" name="option" value="addNew">
+
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newMemberTypeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new member type" class="button button-primary">
+ </form>
+ </div>
+
+ <!-- Delete Member Dialog Box -->
+ <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
+ <center>
+ <p>Are you sure you want to delete this member type?</p>
+ <p><div id="deleteMemberTypeConfirm" class="button button-primary">Yes, delete this member type</div></p>
+ <p><div id="deleteMemberTypeCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Member Type Dialog Box -->
+ <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ <input type="hidden" name="option" value="update">
+ <input id="editMemberTypeID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editMemberTypeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this member type">
+ </form>
+ </div>
+
+ <h2>Member Types</h2>
+
+{if $couldNotDelete}
+ <h3 class="glm-error">
+ Member Type could not be deleted. Type is in use by at least one member.
+ <a href="{$thisURL}?page=glm-members-admin-menu-members&glm_action=list">Click here to see the members list.</a>
+ </h3>
+
+{/if}
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th>Member Type</th>
+ <th>Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveMemberTypes}
+ {assign var="i" value="0"}
+ {foreach $memberTypes as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a class="editMemberType" data-memberTypeID="{$t.id}">{$t.name}</a>
+ </td>
+ <td id="editMemberTypeDescr_{$t.id}">
+ {$t.descr}
+ </td>
+ <td>
+ <div class="deleteMemberTypeButton button button-secondary glm-button-small glm-right" data-memberTypeID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newMemberTypeButton').click( function() {
+ $("#newMemberTypeDialog").dialog("open");
+ });
+ $('.editMemberType').click( function() {
+ var typeID = $(this).attr('data-memberTypeID');
+ var typeName = $(this).text();
+ var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
+ $('#editMemberTypeID').val(typeID);
+ $('#editMemberTypeName').val(typeName.trim());
+ $('#editMemberTypeDescr').val(typeDescr.trim());
+ $("#editMemberTypeDialog").dialog("open");
+ });
+ $('#editMemberTypeCancel').click( function() {
+ $("#editMemberTypeDialog").dialog("close");
+ });
+ $('#newMemberTypeCancel').click( function() {
+ $("#newMemberTypeDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteMemberTypeButton').click( function() {
+ id = $(this).attr('data-memberTypeID');
+ $("#deleteMemberTypeDialog").dialog("open");
+ });
+ $('#deleteMemberTypeConfirm').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=index&option=delete&id=" + id;
+ });
+ $('#deleteMemberTypeCancel').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <!-- Add Regions Button and Dialog Box -->
+ <div id="newRegionButton" class="button button-primary glm-right">Add a Region</div>
+ <div id="newRegionDialog" class="glm-dialog-box" title="Enter a New Region">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="regions">
+ <input type="hidden" name="option" value="addNew">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Region Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newRegionCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Region" class="button button-primary">
+ </form>
+ </div>
+
+ <!-- Add Regions Button -->
+ <div id="deleteRegionDialog" class="glm-dialog-box" title="Delete Region">
+ <center>
+ <p>Are you sure you want to delete this region?</p>
+ <p><div id="deleteRegionConfirm" class="button button-primary">Yes, delete this region</div></p>
+ <p><div id="deleteRegionCancel" class="button button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Regions Dialog Box -->
+ <div id="editRegionDialog" class="glm-dialog-box" title="Edit this Region">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="regions">
+ <input type="hidden" name="option" value="update">
+ <input id="editRegionID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Region Name:</th>
+ <td>
+ <input id="editRegionName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editRegionDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editRegionShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editRegionCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Region">
+ </form>
+ </div>
+
+ <h2>Regions</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Region</th>
+ <th>Description</th>
+ <th>Short Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveRegions}
+ {assign var="i" value="0"}
+ {foreach $regions as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a class="editRegion" data-regionID="{$t.id}">{$t.name}</a>
+ </td>
+ <td id="editRegionDescr_{$t.id}">
+ {$t.descr}
+ </td>
+ <td id="editRegionShortDescr_{$t.id}">
+ {$t.short_descr}
+ </td>
+ <td>
+ <div class="deleteRegionButton button button-secondary glm-button-small glm-right" data-regionID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no regions listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newRegionDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editRegionDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteRegionDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newRegionButton').click( function() {
+ $("#newRegionDialog").dialog("open");
+ });
+ $('.editRegion').click( function() {
+ var regionID = $(this).attr('data-regionID');
+ var regionName = $(this).text();
+ var regionDescr = $('#editRegionDescr_' + regionID).html();
+ var regionShortDescr = $('#editRegionShortDescr_' + regionID).html();
+ $('#editRegionID').val(regionID);
+ $('#editRegionName').val(regionName.trim());
+ $('#editRegionDescr').val(regionDescr.trim());
+ $('#editRegionShortDescr').val(regionShortDescr.trim());
+ $("#editRegionDialog").dialog("open");
+ });
+ $('#editRegionCancel').click( function() {
+ $("#editRegionDialog").dialog("close");
+ });
+ $('#newRegionCancel').click( function() {
+ $("#newRegionDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteRegionButton').click( function() {
+ id = $(this).attr('data-regionID');
+ $("#deleteRegionDialog").dialog("open");
+ });
+ $('#deleteRegionConfirm').click( function() {
+ $("#deleteRegionDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete&id=" + id;
+ });
+ $('#deleteRegionCancel').click( function() {
+ $("#deleteRegionDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}