infopark_cloud_connector 6.9.4 → 6.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +15 -0
  2. data/README +1 -3
  3. data/app/controllers/cms_controller.rb +7 -0
  4. data/app/controllers/rails_connector/default_cms_controller.rb +43 -0
  5. data/app/controllers/rails_connector/objs_controller.rb +29 -0
  6. data/app/controllers/rails_connector/widget_renderer.rb +1 -1
  7. data/app/controllers/rails_connector/workspaces_controller.rb +4 -0
  8. data/app/helpers/cms_helper.rb +7 -0
  9. data/app/helpers/cms_routing_helper.rb +7 -0
  10. data/app/helpers/rails_connector/cms_asset_helper.rb +24 -17
  11. data/app/helpers/rails_connector/cms_tag_helper.rb +9 -6
  12. data/app/helpers/rails_connector/default_cms_helper.rb +23 -0
  13. data/app/helpers/rails_connector/default_cms_routing_helper.rb +101 -0
  14. data/app/helpers/rails_connector/display_helper.rb +4 -30
  15. data/app/helpers/rails_connector/editing_helper.rb +3 -0
  16. data/app/helpers/rails_connector/layout_helper.rb +29 -0
  17. data/app/helpers/rails_connector/table_of_contents_helper.rb +22 -0
  18. data/app/models/named_link.rb +2 -0
  19. data/app/views/cms/_index.html.erb +7 -0
  20. data/app/views/cms/index.html.erb +1 -0
  21. data/app/views/errors/403_forbidden.html.erb +3 -0
  22. data/app/views/errors/410_gone.html.erb +7 -0
  23. data/app/views/rails_connector/_editing_javascript.html.erb +2 -0
  24. data/config/ca-bundle.crt +1 -1
  25. data/config/cms_routes.rb +14 -0
  26. data/config/locales/de.rails_connector.errors.yml +11 -0
  27. data/config/locales/de.rails_connector.lib.yml +6 -0
  28. data/config/locales/de.rails_connector.views.yml +9 -0
  29. data/config/locales/en.rails_connector.errors.yml +10 -0
  30. data/config/locales/en.rails_connector.lib.yml +6 -0
  31. data/config/locales/en.rails_connector.views.yml +9 -0
  32. data/config/routes.rb +4 -0
  33. data/lib/assets/javascripts/infopark_editing.js +689 -285
  34. data/lib/assets/stylesheets/infopark_editing.css +17 -0
  35. data/lib/infopark_cloud_connector.rb +22 -0
  36. data/lib/obj.rb +3 -0
  37. data/lib/rails_connector/attribute_content.rb +190 -0
  38. data/lib/rails_connector/authenticable.rb +30 -0
  39. data/lib/rails_connector/basic_obj.rb +25 -139
  40. data/lib/rails_connector/basic_widget.rb +35 -0
  41. data/lib/rails_connector/cms_accessible.rb +114 -0
  42. data/lib/rails_connector/cms_cache_storage.rb +1 -1
  43. data/lib/rails_connector/cms_dispatch_controller.rb +46 -0
  44. data/lib/rails_connector/cms_env.rb +68 -0
  45. data/lib/rails_connector/cms_test_request.rb +23 -0
  46. data/lib/rails_connector/configuration.rb +3 -2
  47. data/lib/rails_connector/core_extensions.rb +1 -0
  48. data/lib/rails_connector/core_extensions/time.rb +18 -0
  49. data/lib/rails_connector/date_attribute.rb +1 -17
  50. data/lib/rails_connector/engine.rb +57 -0
  51. data/lib/rails_connector/html_string.rb +19 -0
  52. data/lib/rails_connector/link.rb +102 -17
  53. data/lib/rails_connector/link_resolvable.rb +9 -0
  54. data/lib/rails_connector/migrations/migrator.rb +8 -4
  55. data/lib/rails_connector/migrations/workspace_lock.rb +3 -2
  56. data/lib/rails_connector/named_link.rb +1 -1
  57. data/lib/rails_connector/obj_data_from_service.rb +18 -0
  58. data/lib/rails_connector/string_tagging.rb +29 -0
  59. data/lib/rails_connector/type_computer.rb +30 -0
  60. data/lib/widget.rb +3 -0
  61. metadata +103 -18
@@ -0,0 +1,29 @@
1
+ module RailsConnector
2
+
3
+ # This module contains helpers that render tags for the html head
4
+ # and the end of the html body.
5
+ # @api public
6
+ module LayoutHelper
7
+
8
+ # Renders all tags needed in the html head.
9
+ # @api public
10
+ def rails_connector_header_tags
11
+ html = "".html_safe
12
+ html += tag('meta', :name => 'generator',
13
+ :content => "Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de)")
14
+ html += include_edit_marker_support
15
+ html += include_editing_stylesheet
16
+ html
17
+ end
18
+
19
+ # Renders all tags needed at the end of the body tag.
20
+ # @api public
21
+ def rails_connector_after_content_tags
22
+ html = "".html_safe
23
+ html += render_marker_code
24
+ html += include_editing_javascript
25
+ html
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,22 @@
1
+ module RailsConnector
2
+
3
+ #
4
+ # This module contains a helper that can be used to build a table of contents of an object.
5
+ #
6
+ # @api public
7
+ module TableOfContentsHelper
8
+
9
+ #
10
+ # The <tt>table_of_contents</tt> helper method gets an object as argument and returns an array,
11
+ # which can be used as the table of contents of the given object.
12
+ #
13
+ # The returned array consists of the child objects of the given object.
14
+ # The array is sorted according to the configured sort order and the sort keys.
15
+ # It also contains only objects which the current user is permitted to view.
16
+ #
17
+ # @api public
18
+ def table_of_contents(obj)
19
+ obj.sorted_toclist.reject { |o| not o.permitted_for_user?(current_user) }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ # ::NamedLink is just a shortcut
2
+ ::NamedLink = RailsConnector::NamedLink
@@ -0,0 +1,7 @@
1
+ <h1 class="cms_title"><%= display_field @obj, :title %></h1>
2
+ <ul class="cms_toclist">
3
+ <% @obj.toclist.each do |item| %>
4
+ <li><%= link_to display_field(item, :title), cms_path(item) %></li>
5
+ <% end %>
6
+ </ul>
7
+ <%= display_field @obj, :body %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'index' %>
@@ -0,0 +1,3 @@
1
+ <h1><%= t(:'rails_connector.lib.cms_accessible.protected') %></h1>
2
+
3
+ <p><%= t(:"rails_connector.views.errors.forbidden.no_permissions") %></p>
@@ -0,0 +1,7 @@
1
+ <h1><%= t(:'rails_connector.lib.cms_accessible.not_released') %></h1>
2
+
3
+ <% if @valid_until && @valid_until < Time.now %>
4
+ <%= raw t(:"rails_connector.views.errors.gone.not_released_anymore", :valid_until => "<strong>#{l @valid_until}</strong>") %>
5
+ <% elsif @valid_from && Time.now < @valid_from %>
6
+ <%= raw t(:"rails_connector.views.errors.gone.not_yet_released", :valid_from => "<strong>#{l @valid_from}</strong>") %>
7
+ <% end %>
@@ -9,7 +9,9 @@
9
9
  })
10
10
  );
11
11
  infopark.obj.current_page_id = "<%= @obj.try(:id) %>";
12
+ infopark.obj.current_page_obj_class_name = "<%= @obj.try(:obj_class) %>";
12
13
  infopark.obj.current_page_has_edit_view = <%= current_page_has_edit_view? %>;
14
+ infopark.obj.current_page_has_children = <%= current_page_has_children? %>;
13
15
  infopark.admin_gui_base_url = "<%= RailsConnector::CmsRestApi.configuration.url %>";
14
16
  infopark.editing.initialize();
15
17
  });
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## /Network/Servers/xs2.infopark/Users/develop/dcc/tmp/Rails_Connector__Kris__dev__93/repos/cloud_connector/config/ca-bundle.crt -- Bundle of CA Root Certificates
3
3
  ##
4
- ## Converted at: Tue Sep 10 14:39:56 2013 UTC
4
+ ## Converted at: Thu Oct 24 14:57:22 2013 UTC
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -0,0 +1,14 @@
1
+ Rails.application.routes.draw do
2
+ root :to => 'rails_connector/cms_dispatch#index'
3
+ match ':id(/*slug)',
4
+ :to => 'rails_connector/cms_dispatch#index',
5
+ :constraints => { :id => /\d+|[0-9a-f]{16}/ },
6
+ :as => "cms_id"
7
+ match 'toggle_markers/:id',
8
+ :to => 'rails_connector/cms_dispatch#toggle_editmarkers',
9
+ :as => "toggle_markers"
10
+ match '/*permalink',
11
+ :to => 'rails_connector/cms_dispatch#index',
12
+ :as => 'cms_permalink',
13
+ :format => false
14
+ end
@@ -0,0 +1,11 @@
1
+ de:
2
+ rails_connector:
3
+ errors:
4
+ messages:
5
+ blank: "darf nicht leer sein"
6
+ forbidden:
7
+ no_permissions: "Sie haben nicht die notwendigen Zugriffsrechte"
8
+ gone:
9
+ not_released_anymore: "Die Datei war nur bis zum %{valid_until} veröffentlicht."
10
+ not_yet_released: "Die Datei wird erst am %{valid_from} veröffentlicht."
11
+
@@ -0,0 +1,6 @@
1
+ de:
2
+ rails_connector:
3
+ lib:
4
+ cms_accessible:
5
+ protected: "Die Datei ist geschützt"
6
+ not_released: "Die Datei wurde nicht veröffentlicht"
@@ -0,0 +1,9 @@
1
+ de:
2
+ rails_connector:
3
+ views:
4
+ errors:
5
+ forbidden:
6
+ no_permissions: "Sie haben nicht die notwendigen Zugriffsrechte"
7
+ gone:
8
+ not_released_anymore: "Die Datei war nur bis zum %{valid_until} veröffentlicht."
9
+ not_yet_released: "Die Datei wird erst am %{valid_from} veröffentlicht."
@@ -0,0 +1,10 @@
1
+ en:
2
+ rails_connector:
3
+ errors:
4
+ messages:
5
+ blank: "cannot be blank"
6
+ forbidden:
7
+ no_permissions: "You don't have the required permissions"
8
+ gone:
9
+ not_released_anymore: "The file was released only until %{valid_until}"
10
+ not_yet_released: "The file will be released on %{valid_from}"
@@ -0,0 +1,6 @@
1
+ en:
2
+ rails_connector:
3
+ lib:
4
+ cms_accessible:
5
+ protected: "This file is protected"
6
+ not_released: "The file has not been released"
@@ -0,0 +1,9 @@
1
+ en:
2
+ rails_connector:
3
+ views:
4
+ errors:
5
+ forbidden:
6
+ no_permissions: "You don't have the required permissions"
7
+ gone:
8
+ not_released_anymore: "The file was released only until %{valid_until}"
9
+ not_yet_released: "The file will be released on %{valid_from}"
@@ -7,6 +7,9 @@ Rails.application.routes.draw do
7
7
  get :widget_class_selection
8
8
  post :create_widget
9
9
  get :edit_widget
10
+
11
+ post :copy
12
+ post :duplicate
10
13
  end
11
14
  end
12
15
 
@@ -19,6 +22,7 @@ Rails.application.routes.draw do
19
22
  path: '__ipcms/workspaces',
20
23
  only: [:index, :create, :update, :destroy] do
21
24
  member do
25
+ put :rebase
22
26
  put :publish
23
27
  end
24
28
  end
@@ -2318,45 +2318,32 @@ THE SOFTWARE.
2318
2318
 
2319
2319
  */
2320
2320
 
