reset($_REQUEST['file_caption']);
foreach ( $_REQUEST['file_caption'] as $k => $v ) {
- $support->write_log($k);
$id = ($k -0);
- $support->write_log($_REQUEST['file_caption']);
// Sanitize input
$caption = sanitize_text_field( $_REQUEST['file_caption'][$k] );
window.Glma = (function() {
- var xhr = function(data, complete, success, error, type){
- jQuery.ajax({
+ var xhr = function(data, complete, success, error, type, content){
+ var config = {
dataType: "json",
type : type,
url: wp.ajax.settings.url,
complete: complete,
success: success,
error: error
- });
+ }
+ if(content){
+ config['contentType'] = false;
+ config['processData'] = false;
+ }
+ jQuery.ajax(config);
}
+
var memberRecordHandler = function(data, callback){
return function(e){
jQuery(".edit-screen").html('');
}
}
var deleteProps = function(obj){
- console.log(obj)
var searchFields = $(".glm-admin-search-field");
for(var i = 0; i < searchFields.length; i++){
var field = $(searchFields[i]).attr("data-search") ;
glm_action : 'memberManagement',
},
- manageMember: function(data, complete, success, error, type){
+ manageMember: function(data, complete, success, error, type, content){
xhr(
data,
complete,
success,
error,
type,
+ content
);
},
-
updateSearchFilterValues: updateSearchFilterValues,
getSearchFieldValues: getSearchFieldValues,
getSearchFieldValues: getSearchFieldValues,
onSelect: function(e, term, item){
let search = jQuery(item).text();
- console.log("select")
if(search){
var entityData = {
* @release Release: (0.1)
* @link <>
*/
-
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmPluginSupport.php';
abstract class GlmDataAbstract
{
{
$new = false;
-
// Check if we have a new image being submitted
if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
$new = true;
*/
private function processInputData($op = 'u', $id = false, $idField = false)
{
-
// Status is good unless otherwise determined
$status = true;
// Load Members data abstract
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php';
-
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmPluginSupport.php';
/*
* This class performs the work of handling images passed to it via
* an AJAX call that goes through the WorPress AJAX Handler.
*/
public function modelAction ($actionData = false)
{
-
+ $support->write_log("upload");
+ $support = new glmPluginSupport();
$return = array(
'status' => false, // Assume we didn't get files or nothing works
'files' => false, // Provide submitted data along with stored image data
$refTable = $this->config['ref_type_table'][$_REQUEST['glm_refType']];
// Check for uploaded files
+ $support->write_log($_FILES);
if (!isset($_FILES) || count($_FILES) == 0) {
$return['message'] = 'No image file provided!';
echo json_encode($return);
}
if($_REQUEST['option'] == 'submit'){
-
+ //$support->write_log($_REQUEST);
foreach($_REQUEST['form'] as $form=>$field){
preg_match_all("/\\[(.*?)\\]/", $field['name'], $match);
- $id = $match[1][0];
+ if(isset($match[1][0])) $id = $match[1][0];
+
if( strpos($field['name'], "category[") !== false){
$_REQUEST['category'][$field['name']] = $field['value'];
}elseif( strpos($field['name'], "amenity[") !== false){
// If request is for Next
if ($_REQUEST['pageSelect'][0] == 'N') {
$newStart = $_REQUEST['nextStart'] - 0;
- $this->write_log("\nNEW START:". $newStart);
+ // $this->write_log("\nNEW START:". $newStart);
// Otherwise it must be Previous
} else {
$newStart = $_REQUEST['prevStart'] - 0;
}
if ($listResult['returned'] == $limit) {
$nextStart = $start + $limit;
- $this->write_log("\nYOP");
+ // $this->write_log("\nYOP");
}
- $this->write_log("\nstart: " . $start);
- $this->write_log("\nlimit: " . $limit);
- $this->write_log("\nNext start: " . $nextStart);
+ // $this->write_log("\nstart: " . $start);
+ // $this->write_log("\nlimit: " . $limit);
+ // $this->write_log("\nNext start: " . $nextStart);
// since we're doing paging, we have to break out just the member data
$list = $listResult['list'];
$textSearch = str_replace('\\', '', $textSearch );
- $this->write_log("\nstart : $nextStart");
+ // $this->write_log("\nstart : $nextStart");
// Compile template data
$templateData = array(
'testData' => "TEST123",
function(error) {
console.log(error);
},
- "POST"
+ "POST",
);
});
// When submit button is clicked, disable the beforeunload message
$(document).on('click', '.updateMemberProfile',function(e) {
e.preventDefault();
var form = $("#member-info-form");
- editData.option = "submit";
- editData.form = form.serializeArray();
- console.log(editData.form);
+ var fileForm = new FormData(form[0]);
+ fileForm.set("action",'glm_members_admin_ajax');
+ fileForm.set("glm_action" , 'memberManagement');
+ fileForm.set("option" ,"submit");
window.Glma.manageMember(
- editData,
+ fileForm,
function(complete) {},
function(success) {
console.log(success);
function(error) {
console.log(error);
},
- "POST"
+ "POST",
+ true
+
);
// glmSubmitRequired = false;
// return true;
</div>
</div>
{/if}
- <div class="glm-center"><b>New image:</b> <input type="file" name="logo_new"></div>
+ <div class="glm-center"><b>New image:</b> <input id="glm-admin-member-profile-image" type="file" name="logo_new"></div>
</div>
<div id="glm-galleryImageLarger_logo" class="glm-imageDialog"><img src="{$glmPluginMediaUrl}/images/large/{$memberInfo.fieldData.logo}"></div>
{if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}