Solve THINKCMF Background Article album Atlas can only upload a picture of the problem

Source: Internet
Author: User

problems encountered:recently used THINKCMF to customers to develop a corporate website, customers in the use of a period of time after the call to say Backstage article editing page there is a problemthrough the ditch know, in the background article edit and add page album Atlas can only upload one picture at a time
 after having confirmed all the details with the customer, we started to solve the problem, the home page was tested locally and found that the customer was right, so we looked at the source codein \tpl_admin\simpleboot\asset\swfupload.htmlfoundThe number of uploaded images is fixed, and after the problem is found, there is no existing solution to search the network .not found on the network of existing solutions, and then do their own work directly in the source to solveSolution:implementation principle: mainly in the page call to add a parameter, and then on the upload page based on this parameter dynamically set the number to upload 1. Modifications\tpl_admin\simpleboot\asset\swfupload.html source file code (only modified JS file listed)
<script>/** * @Author: htl* @Email: [Email protected]* @DateTime: 2015-07-13 14:23:01* @Description: Customize the number of uploads by parameters*/var _file_upload_limit= "<php>echo $_get[' max_count '];</php>";//The default is 1, and 0 means no limitif (_file_upload_limit.length<=0) _file_upload_limit=1;//for gallery loadingfunctionSet_iframe (ID,src) {if($ ("#" +id). attr ("src") = = ""){$("#" +id). attr ("src",src);}}//Network Addressfunctionaddonlinefile (obj) {varSTRs = $ (obj). val ()? ' | ' + $ (obj). Val (): ";$(' #att-status ').html (STRs);}//whether to add watermark settingsfunctionChange_params () {if($ (' #watermark_enable '). attr (' checked ')) ) {swfu. addPostParam (' watermark_enable ', ' 1 ');}Else{swfu. Removepostparam (' watermark_enable ');}}//picture Selection Processing callbackfunctionAlbum_cancel (Obj,id,source) {//Image Addressvarsrc = $ (obj). attr ("Data-path");//upload image file namevarfilename = $ (obj). attr ("title");//Select the data object in the StatevarSelected = $ ("#fsUploadProgress. Selected");if($ ("#aid-" +id). Hasclass (' selected '))){$("#aid-" +id). Removeclass ("Selected"); selected= $ ("#fsUploadProgress. Selected");varIMGSTR = $ ("#att-status").html ();varLength = Selected.children ("img").length;varSTRs = filenames = "; for(vari=0;i<length;i++) {STRs+ = ' | ' +selected.children ("img"). EQ (i). attr (' path '); filenames+ = ' | ' +selected.children ("img"). EQ (i). attr (' title ');} $(' #att-status ').html (STRs); $ (' #att-status ').html (filenames);}Else{varnum = $ (' #att-status '). html ().Split(' | ').length;varFile_upload_limit =_file_upload_limit;//number of custom uploads//_file_upload_limit=0 to Unlimitedif(file_upload_limit>0&&num > File_upload_limit) {alert (' cannot select more than ' +file_upload_limit+ ' attachments '); returnfalse;} $("#aid-" +id). AddClass ("Selected");$(' #att-status '). Append (' | ') +SRC); $ (' #att-name '). Append (' | ') +filename);}}</script><scripttype= "Text/javascript" >varswfu = ' '; $ (document). Ready (function() { wind. Use("SWFUpload", GV. dimaub+ "Statics/js/swfupload/handlers.js",function() {swfu=newswfupload ({flash_url: "__root__/statics/js/swfupload/swfupload.swf",Upload_url: "{: U (' asset/swfupload ')}",File_post_name: "Filedata",Post_params:{"{: C (' var_session_id ')}": "{: session_id ()}", "Thumb_width": "0", "thumb_height": "0", "watermark_enable": "1", " Filetype_post ":" Jpg|jpeg|gif|png|bmp|zip "},File_size_limit: "20240KB",File_Types: "*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.zip",file_types_description: "All Files",File_upload_limit:_file_upload_limit,//number of custom uploadsCustom_settings: {progresstarget: "fsuploadprogress", Cancelbuttonid: "Btncancel"},Button_image_url:"",Button_width: 75,Button_height: 28,button_placeholder_id: "Buttonplaceholder",Button_text_style:"",button_text_top_padding: 3,button_text_left_padding: 12,Button_window_mode: Swfupload.window_mode. TRANSPARENT,Button_cursor: SWFUpload.CURSOR.HAND,File_dialog_start_handler: Filedialogstart,File_queued_handler: filequeued,File_queue_error_handler: Filequeueerror,File_dialog_complete_handler: Filedialogcomplete,Upload_progress_handler: Uploadprogress,Upload_error_handler: Uploaderror,Upload_success_handler: Uploadsuccess,Upload_complete_handler:uploadcomplete} );})</script><script>$(function(){$("#att-status"). HTML ("");$("#att-status-del"). HTML ("");$("#att-name"). HTML ("");});//set the maximum number of uploads, 0 for unlimited quantityif (_file_upload_limit<=0) $ ("#max_count"). Text ("N"); else $ ("#max_count"). Text (_file_upload_limit);</script>

2. Replace the edit.html and add.html in \tpl_admin\simpleboot\portal\adminpost\ with the following contents   
<ahref= "javascript:;" Style= "margin:5px0;" onclick= "Javascript:flashupload (' albums_images ', ' image upload ', ' photos ', change_images, ' 10,gif|jpg|jpeg|png|bmp,0 ', ', ' ', ') "class=" Btn "> select picture </a>// change to, max_count=0 means no limit, set default to 1<ahref=" javascript:; " Style= "margin:5px0;" onclick= "Javascript:flashupload (' albums_images ', ' image upload ', ' photos ', change_images, ' 10,gif|jpg|jpeg|png|bmp,0 ', ', ' &max_count=0 ', ') 'class= ' btn ' > select Picture </a>

Max_count=0 max_count=5 or the specified number max_count= is not set to default to 1    



From for notes (Wiz)



Solve THINKCMF Background Article album Atlas can only upload a picture of the problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.