<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/simple_cms_images/_show_image_list.rhtml.backup.2008_08_20</filename>
    </added>
    <added>
      <filename>app/views/simple_cms_images/_show_image_list.rhtml.good_ie</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/css/advimage.css.backup.2008_08_20</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/css/advimage.css.good_ie</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/images/delete-icon.jpg</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/images/delete-icon_grey.jpg</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/jscripts/functions.js.backup.2008_08_20</filename>
    </added>
    <added>
      <filename>assets/javascripts/tiny_mce_init.js</filename>
    </added>
    <added>
      <filename>lib/render.rb</filename>
    </added>
    <added>
      <filename>lib/view_paths.rb</filename>
    </added>
    <added>
      <filename>tasks/convert_simple_cms_params.rake</filename>
    </added>
    <added>
      <filename>tasks/dev_to_prod_tasks.rake</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,18 +4,21 @@ SimpleCMS
 Created by Slaive and PullMonkey (December 2007). This is a very good,
 easy to use cms plugin.
 
-This plugin is built for rails version 2.0.2. So if you are using an older 
+This plugin is built for rails versions &lt;= 2.1.0. So if you are using an older 
 version of rails then you will need to edit each of the controllers 
-from: 
+uncomment this for rails versions &gt;= 2.0 and &lt; 2.1
   self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
-to:
+uncomment this for rails versions &lt; 2.0
   self.template_root = File.join(File.dirname(__FILE__), '..', 'views')
 
+and comment out this in the lib/simple_cms.rb file
+  self.append_view_paths File.join(File.dirname(__FILE__), '..', 'app', 'views')
+
 
 SimpleCMS dependencies
 ======================
 
-Once you have SimpleCMS installed you will need to install 3 more plugins:
+Once you have SimpleCMS installed you will need to install 4 more plugins:
     - attachment_fu
     - responds_to_parent
     - acts_as_versioned
@@ -26,8 +29,11 @@ You can do this easily by using the command:
 If this doesn't work you can do it manually by doing the following commands:
     ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/attachment_fu/
     ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/responds_to_parent/
-    ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/acts_as_versioned/
     ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/coderay/
+  If you are using rails versions &gt;= 2.1.1 then install this one
+    ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/acts_as_versioned_2.1.1/
+  If you are using rails versions &lt; 2.1.1 then install this one
+    ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/acts_as_versioned/
 
 
 You will also need to have an image processor installed. There are 3 to choose from:</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,12 @@
 class SimpleCmsImagesController &lt; ApplicationController
-  # For Rails version 2.1 and greater
-  self.append_view_path(File.join(File.dirname(__FILE__), '..', 'views'))
-  # For Rails version 2.0 and greater
-  #self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
-  # For Rails versions less than 2.0
-  #self.template_root = File.join(File.dirname(__FILE__), '..', 'views')
+  # For Rails version &gt;= 2.1
+  # uncomment self.append_view_path File.join(File.dirname(__FILE__), '..', 'app', 'views')
+  # in lib/simple_cms.rb file
+  # For Rails version &gt;= 2.0 and &lt; 2.1
+	#self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
+  # For Rails versions &lt; 2.0
+	#self.template_root = File.join(File.dirname(__FILE__), '..', 'views')
+  
   skip_before_filter :verify_authenticity_token
 
   def index
@@ -58,9 +60,8 @@ class SimpleCmsImagesController &lt; ApplicationController
     @image = SimpleCmsImage.find(params[:id])
     @image.destroy
 
