Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit Page - Add Links - Combobox with list of uploaded files
#1
Good day
-----------

Gs Version : 2.01 (stable downloaded)
File : admin/edit.php

Based on what I did in this post

http://get-simple.info/forum/viewtopic.php?id=1048

I added a combo box to the link dialog box also of CKEditor.

Added the following code to the existing plugin for the Image dialog box
I also added my admin/edit.php file for those that want tot take a look
Code:
if ( dialogName == 'link' ) {
            var infoTab = dialogDefinition.getContents( 'info' );
            var dlg = dialogDefinition.dialog;

            //Add the combo box
            infoTab.add( {
                    id : 'cmbGSFiles',
                    type : 'select',
                    labelLayout : 'horizontal',
                    widths : [ '35%','85%' ],
                    style : 'width:90px',
                    label : 'Uploaded Files ',
                    'default' : '',
                    items :
                    [  
                        [ 'Custom' , 'CUSTOM']
    
                       <?php
                            $path = GSDATAUPLOADPATH;
                            $filenames = getFiles($path);
                            if (count($filenames) != 0) {
                                foreach ($filenames as $file) {
                                        if ($file == "." || $file == ".." || is_dir($path . $file) || $file == ".htaccess") {
                                            // not a upload file
                                        } else {
                                                
                                                $URLtothefile = $SITEURL."data/uploads/$file";
                                                $URLtothefile = str_replace("http://","",$URLtothefile);
                                                echo ",[ '$file' , '$URLtothefile']";
                                        
                                        }
                                }
                            }
                       ?>
                        
                    ],
                    onChange : function() {
                      var cmbValue = this.getValue();
                      if (cmbValue != 'CUSTOM') {
                        dlg.setValueOf( 'info', 'url', cmbValue );
                      }  
                    }

                });

        }

Hope it can help somebody
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply




Users browsing this thread: 1 Guest(s)