Скрыть объявление
ВАШИ ПРАВА ОГРАНИЧЕНЫ!

Зарегистрируйтесь на форуме, чтобы стать полноценным участником сообщества!

Вопрос? Как в dle 12.1 сделать мультивыбор для дополнительного поля типа "список" ?

Тема в разделе "Вопросы- ответы", создана пользователем usergeyv, 5 июн 2018.

05.06.18 в 23:21
06.06.18 в 14:49
5
1.066
0
  1. TopicStarter Overlay
    usergeyv

    usergeyv Посетитель

    Регистрация:
    18 апр 2017
    Сообщения:
    58
    Лучших ответов:
    0
    Рейтинги:
    +12 / 0 / -0
    В xfields.php сделал
    PHP:
    $select "<select multiple=\"multiple\" style=\"width:350px;height:140px;\" id=\"category\" name=\"xfield[$fieldname]\">";
            
    Мультивыбор работает, но добавляется в базу последние выбранное значения, как занести в базу все выбранные значения select
    PHP:
            }
           
          } elseif (
    $value[3] == "select") {
           
            if (
    $xfieldmode == "site") {
                
    $select "<select multiple=\"multiple\" style=\"width:350px;height:140px;\" id=\"category\" name=\"xfield[$fieldname]\">";
            } else {
                
    $select "<select class=\"uniform\" name=\"xfield[$fieldname]\">";
            }
           
            if ( !isset(
    $fieldvalue) ) $fieldvalue "";

            
    $fieldvalue str_replace('&amp;''&'$fieldvalue);

            foreach (
    explode("\r\n"htmlspecialchars($value[4], ENT_QUOTES$config['charset'] )) as $index1 => $value1) {

              
    $value1 explode("|"$value1);
              if( 
    count($value1) < 2$value1[1] = $value1[0];
              
    $select .= "<option value=\"$index1\"" . ($fieldvalue == $value1[0] ? " selected" "") . ">{$value1[1]}</option>\r\n";
            }

            
    $select .= "</select>";
         
            if (
    $xfieldmode == "site") {

                
    $output .= <<<HTML
    <tr id="$holderid">
    <td class="addnews">
    $value[1]:</td>
    <td class="xfields" colspan="2">
    {$select} {$value[18]}</td>
    </tr>
    HTML;

            
    $xfieldinput[$fieldname] = $select;

            } else {

                
    $output .= <<<HTML
    <div id="$holderid" class="form-group">
      <label class="control-label col-sm-2">
    {$value[1]}:</label>
      <div class="col-sm-10">
    {$select} {$value[18]}
      </div>
    </div>
    HTML;
            }
           
          } elseif( 
    $value[3] == "yesorno" ) {

            if ( !isset(
    $fieldvalue) OR $fieldvalue === ''$fieldvalue $value[17];

            
    $fieldvalue intval($fieldvalue);
           
            if (
    $xfieldmode == "site") {

                
    $select "<select name=\"xfield[$fieldname]\">";
                
    $select .= "<option value=\"1\"" . ($fieldvalue == " selected" "") . ">{$lang['xfield_xyes']}</option>\r\n";
                
    $select .= "<option value=\"0\"" . ($fieldvalue == " selected" "") . ">{$lang['xfield_xno']}</option>\r\n";
                
    $select .= "</select>";
               
                
    $output .= <<<HTML
    <tr id="$holderid">
    <td class="addnews">
    $value[1]:</td>
    <td class="xfields" colspan="2">
    {$select} {$value[18]}</td>
    </tr>
    HTML;

            
    $xfieldinput[$fieldname] = $select;

            } else {

                
    $selected $fieldvalue "checked" "";
               
                if (
    $value[18]) $value[18] = "<i class=\"help-button visible-lg-inline-block text-primary-600 fa fa-question-circle position-right position-left\" style=\"position: relative;top: -8px;\" data-rel=\"popover\" data-trigger=\"hover\" data-placement=\"right\" data-content=\"{$help_text}\" ></i>";
       
                
    $output .= <<<HTML
    <div id="$holderid" class="form-group">
      <label class="control-label col-sm-2">
    {$value[1]}:</label>
      <div class="col-sm-10"><input class="switch" type="checkbox" name="xfield[
    $fieldname]" value="1" {$selected}>{$value[18]}
      </div>
    </div>
    HTML;
            }      
           
          } elseif( 
    $value[3] == "image" ) {

            
    $max_file_size = (int)($value[10] * 1024);
           
            
    $fieldvalue str_replace('&amp;''&'$fieldvalue);

            if( 
    $fieldvalue ) {
                
    $path_parts pathinfo($fieldvalue);

                if( 
    $value[12] AND file_exists(ROOT_DIR "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) {
                    
    $img_url =     $config['http_home_url'] . "uploads/posts/" $path_parts['dirname']."/thumbs/".$path_parts['basename'];
                } else {
                    
    $img_url =     $config['http_home_url'] . "uploads/posts/" $path_parts['dirname']."/".$path_parts['basename'];
                }
               
                
    $filename explode("_"$path_parts['basename']);
                unset(
    $filename[0]);
                
    $filename implode("_"$filename);
                   
                
    $up_image "<div class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" $img_url "\" /></div><div class=\"info\"><a href=\"#\" onclick=\"xfimagedelete(\\'".$fieldname."\\',\\'".$fieldvalue."\\');return false;\">{$lang['xfield_xfid']}</a></div></div>";
               
            } else 
    $up_image "";
           
            if (!
    $value[5]) {
                
    $params "rel=\"essential\" ";
                
    $uid "uid=\"essential\" ";

            } else {

                
    $params "";
                
    $uid "";

            }
           
    $uploadscript = <<<HTML
        new qq.FileUploader({
            element: document.getElementById('xfupload_
    {$fieldname}'),
            action: 'engine/ajax/upload.php',
            maxConnections: 1,
            multiple: false,
            allowdrop: false,
            encoding: 'multipart',
            sizeLimit: 
    {$max_file_size},
            allowedExtensions: ['gif', 'jpg', 'jpeg', 'png'],
            params: {"PHPSESSID" : "
    {$sess_id}", "subaction" : "upload", "news_id" : "{$news_id}", "area" : "xfieldsimage", "author" : "{$author}", "xfname" : "{$fieldname}", "user_hash" : "{$dle_login_hash}"},
            template: '<div class="qq-uploader">' +
                    '<div id="uploadedfile_
    {$fieldname}">{$up_image}</div>' +
                    '<div class="qq-upload-button btn btn-green bg-teal btn-sm btn-raised" style="width: auto;">
    {$lang['xfield_xfim']}</div>' +
                    '<ul class="qq-upload-list" style="display:none;"></ul>' +
                 '</div>',
            onSubmit: function(id, fileName) {

                        $('<div id="uploadfile-'+id+'" class="file-box"><span class="qq-upload-file-status">
    {$lang['media_upload_st6']}</span><span class="qq-upload-file">&nbsp;'+fileName+'</span>&nbsp;<span class="qq-status"><span class="qq-upload-spinner"></span><span class="qq-upload-size"></span></span><div class="progress "><div class="progress-bar progress-blue" style="width: 0%"><span>0%</span></div></div></div>').appendTo('#xfupload_{$fieldname}');

            },
            onProgress: function(id, fileName, loaded, total){
                        $('#uploadfile-'+id+' .qq-upload-size').text(DLEformatSize(loaded)+' 
    {$lang['media_upload_st8']} '+DLEformatSize(total));
                        var proc = Math.round(loaded / total * 100);
                        $('#uploadfile-'+id+' .progress-bar').css( "width", proc + '%' );
                        $('#uploadfile-'+id+' .qq-upload-spinner').css( "display", "inline-block");

            },
            onComplete: function(id, fileName, response){

                            if ( response.success ) {
                                var returnbox = response.returnbox;
                                var returnval = response.xfvalue;

                                returnbox = returnbox.replace(/&lt;/g, "<");
                                returnbox = returnbox.replace(/&gt;/g, ">");
                                returnbox = returnbox.replace(/&amp;/g, "&");

                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st9']}');
                                $('#uploadedfile_
    {$fieldname}').html( returnbox );
                                $('#xf_
    {$fieldname}').val(returnval);

                                $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
                               
                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow', function() { $(this).remove(); });
                                }, 1000);

                            } else {
                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st10']}');

                                if( response.error ) $('#uploadfile-'+id+' .qq-status').append( '<br /><span class="text-danger">' + response.error + '</span>' );

                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow');
                                }, 4000);
                            }
            },
            messages: {
                typeError: "
    {$lang['media_upload_st11']}",
                sizeError: "
    {$lang['media_upload_st12']}",
                emptyError: "
    {$lang['media_upload_st13']}"
            },
            debug: false
        });
       
        if($('#xf_
    {$fieldname}').val() != "" ) {
            $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
        }
    HTML;

            if (
    $xfieldmode == "site") {
               
    $onload_scripts[] = <<<HTML
    if ($('#xfupload_{$fieldname}').length){
        
    {$uploadscript}
    }
    HTML;
               
    $output .= <<<HTML
    <tr id="$holderid{$uid}>
    <td class="addnews">
    $value[1]: [not-optional]<span style="color:red;">*</span>[/not-optional]</td>
    <td class="xfields" colspan="2"><div id="xfupload_
    {$fieldname}"></div><input type="hidden" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/>{$value[18]}</td>
    </tr>
    HTML;

                
    $xfieldinput[$fieldname] = "<div id=\"xfupload_{$fieldname}\"></div><input type=\"hidden\" name=\"xfield[$fieldname]\" id=\"xf_$fieldname\" value=\"{$fieldvalue}\" {$params}/>";
               
            } else {
                   
    $output .= <<<HTML
    <div id="$holderid" class="form-group" {$uid}>
      <label class="control-label col-sm-2">
    {$value[1]}: [not-optional]<span style="color:red;">*</span>[/not-optional] {$value[18]}</label>
      <div class="col-sm-10"><div id="xfupload_
    {$fieldname}"></div><input type="hidden" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/>
    <script type="text/javascript">
    jQuery(function($){
    {$uploadscript}
    });
    </script>
      </div>
    </div>
    HTML;

            }

          } elseif( 
    $value[3] == "imagegalery" ) {

            
    $max_file_size = (int)($value[10] * 1024);
           
            
    $fieldvalue str_replace('&amp;''&'$fieldvalue);

            if( 
    $fieldvalue ) {
                
    $fieldvalue_arr explode(','$fieldvalue);
                
    $up_image = array();
               
                foreach (
    $fieldvalue_arr as $temp_value) {
                    
    $temp_value trim($temp_value);
                   
                    if(
    $temp_value == "") continue;
                   
                    
    $path_parts pathinfo($temp_value);
                   
                    if( 
    $value[12] AND file_exists(ROOT_DIR "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) {
                        
    $img_url =     $config['http_home_url'] . "uploads/posts/" $path_parts['dirname']."/thumbs/".$path_parts['basename'];
                    } else {
                        
    $img_url =     $config['http_home_url'] . "uploads/posts/" $path_parts['dirname']."/".$path_parts['basename'];
                    }
                   
                    
    $filename explode("_"$path_parts['basename']);
                    unset(
    $filename[0]);
                    
    $filename implode("_"$filename);
                   
                    
    $xf_id md5($temp_value);
                    
    $up_image[] = "<div id=\"xf_{$xf_id}\" class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" $img_url "\" /></div><div class=\"info\"><a href=\"#\" onclick=\"xfimagegalerydelete_".md5($fieldname)."(\\'".$fieldname."\\',\\'".$temp_value."\\', \\'".$xf_id."\\');return false;\">{$lang['xfield_xfid']}</a></div></div>";

                }
               
                
    $totaluploadedfiles count($up_image);
                
    $up_image implode($up_image);

               
            } else { 
    $up_image ""$totaluploadedfiles 0; }
           
            if (!
    $value[5]) {
                
    $params "rel=\"essential\" ";
                
    $uid "uid=\"essential\" ";

            } else {

                
    $params "";
                
    $uid "";

            }

    $del_function = <<<HTML
        var maxallowfiles_{$fieldcount} = {$value[16]};
        var totaluploaded_
    {$fieldcount} = {$totaluploadedfiles};
        var totalqueue_
    {$fieldcount} = 0;
       
        function xfimagegalerydelete_
    {$fieldcount} ( xfname, xfvalue, id )
        {
            DLEconfirm( '
    {$lang['image_delete']}', '{$lang['p_info']}', function () {
           
                ShowLoading('');
       
                $.post('engine/ajax/upload.php', { subaction: 'deluploads', user_hash: '
    {$dle_login_hash}', news_id: '{$news_id}', author: '{$author}', 'images[]' : xfvalue }, function(data){
       
                    HideLoading('');
                    var str = $('#xf_'+xfname).val();
                    var arr = str.split(',');
                    if( $.inArray(xfvalue, arr) != -1 ){
                        arr.splice( $.inArray(xfvalue, arr), 1 );
                    }
                   
                    if ( arr.length ) {
                        $('#xf_'+xfname).val(arr.join(','));
                    } else {
                        $('#xf_'+xfname).val('');
                    }

                    $('#xf_'+id).remove();
                    totaluploaded_
    {$fieldcount} --;
                   
                    $('#xfupload_' + xfname + ' .qq-upload-button, #xfupload_' + xfname + ' .qq-upload-button input').removeAttr('disabled');
                });
               
            } );
           
            return false;

        };
    HTML;

    $uploadscript = <<<HTML
        var uploader_{$fieldcount} = new qq.FileUploader({
            element: document.getElementById('xfupload_
    {$fieldname}'),
            action: 'engine/ajax/upload.php',
            maxConnections: 1,
            multiple: true,
            allowdrop: false,
            encoding: 'multipart',
            sizeLimit: 
    {$max_file_size},
            allowedExtensions: ['gif', 'jpg', 'jpeg', 'png'],
            params: {"PHPSESSID" : "
    {$sess_id}", "subaction" : "upload", "news_id" : "{$news_id}", "area" : "xfieldsimagegalery", "author" : "{$author}", "xfname" : "{$fieldname}", "user_hash" : "{$dle_login_hash}"},
            template: '<div class="qq-uploader">' +
                    '<div id="uploadedfile_
    {$fieldname}">{$up_image}</div>' +
                    '<div class="qq-upload-button btn btn-green bg-teal btn-sm btn-raised" style="width: auto;">
    {$lang['xfield_xfimg']}</div>' +
                    '<ul class="qq-upload-list" style="display:none;"></ul>' +
                 '</div>',
            onSubmit: function(id, fileName) {
           
                        totalqueue_
    {$fieldcount} ++;
                       
                        if(maxallowfiles_
    {$fieldcount} && (totaluploaded_{$fieldcount} + totalqueue_{$fieldcount} ) > maxallowfiles_{$fieldcount} ) {
                            totalqueue_
    {$fieldcount} --;
                       
                            $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
                            return false;
                        }
                               
                        $('<div id="uploadfile-'+id+'" class="file-box"><span class="qq-upload-file-status">
    {$lang['media_upload_st6']}</span><span class="qq-upload-file">&nbsp;'+fileName+'</span>&nbsp;<span class="qq-status"><span class="qq-upload-spinner"></span><span class="qq-upload-size"></span></span><div class="progress "><div class="progress-bar progress-blue" style="width: 0%"><span>0%</span></div></div></div>').appendTo('#xfupload_{$fieldname}');

            },
            onProgress: function(id, fileName, loaded, total){
                        $('#uploadfile-'+id+' .qq-upload-size').text(DLEformatSize(loaded)+' 
    {$lang['media_upload_st8']} '+DLEformatSize(total));
                        var proc = Math.round(loaded / total * 100);
                        $('#uploadfile-'+id+' .progress-bar').css( "width", proc + '%' );
                        $('#uploadfile-'+id+' .qq-upload-spinner').css( "display", "inline-block");

            },
            onComplete: function(id, fileName, response){

                            totalqueue_
    {$fieldcount} --;

                            if ( response.success ) {
                                totaluploaded_
    {$fieldcount} ++;

                                var fieldvalue = $('#xf_
    {$fieldname}').val();
                           
                                var returnbox = response.returnbox;
                                var returnval = response.xfvalue;

                                returnbox = returnbox.replace(/&lt;/g, "<");
                                returnbox = returnbox.replace(/&gt;/g, ">");
                                returnbox = returnbox.replace(/&amp;/g, "&");

                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st9']}');
                                $('#uploadedfile_
    {$fieldname}').append( returnbox );
                               
                                if (fieldvalue == "") {
                                    $('#xf_
    {$fieldname}').val(returnval);
                                } else {
                                    fieldvalue += ',' +returnval;
                                    $('#xf_
    {$fieldname}').val(fieldvalue);
                                }

                                if(maxallowfiles_
    {$fieldcount} && totaluploaded_{$fieldcount} == maxallowfiles_{$fieldcount} ) {
                                        $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
                                }

                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow', function() { $(this).remove(); });
                                }, 1000);

                            } else {
                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st10']}');

                                if( response.error ) $('#uploadfile-'+id+' .qq-status').append( '<br /><span class="text-danger">' + response.error + '</span>' );

                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow');
                                }, 4000);
                            }
            },
            messages: {
                typeError: "
    {$lang['media_upload_st11']}",
                sizeError: "
    {$lang['media_upload_st12']}",
                emptyError: "
    {$lang['media_upload_st13']}"
            },
            debug: false
        });
       
        if(maxallowfiles_
    {$fieldcount} && totaluploaded_{$fieldcount} >=  maxallowfiles_{$fieldcount} ) {
            $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
        }
    HTML;

            if (
    $xfieldmode == "site") {
               
    $onload_scripts[] = <<<HTML
    if ($('#xfupload_{$fieldname}').length){
        
    {$uploadscript}
    }
    HTML;
               
    $output .= <<<HTML
    <tr id="$holderid{$uid}>
    <td class="addnews">
    $value[1]: [not-optional]<span style="color:red;">*</span>[/not-optional]</td>
    <td class="xfields" colspan="2"><div id="xfupload_
    {$fieldname}"></div><input type="hidden" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/>{$value[18]}
    <script type="text/javascript">
    {$del_function}
    </script>
    </td>
    </tr>
    HTML;

                
    $xfieldinput[$fieldname] = "<div id=\"xfupload_{$fieldname}\"></div><input type=\"hidden\" name=\"xfield[$fieldname]\" id=\"xf_$fieldname\" value=\"{$fieldvalue}\" {$params}/><script type=\"text/javascript\">{$del_function}</script>";
               
            } else {
                       
    $output .= <<<HTML
    <div id="$holderid" class="form-group" {$uid}>
      <label class="control-label col-sm-2">
    {$value[1]}: [not-optional]<span style="color:red;">*</span>[/not-optional] {$value[18]}</label>
      <div class="col-sm-10"><div id="xfupload_
    {$fieldname}"></div><input type="hidden" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/>
    <script type="text/javascript">
    {$del_function}
    jQuery(function($){
    {$uploadscript}
    });
    </script>
      </div>
    </div>
    HTML;

            }

           
          } elseif( 
    $value[3] == "file" ) {
           
            
    $max_file_size = (int)($value[15] * 1024);
            
    $allowed_files explode','strtolower$value[14] ) );
            
    $allowed_files implode"', '"$allowed_files );

            
    $fieldvalue str_replace('&amp;''&'$fieldvalue);

            if (!
    $value[5]) {
                
    $params "rel=\"essential\" ";
                
    $uid "uid=\"essential\" ";

            } else {

                
    $params "";
                
    $uid "";

            }

            if( 
    $fieldvalue ) {
               
                
    $fileid intval(preg_replace"'\[attachment=(.*?):(.*?)\]'si""\\1"$fieldvalue ));
               
                
    $fileid "&nbsp;<button class=\"qq-upload-button btn btn-sm btn-red bg-danger btn-raised\" onclick=\"xffiledelete('".$fieldname."','".$fileid."');return false;\">{$lang['xfield_xfid']}</button>";

                
    $show="display:inline-block;";
               
            } else { 
    $show="display:none;"$fileid="";}
           
    $uploadscript = <<<HTML
        new qq.FileUploader({
            element: document.getElementById('xfupload_
    {$fieldname}'),
            action: 'engine/ajax/upload.php',
            maxConnections: 1,
            multiple: false,
            allowdrop: false,
            encoding: 'multipart',
            sizeLimit: 
    {$max_file_size},
            allowedExtensions: ['
    {$allowed_files}'],
            params: {"PHPSESSID" : "
    {$sess_id}", "subaction" : "upload", "news_id" : "{$news_id}", "area" : "xfieldsfile", "author" : "{$author}", "xfname" : "{$fieldname}", "user_hash" : "{$dle_login_hash}"},
            template: '<div class="qq-uploader">' +
                    '<div class="qq-upload-button btn btn-green bg-teal btn-sm btn-raised" style="width: auto;">
    {$lang['xfield_xfif']}</div>' +
                    '<ul class="qq-upload-list" style="display:none;"></ul>' +
                 '</div>',
            onSubmit: function(id, fileName) {

                        $('<div id="uploadfile-'+id+'" class="file-box"><span class="qq-upload-file-status">
    {$lang['media_upload_st6']}</span><span class="qq-upload-file">&nbsp;'+fileName+'</span>&nbsp;<span class="qq-status"><span class="qq-upload-spinner"></span><span class="qq-upload-size"></span></span><div class="progress"><div class="progress-bar progress-blue" style="width: 0%"><span>0%</span></div></div></div>').appendTo('#xfupload_{$fieldname}');

            },
            onProgress: function(id, fileName, loaded, total){
                        $('#uploadfile-'+id+' .qq-upload-size').text(DLEformatSize(loaded)+' 
    {$lang['media_upload_st8']} '+DLEformatSize(total));
                        var proc = Math.round(loaded / total * 100);
                        $('#uploadfile-'+id+' .progress-bar').css( "width", proc + '%' );
                        $('#uploadfile-'+id+' .qq-upload-spinner').css( "display", "inline-block");

            },
            onComplete: function(id, fileName, response){

                            if ( response.success ) {
                                var returnbox = response.returnbox;
                                var returnval = response.xfvalue;

                                returnbox = returnbox.replace(/&lt;/g, "<");
                                returnbox = returnbox.replace(/&gt;/g, ">");
                                returnbox = returnbox.replace(/&amp;/g, "&");

                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st9']}');
                                $('#xf_
    {$fieldname}').show();
                                $('#uploadedfile_
    {$fieldname}').html( returnbox );
                                $('#xf_
    {$fieldname}').val(returnval);
                                $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
                               
                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow', function() { $(this).remove(); });
                                }, 1000);

                            } else {
                                $('#uploadfile-'+id+' .qq-status').html('
    {$lang['media_upload_st10']}');

                                if( response.error ) $('#uploadfile-'+id+' .qq-status').append( '<br /><span class="text-danger">' + response.error + '</span>' );

                                setTimeout(function() {
                                    $('#uploadfile-'+id).fadeOut('slow');
                                }, 4000);
                            }
            },
            messages: {
                typeError: "
    {$lang['media_upload_st11']}",
                sizeError: "
    {$lang['media_upload_st12']}",
                emptyError: "
    {$lang['media_upload_st13']}"
            },
            debug: false
        });
       
        if($('#xf_
    {$fieldname}').val() != "" ) {
            $('#xfupload_
    {$fieldname} .qq-upload-button, #xfupload_{$fieldname} .qq-upload-button input').attr("disabled","disabled");
        }
       
    HTML;

            if (
    $xfieldmode == "site") {
               
    $onload_scripts[] = <<<HTML
    if ($('#xfupload_{$fieldname}').length){
        
    {$uploadscript}
    }
    HTML;
               
    $output .= <<<HTML
    <tr id="$holderid{$uid}>
    <td class="addnews">
    $value[1]: [not-optional]<span style="color:red;">*</span>[/not-optional]</td>
    <td class="xfields" colspan="2"><input style="
    {$show}" type="text" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/><span id="uploadedfile_{$fieldname}">{$fileid}</span><div id="xfupload_{$fieldname}"></div>{$value[18]}</td>
    </tr>
    HTML;

                
    $xfieldinput[$fieldname] = "<input style=\"{$show}\" type=\"text\" name=\"xfield[$fieldname]\" id=\"xf_$fieldname\" value=\"{$fieldvalue}\" {$params}/><span id=\"uploadedfile_{$fieldname}\">{$fileid}</span><div id=\"xfupload_{$fieldname}\"></div>";
               
            } else {
           
    $output .= <<<HTML
    <div id="$holderid" class="form-group" {$uid}>
      <label class="control-label col-sm-2">
    {$value[1]}: [not-optional]<span style="color:red;">*</span>[/not-optional] {$value[18]}</label>
      <div class="col-sm-10"><input class="form-control width-350 position-left" style="margin-bottom:5px;
    {$show}" type="text" name="xfield[$fieldname]" id="xf_$fieldname" value="{$fieldvalue}{$params}/><span id="uploadedfile_{$fieldname}">{$fileid}</span><div id="xfupload_{$fieldname}"></div>
    <script type="text/javascript">
    jQuery(function($){
    {$uploadscript}
    });
    </script>
      </div>
    </div>
    HTML;

            }      
          }
     
  2. DLEPlugins

    Кодер

    Регистрация:
    29 ноя 2015
    Сообщения:
    1.608
    Лучших ответов:
    8
    Рейтинги:
    +1.194 / 9 / -0
  3. PunPun

    VIP Кинотрафик v2

    Регистрация:
    11 июн 2015
    Сообщения:
    7.298
    Лучших ответов:
    31
    Рейтинги:
    +3.894 / 96 / -0
  4. DLEPlugins

    Кодер

    Регистрация:
    29 ноя 2015
    Сообщения:
    1.608
    Лучших ответов:
    8
    Рейтинги:
    +1.194 / 9 / -0
    Называй модули правильно значит. А не вводи в заблуждение. Человек ищет мульти выбор значений доп полей. Название твоего модуля " DLE MultiXfield - Мульти выбор значений дополнительных полей". Да, дальше названия не читал. В связи с этим скидываю автору такую ссылку
    Multi Select
     
  5. TopicStarter Overlay
    usergeyv

    usergeyv Посетитель

    Регистрация:
    18 апр 2017
    Сообщения:
    58
    Лучших ответов:
    0
    Рейтинги:
    +12 / 0 / -0
    Может меня не правильно поняли, но нужно мультивыбор для добавления новости на сайт
    Действительно там "Модуль подойдет любому сайту на DLE где используются дополнительные поля и нужно сделать простой подбор новостей по ним."
     
  6. TopicStarter Overlay
    usergeyv

    usergeyv Посетитель

    Регистрация:
    18 апр 2017
    Сообщения:
    58
    Лучших ответов:
    0
    Рейтинги:
    +12 / 0 / -0
    В php не селен, исправьте меня, я так понимаю данные select multiple пишутся в переменную $select , нужно использовать массив $select[], а потом implode(",", $select); .но результат
    Код:
    Fatal error: [] operator not supported for strings in /home
     
Яндекс.Метрика