* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.6.74
+ * Version: 1.6.75
* Author: Chuck Scott
* Author URI: http://www.gaslightmedia.com/
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.6.74
+ * @version 1.6.75
*/
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.74');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.75');
define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.4');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
{/if}
{if $haveMember && !$lockedToMember}
- <form action="{$thisUrl}?page=glm-members-admin-menu-member" method="post" enctype="multipart/form-data">
+ <form id="glm-event-admin-form" action="{$thisUrl}?page=glm-members-admin-menu-member" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="events">
{else}
{if $lockedToMember}
- <form action="{$thisUrl}?page=glm-members-admin-menu-events-list" method="post" enctype="multipart/form-data">
+ <form id="glm-event-admin-form" action="{$thisUrl}?page=glm-members-admin-menu-events-list" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="list">
{else}
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <form id="glm-event-admin-form" action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="list">
{/if}
var recurrencesInited = false;
var locationsInited = false;
+ // function used to get everything out of the visual and text editors
+ function get_tinymce_content(){
+ if (jQuery("#wp-glm_descr-wrap").hasClass("tmce-active")){
+
+ tinyMCE.triggerSave();
+
+ return $('#glm_descr').val();
+ } else {
+ // get the shortcode from the editor with [ ] as the delimiter
+ return $("#glm_descr").val();
+ }
+ }
+ // Check for required fields
+ $('#glm-event-admin-form').submit(function(){
+ var formErrors = [];
+ {foreach $event.fieldRequired as $fieldName => $fValue}
+ {if $fieldName != 'status' && $fieldName != 'descr'}
+ if ( {if $fValue}true{else}false{/if} ) {
+ console.log('{$fieldName}', $('input[name="{$fieldName}"]'));
+ console.log('{$fieldName}.val()', $('input[name="{$fieldName}"]').val());
+ if ( !$('input[name="{$fieldName}"]').val() ) {
+ formErrors.push('{$fieldName}');
+ }
+ }
+ {else if $fieldName == 'descr'}
+ if ( {if $fValue}true{else}false{/if} ) {
+ descr = get_tinymce_content();
+ console.log( 'descr', descr );
+ if ( !descr ) {
+ formErrors.push('{$fieldName}');
+ }
+ }
+ {/if}
+
+ {/foreach}
+ var numErrors = formErrors.length;
+ if ( numErrors > 0 ) {
+ console.log('formErrors: ', formErrors);
+ var msg = "The following fields are required for this Event:\n";
+ for ( var i = 0; i < numErrors; i++ ) {
+ msg += formErrors[i] + "\n";
+ }
+ alert(msg);
+ // move to first tab
+ $('#glm-event-descr').trigger('click');
+ return false;
+ } else {
+ return true;
+ }
+ });
+
/*
* Edit area tabs
*/