refinerycms 0.9.6.14 → 0.9.6.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +4 -1
  2. data/Rakefile +3 -51
  3. data/VERSION +1 -1
  4. data/bin/refinery +20 -20
  5. data/bin/refinery-override +9 -9
  6. data/bin/refinery-update-core +41 -34
  7. data/config/application.rb +28 -87
  8. data/config/environment.rb +1 -4
  9. data/config/environments/development.rb +2 -0
  10. data/config/environments/production.rb +1 -1
  11. data/config/preinitializer.rb +2 -6
  12. data/db/schema.rb +1 -1
  13. data/db/seeds.rb +1 -1
  14. data/lib/refinery/tasks/refinery.rake +83 -0
  15. data/lib/refinery/tasks/refinery.rb +16 -0
  16. data/public/images/refinery/dialogLoadingAnimation.gif +0 -0
  17. data/public/javascripts/refinery/admin.js +9 -4
  18. data/public/javascripts/refinery/boot_wym.js +19 -5
  19. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +72 -70
  20. data/public/stylesheets/refinery/refinery.css +19 -7
  21. data/readme.md +2 -2
  22. data/test/fixtures/user_plugins.yml +36 -0
  23. data/test/fixtures/users.yml +1 -2
  24. data/test/functional/dashboard_controller_test.rb +23 -3
  25. data/test/functional/images_controller_test.rb +93 -0
  26. data/test/test_helper.rb +9 -3
  27. data/test/unit/image_test.rb +2 -2
  28. data/test/unit/inquiry_test.rb +6 -6
  29. data/test/unit/news_items_test.rb +8 -8
  30. data/test/unit/refinery_setting_test.rb +12 -12
  31. data/test/unit/resource_test.rb +3 -3
  32. data/themes/demolicious/views/layouts/application.html.erb +1 -1
  33. data/themes/demolicious/views/pages/home.html.erb +1 -1
  34. data/themes/demolicious/views/pages/show.html.erb +1 -1
  35. data/themes/hemingway/views/layouts/application.html.erb +1 -1
  36. data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +1 -1
  37. data/vendor/plugins/dashboard/rails/init.rb +1 -1
  38. data/vendor/plugins/images/app/controllers/admin/images_controller.rb +2 -2
  39. data/vendor/plugins/images/app/helpers/admin/images_helper.rb +6 -2
  40. data/vendor/plugins/images/app/models/image.rb +3 -3
  41. data/vendor/plugins/images/app/views/admin/images/_form.html.erb +4 -4
  42. data/vendor/plugins/images/app/views/admin/images/index.html.erb +2 -2
  43. data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
  44. data/vendor/plugins/inquiries/app/models/inquiry.rb +3 -3
  45. data/vendor/plugins/inquiries/app/views/admin/inquiries/show.html.erb +1 -1
  46. data/vendor/plugins/inquiries/rails/init.rb +1 -1
  47. data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
  48. data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
  49. data/vendor/plugins/news/app/models/news_item.rb +2 -2
  50. data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +1 -1
  51. data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +1 -1
  52. data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +13 -0
  53. data/vendor/plugins/pages/app/models/page_part.rb +3 -1
  54. data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +2 -2
  55. data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +2 -2
  56. data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
  57. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +3 -3
  58. data/vendor/plugins/refinery/app/views/admin/_menu.html.erb +3 -7
  59. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
  60. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +5 -3
  61. data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +1 -1
  62. data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +0 -1
  63. data/vendor/plugins/refinery/lib/refinery.rb +9 -2
  64. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
  65. data/vendor/plugins/refinery/lib/refinery/deprecations.rb +46 -0
  66. data/vendor/plugins/refinery/lib/refinery/initializer.rb +20 -9
  67. data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +6 -5
  68. data/vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb +2 -2
  69. data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +41 -11
  70. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -1
  71. data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +1 -1
  72. data/vendor/plugins/resources/app/models/resource.rb +3 -3
  73. data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +2 -2
  74. data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +2 -2
  75. data/vendor/plugins/themes/app/helpers/themes_helper.rb +1 -1
  76. data/vendor/plugins/themes/lib/theme_server.rb +1 -1
  77. data/vendor/plugins/themes/rails/init.rb +26 -18
  78. metadata +10 -20
  79. data/Gemfile +0 -12
  80. data/public/javascripts/thickbox.js +0 -350
  81. data/public/stylesheets/refinery/thickbox.css +0 -165
  82. data/vendor/cache/aasm-2.1.3.gem +0 -0
  83. data/vendor/cache/actionmailer-2.3.5.gem +0 -0
  84. data/vendor/cache/actionpack-2.3.5.gem +0 -0
  85. data/vendor/cache/activerecord-2.3.5.gem +0 -0
  86. data/vendor/cache/activeresource-2.3.5.gem +0 -0
  87. data/vendor/cache/activesupport-2.3.5.gem +0 -0
  88. data/vendor/cache/friendly_id-2.3.1.gem +0 -0
  89. data/vendor/cache/hpricot-0.8.2.gem +0 -0
  90. data/vendor/cache/rack-1.0.1.gem +0 -0
  91. data/vendor/cache/rails-2.3.5.gem +0 -0
  92. data/vendor/cache/rake-0.8.7.gem +0 -0
  93. data/vendor/cache/rubyzip-0.9.1.gem +0 -0
  94. data/vendor/cache/slim_scrooge-1.0.3.gem +0 -0
  95. data/vendor/cache/will_paginate-2.3.11.gem +0 -0