2321
- // lib/handlebars/browser-prefix.js
2322
- var Handlebars = {};
2323
-
2324
- (function(Handlebars, undefined) {
2325
- ;
2326
2321
  // lib/handlebars/base.js
2327
2322
 
2328
- Handlebars.VERSION = "1.0.0-rc.4";
2329
- Handlebars.COMPILER_REVISION = 3;
2323
+ /*jshint eqnull:true*/
2324
+
2325
+ this.Handlebars = {};
2326
+
2327
+ (function(Handlebars) {
2328
+
2329
+ Handlebars.VERSION = "1.0.0-rc.3";
2330
+ Handlebars.COMPILER_REVISION = 2;
2330
2331
 
2331
2332
  Handlebars.REVISION_CHANGES = {
2332
2333
  1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
2333
- 2: '== 1.0.0-rc.3',
2334
- 3: '>= 1.0.0-rc.4'
2334
+ 2: '>= 1.0.0-rc.3'
2335
2335
  };
2336
2336
 
2337
2337
  Handlebars.helpers = {};
2338
2338
  Handlebars.partials = {};
2339
2339
 
2340
- var toString = Object.prototype.toString,
2341
- functionType = '[object Function]',
2342
- objectType = '[object Object]';
2343
-
2344
2340
  Handlebars.registerHelper = function(name, fn, inverse) {
2345
- if (toString.call(name) === objectType) {
2346
- if (inverse || fn) { throw new Handlebars.Exception('Arg not supported with multiple helpers'); }
2347
- Handlebars.Utils.extend(this.helpers, name);
2348
- } else {
2349
- if (inverse) { fn.not = inverse; }
2350
- this.helpers[name] = fn;
2351
- }
2341
+ if(inverse) { fn.not = inverse; }
2342
+ this.helpers[name] = fn;
2352
2343
  };
2353
2344
 
2354
2345
  Handlebars.registerPartial = function(name, str) {
2355
- if (toString.call(name) === objectType) {
2356
- Handlebars.Utils.extend(this.partials, name);
2357
- } else {
2358
- this.partials[name] = str;
2359
- }
2346
+ this.partials[name] = str;
2360
2347
  };
2361
2348
 
2362
2349
  Handlebars.registerHelper('helperMissing', function(arg) {
@@ -2367,9 +2354,13 @@ Handlebars.registerHelper('helperMissing', function(arg) {
2367
2354
  }
2368
2355
  });
2369
2356
 
2357
+ var toString = Object.prototype.toString, functionType = "[object Function]";
2358
+
2370
2359
  Handlebars.registerHelper('blockHelperMissing', function(context, options) {
2371
2360
  var inverse = options.inverse || function() {}, fn = options.fn;
2372
2361
 
2362
+
2363
+ var ret = "";
2373
2364
  var type = toString.call(context);
2374
2365
 
2375
2366
  if(type === functionType) { context = context.call(this); }
@@ -2460,17 +2451,23 @@ Handlebars.registerHelper('if', function(context, options) {
2460
2451
  });
2461
2452
 
2462
2453
  Handlebars.registerHelper('unless', function(context, options) {
2463
- return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn});
2454
+ var fn = options.fn, inverse = options.inverse;
2455
+ options.fn = inverse;
2456
+ options.inverse = fn;
2457
+
2458
+ return Handlebars.helpers['if'].call(this, context, options);
2464
2459
  });
2465
2460
 
2466
2461
  Handlebars.registerHelper('with', function(context, options) {
2467
- if (!Handlebars.Utils.isEmpty(context)) return options.fn(context);
2462
+ return options.fn(context);
2468
2463
  });
2469
2464
 
2470
2465
  Handlebars.registerHelper('log', function(context, options) {
2471
2466
  var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
2472
2467
  Handlebars.log(level, context);
2473
2468
  });
2469
+
2470
+ }(this.Handlebars));
2474
2471
  ;
2475
2472
  // lib/handlebars/utils.js
2476
2473
 
@@ -2494,61 +2491,48 @@ Handlebars.SafeString.prototype.toString = function() {
2494
2491
  return this.string.toString();
2495
2492
  };
2496
2493
 
2497
- var escape = {
2498
- "&": "&amp;",
2499
- "<": "&lt;",
2500
- ">": "&gt;",
2501
- '"': "&quot;",
2502
- "'": "&#x27;",
2503
- "`": "&#x60;"
2504
- };
2494
+ (function() {
2495
+ var escape = {
2496
+ "&": "&amp;",
2497
+ "<": "&lt;",
2498
+ ">": "&gt;",
2499
+ '"': "&quot;",
2500
+ "'": "&#x27;",
2501
+ "`": "&#x60;"
2502
+ };
2505
2503
 
2506
- var badChars = /[&<>"'`]/g;
2507
- var possible = /[&<>"'`]/;
2504
+ var badChars = /[&<>"'`]/g;
2505
+ var possible = /[&<>"'`]/;
2508
2506
 
2509
- var escapeChar = function(chr) {
2510
- return escape[chr] || "&amp;";
2511
- };
2507
+ var escapeChar = function(chr) {
2508
+ return escape[chr] || "&amp;";
2509
+ };
2512
2510
 
2513
- Handlebars.Utils = {
2514
- extend: function(obj, value) {
2515
- for(var key in value) {
2516
- if(value.hasOwnProperty(key)) {
2517
- obj[key] = value[key];
2511
+ Handlebars.Utils = {
2512
+ escapeExpression: function(string) {
2513
+ // don't escape SafeStrings, since they're already safe
2514
+ if (string instanceof Handlebars.SafeString) {
2515
+ return string.toString();
2516
+ } else if (string == null || string === false) {
2517
+ return "";
2518
2518
  }
2519
- }
2520
- },
2521
-
2522
- escapeExpression: function(string) {
2523
- // don't escape SafeStrings, since they're already safe
2524
- if (string instanceof Handlebars.SafeString) {
2525
- return string.toString();
2526
- } else if (string == null || string === false) {
2527
- return "";
2528
- }
2529
-
2530
- // Force a string conversion as this will be done by the append regardless and
2531
- // the regex test will do this transparently behind the scenes, causing issues if
2532
- // an object's to string has escaped characters in it.
2533
- string = string.toString();
2534
2519
 
2535
- if(!possible.test(string)) { return string; }
2536
- return string.replace(badChars, escapeChar);
2537
- },
2520
+ if(!possible.test(string)) { return string; }
2521
+ return string.replace(badChars, escapeChar);
2522
+ },
2538
2523
 
2539
- isEmpty: function(value) {
2540
- if (!value && value !== 0) {
2541
- return true;
2542
- } else if(toString.call(value) === "[object Array]" && value.length === 0) {
2543
- return true;
2544
- } else {
2545
- return false;
2524
+ isEmpty: function(value) {
2525
+ if (!value && value !== 0) {
2526
+ return true;
2527
+ } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
2528
+ return true;
2529
+ } else {
2530
+ return false;
2531
+ }
2546
2532
  }
2547
- }
2548
- };
2549
- ;
2533
+ };
2534
+ })();;
2550
2535
  // lib/handlebars/runtime.js
2551
-
2552
2536
  Handlebars.VM = {
2553
2537
  template: function(templateSpec) {
2554
2538
  // Just add water
@@ -2559,11 +2543,13 @@ Handlebars.VM = {
2559
2543
  program: function(i, fn, data) {
2560
2544
  var programWrapper = this.programs[i];
2561
2545
  if(data) {
2562
- programWrapper = Handlebars.VM.program(i, fn, data);
2563
- } else if (!programWrapper) {
2564
- programWrapper = this.programs[i] = Handlebars.VM.program(i, fn);
2546
+ return Handlebars.VM.program(fn, data);
2547
+ } else if(programWrapper) {
2548
+ return programWrapper;
2549
+ } else {
2550
+ programWrapper = this.programs[i] = Handlebars.VM.program(fn);
2551
+ return programWrapper;
2565
2552
  }
2566
- return programWrapper;
2567
2553
  },
2568
2554
  programWithDepth: Handlebars.VM.programWithDepth,
2569
2555
  noop: Handlebars.VM.noop,
@@ -2595,27 +2581,21 @@ Handlebars.VM = {
2595
2581
  };
2596
2582
  },
2597
2583
 
2598
- programWithDepth: function(i, fn, data /*, $depth */) {
2599
- var args = Array.prototype.slice.call(arguments, 3);
2584
+ programWithDepth: function(fn, data, $depth) {
2585
+ var args = Array.prototype.slice.call(arguments, 2);
2600
2586
 
2601
- var program = function(context, options) {
2587
+ return function(context, options) {
2602
2588
  options = options || {};
2603
2589
 
2604
2590
  return fn.apply(this, [context, options.data || data].concat(args));
2605
2591
  };
2606
- program.program = i;
2607
- program.depth = args.length;
2608
- return program;
2609
2592
  },
2610
- program: function(i, fn, data) {
2611
- var program = function(context, options) {
2593
+ program: function(fn, data) {
2594
+ return function(context, options) {
2612
2595
  options = options || {};
2613
2596
 
2614
2597
  return fn(context, options.data || data);
2615
2598
  };
2616
- program.program = i;
2617
- program.depth = 0;
2618
- return program;
2619
2599
  },
2620
2600
  noop: function() { return ""; },
2621
2601
  invokePartial: function(partial, name, context, helpers, partials, data) {
@@ -2636,9 +2616,6 @@ Handlebars.VM = {
2636
2616
 
2637
2617
  Handlebars.template = Handlebars.VM.template;
2638
2618
  ;
2639
- // lib/handlebars/browser-suffix.js
2640
- })(Handlebars);
2641
- ;
2642
2619
  /*!
2643
2620
  * jQuery Cookie Plugin v1.3.1
2644
2621
  * https://github.com/carhartl/jquery-cookie
@@ -5403,9 +5380,9 @@ if (typeof module !== 'undefined' && module.exports) {
5403
5380
  }
5404
5381
 
5405
5382
  ;
5406
- // Underscore.js 1.5.1
5383
+ // Underscore.js 1.4.4
5407
5384
  // http://underscorejs.org
5408
- // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5385
+ // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
5409
5386
  // Underscore may be freely distributed under the MIT license.
5410
5387
 
5411
5388
  (function() {
@@ -5426,12 +5403,11 @@ if (typeof module !== 'undefined' && module.exports) {
5426
5403
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
5427
5404
 
5428
5405
  // Create quick reference variables for speed access to core prototypes.
5429
- var
5430
- push = ArrayProto.push,
5431
- slice = ArrayProto.slice,
5432
- concat = ArrayProto.concat,
5433
- toString = ObjProto.toString,
5434
- hasOwnProperty = ObjProto.hasOwnProperty;
5406
+ var push = ArrayProto.push,
5407
+ slice = ArrayProto.slice,
5408
+ concat = ArrayProto.concat,
5409
+ toString = ObjProto.toString,
5410
+ hasOwnProperty = ObjProto.hasOwnProperty;
5435
5411
 
5436
5412
  // All **ECMAScript 5** native function implementations that we hope to use
5437
5413
  // are declared here.
@@ -5470,7 +5446,7 @@ if (typeof module !== 'undefined' && module.exports) {
5470
5446
  }
5471
5447
 
5472
5448
  // Current version.
5473
- _.VERSION = '1.5.1';
5449
+ _.VERSION = '1.4.4';
5474
5450
 
5475
5451
  // Collection Functions
5476
5452
  // --------------------
@@ -5502,7 +5478,7 @@ if (typeof module !== 'undefined' && module.exports) {
5502
5478
  if (obj == null) return results;
5503
5479
  if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
5504
5480
  each(obj, function(value, index, list) {
5505
- results.push(iterator.call(context, value, index, list));
5481
+ results[results.length] = iterator.call(context, value, index, list);
5506
5482
  });
5507
5483
  return results;
5508
5484
  };
@@ -5577,7 +5553,7 @@ if (typeof module !== 'undefined' && module.exports) {
5577
5553
  if (obj == null) return results;
5578
5554
  if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
5579
5555
  each(obj, function(value, index, list) {
5580
- if (iterator.call(context, value, index, list)) results.push(value);
5556
+ if (iterator.call(context, value, index, list)) results[results.length] = value;
5581
5557
  });
5582
5558
  return results;
5583
5559
  };
@@ -5661,7 +5637,7 @@ if (typeof module !== 'undefined' && module.exports) {
5661
5637
 
5662
5638
  // Return the maximum element or (element-based computation).
5663
5639
  // Can't optimize arrays of integers longer than 65,535 elements.
5664
- // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
5640
+ // See: https://bugs.webkit.org/show_bug.cgi?id=80797
5665
5641
  _.max = function(obj, iterator, context) {
5666
5642
  if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
5667
5643
  return Math.max.apply(Math, obj);
@@ -5670,7 +5646,7 @@ if (typeof module !== 'undefined' && module.exports) {
5670
5646
  var result = {computed : -Infinity, value: -Infinity};
5671
5647
  each(obj, function(value, index, list) {
5672
5648
  var computed = iterator ? iterator.call(context, value, index, list) : value;
5673
- computed > result.computed && (result = {value : value, computed : computed});
5649
+ computed >= result.computed && (result = {value : value, computed : computed});
5674
5650
  });
5675
5651
  return result.value;
5676
5652
  };
@@ -5769,7 +5745,7 @@ if (typeof module !== 'undefined' && module.exports) {
5769
5745
  return low;
5770
5746
  };
5771
5747
 
5772
- // Safely create a real, live array from anything iterable.
5748
+ // Safely convert anything iterable into a real, live array.
5773
5749
  _.toArray = function(obj) {
5774
5750
  if (!obj) return [];
5775
5751
  if (_.isArray(obj)) return slice.call(obj);
@@ -5828,11 +5804,8 @@ if (typeof module !== 'undefined' && module.exports) {
5828
5804
 
5829
5805
  // Internal implementation of a recursive `flatten` function.
5830
5806
  var flatten = function(input, shallow, output) {
5831
- if (shallow && _.every(input, _.isArray)) {
5832
- return concat.apply(output, input);
5833
- }
5834
5807
  each(input, function(value) {
5835
- if (_.isArray(value) || _.isArguments(value)) {
5808
+ if (_.isArray(value)) {
5836
5809
  shallow ? push.apply(output, value) : flatten(value, shallow, output);
5837
5810
  } else {
5838
5811
  output.push(value);
@@ -5875,7 +5848,7 @@ if (typeof module !== 'undefined' && module.exports) {
5875
5848
  // Produce an array that contains the union: each distinct element from all of
5876
5849
  // the passed-in arrays.
5877
5850
  _.union = function() {
5878
- return _.uniq(_.flatten(arguments, true));
5851
+ return _.uniq(concat.apply(ArrayProto, arguments));
5879
5852
  };
5880
5853
 
5881
5854
  // Produce an array that contains every item shared between all the
@@ -5899,10 +5872,11 @@ if (typeof module !== 'undefined' && module.exports) {
5899
5872
  // Zip together multiple lists into a single array -- elements that share
5900
5873
  // an index go together.
5901
5874
  _.zip = function() {
5902
- var length = _.max(_.pluck(arguments, "length").concat(0));
5875
+ var args = slice.call(arguments);
5876
+ var length = _.max(_.pluck(args, 'length'));
5903
5877
  var results = new Array(length);
5904
5878
  for (var i = 0; i < length; i++) {
5905
- results[i] = _.pluck(arguments, '' + i);
5879
+ results[i] = _.pluck(args, "" + i);
5906
5880
  }
5907
5881
  return results;
5908
5882
  };
@@ -5990,7 +5964,7 @@ if (typeof module !== 'undefined' && module.exports) {
5990
5964
  // available.
5991
5965
  _.bind = function(func, context) {
5992
5966
  var args, bound;
5993
- if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
5967
+ if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
5994
5968
  if (!_.isFunction(func)) throw new TypeError;
5995
5969
  args = slice.call(arguments, 2);
5996
5970
  return bound = function() {
@@ -6046,23 +6020,17 @@ if (typeof module !== 'undefined' && module.exports) {
6046
6020
  };
6047
6021
 
6048
6022
  // Returns a function, that, when invoked, will only be triggered at most once
6049
- // during a given window of time. Normally, the throttled function will run
6050
- // as much as it can, without ever going more than once per `wait` duration;
6051
- // but if you'd like to disable the execution on the leading edge, pass
6052
- // `{leading: false}`. To disable execution on the trailing edge, ditto.
6053
- _.throttle = function(func, wait, options) {
6054
- var context, args, result;
6055
- var timeout = null;
6023
+ // during a given window of time.
6024
+ _.throttle = function(func, wait) {
6025
+ var context, args, timeout, result;
6056
6026
  var previous = 0;
6057
- options || (options = {});
6058
6027
  var later = function() {
6059
- previous = options.leading === false ? 0 : new Date;
6028
+ previous = new Date;
6060
6029
  timeout = null;
6061
6030
  result = func.apply(context, args);
6062
6031
  };
6063
6032
  return function() {
6064
6033
  var now = new Date;
6065
- if (!previous && options.leading === false) previous = now;
6066
6034
  var remaining = wait - (now - previous);
6067
6035
  context = this;
6068
6036
  args = arguments;
@@ -6071,7 +6039,7 @@ if (typeof module !== 'undefined' && module.exports) {
6071
6039
  timeout = null;
6072
6040
  previous = now;
6073
6041
  result = func.apply(context, args);
6074
- } else if (!timeout && options.trailing !== false) {
6042
+ } else if (!timeout) {
6075
6043
  timeout = setTimeout(later, remaining);
6076
6044
  }
6077
6045
  return result;
@@ -6083,8 +6051,7 @@ if (typeof module !== 'undefined' && module.exports) {
6083
6051
  // N milliseconds. If `immediate` is passed, trigger the function on the
6084
6052
  // leading edge, instead of the trailing.
6085
6053
  _.debounce = function(func, wait, immediate) {
6086
- var result;
6087
- var timeout = null;
6054
+ var timeout, result;
6088
6055
  return function() {
6089
6056
  var context = this, args = arguments;
6090
6057
  var later = function() {
@@ -6138,6 +6105,7 @@ if (typeof module !== 'undefined' && module.exports) {
6138
6105
 
6139
6106
  // Returns a function that will only be executed after being called N times.
6140
6107
  _.after = function(times, func) {
6108
+ if (times <= 0) return func();
6141
6109
  return function() {
6142
6110
  if (--times < 1) {
6143
6111
  return func.apply(this, arguments);
@@ -6153,7 +6121,7 @@ if (typeof module !== 'undefined' && module.exports) {
6153
6121
  _.keys = nativeKeys || function(obj) {
6154
6122
  if (obj !== Object(obj)) throw new TypeError('Invalid object');
6155
6123
  var keys = [];
6156
- for (var key in obj) if (_.has(obj, key)) keys.push(key);
6124
+ for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
6157
6125
  return keys;
6158
6126
  };
6159
6127
 
@@ -6249,7 +6217,7 @@ if (typeof module !== 'undefined' && module.exports) {
6249
6217
  // Internal recursive comparison function for `isEqual`.
6250
6218
  var eq = function(a, b, aStack, bStack) {
6251
6219
  // Identical objects are equal. `0 === -0`, but they aren't identical.
6252
- // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
6220
+ // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
6253
6221
  if (a === b) return a !== 0 || 1 / a == 1 / b;
6254
6222
  // A strict comparison is necessary because `null == undefined`.
6255
6223
  if (a == null || b == null) return a === b;
@@ -6291,13 +6259,6 @@ if (typeof module !== 'undefined' && module.exports) {
6291
6259
  // unique nested structures.
6292
6260
  if (aStack[length] == a) return bStack[length] == b;
6293
6261
  }
6294
- // Objects with different constructors are not equivalent, but `Object`s
6295
- // from different frames are.
6296
- var aCtor = a.constructor, bCtor = b.constructor;
6297
- if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
6298
- _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
6299
- return false;
6300
- }
6301
6262
  // Add the first object to the stack of traversed objects.
6302
6263
  aStack.push(a);
6303
6264
  bStack.push(b);
@@ -6314,6 +6275,13 @@ if (typeof module !== 'undefined' && module.exports) {
6314
6275
  }
6315
6276
  }
6316
6277
  } else {
6278
+ // Objects with different constructors are not equivalent, but `Object`s
6279
+ // from different frames are.
6280
+ var aCtor = a.constructor, bCtor = b.constructor;
6281
+ if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
6282
+ _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
6283
+ return false;
6284
+ }
6317
6285
  // Deep compare objects.
6318
6286
  for (var key in a) {
6319
6287
  if (_.has(a, key)) {
@@ -6437,7 +6405,7 @@ if (typeof module !== 'undefined' && module.exports) {
6437
6405
 
6438
6406
  // Run a function **n** times.
6439
6407
  _.times = function(n, iterator, context) {
6440
- var accum = Array(Math.max(0, n));
6408
+ var accum = Array(n);
6441
6409
  for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
6442
6410
  return accum;
6443
6411
  };
@@ -6458,7 +6426,8 @@ if (typeof module !== 'undefined' && module.exports) {
6458
6426
  '<': '&lt;',
6459
6427
  '>': '&gt;',
6460
6428
  '"': '&quot;',
6461
- "'": '&#x27;'
6429
+ "'": '&#x27;',
6430
+ '/': '&#x2F;'
6462
6431
  }
6463
6432
  };
6464
6433
  entityMap.unescape = _.invert(entityMap.escape);
@@ -6479,8 +6448,8 @@ if (typeof module !== 'undefined' && module.exports) {
6479
6448
  };
6480
6449
  });
6481
6450
 
6482
- // If the value of the named `property` is a function then invoke it with the
6483
- // `object` as context; otherwise, return it.
6451
+ // If the value of the named property is a function then invoke it;
6452
+ // otherwise, return it.
6484
6453
  _.result = function(object, property) {
6485
6454
  if (object == null) return void 0;
6486
6455
  var value = object[property];
@@ -6651,7 +6620,7 @@ if (typeof module !== 'undefined' && module.exports) {
6651
6620
  (function() {
6652
6621
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6653
6622
  this.InfoparkHandlebarsTemplates["choose_obj_class_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6654
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6623
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6655
6624
  helpers = helpers || Handlebars.helpers; data = data || {};
6656
6625
  var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
6657
6626
 
@@ -6677,7 +6646,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6677
6646
  (function() {
6678
6647
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6679
6648
  this.InfoparkHandlebarsTemplates["choose_obj_class_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6680
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6649
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6681
6650
  helpers = helpers || Handlebars.helpers; data = data || {};
6682
6651
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
6683
6652
 
@@ -6693,7 +6662,7 @@ function program1(depth0,data) {
6693
6662
  function program2(depth0,data) {
6694
6663
 
6695
6664
  var buffer = "", stack1;
6696
- buffer += "\n <div class=\"ip_obj_class_thumbnail ip_editing_widget_preview\" data-ip-obj-class-name=\"";
6665
+ buffer += "\n <div class=\"ip_obj_class_thumbnail ip_editing_widget_preview\" data-ip-private-obj-class-name=\"";
6697
6666
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
6698
6667
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
6699
6668
  buffer += escapeExpression(stack1)
@@ -6715,7 +6684,7 @@ function program2(depth0,data) {
6715
6684
  (function() {
6716
6685
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6717
6686
  this.InfoparkHandlebarsTemplates["confirmation_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6718
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6687
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6719
6688
  helpers = helpers || Handlebars.helpers; data = data || {};
6720
6689
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
6721
6690
 
@@ -6765,9 +6734,9 @@ function program1(depth0,data) {
6765
6734
  (function() {
6766
6735
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6767
6736
  this.InfoparkHandlebarsTemplates["edit_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6768
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6737
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6769
6738
  helpers = helpers || Handlebars.helpers; data = data || {};
6770
- var buffer = "", stack1, stack2, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
6739
+ var buffer = "", stack1, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
6771
6740
 
6772
6741
 
6773
6742
  buffer += "<div class=\"ip_edit_dialog ip_modal_big ip_adjust_dialog\">\n\n <div class=\"ip_modal_header\">\n <h3><i class=\"ip_icon\">";
@@ -6777,11 +6746,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6777
6746
  buffer += "</i>";
6778
6747
  options = {hash:{},data:data};
6779
6748
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "edit_dialog.title", depth0.title, options) : helperMissing.call(depth0, "translate", "edit_dialog.title", depth0.title, options)))
6780
- + "</h3>\n <div class=\"ip_edit_dialog_saving_indicator\"></div>\n </div>\n\n <div class=\"ip_modal_body ip_edit_dialog_markup ip_auto_height\">";
6781
- if (stack2 = helpers.markup) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
6782
- else { stack2 = depth0.markup; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
6783
- if(stack2 || stack2 === 0) { buffer += stack2; }
6784
- buffer += "</div>\n\n <div class=\"ip_modal_footer\">\n <a href=\"#\" class=\"ip_button ip_cancel\">";
6749
+ + "</h3>\n <div class=\"ip_edit_dialog_saving_indicator\"></div>\n </div>\n\n <div class=\"ip_modal_body ip_auto_height\">\n <i class=\"ip_icon ip_spinning\">&#xf023;</i>\n <div class=\"ip_edit_dialog_markup\"></div>\n </div>\n\n <div class=\"ip_modal_footer\">\n <a href=\"#\" class=\"ip_button ip_cancel\">";
6785
6750
  options = {hash:{},data:data};
6786
6751
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "close", options) : helperMissing.call(depth0, "translate", "close", options)))
6787
6752
  + "</a>\n </div>\n\n</div>\n";
@@ -6792,7 +6757,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6792
6757
  (function() {
6793
6758
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6794
6759
  this.InfoparkHandlebarsTemplates["editable_workspace_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6795
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6760
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6796
6761
  helpers = helpers || Handlebars.helpers; data = data || {};
6797
6762
  var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
6798
6763
 
@@ -6832,7 +6797,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6832
6797
  (function() {
6833
6798
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6834
6799
  this.InfoparkHandlebarsTemplates["element_overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6835
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6800
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6836
6801
  helpers = helpers || Handlebars.helpers; data = data || {};
6837
6802
 
6838
6803
 
@@ -6844,14 +6809,18 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6844
6809
  (function() {
6845
6810
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6846
6811
  this.InfoparkHandlebarsTemplates["inplace_menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6847
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6812
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6848
6813
  helpers = helpers || Handlebars.helpers; data = data || {};
6849
6814
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
6850
6815
 
6851
6816
  function program1(depth0,data) {
6852
6817
 
6853
6818
  var buffer = "", stack1;
6854
- buffer += "\n <li class=\"ip_menu_item\">\n <span><i class=\"ip_icon\">"
6819
+ buffer += "\n <li class=\"";
6820
+ if (stack1 = helpers.css_class) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
6821
+ else { stack1 = depth0.css_class; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
6822
+ buffer += escapeExpression(stack1)
6823
+ + "\">\n <span><i class=\"ip_icon\">"
6855
6824
  + escapeExpression(((stack1 = depth0.icon),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
6856
6825
  + "</i>"
6857
6826
  + escapeExpression(((stack1 = depth0.text),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
@@ -6874,7 +6843,7 @@ function program1(depth0,data) {
6874
6843
  (function() {
6875
6844
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6876
6845
  this.InfoparkHandlebarsTemplates["inplace_menu_icon"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6877
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6846
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6878
6847
  helpers = helpers || Handlebars.helpers; data = data || {};
6879
6848
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
6880
6849
 
@@ -6891,7 +6860,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6891
6860
  (function() {
6892
6861
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6893
6862
  this.InfoparkHandlebarsTemplates["menu_bar"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6894
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6863
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6895
6864
  helpers = helpers || Handlebars.helpers; data = data || {};
6896
6865
 
6897
6866
 
@@ -6903,17 +6872,31 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6903
6872
  (function() {
6904
6873
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6905
6874
  this.InfoparkHandlebarsTemplates["menu_bar_dropdown"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6906
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6875
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6907
6876
  helpers = helpers || Handlebars.helpers; data = data || {};
6908
- var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this;
6877
+ var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this, functionType="function";
6909
6878
 
6910
6879
  function program1(depth0,data) {
6911
6880
 
6912
- var buffer = "", stack1, options;
6881
+ var buffer = "", stack1, stack2, options;
6913
6882
  buffer += "\n ";
6914
6883
  stack1 = helpers['if'].call(depth0, depth0.current_page_has_edit_view, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
6915
6884
  if(stack1 || stack1 === 0) { buffer += stack1; }
6916
- buffer += "\n\n <li id=\"ip_delete_current_page\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\">&#xF018;</i>";
6885
+ buffer += "\n\n <li id=\"ip_save_current_page_to_clipboard\" class=\"";
6886
+ if (stack1 = helpers.disable_with_children) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
6887
+ else { stack1 = depth0.disable_with_children; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
6888
+ buffer += escapeExpression(stack1)
6889
+ + "\">\n <span>\n <i class=\"ip_icon\">&#xf017;</i>\n ";
6890
+ options = {hash:{},data:data};
6891
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.save_current_page_to_clipboard", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.save_current_page_to_clipboard", options)))
6892
+ + "\n </span>\n </li>\n\n <li id=\"ip_duplicate_current_page\" class=\"";
6893
+ if (stack2 = helpers.disable_with_children) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
6894
+ else { stack2 = depth0.disable_with_children; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
6895
+ buffer += escapeExpression(stack2)
6896
+ + "\">\n <span>\n <i class=\"ip_icon\">&#xf015;</i>\n ";
6897
+ options = {hash:{},data:data};
6898
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.duplicate_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.duplicate_current_page", options)))
6899
+ + "\n </span>\n </li>\n\n <li id=\"ip_delete_current_page\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\">&#xF018;</i>";
6917
6900
  options = {hash:{},data:data};
6918
6901
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.delete_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.delete_current_page", options)))
6919
6902
  + "</span>\n </li>\n\n <li id=\"ip_open_current_page_in_admin_gui\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\">&#xF000;</i>";
@@ -6946,7 +6929,7 @@ function program2(depth0,data) {
6946
6929
  (function() {
6947
6930
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6948
6931
  this.InfoparkHandlebarsTemplates["overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6949
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6932
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6950
6933
  helpers = helpers || Handlebars.helpers; data = data || {};
6951
6934
 
6952
6935
 
@@ -6958,7 +6941,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
6958
6941
  (function() {
6959
6942
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
6960
6943
  this.InfoparkHandlebarsTemplates["prompt_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
6961
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6944
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
6962
6945
  helpers = helpers || Handlebars.helpers; data = data || {};
6963
6946
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
6964
6947
 
@@ -7008,7 +6991,7 @@ function program1(depth0,data) {
7008
6991
  (function() {
7009
6992
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7010
6993
  this.InfoparkHandlebarsTemplates["saving_indicator"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7011
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
6994
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7012
6995
  helpers = helpers || Handlebars.helpers; data = data || {};
7013
6996
  var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
7014
6997
 
@@ -7016,7 +6999,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
7016
6999
  buffer += "<span class=\"ip_saving_indicator ip_saving_state_bar\">\n <span class=\"ip_saving_in_progress\" style=\"display:none;\">\n <i class=\"ip_icon ip_spinning\">&#xf023;</i>\n <span class=\"ip_button_label\"><span>";
7017
7000
  options = {hash:{},data:data};
7018
7001
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "saving_indicator_item.saving", options) : helperMissing.call(depth0, "translate", "saving_indicator_item.saving", options)))
7019
- + "</span></span>\n </span>\n\n <span class=\"ip_saving_done\">\n <i class=\"ip_icon\">&#xf03F;</i>\n <span class=\"ip_button_label\"><span>";
7002
+ + "</span></span>\n </span>\n\n <span class=\"ip_saving_done\" style=\"display:none;\">\n <i class=\"ip_icon\">&#xf03F;</i>\n <span class=\"ip_button_label\"><span>";
7020
7003
  options = {hash:{},data:data};
7021
7004
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "saving_indicator_item.saved", options) : helperMissing.call(depth0, "translate", "saving_indicator_item.saved", options)))
7022
7005
  + "</span></span>\n </span>\n</div>\n";
@@ -7027,7 +7010,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
7027
7010
  (function() {
7028
7011
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7029
7012
  this.InfoparkHandlebarsTemplates["saving_overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7030
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
7013
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7031
7014
  helpers = helpers || Handlebars.helpers; data = data || {};
7032
7015
 
7033
7016
 
@@ -7039,7 +7022,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
7039
7022
  (function() {
7040
7023
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7041
7024
  this.InfoparkHandlebarsTemplates["title"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7042
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
7025
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7043
7026
  helpers = helpers || Handlebars.helpers; data = data || {};
7044
7027
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
7045
7028
 
@@ -7056,7 +7039,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
7056
7039
  (function() {
7057
7040
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7058
7041
  this.InfoparkHandlebarsTemplates["workspace_form_select_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7059
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
7042
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7060
7043
  helpers = helpers || Handlebars.helpers; data = data || {};
7061
7044
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
7062
7045
 
@@ -7101,7 +7084,7 @@ function program4(depth0,data) {
7101
7084
  (function() {
7102
7085
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7103
7086
  this.InfoparkHandlebarsTemplates["workspace_select_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7104
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
7087
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7105
7088
  helpers = helpers || Handlebars.helpers; data = data || {};
7106
7089
  var buffer = "", stack1, self=this, functionType="function", escapeExpression=this.escapeExpression;
7107
7090
 
@@ -7158,7 +7141,7 @@ function program8(depth0,data) {
7158
7141
  (function() {
7159
7142
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
7160
7143
  this.InfoparkHandlebarsTemplates["workspace_select_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
7161
- this.compilerInfo = [3,'>= 1.0.0-rc.4'];
7144
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
7162
7145
  helpers = helpers || Handlebars.helpers; data = data || {};
7163
7146
  var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this;
7164
7147
 
@@ -7177,6 +7160,12 @@ function program1(depth0,data) {
7177
7160
  + " \">&#61519;</i>\n ";
7178
7161
  options = {hash:{},data:data};
7179
7162
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rename_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rename_working_copy", depth0.current_short_title, options)))
7163
+ + "\n </span>\n </li>\n <li class=\"ip_menu_item\">\n <span id='ip-rebase-current-ws'>\n <i class=\"ip_icon\"\n title=\"";
7164
+ options = {hash:{},data:data};
7165
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options)))
7166
+ + " \">\n &#xF023;\n </i>\n ";
7167
+ options = {hash:{},data:data};
7168
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options)))
7180
7169
  + "\n </span>\n </li>\n <li class=\"ip_menu_item\">\n <span id='ip-delete-current-ws'>\n <i class=\"ip_icon\"\n title=\"";
7181
7170
  options = {hash:{},data:data};
7182
7171
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.delete_working_copy", depth0.current_short_title, options)))
@@ -7241,6 +7230,7 @@ $.i18n().load({
7241
7230
  'menu_bar.publish_working_copy': '"$1" veröffentlichen',
7242
7231
  'menu_bar.publish_ws_confirmation': '"$1" veröffentlichen?',
7243
7232
  'menu_bar.publish_ws_confirmation_desc': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.',
7233
+ 'menu_bar.rebase_working_copy': '"$1" aktualisieren',
7244
7234
  'menu_bar.rename_working_copy': '"$1" umbenennen',
7245
7235
  'menu_bar.rename_working_copy_desc': 'Bitte geben Sie den neuen Titel der Arbeitskopie ein.',
7246
7236
  'menu_bar.rename': 'Umbenennen',
@@ -7248,6 +7238,8 @@ $.i18n().load({
7248
7238
  'menu_bar.delete_ws_confirmation': 'Wirklich "$1" löschen?',
7249
7239
  'menu_bar.delete_ws_confirmation_desc': 'Eine gelöschte Arbeitskopie kann nicht wiederhergestellt werden.',
7250
7240
  'menu_bar.delete': 'Löschen',
7241
+ 'menu_bar.move': 'Verschieben',
7242
+ 'menu_bar.copy': 'Kopieren',
7251
7243
  'menu_bar.create': 'Anlegen',
7252
7244
  'menu_bar.publish': 'Veröffentlichen',
7253
7245
  'menu_bar.create_new_working_copy': 'Arbeitskopie anlegen',
@@ -7257,13 +7249,17 @@ $.i18n().load({
7257
7249
 
7258
7250
  'menu_bar_dropdown.edit_current_page': 'Diese Seite bearbeiten',
7259
7251
  'menu_bar_dropdown.delete_current_page': 'Diese Seite löschen',
7252
+ 'menu_bar_dropdown.save_current_page_to_clipboard': 'Diese Seite im Clipboard ablegen',
7253
+ 'menu_bar_dropdown.duplicate_current_page': 'Diese Seite duplizieren',
7260
7254
  'menu_bar_dropdown.open_current_page_in_admin_gui': 'Im Admin-GUI öffnen',
7261
7255
  'menu_bar_dropdown.deactivate_editing': 'Direktbearbeitung deaktivieren',
7262
7256
 
7263
7257
  'saving_indicator_item.saving': 'Wird gespeichert...',
7264
- 'saving_indicator_item.saved': 'Alle Änderungen gespeichert',
7258
+ 'saving_indicator_item.saved': 'Änderungen gespeichert',
7265
7259
 
7266
7260
  'child_list_menus.add_subpage': 'Neue Seite anlegen',
7261
+ 'child_list_menus.move_here': 'Seite im Clipboard hierher verschieben',
7262
+ 'child_list_menus.copy_here': 'Seite im Clipboard hier einfügen',
7267
7263
 
7268
7264
  'widget_menus.add_widget': 'Widget einfügen',
7269
7265
  'widget_menus.edit_widget': 'Widget bearbeiten',
@@ -7272,8 +7268,18 @@ $.i18n().load({
7272
7268
 
7273
7269
  'commands.delete_obj.confirm_title': 'Wirklich diese Seite löschen?',
7274
7270
  'commands.delete_obj.confirm_description': 'Eine gelöschte Seite kann nicht wiederhergestellt werden.',
7271
+ 'commands.move_obj_into.confirm_title': 'Seite im Clipboard hierher verschieben?',
7272
+ 'commands.move_obj_into.confirm_description': 'Die im Clipboard abgelegte Seite wird hierher verschoben.',
7273
+ 'commands.copy_obj_into.confirm_title': 'Seite im Clipboard hierher kopieren?',
7274
+ 'commands.copy_obj_into.confirm_description': 'Eine Kopie der Seite im Clipboard wird hier eingefügt.',
7275
+ 'commands.paste.not_allowed': 'Aufgrund ihres Typs kann die Seite hier nicht eingefügt werden.\n\nNur Seiten der folgenden Typen können hierher verschoben oder kopiert werden:\n\n$2',
7276
+ 'commands.save_obj.has_children': 'Seiten mit Unterseiten können noch nicht verschoben oder kopiert werden.',
7275
7277
  'commands.delete_widget.confirm_title': 'Wirklich dieses Widget löschen?',
7276
7278
  'commands.delete_widget.confirm_description': 'Ein gelöschtes Widget kann nicht wiederhergestellt werden.',
7279
+ 'commands.duplicate_obj.button_text': 'Duplizieren',
7280
+ 'commands.duplicate_obj.confirm_title': 'Diese Seite duplizieren?',
7281
+ 'commands.duplicate_obj.confirm_description': 'Diese Seite wird sofort dupliziert.',
7282
+ 'commands.duplicate_obj.has_children': 'Seiten mit Unterseiten können noch nicht dupliziert werden.',
7277
7283
 
7278
7284
  'image_upload.too_many_files': 'Nur eine Detei erlaubt.',
7279
7285
 
@@ -7287,7 +7293,7 @@ $.i18n().load({
7287
7293
  'welcome_x': 'Welcome $1',
7288
7294
  'accept': 'Accept',
7289
7295
  'close': 'Close',
7290
- 'load': 'Loading...',
7296
+ 'loading': 'Loading...',
7291
7297
  'current_page': 'current page',
7292
7298
 
7293
7299
  'choose_obj_class_dialog.add_child_page.title': 'Select Page Type',
@@ -7309,6 +7315,7 @@ $.i18n().load({
7309
7315
  'menu_bar.publish_working_copy': 'Publish "$1"',
7310
7316
  'menu_bar.publish_ws_confirmation': 'Publish "$1"?',
7311
7317
  'menu_bar.publish_ws_confirmation_desc': 'Publishing a working copy is final. This action cannot be undone.',
7318
+ 'menu_bar.rebase_working_copy': 'Update "$1"',
7312
7319
  'menu_bar.rename_working_copy': 'Rename "$1"',
7313
7320
  'menu_bar.rename_working_copy_desc': 'Please enter the new title of the working copy.',
7314
7321
  'menu_bar.rename': 'Rename',
@@ -7317,6 +7324,8 @@ $.i18n().load({
7317
7324
  'menu_bar.delete_ws_confirmation_desc': 'A deleted working copy cannot be restored.',
7318
7325
  'menu_bar.delete': 'Delete',
7319
7326
  'menu_bar.create': 'Create',
7327
+ 'menu_bar.move': 'Move',
7328
+ 'menu_bar.copy': 'Copy',
7320
7329
  'menu_bar.publish': 'Publish',
7321
7330
  'menu_bar.create_new_working_copy': 'Create working copy',
7322
7331
  'menu_bar.create_new_ws_confirmation': 'Create a working copy',
@@ -7325,13 +7334,17 @@ $.i18n().load({
7325
7334
 
7326
7335
  'menu_bar_dropdown.edit_current_page': 'Edit this page',
7327
7336
  'menu_bar_dropdown.delete_current_page': 'Delete this page',
7337
+ 'menu_bar_dropdown.save_current_page_to_clipboard': 'Place this page on the clipboard',
7338
+ 'menu_bar_dropdown.duplicate_current_page': 'Duplicate this page',
7328
7339
  'menu_bar_dropdown.open_current_page_in_admin_gui': 'Open in admin GUI',
7329
7340
  'menu_bar_dropdown.deactivate_editing': 'Deactivate in-place editing',
7330
7341
 
7331
7342
  'saving_indicator_item.saving': 'Saving...',
7332
- 'saving_indicator_item.saved': 'All changes saved',
7343
+ 'saving_indicator_item.saved': 'Changes saved',
7333
7344
 
7334
7345
  'child_list_menus.add_subpage': 'Create new page',
7346
+ 'child_list_menus.move_here': 'Move page on clipboard here',
7347
+ 'child_list_menus.copy_here': 'Copy page on clipboard here',
7335
7348
 
7336
7349
  'widget_menus.add_widget': 'Insert widget',
7337
7350
  'widget_menus.edit_widget': 'Edit widget',
@@ -7340,12 +7353,25 @@ $.i18n().load({
7340
7353
 
7341
7354
  'commands.delete_obj.confirm_title': 'Really delete this page?',
7342
7355
  'commands.delete_obj.confirm_description': 'A deleted page cannot be restored.',
7356
+ 'commands.move_obj_into.confirm_title': 'Move page on clipboard here?',
7357
+ 'commands.move_obj_into.confirm_description': 'The page that has been placed on the clipboard will be moved here.',
7358
+ 'commands.copy_obj_into.confirm_title': 'Copy page on clipboard here?',
7359
+ 'commands.copy_obj_into.confirm_description': 'A copy of the page on the clipboard will be inserted here.',
7360
+ 'commands.save_obj.has_children': 'Pages with subpages cannot be copied or moved yet.',
7361
+ 'commands.paste.not_allowed': 'Due to its type, the page cannot be moved or copied here.\n\nOnly pages of the following types can be inserted here:\n\n$2',
7343
7362
  'commands.delete_widget.confirm_title': 'Really delete this widget?',
7344
7363
  'commands.delete_widget.confirm_description': 'A deleted widget cannot be restored.',
7364
+ 'commands.duplicate_obj.button_text': 'Duplicate',
7365
+ 'commands.duplicate_obj.confirm_title': 'Duplicate the current page?',
7366
+ 'commands.duplicate_obj.confirm_description': 'The current page will be duplicated immediately.',
7367
+ 'commands.duplicate_obj.has_children': 'Pages with subpages cannot be duplicated yet.',
7345
7368
 
7346
7369
  'image_upload.too_many_files': 'Only one file allowed.',
7347
7370
 
7348
- 'warn_before_unloading': 'You have unsaved changes. Are you sure you want to quit?'
7371
+ 'warn_before_unloading': 'You have unsaved changes. Are you sure you want to quit?',
7372
+
7373
+ 'test.two_arguments': '$1, $2',
7374
+ 'test.four_arguments': '$1, $2, $3, $4'
7349
7375
  }, 'en');
7350
7376
  /*global alert:false */
7351
7377
 
@@ -7462,7 +7488,7 @@ var infopark = {
7462
7488
  }
7463
7489
  });
7464
7490
  } else if (event === 'new_content') {
7465
- infopark.editing.on('refresh', function(dom_element) {
7491
+ infopark.editing.on('new_content', function(dom_element) {
7466
7492
  if (dom_element) {
7467
7493
  callback(dom_element);
7468
7494
  }
@@ -7484,6 +7510,20 @@ var infopark = {
7484
7510
  } else {
7485
7511
  $.error("Can't delete without ID");
7486
7512
  }
7513
+ },
7514
+
7515
+ never_resolve: function() {
7516
+ return $.Deferred();
7517
+ },
7518
+
7519
+ trigger: function(event_name, dom_element) {
7520
+ if (event_name === 'new_content') {
7521
+ _.each($(dom_element), function(e) {
7522
+ infopark.editing.new_content(e);
7523
+ });
7524
+ } else {
7525
+ $.error('Unknown event "' + event_name + '"');
7526
+ }
7487
7527
  }
7488
7528
  };
7489
7529
  (function() {
@@ -7504,9 +7544,12 @@ var infopark = {
7504
7544
  }
7505
7545
  },
7506
7546
 
7507
- translate: function(key, param1) {
7547
+ // In addition to the key you can pass multiple parameters that will be interpolated into
7548
+ // the translated string.
7549
+ translate: function(key) {
7508
7550
  $.i18n().locale = infopark.i18n.locale();
7509
- return $.i18n(key, param1);
7551
+
7552
+ return $.i18n.apply(0, arguments);
7510
7553
  }
7511
7554
  }
7512
7555
  });
@@ -7533,7 +7576,7 @@ var infopark = {
7533
7576
 
7534
7577
  var save_content = function(dom_element, content) {
7535
7578
  if (assert_valid_dom_element(dom_element)) {
7536
- if (content === undefined || content === null) {
7579
+ if (content === undefined) {
7537
7580
  $.error('Can not call "save" with no content');
7538
7581
  } else {
7539
7582
  var cms_field_element = build_cms_field_element(dom_element);
@@ -7599,12 +7642,10 @@ var infopark = {
7599
7642
  infopark.reload();
7600
7643
  },
7601
7644
 
7602
- refresh: function(dom_element) {
7603
- _.each($(event_handlers.refresh), function(handler) {
7645
+ new_content: function(dom_element) {
7646
+ _.each($(event_handlers.new_content), function(handler) {
7604
7647
  if (dom_element) {
7605
7648
  handler(dom_element);
7606
- } else if (handler.length === 0) {
7607
- handler();
7608
7649
  }
7609
7650
  });
7610
7651
  },
@@ -7649,7 +7690,7 @@ var infopark = {
7649
7690
  });
7650
7691
  });
7651
7692
  default:
7652
- throw { message: "Invalid task (wrong status)", task: task };
7693
+ throw { message: "Invalid task (unknown status)", task: task };
7653
7694
  }
7654
7695
  };
7655
7696
 
@@ -7659,7 +7700,10 @@ var infopark = {
7659
7700
  options.data = JSON.stringify(options.data);
7660
7701
  }
7661
7702
  return $.ajax(base_url + path, $.extend(options || {}, {
7662
- type: type, dataType: 'json', contentType: 'application/json; charset=utf-8'
7703
+ type: type,
7704
+ dataType: 'json',
7705
+ contentType: 'application/json; charset=utf-8',
7706
+ cache: false // Don't cache GET requests.
7663
7707
  })).then(
7664
7708
  function(result, text_status, xhr) {
7665
7709
  return $.Deferred().resolve(result);
@@ -7674,9 +7718,7 @@ var infopark = {
7674
7718
  }
7675
7719
  return $.Deferred().reject(error_message);
7676
7720
  }
7677
- ).fail(function(error_message) {
7678
- infopark.alert(error_message);
7679
- });
7721
+ );
7680
7722
  };
7681
7723
 
7682
7724
  $.extend(infopark, {
@@ -7694,13 +7736,15 @@ var infopark = {
7694
7736
  }
7695
7737
  });
7696
7738
 
7739
+ var promise = ajax_promise.fail(function(error_message) {
7740
+ infopark.alert(error_message);
7741
+ });
7697
7742
  if (is_write_request) {
7698
- return ajax_promise.always(function() {
7743
+ promise = promise.always(function() {
7699
7744
  infopark.write_monitor.end_write();
7700
7745
  });
7701
- } else {
7702
- return ajax_promise;
7703
7746
  }
7747
+ return promise;
7704
7748
  }
7705
7749
  });
7706
7750
  }());
@@ -7828,9 +7872,10 @@ var infopark = {
7828
7872
  infopark.menu_bar.register_item_renderer(function(menu_bar) {
7829
7873
  var view = infopark.template.render('menu_bar_dropdown', {
7830
7874
  has_current_page: infopark.obj.current_page_id,
7831
- current_page_has_edit_view: infopark.obj.current_page_has_edit_view
7875
+ current_page_has_edit_view: infopark.obj.current_page_has_edit_view,
7876
+ disable_with_children: disable_with_children
7832
7877
  });
7833
- menu_bar.find('#ip_menu_bar_dropdown').append(view);
7878
+ menu_bar.find('#ip_menu_bar_dropdown').html(view);
7834
7879
  });
7835
7880
  }
7836
7881
  }
@@ -7857,6 +7902,14 @@ var infopark = {
7857
7902
  infopark.commands.delete_obj(infopark.obj.current_page());
7858
7903
  });
7859
7904
 
7905
+ on_click('ip_save_current_page_to_clipboard', function() {
7906
+ infopark.commands.save_obj_to_clipboard(infopark.obj.current_page());
7907
+ });
7908
+
7909
+ on_click('ip_duplicate_current_page', function() {
7910
+ infopark.commands.duplicate_obj(infopark.obj.current_page());
7911
+ });
7912
+
7860
7913
  on_click('ip_open_current_page_in_admin_gui', function() {
7861
7914
  infopark.commands.open_in_admin_gui(infopark.obj.current_page_id);
7862
7915
  });
@@ -7864,6 +7917,14 @@ var infopark = {
7864
7917
  on_click('ip_deactivate_editing', function() {
7865
7918
  infopark.editing.deactivate();
7866
7919
  });
7920
+
7921
+ var disable_with_children = function() {
7922
+ if (infopark.obj.current_page_has_children) {
7923
+ return 'ip_menu_item disabled';
7924
+ } else {
7925
+ return 'ip_menu_item';
7926
+ }
7927
+ };
7867
7928
  }());
7868
7929
  (function() {
7869
7930
  var t = infopark.i18n.translate;
@@ -7988,12 +8049,21 @@ var infopark = {
7988
8049
  }).done(function(new_title) {
7989
8050
  infopark.with_saving_overlay(
7990
8051
  infopark.editing.workspace().rename(new_title).then(function() {
7991
- return infopark.redirect_to('?_rc-ws=' + infopark.editing.workspace().id());
8052
+ return infopark.reload();
7992
8053
  })
7993
8054
  );
7994
8055
  });
7995
8056
  });
7996
8057
 
8058
+ $(document).on("click.ip-rebase-ws", "#ip-rebase-current-ws", function(e) {
8059
+ default_click_action(e);
8060
+ infopark.with_saving_overlay(
8061
+ infopark.editing.workspace().rebase().then(function() {
8062
+ return infopark.reload();
8063
+ })
8064
+ );
8065
+ });
8066
+
7997
8067
  $(document).on("click.ip-delete-ws", "#ip-delete-current-ws", function(e) {
7998
8068
  default_click_action(e);
7999
8069
  infopark.confirmation_dialog({
@@ -8063,12 +8133,17 @@ var infopark = {
8063
8133
  $.extend(infopark, {
8064
8134
  child_list_element: {
8065
8135
  create_instance: function(cms_element) {
8066
- if (cms_element.dom_element().attr('data-ip-child-list-path')) {
8136
+ if (cms_element.dom_element().attr('data-ip-private-child-list-path')) {
8067
8137
  var that = cms_element;
8068
8138
 
8139
+ var generate_path = function(){
8140
+ var name = infopark.random_hex();
8141
+ return that.path() + '/' + name;
8142
+ };
8143
+
8069
8144
  $.extend(that, {
8070
8145
  path: function() {
8071
- return that.dom_element().attr('data-ip-child-list-path');
8146
+ return that.dom_element().attr('data-ip-private-child-list-path');
8072
8147
  },
8073
8148
 
8074
8149
  fetch_page_class_selection: function() {
@@ -8076,14 +8151,26 @@ var infopark = {
8076
8151
  $.param({parent_path: that.path()}));
8077
8152
  },
8078
8153
 
8154
+ allowed_classes: function() {
8155
+ return JSON.parse(
8156
+ that.dom_element().attr('data-ip-private-child-list-allowed-classes'));
8157
+ },
8158
+
8079
8159
  create_child: function(obj_class) {
8080
- var name = infopark.random_hex();
8081
- var path = that.path() + "/" + name;
8160
+ var path = generate_path();
8082
8161
 
8083
8162
  return infopark.obj.create({
8084
8163
  _path: path,
8085
8164
  _obj_class: obj_class
8086
8165
  });
8166
+ },
8167
+
8168
+ add_child: function(child) {
8169
+ var path = generate_path();
8170
+
8171
+ return child.save({
8172
+ _path: path
8173
+ });
8087
8174
  }
8088
8175
  });
8089
8176
 
@@ -8091,7 +8178,7 @@ var infopark = {
8091
8178
  }
8092
8179
  },
8093
8180
  all: function() {
8094
- return _.map($('[data-ip-child-list-path]'), function(dom_element) {
8181
+ return _.map($('[data-ip-private-child-list-path]'), function(dom_element) {
8095
8182
  return infopark.cms_element.from_dom_element($(dom_element));
8096
8183
  });
8097
8184
  }
@@ -8162,13 +8249,13 @@ $(function() {
8162
8249
  },
8163
8250
  obj: function() {
8164
8251
  return infopark.obj.create_instance(
8165
- that.dom_element().attr('data-ip-field-id'),
8252
+ that.dom_element().attr('data-ip-private-field-id'),
8166
8253
  that.dom_element().attr('data-ip-field-obj-class')
8167
8254
  );
8168
8255
  },
8169
8256
 
8170
8257
  save: function(content) {
8171
- if (content === undefined || content === null) {
8258
+ if (content === undefined) {
8172
8259
  if (that.content) {
8173
8260
  content = that.content();
8174
8261
  } else {
@@ -8183,7 +8270,7 @@ $(function() {
8183
8270
 
8184
8271
  original_content: function() {
8185
8272
  if (has_original_content(that.field_type())) {
8186
- return JSON.parse(that.dom_element().attr('data-ip-field-original-content'));
8273
+ return JSON.parse(that.dom_element().attr('data-ip-private-field-original-content'));
8187
8274
  } else {
8188
8275
  $.error('Fields of type ' + that.field_type() + ' do not support original content');
8189
8276
  }
@@ -8191,7 +8278,7 @@ $(function() {
8191
8278
 
8192
8279
  set_original_content: function(content) {
8193
8280
  if (has_original_content(that.field_type())) {
8194
- that.dom_element().attr('data-ip-field-original-content', JSON.stringify(content));
8281
+ that.dom_element().attr('data-ip-private-field-original-content', JSON.stringify(content));
8195
8282
  }
8196
8283
  }
8197
8284
 
@@ -8310,6 +8397,21 @@ $(function() {
8310
8397
  return infopark.ajax('GET', 'objs/' + that.id() + '/edit').then(function(data) {
8311
8398
  return data.markup;
8312
8399
  });
8400
+ },
8401
+
8402
+ copy_to: function(path) {
8403
+ var post_attr = {data: {parent_path: path}};
8404
+ var url = 'objs/'+that.id()+'/copy';
8405
+
8406
+ return infopark.ajax('POST', url, post_attr).then(function(new_data) {
8407
+ return infopark.obj.create_instance(new_data.id, new_data._obj_class);
8408
+ });
8409
+ },
8410
+
8411
+ duplicate: function() {
8412
+ return infopark.ajax('POST', 'objs/'+that.id()+'/duplicate').then(function(new_data) {
8413
+ return infopark.obj.create_instance(new_data.id, new_data._obj_class);
8414
+ });
8313
8415
  }
8314
8416
  };
8315
8417
 
@@ -8325,19 +8427,22 @@ $(function() {
8325
8427
  },
8326
8428
 
8327
8429
  current_page_id: null,
8430
+ current_page_obj_class_name: null,
8328
8431
 
8329
8432
  current_page: function() {
8330
8433
  if (infopark.obj.current_page_id) {
8331
- return infopark.obj.create_instance(infopark.obj.current_page_id);
8434
+ return infopark.obj.create_instance(infopark.obj.current_page_id, infopark.obj.current_page_obj_class_name);
8332
8435
  }
8333
8436
  },
8334
8437
 
8335
- current_page_has_edit_view: false
8438
+ current_page_has_edit_view: false,
8439
+ current_page_has_children: false
8336
8440
  }
8337
8441
  });
8338
8442
  }());
8339
8443
  (function() {
8340
8444
  var field_types = [
8445
+ 'binary',
8341
8446
  'enum',
8342
8447
  'linklist',
8343
8448
  'multienum',
@@ -8388,14 +8493,14 @@ $(function() {
8388
8493
  $.extend(infopark, {
8389
8494
  widget_element: {
8390
8495
  create_instance: function(cms_element) {
8391
- if (cms_element.dom_element().attr('data-ip-widget-id')) {
8496
+ if (cms_element.dom_element().attr('data-ip-private-widget-id')) {
8392
8497
  var that = cms_element;
8393
8498
 
8394
8499
  $.extend(that, {
8395
8500
  obj: function() {
8396
8501
  return infopark.obj.create_instance(
8397
- that.dom_element().attr('data-ip-widget-id'),
8398
- that.dom_element().attr('data-ip-widget-obj-class')
8502
+ that.dom_element().attr('data-ip-private-widget-id'),
8503
+ that.dom_element().attr('data-ip-private-widget-obj-class')
8399
8504
  );
8400
8505
  },
8401
8506
  widget_field: function() {
@@ -8403,7 +8508,7 @@ $(function() {
8403
8508
  },
8404
8509
 
8405
8510
  has_edit_view: function() {
8406
- return that.dom_element().attr('data-ip-widget-has-edit-view') ? true : false;
8511
+ return that.dom_element().attr('data-ip-private-widget-has-edit-view') ? true : false;
8407
8512
  },
8408
8513
 
8409
8514
  fetch_edit_markup: function() {
@@ -8452,7 +8557,7 @@ $(function() {
8452
8557
  },
8453
8558
 
8454
8559
  widgets: function() {
8455
- var widgets_dom = that.dom_element().children('[data-ip-widget-id]');
8560
+ var widgets_dom = that.dom_element().children('[data-ip-private-widget-id]');
8456
8561
  var widgets = _.map(widgets_dom, function(widget_dom) {
8457
8562
  return infopark.cms_element.from_dom_element($(widget_dom));
8458
8563
  });
@@ -8511,6 +8616,13 @@ $(function() {
8511
8616
  throw "publish not allowed for already published contents";
8512
8617
  }
8513
8618
  },
8619
+ rebase: function() {
8620
+ if (that.is_editable()) {
8621
+ return infopark.ajax('PUT', 'workspaces/' + that.id() + '/rebase');
8622
+ } else {
8623
+ throw "rebase not allowed for already published contents";
8624
+ }
8625
+ },
8514
8626
  rename: function(new_title) {
8515
8627
  return infopark.ajax('PUT', 'workspaces/' + that.id(),
8516
8628
  {data: {workspace: {title: new_title}}});
@@ -8549,6 +8661,41 @@ $(function() {
8549
8661
  }
8550
8662
  });
8551
8663
  }());
8664
+ (function() {
8665
+ infopark.storage = {
8666
+ set: function(key, object) {
8667
+ localStorage.setItem(full_key(key), JSON.stringify(object));
8668
+ },
8669
+
8670
+ get: function(key) {
8671
+ return JSON.parse(localStorage.getItem(full_key(key)));
8672
+ },
8673
+
8674
+ has_key: function(key) {
8675
+ return !!infopark.storage.get(key);
8676
+ },
8677
+
8678
+ remove: function(key) {
8679
+ localStorage.removeItem(full_key(key));
8680
+ },
8681
+
8682
+ clear: function() {
8683
+ for (var i=0; i < localStorage.length; i++) {
8684
+ var key = localStorage.key(i);
8685
+
8686
+ if (key.indexOf(storage_key_prefix) === 0) {
8687
+ localStorage.removeItem(key);
8688
+ }
8689
+ }
8690
+ }
8691
+ };
8692
+
8693
+ var storage_key_prefix = '_infopark_';
8694
+
8695
+ var full_key = function(key_suffix) {
8696
+ return storage_key_prefix + key_suffix;
8697
+ };
8698
+ })();
8552
8699
  (function() {
8553
8700
  $.extend(infopark, {
8554
8701
  /*
@@ -8713,7 +8860,9 @@ $(function() {
8713
8860
  $.extend(infopark, {
8714
8861
  with_overlay: function(promise) {
8715
8862
  infopark.overlay.show();
8716
- return promise.always(infopark.overlay.hide);
8863
+ return promise.always(function() {
8864
+ infopark.overlay.hide();
8865
+ });
8717
8866
  },
8718
8867
 
8719
8868
  overlay: {
@@ -8737,6 +8886,12 @@ $(function() {
8737
8886
  view = null;
8738
8887
  });
8739
8888
  }
8889
+ },
8890
+
8891
+ // Test purpose only.
8892
+ remove_all: function() {
8893
+ $('.ip_overlay').remove();
8894
+ view = null;
8740
8895
  }
8741
8896
  }
8742
8897
  });
@@ -8747,7 +8902,9 @@ $(function() {
8747
8902
  $.extend(infopark, {
8748
8903
  with_saving_overlay: function(promise) {
8749
8904
  infopark.saving_overlay.show();
8750
- return promise.always(infopark.saving_overlay.hide);
8905
+ return promise.always(function() {
8906
+ infopark.saving_overlay.hide();
8907
+ });
8751
8908
  },
8752
8909
 
8753
8910
  saving_overlay: {
@@ -8773,6 +8930,12 @@ $(function() {
8773
8930
  view = null;
8774
8931
  });
8775
8932
  }
8933
+ },
8934
+
8935
+ // Test purpose only.
8936
+ remove_all: function() {
8937
+ $('.ip_saving_overlay').remove();
8938
+ view = null;
8776
8939
  }
8777
8940
  }
8778
8941
  });
@@ -8797,7 +8960,15 @@ $(function() {
8797
8960
  var end_write_token = infopark.write_monitor.on('end_write', function() {
8798
8961
  if (!infopark.write_monitor.is_writing()) {
8799
8962
  parent_view.find(saving_in_progress_selector).hide();
8800
- parent_view.find(saving_done_selector).show();
8963
+
8964
+ var saving_done_element = parent_view.find(saving_done_selector);
8965
+ saving_done_element.show();
8966
+
8967
+ if (!infopark.transition.immediate_mode) {
8968
+ setTimeout(function() {
8969
+ saving_done_element.fadeOut(1000);
8970
+ }, 3000);
8971
+ }
8801
8972
  }
8802
8973
  });
8803
8974
 
@@ -9001,6 +9172,17 @@ $(function() {
9001
9172
  });
9002
9173
  });
9003
9174
  }());
9175
+ (function() {
9176
+ $.extend(infopark, {
9177
+ reloading: {
9178
+ init: function() {
9179
+ $('body').on('infopark_reload', function() {
9180
+ infopark.with_saving_overlay(infopark.reload());
9181
+ });
9182
+ }
9183
+ }
9184
+ });
9185
+ }());
9004
9186
  (function() {
9005
9187
  $.extend(infopark, {
9006
9188
  choose_obj_class_dialog: function(obj_classes_deferred, locale_path) {
@@ -9028,7 +9210,7 @@ $(function() {
9028
9210
  view.on('click', '.ip_obj_class_thumbnail', function(e) {
9029
9211
  e.preventDefault();
9030
9212
  infopark.dialog.close(view);
9031
- deferred.resolve($(this).attr('data-ip-obj-class-name'));
9213
+ deferred.resolve($(this).attr('data-ip-private-obj-class-name'));
9032
9214
  });
9033
9215
  });
9034
9216
 
@@ -9055,34 +9237,63 @@ $(function() {
9055
9237
  (function() {
9056
9238
  $.extend(infopark, {
9057
9239
  edit_dialog: {
9058
- open: function(title, markup, icon) {
9240
+ open: function(title, fetch_markup, icon) {
9059
9241
  var deferred = $.Deferred();
9060
9242
 
9061
9243
  var view = $(infopark.template.render('edit_dialog',
9062
- {icon: icon || '&#xF030;', title: title, markup: markup}));
9244
+ {icon: icon || '&#xF030;', title: title}));
9063
9245
 
9064
9246
  $('#ip-editing').append(view);
9065
9247
 
9066
9248
  var saving_indicator = infopark.saving_indicator.create(
9067
9249
  view.find('.ip_edit_dialog_saving_indicator'));
9068
9250
 
9069
- var cancel_action = function(e) {
9070
- e.preventDefault();
9071
- saving_indicator.destroy();
9251
+ var load_markup = function() {
9252
+ var target = view.find('.ip_edit_dialog_markup');
9253
+ var spinner = view.find('.ip_modal_body .ip_spinning');
9254
+
9255
+ target.hide();
9256
+ spinner.show();
9257
+
9258
+ fetch_markup().then(function(markup) {
9259
+ target.html(markup);
9260
+
9261
+ spinner.hide();
9262
+ target.show();
9263
+
9264
+ infopark.editing.new_content(target.get(0));
9265
+ }, function() {
9266
+ close();
9267
+ });
9268
+ };
9269
+
9270
+ view.on('infopark_reload', function() {
9271
+ load_markup();
9272
+ return false;
9273
+ });
9274
+
9275
+ load_markup();
9276
+
9277
+ var close = function() {
9072
9278
  infopark.dialog.close(view);
9073
9279
  deferred.resolve();
9074
9280
  };
9075
9281
 
9076
- view.find('.ip_cancel').on('click', cancel_action);
9282
+ var cancel = function(e) {
9283
+ e.preventDefault();
9284
+ saving_indicator.destroy();
9285
+ close();
9286
+ };
9287
+
9288
+ view.find('.ip_cancel').on('click', cancel);
9077
9289
 
9078
9290
  infopark.transition(view, function() {
9079
9291
  view.addClass('ip_show');
9080
9292
  }).then(function() {
9081
9293
  infopark.dialog.adjust(view);
9082
- infopark.editing.refresh(view.find('.ip_edit_dialog_markup').get(0));
9083
9294
  });
9084
9295
 
9085
- return infopark.with_dialog_behaviour(deferred, {escape: cancel_action});
9296
+ return infopark.with_dialog_behaviour(deferred, {escape: cancel});
9086
9297
  }
9087
9298
  }
9088
9299
  });
@@ -9109,15 +9320,22 @@ $(function() {
9109
9320
  },
9110
9321
  init: function() {
9111
9322
  infopark.editing.on('activate', function() {
9112
- create_or_refresh_menus();
9323
+ infopark.inplace_menus.refresh();
9113
9324
  });
9114
9325
 
9115
- infopark.editing.on('refresh', function() {
9116
- create_or_refresh_menus();
9326
+ infopark.editing.on('new_content', function() {
9327
+ infopark.inplace_menus.refresh();
9117
9328
  });
9118
9329
  },
9119
9330
  close_all_menus: function() {
9120
9331
  remove_menus();
9332
+ },
9333
+
9334
+ refresh: function() {
9335
+ remove_markers_and_menus();
9336
+ collect_menu_items();
9337
+ render_menu_items();
9338
+ infopark.inplace_menus.refresh_positions();
9121
9339
  }
9122
9340
  }
9123
9341
  });
@@ -9165,7 +9383,8 @@ $(function() {
9165
9383
  var items = _.map(dom_menu, function(menu_item) {
9166
9384
  return {
9167
9385
  icon: menu_item.icon,
9168
- text: menu_item.title
9386
+ text: menu_item.title,
9387
+ css_class: menu_item.disabled ? 'ip_menu_item disabled' : 'ip_menu_item'
9169
9388
  };
9170
9389
  });
9171
9390
 
@@ -9212,13 +9431,6 @@ $(function() {
9212
9431
  });
9213
9432
  dom_elements_with_menu = [];
9214
9433
  };
9215
-
9216
- var create_or_refresh_menus = function() {
9217
- remove_markers_and_menus();
9218
- collect_menu_items();
9219
- render_menu_items();
9220
- infopark.inplace_menus.refresh_positions();
9221
- };
9222
9434
  }());
9223
9435
 
9224
9436
  $(window).on('resize', function () { infopark.inplace_menus.refresh_positions(); });
@@ -9233,7 +9445,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9233
9445
  function(obj_class) {
9234
9446
  return infopark.with_saving_overlay(
9235
9447
  child_list_element.create_child(obj_class).then(function(new_obj) {
9236
- return infopark.redirect_to(new_obj.id());
9448
+ return infopark.redirect_to('/'+new_obj.id());
9237
9449
  })
9238
9450
  );
9239
9451
  }
@@ -9241,18 +9453,20 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9241
9453
  },
9242
9454
 
9243
9455
  edit_obj: function(obj) {
9244
- return obj.fetch_edit_markup().then(function(markup) {
9245
- var has_changes = false;
9246
- var token = infopark.write_monitor.on('start_write', function() {
9247
- has_changes = true;
9248
- });
9249
- var title = infopark.i18n.translate('current_page');
9250
- return infopark.edit_dialog.open(title, markup, '&#xF03D;').then(function() {
9251
- infopark.write_monitor.off(token);
9252
- if (has_changes) {
9253
- return infopark.with_saving_overlay(infopark.reload());
9254
- }
9255
- });
9456
+ var has_changes = false;
9457
+ var token = infopark.write_monitor.on('start_write', function() {
9458
+ has_changes = true;
9459
+ });
9460
+
9461
+ var title = infopark.i18n.translate('current_page');
9462
+ var fetch_markup = function() {
9463
+ return obj.fetch_edit_markup();
9464
+ };
9465
+ return infopark.edit_dialog.open(title, fetch_markup, '&#xF03D;').then(function() {
9466
+ infopark.write_monitor.off(token);
9467
+ if (has_changes) {
9468
+ return infopark.with_saving_overlay(infopark.reload());
9469
+ }
9256
9470
  });
9257
9471
  },
9258
9472
 
@@ -9270,6 +9484,76 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9270
9484
  });
9271
9485
  },
9272
9486
 
9487
+ save_obj_to_clipboard: function(obj) {
9488
+ if (!infopark.obj.current_page_has_children) {
9489
+ infopark.clipboard.save_obj(obj);
9490
+ infopark.inplace_menus.refresh();
9491
+ } else {
9492
+ infopark.alert(infopark.i18n.translate('commands.save_obj.has_children'));
9493
+ }
9494
+ },
9495
+
9496
+ move_obj_into: function(child_list_element) {
9497
+ if (!infopark.clipboard.can_paste_into(child_list_element)) {
9498
+ paste_obj_not_allowed(child_list_element);
9499
+ } else {
9500
+ return infopark.confirmation_dialog({
9501
+ icon: '&#xF016;',
9502
+ confirm_button_color: 'ip_green',
9503
+ confirm_button_text: infopark.i18n.translate('menu_bar.move'),
9504
+ title: infopark.i18n.translate('commands.move_obj_into.confirm_title'),
9505
+ description: infopark.i18n.translate('commands.move_obj_into.confirm_description')
9506
+ }).then(function() {
9507
+ var obj = infopark.clipboard.obj();
9508
+
9509
+ return infopark.with_saving_overlay(child_list_element.add_child(obj).then(function() {
9510
+ infopark.clipboard.clear();
9511
+ return infopark.reload();
9512
+ }));
9513
+ });
9514
+ }
9515
+ },
9516
+
9517
+ duplicate_obj: function(obj) {
9518
+ if (!infopark.obj.current_page_has_children) {
9519
+ return infopark.confirmation_dialog({
9520
+ icon: '&#xF015;',
9521
+ confirm_button_color: 'ip_green',
9522
+ confirm_button_text: infopark.i18n.translate('commands.duplicate_obj.button_text'),
9523
+ title: infopark.i18n.translate('commands.duplicate_obj.confirm_title'),
9524
+ description: infopark.i18n.translate('commands.duplicate_obj.confirm_description')
9525
+ }).then(function(){
9526
+ return infopark.with_saving_overlay(obj.duplicate().then(function(dup_page) {
9527
+ return infopark.redirect_to('/'+dup_page.id());
9528
+ }));
9529
+ });
9530
+ } else {
9531
+ infopark.alert(infopark.i18n.translate('commands.duplicate_obj.has_children'));
9532
+ }
9533
+ },
9534
+
9535
+ copy_obj_into: function(child_list_element) {
9536
+ if (!infopark.clipboard.can_paste_into(child_list_element)) {
9537
+ paste_obj_not_allowed(child_list_element);
9538
+ } else {
9539
+ return infopark.confirmation_dialog({
9540
+ icon: '&#xF015;',
9541
+ confirm_button_color: 'ip_green',
9542
+ confirm_button_text: infopark.i18n.translate('menu_bar.copy'),
9543
+ title: infopark.i18n.translate('commands.copy_obj_into.confirm_title'),
9544
+ description: infopark.i18n.translate('commands.copy_obj_into.confirm_description')
9545
+ }).then(function() {
9546
+ var obj = infopark.clipboard.obj();
9547
+ var promise = obj.copy_to(child_list_element.path());
9548
+
9549
+ return infopark.with_saving_overlay(promise.then(function() {
9550
+ infopark.clipboard.clear();
9551
+ return infopark.reload();
9552
+ }));
9553
+ });
9554
+ }
9555
+ },
9556
+
9273
9557
  add_widget: function(widget_field_element, widget_element) {
9274
9558
  return infopark.choose_obj_class_dialog(
9275
9559
  widget_field_element.fetch_widget_class_selection(), 'add_widget').then(
@@ -9283,7 +9567,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9283
9567
  } else {
9284
9568
  widget_field_element.dom_element().append(dom_element);
9285
9569
  }
9286
- infopark.editing.refresh(dom_element.get(0));
9570
+ infopark.editing.new_content(dom_element.get(0));
9287
9571
  })
9288
9572
  ).then(function() {
9289
9573
  return widget_field_element.save().then(function() {
@@ -9297,23 +9581,21 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9297
9581
  edit_widget: function(widget_element) {
9298
9582
  var obj = widget_element.obj();
9299
9583
  var dom_element = widget_element.dom_element();
9300
- return widget_element.fetch_edit_markup().then(function(edit_markup) {
9301
- var has_changes = false;
9302
- var token = infopark.write_monitor.on('start_write', function() {
9303
- has_changes = true;
9304
- });
9305
- return infopark.edit_dialog.open(obj.obj_class_name(), edit_markup).then(function() {
9306
- infopark.write_monitor.off(token);
9307
- if (has_changes) {
9308
- return infopark.with_element_overlay(dom_element,
9309
- widget_element.fetch_show_markup().then(function(show_markup) {
9310
- var new_dom_element = $(show_markup);
9311
- dom_element.replaceWith(new_dom_element);
9312
- infopark.editing.refresh(new_dom_element.get(0));
9313
- })
9314
- );
9315
- }
9316
- });
9584
+
9585
+ var has_changes = false;
9586
+ var token = infopark.write_monitor.on('start_write', function() {
9587
+ has_changes = true;
9588
+ });
9589
+
9590
+ var title = obj.obj_class_name();
9591
+ var fetch_markup = function() {
9592
+ return widget_element.fetch_edit_markup();
9593
+ };
9594
+ return infopark.edit_dialog.open(title, fetch_markup).then(function() {
9595
+ infopark.write_monitor.off(token);
9596
+ if (has_changes) {
9597
+ dom_element.trigger('infopark_reload');
9598
+ }
9317
9599
  });
9318
9600
  },
9319
9601
 
@@ -9326,7 +9608,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9326
9608
  description: infopark.i18n.translate('commands.delete_widget.confirm_description')
9327
9609
  }).then(function() {
9328
9610
  widget_element.dom_element().remove();
9329
- infopark.editing.refresh();
9611
+
9330
9612
  return widget_field_element.save().then(function() {
9331
9613
  return widget_element.obj().destroy();
9332
9614
  });
@@ -9343,6 +9625,20 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9343
9625
 
9344
9626
  }
9345
9627
  });
9628
+
9629
+ var paste_obj_not_allowed = function(child_list_element) {
9630
+ var obj_class_name = infopark.clipboard.obj().obj_class_name();
9631
+ var allowed_classes = _.map(child_list_element.allowed_classes(), function(item) {
9632
+ return ' ' + item;
9633
+ });
9634
+
9635
+ var message = infopark.i18n.translate(
9636
+ 'commands.paste.not_allowed',
9637
+ obj_class_name,
9638
+ allowed_classes.join('\n'));
9639
+
9640
+ infopark.alert(message);
9641
+ };
9346
9642
  }());
9347
9643
  (function() {
9348
9644
  $.extend(infopark, {
@@ -9405,12 +9701,51 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9405
9701
  }
9406
9702
  });
9407
9703
  }());
9704
+ (function() {
9705
+ $.extend(infopark, {
9706
+ widget_reloading: {
9707
+ init: function() {
9708
+ activate_for_all_beneath($('body'));
9709
+
9710
+ infopark.on('new_content', function(dom_element) {
9711
+ var jquery_object = $(dom_element);
9712
+ if (jquery_object.attr('data-ip-private-widget-id')) {
9713
+ activate_for(jquery_object);
9714
+ }
9715
+ activate_for_all_beneath(jquery_object);
9716
+ });
9717
+ }
9718
+ }
9719
+ });
9720
+
9721
+ var activate_for_all_beneath = function(jquery_object) {
9722
+ _.each(jquery_object.find('[data-ip-private-widget-id]'), function(dom_element) {
9723
+ activate_for($(dom_element));
9724
+ });
9725
+ };
9726
+
9727
+ var activate_for = function(jquery_object) {
9728
+ jquery_object.on('infopark_reload', function() {
9729
+ var widget_element = infopark.cms_element.from_dom_element(jquery_object);
9730
+
9731
+ infopark.with_element_overlay(jquery_object,
9732
+ widget_element.fetch_show_markup().then(function(show_markup) {
9733
+ var new_jquery_object = $(show_markup);
9734
+ jquery_object.replaceWith(new_jquery_object);
9735
+ infopark.editing.new_content(new_jquery_object.get(0));
9736
+ })
9737
+ );
9738
+
9739
+ return false;
9740
+ });
9741
+ };
9742
+ }());
9408
9743
  (function() {
9409
9744
  $.extend(infopark, {
9410
9745
  widget_sorting: {
9411
9746
  init: function() {
9412
9747
  infopark.editing.on('activate', create);
9413
- infopark.editing.on('refresh', create);
9748
+ infopark.editing.on('new_content', create);
9414
9749
  },
9415
9750
 
9416
9751
  // Called when actual dragging started.
@@ -9428,7 +9763,6 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9428
9763
 
9429
9764
  // Called when dragging stopped and there has been a position change.
9430
9765
  update: function(event, ui) {
9431
- infopark.editing.refresh();
9432
9766
  var widget_field_element = infopark.cms_element.from_dom_element(ui.item).widget_field();
9433
9767
  widget_field_element.save();
9434
9768
  }
@@ -9441,7 +9775,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9441
9775
  var dom_element = widget_field_element.dom_element();
9442
9776
  if (!dom_element.data('ui-sortable')) {
9443
9777
  dom_element.sortable({
9444
- items: '> [data-ip-widget-id]',
9778
+ items: '> [data-ip-private-widget-id]',
9445
9779
  handle: '> .ip_editing_marker',
9446
9780
  activate: infopark.widget_sorting.activate,
9447
9781
  deactivate: infopark.widget_sorting.deactivate,
@@ -9464,6 +9798,20 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9464
9798
  icon: '\uF022',
9465
9799
  execute: function() { infopark.commands.new_child_page(child_list_element); }
9466
9800
  });
9801
+ if (!infopark.clipboard.is_empty()) {
9802
+ menu.add_item(child_list_element.dom_element(), {
9803
+ title: infopark.i18n.translate('child_list_menus.move_here'),
9804
+ icon: '\uF016',
9805
+ execute: function() { infopark.commands.move_obj_into(child_list_element); },
9806
+ disabled: !infopark.clipboard.can_paste_into(child_list_element)
9807
+ });
9808
+ menu.add_item(child_list_element.dom_element(), {
9809
+ title: infopark.i18n.translate('child_list_menus.copy_here'),
9810
+ icon: '\uF015',
9811
+ execute: function() { infopark.commands.copy_obj_into(child_list_element); },
9812
+ disabled: !infopark.clipboard.can_paste_into(child_list_element)
9813
+ });
9814
+ }
9467
9815
  });
9468
9816
  }
9469
9817
  });
@@ -9508,7 +9856,10 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9508
9856
  $.extend(infopark, {
9509
9857
  image_upload: {
9510
9858
  init: function() {
9511
- infopark.editing.on('activate', activate);
9859
+ infopark.on('editing', function() {
9860
+ activate_for_field_type('linklist');
9861
+ activate_for_field_type('reference');
9862
+ });
9512
9863
 
9513
9864
  // Disable DnD for all elements by default to prevent the user
9514
9865
  // from accidentally opening an image in browser.
@@ -9516,12 +9867,10 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9516
9867
  $('body').on('drop', function(e) { return false; });
9517
9868
  },
9518
9869
 
9519
- upload_image: function(event, dom_element) {
9870
+ upload_image: function(event, dom_element, field_type) {
9520
9871
  var data_transfer = event.originalEvent.dataTransfer;
9521
9872
  if (!data_transfer) { return; }
9522
9873
 
9523
- var cms_element = infopark.cms_element.from_dom_element(dom_element);
9524
-
9525
9874
  var files = data_transfer.files;
9526
9875
  if (files.length === 0) {
9527
9876
  return;
@@ -9536,18 +9885,21 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9536
9885
  var create_image = function(file) {
9537
9886
  var obj_name = file.name.replace(/[^a-z0-9_.$\-]/ig, '-');
9538
9887
  var path = '_resources/' + infopark.random_hex() + '/' + obj_name;
9539
- return infopark.obj.create({blob: file, _path: path, _obj_class: 'Image'});
9540
- };
9541
-
9542
- var link_image = function(resource_id) {
9543
- var attributes = {};
9544
- attributes[cms_element.field_name()] = [{obj_id: resource_id}];
9545
- return cms_element.obj().save(attributes);
9888
+ return infopark.create_obj({blob: file, _path: path, _obj_class: 'Image'});
9546
9889
  };
9547
9890
 
9548
9891
  infopark.with_saving_overlay(create_image(file).then(function(data) {
9549
- return link_image(data.id()).then(function() {
9550
- return infopark.reload();
9892
+ var field_value;
9893
+ if (field_type === 'reference') {
9894
+ field_value = data.id;
9895
+ } else if (field_type === 'linklist') {
9896
+ field_value = [{obj_id: data.id}];
9897
+ } else {
9898
+ $.error('Field type must be "reference" or "linklist".');
9899
+ }
9900
+
9901
+ return dom_element.infopark('save', field_value).then(function() {
9902
+ dom_element.trigger('infopark_reload');
9551
9903
  });
9552
9904
  }));
9553
9905
  }
@@ -9555,19 +9907,21 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9555
9907
  }
9556
9908
  });
9557
9909
 
9558
- var activate = function() {
9559
- $('body').on('dragover.image_upload', 'img[data-ip-field-type=linklist]', function(e) {
9910
+ var activate_for_field_type = function(field_type) {
9911
+ var field_type_selector = 'img[data-ip-field-type=' + field_type + ']';
9912
+
9913
+ $('body').on('dragover.image_upload', field_type_selector, function(e) {
9560
9914
  $(e.target).addClass('ip_editing_dragover');
9561
9915
  return false;
9562
9916
  });
9563
9917
 
9564
- $('body').on('dragleave.image_upload', 'img[data-ip-field-type=linklist]', function(e) {
9918
+ $('body').on('dragleave.image_upload', field_type_selector, function(e) {
9565
9919
  $(e.target).removeClass('ip_editing_dragover');
9566
9920
  return false;
9567
9921
  });
9568
9922
 
9569
- $('body').on('drop.image_upload', 'img[data-ip-field-type=linklist]', function(e) {
9570
- infopark.image_upload.upload_image(e, $(e.target));
9923
+ $('body').on('drop.image_upload', field_type_selector, function(e) {
9924
+ infopark.image_upload.upload_image(e, $(e.target), field_type);
9571
9925
  return false;
9572
9926
  });
9573
9927
  };
@@ -9667,6 +10021,54 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9667
10021
  }
9668
10022
  });
9669
10023
  }());
10024
+ (function(){
10025
+ infopark.clipboard = {
10026
+ save_obj: function(obj) {
10027
+ store_obj(obj);
10028
+ },
10029
+
10030
+ is_empty: function() {
10031
+ return !infopark.storage.has_key(storage_key);
10032
+ },
10033
+
10034
+ obj: function() {
10035
+ var data = stored_data();
10036
+ return infopark.obj.create_instance(data.id, data.obj_class_name);
10037
+ },
10038
+
10039
+ clear: function() {
10040
+ infopark.storage.remove(storage_key);
10041
+ },
10042
+
10043
+ can_paste_into: function(child_list_element) {
10044
+ var allowed_classes = child_list_element.allowed_classes();
10045
+
10046
+ if (allowed_classes) {
10047
+ var obj_class_name = stored_data().obj_class_name;
10048
+ return _.contains(allowed_classes, obj_class_name);
10049
+ } else {
10050
+ return true;
10051
+ }
10052
+ }
10053
+ };
10054
+
10055
+ var storage_key = 'clipboard';
10056
+
10057
+ var store_obj = function(obj) {
10058
+ var data = {id: obj.id(), obj_class_name: obj.obj_class_name()};
10059
+ infopark.storage.set(storage_key, data);
10060
+ };
10061
+
10062
+ var stored_data = function() {
10063
+ var data = infopark.storage.get(storage_key);
10064
+
10065
+ return data || {};
10066
+ };
10067
+ })();
10068
+
10069
+
10070
+
10071
+
9670
10072
 
9671
10073
 
9672
10074
 
@@ -9721,9 +10123,11 @@ infopark.menu_bar_dropdown.init();
9721
10123
  infopark.workspace_select.init();
9722
10124
  infopark.menu_bar.init();
9723
10125
  infopark.widget_menus.init();
10126
+ infopark.widget_reloading.init();
9724
10127
  infopark.widget_sorting.init();
9725
10128
  infopark.image_upload.init();
9726
10129
  infopark.child_list_menus.init();
9727
10130
  infopark.editable_workspace_dialog.init();
10131
+ infopark.reloading.init();
9728
10132
 
9729
10133
  window.onbeforeunload = infopark.warn_before_unloading;