GetSimple Support Forum
Edit page - Insert Image - Combo box with images - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Edit page - Insert Image - Combo box with images (/showthread.php?tid=974)



Edit page - Insert Image - Combo box with images - dominionit - 2010-09-12

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


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-12

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>



Edit page - Insert Image - Combo box with images - dominionit - 2010-09-12

Hi there.

Added small bug fix with the url had double // in them.

Also added custom links to the links dialog box as in this post

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

Hope it can help somebody..
(File is attached to this post)


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-12

Hi there
-0=0-=0-=

Hopefully last updated.

I added a selection box for Thumbnails and the smaller version of the images also. Thus you can select all 3 versions of the image that is automatically available from one place now.

Attached my admin/edit.php file to post

Hope it can help


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-13

Hi there.

Here is image of what the new insert image dialog looks like

[Image: beeld_in_page_4.jpg]


Edit page - Insert Image - Combo box with images - erix1 - 2010-09-23

dominionit Wrote:Hi there.

Here is image of what the new insert image dialog looks like

[Image: beeld_in_page_4.jpg]

Very nice! One of the most customer-friendly enhancements I´ve seen. Only one thing: You have to save the page between each inserted image, or the image-button won´t work.

Great one! Erix1


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-24

Thanks, will look into it.., just game back from week away.. just have to catchup on stuff first..tx


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-25

erix1 Wrote:
dominionit Wrote:Hi there.

Here is image of what the new insert image dialog looks like

Very nice! One of the most customer-friendly enhancements I´ve seen. Only one thing: You have to save the page between each inserted image, or the image-button won´t work.

Great one! Erix1

Hi there.

K I fixed the problem. Could not believe what it was Big Grin but at least it is fixed. had to force all combo boxes back to Custom after all selects else it had error creating new box. But all are working and fixed now.

thanks, hope it helps. let me know if there is any other issues.


Edit page - Insert Image - Combo box with images - dominionit - 2010-09-28

Hi there.

Made a version for GS v2.03.

works without issue that I could see. say if you find anything

thanks