@@ -1,5 +1,2 @@
1
1
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Refinery::Application.initialize! if Rails.version.to_f >= 3.0
2
+ require File.expand_path('../application', __FILE__)
@@ -16,6 +16,8 @@ config.action_controller.perform_caching = false
16
16
  # Don't care if the mailer can't send
17
17
  config.action_mailer.raise_delivery_errors = false
18
18
 
19
+ config.log_level = :info
20
+
19
21
  # Uncomment the following lines if you're getting
20
22
  # "A copy of XX has been removed from the module tree but is still active!"
21
23
  # or you want to develop a plugin and don't want to restart every time a change is made:
@@ -23,4 +23,4 @@ config.log_level = :info
23
23
  # Set to true in order to use Amazon's Simple Storage Service on your production machine
24
24
  # instead of the default file system for resources and images
25
25
  # Make sure to your bucket info is correct in amazon_s3.yml
26
- USE_S3_BACKEND = false
26
+ Refinery.s3_backend = false
@@ -4,7 +4,6 @@ rails_root = (defined?(Rails.root) ? Rails.root : Pathname.new(RAILS_ROOT)).clea
4
4
  if (non_gem_path = rails_root.join("vendor", "plugins", "refinery", "lib", "refinery.rb")).exist?
5
5
  require non_gem_path.realpath.to_s
6
6
  else
7
- require 'rubygems'
8
7
  version = if defined? REFINERY_GEM_VERSION
9
8
  REFINERY_GEM_VERSION
10
9
  elsif ENV.include?("REFINERY_GEM_VERSION")
@@ -13,6 +12,7 @@ else
13
12
  $1 if rails_root.join("config", "application.rb").read =~ /^[^#]*REFINERY_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
14
13
  end
15
14
 
15
+ require "rubygems"
16
16
  if version
17
17
  gem 'refinerycms', version
18
18
  else
@@ -20,8 +20,4 @@ else
20
20
  end
21
21
 
22
22
  require 'refinery_initializer'
23
- end
24
-
25
- # Set to true in your environment specific file (e.g. production.rb) to use Amazon's Simple
26
- # Storage Service instead of the default file system for resources and images
27
- USE_S3_BACKEND = false unless defined?(USE_S3_BACKEND)
23
+ end
data/db/schema.rb CHANGED
@@ -1,4 +1,4 @@
1
- # This file is auto-generated from the current state of the database. Instead of editing this file,
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
2
  # please use the migrations feature of Active Record to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
4
  #
data/db/seeds.rb CHANGED
@@ -118,4 +118,4 @@ Page.create(:title => "Down for maintenance",
118
118
  })