-    respond_to do |format|
-      # format.html { redirect_to my_image_url }
-      format.xml { head :ok }
+    render :update do |page|
+      page[&quot;image_#{params[:id]}&quot;].remove
     end
   end
 end</diff>
      <filename>app/controllers/simple_cms_images_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,46 +1,50 @@
 class SimpleCmsItemsController &lt; ApplicationController
-  # For Rails version 2.1 and greater
-	self.append_view_path(File.join(File.dirname(__FILE__), '..', 'views'))
-  # For Rails version 2.0 and greater
+  # For Rails version &gt;= 2.1
+  # uncomment self.append_view_path File.join(File.dirname(__FILE__), '..', 'app', 'views')
+  # in lib/simple_cms.rb file
+  # For Rails version &gt;= 2.0 and &lt; 2.1
 	#self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
-  # For Rails versions less than 2.0
+  # For Rails versions &lt; 2.0
 	#self.template_root = File.join(File.dirname(__FILE__), '..', 'views')
   
   skip_before_filter :verify_authenticity_token
   #before_filter :authenticate
   require 'coderay'
   layout 'plugin'
-  #caches_action :content
 	def edit
-    logger.error(&quot;\ncms_referer: &quot; + session[&quot;cms_referer&quot;].to_s + &quot;\n\n&quot;)
+		@simple_cms_item = SimpleCmsItem.find(params[:id])
+    referer = session[:cms_data][@simple_cms_item.params][:referer]
+    #logger.error(&quot;\nsession data: &quot; + session[:cms_data].inspect + &quot;\n\n&quot;)
+    logger.error(&quot;\ncms_referer: &quot; + referer.to_s + &quot;\n\n&quot;)
     # if no referer, then redirect to base root of application
     # the user jumped to edit without going through the interface
     # this is a no no for many reasons
-    if session[&quot;cms_referer&quot;].nil?
-      logger.error(&quot;\nThere was no referer!!\n\n&quot;)
+    if referer.nil?
       # derive base root path
       path = request.env[&quot;REQUEST_PATH&quot;].gsub(/simple_cms_items.*$/, &quot;&quot;)
       redirect_to path
       return
     end
     
-		@simple_cms_item = SimpleCmsItem.find(params[:id])
     @versions = @simple_cms_item.versions
-################ CHECK THIS ##########    @cms_item_version = @simple_cms_item
-    @prefix = session[&quot;cms_prefix&quot;][@simple_cms_item.params]
+    @prefix = session[:cms_data][@simple_cms_item.params][:prefix]
 
     # if user is not an admin, redirect to the refering page
-    if !session[&quot;cms_admin&quot;][@simple_cms_item.params]
-      redirect_to session[&quot;cms_referer&quot;]
+    if !session[:cms_data][@simple_cms_item.params][:admin]
+      redirect_to referer
 			return
 		elsif request.post?
+      if params[:commit] == &quot;Cancel&quot;
+        redirect_to referer
+        return
+      end
       if !(@simple_cms_item.data.to_s == params[:simple_cms_item][:data].to_s)
-        @simple_cms_item.updated_by = session[&quot;cms_user&quot;][@simple_cms_item.params]
+        @simple_cms_item.updated_by = session[:cms_data][@simple_cms_item.params][:user]
         @simple_cms_item.update_attributes(params[:simple_cms_item])
       else
         logger.error(&quot;\nUser did not make any changes\n&quot;)
       end
-      redirect_to session[&quot;cms_referer&quot;]
+      redirect_to referer
       return
 		end
 	end</diff>
      <filename>app/controllers/simple_cms_items_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,10 @@
 class SimpleCmsMediaController &lt; ApplicationController
-  # For Rails version 2.1 and greater
-	self.append_view_path(File.join(File.dirname(__FILE__), '..', 'views'))
-  # For Rails version 2.0 and greater
-  #self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
-  # For Rails versions less than 2.0
+  # For Rails version &gt;= 2.1
+  # uncomment self.append_view_path File.join(File.dirname(__FILE__), '..', 'app', 'views')
+  # in lib/simple_cms.rb file
+  # For Rails version &gt;= 2.0 and &lt; 2.1
+	#self.view_paths &lt;&lt; File.join(File.dirname(__FILE__), '..', 'views')
+  # For Rails versions &lt; 2.0
 	#self.template_root = File.join(File.dirname(__FILE__), '..', 'views')
   
   skip_before_filter :verify_authenticity_token</diff>
      <filename>app/controllers/simple_cms_media_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,44 @@
 class SimpleCmsItem &lt; ActiveRecord::Base
   acts_as_versioned
 
-  #def page_path
-  #  h = YAML.load(params)
-  #  h.delete(&quot;label&quot;)
-  #  return h
-  #  #return &quot;/&quot; + h[&quot;id&quot;].join(&quot;/&quot;)
-  #end
-  
   def label
     h = YAML.load(params)
-    return h[&quot;label&quot;]
+    h.each do |a|
+      return a[1] if a[0] == &quot;label&quot;
+    end
+    return nil
+    #return h[&quot;label&quot;]
   end
 
+  def domain
+    h = YAML.load(params)
+    h.each do |a|
+      return a[1] if a[0] == &quot;domain&quot;
+    end
+    return nil
+  end
+
+  def controller
+    h = YAML.load(params)
+    h.each do |a|
+      return a[1] if a[0] == &quot;controller&quot;
+    end
+    return nil
+  end
+
+  def action
+    h = YAML.load(params)
+    h.each do |a|
+      return a[1] if a[0] == &quot;action&quot;
+    end
+    return nil
+  end
+
+  def path
+    h = YAML.load(params)
+    h.each do |a|
+      return a[1].join(&quot;/&quot;) if a[0] == &quot;path&quot;
+    end
+    return nil
+  end
 end</diff>
      <filename>app/models/simple_cms_item.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,45 +1,9 @@
-&lt;% %&gt;
+&lt;% -%&gt;
 &lt;html&gt;
 	&lt;head&gt;
 		&lt;%= stylesheet_link_tag &quot;simple_cms&quot;, &quot;coderay&quot; %&gt;
-    &lt;%= javascript_include_tag :defaults, &quot;tiny_mce/tiny_mce&quot;, &quot;simple_cms&quot; %&gt;
-    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
-      tinyMCE.init({
-        mode : &quot;textareas&quot;,
-        theme : &quot;advanced&quot;,
-        plugins : &quot;devkit,style,layer,table,save,advhr,emotions,ts_advimage,iespell,preview,advmedia,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,insertcode,dd&quot;,
-        theme_advanced_disable : &quot;image&quot;,
-        theme_advanced_buttons1_add_before : &quot;save,newdocument,|&quot;,
-        theme_advanced_buttons1_add : &quot;fontselect,fontsizeselect&quot;,
-        theme_advanced_buttons2_add_before: &quot;cut,copy,paste,pastetext,pasteword,|&quot;,
-        theme_advanced_buttons2_add : &quot;|,preview,|,print,|,fullscreen&quot;,
-        theme_advanced_buttons3_add_before : &quot;tablecontrols,|&quot;,
-        theme_advanced_buttons3_add : &quot;emotions,ts_image,advmedia,|,forecolor,backcolor&quot;,
-        theme_advanced_buttons4 : &quot;insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,insertcode,|,dd_code&quot;,
-        theme_advanced_toolbar_location : &quot;top&quot;,
-        theme_advanced_toolbar_align : &quot;left&quot;,
-        theme_advanced_path_location : &quot;bottom&quot;,
-        extended_valid_elements : &quot;a[name|href|target|title|onclick],img[class|src|style|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],code_highlighting[type]&quot;,
-        file_browser_callback : &quot;fileBrowserCallBack&quot;,
-        theme_advanced_resizing : true,
-        nonbreaking_force_tab : true,
-        apply_source_formatting : true,
-        template_replace_values : {
-          username : &quot;Jack Black&quot;,
-          staffid : &quot;991234&quot;
-        },
-        relative_urls : false,
-        remove_script_host : false
-      });
-
-      function fileBrowserCallBack(field_name, url, type, win) {
-        // This is where you insert your custom filebrowser logic
-        alert(&quot;Example of filebrowser callback: field_name: &quot; + field_name + &quot;, url: &quot; + url + &quot;, type: &quot; + type + &quot;, win: &quot; + win);
-        
-        // Insert new URL, this would normaly be done in a popup
-        //win.document.forms[0].elements[field_name].value = &quot;someurl.htm&quot;;
-      }
-    &lt;/script&gt;
+    &lt;%= javascript_include_tag :defaults, &quot;simple_cms&quot; %&gt;
+    &lt;%= javascript_include_tag &quot;tiny_mce/tiny_mce&quot;, &quot;tiny_mce_init&quot; %&gt;
 	&lt;/head&gt;
 	&lt;body&gt;
 		&lt;%= yield %&gt;</diff>
      <filename>app/views/layouts/plugin.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,17 @@
-&lt;% %&gt;
+&lt;% -%&gt;
 &lt;div class=&quot;simple_cms_item&lt;%= &quot;_admin&quot; if @cms_admin %&gt;&quot;
     &lt;%= &quot;onmouseover=\&quot;show_simple_cms_controls($(this))\&quot;&quot; if @cms_admin %&gt;
     &lt;%= &quot;onmouseout=\&quot;hide_simple_cms_controls($(this))\&quot;&quot; if @cms_admin %&gt;&gt;
-  &lt;% if @cms_admin and simple_cms_item.data.blank? %&gt;
+  &lt;% if @cms_admin and simple_cms_item.data.blank? -%&gt;
     &lt;b style=&quot;cursor: pointer;&quot; &lt;%= &quot;onclick=\&quot;edit_simple_cms_item(#{simple_cms_item.id},'#{@prefix}')\&quot;&quot; %&gt;&gt;Click to add content here.&lt;/b&gt;
-  &lt;% else %&gt;
+  &lt;% else -%&gt;
     &lt;div class=&quot;controls&quot;&gt;
-      &lt;% if @cms_admin %&gt;
+      &lt;% if @cms_admin -%&gt;
         &lt;b &lt;%= &quot;onclick=\&quot;edit_simple_cms_item(#{simple_cms_item.id},'#{@prefix}')\&quot;&quot; %&gt;&gt;Edit&lt;/b&gt;
-      &lt;% end %&gt;
+      &lt;% end -%&gt;
     &lt;/div&gt;
-    &lt;%= parse_coderay(simple_cms_item.data) %&gt;
-  &lt;% end %&gt;
+    &lt;% if !(simple_cms_item.data.nil? and !@cms_admin) -%&gt;
+      &lt;%= parse_coderay(simple_cms_item.data) %&gt;
+    &lt;% end -%&gt;
+  &lt;% end -%&gt;
 &lt;/div&gt;</diff>
      <filename>app/views/shared/_simple_cms_item.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,23 @@
 &lt;% if @images.size &gt; 0 %&gt;
 &lt;ul&gt;
   &lt;% @images.each_with_index do |image, i| %&gt;
-    &lt;li style=&quot;padding:0;margin:0list-style-type:none;display:inline;&quot;&gt;
-      &lt;a href=&quot;#&quot; onclick=&quot;ts_insert_image('&lt;%= image.public_filename %&gt;', 'ALT TEXT');&quot;&gt;&lt;%= @thumb_images[i] ? image_tag( @thumb_images[i].public_filename ) : image.filename + &quot;&lt;br /&gt;&quot; %&gt;&lt;/a&gt;
+    &lt;li style=&quot;padding:0;margin:0;list-style-type:none;display:inline;&quot;&gt;
+      &lt;a href=&quot;#&quot; onclick=&quot;ts_insert_image('&lt;%= image.public_filename %&gt;', 'ALT TEXT');&quot;&gt;
+      &lt;% if @thumb_images[i] -%&gt; 
+        &lt;div class=&quot;image&lt;%= &quot;_ie&quot; if request.env[&quot;HTTP_USER_AGENT&quot;] =~ /MSIE/ %&gt;&quot; id=&quot;image_&lt;%= image.id %&gt;&quot; onmouseover=&quot;show_image_controls($(this),&lt;%= image.id %&gt;)&quot; onmouseout=&quot;hide_image_controls($(this),&lt;%= image.id %&gt;)&quot;&gt;
+          &lt;%= image_tag( @thumb_images[i].public_filename, :align =&gt; &quot;top&quot; ) %&gt;&lt;/a&gt;
+          &lt;span id=&quot;controls_&lt;%= image.id %&gt;&quot; class=&quot;controls&quot;&gt;
+            &lt;%= link_to_remote( 
+                        image_tag(&quot;/javascripts/tiny_mce/plugins/ts_advimage/images/delete-icon_grey.jpg&quot;, 
+                               :width =&gt; &quot;25&quot;, :height =&gt; &quot;25&quot;, :alt =&gt; &quot;delete&quot;, :title =&gt; &quot;Delete Image&quot;), 
+                        :url =&gt; { :action =&gt; 'destroy', :id =&gt; image.id }, 
+                        :html =&gt; { :class =&gt; &quot;controls&quot; }, 
+                        :confirm =&gt; &quot;This will permanentally delete this image and everywhere you are linked to it will disapear.\n\nAre you sure you want to delete this image?&quot; ) %&gt;
+          &lt;/span&gt;
+        &lt;/div&gt;
+      &lt;% else %&gt;
+        &lt;%= image.filename + &quot;&lt;br /&gt;&quot; %&gt;&lt;/a&gt;
+      &lt;% end %&gt;
     &lt;/li&gt;
   &lt;% end %&gt;
 &lt;/ul&gt;</diff>
      <filename>app/views/simple_cms_images/_show_image_list.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,8 @@
   &lt;/h3&gt;
   &lt;%= text_area :simple_cms_item, :data, {:class =&gt; &quot;mceEditor&quot;} %&gt;
 	&lt;br/&gt;
-	&lt;%= submit_tag &quot;Save Content&quot; %&gt;
-	&lt;%= link_to &quot;cancel&quot;, session[&quot;cms_referer&quot;],
-              :confirm =&gt; &quot;Are you sure you want to discard your changes?&quot; %&gt;
+	&lt;%= submit_tag &quot;Save Content&quot;, :style =&gt; &quot;float:left;&quot; %&gt;
+  &lt;%= button_to &quot;Cancel&quot;, {}, :name =&gt; 'commit', :style =&gt; &quot;float:left;&quot;,
+                              :confirm =&gt; &quot;Are you sure you want to discard your changes?&quot; %&gt;
 	&lt;br/&gt;
 &lt;/div&gt;</diff>
      <filename>app/views/simple_cms_items/_form.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -227,6 +227,17 @@ function insertMedia() {
 		return false;
 	}
 
+  if (f.media_type.options[f.media_type.selectedIndex].value == &quot;file&quot;) {
+    h  = '&lt;a href=&quot;' + f.src.value + '&quot;';
+    h += ' target=&quot;_blank&quot;';
+    h += '&gt;';
+    h += f.link_text.value;
+    h += '&lt;/a&gt;';
+		tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h);
+	  tinyMCEPopup.close();
+    return;
+  }
+
 	f.width.value = f.width.value == &quot;&quot; ? 100 : f.width.value;
 	f.height.value = f.height.value == &quot;&quot; ? 100 : f.height.value;
 
@@ -384,7 +395,18 @@ function changedType(t) {
 	d.getElementById('shockwave_options').style.display = 'none';
 	d.getElementById('wmp_options').style.display = 'none';
 	d.getElementById('rmp_options').style.display = 'none';
-	d.getElementById(t + '_options').style.display = 'block';
+  d.getElementById('file_options').style.display = 'none';
+  if (t == 'file') {
+    d.getElementById('dimensions').style.display = 'none';
+    d.getElementById('prev').style.display = 'none';
+    d.getElementById('advanced_tab').style.display = 'none';
+    d.getElementById('file_options').style.display = '';
+  } else {
+    d.getElementById('dimensions').style.display = '';
+    d.getElementById('prev').style.display = '';
+    d.getElementById('advanced_tab').style.display = '';
+	  d.getElementById(t + '_options').style.display = 'block';
+  }
 }
 
 function serializeParameters() {
@@ -600,6 +622,9 @@ function generatePreview(c) {
 			codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
 			type = 'audio/x-pn-realaudio-plugin';
 			break;
+
+    case &quot;file&quot;:
+      break;
 	}
 
 	if (pl == '') {</diff>
      <filename>assets/javascripts/tiny_mce/plugins/advmedia/jscripts/media.js</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ size_limit : '500 megabytes',
 file : 'File/URL',
 list : 'List',
 size : 'Dimensions',
+link_text : 'Link Text',
 preview : 'Preview',
 constrain_proportions : 'Constrain proportions',
 type : 'Type',</diff>
      <filename>assets/javascripts/tiny_mce/plugins/advmedia/langs/en.js</filename>
    </modified>
    <modified>
      <diff>@@ -64,6 +64,7 @@
 										&lt;option value=&quot;shockwave&quot;&gt;Shockwave&lt;/option&gt;
 										&lt;option value=&quot;wmp&quot;&gt;Windows Media&lt;/option&gt;
 										&lt;option value=&quot;rmp&quot;&gt;Real Media&lt;/option&gt;
+                    &lt;option value=&quot;file&quot;&gt;Downloadable File&lt;/option&gt;
 									&lt;/select&gt;
 								&lt;/td&gt;
 							&lt;/tr&gt;
@@ -82,7 +83,7 @@
 								&lt;td&gt;&lt;label for=&quot;linklist&quot;&gt;{$lang_advmedia_list}&lt;/label&gt;&lt;/td&gt;
 								&lt;td id=&quot;linklistcontainer&quot;&gt;&amp;nbsp;&lt;/td&gt;
 							&lt;/tr&gt;
-							&lt;tr&gt;
+							&lt;tr id=&quot;dimensions&quot;&gt;
 								&lt;td&gt;&lt;label for=&quot;width&quot;&gt;{$lang_advmedia_size}&lt;/label&gt;&lt;/td&gt;
 								&lt;td&gt;
 								&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
@@ -93,6 +94,10 @@
 									&lt;/tr&gt;
 								&lt;/table&gt;
 							&lt;/tr&gt;
+              &lt;tr id=&quot;file_options&quot;&gt;
+                &lt;td&gt;&lt;label for=&quot;link_text&quot;&gt;{$lang_advmedia_link_text}&lt;/label&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;link_text&quot; name=&quot;link_text&quot; value=&quot;&quot; style=&quot;width: 230px;&quot; /&gt;&lt;/td&gt;
+              &lt;/tr&gt;
 					&lt;/table&gt;
 				&lt;/fieldset&gt;
 </diff>
      <filename>assets/javascripts/tiny_mce/plugins/advmedia/media.htm</filename>
    </modified>
    <modified>
      <diff>@@ -62,7 +62,7 @@ var TinyMCE_InsertCodePlugin = {
     tinyMCE.switchClass(editor_id + '_insertcode', 'mceButtonNormal');
 
     // Select insertcode button if parent node is a pre
-    if (tinyMCE.getParentElement(node, &quot;pre&quot;, &quot;class&quot;))
+    if (tinyMCE.getParentElement(node, &quot;code_highlighting&quot;))
       tinyMCE.switchClass(editor_id + '_insertcode', 'mceButtonSelected');
 
     return true;</diff>
      <filename>assets/javascripts/tiny_mce/plugins/insertcode/editor_plugin.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,75 +1,104 @@
 /* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('insertcode', 'en,fr,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl');
+tinyMCE.importPluginLanguagePack('insertcode');
 
-/**
- * Information about the plugin.
- */
-function TinyMCE_insertcode_getInfo() {
-	return {
-		longname : 'insertcode plugin',
-		author : 'Maxime Lardenois',
-		authorurl : 'http://www.jpnp.org',
-		infourl : 'http://www.jpnp.org',
-		version : &quot;1.0&quot;
-	};
-};
+// InsertCode Plugin
+var TinyMCE_InsertCodePlugin = {
+  /**
+   * Information about the plugin.
+   */
+  getInfo : function () {
+    return {
+      longname : 'insertcode plugin',
+      author : 'Sean Naegle',
+      authorurl : '',
+      infourl : '',
+      version : &quot;1.0&quot;
+    };
+  },
+
+  /**
+   * Gets executed when a editor needs to generate a button.
+   */
+  getControlHTML : function (cn) {
+    switch (cn) {
+      case &quot;insertcode&quot;:
+        return tinyMCE.getButtonHTML(cn, 'lang_insertcode_desc', '{$pluginurl}/images/insertcode.gif', 'mceInsertCode');
+    }
 
-/**
- * Gets executed when a editor needs to generate a button.
- */
-function TinyMCE_insertcode_getControlHTML(control_name) {
-	switch (control_name) {
-		case &quot;insertcode&quot;:
-			var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceinsertcode\', true);return false;';
-			return '&lt;a href=&quot;javascript:' + cmd + '&quot; onclick=&quot;' + cmd + '&quot; target=&quot;_self&quot; onmousedown=&quot;return false;&quot;&gt;&lt;img id=&quot;{$editor_id}_insertcode&quot; src=&quot;{$pluginurl}/images/insertcode.gif&quot; title=&quot;{$lang_insertcode_desc}&quot; width=&quot;20&quot; height=&quot;20&quot; class=&quot;mceButtonNormal&quot; onmouseover=&quot;tinyMCE.switchClass(this,\'mceButtonOver\');&quot; onmouseout=&quot;tinyMCE.restoreClass(this);&quot; onmousedown=&quot;tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');&quot; /&gt;&lt;/a&gt;';
-	}
+    return &quot;&quot;;
+  },
 
-	return &quot;&quot;;
-}
+  /**
+   * Gets executed when a command is called.
+   */
+  execCommand : function(editor_id, element, command, user_interface, value) {
+    // Handle commands
+    switch (command) {
+      // Remember to have the &quot;mce&quot; prefix for commands so they don't intersect with built in ones in the browser.
+      case &quot;mceInsertCode&quot;:
+        // Open a popup window
+        tinyMCE.openWindow({
+            file : '../../plugins/insertcode/insertcode.htm',
+            width : 550 + tinyMCE.getLang('lang_advmedia_delta_width', 0),
+            height : 500 + tinyMCE.getLang('lang_advmedia_delta_height', 0)
+          }, {
+            editor_id : editor_id,
+            resizable : &quot;yes&quot;,
+            scrollbars : &quot;no&quot;
+        });
+        
+        return true;
+    }
 
-/**
- * Gets executed when a command is called.
- */
-function TinyMCE_insertcode_execCommand(editor_id, element, command, user_interface, value) {
-	// Handle commands
-	switch (command) {
-		// Remember to have the &quot;mce&quot; prefix for commands so they don't intersect with built in ones in the browser.
-		case &quot;mceinsertcode&quot;:
-			// Show UI/Popup
-			if (user_interface) {
-				// Open a popup window
-				var insertcode = new Array();
+    // Pass to next handler in chain
+    return false;
+  },
 
-				insertcode['file'] = '../../plugins/insertcode/insertcode.htm'; // Relative to theme
-				insertcode['width'] = 550;
-				insertcode['height'] = 500;
+  /**
+   * Gets executed when the selection/cursor position was changed.
+   */
+  handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+    // Deselect insertcode button
+    tinyMCE.switchClass(editor_id + '_insertcode', 'mceButtonNormal');
 
-				tinyMCE.openWindow(insertcode, {editor_id : editor_id, resizable : &quot;yes&quot;, scrollbars : &quot;no&quot;});
+    // Select insertcode button if parent node is a pre
+    if (tinyMCE.getParentElement(node, &quot;code_highlighting&quot;))
+      tinyMCE.switchClass(editor_id + '_insertcode', 'mceButtonSelected');
 
-				// Let TinyMCE know that something was modified
-				tinyMCE.triggerNodeChange(false);
-			} else {
-				// Do a command this gets called from the insertcode popup
-				alert(&quot;execCommand: mceinsertcode gets called from popup.&quot;);
-			}
+    return true;
+  }
 
-			return true;
-	}
+  /*
+  handleEvent : function(e) {
+    var inst = tinyMCE.selectedInstance;
+    var w = inst.getWin(), le = inst._lastStyleElm, e;
 
-	// Pass to next handler in chain
-	return false;
-}
+    if (tinyMCE.isGecko) {
+      e = inst.getFocusElement();
 
-/**
- * Gets executed when the selection/cursor position was changed.
- */
-function TinyMCE_insertcode_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-	// Deselect insertcode button
-	tinyMCE.switchClassSticky(editor_id + '_insertcode', 'mceButtonNormal');
+      if (e) {
+        if (!inst.
+    }
+  }
+  */
 
-	// Select insertcode button if parent node is a pre
-	if (tinyMCE.getParentElement(node, &quot;pre&quot;, &quot;class&quot;))
-		tinyMCE.switchClassSticky(editor_id + '_insertcode', 'mceButtonSelected');
+  /**
+   * displays the outline box
+  handleVisualAid : function(el, deep, state, inst) {
+    var nl = inst.getDoc().getElementsByTagName(&quot;code_highlighting&quot;), i;
+    alert(&quot;You are in the handleVisualAid() function&quot;);
+    alert(&quot;nl: &quot; + nl);
+
+    for(i=0; i&lt;nl.length; i++) {
+      if (new RegExp('absolute|relative|static', 'gi').test(nl[i].style.position)) {
+        if (state)
+          tinyMCE.addCSSClass(nl[i], 'mceVisualAid');
+        else
+          tinyMCE.removeCSSClass(nl[i], 'mceVisualAid');
+      }
+    }
+  }
+   */
+};
 
-	return true;
-}
\ No newline at end of file
+tinyMCE.addPlugin(&quot;insertcode&quot;, TinyMCE_InsertCodePlugin);</diff>
      <filename>assets/javascripts/tiny_mce/plugins/insertcode/editor_plugin_src.js</filename>
    </modified>
    <modified>
      <diff>@@ -22,8 +22,6 @@
             &lt;option value=&quot;xhtml&quot;&gt;Nitro-XHTML&lt;/option&gt;
           &lt;/select&gt;
         &lt;/span&gt;&lt;br/&gt;
-				{$lang_insertcode_legend} :&lt;br/&gt;
-				&lt;input type=&quot;text&quot; name=&quot;codeLegend&quot; size=&quot;90&quot; style=&quot;width: 100%;&quot;/&gt;
         &lt;br/&gt;
 				{$lang_insertcode_contents} : &lt;br/&gt;
 				&lt;textarea name=&quot;codeContent&quot; cols=&quot;100&quot; rows=&quot;15&quot; style=&quot;width: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;&quot; dir=&quot;ltr&quot; wrap=&quot;soft&quot;&gt;</diff>
      <filename>assets/javascripts/tiny_mce/plugins/insertcode/insertcode.htm</filename>
    </modified>
    <modified>
      <diff>@@ -4,29 +4,25 @@ function init() {
 	tinyMCEPopup.resizeToInnerSize();
   var editor_id = tinyMCE.getWindowArg('editor_id');
 	var inst = tinyMCE.getInstanceById(editor_id);
-	codeDiv = tinyMCE.getParentElement(inst.getFocusElement(), &quot;CODE_HIGHLIGHTING&quot;, function(n)
+	/*codeDiv = tinyMCE.getParentElement(inst.getFocusElement(), &quot;CODE_HIGHLIGHTING&quot;, function(n)
 	    {
 	        return n.parentNode &amp;&amp; n.parentNode.tagName == &quot;CODE_HIGHLIGHTING&quot; &amp;&amp; n.parentNode.className == &quot;insert_code&quot;;
-  });
-
-  //alert(&quot;codeDiv: &quot; + codeDiv);
+  });*/
 
   var focusElm = inst.getFocusElement();
-  //alert(&quot;focusElm node type: &quot; + focusElm.nodeType);
-  //alert(&quot;focusElm: &quot; + focusElm.toSource());
-  //alert(&quot;focusElm: &quot; + focusElm.toString());
-  //alert(&quot;focusElm: &quot; + focusElm.valueOf());
-  //alert(&quot;focusElm: &quot; + String(focusElm));
-  //alert(&quot;focusElm tag type: &quot; + focusElm.tag);
   // If this has &lt;code_highlighting tags already then
   // we are going to use that content
   if (focusElm.nodeName == &quot;CODE_HIGHLIGHTING&quot;) {
     action = 'update';
-    // Select all text
-    tinyMCE.execInstanceCommand(editor_id,'mceSelectNodeDepth',false,'0');
     // Put text in editor
+    document.forms[0].codeType.value = focusElm.getAttributeNode('type').nodeValue
+    //alert(&quot;code: &quot; + focusElm.textContent);
     document.forms[0].codeContent.value = focusElm.textContent;
   } else {
+    var selectedText = inst.selection.getSelectedText();
+    selectedText = selectedText.replace(/\n\n/g,&quot;\n&quot;);
+    //alert(&quot;text: &quot; + selectedText);
+    document.forms[0].codeContent.value = selectedText;
 	  action = 'insert';
   }
 
@@ -34,46 +30,28 @@ function init() {
 	resizeInputs();
 }
 
-function insertText() {
-  var editor_id = tinyMCE.getWindowArg('editor_id');
-  var inst = tinyMCE.getInstanceById(editor_id);
-  var focusElm = inst.getFocusElement();
-  var selectedText = inst.selection.getSelectedHTML();
-
-  //alert(&quot;focusElm: &quot; + focusElm);
-  //alert(&quot;focusElm node name: &quot; + focusElm.nodeName);
-  //alert(&quot;focusElm node value: &quot; + focusElm.nodeValue);
-  //alert(&quot;focusElm text content: &quot; + focusElm.textContent);
-  //alert(&quot;selectedText: \n&quot; + selectedText);
-}
-
 function insertCode() {
-  //alert(&quot;You are inside the insertCode() function&quot;);
 	var codeType = document.forms[0].codeType.options[document.forms[0].codeType.selectedIndex].value;
-	var codeLegend = document.forms[0].codeLegend.value;
 	var code = document.forms[0].codeContent.value;
 
-  doInsertCode(codeType,codeLegend,code);
+  doInsertCode(codeType,code);
 }
 
-function doInsertCode(codeType,codeLegend,code) {
-  //alert(&quot;You are inside the doInsertCode() function&quot;);
+function doInsertCode(codeType,code) {
 	var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
+  var codeDiv = inst.getFocusElement(); 
 	tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);
-  //alert(&quot;action = &quot; + action);
 
 	if (action == &quot;update&quot;) {
-		codeDiv.className = codeType;
-		codeDiv.innerHTML = '';
-		codeDiv.innerHTML = code;
+    codeDiv.getAttributeNode('type').nodeValue = codeType
+		codeDiv.innerHTML = formatCode(code);
+    //alert(&quot;code: &quot; + formatCode(code));
 	} else {
     code = formatCode(code);
-    //alert(&quot;code: \n&quot; + code);
-		//fullCode = '&lt;div class=&quot;insert_code_' + codeType + '&quot;&gt;\n' + code + '\n&lt;/div&gt;';
 		fullCode = '&lt;code_highlighting type=&quot;' + codeType + '&quot;&gt;\n' + code + '\n&lt;/code_highlighting&gt;';
     //alert(&quot;full code: \n&quot; + fullCode);
 
-		tinyMCEPopup.execCommand(&quot;mceInsertContent&quot;, false, fullCode);
+		tinyMCE.selectedInstance.execCommand(&quot;mceInsertContent&quot;, false, fullCode);
 		tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
 	}
 
@@ -93,11 +71,20 @@ function formatCode(code) {
   code = code.replace(/\t/g,&quot;&amp;nbsp;&amp;nbsp;&quot;);
   code = code.replace(/&lt;/g,&quot;&amp;lt;&quot;);
   code = code.replace(/&gt;/g,&quot;&amp;gt;&quot;);
-  code = code.replace(/\n/g,&quot;&lt;br /&gt;&quot;);
+  code = code.replace(/\n/g,&quot;&lt;br /&gt;\n&quot;);
 
   return code;
 }
 
+/*function formatHTML(html) {
+  html = html.replace(/&lt;br&gt;/g, &quot;\n&quot;);
+  html = html.replace(/&amp;nbsp;/g, &quot; &quot;);
+  html = html.replace(/&amp;lt;/g, &quot;&lt;&quot;);
+  html = html.replace(/&amp;gt;/g, &quot;&gt;&quot;);
+
+  return html;
+}*/
+
 var wHeight=0, wWidth=0;
 
 function resizeInputs() {
@@ -111,7 +98,6 @@ function resizeInputs() {
 
 	document.forms[0].codeContent.style.height = Math.abs(wHeight) + 'px';
 	document.forms[0].codeContent.style.width  = Math.abs(wWidth) + 'px';
-	document.forms[0].codeLegend.style.width  = Math.abs(wWidth) + 'px';
 }
 
 function deleteHighlighting(withTags) {</diff>
      <filename>assets/javascripts/tiny_mce/plugins/insertcode/jscripts/insertcode.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,7 @@
+function formElement() {
+  return document.forms[0];
+}
+
 function init() {
 	tinyMCEPopup.resizeToInnerSize();
 
@@ -7,7 +11,7 @@ function init() {
 
 	var inst = tinyMCE.selectedInstance;
 	var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), &quot;td,th&quot;);
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var st = tinyMCE.parseStyle(tinyMCE.getAttrib(tdElm, &quot;style&quot;));
 
 	// Get table cell data
@@ -57,7 +61,7 @@ function updateAction() {
 	var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), &quot;td,th&quot;);
 	var trElm = tinyMCE.getParentElement(inst.getFocusElement(), &quot;tr&quot;);
 	var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), &quot;table&quot;);
-	var formObj = document.forms[0];
+	var formObj = formElement();
 
 	inst.execCommand('mceBeginUndoLevel');
 
@@ -125,7 +129,7 @@ function nextCell(elm) {
 
 function updateCell(td, skip_id) {
 	var inst = tinyMCE.selectedInstance;
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var curCellType = td.nodeName.toLowerCase();
 	var celltype = getSelectValue(formObj, 'celltype');
 	var doc = inst.getDoc();
@@ -185,7 +189,7 @@ function updateCell(td, skip_id) {
 }
 
 function changedBackgroundImage() {
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var st = tinyMCE.parseStyle(formObj.style.value);
 
 	st['background-image'] = &quot;url('&quot; + formObj.backgroundimage.value + &quot;')&quot;;
@@ -194,7 +198,7 @@ function changedBackgroundImage() {
 }
 
 function changedSize() {
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var st = tinyMCE.parseStyle(formObj.style.value);
 
 	var width = formObj.width.value;
@@ -213,7 +217,7 @@ function changedSize() {
 }
 
 function changedColor() {
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var st = tinyMCE.parseStyle(formObj.style.value);
 
 	st['background-color'] = formObj.bgcolor.value;
@@ -223,7 +227,7 @@ function changedColor() {
 }
 
 function changedStyle() {
-	var formObj = document.forms[0];
+	var formObj = formElement();
 	var st = tinyMCE.parseStyle(formObj.style.value);
 
 	if (st['background-image'])</diff>
      <filename>assets/javascripts/tiny_mce/plugins/table/jscripts/cell.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,7 @@
+function formElement() {
+  return document.forms[0];
+}
+
 function init() {
 	tinyMCEPopup.resizeToInnerSize();
 </diff>
      <filename>assets/javascripts/tiny_mce/plugins/table/jscripts/row.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,63 @@
 /* CSS file for advimage plugin popup */
 
+div.image {
+  width: 60px;
+  height: 100px;
+  float: left;
+  margin-bottom: 1px;
+  margin-right: 5px;
+  border: 2px solid #fff;
+}
+
+div.image img {
+  vertical-align: top;
+  margin: 0px;
+  margin-bottom: 1px;
+}
+
+div.image_ie {
+  float: left;
+  display: inline;
+  width: 60px;
+  height: 100px;
+  margin-bottom: 1px;
+  border: 2px solid #fff;
+}
+
+div.image_ie img {
+  vertical-align: top;
+  margin: 5px;
+  margin-bottom: 1px;
+}
+
+span.controls {
+  display: none;
+  background-color: #A9A9A9;
+  width: 60px;
+  height: 30px;
+  margin-bottom: 1px;
+}
+
+a.controls {
+  /*background-color: #A9A9A9;*/
+  vertical-align: bottom;
+  /*float: right;*/
+  margin-right: 5px;
+}
+
+a.controls img {
+  border: 0px;
+  /*background-color: #A9A9A9;*/
+  vertical-align: bottom;
+}
+
+div.over_image {
+  float: left;
+  border: 2px solid gray;
+  background-color: #A9A9A9;
+  margin-right: 5px;
+}
+
 .mceImageList {
 	width: 280px;
 }</diff>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/css/advimage.css</filename>
    </modified>
    <modified>
      <diff>@@ -572,6 +572,15 @@ function getImageListHTML(elm_id, target_form_element, onchange_func) {
 
 	// tinyMCE.debug('-- image list start --', html, '-- image list end --');
 }
+function show_image_controls(obj,id) {
+  obj.addClassName('over_image');
+  $('controls_'+id).style.display = &quot;inline&quot;;
+}
+
+function hide_image_controls(obj,id) {
+  obj.removeClassName('over_image');
+  $('controls_'+id).style.display = &quot;&quot;;
+}
 
 // While loading
 preinit();</diff>
      <filename>assets/javascripts/tiny_mce/plugins/ts_advimage/jscripts/functions.js</filename>
    </modified>
    <modified>
      <diff>@@ -4092,6 +4092,12 @@ tinyMCE.add(TinyMCE_Engine, {
 		// Close tags &lt;img&gt;&lt;/img&gt; to &lt;img/&gt;
 		s = s.replace(new RegExp('&lt;(img|br|hr)([^&gt;]*)&gt;&lt;\\/(img|br|hr)&gt;', 'gi'), '&lt;$1$2 /&gt;');
 
+    // Remove open closed tags with nothing inside them
+    //s = s.replace(new RegExp('&lt;(h[1-6]|font|strong|a|b|u|i|table|em|ul|ol|blockquote|code_highlighting).*&gt;(\\s|&amp;nbsp;|)*&lt;/(h[1-6]|font|strong|a|b|u|i|table|em|ul|ol|blockquote|code_highlighting)&gt;', 'gi'), '');
+
+    // Fix split up code_highlighting tags
+    s = s.replace(new RegExp('&lt;/code_highlighting&gt;\\s&lt;/p&gt;\\s&lt;p&gt;\\s&lt;code_highlighting\\stype=&quot;[a-z]*&quot;&gt;', 'gi'), '&lt;br /&gt;\n');
+
 		// Weird MSIE bug, &lt;p&gt;&lt;hr /&gt;&lt;/p&gt; breaks runtime?
 		if (tinyMCE.isIE)
 			s = s.replace(new RegExp('&lt;p&gt;&lt;hr \\/&gt;&lt;\\/p&gt;', 'gi'), &quot;&lt;hr&gt;&quot;);</diff>
      <filename>assets/javascripts/tiny_mce/tiny_mce.js</filename>
    </modified>
    <modified>
      <diff>@@ -1436,8 +1436,6 @@ TinyMCE_Engine.prototype = {
 	getButtonHTML : function(id, lang, img, cmd, ui, val) {
 		var h = '', m, x, io = '';
 
-    alert(&quot;this is: &quot; + img);
-
 		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
 
 		if (typeof(ui) != &quot;undefined&quot; &amp;&amp; ui != null)
@@ -1856,6 +1854,7 @@ TinyMCE_Engine.prototype = {
 		if (this.plugins[name])
 			b = this.plugins[name].baseURL;
 
+    //alert(&quot;import plugin: &quot; + b + '/langs/' + tinyMCE.settings.language + '.js');
 		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings.language +  '.js');
 	},
 
@@ -4093,6 +4092,12 @@ tinyMCE.add(TinyMCE_Engine, {
 		// Close tags &lt;img&gt;&lt;/img&gt; to &lt;img/&gt;
 		s = s.replace(new RegExp('&lt;(img|br|hr)([^&gt;]*)&gt;&lt;\\/(img|br|hr)&gt;', 'gi'), '&lt;$1$2 /&gt;');
 
+    // Remove open closed tags with nothing inside them
+    //s = s.replace(new RegExp('&lt;(h[1-6]|font|strong|a|b|u|i|table|em|ul|ol|blockquote|code_highlighting).*&gt;(\\s|&amp;nbsp;|)*&lt;/(h[1-6]|font|strong|a|b|u|i|table|em|ul|ol|blockquote|code_highlighting)&gt;', 'gi'), '');
+
+    // Fix split up code_highlighting tags
+    s = s.replace(new RegExp('&lt;/code_highlighting&gt;\\s&lt;/p&gt;\\s&lt;p&gt;\\s&lt;code_highlighting\\stype=&quot;[a-z]*&quot;&gt;', 'gi'), '&lt;br /&gt;\n');
+
 		// Weird MSIE bug, &lt;p&gt;&lt;hr /&gt;&lt;/p&gt; breaks runtime?
 		if (tinyMCE.isIE)
 			s = s.replace(new RegExp('&lt;p&gt;&lt;hr \\/&gt;&lt;\\/p&gt;', 'gi'), &quot;&lt;hr&gt;&quot;);</diff>
      <filename>assets/javascripts/tiny_mce/tiny_mce_src.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,32 @@
 # Include hook code here
+#require 'application'
 require 'simple_cms'
 
+ActionView::Base.send :include, SimpleCmsMod::Render
+
+ApplicationController.send :include, SimpleCmsMod::ViewPaths
+
 model_path      = File.join(directory, 'app', 'models')
 $LOAD_PATH &lt;&lt; model_path
-Dependencies.load_paths &lt;&lt; model_path
+
+# Use Dependencies.load_paths for any version &lt;= 2.1.0
+# Use ActiveSupport::Dependencies.load_paths for any version &gt;= 2.1.1
+# If you are using a version &lt;= 2.1.0 and it is not in the list then add it
+if %w(1.2.0 1.2.1 1.2.3 1.2.4 1.2.5 1.2.6 2.0.0 2.0.1 2.0.2 2.1.0).include?(RAILS_GEM_VERSION)
+  Dependencies.load_paths &lt;&lt; model_path
+else
+  ActiveSupport::Dependencies.load_paths &lt;&lt; model_path
+end
 
 controller_path = File.join(directory, 'app', 'controllers')
 $LOAD_PATH &lt;&lt; controller_path
-Dependencies.load_paths &lt;&lt; controller_path
+
+# Use Dependencies.load_paths for any version &lt;= 2.1.0
+# Use ActiveSupport::Dependencies.load_paths for any version &gt;= 2.1.1
+# If you are using a version &lt;= 2.1.0 and it is not in the list then add it
+if %w(1.2.0 1.2.1 1.2.3 1.2.4 1.2.5 1.2.6 2.0.0 2.0.1 2.0.2 2.1.0).include?(RAILS_GEM_VERSION)
+  Dependencies.load_paths &lt;&lt; controller_path
+else
+  ActiveSupport::Dependencies.load_paths &lt;&lt; controller_path
+end
 config.controller_paths &lt;&lt; controller_path</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,8 @@
 # Install hook code here
 require 'ftools'
 
+puts IO.read(File.join(File.dirname(__FILE__), 'README'))
+puts &quot;\n\n======================================================&quot;
 puts &quot;\n\nMoving all required javascript and css files to your public directory...&quot;
 `rake simple_cms:install`
 puts &quot;\n\nsimple_cms requires 4 dependencies...attachment_fu, responds_to_parent, acts_as_versioned, and coderay. To install them use: \n'rake simple_cms:install_dependencies'\n\n&quot;
-puts IO.read(File.join(File.dirname(__FILE__), 'README'))</diff>
      <filename>install.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,78 +1,3 @@
-# SimpleCMS
-ActionView::Base.class_eval do
-  alias_method :render_otherwise, :render
-  
-  def render(options = {}, old_local_assigns = {}, &amp;block) #:nodoc:
-    if options.is_a?(Hash) &amp;&amp; options[:simpleCMS]
-      render_simple_cms(options)
-    else
-      render_otherwise(options, old_local_assigns, &amp;block)
-    end
-  end
-  
-  def render_simple_cms(options = {})
-		@label      = (options[:simpleCMS].blank?)? &quot;defaultLabel&quot; : options[:simpleCMS]
-    @domain     = controller.request.env[&quot;HTTP_X_FORWARDED_HOST&quot;] if controller.request.env[&quot;HTTP_X_FORWARDED_HOST&quot;]
-    @reusable   = options[:reusable] || false
-    if @reusable
-      @cms_params = {:label =&gt; @label, :domain =&gt; @domain}.to_yaml.gsub(/\r/,&quot;&quot;)
-    else
-		  @cms_params = controller.params.
-                    merge(:label =&gt; @label, :domain =&gt; @domain).
-                    to_yaml.gsub(/\r/,&quot;&quot;)
-    end
-    @cms_admin  = options[:admin]  || false
-    @cms_user   = options[:user]   || &quot;N/A&quot;
-    @prefix     = options[:prefix] || &quot;&quot; 
-
-		session[&quot;cms_admin&quot;]             ||= {}  
-    session[&quot;cms_admin&quot;][@cms_params]  = @cms_admin
-    session[&quot;cms_user&quot;]              ||= {}
-    session[&quot;cms_user&quot;][@cms_params]   = @cms_user
-    session[&quot;cms_prefix&quot;]            ||= {}
-    session[&quot;cms_prefix&quot;][@cms_params] = @prefix
-    #session[&quot;cms_referer&quot;]             = controller.request.env[&quot;REQUEST_PATH&quot;].gsub(/\/sites.*skizmo.com/,&quot;&quot;)
-    #session[&quot;cms_referer&quot;]             = &quot;/&quot; if session[&quot;cms_referer&quot;].blank?
-    request_path = controller.request.env[&quot;REQUEST_PATH&quot;] || controller.request.env[&quot;REQUEST_URI&quot;] || controller.request.env[&quot;SCRIPT_NAME&quot;]
-    session[&quot;cms_referer&quot;]             = request_path.nil? ? &quot;/&quot; : request_path.gsub(/\/sites.*skizmo.com/,&quot;&quot;)
-
-    
-		# link to add new data
-		# display current data if any
-		item = SimpleCmsItem.find_by_params(@cms_params)
-    if !item
-		  item = SimpleCmsItem.create(:params =&gt; @cms_params, :created_by =&gt; @cms_user, :updated_by =&gt; @cms_user)
-    end
-  	render :partial =&gt; shared_path(&quot;simple_cms_item&quot;), 
-           :object  =&gt; item
-  end
-
-	def cms_shared_path(partial_path)
-		shared_path(partial_path)
-	end
-
-private
-
-	# Path to CMS Files that the end user will experience
-	# 1 partial for adding content
-	# 1 partial for viewing/editing content
-	def shared_path(partial_path)
-    return &quot;shared/#{partial_path}&quot;
-	end
-  
-  def parse_coderay(text)
-    text.scan(/(&lt;code_highlighting type=\&quot;([a-z].+?)\&quot;&gt;(.+?)&lt;\/code_highlighting&gt;)/m).each do |match|
-      logger.error(&quot;\ncode: &quot; + match[2])
-      match[2] = match[2].gsub(&quot;&lt;br /&gt;&quot;, &quot;&quot;).
-                          gsub(&quot;&amp;nbsp;&quot;, &quot; &quot;).
-                          gsub(&quot;&amp;lt;&quot;, &quot;&lt;&quot;).
-                          gsub(&quot;&amp;gt;&quot;, &quot;&gt;&quot;).
-                          gsub(&quot;&amp;quot;&quot;, &quot;\&quot;&quot;)
-      match[2] = match[2] + &quot;\n&quot;
-      logger.error(&quot;\nnew code: &quot; + match[2])
-      text.gsub!(match[0],CodeRay.scan(match[2], match[1].to_sym).div( :line_numbers =&gt; :table, :css =&gt; :class))
-    end
-    return text
-  end
-
-end 
+# SimpleCms
+require 'view_paths'
+require 'render'</diff>
      <filename>lib/simple_cms.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,24 +5,32 @@ namespace :simple_cms do
 
   desc 'Installs required javascript and css files to the public/javascripts and public/stylesheets directories'
   task :install do
-    puts &quot;COPYING *.js:&quot;
-    FileUtils.cp Dir[PLUGIN_ROOT + '/assets/javascripts/*.js'], RAILS_ROOT + '/public/javascripts'
+    FileList[PLUGIN_ROOT + '/assets/javascripts/*.js'].each do |f|
+      puts &quot;ADDING /public/javascripts/&quot; + File.basename(f)
+      FileUtils.cp f, RAILS_ROOT + '/public/javascripts'
+    end
+    FileList[PLUGIN_ROOT + '/assets/stylesheets/*.css'].each do |f|
+      puts &quot;ADDING /public/stylesheets/&quot; + File.basename(f)
+      FileUtils.cp f, RAILS_ROOT + '/public/stylesheets'
+    end
+    
     puts &quot;COPYING tiny_mce:&quot;
     FileUtils.cp_r Dir[PLUGIN_ROOT + '/assets/javascripts/tiny_mce'], RAILS_ROOT + '/public/javascripts'
-    puts &quot;COPYING *.css:&quot;
-    FileUtils.cp Dir[PLUGIN_ROOT + '/assets/stylesheets/*.css'], RAILS_ROOT + '/public/stylesheets' 
   end
   
   desc 'Uninstalls all javascript and css files that were created by the simple_cms:install'
   task :uninstall do
-    puts &quot;REMOVING /public/javascripts/tiny_mce:&quot;
+    puts &quot;REMOVING /assets/javascripts/tiny_mce:&quot;
     FileUtils.rm_rf RAILS_ROOT + '/public/javascripts/tiny_mce'
-    puts &quot;REMOVING /public/javascripts/simple_cms.js&quot;
-    FileUtils.rm RAILS_ROOT + '/public/javascripts/simple_cms.js'
-    puts &quot;REMOVING /public/stylesheets/simple_cms.css&quot;
-    FileUtils.rm RAILS_ROOT + '/public/stylesheets/simple_cms.css'
-    puts &quot;REMOVING /public/stylesheets/coderay.css&quot;
-    FileUtils.rm RAILS_ROOT + '/public/stylesheets/coderay.css'
+
+    FileList[PLUGIN_ROOT + '/assets/javascripts/*.js'].each do |file|
+      puts &quot;REMOVING /public/javascripts/&quot; + File.basename(file)
+      FileUtils.rm RAILS_ROOT + '/public/javascripts/' + File.basename(file)
+    end
+    FileList[PLUGIN_ROOT + '/assets/stylesheets/*.css'].each do |file|
+      puts &quot;REMOVING /public/stylesheets/&quot; + File.basename(file)
+      FileUtils.rm RAILS_ROOT + '/public/stylesheets/' + File.basename(file)
+    end
   end
 
   desc 'Installs simple_cms dependencies(attachment_fu, responds_to_parent, acts_as_versioned, and coderay)'
@@ -32,7 +40,7 @@ namespace :simple_cms do
     puts &quot;Installing plugin responds_to_parent...&quot;
     puts `ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/responds_to_parent/`
     puts &quot;Installing plugin acts_as_versioned...&quot;
-    puts `ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/acts_as_versioned/`
+    puts `ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/acts_as_versioned_2.1.1/`
     puts &quot;Installing plugin coderay...&quot;
     puts `ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/coderay/`
   end</diff>
      <filename>tasks/simple_cms_tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/css/dd.css</filename>
    </removed>
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/editor_plugin.js</filename>
    </removed>
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/editor_plugin_src.js</filename>
    </removed>
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/images/dd_code.gif</filename>
    </removed>
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/install%20-%20readme.txt</filename>
    </removed>
    <removed>
      <filename>assets/javascripts/tiny_mce/plugins/dd/langs/en.js</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>9067ae83d3d187b2f3870bccbc188ea56093b806</id>
    </parent>
  </parents>
  <author>
    <name>scnaegle</name>
    <email>scnaegl@sahp5507.sandia.gov</email>
  </author>
  <url>http://github.com/pullmonkey/simple_cms/commit/b2355525f1913e2c31137da1d6be93e06e6e6d96</url>
  <id>b2355525f1913e2c31137da1d6be93e06e6e6d96</id>
  <committed-date>2009-04-15T11:06:30-07:00</committed-date>
  <authored-date>2009-04-15T11:06:30-07:00</authored-date>
  <message>updated to newest pull from subversion</message>
  <tree>a79db87158cf01d4803a66743102309f0f3d21bb</tree>
  <committer>
    <name>scnaegle</name>
    <email>scnaegl@sahp5507.sandia.gov</email>
  </committer>
</commit>
