#!/bin/bash SITE=@gmphome SRC=@gklive WEBUSER=www-data WEBGROUP=www-data CLEAN=false ROOT=`drush $SITE status 'Drupal Root' --pipe` SITE_PATH=`drush $SITE status 'Site Path' --pipe` SETTINGS=$ROOT/$SITE_PATH/settings.php TMP=/home/ga/tmp/wysiwyg-ckeditor echo "the root for $SITE is $ROOT" if $CLEAN ; then drush rsync $SRC $SITE --delete drush sql-sync $SRC $SITE --create-db drush @gkdev updatedb fi # # Step 0: Disable some modules that we do not need. # # In particular, lightbox 2 blows up with jquery_update-6.x-2.x-dev. # drush $SITE dis lightbox2 fckeditor imce # # Step 1: Download wysiwyg and enable it # drush $SITE dl wysiwyg drush $SITE en wysiwyg # # Step 2: Put ckeditor into sites/all/libraries # mkdir -p $ROOT/sites/all/libraries mkdir -p $TMP (cd $TMP && wget -nc -nd http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.2.1/ckeditor_3.2.1.tar.gz) (cd $ROOT/sites/all/libraries && tar xzvf $TMP/ckeditor_3.2.1.tar.gz) # # Step 3: # # visit admin/settings/wysiwyg # delete all of the wysiwyg profiles # re-save with ckeditor # # # Step 4: # # Configure filtered html profile # # Buttons: # as desired # # Cleanup and output: # Force cleanup on standard paste # # CSS: # # editor default css # # # Step 5: Insert black magic into settings file # # I will probably burn in hell for this hack, but it is # a convenient way to set up your ckeditor defaults # without modifying config.js in ckeditor (which is # ignored anyway). # # If you have a module MYMODULE, then rename the # hook below to MYMODULE_wysiwyg_editor_settings_alter # and keep this out of your settings.php file. # if [ "x"`grep 'wysiwyg_wysiwyg_editor_settings_alter' $SETTINGS` == "x" ] ; then cat << "__END__" >> $SETTINGS function wysiwyg_wysiwyg_editor_settings_alter(&$settings, &$context) { if($context['profile']->editor == 'ckeditor') { $settings['uiColor'] = '#88AA4E'; $settings['scayt_autoStartup'] = TRUE; } } __END__ else echo "black magic already inserted in settings" fi # # Decided against the 'insert' module # # drush $SITE dl insert content filefield imagefield # # Step 6: Download wysiwyg_imageupload # # IMPORTANT: Requires jquery_update-6.x-2.x-dev, not the jquery_update stable release (currently 6.x-1.1) # drush $SITE dl wysiwyg_imageupload drush $SITE dl jquery_update-6.x-2.x-dev jquery_ui jquery_ui_dialog drush $SITE dl imageapi imageapi_gd imagecache image_resize_filter # # Step 7: We need to download jqueryui before we enable jquery_ui. # We also need to upgrade to jquery 1.3 in order for this to work. # (cd $TMP && wget -nc -nd http://jquery-ui.googlecode.com/files/jquery-ui-1.7.2.zip) (cd $ROOT/sites/all/modules/jquery_ui/ && unzip $TMP/jquery-ui-1.7.2.zip && mv jquery-ui-1.7.2 jquery.ui) # # Step 8: Now we're ready to enable everything # drush $SITE en wysiwyg_imageupload jquery_update jquery_ui jquery_ui_dialog imageapi imageapi_gd imagecache imagecache_ui image_resize_filter # # Then we get this message: # # The image resize filter has been installed. Before this does [warning] # anything, the image resize filter needs to be added to one or more # input formats. Visit the input format administration to set up this # filter. # # # Step 9: Go back to 'buttons' in the Wysiwyg Filtered html editor # and turn on image uploading. # # Also Visit admin/build/imagecache and make some image presets # # I made the following presets: # # full # large scale 480x480 # small scale 160x160 # # # Step 10: Repair file permissions if necessary # mkdir $ROOT/$SITE_PATH/files/imagecache chgrp -R $WEBGROUP $ROOT/$SITE_PATH/files chmod -R g+rw $ROOT/$SITE_PATH/files # # Steo 11: Create a custom filter # drush $SITE dl customfilter drush $SITE en customfilter # # Pre-IMG filter: # # /(<)(\s*img[^>]+)(>)/i # PHP code on # $result='[' . $matches[2] . ']'; # # Post-IMG filter: # # /(\[)(\s*img[^>]+)(\])/i # PHP code on # $result='<' . $matches[2] . '>'; # Go to 'input formats' # Edit 'Filtered HTML' # Enable pre-img filter and post-img filter # Make sure order is: # pre-img filter # html filter # post-img filter