* @release SVN: $Id: dataFiles.php,v 1.0 2011/01/25 19:31:47 cscott
* Exp $
*/
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmPluginSupport.php';
class GlmDataFiles extends GlmDataAbstract
{
*/
function __construct ($wpdb, $config)
{
-
+
// If this class is not being extended along with existing $wpdb and $config
if (!$this->wpdb) {
*/
public function filesDataUpdate($refType, $refID, $orderField)
{
-
+ $support = new glmPluginSupport();
// Re-order image gallery files
$this->filePositionOrder($refType, $refID, $orderField);
if (isset($_REQUEST['file_caption'])
&& is_array($_REQUEST['file_caption'])
&& count($_REQUEST['file_caption']) > 0) {
-
+
// Update other data for this image
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] );
$descr = (isset($_REQUEST['file_descr'])) ? sanitize_text_field( $_REQUEST['file_descr'][$k] ):'';
*/
jQuery(document).ready(function($) {
-
+ window.Glma['fileUploaderInit'] = function(){
var drop;
var fileDrop;
var recordID;
var newImageAdded = false;
var enableDraggable = true;
var statusArea = false;
-
+ window.Glma = window.Glma || {};
+
// Setup Drag and Drop when Add
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');
-
- // Change from Drag/Drop not supported to drop here text
- $('.glm-fileBrowseButton').addClass('glm-fileItemHidden');
- $('.glm-fileDropText').removeClass('glm-fileItemHidden');
- $('.glm-fileDrop').removeClass('glm-fileItemHidden');
-
- // Prevent dropping on the document
- $(document).on('dragenter', function (e) {
+
+ // 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');
+
+ // Change from Drag/Drop not supported to drop here text
+ $('.glm-fileBrowseButton').addClass('glm-fileItemHidden');
+ $('.glm-fileDropText').removeClass('glm-fileItemHidden');
+ $('.glm-fileDrop').removeClass('glm-fileItemHidden');
+
+ // 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('dragover', function (e) {
- e.stopPropagation();
- e.preventDefault();
- });
- $(document).on('drop', function (e) {
- e.preventDefault();
- });
-
- // For each image drop area on the page
- $('.glm-imageDrop').each(function() {
- drop = $(this);
- initDrop();
- });
+ });
+ $(document).on('drop', function (e) {
+ e.preventDefault();
+ });
- // For each file drop area on the page
- $('.glm-fileDrop').each(function() {
- fileDrop = $(this);
- initFileDrop();
- });
+ // For each image drop area on the page
+ $('.glm-imageDrop').each(function() {
+ drop = $(this);
+ initDrop();
+ });
+ // For each file drop area on the page
+ $('.glm-fileDrop').each(function() {
+ fileDrop = $(this);
+ initFileDrop();
+ });
+
+
} else {
alert('Your Web browser does not support "Drag & Drop" image uploads using "XHR2".\nThat capability is required to upload images for the image gallery on this page.\nConsider upgrading your browser.');
}
}
setupExpandedImageEvents();
setupExpandedFileEvents();
+}
+window.Glma.fileUploaderInit();
});
$_REQUEST['category'][$field['name']] = $field['value'];
}elseif( strpos($field['name'], "amenity[") !== false){
$_REQUEST['amenity'][$field['name']] = $field['value'];
+ }elseif( strpos($field['name'], "file_caption[") !== false){
+ preg_match_all("/\\[(.*?)\\]/", $field['name'], $match);
+ $_REQUEST['file_caption'][$match[1][0]] = $field['value'];
+ }elseif( strpos($field['name'], "galleryImage_caption[") !== false){
+ preg_match_all("/\\[(.*?)\\]/", $field['name'], $match);
+ $_REQUEST['galleryImage_caption'][$match[1][0]] = $field['value'];
}else{
$_REQUEST[$field['name']] = $field['value'];
}
}
+
unset($_REQUEST['form']);
+ //$support->write_log($_REQUEST);
$data = $this->controller( 'member', 'memberInfo', false, true, true);
}
if($_REQUEST['option'] == 'delete'){