Timezone settings now affect AJAX calls, File Library basic features now complete.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 2 Feb 2018 20:38:40 +0000 (15:38 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 2 Feb 2018 20:38:40 +0000 (15:38 -0500)
controllers/admin.php
js/fileLibraryUpload/fileLibraryUpload.js
models/admin/ajax/fileLibraryUpload.php
views/admin/fileLibrary/index.html

index 54792e8..4a8a71e 100644 (file)
@@ -254,6 +254,9 @@ class glmMembersAdmin extends GlmPluginSupport
     public function  glmMembersAdminAjax()
     {
 
+        $defaultTimeZone = date_default_timezone_get();
+        date_default_timezone_set($this->config['settings']['time_zone']);
+
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
@@ -384,6 +387,9 @@ class glmMembersAdmin extends GlmPluginSupport
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
 
+        // Restore timezone that was set before our code was called
+        date_default_timezone_set($defaultTimeZone);
+
         exit;   // Need to test if this is here for a reason!
         wp_die();
 
index 1436e1b..0b606f9 100644 (file)
@@ -319,6 +319,7 @@ jQuery(document).ready(function($) {
                         fData = fData.replace(/\{ filename \}/g, fileData.files[i].name);
                         fData = fData.replace(/\{ fileurl \}/g, fileData.files[i].newFileUrl);
                         fData = fData.replace(/\{ newfilename \}/g, fileData.files[i].newFileName);
+                        fData = fData.replace(/\{ lastaccesstime \}/g, fileData.files[i].lastAccessTime);
                         $('#AfterNewFiles').before(fData);
 
 //                        $('#fileContainer_' + fileData.files[i].id).removeClass('glm-fileLibraryItemHidden');
index 5272977..edbe959 100644 (file)
@@ -185,9 +185,8 @@ class GlmMembersAdmin_ajax_fileLibraryUpload extends GlmDataFileLibrary
 
             $file['newFileName'] = $newFilename;
             $file['newFileUrl'] = GLM_MEMBERS_WORDPRESS_FILE_LIBRARY_URL.$newFilename;
-
-
-            $lastAccessTime = date('Y-m-d H:i:s');
+            $file['lastAccessTimeMysql'] = date('Y-m-d H:i:s');
+            $file['lastAccessTime'] = date('m/d/Y h:i A');
 
             // Store image name in images table
             $sql = "
@@ -205,7 +204,7 @@ class GlmMembersAdmin_ajax_fileLibraryUpload extends GlmDataFileLibrary
                         '".$file['newFileName']."',
                         '',
                         '',
-                        '$lastAccessTime'
+                        '".$file['lastAccessTimeMysql']."'
                     );
             ";
             $this->wpdb->query($sql);
index 7268dfa..4dd7211 100644 (file)
@@ -70,7 +70,7 @@
                                             &nbsp;
                                         </td>
                                         <td class="glm-file-library-table-left">
-                                            &nbsp
+                                            { lastaccesstime }
                                         </td>
                                     </tr>
                                     <tr id="fileLinks_{ id }" class="glm-hidden glm-file-links"">
                                         <td colspan="5" style="border: 1px #ccc solid;">
                                             <div class="glm-row" style="margin-bottom: 0px !important; margin-top: .5rem;">
                                                 <div class="glm-columns glm-small-6">
-                                                    <label>File Title: </label><BR>
+                                                    <label>File Title: </label><br>
                                                     <input id="InputTitle_{ id }" class="glm-form-text-input-medium" type="text" name="title" value=""><br>
                                                 </div>
                                                 <div class="glm-columns glm-small-5">
-                                                    Description: 
+                                                    <label>Description: </label><br> 
                                                     <textarea id="InputDescr_{ id }" class="glm-form-text-input-medium" name="descr"></textarea>
                                                 </div>
                                             </div>
             </div>
         </div>
     
-   <p>NOTE: The "Copy" button will copy the entire URL for the uploaded file to the user's "Clipboard".</p>
+   <p>NOTE: 
+        Hover over a line to show actions. 
+        For reference, any files you edit, download, or copy the link will have a difffernt background color till the page is refreshed and 
+        the last file you edit, download, or copy will be hilighted.
+   </p>
    <div class="glm-admin-table">
         <div class="glm-admin-table-inner">
     {if $paging}
                 </tr>
             </thead>
             <tbody>
-                <tr class="glm-NewFileHidden glm-fileLibraryItemHidden" style="background-color: #fff;"><th colspan="4" style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;New Uploads</th></tr>
+                <tr class="glm-NewFileHidden glm-fileLibraryItemHidden" style="background-color: #fff;"><th colspan="4" style="color: gray;">&nbsp;&nbsp;&nbsp;&nbsp;New Uploads</th></tr>
             </tbody>
             <tbody id="AfterNewFiles">
                 <tr class="glm-NewFileHidden glm-fileLibraryItemHidden" style="background-color: #fff;"><td colspan="4">&nbsp;</td></tr>
-                <tr class="glm-NewFileHidden glm-fileLibraryItemHidden" style="background-color: #fff;"><th colspan="4" style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;Previous Uploads</th></tr>
+                <tr class="glm-NewFileHidden glm-fileLibraryItemHidden" style="background-color: #fff;"><th colspan="4" style="color: gray;">&nbsp;&nbsp;&nbsp;&nbsp;Previous Uploads</th></tr>
             </tbody>            
     {if $haveFiles}
         {assign var="i" value="0"}
                     <td colspan="5" style="border: 1px #ccc solid;">
                         <div class="glm-row" style="margin-bottom: 0px !important; margin-top: .5rem;">
                             <div class="glm-columns glm-small-6">
-                                <label>File Title: </label><BR>
+                                <label>File Title: </label><br>
                                 <input id="InputTitle_{$f.id}" class="glm-form-text-input-medium" type="text" name="title" value="{$f.title}"><br>
                             </div>
                             <div class="glm-columns glm-small-5">
-                                Description: 
+                                <label>Description: </label><br> 
                                 <textarea id="InputDescr_{$f.id}" class="glm-form-text-input-medium" name="descr">{$f.descr}</textarea>
                             </div>
                         </div>