Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit page - Insert Image - Combo box with images
#1
Good day
------------

GS Version : 2.01 (stable downloaded)
Code changed : admin/edit.php
From Line : 304

I dont really know where to put this, but wanted to share as I hope it can help someone. is not really a plugin but enhancement of GS. I made a plugin for CKEditor to allow a combo box with all the image names in the uploads folder to be selectable and when you select them the correct url is added automatically for you to the URL at the top and image become viewable. I also added my edit.php file to the post for those that want to take a look.

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);
                                        $extention = get_FileType($ext);
                                        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>

Hope it can help somebody

Dominion IT

www.dominion-it.co.za
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:25:45



Users browsing this thread: 1 Guest(s)