From: Chuck Scott Date: Tue, 30 Jun 2015 14:50:09 +0000 (-0400) Subject: In mid development for image upload handling X-Git-Tag: v1.0.0^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=fb4528079e2db173d19d7dc65d8e25958b99ac4e;p=WP-Plugins%2Fglm-member-db.git In mid development for image upload handling --- diff --git a/classes/data/dataAccommodationTypes.php b/classes/data/dataAccommodationTypes.php index c87ab977..ef803e5b 100644 --- a/classes/data/dataAccommodationTypes.php +++ b/classes/data/dataAccommodationTypes.php @@ -141,7 +141,7 @@ class GlmDataAccommodationTypes extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataAmenities.php b/classes/data/dataAmenities.php index ee49098c..ce8d06c0 100644 --- a/classes/data/dataAmenities.php +++ b/classes/data/dataAmenities.php @@ -157,7 +157,7 @@ class GlmDataAmenities extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataCategories.php b/classes/data/dataCategories.php index 5f1062e3..599f72ff 100644 --- a/classes/data/dataCategories.php +++ b/classes/data/dataCategories.php @@ -154,7 +154,7 @@ class GlmDataCategories extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } @@ -283,7 +283,7 @@ class GlmDataCategories extends GlmDataAbstract } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice("Category added: name = $name, parent = $parent, ID = $categoryID", 'DataBlock', "addCategory()"); } diff --git a/classes/data/dataCategoryMemberInfo.php b/classes/data/dataCategoryMemberInfo.php index 447d0ee4..23b30fc0 100644 --- a/classes/data/dataCategoryMemberInfo.php +++ b/classes/data/dataCategoryMemberInfo.php @@ -143,7 +143,7 @@ class GlmDataCategoryMemberInfo extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } @@ -200,7 +200,7 @@ class GlmDataCategoryMemberInfo extends GlmDataAbstract ;"; $list = $this->wpdb->get_results($sql, ARRAY_A); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getListWithParents() query"); glmMembersAdmin::addNotice($list, 'DataBlock', 'getListWithParents() data'); } @@ -289,7 +289,7 @@ class GlmDataCategoryMemberInfo extends GlmDataAbstract // Get new list and return it $current = $this->getList($memberInfoID); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($current, 'DataBlock', 'Currently Selected Member Categories'); } diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php index 35396aaf..8b4156c4 100644 --- a/classes/data/dataCities.php +++ b/classes/data/dataCities.php @@ -10,7 +10,7 @@ * @package GLM Member-DB * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + * @release SVN: $Id: dataCities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ */ /** @@ -22,8 +22,8 @@ * @package EventManagement * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott - * Exp $ + * @release SVN: $Id: dataCities.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ */ class GlmDataCities extends GlmDataAbstract { @@ -126,7 +126,7 @@ class GlmDataCities extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataImages.php b/classes/data/dataImages.php new file mode 100644 index 00000000..a5e66e33 --- /dev/null +++ b/classes/data/dataImages.php @@ -0,0 +1,240 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataImages.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataImages class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataImages.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataImages extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Field definitions + * + * @var $ini + * @access public + */ + public $table; + + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + + /** + * Constructor + * + * @param object $d + * database connection + * + * @return void + * @access public + */ + function __construct ($wpdb, $config) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'images'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Status + 'status' => array ( + 'field' => 'status', + 'type' => 'list', + 'list' => $this->config['status'], + 'required' => true, + 'default' => $this->config['status_numb']['Pending'], + 'force_list' => true, + 'use' => 'a' + ), + + // File Name + 'file_name' => array( + 'field' => 'file_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + + // Description + 'descr' => array( + 'field' => 'descr', + 'type' => 'text', + 'use' => 'a' + ), + + // Caption + 'caption' => array( + 'field' => 'caption', + 'type' => 'text', + 'use' => 'a' + ), + + // Position + 'position' => array( + 'field' => 'position', + 'type' => 'integer', + 'use' => 'a' + ), + + // Reference Type - Which table this entry is associated with + 'ref_type' => array ( + 'field' => 'ref_type', + 'type' => 'list', + 'list' => $this->config['ref_type'], + 'required' => true, + 'default' => $this->config['ref_type_numb']['None'], + 'force_list' => true, + 'use' => 'a' + ), + + // Reference Destination - Which entry in the table is it associated with + 'position' => array( + 'field' => 'position', + 'type' => 'integer', + 'use' => 'a' + ) + + ); + + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); + } + + } + + + /* + * Get an Image Gallery + * + * Retrieves all images for a specific refernce type and ID + * + * Reference types point to a particuarl table of data, such as + * the member_info table. The ID points to a particular entry, + * such as a specific member information record (Reference + * Destination). + * + * @param int $refType Reference Type + * @param int $refID Reference entry ID + * + * @return object Class object + * + */ + public function getGallery($refType, $refID ) + { + + // Check for a valid reference type + if (!isset($this->config['ref_type'][$refType])) { + + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice("dataImages.php - getGallery()
  Specified reference type ($refType) is invalid.", 'Alert'); + } + + return false; + } + + // Make sure $refID is a positive integer - If it's not a valid reference, nothing will be returned anyway. + $refID = $refID -0; + if ($refID <= 0) { + + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice("dataImages.php - getGallery()
  Specified reference destination ($refID) is invalid.", 'Alert'); + } + + return false; + } + + + // Get all images matching $refType and $refID ordered by "position" number + $where = "T.ref_type = $refType AND T.ref_dest = $refID"; + $imageGallery = $this->getList($where, 'T.position'); + + // Check if we found anything + if (!is_array($imageGallery) || count($imageGallery) == 0) { + return false; + } + + return $imageGallery; + + } +} + +?> \ No newline at end of file diff --git a/classes/data/dataMemberInfo.php b/classes/data/dataMemberInfo.php index ced7e2ec..5ff5ea2d 100644 --- a/classes/data/dataMemberInfo.php +++ b/classes/data/dataMemberInfo.php @@ -314,7 +314,7 @@ class GlmDataMemberInfo extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataMemberTypes.php b/classes/data/dataMemberTypes.php index 92cd7976..887f3bbe 100644 --- a/classes/data/dataMemberTypes.php +++ b/classes/data/dataMemberTypes.php @@ -134,7 +134,7 @@ class GlmDataMemberTypes extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index 753c5728..409102ed 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -179,7 +179,7 @@ class GlmDataMembers extends GlmDataAbstract { ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php index 571df300..09ccaefd 100644 --- a/classes/data/dataRegions.php +++ b/classes/data/dataRegions.php @@ -141,7 +141,7 @@ class GlmDataRegions extends GlmDataAbstract ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index dc7ea0ae..ad6fc345 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -122,21 +122,21 @@ class GlmDataSettingsGeneral extends GlmDataAbstract // Adming Debug 'admin_debug' => array( 'field' => 'admin_debug', - 'type' => 'boolean', + 'type' => 'checkbox', 'use' => 'a' ), // Adming Debug Verbose 'admin_debug_verbose' => array( 'field' => 'admin_debug_verbose', - 'type' => 'boolean', + 'type' => 'checkbox', 'use' => 'a' ), // Front-end Debug 'front_debug' => array( 'field' => 'front_debug', - 'type' => 'boolean', + 'type' => 'checkbox', 'use' => 'a' ), @@ -266,7 +266,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'field' => 'list_logo_size', 'type' => 'list', 'list' => $this->config['image_sizes'], - 'required' => true, + 'force_list' => true, 'use' => 'a' ), @@ -280,7 +280,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract // Front-end Listings - Show Street 'list_show_street' => array( - 'field' => 'list_show_Street', + 'field' => 'list_show_street', 'type' => 'checkbox', 'use' => 'a' ), @@ -366,7 +366,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract ), // Front-end Listings - Show Credit Cards - 'list_show_logo' => array( + 'list_show_creditcards' => array( 'field' => 'list_show_creditcards', 'type' => 'checkbox', 'default' => true, @@ -406,13 +406,13 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'field' => 'list_map_logo_size', 'type' => 'list', 'list' => $this->config['image_sizes'], - 'required' => true, + 'force_list' => true, 'use' => 'a' ), // Front-end Listings - Map Show Description - 'list_map_show_description' => array( - 'field' => 'list_map_show_description', + 'list_map_show_descr' => array( + 'field' => 'list_map_show_descr', 'type' => 'checkbox', 'default' => false, 'use' => 'a' @@ -435,7 +435,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract ), // Front-end Listings - Map Show Street - 'list_map_show_Street' => array( + 'list_map_show_street' => array( 'field' => 'list_map_show_street', 'type' => 'checkbox', 'default' => false, @@ -555,13 +555,13 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'field' => 'detail_logo_size', 'type' => 'list', 'list' => $this->config['image_sizes'], - 'required' => true, + 'force_list' => true, 'use' => 'a' ), // Front-end Member Detail - Show Description - 'detail_show_description' => array( - 'field' => 'detail_show_description', + 'detail_show_descr' => array( + 'field' => 'detail_show_descr', 'type' => 'checkbox', 'default' => false, 'use' => 'a' @@ -669,11 +669,148 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'type' => 'checkbox', 'default' => false, 'use' => 'a' - ) + ), + + /* + * Front-end Member Detail Map Options + */ + + // Front-end Detail - Map Show Logo + 'detail_map_show_logo' => array( + 'field' => 'detail_map_show_logo', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Logo Size + 'detail_map_logo_size' => array( + 'field' => 'detail_map_logo_size', + 'type' => 'list', + 'list' => $this->config['image_sizes'], + 'force_list' => true, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Description + 'detail_map_show_descr' => array( + 'field' => 'detail_map_show_descr', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Short Description + 'detail_map_show_short_descr' => array( + 'field' => 'detail_map_show_short_descr', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Address + 'detail_map_show_address' => array( + 'field' => 'detail_map_show_address', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Street + 'detail_map_show_street' => array( + 'field' => 'detail_map_show_street', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show City, State, ZIP + 'detail_map_show_citystatezip' => array( + 'field' => 'detail_map_show_citystatezip', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Country + 'detail_map_show_country' => array( + 'field' => 'detail_map_show_country', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Region + 'detail_map_show_region' => array( + 'field' => 'detail_map_show_region', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Phone + 'detail_map_show_phon' => array( + 'field' => 'detail_map_show_phone', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Toll Free + 'detail_map_show_tollfree' => array( + 'field' => 'detail_map_show_tollfree', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show URL + 'detail_map_show_url' => array( + 'field' => 'detail_map_show_url', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show URL With New Target + 'detail_map_show_url_newtarget' => array( + 'field' => 'detail_map_show_url_newtarget', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Categories + 'detail_map_show_categories' => array( + 'field' => 'detail_map_show_categories', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show Credit Cards + 'detail_map_show_creditcards' => array( + 'field' => 'detail_map_show_creditcards', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + // Front-end Detail - Map Show amenities + 'detail_map_show_amenities' => array( + 'field' => 'detail_map_show_amenities', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + + + + ); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } diff --git a/classes/data/settings/dataSettingsTerms.php b/classes/data/settings/dataSettingsTerms.php new file mode 100644 index 00000000..4a05295d --- /dev/null +++ b/classes/data/settings/dataSettingsTerms.php @@ -0,0 +1,448 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataSettingsTerms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataSettingsGeneral class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataSettingsTerms extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Field definitions + * + * @var $ini + * @access public + */ + public $table; + + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + + /** + * Constructor + * + * @param object $d + * database connection + * + * @return void + * @access public + */ + function __construct ($wpdb, $config) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'settings_terms'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + /* + * Admin Menu Names + */ + + // Menu Members + 'term_admin_menu_members' => array( + 'field' => 'term_admin_menu_members', + 'type' => 'text', + 'use' => 'a' + ), + + // Sub Menu Member List + 'term_admin_menu_members_list' => array( + 'field' => 'term_admin_menu_member_list', + 'type' => 'text', + 'use' => 'a' + ), + + // Menu Member + 'term_admin_menu_member' => array( + 'field' => 'term_admin_menu_member', + 'type' => 'text', + 'use' => 'a' + ), + + // Menu Configure + 'term_admin_menu_configure' => array( + 'field' => 'term_admin_menu_configure', + 'type' => 'text', + 'use' => 'a' + ), + + // Menu Settings + 'term_admin_menu_settings' => array( + 'field' => 'term_admin_menu_settings', + 'type' => 'text', + 'use' => 'a' + ), + + // Menu Shortcodes + 'term_admin_menu_shortcodes' => array( + 'field' => 'term_admin_menu_shortcodes', + 'type' => 'text', + 'use' => 'a' + ), + + /* + * Admin Page Tabs + */ + + // Tab Members/Main Dashboard + 'term_admin_menu_members_dashboard' => array( + 'field' => 'term_admin_menu_members_dashboard', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Members/List of Members + 'term_admin_menu_members_list' => array( + 'field' => 'term_admin_menu_members_list', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Members/Reports + 'term_admin_menu_members_reports' => array( + 'field' => 'term_admin_menu_members_reports', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Member Dashboard + 'term_admin_menu_member_dashboard' => array( + 'field' => 'term_admin_menu_member_dashboard', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Member Info + 'term_admin_menu_member_info' => array( + 'field' => 'term_admin_menu_member_info', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Locations + 'term_admin_menu_member_locations' => array( + 'field' => 'term_admin_menu_member_locations', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Facilities + 'term_admin_menu_member_facilities' => array( + 'field' => 'term_admin_menu_member_facilities', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Attractions + 'term_admin_menu_member_attractions' => array( + 'field' => 'term_admin_menu_member_attractions', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Member/Contacts + 'term_admin_menu_member_contacts' => array( + 'field' => 'term_admin_menu_member_contacts', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Member Types + 'term_admin_menu_configure_member_types' => array( + 'field' => 'term_admin_menu_configure_member_types', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Member Categories + 'term_admin_menu_configure_member_cats' => array( + 'field' => 'term_admin_menu_configure_member_cats', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Accommodation Types + 'term_admin_menu_configure_accom_types' => array( + 'field' => 'term_admin_menu_configure_accom_types', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Amenities + 'term_admin_menu_configure_amenities' => array( + 'field' => 'term_admin_menu_configure_amenities', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Cities + 'term_admin_menu_configure_cities' => array( + 'field' => 'term_admin_menu_configure_cities', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Configure/Regions + 'term_admin_menu_configure_regions' => array( + 'field' => 'term_admin_menu_configure_regions', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Settings/General Settings + 'term_admin_menu_settings_general' => array( + 'field' => 'term_admin_menu_settings_general', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Settings/Terms and Phrases + 'term_admin_menu_settings_terms' => array( + 'field' => 'term_admin_menu_settings_terms', + 'type' => 'text', + 'use' => 'a' + ), + + // Tab Settings/Development + 'term_admin_menu_settings_development' => array( + 'field' => 'term_admin_menu_settings_development', + 'type' => 'text', + 'use' => 'a' + ), + + /* + * General Terms + */ + + // Member + 'term_member' => array( + 'field' => 'term_member', + 'type' => 'text', + 'use' => 'a' + ), + + // Member Cap + 'term_member_cap' => array( + 'field' => 'term_member_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Member Plural + 'term_member_plur' => array( + 'field' => 'term_member_plur', + 'type' => 'text', + 'use' => 'a' + ), + + // Member Plural Cap + 'term_member_plur_cap' => array( + 'field' => 'term_member_plur_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Location + 'term_location' => array( + 'field' => 'term_location', + 'type' => 'text', + 'use' => 'a' + ), + + // Location Cap + 'term_location_cap' => array( + 'field' => 'term_location_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Location Plur + 'term_location_plur' => array( + 'field' => 'term_location_plur', + 'type' => 'text', + 'use' => 'a' + ), + + // Location Plur Cap + 'term_location_plur_cap' => array( + 'field' => 'term_location_plur_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Facility + 'term_facility' => array( + 'field' => 'term_facility', + 'type' => 'text', + 'use' => 'a' + ), + + // Facility Cap + 'term_facility_cap' => array( + 'field' => 'term_facility_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Facility Plur + 'term_facility_plur' => array( + 'field' => 'term_facility_plur', + 'type' => 'text', + 'use' => 'a' + ), + + // Facility Plur Cap + 'term_facility_plur_cap' => array( + 'field' => 'term_facility_plur_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Attraction + 'term_attraction' => array( + 'field' => 'term_attraction', + 'type' => 'text', + 'use' => 'a' + ), + + // Attraction Cap + 'term_attraction_cap' => array( + 'field' => 'term_attraction_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Attraction Plur + 'term_attraction_plur' => array( + 'field' => 'term_attraction_plur', + 'type' => 'text', + 'use' => 'a' + ), + + // Attraction Plur Cap + 'term_attraction_plur_cap' => array( + 'field' => 'term_attraction_plur_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Contact + 'term_contact' => array( + 'field' => 'term_contact', + 'type' => 'text', + 'use' => 'a' + ), + + // Contact Cap + 'term_contact_cap' => array( + 'field' => 'term_contact_cap', + 'type' => 'text', + 'use' => 'a' + ), + + // Contact Plur + 'term_contact_plur' => array( + 'field' => 'term_contact_plur', + 'type' => 'text', + 'use' => 'a' + ), + + // Contact Plur Cap + 'term_contact_plur_cap' => array( + 'field' => 'term_contact_plur_cap', + 'type' => 'text', + 'use' => 'a' + ) + + + ); + + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); + } + + } +} + +?> \ No newline at end of file diff --git a/config/plugin.ini b/config/plugin.ini index 4263698b..fad26a1f 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -323,6 +323,7 @@ phrase['phrase_test'] = 'test' [chuck:common] admin_debug = true +admin_debug_verbose = true front_debug = true googleMapsApiKey = '' diff --git a/controllers/admin.php b/controllers/admin.php index 1868820b..064bc736 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -41,7 +41,8 @@ $GLOBALS['glmMembersAdminValidActions'] = array( 'locations', 'facilities', 'activities', - 'accommodations' + 'accommodations', + 'memberImage', // Member Image Processing via AJAX ) , 'configure' => array( @@ -54,6 +55,7 @@ $GLOBALS['glmMembersAdminValidActions'] = array( ), 'settings' => array( 'index', // General Options + 'terms', // Terms and Phrases 'development' ), 'shortcodes' => array( @@ -219,20 +221,95 @@ class glmMembersAdmin extends GlmPluginSupport )); -/* - add_action( 'admin_init', - array( - $this, - 'glmMembersAdminSettingsInit' - )); -*/ + // Add AJAX image upload action + add_action( 'wp_ajax_glm_members_image_upload', + array( + $this, + 'glmMembersImageUpload' + ) + ); + + + } + + /** + * Image Upload AJAX Target + * + * Acccepts image uploads and routes them to the appropriate + * model file. + * + * @return void + * @access public + */ + public function glmMembersImageUpload() + { + // Get the model menu + if (isset($_REQUEST['glm_menu']) && $_REQUEST['glm_menu'] != '') { + $a = sanitize_text_field($_REQUEST['glm_menu']); + if ($a != '') { + $menuItem = $a; + } else { + // No menu provided - terminating + trigger_error ( 'ERROR: No "glm_menu" string provided in POST array.', E_USER_ERROR); + } + } else { + // Missing glm_menu Item in post array. + trigger_error ( 'ERROR: No "glm_menu" item in POST array.', E_USER_ERROR); + } + + // Get the model action + if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') { + $a = sanitize_text_field($_REQUEST['glm_action']); + if ($a != '') { + $Action = $a; + } else { + // No menu provided - terminating + trigger_error ( 'ERROR: No "glm_action" string provided in POST array.', E_USER_ERROR); + } + + } else { + trigger_error ( 'ERROR: No "glm_action" itme in POST array.', E_USER_ERROR); + } + + // If menu item and action aren't valid, quit now. + if (! isset($GLOBALS['glmMembersAdminValidActions'][$menuItem]) || + ! in_array($Action, $GLOBALS['glmMembersAdminValidActions'][$menuItem])) { + + // Menu item/Action not in valid actions array + trigger_error ( 'ERROR: The specified menu item and action are not valid.', E_USER_ERROR); + } + + // Build model and path and class names + $modelName = GLM_MEMBERS_PLUGIN_PATH . '/models/admin/' . $menuItem . + '/' . $Action . '.php'; + $className = 'GlmMembersAdmin_' . $menuItem . '_' . $Action; + + // If model file doesn't exist - we have an error + if (!file_exists($modelName)) { + trigger_error ( "ERROR: The specified model file doesn't exist. ($modelName)", E_USER_ERROR); + } + + // Load the model file + require_once ($modelName); + + // check for an invalid model class name + if (!class_exists($className)) { + trigger_error ( "ERROR: The specified class naeme doesn't exist. ($className)", E_USER_ERROR); + } + + // Instantiate the model and ask it to perform the work + $model = new $className($this->wpdb, $this->config); + $model->modelAction(); + + wp_die(); + } /** * Setup inclusion of admin scripts and css * * This method is called by an add_action() hook setup in the contructor. - * + *FormData * (no prameters) * * @return void @@ -252,6 +329,8 @@ class glmMembersAdmin extends GlmPluginSupport wp_enqueue_style('wp-jquery-ui-dialog'); wp_enqueue_media(); + + // Scripts included with this plugin wp_register_script('glm-members-admin-js', GLM_MEMBERS_PLUGIN_URL . 'js/admin.js', array( @@ -265,6 +344,16 @@ class glmMembersAdmin extends GlmPluginSupport GLM_MEMBERS_PLUGIN_URL . 'css/admin.css'); wp_enqueue_style('glmMembersAdminStyle'); + // Image Upload scripts and css for Member DB and perhaps other + wp_register_script('glm-members-admin-image-upload', + GLM_MEMBERS_PLUGIN_URL . 'js/imageUpload/imageUpload.js', + array( + 'jquery' + )); + wp_enqueue_script('glm-members-admin-image-upload'); + wp_register_style('glm-members-admin-image-upload-css', + GLM_MEMBERS_PLUGIN_URL . 'js/imageUpload/imageUpload.css'); + wp_enqueue_style('glm-members-admin-image-upload-css'); } diff --git a/glm-member-db.php b/glm-member-db.php index c89d96d9..a45a1dbd 100644 --- a/glm-member-db.php +++ b/glm-member-db.php @@ -352,8 +352,6 @@ function glmMembersAdminNotices($windowed = true) } } - delete_option('glmMembersAdminNoticeDataBlocks'); - echo $output.' @@ -383,11 +381,14 @@ function glmMembersAdminNotices($windowed = true) echo $output.'

