Minor fixes - Mostly cosmetic and informational.
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 7 May 2018 19:33:14 +0000 (15:33 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 7 May 2018 19:33:14 +0000 (15:33 -0400)
classes/data/dataCustomFields.php
css/admin.css
models/admin/ajax/customFieldsFront.php
models/front/customFields/formDisplay.php
views/admin/customFields/index.html

index 25559fe..305db8d 100644 (file)
@@ -341,13 +341,14 @@ class GlmDataFieldsCustomFields extends GlmDataAbstract
     /*
      * Get form fields along with any stored data
      *
-     * @param
-     * @param string $a Action being performed (l, i, g, ...)
+     * @param string $fid Form identification string
+     * @param integer $recordId form instance ID
+     * @param boolean $ignoreNonInput Do not return non-input fields
      *
      * @return object Class object
      *
      */
-    public function getFormWithData($fid, $recordId = false)
+    public function getFormWithData($fid, $recordId = false, $ignoreNonInput = false)
     {
         // Save current status of get stored data flag
         $savedGetStoredDataState = $this->getStoredData;
@@ -371,13 +372,16 @@ class GlmDataFieldsCustomFields extends GlmDataAbstract
 
         // Check if there's any priority display fields or fields with selected cost
         if (is_array($result['form']) && count($result['form']) > 0) {
-            foreach ($result['form'] as $field) {
+            foreach ($result['form'] as $fKey=>$field) {
                 if ($field['priority_display']['value'] || $field['cost'] > 0) {
                     $result['hasPriorityField'] = true;
                 }
                 if ($field['cost'] > 0) {
                     $result['totalCost'] += $field['cost'];
                 }
+                if ($ignoreNonInput && $field['displayOnly']) {
+                    unset($result['form'][$fKey]);
+                }
             }
         }
 
index 42c8567..30babeb 100644 (file)
@@ -22,7 +22,7 @@
 /* Styles for sorting */
 .ui-sortable-helper {
 }
-.sortable-handle {
+.glm-custom-sortable-handle {
     cursor: pointer;
 }
 .sort-field-outofsortarea {
index 9f82dd0..d0cb5be 100644 (file)
@@ -67,6 +67,9 @@ class GlmMembersAdmin_ajax_customFieldsFront extends GlmDataFieldsCustomFields
      *
      * This model action does not return, it simply does it's work then calls die();
      *
+     * This model looks for a submit parameter of "option2". If that is "fieldsOnly"
+     * then only input fields are included and comments and separators are not included.
+     *
      * @param $actionData
      *
      * @return No return is expected from this model. Content should be output then wp_die();
@@ -74,6 +77,9 @@ class GlmMembersAdmin_ajax_customFieldsFront extends GlmDataFieldsCustomFields
     public function modelAction ($actionData = false)
     {
 
+        // Check if this is a request to only output input fields and ignore comments and such
+        $fieldsOnly = (isset($_REQUEST) && $_REQUEST['option2'] == 'fieldsOnly');
+
         switch($_REQUEST['option']) {
 
             case 'displayForm':
@@ -85,6 +91,7 @@ class GlmMembersAdmin_ajax_customFieldsFront extends GlmDataFieldsCustomFields
                         'record-id'         => $_REQUEST['recordId'],
                         'parent-form-id'    => $_REQUEST['parentFormId'],
                         'form-data'         => $_REQUEST['formData'],
+                        'ignore-non-input'  => $fieldsOnly
                     )
                 );
 
index 17d9ad9..ae343a5 100644 (file)
@@ -126,7 +126,7 @@ class GlmMembersFront_customFields_formDisplay extends GlmDataFieldsCustomFields
             }
 
             // Try to retrieve the form
-            $formFields = $this->getFormWithData($formId, $recordId);
+            $formFields = $this->getFormWithData($formId, $recordId, $actionData['request']['ignore-non-input']);
 
             // If we received good data
             if ( isset($formFields)
index 49f3dc5..903c266 100644 (file)
     </thead>
 {if $haveCustomFields}
   {foreach $custom_fields as $t}
-    <tbody id="field_{$t.id}" class="sort-field-container">
+    <tbody id="field_{$t.id}" class="glm-custom-sort-field-container">
         <tr class="FieldRow_{$t.id}">
-            <th style="font-weight: bold; text-align: left;" id="DisplayFieldName_{$t.id}" class="sortable-handle">{$t.field_name}</th>
+            <th style="font-weight: bold; text-align: left;" id="DisplayFieldName_{$t.id}" class="glm-custom-sortable-handle">{$t.field_name}</th>
             <td style="text-align: left;" id="DisplayFieldTypeDescr_{$t.id}">{$t.field_type_descr}</td>
             <td style="text-align: left;" id="DisplayFieldPriority_{$t.id}">{$t.priority_display.name}</td>
             <td style="text-align: left;" id="DisplayFieldRequired_{$t.id}">{$t.required.name}</td>
@@ -568,18 +568,18 @@ jQuery(document).ready(function($) {
      */
 
     // Hide any custom field options for the field while mousedown
-    $('.sortable-handle').mousedown(function() {
+    $('.glm-custom-sortable-handle').mousedown(function() {
         $(this).parent().parent().find(".picklist-options-container").css("display","none");
     });
-    $('.sortable-handle').mouseup(function() {
+    $('.glm-custom-sortable-handle').mouseup(function() {
         $(this).parent().parent().find(".picklist-options-container").css("display","table-row");
     });
     
     // Make fields tables sortable
     var regFieldSortable = $('#FieldsTable_{$fid}').sortable({
-        items: '.sort-field-container',
+        items: '.glm-custom-sort-field-container',
         cursorAt: { top: -20, left: 10 },
-        handle: ".sortable-handle",
+        handle: ".glm-custom-sortable-handle",
         start: function ( event, ui ) {     
         },
         stop: function ( event, ui ) {
@@ -604,7 +604,7 @@ jQuery(document).ready(function($) {
                 data:       formData,
                 encode:     true,
                 dataType:   'text'
-            })
+            });
         }
         
     });