119
119
 
120
120
  # Create a default themes directory.
121
- Rails.root.join("themes").mkdir unless Rails.root.join("themes").directory?
121
+ Rails.root.join("themes").mkdir unless Rails.root.join("themes").directory?
@@ -0,0 +1,83 @@
1
+ desc 'Removes trailing whitespace across the entire application.'
2
+ task :whitespace do
3
+ sh %{find . -name '*.*rb' -exec sed -i '' 's/\t/ /g' {} \\; -exec sed -i '' 's/ *$//g' {} \\; }
4
+ end
5
+
6
+ namespace :test do
7
+ desc "Run the tests that ship with Refinery to ensure any changes you've made haven't caused instability."
8
+ task :refinery do
9
+ errors = %w(test:refinery:units test:refinery:functionals test:refinery:integration).collect do |task|
10
+ begin
11
+ Rake::Task[task].invoke
12
+ nil
13
+ rescue => e
14
+ task
15
+ end
16
+ end.compact
17
+ abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
18
+ end
19
+ namespace :refinery do
20
+ Rake::TestTask.new(:units => "db:test:prepare") do |t|
21
+ t.libs << Refinery.root.join("test").to_s
22
+ t.pattern = Refinery.root.join("test", "unit", "**", "*_test.rb").to_s
23
+ t.verbose = true
24
+ ENV["RAILS_ROOT"] = Rails.root.to_s
25
+ end
26
+ Rake::Task['test:refinery:units'].comment = "Run the unit tests in Refinery."
27
+
28
+ Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
29
+ t.libs << Refinery.root.join("test").to_s
30
+ t.pattern = Refinery.root.join("test", "functional", "**", "*_test.rb").to_s
31
+ t.verbose = true
32
+ ENV["RAILS_ROOT"] = Rails.root.to_s
33
+ end
34
+ Rake::Task['test:refinery:functionals'].comment = "Run the functional tests in Refinery."
35
+
36
+ Rake::TestTask.new(:integration => "db:test:prepare") do |t|
37
+ t.libs << Refinery.root.join("test").to_s
38
+ t.pattern = Refinery.root.join("test", "integration", "**", "*_test.rb").to_s
39
+ t.verbose = true
40
+ ENV["RAILS_ROOT"] = Rails.root.to_s
41
+ end
42
+ Rake::Task['test:refinery:integration'].comment = "Run the integration tests in Refinery."
43
+
44
+ Rake::TestTask.new(:benchmark => 'db:test:prepare') do |t|
45
+ t.libs << Refinery.root.join("test").to_s
46
+ t.pattern = Refinery.root.join("test", "performance", "**", "*_test.rb")
47
+ t.verbose = true
48
+ t.options = '-- --benchmark'
49
+ ENV["RAILS_ROOT"] = Rails.root.to_s
50
+ end
51
+ Rake::Task['test:refinery:benchmark'].comment = 'Benchmark the performance tests in Refinery'
52
+ end
53
+ end
54
+
55
+ # You don't need to worry about this unless you're releasing Refinery gems.
56
+ begin
57
+ require 'jeweler'
58
+ Jeweler::Tasks.new do |s|
59
+ s.name = %q{refinerycms}
60
+ s.description = %q{A beautiful open source Ruby on Rails content manager for small business. Easy to extend, easy to use, lightweight and all wrapped up in a super slick UI.}
61
+ s.summary = %q{A beautiful open source Ruby on Rails content manager for small business.}
62
+ s.email = %q{info@refinerycms.com}
63
+ s.homepage = %q{http://refinerycms.com}
64
+ s.authors = ["Resolve Digital", "David Jones", "Philip Arndt"]
65
+ s.extra_rdoc_files = %w(readme.md contributors.md license.md VERSION)
66
+ s.rdoc_options << "--inline-source"
67
+ s.has_rdoc = true
68
+ end
69
+
70
+ namespace :version do
71
+ namespace :bump do
72
+ desc "Bump the application's version by a build version."
73
+ task :build => [:version_required, :version] do
74
+ version = Jeweler::VersionHelper.new(Rails.root.to_s)
75
+ version.update_to(version.major, version.minor, version.patch, ((version.build || 0).to_i + 1))
76
+ version.write
77
+ $stdout.puts "Updated version: #{version.to_s}"
78
+ end
79
+ end
80
+ end
81
+ rescue LoadError
82
+ #puts "Jeweler not available. Install it with: sudo gem install jeweler"
83
+ end
@@ -0,0 +1,16 @@
1
+ # Because we use plugins that are shipped via gems, we lose their rake tasks.
2
+ # So here, we find them (if there are any) and include them into rake.
3
+ extra_rake_tasks = []
4
+ if defined?(Refinery) && Refinery.is_a_gem
5
+ extra_rake_tasks << Dir[Refinery.root.join("vendor", "plugins", "*", "**", "tasks", "**", "*", "*.rake")].sort
6
+ end
7
+
8
+ # We also need to load in the rake tasks from gem plugins whether Refinery is a gem or not:
9
+ if $refinery_gem_plugin_lib_paths.present?
10
+ extra_rake_tasks << $refinery_gem_plugin_lib_paths.collect {|path| Dir[File.join(%W(#{path} tasks ** *.rake))].sort}
11
+ end
12
+
13
+ extra_rake_tasks << Dir[Rails.root.join("lib", "refinery", "tasks", "*.rake")]
14
+
15
+ # Load in any extra tasks that we've found.
16
+ extra_rake_tasks.flatten.compact.uniq.each {|rake| load rake }
@@ -35,7 +35,8 @@ init_modal_dialogs = function(){
35
35
  $('a[href*="dialog=true"]').each(function(i, anchor)
36
36
  {
37
37
  $(anchor).click(function(e){
38
- $("<iframe id='dialog_iframe' src='" + $(this).attr('href') + "'></iframe>").dialog({
38
+ iframe = $("<iframe id='dialog_iframe' src='" + $(this).attr('href') + "'></iframe>");
39
+ iframe.dialog({
39
40
  title: $(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null,
40
41
  modal: true,
41
42
  resizable: false,
@@ -44,6 +45,10 @@ init_modal_dialogs = function(){
44
45
  height: (parseInt($(anchor.href.match("height=([0-9]*)")).last().get(0))||473),
45
46
  beforeclose: function(){$(document.body).removeClass('hide-overflow')}
46
47
  });
48
+ if ($.browser.msie) {
49
+ iframe.css({'margin':'-2px 2px 2px -2px'});
50
+ // iframe..css('overflow: hidden');
51
+ }
47
52
  $(document.body).addClass('hide-overflow');
48
53
  e.preventDefault();
49
54
  });
@@ -232,7 +237,7 @@ var link_dialog = {
232
237
  var port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
233
238
  var url = link.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
234
239
 
235
- link_dialog.update_parent(url, link.rel);
240
+ link_dialog.update_parent(url, link.rel.replace(/\ ?<em>.+?<\/em>/, ''));
236
241
  });
237
242
  },
238
243
 
@@ -420,8 +425,8 @@ var page_options = {
420
425
  var part_id = $('#page_parts_attributes_' + stab_id + '_id').val();
421
426
  //console.log('stab_id: ' + stab_id + ' part_id: ' + part_id);
422
427
 
423
- var result = confirm("This will remove the content section '" + $('#page_parts .ui-tabs-selected a').html() + "' when the page is saved and erase all content that has been entered into it, Are you sure?");
424
- if(part_id && result){
428
+ var result = confirm("This will remove the content section '" + $('#page_parts .ui-tabs-selected a').html() + "' and erase all content that has been entered into it even if you don't save the page, are you sure?");
429
+ if(part_id && result) {
425
430
  $.ajax({
426
431
  url: page_options.del_part_url + '/' + part_id,
427
432
  type: 'DELETE'
@@ -94,7 +94,7 @@ var wymeditor_boot_options = $.extend({
94
94
  + "<div id='dialog-form-actions' class='form-actions'>"
95
95
  + "<input class='wym_submit' type='button' value='{Insert}' />"
96
96
  + " or "
97
- + "<a class='wym_cancel close_dialog' type='button' href=''>{Cancel}</a>"
97
+ + "<a href='' class='wym_cancel close_dialog'>{Cancel}</a>"
98
98
  + "</div>"
99
99
  + "</form>"
100
100
  + "</div>"
@@ -110,16 +110,30 @@ var wymeditor_boot_options = $.extend({
110
110
  + "<div id='dialog-form-actions' class='form-actions'>"
111
111
  + "<input class='wym_submit' type='button' value='{Insert}' />"
112
112
  + " or "
113
- + "<a class='wym_cancel close_dialog' type='button' href=''>{Cancel}</a>"
113
+ + "<a href='' class='wym_cancel close_dialog'>{Cancel}</a>"
114
114
  + "</div>"
115
115
  + "</form>"
116
116
  + "</div>"
117
117
 
118
118
  , dialogPath: "/admin/dialogs/"
119
- , dialogFeatures: "?width=958&height=460&modal=true&titlebar=true&auto_size_content=true&draggable=true"
120
- , dialogInlineFeatures: "?width=600&height=320&modal=true&titlebar=true&auto_size_content=true&draggable=true"
119
+ , dialogFeatures: {
120
+ width: 958
121
+ , height: 570
122
+ , modal: true
123
+ , draggable: true
124
+ , resizable: false
125
+ , autoOpen: true
126
+ }
127
+ , dialogInlineFeatures: {
128
+ width: 600
129
+ , height: 530
130
+ , modal: true
131
+ , draggable: true
132
+ , resizable: false
133
+ , autoOpen: true
134
+ }
121
135
 
122
- , dialogId: 'TB_window'
136
+ , dialogId: 'editor_dialog'
123
137
 
124
138
  , dialogHtml:
125
139
  "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
@@ -513,10 +513,12 @@ $.fn.wymeditor = function(options) {
513
513
  updateSelector: ".wymupdate",
514
514
  updateEvent: "click",
515
515
 
516
- dialogFeatures: "menubar=no,titlebar=no,toolbar=no,resizable=no"
517
- + ",width=560,height=300,top=0,left=0",
516
+ dialogFeatures: {
517
+ width: 560
518
+ , height: 300
519
+ }
518
520
 
519
- dialogHtml: "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'"
521
+ , dialogHtml: "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'"
520
522
  + " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
521
523
  + "<html dir='"
522
524
  + WYMeditor.DIRECTION
@@ -1229,7 +1231,7 @@ WYMeditor.editor.prototype.update = function() {
1229
1231
  * @description Opens a dialog box
1230
1232
  */
1231
1233
  WYMeditor.editor.prototype.dialog = function( dialogType ) {
1232
- var path = this._wym._options.dialogPath + dialogType + this._wym._options.dialogFeatures;
1234
+ var path = this._wym._options.dialogPath + dialogType;
1233
1235
 
1234
1236
  this._current_unique_stamp = this.uniqueStamp();
1235
1237
  // change undo or redo on cancel to true to have this happen when a user closes (cancels) a dialogue
@@ -1266,7 +1268,6 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1266
1268
  }
1267
1269
 
1268
1270
  // set up handlers.
1269
- imageGroup = null;
1270
1271
  wym = this;
1271
1272
  ajax_loaded_callback = function(){wym.dialog_ajax_callback(selected)}
1272
1273
 
@@ -1292,41 +1293,42 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1292
1293
  parent_node.id = 'replace_me_with_' + this._current_unique_stamp;
1293
1294
  }
1294
1295
 
1295
- if (dialogType != WYMeditor.DIALOG_PASTE) {
1296
- path += (this._wym._options.dialogFeatures.length == 0) ? "?" : "&";
1296
+ if (dialogType != WYMeditor.DIALOG_PASTE && dialogType != WYMeditor.DIALOG_TABLE) {
1297
+ path += path.indexOf("?") == -1 ? "?" : "&";
1297
1298
  port = (window.location.port.length > 0 ? (":" + window.location.port) : "")
1298
1299
  path += "current_link=" + parent_node.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
1299
1300
  path += "&target_blank=" + (parent_node.target == "_blank" ? "true" : "false");
1300
1301
  }
1301
1302
  }
1302
1303
 
1303
- // launch thickbox
1304
+ // launch dialog
1304
1305
 
1305
- dialog_title = this.replaceStrings(this.encloseString( dialogType ));
1306
+ dialog_title = wym.replaceStrings(wym.encloseString( dialogType ));
1307
+ dialog_container = $("<div id='" + wym._options.dialogId + "' class='editor_dialog'></div>");
1306
1308
  switch(dialogType) {
1307
1309
  case WYMeditor.DIALOG_TABLE: {
1308
- dialog_container = document.createElement("div");
1309
- dialog_container.id = 'inline_dialog_container';
1310
- dialog_container.innerHTML = this.replaceStrings(this._options.dialogTableHtml);
1311
- $(document.body).after(dialog_container);
1310
+ // create and open dialog
1311
+ dialog_container.html(wym.replaceStrings(wym._options.dialogTableHtml)).dialog($.extend(wym._options.dialogInlineFeatures, {
1312
+ title: dialog_title
1313
+ }));
1312
1314
 
1313
- tb_show(dialog_title, "#" + this._options.dialogInlineFeatures + "&inlineId=inline_dialog_container&TB_inline=true&modal=true", imageGroup);
1314
1315
  ajax_loaded_callback();
1315
1316
  break;
1316
1317
  }
1317
1318
  case WYMeditor.DIALOG_PASTE: {
1318
- dialog_container = document.createElement("div");
1319
- dialog_container.id = 'inline_dialog_container';
1320
- dialog_container.innerHTML = this.replaceStrings(this._options.dialogPasteHtml);
1321
- $(document.body).after(dialog_container);
1319
+ dialog_container.html(wym.replaceStrings(wym._options.dialogPasteHtml)).dialog($.extend(wym._options.dialogInlineFeatures, {
1320
+ title: dialog_title
1321
+ }));
1322
1322
 
1323
- tb_show(dialog_title, "#" + this._options.dialogInlineFeatures + "&inlineId=inline_dialog_container&TB_inline=true&modal=true", imageGroup);
1324
1323
  ajax_loaded_callback();
1325
1324
  break;
1326
1325
  }
1327
1326
  default:
1328
1327
  {
1329
- tb_show(dialog_title, path, imageGroup, ajax_loaded_callback);
1328
+ $("<img id='dialog_loading' src='/images/refinery/dialogLoadingAnimation.gif />").appendTo(dialog_container);
1329
+ dialog_container.dialog($.extend(wym._options.dialogFeatures, {
1330
+ title: dialog_title
1331
+ })).load(path, ajax_loaded_callback);
1330
1332
  break;
1331
1333
  }
1332
1334
  }
@@ -1335,8 +1337,12 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1335
1337
 
1336
1338
  WYMeditor.editor.prototype.dialog_ajax_callback = function(selected) {
1337
1339
 
1338
- // look for iframes
1340
+ // set variables
1339
1341
  wym = this; _selected = selected;
1342
+ // now fix the height;
1343
+ $("#" + wym._options.dialogId + ".editor_dialog").css('height', 'auto');
1344
+
1345
+ // look for iframes
1340
1346
  (iframes = $("#" + this._options.dialogId).find('iframe')).load(function() {
1341
1347
  WYMeditor.INIT_DIALOG(wym, _selected);
1342
1348
  $(this).unbind('load');
@@ -1474,11 +1480,11 @@ WYMeditor.editor.prototype.format_block = function(selected) {
1474
1480
 
1475
1481
  WYMeditor.editor.prototype.computeBasePath = function() {
1476
1482
  if ((script_path = this.computeWymPath()) != null) {
1477
- if ((src_parts = script_path.split('/')).length > 1) { src_parts.pop(); }
1478
- return src_parts.join('/') + "/";
1483
+ if ((src_parts = script_path.split('/')).length > 1) { src_parts.pop(); }
1484
+ return src_parts.join('/') + "/";
1479
1485
  }
1480
1486
  else {
1481
- return null;
1487
+ return null;
1482
1488
  }
1483
1489
  };
1484
1490
 
@@ -1488,13 +1494,13 @@ WYMeditor.editor.prototype.computeWymPath = function() {
1488
1494
 
1489
1495
  WYMeditor.editor.prototype.computeJqueryPath = function() {
1490
1496
  return $($.grep($('script'), function(s){
1491
- return (s.src && s.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/ ))
1497
+ return (s.src && s.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/ ))
1492
1498
  })).attr('src');
1493
1499
  };
1494
1500
 
1495
1501
  WYMeditor.editor.prototype.computeCssPath = function() {
1496
1502
  return $($.grep($('link'), function(s){
1497
- return (s.href && s.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/ ))
1503
+ return (s.href && s.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/ ))
1498
1504
  })).attr('href');
1499
1505
  };
1500
1506
 
@@ -1550,13 +1556,7 @@ WYMeditor.editor.prototype.mousedown = function(evt) {
1550
1556
  * href - The CSS path.
1551
1557
  */
1552
1558
  WYMeditor.loadCss = function(href) {
1553
-
1554
- var link = document.createElement('link');
1555
- link.rel = 'stylesheet';
1556
- link.href = href;
1557
-
1558
- var head = $('head').get(0);
1559
- head.appendChild(link);
1559
+ $("<link rel='stylesheet' />").attr('href', href).appendTo($('head').get(0));
1560
1560
  };
1561
1561
 
1562
1562
  /*
@@ -1565,42 +1565,41 @@ WYMeditor.loadCss = function(href) {
1565
1565
  */
1566
1566
  WYMeditor.editor.prototype.loadSkin = function() {
1567
1567
 
1568
- //does the user want to automatically load the CSS (default: yes)?
1569
- //we also test if it hasn't been already loaded by another instance
1570
- //see below for a better (second) test
1571
- if(this._options.loadSkin && !WYMeditor.SKINS[this._options.skin]) {
1572
-
1573
- //check if it hasn't been already loaded
1574
- //so we don't load it more than once
1575
- //(we check the existing <link> elements)
1576
-
1577
- var found = false;
1578
- var rExp = new RegExp(this._options.skin
1579
- + '\/' + WYMeditor.SKINS_DEFAULT_CSS + '$');
1580
-
1581
- $('link').each( function() {
1582
- if(this.href.match(rExp)) found = true;
1583
- });
1584
-
1585
- //load it, using the skin path
1586
- if(!found) WYMeditor.loadCss( this._options.cssSkinPath
1587
- + WYMeditor.SKINS_DEFAULT_CSS );
1568
+ //does the user want to automatically load the CSS (default: yes)?
1569
+ //we also test if it hasn't been already loaded by another instance
1570
+ //see below for a better (second) test
1571
+ if(this._options.loadSkin && !WYMeditor.SKINS[this._options.skin]) {
1572
+ //check if it hasn't been already loaded
1573
+ //so we don't load it more than once
1574
+ //(we check the existing <link> elements)
1575
+
1576
+ var found = false;
1577
+ var rExp = new RegExp(this._options.skin
1578
+ + '\/' + WYMeditor.SKINS_DEFAULT_CSS + '$');
1579
+
1580
+ $('link').each( function() {
1581
+ if(this.href.match(rExp)) found = true;
1582
+ });
1583
+
1584
+ // if not found, load it, using the skin path
1585
+ if(!found) {
1586
+ WYMeditor.loadCss( this._options.cssSkinPath + WYMeditor.SKINS_DEFAULT_CSS );
1588
1587
  }
1588
+ }
1589
1589
 
1590
- //put the classname (ex. wym_skin_default) on wym_box
1591
- $(this._box).addClass( "wym_skin_" + this._options.skin );
1592
-
1593
- //does the user want to use some JS to initialize the skin (default: yes)?
1594
- //also check if it hasn't already been loaded by another instance
1595
- if(this._options.initSkin && !WYMeditor.SKINS[this._options.skin]) {
1590
+ //put the classname (ex. wym_skin_default) on wym_box
1591
+ $(this._box).addClass( "wym_skin_" + this._options.skin );
1596
1592
 
1597
- eval($.ajax({url:this._options.jsSkinPath
1598
- + WYMeditor.SKINS_DEFAULT_JS, async:false}).responseText);
1599
- }
1593
+ //does the user want to use some JS to initialize the skin (default: yes)?
1594
+ //also check if it hasn't already been loaded by another instance
1595
+ if(this._options.initSkin && !WYMeditor.SKINS[this._options.skin]) {
1596
+ eval($.ajax({url:this._options.jsSkinPath + WYMeditor.SKINS_DEFAULT_JS, async:false}).responseText);
1597
+ }
1600
1598
 
1601
- //init the skin, if needed
1602
- if(WYMeditor.SKINS[this._options.skin] && WYMeditor.SKINS[this._options.skin].init)
1603
- WYMeditor.SKINS[this._options.skin].init(this);
1599
+ //init the skin, if needed
1600
+ if(WYMeditor.SKINS[this._options.skin] && WYMeditor.SKINS[this._options.skin].init) {
1601
+ WYMeditor.SKINS[this._options.skin].init(this);
1602
+ }
1604
1603
 
1605
1604
  };
1606
1605
 
@@ -1615,6 +1614,9 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1615
1614
  var dialogType = dialog.find('#wym_dialog_type').val();
1616
1615
  var replaceable = wym._selected_image ? $(wym._selected_image) : $(wym._doc.body).find('#replace_me_with_' + wym._current_unique_stamp);
1617
1616
 
1617
+ // focus first textarea or input type text element
1618
+ dialog.find('input[type=text], textarea').first().focus();
1619
+
1618
1620
  dialog.find(".close_dialog").click(function(e){
1619
1621
  wym.close_dialog(e, true);
1620
1622
  });
@@ -1648,11 +1650,13 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1648
1650
  link.attr({'style': replaceable.attr('style'), 'class': replaceable.attr('class')});
1649
1651
  replaceable.after(link);
1650
1652
  link.html(replaceable.html());
1653
+
1654
+ // now we can get rid of the replaceable element.
1651
1655
  replaceable.remove();
1652
1656
  }
1653
1657
  else
1654
1658
  {
1655
- if ((parent = replaceable.get(0).parentNode) != null && parent.tagName.toUpperCase() == "A") {
1659
+ if ((parent = replaceable.parent().get(0)) != null && parent.tagName.toUpperCase() == "A") {
1656
1660
  $(parent).attr({href: link.attr('href'), title: $(wym._options.titleSelector).val(), target: target});
1657
1661
  }
1658
1662
  else {
@@ -1671,7 +1675,7 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1671
1675
  }
1672
1676
  }
1673
1677
  // fire a click event on the dialogs close button
1674
- wym.close_dialog()
1678
+ wym.close_dialog();
1675
1679
  });
1676
1680
 
1677
1681
  $(wym._options.dialogImageSelector).find(wym._options.submitSelector).click(function() {
@@ -1756,9 +1760,7 @@ WYMeditor.editor.prototype.close_dialog = function(e, cancelled) {
1756
1760
  this._iframe.contentWindow.focus();
1757
1761
  }
1758
1762
 
1759
- $('#inline_dialog_container').remove();
1760
-
1761
- tb_remove();
1763
+ $("#" + wym._options.dialogId).dialog("close").remove();
1762
1764
 
1763
1765
  if (e) {
1764
1766
  e.preventDefault();