'; - // Delete the option containing the notices to indicate they have been sent - delete_option('glmMembersAdminNotices'); } + delete_option('glmMembersAdminNoticeAlerts'); + delete_option('glmMembersAdminNotices'); + delete_option('glmMembersAdminNoticeProcess'); + delete_option('glmMembersAdminNoticeDataBlocks'); + } /* diff --git a/js/imageUpload/OLD_SAVE_imageUpload.js b/js/imageUpload/OLD_SAVE_imageUpload.js new file mode 100644 index 00000000..61d26885 --- /dev/null +++ b/js/imageUpload/OLD_SAVE_imageUpload.js @@ -0,0 +1,88 @@ +/* + * HTML5 Image Upload Support + * + * Developed from information in http://www.sitepoint.com/html5-file-drag-and-drop/ + */ + +jQuery(document).ready(function($) { + + // output information + function Output(msg) { + var m = $id("imageDragMessages"); + m.innerHTML = msg + m.innerHTML; + } + + // Setup Drag and Drop when Add and + $('#newImageButton').click( function() { + //call initialization function if drag/drop supported by browser + if (window.File && window.FileList && window.FileReader) { + ImageDragInit(); + } + }); + + //initialize + function ImageDragInit() { + + // is XHR2 available? + var xhr = new XMLHttpRequest(); + if (xhr.upload) { + + // Change from Drag/Drop not supported to drop here display + $('#noImageDrop').css('display', 'none'); + $('#noImageDrop').css('display', 'none'); + $('#imageDrop').css('display', 'block'); + + // file drop +// imageDrop.addEventListener("dragover", FileDragHover, false); +// imageDrop.addEventListener("dragleave", FileDragHover, false); +// imageDrop.addEventListener("drop", FileSelectHandler, false); + + // remove submit button + newImageSubmit.style.display = "none"; + + } + + } + + /* + $(window).on('dragenter', function(){ + $(this).preventDefault(); + }); +*/ + + // Change drop destination appearance only when dragging over a file. + $('#imageDrop').on('dragenter', function(){ + $('#imageDropText').css('display', 'none'); + $('#imageDrop').addClass('imageDropDragOver'); + }); + + $('#imageDrop').on('dragleave', function(){ + $('#imageDropText').css('display', 'block'); + $('#imageDrop').removeClass('imageDropDragOver'); + }); + + // file drag hover + $('#imageDrop').mouseover( function(e) { + e.stopPropagation(); +// e.preventDefault(); +// $('#imageDrop').css('display', 'block'); + e.target.className = (e.type == "dragover" ? "hover" : ""); + }); + + // file selection + $('#newImage').change( function() { + + // cancel event and hover styling + FileDragHover(e); + + // fetch FileList object + var files = e.target.files || e.dataTransfer.files; + + // process all File objects + for (var i = 0, f; f = files[i]; i++) { + ParseFile(f); + } + + }); + +}); diff --git a/js/imageUpload/imageUpload.css b/js/imageUpload/imageUpload.css new file mode 100644 index 00000000..660dd1e6 --- /dev/null +++ b/js/imageUpload/imageUpload.css @@ -0,0 +1,132 @@ +.glm-imageGalleryContainer +{ + margin: .5em 1em 1em 1em; + padding: .5em; + border: 2px solid #ccc; + text-align: center; +} + +.glm-imageDropContainer +{ + position: relative; + text-align: center; + padding: 0 1em 1em 1em; + background-color: #eee; + border: 2px solid #ccc; + border-radius: 7px; + cursor: default; + margin-left: auto; + margin-right: auto; + width: 75%; + height: 5em; +} +.glm-imageDrop +{ + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 10; + border-radius: 7px; + height: 100%; + background-color: #000; + opacity: .0; + filter: alpha(opacity=0); /* For IE8 and earlier */ + +} +.glm-imageDropText +{ + color: #666; + z-index: 9; +} +.glm-noImageDropText +{ + color: #666; +} +.glm-imageItemHidden +{ + display: none; + z-index: 9; +} +.glm-imageDropDragOver +{ + border: 2px solid #000 important; + background-color: #fff; +} +.glm-imageUploadStatus +{ + position: absolute; + width: 100%; + height: 100%; + top: 20px; + left: 10px; + z-index: 11; + border: 2px solid black; + border-radius: 7px; + height: 8em; + background-color: #fff; + box-shadow: 10px 10px 5px grey; +} + +.glm-imageGalleryImages +{ +} + +.glm-statusTable +{ + width: 100%; +/* table-layout: fixed; */ + line-height: 80%; +} +.glm-statusImageTD +{ +/* width: 25%; */ + max-width: 100%; + overflow: hidden; + padding: 3px; + display: table-cell; + vertical-align: middle; +} +.glm-statusPrompt +{ + width: 10%; + padding: 0px; + font-weight: bold; + text-align: right; +} +.glm-statusValue +{ + width: 65%; + padding: 0px; + text-align: left; +} +.glm-statusImageContainer +{ + display: block; + width: 100px; +} +.glm-statusImage +{ + height: 5.1em; + width: auto; + display: block; + margin-left: auto; + margin-right: auto; +} + +.glm-progressBarContainer +{ + height: 100%; + width: 95%; + background-color: #ccc; + border: 1px solid black; + line-height: 1em; +} +.glm-progressBar +{ + height: 1em; + background-color: blue; + width: 0%; +} + diff --git a/js/imageUpload/imageUpload.js b/js/imageUpload/imageUpload.js new file mode 100644 index 00000000..5a644194 --- /dev/null +++ b/js/imageUpload/imageUpload.js @@ -0,0 +1,314 @@ +/* + * HTML5 Image Upload Support + * + * Developed from information in + * http://www.sitepoint.com/html5-file-drag-and-drop/ + * http://hayageek.com/drag-and-drop-file-upload-jquery/ + */ + + +/****** NEED TO ADD FILE SIZE TEST AND USER NOTICE ALERT *******/ + +jQuery(document).ready(function($) { + + + var drop; + var recordID; + var menuItem; + var action; + var files; + + // Setup Drag and Drop when Add and + if (window.File && window.FileList && window.FileReader) { + + // is XHR2 available? + var xhr = new XMLHttpRequest(); + if (xhr.upload) { + + // Change from Drag/Drop not supported to drop here text + $('.glm-imageBrowseButton').addClass('glm-imageItemHidden'); + $('.glm-imageDropText').removeClass('glm-imageItemHidden'); + $('.glm-imageDrop').removeClass('glm-imageItemHidden'); + + // Prevent dropping on the document + $(document).on('dragenter', function (e) { + e.stopPropagation(); + e.preventDefault(); + }); + $(document).on('dragover', function (e) { + e.stopPropagation(); + e.preventDefault(); + }); + $(document).on('drop', function (e) { + e.preventDefault(); + }); + + // For each image drop area + $('.glm-imageDrop').each(function() { + drop = $(this); + initDrop(); + + // **** NEED TO DEAL WITH DELAY TILL THE PRIOR DROP AREA HAS BEEN PROCESSED *** + + }); + + } else { + $('.glm-noImageDropText').removeClass('glm-imageItemHidden'); + } + + } + + // Setup a single drop area + function initDrop() { + + // Get ID for the record number to which these images belong. + recordID = drop.attr("data-id"); + menuItem = drop.attr("data-menuItem"); + action = drop.attr("data-action"); + + // Change drop destination appearance only when dragging over a file. + drop.on('dragenter', function(e){ + e.stopPropagation(); + e.preventDefault(); + drop.parent().addClass('glm-imageDropDragOver'); + }); + drop.on('dragover', function(e){ + e.stopPropagation(); + e.preventDefault(); + }); + drop.on('dragleave', function(e){ + e.stopPropagation(); + e.preventDefault(); + drop.parent().removeClass('glm-imageDropDragOver'); + }); + + // File drop action + $('.glm-imageDrop').on('drop', function (e) { + e.preventDefault(); + files = e.originalEvent.dataTransfer.files; + handleFileDrop(); + drop.parent().removeClass('glm-imageDropDragOver'); + }); + + } + + /* + * This function sets up AJAX processing of the list of files. + * It then fires off the processFile() function to do the first + * file. When the AJAX call in sendFileToServer() completes, + * the complete: function will call processFile() again to + * do the next file, if one exists. + */ + var thisFile = 0; + var numbFiles = 0; + + function handleFileDrop() { + + // Reset file pointer and set number of last file + thisFile = 0; + numbFiles = files.length; + + // Start with the first file + processFile(); + +/* var fd = new FormData(); + fd.append('file', file); + + var status = new createStatusbar(file, drop); + statusArea.fadeIn( function() { + sendFileToServer(fd,status); + }); +*/ +// statusArea.addClass('glm-imageItemHidden'); + + } + + /* + * Process the current file - AJAX complete: will call back to this + * function for the next file + */ + function processFile() { + + // If we still have files to process + if (thisFile < numbFiles) { + + file = files[thisFile]; + + // Setup field pairs for sending in request + var fd = new FormData(); + fd.append('file', file); + + // Setup status display area + var status = new createStatusbar(file, thisFile, numbFiles); + statusArea.fadeIn( function() { + + // When status has faded in, Send the files + sendFileToServer(fd, status, recordID); + + }); + + thisFile++; + + } else { + + // done + + } + + } + + function createStatusbar(file, thisFile, numbFiles) + { + var statusDone = false; + + /* + * We need to redefine these values inside this function + * so the reader.onload function can see them. + */ + var curFile = thisFile + 1; + var lastFile = numbFiles; + + // Get status area for this drop area + statusArea = drop.siblings('.glm-imageUploadStatus'); + + // Make status area visible (overlay) and clear contents + statusArea.html(''); + + // If file is an image + var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/; + + if (regex.test(file.name.toLowerCase())) { + + // Create HTML5 file reader and load image + var reader = new FileReader(); + reader.onload = function (e) { + + // Add file information to status area + statusbar = + 'Uploading Image {thisFile} of {numbFiles}' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
Name: {fileName}
Type: {fileType}
Size: {fileSize}
Progress:
' + ; + statusbar = statusbar.replace('{thisFile}', curFile); + statusbar = statusbar.replace('{numbFiles}', lastFile); + statusbar = statusbar.replace('{fileImage}', e.target.result); + statusbar = statusbar.replace('{fileName}', file.name); + statusbar = statusbar.replace('{fileType}', file.type); + + // Fix up file size string and replace that + var sizeStr=""; + var sizeKB = file.size/1024; + if(parseInt(sizeKB) > 1024) + { + var sizeMB = sizeKB/1024; + sizeStr = sizeMB.toFixed(2)+" MB"; + } + else + { + sizeStr = sizeKB.toFixed(2)+" KB"; + } + statusbar = statusbar.replace('{fileSize}', sizeStr); + + // Assign the HTML to the status area + statusArea.html(statusbar); + + } + reader.readAsDataURL(file); + } else { + alert(file.name + " is not a valid image file."); + statusArea.addClass('glm-imageItemHidden'); + return false; + } + + this.setProgress = function(progress) + { + statusArea.find('.glm-progressBar').css('width', progress + '%'); + +/* + var progressBarWidth =progress*this.progressBar.width()/ 100; + this.progressBar.find('div').animate({ width: progressBarWidth }, 10).html(progress + "% "); + if(parseInt(progress) >= 100) + { + this.abort.hide(); + } +*/ + } + + this.setAbort = function(jqxhr) + { + var sb = this.statusbar; + this.abort.click(function() + { + jqxhr.abort(); + sb.hide(); + }); + } + } + + /* + * Sends file to image plugin via AJAX submission targeting + * WordPress AJAX handling. An image upload processor has been + * declared with an add_action() in the admin controller + * specifying the function containing that processor. We tell + * WordPress how to route the submission using the "action" + * post parameter. This matches everything after "wp_ajax_" + * in the action name. + */ + function sendFileToServer(fd, status, recordID) + { + + fd.append( 'action', 'glm_members_image_upload' ); + + var jqXHR=$.ajax({ + xhr: function() { + var xhrobj = $.ajaxSettings.xhr(); + if (xhrobj.upload) { + xhrobj.upload.addEventListener('progress', function(event) { + var percent = 0; + var position = event.loaded || event.position; + var total = event.total; + if (event.lengthComputable) { + percent = Math.ceil(position / total * 100); + } + status.setProgress(percent); + }, false); + + } + return xhrobj; + }, + url: ajaxurl + '?glm_menu=' + menuItem + '&glm_action=' + action + '&memberInfoID=' + recordID, // WordPress admin AJAX url + type: "POST", + contentType:false, + processData: false, + cache: false, + data: fd, + success: function(data){ +alert(data); +// status.clearStatus(); +// status.setProgress(100); + +// $("#status1").append("File upload Done
"); + }, + complete: function() { + + // When status area has faded + statusArea.fadeOut( function() { + + // Process the next file, if one exists. + processFile(); + + }); + + } + }); + + return jqXHR; +// status.setAbort(jqXHR); + } + +}); diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/.editorconfig b/js/jqueryDragAndDrop-ForReferenceOnly/.editorconfig new file mode 100644 index 00000000..ad446fa0 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/.editorconfig @@ -0,0 +1,11 @@ +; http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/.gitignore b/js/jqueryDragAndDrop-ForReferenceOnly/.gitignore new file mode 100644 index 00000000..14fe67f0 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/.gitignore @@ -0,0 +1,5 @@ +node_modules +tmp + +.DS_Store +._* \ No newline at end of file diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/.travis.yml b/js/jqueryDragAndDrop-ForReferenceOnly/.travis.yml new file mode 100644 index 00000000..7f22ed18 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.10 + +before_script: + - npm install -g grunt-cli + +script: "grunt test" diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/README b/js/jqueryDragAndDrop-ForReferenceOnly/README new file mode 100644 index 00000000..f3ac9e54 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/README @@ -0,0 +1,70 @@ +ezdz-multiple + +jQuery File Input plugin ezdz multiple files and grid preview + +It is based on Ezdz jQuery File Input plugin. new features have been added as follows. + + support multiple file upload. + support grid preview of image. + +All other settings pls refer to ezdz documentation https://github.com/jaysalvat/ezdz + +index.html file demostrates multiple file upload features and preview of image features. + +remember add multiple attribute to input tag. +Sample Usage + +in the html head section + + + + + +in the body section, simply add normal input tag, the plugin will automatically convert it into dropzone. + + + +add javascript pointing to input tag, add customize configuration. + +$('input[type="file"]').ezdz({ + text: 'drop cover photos', + validators: { + maxWidth: 2000, + maxHeight: 2000, + maxNumber: 6 + }, + reject: function(file, errors) { + if (errors.mimeType) { + alert(file.name + ' must be an image.'); + return; + } + + if (errors.maxWidth) { + alert(file.name + ' must be width:2000px max.'); + return; + } + + if (errors.maxHeight) { + alert(file.name + ' must be height:2000px max.'); + return; + } + + if (errors.maxNumber) { + alert('you can upload maximum of 6 images'); + return; + } + } + }); + +if you looking for modify preview image grid, editing jquery.ezdz.css, for example, the code represent 3 columns grid. + +.image-g li { + float: left; + max-width: 32%; + max-height: 48%; + padding: 0.10em; +} + +.image-g li:nth-child(3n+1) { + clear: left; +} diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.css b/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.css new file mode 100644 index 00000000..b2607eb3 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.css @@ -0,0 +1,126 @@ +/* ---------------------------------------------------------------------------- +// Ezdz [izy-dizy] +// Licensed under the MIT license. +// http://github.com/jaysalvat/ezdz/ +// ---------------------------------------------------------------------------- +// Copyright (C) 2014 Jay Salvat +// http://jaysalvat.com/ +// --------------------------------------------------------------------------*/ + +.ezdz-dropzone { + position: relative; +/* font: bold 24px arial; */ + text-align: center; + width: 100%; + height: 400px; /* Width of entire drop area */ + line-height: 100px; + color: #; + overflow: hidden; +} + +.ezdz-dropzone div { + color: lightgray; +/* font: bold 24px arial; */ + line-height: 100px; + /* */ +} + +.ezdz-dropzone span { + border-radius: 20px; + background: black; + background: rgba(0,0,0,0.7); + color: white; + font-size: 13px; + font-weight: normal; + max-width: 90%; + vertical-align: middle; + padding: 4%; + line-height: 10px; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.ezdz-dropzone img { + border-radius: 5px; + +} + +.ezdz-dropzone [type="file"] { + cursor: pointer; + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + margin: 0; + padding: 0; + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.ezdz-focus { +/* border: 10px dotted darkgray; */ + color: darkgray; +} + +.ezdz-focus div { + color: darkgray; + +} + +.ezdz-enter { +/* border: 10px solid black; */ + color: black; +} + +.ezdz-enter div { + color: black; + +} +.ezdz-accept { +/* border: 10px solid gray; */ + color: gray; +} + +.ezdz-accept div { + color: gray; +} + +.ezdz-reject { +/* border: 10px solid darkred; */ + color: darkred; +} + +.ezdz-reject div { + color: darkred; +} + +.image-g { + list-style-type: none; + padding: 0.25em; + overflow: hidden; + white-space: nowrap; +} + +.image-g li { + float: left; + width: 360px; +/* max-width: 32%; + max-height: 48%; */ + padding: 0.10em; +} + +.image-g img { + display: block; + width: 40%; + height: auto; + border: 2px solid black; +} + +.image-g li:nth-child(3n+1) { + clear: left; +} + \ No newline at end of file diff --git a/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.js b/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.js new file mode 100644 index 00000000..e30ab877 --- /dev/null +++ b/js/jqueryDragAndDrop-ForReferenceOnly/jquery.ezdz.js @@ -0,0 +1,422 @@ +/* ---------------------------------------------------------------------------- +// Ezdz [izy-dizy] +// Licensed under the MIT license. +// http://github.com/jaysalvat/ezdz/ +// ---------------------------------------------------------------------------- +// Copyright (C) 2014 Jay Salvat +// http://jaysalvat.com/ +// --------------------------------------------------------------------------*/ + +/* global define: true, require: true, jQuery */ + +(function (factory) { + "use strict"; + + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } else if (typeof exports === 'object') { + factory(require('jquery')); + } else { + factory(jQuery); + } +}(function ($) { + "use strict"; + + // Default settings + var defaults = { + className: '', + text: 'Drop a file', + previewImage: true, + value: null, + classes: { + main: 'ezdz-dropzone', + enter: 'ezdz-enter', + reject: 'ezdz-reject', + accept: 'ezdz-accept', + focus: 'ezdz-focus' + }, + validators: { + maxSize: null, + width: null, + maxWidth: null, + minWidth: null, + height: null, + maxHeight: null, + minHeight: null, + maxNumber: null + }, + init: function() {}, + enter: function() {}, + leave: function() {}, + reject: function() {}, + accept: function() {}, + format: function(filename) { + return filename; + } + }; + + // Main plugin + $.ezdz = function(element, options) { + this.settings = $.extend(true, {}, defaults, $.ezdz.defaults, options); + this.$input = $(element); + + var self = this, + settings = self.settings, + $input = self.$input; + + if (!$input.is('input[type="file"]')) { + return; + } + + // Stop if not compatible with HTML5 file API + if (!$.ezdz.isBrowserCompatible()) { + return; + } + + // private: Init the plugin + var init = function() { + var $ezdz, $container, value; + + // Build the container + $container = $('
') + + .on('dragover.ezdz', function() { + $(this).addClass(settings.classes.enter); + + if ($.isFunction(settings.enter)) { + settings.enter.apply(this); + } + }) + + .on('dragleave.ezdz', function() { + $(this).removeClass(settings.classes.enter); + + if ($.isFunction(settings.leaved)) { + settings.leaved.apply(this); + } + }) + + .addClass(settings.className); + + // Build the whole dropzone + $input + .wrap($container) + .before('
' + settings.text + '
'); + + $ezdz = $input.parent('.' + settings.classes.main); + + // Preview a file at start if it's defined + value = settings.value || $input.data('value'); + + if (value) { + self.preview(value); + } + + // Trigger the init callback + if ($.isFunction(settings.init)) { + settings.init.apply($input, [ value ]); + } + + // Events on the input + $input + + .on('focus.ezdz', function() { + $ezdz.addClass(settings.classes.focus); + }) + + .on('blur.ezdz', function() { + $ezdz.removeClass(settings.classes.focus); + }) + + .on('change.ezdz', function() { + + + // No file, so user has cancelled + if (this.files.length == 0) { + return; + } + + // Mime-Types + var allowed = $input.attr('accept'), + accepted = false, + valid = true, + errors = { + 'mimeType': false, + 'maxSize': false, + 'width': false, + 'minWidth': false, + 'maxWidth': false, + 'height': false, + 'minHeight': false, + 'maxHeight': false, + 'maxNumber': false + }; + + //Check the maximum number of files + + if (settings.validators.maxNumber && this.files.length > settings.validators.maxNumber) { + valid = false; + errors.maxNumber = true; + } + + var imgArr = new Array(); + var isImage = true; + + var i=0; + for(i=0;i settings.validators.maxSize) { + valid = false; + errors.maxSize = true; + } + + if (isImage) { + file.width = img.width; + file.height = img.height; + + if (settings.validators.width && img.width !== settings.validators.width) { + valid = false; + errors.width = true; + } + + if (settings.validators.maxWidth && img.width > settings.validators.maxWidth) { + valid = false; + errors.maxWidth = true; + } + + if (settings.validators.minWidth && img.width < settings.validators.minWidth) { + valid = false; + errors.minWidth = true; + } + + if (settings.validators.height && img.height !== settings.validators.height) { + valid = false; + errors.height = true; + } + + if (settings.validators.maxHeight && img.height > settings.validators.maxHeight) { + valid = false; + errors.maxHeight = true; + } + + if (settings.validators.minHeight && img.height < settings.validators.minHeight) { + valid = false; + errors.minHeight = true; + } + } + + + }, 100); + }; + } + + setTimeout(function() { + + // The file is validated, so added to input + if (valid === true) { + $ezdz.find('img').remove(); + + if (isImage && settings.previewImage === true) { + var $image_wrapper = $("
    "); + $image_wrapper.addClass("image-g"); + var i; + for (i=0;i").append(img_obj); + $image_wrapper.append($image_item); + } + $ezdz.find('div').html($image_wrapper.fadeIn()); + } else { + $ezdz.find('div').html('' + formatted + ''); + } + + $ezdz.addClass(settings.classes.accept); + + // Trigger the accept callback + if ($.isFunction(settings.accept)) { + settings.accept.apply($input, [ file ]); + } + + // The file is invalidated, so rejected + } else { + $input.val(''); + + $ezdz.addClass(settings.classes.reject); + + // Trigger the reject callback + if ($.isFunction(settings.reject)) { + settings.reject.apply($input, [ file, errors ]); + } + } + + }, 1000); + + + }); + }; + + init(); + }; + + // Inject a file or image in the preview + $.ezdz.prototype.preview = function(path, callback) { + var settings = this.settings, + $input = this.$input, + $ezdz = $input.parent('.' + settings.classes.main), + basename = path.replace(/\\/g,'/').replace( /.*\//, ''), + formatted = settings.format(basename); + + var img = new Image(); + img.src = path; + + // Is an image + img.onload = function() { + $ezdz.find('div').html($(img).fadeIn()); + + if ($.isFunction(callback)) { + callback.apply(this); + } + }; + + // Is not an image + img.onerror = function() { + $ezdz.find('div').html('' + formatted + ''); + + if ($.isFunction(callback)) { + callback.apply(this); + } + }; + + $ezdz.addClass(settings.classes.accept); + }; + + // Destroy ezdz + $.ezdz.prototype.destroy = function() { + var settings = this.settings, + $input = this.$input; + + $input.parent('.' + settings.classes.main).replaceWith($input); + $input.off('*.ezdz'); + $input.removeData('ezdz'); + }; + + // Extend settings + $.ezdz.prototype.options = function(options) { + var settings = this.settings; + + if (!options) { + return settings; + } + + $.extend(true, this.settings, options); + }; + + // Get input container + $.ezdz.prototype.container = function() { + var settings = this.settings, + $input = this.$input; + + return $input.parent('.' + settings.classes.main); + }; + + // Is browser compatible + $.ezdz.isBrowserCompatible = function() { + return !!(window.File && window.FileList && window.FileReader); + }; + + // Default options + $.ezdz.defaults = defaults; + + // jQuery plugin + $.fn.ezdz = function(options) { + var args = arguments, + plugin = $(this).data('ezdz'); + + if (!plugin) { + return $(this).data('ezdz', new $.ezdz(this, options)); + } if (plugin[options]) { + return plugin[options].apply(plugin, Array.prototype.slice.call(args, 1)); + } else { + $.error('Ezdz error - Method ' + options + ' does not exist.'); + } + }; +})); diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 07955ed9..c99a4c19 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -2360,7 +2360,7 @@ abstract class GlmDataAbstract } else { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error"); } @@ -2645,6 +2645,12 @@ abstract class GlmDataAbstract $this->select = ''; $sep = ''; // Used as separator for $select list + // Check that we have a fields list + if (!is_array($this->fields) || count($this->fields) == 0) { + echo "ALERT: Empty Fields List in data abstract buildFieldsList()! Likely programming error."; + return false; + } + // For each possible field reset($this->fields); while (list($k, $v) = each($this->fields )) { @@ -2701,7 +2707,7 @@ abstract class GlmDataAbstract } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($this->fieldData, 'DataBlock', "buildFieldsList() data"); } @@ -2895,7 +2901,7 @@ abstract class GlmDataAbstract $stats = $this->wpdb->get_row($sql, ARRAY_A); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getStats() query"); glmMembersAdmin::addNotice($stats, 'DataBlock', "Stats Data"); } @@ -2942,7 +2948,7 @@ abstract class GlmDataAbstract "; } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query"); } @@ -2958,7 +2964,7 @@ abstract class GlmDataAbstract $newList[$v['id']] = $this->processOutputData($v, 'l'); } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($newList, 'DataBlock', "getList() data"); } @@ -2997,7 +3003,7 @@ abstract class GlmDataAbstract $detail = $this->processOutputData($detail, 'g', $fieldVals); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query"); glmMembersAdmin::addNotice($detail, 'DataBlock', "getEntry() data"); } @@ -3128,7 +3134,7 @@ abstract class GlmDataAbstract // Check if there's a function to do other checks $r = $this->checkOther($r, 'n'); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($r, 'DataBlock', "newEntry() data"); } @@ -3206,42 +3212,40 @@ abstract class GlmDataAbstract ( $fields ) VALUES ( $vals ); "; - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "insertEntry() Query"); } // Now store the field data $this->wpdb->query($sql); - $queryError = $this->wpdb->last_error; - - // If there were no errors - if (trim($queryError) != '') { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + // Check for query errors + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + $queryError = $this->wpdb->last_error; + if (trim($queryError) != '') { glmMembersAdmin::addNotice( - 'insertEntry() Query Failure
    ' + 'insertEntry() Query Failure
    ' .'  Error Message: '.$queryError.'
    ' .'  Table: '.$this->table, 'Alert'); } } - // Get the current ID value and set that in the session $r['fieldData']['id'] = $this->wpdb->insert_id; } else { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice('  insertEntry() requested to NOT store new entry!', 'Process'); } } } else { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice('  checkOther() returned bad status.', 'Process'); } } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() data"); } @@ -3264,6 +3268,17 @@ abstract class GlmDataAbstract ;"; $detail = $this->wpdb->get_row($sql, ARRAY_A); + // Check for Errors + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + $queryError = $this->wpdb->last_error; + if (trim($queryError) != '') { + glmMembersAdmin::addNotice( + 'editEntry() Query Failure
    ' + .'  Error Message: '.$queryError.'
    ' + .'  Table: '.$this->table, 'Alert'); + } + } + // Check for failure retrieving data if (!$detail) { return false; @@ -3272,7 +3287,7 @@ abstract class GlmDataAbstract // Process individual fields $detail = $this->processOutputData($detail, 'e', true, $id, $idField); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query"); glmMembersAdmin::addNotice($detail, 'DataBlock', "editEntry() data"); } @@ -3346,12 +3361,23 @@ abstract class GlmDataAbstract // Now store the field data $this->wpdb->query($sql, ARRAY_A); + // Check for Errors + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + $queryError = $this->wpdb->last_error; + if (trim($queryError) != '') { + glmMembersAdmin::addNotice( + 'updateEntry() Query Failure
    ' + .'  Error Message: '.$queryError.'
    ' + .'  Table: '.$this->table, 'Alert'); + } + } + // Get the data again for output $r['fieldData'] = $this->getEntry($id, $idField); } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($r, 'DataBlock', "updateEntry() data"); } @@ -3406,7 +3432,7 @@ abstract class GlmDataAbstract WHERE $idField = $id; "; - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - deleteEntry() query"); } @@ -3421,7 +3447,7 @@ abstract class GlmDataAbstract } } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($detail, 'DataBlock', "deleteEntry() data"); } diff --git a/lib/html5-File-Upload/assets/css/styles.css b/lib/html5-File-Upload/assets/css/styles.css new file mode 100644 index 00000000..5f2545d4 --- /dev/null +++ b/lib/html5-File-Upload/assets/css/styles.css @@ -0,0 +1,256 @@ +/*------------------------- + Simple reset +--------------------------*/ + + +/* +*{ + margin:0; + padding:0; +} +*/ + + +/*------------------------- + General Styles +--------------------------*/ + +/* + +html{ + background:url('../img/background_tile_2.jpg'); + min-height:100%; + position:relative; + +} + +body{ + color:#fff; + min-height:600px; + font:14px/1.3 'Segoe UI',Arial, sans-serif; +} + +a, a:visited { + text-decoration:none; + outline:none; + color:#54a6de; +} + +a:hover{ + text-decoration:underline; +} + +header, footer{ + display:block; +} + +*/ + +/*------------------------- + Header Styles +--------------------------*/ + +/* + +header{ + background:url('../img/background_tile_1.jpg'); + padding:75px; + position: relative; +} + +header:before, +#dropbox:before{ + display: block; + content:''; + height:4px; + width:100%; + background:url('../img/blue_line.jpg'); + position: absolute; + top:0; + left:0; + box-shadow:0 2px 2px rgba(0,0,0,0.4); +} + + +h1{ + background:url('../img/logo.jpg') no-repeat top center; + height:92px; + overflow: hidden; + text-indent: -99999px; + text-align: center; +} + +*/ + +/*------------------------- + Dropbox Element +--------------------------*/ + + + +#dropbox{ +/* + background:url('../img/background_tile_3.jpg'); + + border-radius:3px; + position: relative; + margin:80px auto 90px; + min-height: 290px; + overflow: hidden; + padding-bottom: 40px; + width: 990px; + + box-shadow:0 0 4px rgba(0,0,0,0.3) inset,0 -3px 2px rgba(0,0,0,0.1); +*/ +} + + +#dropbox .message{ + font-size: 11px; + text-align: center; + padding-top:160px; + display: block; +} + +#dropbox .message i{ + color:#ccc; + font-size:10px; +} + +#dropbox:before{ + border-radius:3px 3px 0 0; +} + + + +/*------------------------- + Image Previews +--------------------------*/ + + + +#dropbox .preview{ + width:245px; + height: 215px; + float:left; + margin: 55px 0 0 60px; + position: relative; + text-align: center; +} + +#dropbox .preview img{ + max-width: 240px; + max-height:180px; + border:3px solid #fff; + display: block; + + box-shadow:0 0 2px #000; +} + +#dropbox .imageHolder{ + display: inline-block; + position:relative; +} + +#dropbox .uploaded{ + position: absolute; + top:0; + left:0; + height:100%; + width:100%; + background: url('../img/done.png') no-repeat center center rgba(255,255,255,0.5); + display: none; +} + +#dropbox .preview.done .uploaded{ + display: block; +} + + + +/*------------------------- + Progress Bars +--------------------------*/ + + + +#dropbox .progressHolder{ + position: absolute; + background-color:#252f38; + height:12px; + width:100%; + left:0; + bottom: 0; + + box-shadow:0 0 2px #000; +} + +#dropbox .progress{ + background-color:#2586d0; + position: absolute; + height:100%; + left:0; + width:0; + + box-shadow: 0 0 1px rgba(255, 255, 255, 0.4) inset; + + -moz-transition:0.25s; + -webkit-transition:0.25s; + -o-transition:0.25s; + transition:0.25s; +} + +#dropbox .preview.done .progress{ + width:100% !important; +} + + + +/*---------------------------- + The Footer +-----------------------------*/ + +/* + +footer{ + display:block; + background-color: #151517; + + position:fixed; + width:100%; + height:70px; + bottom:0; + left:0; + z-index: 100000; + + box-shadow: 0 -1px 2px #171717; + -webkit-box-shadow: 0 -1px 2px #171717; + -moz-box-shadow: 0 -1px 2px #171717; +} + +footer h2{ + font-size:20px; + font-weight:normal; + left:50%; + margin-left:-400px; + padding:22px 0; + position:absolute; + width: 540px; + color:#eee; +} + +footer a.tzine,a.tzine:visited{ + background:url("../img/tzine.png") no-repeat right top; + border:none; + text-decoration:none; + color:#FCFCFC; + font-size:12px; + height:70px; + left:50%; + line-height:31px; + margin:23px 0 0 110px; + position:absolute; + top:0; + width:290px; +} +*/ \ No newline at end of file diff --git a/lib/html5-File-Upload/assets/img/background_tile_1.jpg b/lib/html5-File-Upload/assets/img/background_tile_1.jpg new file mode 100644 index 00000000..ad83d30a Binary files /dev/null and b/lib/html5-File-Upload/assets/img/background_tile_1.jpg differ diff --git a/lib/html5-File-Upload/assets/img/background_tile_2.jpg b/lib/html5-File-Upload/assets/img/background_tile_2.jpg new file mode 100644 index 00000000..c7b5efc1 Binary files /dev/null and b/lib/html5-File-Upload/assets/img/background_tile_2.jpg differ diff --git a/lib/html5-File-Upload/assets/img/background_tile_3.jpg b/lib/html5-File-Upload/assets/img/background_tile_3.jpg new file mode 100644 index 00000000..ac39d60e Binary files /dev/null and b/lib/html5-File-Upload/assets/img/background_tile_3.jpg differ diff --git a/lib/html5-File-Upload/assets/img/blue_line.jpg b/lib/html5-File-Upload/assets/img/blue_line.jpg new file mode 100644 index 00000000..2af2c9f7 Binary files /dev/null and b/lib/html5-File-Upload/assets/img/blue_line.jpg differ diff --git a/lib/html5-File-Upload/assets/img/done.png b/lib/html5-File-Upload/assets/img/done.png new file mode 100644 index 00000000..22a14109 Binary files /dev/null and b/lib/html5-File-Upload/assets/img/done.png differ diff --git a/lib/html5-File-Upload/assets/img/logo.jpg b/lib/html5-File-Upload/assets/img/logo.jpg new file mode 100644 index 00000000..5c832523 Binary files /dev/null and b/lib/html5-File-Upload/assets/img/logo.jpg differ diff --git a/lib/html5-File-Upload/assets/img/tzine.png b/lib/html5-File-Upload/assets/img/tzine.png new file mode 100644 index 00000000..df4abaf9 Binary files /dev/null and b/lib/html5-File-Upload/assets/img/tzine.png differ diff --git a/lib/html5-File-Upload/assets/js/jquery.filedrop.js b/lib/html5-File-Upload/assets/js/jquery.filedrop.js new file mode 100644 index 00000000..ec2b238d --- /dev/null +++ b/lib/html5-File-Upload/assets/js/jquery.filedrop.js @@ -0,0 +1,315 @@ +/* + * Default text - jQuery plugin for html5 dragging files from desktop to browser + * + * Author: Weixi Yen + * + * Email: [Firstname][Lastname]@gmail.com + * + * Copyright (c) 2010 Resopollution + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * http://www.github.com/weixiyen/jquery-filedrop + * + * Version: 0.1.0 + * + * Features: + * Allows sending of extra parameters with file. + * Works with Firefox 3.6+ + * Future-compliant with HTML5 spec (will work with Webkit browsers and IE9) + * Usage: + * See README at project homepage + * + */ +(function($){ + + jQuery.event.props.push("dataTransfer"); + var opts = {}, + default_opts = { + url: '', + refresh: 1000, + paramname: 'userfile', + maxfiles: 25, + maxfilesize: 1, // MBs + data: {}, + drop: empty, + dragEnter: empty, + dragOver: empty, + dragLeave: empty, + docEnter: empty, + docOver: empty, + docLeave: empty, + beforeEach: empty, + afterAll: empty, + rename: empty, + error: function(err, file, i){alert(err);}, + uploadStarted: empty, + uploadFinished: empty, + progressUpdated: empty, + speedUpdated: empty + }, + errors = ["BrowserNotSupported", "TooManyFiles", "FileTooLarge"], + doc_leave_timer, + stop_loop = false, + files_count = 0, + files; + + $.fn.filedrop = function(options) { + opts = $.extend( {}, default_opts, options ); + + this.bind('drop', drop).bind('dragenter', dragEnter).bind('dragover', dragOver).bind('dragleave', dragLeave); + $(document).bind('drop', docDrop).bind('dragenter', docEnter).bind('dragover', docOver).bind('dragleave', docLeave); + }; + + function drop(e) { + opts.drop(e); + files = e.dataTransfer.files; + if (files === null || files === undefined) { + opts.error(errors[0]); + return false; + } + + files_count = files.length; + upload(); + e.preventDefault(); + return false; + } + + function getBuilder(filename, filedata, boundary) { + var dashdash = '--', + crlf = '\r\n', + builder = ''; + + $.each(opts.data, function(i, val) { + if (typeof val === 'function') val = val(); + builder += dashdash; + builder += boundary; + builder += crlf; + builder += 'Content-Disposition: form-data; name="'+i+'"'; + builder += crlf; + builder += crlf; + builder += val; + builder += crlf; + }); + + builder += dashdash; + builder += boundary; + builder += crlf; + builder += 'Content-Disposition: form-data; name="'+opts.paramname+'"'; + builder += '; filename="' + filename + '"'; + builder += crlf; + + builder += 'Content-Type: application/octet-stream'; + builder += crlf; + builder += crlf; + + builder += filedata; + builder += crlf; + + builder += dashdash; + builder += boundary; + builder += dashdash; + builder += crlf; + return builder; + } + + function progress(e) { + if (e.lengthComputable) { + var percentage = Math.round((e.loaded * 100) / e.total); + if (this.currentProgress != percentage) { + + this.currentProgress = percentage; + opts.progressUpdated(this.index, this.file, this.currentProgress); + + var elapsed = new Date().getTime(); + var diffTime = elapsed - this.currentStart; + if (diffTime >= opts.refresh) { + var diffData = e.loaded - this.startData; + var speed = diffData / diffTime; // KB per second + opts.speedUpdated(this.index, this.file, speed); + this.startData = e.loaded; + this.currentStart = elapsed; + } + } + } + } + + + + function upload() { + stop_loop = false; + if (!files) { + opts.error(errors[0]); + return false; + } + var filesDone = 0, + filesRejected = 0; + + if (files_count > opts.maxfiles) { + opts.error(errors[1]); + return false; + } + + for (var i=0; i max_file_size) { + opts.error(errors[2], files[i], i); + filesRejected++; + continue; + } + + reader.onloadend = send; + reader.readAsBinaryString(files[i]); + } else { + filesRejected++; + } + } catch(err) { + opts.error(errors[0]); + return false; + } + } + + function send(e) { + // Sometimes the index is not attached to the + // event object. Find it by size. Hack for sure. + if (e.target.index == undefined) { + e.target.index = getIndexBySize(e.total); + } + + var xhr = new XMLHttpRequest(), + upload = xhr.upload, + file = files[e.target.index], + index = e.target.index, + start_time = new Date().getTime(), + boundary = '------multipartformboundary' + (new Date).getTime(), + builder; + + newName = rename(file.name); + if (typeof newName === "string") { + builder = getBuilder(newName, e.target.result, boundary); + } else { + builder = getBuilder(file.name, e.target.result, boundary); + } + + upload.index = index; + upload.file = file; + upload.downloadStartTime = start_time; + upload.currentStart = start_time; + upload.currentProgress = 0; + upload.startData = 0; + upload.addEventListener("progress", progress, false); + + xhr.open("POST", opts.url, true); + xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + + boundary); + + xhr.sendAsBinary(builder); + + opts.uploadStarted(index, file, files_count); + + xhr.onload = function() { + if (xhr.responseText) { + var now = new Date().getTime(), + timeDiff = now - start_time, + result = opts.uploadFinished(index, file, jQuery.parseJSON(xhr.responseText), timeDiff); + filesDone++; + if (filesDone == files_count - filesRejected) { + afterAll(); + } + if (result === false) stop_loop = true; + } + }; + } + } + + function getIndexBySize(size) { + for (var i=0; i < files_count; i++) { + if (files[i].size == size) { + return i; + } + } + + return undefined; + } + + function rename(name) { + return opts.rename(name); + } + + function beforeEach(file) { + return opts.beforeEach(file); + } + + function afterAll() { + return opts.afterAll(); + } + + function dragEnter(e) { + clearTimeout(doc_leave_timer); + e.preventDefault(); + opts.dragEnter(e); + } + + function dragOver(e) { + clearTimeout(doc_leave_timer); + e.preventDefault(); + opts.docOver(e); + opts.dragOver(e); + } + + function dragLeave(e) { + clearTimeout(doc_leave_timer); + opts.dragLeave(e); + e.stopPropagation(); + } + + function docDrop(e) { + e.preventDefault(); + opts.docLeave(e); + return false; + } + + function docEnter(e) { + clearTimeout(doc_leave_timer); + e.preventDefault(); + opts.docEnter(e); + return false; + } + + function docOver(e) { + clearTimeout(doc_leave_timer); + e.preventDefault(); + opts.docOver(e); + return false; + } + + function docLeave(e) { + doc_leave_timer = setTimeout(function(){ + opts.docLeave(e); + }, 200); + } + + function empty(){} + + try { + if (XMLHttpRequest.prototype.sendAsBinary) return; + XMLHttpRequest.prototype.sendAsBinary = function(datastr) { + function byteValue(x) { + return x.charCodeAt(0) & 0xff; + } + var ords = Array.prototype.map.call(datastr, byteValue); + var ui8a = new Uint8Array(ords); + this.send(ui8a.buffer); + } + } catch(e) {} + +})(jQuery); \ No newline at end of file diff --git a/lib/html5-File-Upload/assets/js/upload-script.js b/lib/html5-File-Upload/assets/js/upload-script.js new file mode 100644 index 00000000..33410863 --- /dev/null +++ b/lib/html5-File-Upload/assets/js/upload-script.js @@ -0,0 +1,102 @@ +$(function(){ + + var dropbox = $('#dropbox'), + message = $('.message', dropbox); + + dropbox.filedrop({ + // The name of the $_FILES entry: + paramname:'pic', + + maxfiles: 5, + maxfilesize: 2, + url: 'post_file.php', + + uploadFinished:function(i,file,response){ + $.data(file).addClass('done'); + // response is the JSON object that post_file.php returns + }, + + error: function(err, file) { + switch(err) { + case 'BrowserNotSupported': + showMessage('Your browser does not support HTML5 file uploads!'); + break; + case 'TooManyFiles': + alert('Too many files! Please select 5 at most! (configurable)'); + break; + case 'FileTooLarge': + alert(file.name+' is too large! Please upload files up to 2mb (configurable).'); + break; + default: + break; + } + }, + + // Called before each upload is started + beforeEach: function(file){ + if(!file.type.match(/^image\//)){ + alert('Only images are allowed!'); + + // Returning false will cause the + // file to be rejected + return false; + } + }, + + uploadStarted:function(i, file, len){ + createImage(file); + }, + + progressUpdated: function(i, file, progress) { + $.data(file).find('.progress').width(progress); + } + + }); + + var template = '
    '+ + ''+ + ''+ + ''+ + ''+ + '
    '+ + '
    '+ + '
    '+ + '
    '; + + + function createImage(file){ + + var preview = $(template), + image = $('img', preview); + + var reader = new FileReader(); + + image.width = 100; + image.height = 100; + + reader.onload = function(e){ + + // e.target.result holds the DataURL which + // can be used as a source of the image: + + image.attr('src',e.target.result); + }; + + // Reading the file as a DataURL. When finished, + // this will trigger the onload function above: + reader.readAsDataURL(file); + + message.hide(); + preview.appendTo(dropbox); + + // Associating a preview container + // with the file, using jQuery's $.data(): + + $.data(file,preview); + } + + function showMessage(msg){ + message.html(msg); + } + +}); \ No newline at end of file diff --git a/lib/html5-File-Upload/post_file.php b/lib/html5-File-Upload/post_file.php new file mode 100644 index 00000000..c364f940 --- /dev/null +++ b/lib/html5-File-Upload/post_file.php @@ -0,0 +1,59 @@ +$str)); + exit; +} + +function get_extension($file_name){ + $ext = explode('.', $file_name); + $ext = array_pop($ext); + return strtolower($ext); +} +?> \ No newline at end of file diff --git a/lib/html5-File-Upload/sample-index.html b/lib/html5-File-Upload/sample-index.html new file mode 100644 index 00000000..50aa0319 --- /dev/null +++ b/lib/html5-File-Upload/sample-index.html @@ -0,0 +1,41 @@ + + + + + HTML5 File Drag and Drop Upload with jQuery and PHP | Tutorialzine Demo + + + + + + + + + +
    +

    HTML5 File Upload with jQuery and PHP

    +
    + +
    + Drop images here to upload.
    (they will only be visible to you)
    +
    + + + + + + + + + + + + + + + diff --git a/misc/databaseScripts/create_database_V0.1.sql b/misc/databaseScripts/create_database_V0.1.sql index 885865dc..89de3ff5 100644 --- a/misc/databaseScripts/create_database_V0.1.sql +++ b/misc/databaseScripts/create_database_V0.1.sql @@ -259,10 +259,10 @@ CREATE TABLE {prefix}golf ( CREATE TABLE {prefix}images ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, + status TINYINT(1) NULL, file_name TINYTEXT NULL, descr TEXT NULL, caption TINYTEXT NULL, - pending TINYINT(1) NULL, position INT NULL, ref_type INT NULL, ref_dest INT NULL, @@ -475,85 +475,253 @@ CREATE TABLE {prefix}restaurants ( CREATE TABLE {prefix}settings_general ( id INT NOT NULL AUTO_INCREMENT, - admin_debug BOOLEAN NULL, - admin_debug_verbose BOOLEAN NULL, - front_debug BOOLEAN NULL, - front_debug_verbose BOOLEAN NULL, - google_maps_api_key TINYTEXT NULL, - maps_default_lat FLOAT NULL, - maps_default_lon FLOAT NULL, + admin_debug BOOLEAN DEFAULT true, + admin_debug_verbose BOOLEAN DEFAULT false, + front_debug BOOLEAN DEFAULT false, + front_debug_verbose BOOLEAN DEFAULT false, + google_maps_api_key TINYTEXT DEFAULT '', + maps_default_lat FLOAT DEFAULT 45.3749, + maps_default_lon FLOAT DEFAULT -84.9592, time_zone TINYTEXT NULL, - list_show_map BOOLEAN NULL, - list_show_list BOOLEAN NULL, - list_show_search BOOLEAN NULL, - list_show_search_text BOOLEAN NULL, - list_show_search_category BOOLEAN NULL, - list_show_search_amenities BOOLEAN NULL, - list_show_search_alphja BOOLEAN NULL, - list_show_detail_link BOOLEAN NULL, - list_show_logo BOOLEAN NULL, + list_show_map BOOLEAN DEFAULT true, + list_show_list BOOLEAN DEFAULT true, + list_show_search BOOLEAN DEFAULT true, + list_show_search_text BOOLEAN DEFAULT true, + list_show_search_category BOOLEAN DEFAULT true, + list_show_search_amenities BOOLEAN DEFAULT true, + list_show_search_alpha BOOLEAN DEFAULT true, + list_show_detail_link BOOLEAN DEFAULT true, + list_show_logo BOOLEAN DEFAULT true, list_logo_size TINYTEXT NULL, - list_show_address BOOLEAN NULL, - list_show_street BOOLEAN NULL, - list_show_citystatezip BOOLEAN NULL, - list_show_country BOOLEAN NULL, - list_show_region BOOLEAN NULL, - list_show_descr BOOLEAN NULL, - list_show_short_descr BOOLEAN NULL, - list_show_phone BOOLEAN NULL, - list_show_tollfree BOOLEAN NULL, - list_show_url BOOLEAN NULL, - list_show_url_newtarget BOOLEAN NULL, - list_show_categories BOOLEAN NULL, - list_show_creditcards BOOLEAN NULL, - list_show_amenities BOOLEAN NULL, - list_map_show_detaillink BOOLEAN NULL, - list_map_show_logo BOOLEAN NULL, + list_show_address BOOLEAN DEFAULT true, + list_show_street BOOLEAN DEFAULT true, + list_show_citystatezip BOOLEAN DEFAULT true, + list_show_country BOOLEAN DEFAULT true, + list_show_region BOOLEAN DEFAULT true, + list_show_descr BOOLEAN DEFAULT false, + list_show_short_descr BOOLEAN DEFAULT true, + list_show_phone BOOLEAN DEFAULT true, + list_show_tollfree BOOLEAN DEFAULT true, + list_show_url BOOLEAN DEFAULT true, + list_show_url_newtarget BOOLEAN DEFAULT true, + list_show_categories BOOLEAN DEFAULT true, + list_show_creditcards BOOLEAN DEFAULT true, + list_show_amenities BOOLEAN DEFAULT false, + list_map_show_detaillink BOOLEAN DEFAULT true, + list_map_show_logo BOOLEAN DEFAULT false, list_map_logo_size TINYTEXT NULL, - list_map_show_description BOOLEAN NULL, - list_map_show_short_description BOOLEAN NULL, - list_map_show_address BOOLEAN NULL, - list_map_show_street BOOLEAN NULL, - list_map_show_citystatezip BOOLEAN NULL, - list_map_show_country BOOLEAN NULL, - list_map_show_region BOOLEAN NULL, - list_map_show_phone BOOLEAN NULL, - list_map_show_tollfree BOOLEAN NULL, - list_map_show_url BOOLEAN NULL, - list_map_show_url_newtarget BOOLEAN NULL, - list_map_show_categories BOOLEAN NULL, - list_map_show_creditcards BOOLEAN NULL, - list_map_show_amenities BOOLEAN NULL, - detail_show_map BOOLEAN NULL, - detail_show_directions BOOLEAN NULL, - detail_show_logo BOOLEAN NULL, - detail_show_logo_size TINYTEXT NULL, - detail_show_description BOOLEAN NULL, - detail_show_short_description BOOLEAN NULL, - detail_show_address BOOLEAN NULL, - detail_show_street BOOLEAN NULL, - detail_show_citystatezip BOOLEAN NULL, - detail_show_country BOOLEAN NULL, - detail_show_region BOOLEAN NULL, - detail_show_phone BOOLEAN NULL, - detail_show_tollfree BOOLEAN NULL, - detail_show_url BOOLEAN NULL, - detail_show_url_newtarget BOOLEAN NULL, - detail_show_categories BOOLEAN NULL, - detail_show_creditcards BOOLEAN NULL, - detail_show_amenities BOOLEAN NULL, + list_map_show_descr BOOLEAN DEFAULT false, + list_map_show_short_descr BOOLEAN DEFAULT true, + list_map_show_address BOOLEAN DEFAULT true, + list_map_show_street BOOLEAN DEFAULT true, + list_map_show_citystatezip BOOLEAN DEFAULT true, + list_map_show_country BOOLEAN DEFAULT true, + list_map_show_region BOOLEAN DEFAULT true, + list_map_show_phone BOOLEAN DEFAULT true, + list_map_show_tollfree BOOLEAN DEFAULT true, + list_map_show_url BOOLEAN DEFAULT true, + list_map_show_url_newtarget BOOLEAN DEFAULT true, + list_map_show_categories BOOLEAN DEFAULT false, + list_map_show_creditcards BOOLEAN DEFAULT false, + list_map_show_amenities BOOLEAN DEFAULT false, + detail_show_map BOOLEAN DEFAULT true, + detail_show_directions BOOLEAN DEFAULT true, + detail_show_logo BOOLEAN DEFAULT true, + detail_logo_size TINYTEXT NULL, + detail_show_descr BOOLEAN DEFAULT true, + detail_show_short_descr BOOLEAN DEFAULT false, + detail_show_address BOOLEAN DEFAULT true, + detail_show_street BOOLEAN DEFAULT true, + detail_show_citystatezip BOOLEAN DEFAULT true, + detail_show_country BOOLEAN DEFAULT true, + detail_show_region BOOLEAN DEFAULT true, + detail_show_phone BOOLEAN DEFAULT true, + detail_show_tollfree BOOLEAN DEFAULT true, + detail_show_url BOOLEAN DEFAULT true, + detail_show_url_newtarget BOOLEAN DEFAULT true, + detail_show_categories BOOLEAN DEFAULT true, + detail_show_creditcards BOOLEAN DEFAULT true, + detail_show_amenities BOOLEAN DEFAULT true, + detail_map_show_logo BOOLEAN DEFAULT false, + detail_map_logo_size TINYTEXT NULL, + detail_map_show_descr BOOLEAN DEFAULT false, + detail_map_show_short_descr BOOLEAN DEFAULT true, + detail_map_show_address BOOLEAN DEFAULT true, + detail_map_show_street BOOLEAN DEFAULT true, + detail_map_show_citystatezip BOOLEAN DEFAULT true, + detail_map_show_country BOOLEAN DEFAULT true, + detail_map_show_region BOOLEAN DEFAULT true, + detail_map_show_phone BOOLEAN DEFAULT true, + detail_map_show_tollfree BOOLEAN DEFAULT true, + detail_map_show_url BOOLEAN DEFAULT true, + detail_map_show_url_newtarget BOOLEAN DEFAULT true, + detail_map_show_categories BOOLEAN DEFAULT false, + detail_map_show_creditcards BOOLEAN DEFAULT false, + detail_map_show_amenities BOOLEAN DEFAULT false, PRIMARY KEY (id) ); ---- +INSERT INTO {prefix}settings_general + ( id, time_zone ) + VALUES + ( 1, 'America/Detroit' ) +; + +---- + CREATE TABLE {prefix}settings_terms ( id INT NOT NULL AUTO_INCREMENT, + term_admin_menu_members TINYTEXT NULL, + term_admin_menu_member_list TINYTEXT NULL, + term_admin_menu_member TINYTEXT NULL, + term_admin_menu_configure TINYTEXT NULL, + term_admin_menu_settings TINYTEXT NULL, + term_admin_menu_shortcodes TINYTEXT NULL, + term_admin_menu_members_dashboard TINYTEXT NULL, + term_admin_menu_members_list TINYTEXT NULL, + term_admin_menu_members_reports TINYTEXT NULL, + term_admin_menu_member_dashboard TINYTEXT NULL, + term_admin_menu_member_info TINYTEXT NULL, + term_admin_menu_member_locations TINYTEXT NULL, + term_admin_menu_member_facilities TINYTEXT NULL, + term_admin_menu_member_attractions TINYTEXT NULL, + term_admin_menu_member_contacts TINYTEXT NULL, + term_admin_menu_configure_member_types TINYTEXT NULL, + term_admin_menu_configure_member_cats TINYTEXT NULL, + term_admin_menu_configure_accom_types TINYTEXT NULL, + term_admin_menu_configure_amenities TINYTEXT NULL, + term_admin_menu_configure_cities TINYTEXT NULL, + term_admin_menu_configure_regions TINYTEXT NULL, + term_admin_menu_settings_general TINYTEXT NULL, + term_admin_menu_settings_terms TINYTEXT NULL, + term_admin_menu_settings_development TINYTEXT NULL, + term_member TINYTEXT NULL, + term_member_cap TINYTEXT NULL, + term_member_plur TINYTEXT NULL, + term_member_plur_cap TINYTEXT NULL, + term_location TINYTEXT NULL, + term_location_cap TINYTEXT NULL, + term_location_plur TINYTEXT NULL, + term_location_plur_cap TINYTEXT NULL, + term_facility TINYTEXT NULL, + term_facility_cap TINYTEXT NULL, + term_facility_plur TINYTEXT NULL, + term_facility_plur_cap TINYTEXT NULL, + term_attraction TINYTEXT NULL, + term_attraction_cap TINYTEXT NULL, + term_attraction_plur TINYTEXT NULL, + term_attraction_plur_cap TINYTEXT NULL, + term_contact TINYTEXT NULL, + term_contact_cap TINYTEXT NULL, + term_contact_plur TINYTEXT NULL, + term_contact_plur_cap TINYTEXT NULL, PRIMARY KEY (id) ); ---- +INSERT INTO {prefix}settings_terms + ( + id, + term_admin_menu_members, + term_admin_menu_member_list, + term_admin_menu_member, + term_admin_menu_configure, + term_admin_menu_settings, + term_admin_menu_shortcodes, + term_admin_menu_members_dashboard, + term_admin_menu_members_list, + term_admin_menu_members_reports, + term_admin_menu_member_dashboard, + term_admin_menu_member_info, + term_admin_menu_member_locations, + term_admin_menu_member_facilities, + term_admin_menu_member_attractions, + term_admin_menu_member_contacts, + term_admin_menu_configure_member_types, + term_admin_menu_configure_member_cats, + term_admin_menu_configure_accom_types, + term_admin_menu_configure_amenities, + term_admin_menu_configure_cities, + term_admin_menu_configure_regions, + term_admin_menu_settings_general, + term_admin_menu_settings_terms, + term_admin_menu_settings_development, + term_member, + term_member_cap, + term_member_plur, + term_member_plur_cap, + term_location, + term_location_cap, + term_location_plur, + term_location_plur_cap, + term_facility, + term_facility_cap, + term_facility_plur, + term_facility_plur_cap, + term_attraction, + term_attraction_cap, + term_attraction_plur, + term_attraction_plur_cap, + term_contact, + term_contact_cap, + term_contact_plur, + term_contact_plur_cap + ) + VALUES + ( + 1, + 'Members', + 'Member', + 'Add Member', + 'Configure', + 'Settings', + 'Shortcodes', + 'Dashboard', + 'Member List', + 'Reports', + 'Member Dashboard', + 'Member Info', + 'Locations', + 'Facilities', + 'Attractions', + 'Contacts', + 'Member Types', + 'Member Categories', + 'Accommodation Types', + 'Amenities', + 'Cities', + 'Regions', + 'General Settings', + 'Terms & Phrases', + 'Development', + 'member', + 'Member', + 'members', + 'Members', + 'location', + 'Location', + 'locations', + 'Locations', + 'facility', + 'Facility', + 'facilities', + 'Facilities', + 'attraction', + 'Attraction', + 'attractions', + 'Attractions', + 'contact', + 'Contact', + 'contacts', + 'Contacts' + ) +; + +---- + CREATE TABLE {prefix}social_media ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, diff --git a/misc/notes.txt b/misc/notes.txt index 968827cb..703863df 100644 --- a/misc/notes.txt +++ b/misc/notes.txt @@ -1,6 +1,17 @@ Development Notes ----------------- +Database Updates + +* Added table settings_general +* Added table settings_terms +* ALTER TABLE wp_glm_members_images CHANGE pending status tinyint; + + +TO-DO + +* Check all current_user_can() calls to make sure they're for the right capability. + ADMIN AREA * Consider paginating certain lists diff --git a/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php b/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php index d206596e..f2747bd7 100644 --- a/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php +++ b/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '081a36d97cdf30d438a1e104c26a275acc180da0' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html', - 1 => 1426001139, + 1 => 1434727132, 2 => 'file', ), ), @@ -22,8 +22,10 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'haveMemberTypes' => 0, 'thisURL' => 0, 'haveCategories' => 0, - 'haveRegions' => 0, 'haveAccommodationTypes' => 0, + 'haveAmenities' => 0, + 'haveCities' => 0, + 'haveRegions' => 0, 'numbMembers' => 0, 'membersPending' => 0, 'pendingList' => 0, @@ -42,7 +44,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( You do not have any Member Types setup. Click here to add Member Types. +?page=glm-members-admin-menu-configure&glm_action=index">Click here to add Member Types. tpl_vars['haveCategories']->value) {?> @@ -52,21 +54,36 @@ $_valid = $_smarty_tpl->decodeProperties(array ( ?page=glm-members-admin-menu-configure&glm_action=categories">Click here to add Member Categories. -tpl_vars['haveRegions']->value) {?> +tpl_vars['haveAccommodationTypes']->value) {?> - You do not have any Regions setup. + You do not have any Accommodation Types setup. Click here to add Regions. +?page=glm-members-admin-menu-configure&glm_action=accommodationTypes">Click here to add Accommodation Types. -tpl_vars['haveAccommodationTypes']->value) {?> +tpl_vars['haveAmenities']->value) {?> + + You do not have any Amenities setup. + Click here to add Amenities. + + +tpl_vars['haveCities']->value) {?> - You do not have any AccommodationTypes setup. + You do not have any Cities setup. Click here to add AccommodationTypes. +?page=glm-members-admin-menu-configure&glm_action=cities">Click here to add Cities. + + +tpl_vars['haveRegions']->value) {?> + + You do not have any Regions setup. + Click here to add Regions. tpl_vars['numbMembers']->value==0) {?> +   You do not have any members listed. + tpl_vars["i"])) {$_smarty_tpl->tpl_vars["i"] = clone $_smarty_tpl->tpl_vars["i"]; +$_smarty_tpl->tpl_vars["i"]->value = "0"; $_smarty_tpl->tpl_vars["i"]->nocache = null; $_smarty_tpl->tpl_vars["i"]->scope = 0; +} else $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?> tpl_vars['p'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['p']->_loop = false; $_from = $_smarty_tpl->tpl_vars['pendingList']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');} foreach ($_from as $_smarty_tpl->tpl_vars['p']->key => $_smarty_tpl->tpl_vars['p']->value) { diff --git a/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php b/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php index 8c5bfbf3..1a982780 100644 --- a/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php +++ b/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '47fb9b803e7138d215645f3c977b0b1dc2a9e718' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html', - 1 => 1433354735, + 1 => 1434554103, 2 => 'file', ), ), @@ -56,7 +56,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (

    * Required

    Cancel - +
    diff --git a/misc/smarty/templates_c/60cbe99d19bbec013cbca4d9344f2fd4a4152f52.file.index.html.php b/misc/smarty/templates_c/60cbe99d19bbec013cbca4d9344f2fd4a4152f52.file.index.html.php index b511d05f..9a2aeee7 100644 --- a/misc/smarty/templates_c/60cbe99d19bbec013cbca4d9344f2fd4a4152f52.file.index.html.php +++ b/misc/smarty/templates_c/60cbe99d19bbec013cbca4d9344f2fd4a4152f52.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '60cbe99d19bbec013cbca4d9344f2fd4a4152f52' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/index.html', - 1 => 1421691086, + 1 => 1434209562, 2 => 'file', ), ), @@ -15,9 +15,9 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'function' => array ( ), - 'has_nocache_code' => false, 'version' => 'Smarty-3.1.21-dev', 'unifunc' => 'content_54c086b3b1dd65_92948708', + 'has_nocache_code' => false, ),false); /*/%%SmartyHeaderCode%%*/?> getSubTemplate ('admin/error/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?> diff --git a/models/admin/dashboardWidget/index.php b/models/admin/dashboardWidget/index.php index 3aec7c43..d7840282 100644 --- a/models/admin/dashboardWidget/index.php +++ b/models/admin/dashboardWidget/index.php @@ -119,18 +119,30 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers $categoriesStats = $Categories->getStats(); $haveCategories = ($categoriesStats > 0); - // Check for required Regions - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'); - $Regions = new GlmDataRegions($this->wpdb, $this->config); - $regionsStats = $Regions->getStats(); - $haveRegions = ($regionsStats > 0); - // Check for required Accommodation Types require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php'); $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config); $accommodationTypesStats = $AccommodationTypes->getStats(); $haveAccommodationTypes = ($accommodationTypesStats > 0); + // Check for required Amenities + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); + $Amenities = new GlmDataAmenities($this->wpdb, $this->config); + $amenitiesStats = $Amenities->getStats(); + $haveAmenities = ($amenitiesStats > 0); + + // Check for required Cities + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'); + $Cities = new GlmDataCities($this->wpdb, $this->config); + $citiesStats = $Cities->getStats(); + $haveCities = ($citiesStats > 0); + + // Check for required Regions + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'); + $Regions = new GlmDataRegions($this->wpdb, $this->config); + $regionsStats = $Regions->getStats(); + $haveRegions = ($regionsStats > 0); + // Get number of member information records with pending updates require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'); $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); @@ -149,8 +161,10 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers 'membersPending' => $membersPending, 'haveMemberTypes' => $haveMemberTypes, 'haveCategories' => $haveCategories, - 'haveRegions' => $haveRegions, 'haveAccommodationTypes' => $haveAccommodationTypes, + 'haveAmenities' => $haveAmenities, + 'haveRegions' => $haveRegions, + 'haveCities' => $haveCities, 'pendingList' => $pendingList ); diff --git a/models/admin/member/memberImage.php b/models/admin/member/memberImage.php new file mode 100644 index 00000000..668cc511 --- /dev/null +++ b/models/admin/member/memberImage.php @@ -0,0 +1,137 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Members data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php'); + +/* + * This class performs the work of handling images passed to it via + * an AJAX call that goes through the WorPress AJAX Handler. + * + */ +class GlmMembersAdmin_member_memberImage extends GlmDataImages +{ + + /** + * 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) + { + + $return = array( + 'status' => false, // Assume we didn't get files or nothing works + 'files' => false, // Provide submitted data along with stored image data + 'message' => false + ); + + + // Check for uploaded files + if (!isset($_FILES) || count($_FILES) == 0) { + $return['message'] = 'No image file provided!'; + echo json_encode($return); + die(); + } + + // Include the incoming files data + $files = $_FILES; + + // Check for Member Info record ID + if (!isset($_REQUEST['memberInfoID']) || trim($_REQUEST['memberInfoID']) == '') { + $return['message'] = 'No Member Info Record ID provided!'; + echo json_encode($return); + die(); + } +echo "memberInfoID = ".$_REQUEST['memberInfoID']."\n\n"; + // Store each file away + + // Add stored image to return data + + // Return stored image data + echo json_encode($return); + die(); + } + + +} +?> diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index 95735c3b..19cdeb85 100644 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -60,39 +60,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo // Run constructor for members data class parent::__construct(false, false); - // Add scrips and css - add_action('glm_members_memberInfo_enqueue_scripts', - array( - $this, - 'glmMembersMemberInfoScripts' - ) - ); - - - } - - /** - * Setup inclusion of needed scripts - * - * This method is called by an add_action() hook setup in the contructor. - * - * (no prameters) - * - * @return void - * @access public - */ - public function glmMembersMemberInfoScripts () - { -/* Not working at this time - // Enqueue Geolocation Edit Script - wp_register_script('glm-members-geo-js', - GLM_MEMBERS_PLUGIN_URL . 'js/geolocation-edit/jquery.geolocation.edit.0.0.11.js', - array( - 'jquery' - ) - ); - wp_enqueue_script('glm-members-geo-js'); -*/ } /* @@ -137,6 +104,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo $haveMember = false; $memberInfoID = 0; $haveMemberInfo = false; + $haveImageGallery = false; $isActive = false; $noActive = false; $categories = false; @@ -296,11 +264,19 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo // Edit the existing member $memberInfo = $this->editEntry($memberInfoID); - // If we have member data, say so + // If we have member data if (is_array($memberInfo) && $memberInfo['status']) { + // Say we do $haveMemberInfo = true; + // Also get any image gallery images + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php'); + $Images = new GlmDataImages($this->wpdb, $this->config); + $imageGallery = $Images->getGallery($this->config['ref_type_numb']['Member'], $memberInfoID); + + $haveImageGallery = ($imageGallery != false); + // Otherwise } else { diff --git a/models/admin/members/index.php b/models/admin/members/index.php index caee4bdc..73ca9ca9 100644 --- a/models/admin/members/index.php +++ b/models/admin/members/index.php @@ -115,18 +115,30 @@ class GlmMembersAdmin_members_index extends GlmDataMembers $categoriesStats = $Categories->getStats(); $haveCategories = ($categoriesStats > 0); - // Check for required Regions - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'); - $Regions = new GlmDataRegions($this->wpdb, $this->config); - $regionsStats = $Regions->getStats(); - $haveRegions = ($regionsStats > 0); - // Check for required Accommodation Types require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php'); $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config); $accommodationTypesStats = $AccommodationTypes->getStats(); $haveAccommodationTypes = ($accommodationTypesStats > 0); + // Check for required Amenities + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); + $Amenities = new GlmDataAmenities($this->wpdb, $this->config); + $amenitiesStats = $Amenities->getStats(); + $haveAmenities = ($amenitiesStats > 0); + + // Check for required Cities + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'); + $Cities = new GlmDataCities($this->wpdb, $this->config); + $citiesStats = $Cities->getStats(); + $haveCities = ($citiesStats > 0); + + // Check for required Regions + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'); + $Regions = new GlmDataRegions($this->wpdb, $this->config); + $regionsStats = $Regions->getStats(); + $haveRegions = ($regionsStats > 0); + // Get number of member information records with pending updates require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'); $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); @@ -145,8 +157,10 @@ class GlmMembersAdmin_members_index extends GlmDataMembers 'membersPending' => $membersPending, 'haveMemberTypes' => $haveMemberTypes, 'haveCategories' => $haveCategories, - 'haveRegions' => $haveRegions, 'haveAccommodationTypes' => $haveAccommodationTypes, + 'haveAmenities' => $haveAmenities, + 'haveRegions' => $haveRegions, + 'haveCities' => $haveCities, 'pendingList' => $pendingList ); diff --git a/models/admin/settings/index.php b/models/admin/settings/index.php index e5645f52..e0bb79d5 100644 --- a/models/admin/settings/index.php +++ b/models/admin/settings/index.php @@ -13,12 +13,15 @@ * @version 0.1 */ +// Load Members data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsGeneral.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 +class GlmMembersAdmin_settings_index extends GlmDataSettingsGeneral { /** @@ -54,6 +57,9 @@ class GlmMembersAdmin_settings_index // Save plugin configuration object $this->config = $config; + // Run constructor for members data class + parent::__construct(false, false); + } /* @@ -92,13 +98,74 @@ class GlmMembersAdmin_settings_index */ public function modelAction ($actionData = 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')) { + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'User does not have rights to make configuration changes.' + ) + ); + } + + // Check for submission option + $option = ''; + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { + $option = $_REQUEST['option']; + } + + switch($option) { + + // Update the settings and redisplay the form + case 'submit': + + // Update the general settings + $generalSettings = $this->updateEntry(1); + + // Display admin message that the data has been updated + glmMembersAdmin::addNotice('General Settings for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice'); + + break; + + // Default is to get the current settings and display the form + default: + + // Try to get the first (should be only) entry for general settings. + $generalSettings = $this->editEntry($id); + + if ($generalSettings === false) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("  /modesl/admin/settings/index.php: Unable to load General Settings.", 'Alert'); + } + + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'Unable to create general settings entry in database.' + ) + ); + } + + break; - // Determine if current user can add, edit, delete member data - $canEdit = current_user_can('glm_members_edit'); + } // Compile template data $templateData = array( - 'canEdit' => $canEdit + 'reason' => '', + 'settings' => $generalSettings, + 'timezones' => DateTimeZone::listIdentifiers() +// 'canEdit' => $canEdit ); // Return status, suggested view, and data to controller diff --git a/models/admin/settings/terms.php b/models/admin/settings/terms.php new file mode 100644 index 00000000..9db4ce66 --- /dev/null +++ b/models/admin/settings/terms.php @@ -0,0 +1,184 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Members data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsTerms.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_terms extends GlmDataSettingsTerms +{ + + /** + * 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) + { + // 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')) { + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'User does not have rights to make configuration changes.' + ) + ); + } + + // Check for submission option + $option = ''; + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { + $option = $_REQUEST['option']; + } + + switch($option) { + + // Update the settings and redisplay the form + case 'submit': + + // Update the general settings + $termsSettings = $this->updateEntry(1); + + // Display admin message that the data has been updated + glmMembersAdmin::addNotice('Terms Settings for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice'); + + break; + + // Default is to get the current settings and display the form + default: + + // Try to get the first (should be only) entry for general settings. + $termsSettings = $this->editEntry($id); + + // Check that we actually have the terms + if ($termsSettings === false) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("/modesl/admin/settings/terms.php: Unable to load Terms Settings.", 'Alert'); + } + + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'Unable to create terms settings entry in database.' + ) + ); + } + + break; + + } + + // Compile template data + $templateData = array( + 'reason' => '', + 'settings' => $termsSettings, +// 'canEdit' => $canEdit + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => true, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/settings/terms.html', + 'data' => $templateData + ); + + } + +} + +?> \ No newline at end of file diff --git a/views/admin/configure/accommodationTypes.html b/views/admin/configure/accommodationTypes.html index 8e78a956..0f1839db 100644 --- a/views/admin/configure/accommodationTypes.html +++ b/views/admin/configure/accommodationTypes.html @@ -28,7 +28,7 @@

    * Required

    Cancel - + diff --git a/views/admin/configure/amenities.html b/views/admin/configure/amenities.html index 4e765618..ea5088c0 100644 --- a/views/admin/configure/amenities.html +++ b/views/admin/configure/amenities.html @@ -43,7 +43,7 @@

    * Required

    Cancel - + diff --git a/views/admin/configure/categories.html b/views/admin/configure/categories.html index c816db0d..7ede7f0b 100644 --- a/views/admin/configure/categories.html +++ b/views/admin/configure/categories.html @@ -44,7 +44,7 @@

    * Required

    Cancel - + diff --git a/views/admin/configure/cities.html b/views/admin/configure/cities.html index 789f0361..892fca5e 100644 --- a/views/admin/configure/cities.html +++ b/views/admin/configure/cities.html @@ -45,7 +45,7 @@

    * Required

    Cancel - + diff --git a/views/admin/configure/index.html b/views/admin/configure/index.html index 0cbedb6d..b188b6d2 100644 --- a/views/admin/configure/index.html +++ b/views/admin/configure/index.html @@ -23,7 +23,7 @@

    * Required

    Cancel - + diff --git a/views/admin/configure/regions.html b/views/admin/configure/regions.html index c4cb6e85..0475d072 100644 --- a/views/admin/configure/regions.html +++ b/views/admin/configure/regions.html @@ -28,7 +28,7 @@

    * Required

    Cancel - + diff --git a/views/admin/dashboardWidget/index.html b/views/admin/dashboardWidget/index.html index 2b927590..953e5f60 100644 --- a/views/admin/dashboardWidget/index.html +++ b/views/admin/dashboardWidget/index.html @@ -20,18 +20,30 @@ Add {/if} -{if !$haveRegions} - - No Regions - Add - -{/if} {if !$haveAccommodationTypes} No Accommodation Types Add {/if} +{if !$haveAmenities} + + No Amenities + Add + +{/if} +{if !$haveCities} + + No Cities + Add + +{/if} +{if !$haveRegions} + + No Regions + Add + +{/if} {if $numbMembers == 0} No Members diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index de2d17b2..eaa60c0e 100644 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -2,6 +2,10 @@ + + {if $haveMemberInfo}
    Archive this Member Information
    @@ -95,7 +99,8 @@ // 'media_buttons' => true, // 'quicktags' => false, 'wpautop' => false, - 'textarea_name' => 'descr', + 'textarea_name' => 'descr', + 'editor_height' => 200, // Height in px, overrides editor_rows // 'textarea_rows' => 8 )); @@ -359,11 +364,66 @@ {if $memberInfo.fieldFail.notes}

    {$memberInfo.fieldFail.notes}

    {/if} + + Image Gallery + + +
    +
    +
    + +
    Drag and drop new images here
    +
    HTML5 file drag-and-drop not supported by your browser.
    Use "Browse" button above to upload an image.
    +
    + +

    * Required

    + - + + + + + + + diff --git a/views/admin/members/index.html b/views/admin/members/index.html index 7279dd65..0e4a33d4 100644 --- a/views/admin/members/index.html +++ b/views/admin/members/index.html @@ -6,7 +6,7 @@ {if !$haveMemberTypes} You do not have any Member Types setup. - Click here to add Member Types. + Click here to add Member Types. {/if} {if !$haveCategories} @@ -15,19 +15,32 @@ Click here to add Member Categories. {/if} -{if !$haveRegions} +{if !$haveAccommodationTypes} - You do not have any Regions setup. - Click here to add Regions. + You do not have any Accommodation Types setup. + Click here to add Accommodation Types. {/if} -{if !$haveAccommodationTypes} +{if !$haveAmenities} + + You do not have any Amenities setup. + Click here to add Amenities. + +{/if} +{if !$haveCities} - You do not have any AccommodationTypes setup. - Click here to add AccommodationTypes. + You do not have any Cities setup. + Click here to add Cities. + +{/if} +{if !$haveRegions} + + You do not have any Regions setup. + Click here to add Regions. {/if} {if $numbMembers == 0} +   You do not have any members listed. Click here to create your first member. diff --git a/views/admin/settings/header.html b/views/admin/settings/header.html index a2ac3396..fdf136d4 100644 --- a/views/admin/settings/header.html +++ b/views/admin/settings/header.html @@ -4,6 +4,7 @@
    diff --git a/views/admin/settings/index.html b/views/admin/settings/index.html index 27995976..5e55233a 100644 --- a/views/admin/settings/index.html +++ b/views/admin/settings/index.html @@ -1,7 +1,296 @@ {include file='admin/settings/header.html'} -

    General Settings

    - -

    General settings go here.

    +

    *** Not using these settings yet! ***

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Debug Settings

    Admin Debug Information: + +
    Admin Debug Verbose: + +
    Front-End Debug Information: + +
    Front-End Debug Verbose: + +

    Misc. Settings

    Google Maps API Key: + + {if $settings.fieldFail.google_maps_api_key}

    {$settings.fieldFail.google_maps_api_key}

    {/if} +
    Optional: See Google Maps JAVAscript API V3 documentation for information. +
    Default Map Location: + +
    + + +
    Please enter values in decimal degrees. + {if $settings.fieldFail.maps_default_lat}

    {$settings.fieldFail.maps_default_lat}

    {/if} + {if $settings.fieldFail.maps_default_lon}

    {$settings.fieldFail.maps_default_lon}

    {/if} +
    Time Zone: + + {if $settings.fieldFail.time_zone}

    {$settings.fieldFail.time_zone}

    {/if} +

    Member List Page Options

    Show Map: + +
    Map Options: + + + + + + + + + + + + + + + + + + + + + + + + + +
    Show Member Name as Link to Detail:
    Show Logo:
    Logo Size: + +
    Show Description:
    Show Short Description:
    Show Address:
    Show Street:
    Show City, State, ZIP:
    Show Country:
    Show Region:
    Show Phone:
    Show Toll Free:
    Show URL: + + Display URL as a link: +
    Show Categories:
    Show Credit Cards:
    Show Amenitiies:
    +
    Show Search Form: + +
    Search Form Options: + + + + + + +
    Text Search:
    Category Search:
    Amenities Search:
    Show Alpha Index:
    +
    Show Member List: + +
    Member List Options + + + + + + + + + + + + + + + + + + + + + + + + + +
    Show Member Name as Link to Detail:
    Show Member Logo:
    Logo Size: + + {if $settings.fieldFail.list_logo_size}

    {$settings.fieldFail.list_logo_size}

    {/if} +
    Show Address:
    Address Options: + + + + +
    Show Street:
    Show City, State, ZIP:
    Show Country:
    +
    Show Region:
    Show Description:
    Show Short Description:
    Show Phone Number:
    Show Toll Free Phone Number:
    Show URL: + + Display URL as a link: +
    Show Categories:
    Show Credit Cards Accepted:
    Show Amenities:
    +

    Member Detail Page Options

    Show Map: + +
    Map Options: + + + + + + + + + + + + + + + + + + + + + + +
    Show Logo:
    Logo Size: + +
    Show Description:
    Show Short Description:
    Show Address:
    Show Street:
    Show City, State, ZIP:
    Show Country:
    Show Region:
    Show Phone:
    Show Toll Free:
    Show URL: + + Display URL as a link: +
    Show Categories:
    Show Credit Cards:
    Show Amenitiies:
    +
    Show Directions: + +
    Member Detail Options: + + + + + + + + + + + + + + + + + + + + + + + + +
    Show Member Logo:
    Logo Size: + + {if $settings.fieldFail.detail_logo_size}

    {$settings.fieldFail.detail_logo_size}

    {/if} +
    Show Address:
    Address Options: + + + + +
    Show Street:
    Show City, State, ZIP:
    Show Country:
    +
    Show Region:
    Show Description:
    Show Short Description:
    Show Phone Number:
    Show Toll Free Phone Number:
    Show URL: + + Display URL as a link: +
    Show Categories:
    Show Credit Cards Accepted:
    Show Amenities:
    +
    + +
    {include file='admin/footer.html'} diff --git a/views/admin/settings/terms.html b/views/admin/settings/terms.html new file mode 100644 index 00000000..5b239b0f --- /dev/null +++ b/views/admin/settings/terms.html @@ -0,0 +1,376 @@ +{include file='admin/settings/header.html'} + +

    *** Not using these settings yet! ***

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Admin Menu and Tab Names

    Members Menu: + + {if $settings.fieldFail.term_admin_menu_members}

    {$settings.fieldFail.term_admin_menu_members}

    {/if} +
    Members Menu Tabs: + + + + + + + + + + + + + +
    Main Dashboard: + + {if $settings.fieldFail.term_admin_menu_members_dashboard}

    {$settings.fieldFail.term_admin_menu_members_dashboard}

    {/if} +
    Member List: + + {if $settings.fieldFail.term_admin_menu_members_list}

    {$settings.fieldFail.term_admin_menu_members_list}

    {/if} +
    Reports: + + {if $settings.fieldFail.term_admin_menu_members_reports}

    {$settings.fieldFail.term_admin_menu_members_reports}

    {/if} +
    +
    Member Menu: + + {if $settings.fieldFail.term_admin_menu_member}

    {$settings.fieldFail.term_admin_menu_member}

    {/if} +
    Member Menu Tabs: + + + + + + + + + + + + + + + + + + + + + + + + + +
    Member Dashboard: + + {if $settings.fieldFail.term_admin_menu_member_dashboard}

    {$settings.fieldFail.term_admin_menu_member_dashboard}

    {/if} +
    Member Info: + + {if $settings.fieldFail.term_admin_menu_member_info}

    {$settings.fieldFail.term_admin_menu_member_info}

    {/if} +
    Locations: + + {if $settings.fieldFail.term_admin_menu_member_locations}

    {$settings.fieldFail.term_admin_menu_member_locations}

    {/if} +
    Facilities: + + {if $settings.fieldFail.term_admin_menu_member_facilities}

    {$settings.fieldFail.term_admin_menu_member_facilities}

    {/if} +
    Attractions: + + {if $settings.fieldFail.term_admin_menu_member_attractions}

    {$settings.fieldFail.term_admin_menu_member_attractions}

    {/if} +
    Contacts: + + {if $settings.fieldFail.term_admin_menu_member_contacts}

    {$settings.fieldFail.term_admin_menu_member_contacts}

    {/if} +
    +
    Configure Menu: + + {if $settings.fieldFail.term_admin_menu_configure}

    {$settings.fieldFail.term_admin_menu_configure}

    {/if} +
    Configure Menu Tabs: + + + + + + + + + + + + + + + + + + + + + + + + + +
    Member Types: + + {if $settings.fieldFail.term_admin_menu_configure_member_types}

    {$settings.fieldFail.term_admin_menu_configure_member_types}

    {/if} +
    Member Categories: + + {if $settings.fieldFail.term_admin_menu_configure_member_cats}

    {$settings.fieldFail.term_admin_menu_configure_member_cats}

    {/if} +
    Accommodation Types: + + {if $settings.fieldFail.term_admin_menu_configure_accom_types}

    {$settings.fieldFail.term_admin_menu_configure_accom_types}

    {/if} +
    Amenities: + + {if $settings.fieldFail.term_admin_menu_configure_amenities}

    {$settings.fieldFail.term_admin_menu_configure_amenities}

    {/if} +
    Cities: + + {if $settings.fieldFail.term_admin_menu_configure_cities}

    {$settings.fieldFail.term_admin_menu_configure_cities}

    {/if} +
    Regions: + + {if $settings.fieldFail.term_admin_menu_configure_regions}

    {$settings.fieldFail.term_admin_menu_configure_regions}

    {/if} +
    +
    Settings Menu: + + {if $settings.fieldFail.term_admin_menu_settings}

    {$settings.fieldFail.term_admin_menu_settings}

    {/if} +
    Settings Menu Tabs: + + + + + + + + + + + + + +
    General Settings: + + {if $settings.fieldFail.term_admin_menu_settings_general}

    {$settings.fieldFail.term_admin_menu_settings_general}

    {/if} +
    Terms & Phrases: + + {if $settings.fieldFail.term_admin_menu_settings_terms}

    {$settings.fieldFail.term_admin_menu_settings_terms}

    {/if} +
    Development: + + {if $settings.fieldFail.term_admin_menu_settings_development}

    {$settings.fieldFail.term_admin_menu_settings_development}

    {/if} +
    +

    Terms

    Member: + + + + + + + + + + + + + + + + + +
    Normal: + + {if $settings.fieldFail.term_member}

    {$settings.fieldFail.term_member}

    {/if} +
    Capitalized: + + {if $settings.fieldFail.term_member_cap}

    {$settings.fieldFail.term_member_cap}

    {/if} +
    Plural: + + {if $settings.fieldFail.term_member_plur}

    {$settings.fieldFail.term_member_plur}

    {/if} +
    Plural Capitalized: + + {if $settings.fieldFail.term_member_plur_cap}

    {$settings.fieldFail.term_member_plur_cap}

    {/if} +
    +
    Location: + + + + + + + + + + + + + + + + + +
    Normal: + + {if $settings.fieldFail.term_location}

    {$settings.fieldFail.term_location}

    {/if} +
    Capitalized: + + {if $settings.fieldFail.term_location_cap}

    {$settings.fieldFail.term_location_cap}

    {/if} +
    Plural: + + {if $settings.fieldFail.term_location_plur}

    {$settings.fieldFail.term_location_plur}

    {/if} +
    Plural Capitalized: + + {if $settings.fieldFail.term_location_plur_cap}

    {$settings.fieldFail.term_location_plur_cap}

    {/if} +
    +
    Facility: + + + + + + + + + + + + + + + + + +
    Normal: + + {if $settings.fieldFail.term_facility}

    {$settings.fieldFail.term_facility}

    {/if} +
    Capitalized: + + {if $settings.fieldFail.term_facility_cap}

    {$settings.fieldFail.term_facility_cap}

    {/if} +
    Plural: + + {if $settings.fieldFail.term_facility_plur}

    {$settings.fieldFail.term_facility_plur}

    {/if} +
    Plural Capitalized: + + {if $settings.fieldFail.term_facility_plur_cap}

    {$settings.fieldFail.term_facility_plur_cap}

    {/if} +
    +
    Attraction: + + + + + + + + + + + + + + + + + +
    Normal: + + {if $settings.fieldFail.term_attraction}

    {$settings.fieldFail.term_attraction}

    {/if} +
    Capitalized: + + {if $settings.fieldFail.term_attraction_cap}

    {$settings.fieldFail.term_attraction_cap}

    {/if} +
    Plural: + + {if $settings.fieldFail.term_attraction_plur}

    {$settings.fieldFail.term_attraction_plur}

    {/if} +
    Plural Capitalized: + + {if $settings.fieldFail.term_attraction_plur_cap}

    {$settings.fieldFail.term_attraction_plur_cap}

    {/if} +
    +
    Contact: + + + + + + + + + + + + + + + + + +
    Normal: + + {if $settings.fieldFail.term_contact}

    {$settings.fieldFail.term_contact}

    {/if} +
    Capitalized: + + {if $settings.fieldFail.term_contact_cap}

    {$settings.fieldFail.term_contact_cap}

    {/if} +
    Plural: + + {if $settings.fieldFail.term_contact_plur}

    {$settings.fieldFail.term_contact_plur}

    {/if} +
    Plural Capitalized: + + {if $settings.fieldFail.term_contact_plur_cap}

    {$settings.fieldFail.term_contact_plur_cap}

    {/if} +
    +
    + +
    +{include file='admin/footer.html'} diff --git a/views/admin/settingsPage-ISTHISNEEDED/index.html b/views/admin/settingsPage-ISTHISNEEDED/index.html new file mode 100644 index 00000000..de804cf0 --- /dev/null +++ b/views/admin/settingsPage-ISTHISNEEDED/index.html @@ -0,0 +1,14 @@ + +

    + +
    +

    My Plugin Options

    +
    + {php} settings_fields( 'glm-member-db-settings-group' ); {/php} + {php} do_settings_sections( 'glm-member-db-settings' ); {/php} + {php} submit_button(); {/php} +
    +
    diff --git a/views/admin/settingsPage/index.html b/views/admin/settingsPage/index.html deleted file mode 100644 index de804cf0..00000000 --- a/views/admin/settingsPage/index.html +++ /dev/null @@ -1,14 +0,0 @@ - -

    - -
    -

    My Plugin Options

    -
    - {php} settings_fields( 'glm-member-db-settings-group' ); {/php} - {php} do_settings_sections( 'glm-member-db-settings' ); {/php} - {php} submit_button(); {/php} -
    -