Ver Fonte

#1678 - Allow to edit 'author' field by admin/moderator in content

RomanL há 4 anos atrás
pai
commit
6c994f8e2f
2 ficheiros alterados com 4 adições e 5 exclusões
  1. 1 1
      inc/js/functions.js
  2. 3 4
      template/scripts/BxBaseFormView.php

+ 1 - 1
inc/js/functions.js

@@ -1150,7 +1150,7 @@ function bx_autocomplete_fields(iId, sUrl, sName, bShowImg, bOnlyOnce, onSelect)
 			else if(bShowImg && item.thumb != undefined)
 				sImage = '<img class="bx-def-thumb bx-def-thumb-size bx-def-margin-sec-right" src="' + item.thumb + '">';
 
-			$(this).before('<b class="bx-def-color-bg-hl bx-def-round-corners">' + sImage + item.label + '<input type="hidden" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="' + sName + '" value="' + item.value + '" /></b>');
+			$(this).before('<b class="bx-def-color-bg-hl bx-def-round-corners">' + sImage + item.label + '<input type="hidden" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="' + sName + (bOnlyOnce ? '' : '[]') + '" value="' + item.value + '" /></b>');
 		}
 
 		if (!bOnlyOnce)

+ 3 - 4
template/scripts/BxBaseFormView.php

@@ -1497,8 +1497,7 @@ BLAH;
 
         $aTmplVarsVals = [];
         if(!empty($aInput['value'])) {
-            if(is_array($aInput['value']) || (is_numeric($aInput['value']) && $aInput['custom']['only_once'] == 1)) {
-                
+            if(is_array($aInput['value']) || (is_numeric($aInput['value']))) {
                 if (!is_array($aInput['value']))
                     $aInput['value'] = [$aInput['value']];
                     
@@ -1509,7 +1508,7 @@ BLAH;
                    $aTmplVarsVals[] = [
                        'item_unit' => $oProfile->getUnit(0, array('template' => 'unit_wo_info')),
                        'item_name' => $oProfile->getDisplayName(),
-                       'name' => $aInput['name'],
+                       'name' => $aInput['name'] . (isset($aInput['custom']['only_once']) && $aInput['custom']['only_once'] == 1 ? '' : '[]'),
                        'value' => $sVal
                    ];
                 }
@@ -1532,7 +1531,7 @@ BLAH;
         $this->addCssJsUi();
 
         return $this->oTemplate->parseHtmlByName('form_field_custom_suggestions.html', array(
-            'name' => $aInput['name'] . (isset($aInput['custom']['only_once']) && $aInput['custom']['only_once'] == 1 ? '[]' : ''),
+            'name' => $aInput['name'],
             'attrs' => bx_convert_array2attrs($aAttrs),
             'bx_repeat:vals' => $aTmplVarsVals,
             'bx_if:input' => array(