Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit page - Insert Image - Combo box with images
#2
Hi there.. Sorry, I noted I still had part of testing code there.. cleaned it up must look as follows now
(my edit.php file is included also)

Code:
<script type="text/javascript">
    //<![CDATA[

// Added GS image files to be selectable via the image insert system.
// Author : Dominion IT
// url : www.dominion-it.co.za
CKEDITOR.on( 'dialogDefinition', function( ev )
    {
        var dialogName = ev.data.name;
        var dialogDefinition = ev.data.definition;
        
        if ( dialogName == 'image' ) {
            var infoTab = dialogDefinition.getContents( 'info' );
            var dlg = dialogDefinition.dialog;

            //Add the combo box
            infoTab.add( {
                    id : 'cmbGSImages',
                    type : 'select',
                    labelLayout : 'horizontal',
                    widths : [ '35%','85%' ],
                    style : 'width:90px',
                    label : 'Uploaded Images ',
                    '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 {
                                        $ext = substr($file, strrpos($file, '.') + 1);
                                        if (strtolower($ext) == 'gif' || strtolower($ext) == 'jpg' || strtolower($ext) == 'jpeg' || strtolower($ext) == 'png') {
                                            $URLtothefile = $SITEURL."/data/uploads/$file";
                                            echo ",[ '$file' , '$URLtothefile']";
                                        }
                                    }
                                }
                            }
                       ?>
                        
                    ],
                    onChange : function() {
                      var cmbValue = this.getValue();
                      if (cmbValue != 'CUSTOM') {
                        dlg.setValueOf( 'info', 'txtUrl', cmbValue );
                      }  
                    }

                });

        }        
    });

    //]]>
    </script>
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply


Messages In This Thread
Edit page - Insert Image - Combo box with images - by dominionit - 2010-09-12, 08:58:46



Users browsing this thread: 1 Guest(s)