CMS Tree Page View - Version 0.7.18

Version Description

  • Second try: Hopefully fixed the problem that moving a page resulted in WPML losing the connection between the languages
  • Hungarian translation added
  • Small CSS fixes
  • Fixed compatiblity issue with ALO EasyMail Newsletter
Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin CMS Tree Page View
Version 0.7.18
Comparing to
See all releases

Code changes from version 0.7.17 to 0.7.18

Files changed (68) hide show
  1. functions.php +6 -1
  2. index.php +2 -2
  3. languages/cms-tree-page-view-hu_HU.mo +0 -0
  4. languages/cms-tree-page-view-hu_HU.po +161 -0
  5. readme.txt +8 -2
  6. scripts/cms_tree_page_view.js +1 -1
  7. trunk/FirePHPCore/FirePHP.class.php +1529 -0
  8. trunk/FirePHPCore/FirePHP.class.php4 +1292 -0
  9. trunk/FirePHPCore/LICENSE +29 -0
  10. trunk/FirePHPCore/fb.php +261 -0
  11. trunk/FirePHPCore/fb.php4 +251 -0
  12. trunk/functions.php +1074 -0
  13. trunk/images/page_white_text.png +0 -0
  14. trunk/images/signature.gif +0 -0
  15. trunk/index.php +57 -0
  16. trunk/languages/cms-tree-page-view-be_BY.mo +0 -0
  17. trunk/languages/cms-tree-page-view-be_BY.po +133 -0
  18. trunk/languages/cms-tree-page-view-cs_CZ.mo +0 -0
  19. trunk/languages/cms-tree-page-view-cs_CZ.po +323 -0
  20. trunk/languages/cms-tree-page-view-de_DE.mo +0 -0
  21. trunk/languages/cms-tree-page-view-de_DE.po +163 -0
  22. trunk/languages/cms-tree-page-view-el.mo +0 -0
  23. trunk/languages/cms-tree-page-view-el.po +260 -0
  24. trunk/languages/cms-tree-page-view-es_ES.mo +0 -0
  25. trunk/languages/cms-tree-page-view-es_ES.po +133 -0
  26. trunk/languages/cms-tree-page-view-fr_FR.mo +0 -0
  27. trunk/languages/cms-tree-page-view-fr_FR.po +163 -0
  28. trunk/languages/cms-tree-page-view-he_IL.mo +0 -0
  29. trunk/languages/cms-tree-page-view-he_IL.po +236 -0
  30. trunk/languages/cms-tree-page-view-hu_HU.mo +0 -0
  31. trunk/languages/cms-tree-page-view-hu_HU.po +161 -0
  32. trunk/languages/cms-tree-page-view-it_IT.mo +0 -0
  33. trunk/languages/cms-tree-page-view-it_IT.po +175 -0
  34. trunk/languages/cms-tree-page-view-nl_NL.mo +0 -0
  35. trunk/languages/cms-tree-page-view-nl_NL.po +234 -0
  36. trunk/languages/cms-tree-page-view-pt_BR.mo +0 -0
  37. trunk/languages/cms-tree-page-view-pt_BR.po +247 -0
  38. trunk/languages/cms-tree-page-view-ru_RU.mo +0 -0
  39. trunk/languages/cms-tree-page-view-ru_RU.po +133 -0
  40. trunk/languages/cms-tree-page-view-sv_SE.mo +0 -0
  41. trunk/languages/cms-tree-page-view.pot +257 -0
  42. trunk/readme.txt +298 -0
  43. trunk/screenshot-1.png +0 -0
  44. trunk/screenshot-2.png +0 -0
  45. trunk/screenshot-3.png +0 -0
  46. trunk/screenshot-4.png +0 -0
  47. trunk/screenshot-5.png +0 -0
  48. trunk/screenshot-6.png +0 -0
  49. trunk/screenshot-7.png +0 -0
  50. trunk/scripts/cms_tree_page_view.js +555 -0
  51. trunk/scripts/jquery.alerts.js +235 -0
  52. trunk/scripts/jquery.biscuit.js +96 -0
  53. trunk/scripts/jquery.hoverIntent.minified.js +9 -0
  54. trunk/scripts/jquery.jstree.js +4545 -0
  55. trunk/scripts/themes/wordpress/d.png +0 -0
  56. trunk/scripts/themes/wordpress/d_old.png +0 -0
  57. trunk/scripts/themes/wordpress/dot_for_ie.gif +0 -0
  58. trunk/scripts/themes/wordpress/iconsxx.png +0 -0
  59. trunk/scripts/themes/wordpress/style.css +91 -0
  60. trunk/scripts/themes/wordpress/throbber.gif +0 -0
  61. trunk/styles/images/arrow-left.gif +0 -0
  62. trunk/styles/images/help.gif +0 -0
  63. trunk/styles/images/important.gif +0 -0
  64. trunk/styles/images/info.gif +0 -0
  65. trunk/styles/images/lock.png +0 -0
  66. trunk/styles/images/title.gif +0 -0
  67. trunk/styles/jquery.alerts.css +57 -0
  68. trunk/styles/styles.css +323 -0
functions.php CHANGED
@@ -521,6 +521,9 @@ function cms_tpv_get_pages($args = null) {
521
 
522
  // does not work with plugin role scoper. don't know why, but this should fix it
523
  remove_action("get_pages", array('ScoperHardway', 'flt_get_pages'), 1, 2);
 
 
 
524
 
525
  #do_action_ref_array('parse_query', array(&$this));
526
  #print_r($get_posts_args);
@@ -529,7 +532,7 @@ function cms_tpv_get_pages($args = null) {
529
  // filter out pages for wpml, by applying same filter as get_pages does
530
  // only run if wpml is available or always?
531
  $pages = apply_filters('get_pages', $pages, $get_posts_args);
532
-
533
  return $pages;
534
 
535
  }
@@ -913,6 +916,8 @@ function cms_tpv_move_page() {
913
  $node_id = str_replace("cms-tpv-", "", $node_id);
914
  $ref_node_id = str_replace("cms-tpv-", "", $ref_node_id);
915
 
 
 
916
  if ($node_id && $ref_node_id) {
917
  #echo "\nnode_id: $node_id";
918
  #echo "\ntype: $type";
521
 
522
  // does not work with plugin role scoper. don't know why, but this should fix it
523
  remove_action("get_pages", array('ScoperHardway', 'flt_get_pages'), 1, 2);
524
+
525
+ // does not work with plugin ALO EasyMail Newsletter
526
+ remove_filter('get_pages','ALO_exclude_page');
527
 
528
  #do_action_ref_array('parse_query', array(&$this));
529
  #print_r($get_posts_args);
532
  // filter out pages for wpml, by applying same filter as get_pages does
533
  // only run if wpml is available or always?
534
  $pages = apply_filters('get_pages', $pages, $get_posts_args);
535
+
536
  return $pages;
537
 
538
  }
916
  $node_id = str_replace("cms-tpv-", "", $node_id);
917
  $ref_node_id = str_replace("cms-tpv-", "", $ref_node_id);
918
 
919
+ $_POST["skip_sitepress_actions"] = true; // sitepress.class.php->save_post_actions
920
+
921
  if ($node_id && $ref_node_id) {
922
  #echo "\nnode_id: $node_id";
923
  #echo "\ntype: $type";
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CMS Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
5
  Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. Use the tree you to edit, view, add pages and search pages (very useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
6
- Version: 0.7.17
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -28,7 +28,7 @@ License: GPL2
28
  #require("functions.php");
29
  require(dirname(__FILE__)."/functions.php");
30
 
31
- define( "CMS_TPV_VERSION", "0.7.17");
32
  define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
33
  define( "CMS_TPV_NAME", "CMS Tree Page View");
34
 
3
  Plugin Name: CMS Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
5
  Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. Use the tree you to edit, view, add pages and search pages (very useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
6
+ Version: 0.7.18
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
28
  #require("functions.php");
29
  require(dirname(__FILE__)."/functions.php");
30
 
31
+ define( "CMS_TPV_VERSION", "0.7.18");
32
  define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
33
  define( "CMS_TPV_NAME", "CMS Tree Page View");
34
 
languages/cms-tree-page-view-hu_HU.mo ADDED
Binary file
languages/cms-tree-page-view-hu_HU.po ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-06-30 19:00+0000\n"
11
+ "PO-Revision-Date: 2011-03-08 19:52+0100\n"
12
+ "Last-Translator: Szijártó József <hutchington@gmail.com>\n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+
18
+ #: functions.php:45
19
+ msgid "Enter title of new page"
20
+ msgstr "Új oldal címének megadása"
21
+
22
+ #: functions.php:46
23
+ msgid "child pages"
24
+ msgstr "aloldalak"
25
+
26
+ #: functions.php:47
27
+ msgid "Edit page"
28
+ msgstr "Oldal szerkesztése"
29
+
30
+ #: functions.php:48
31
+ msgid "View page"
32
+ msgstr "Oldal megtekintése"
33
+
34
+ #: functions.php:49
35
+ msgid "Edit"
36
+ msgstr "Szerkeszt"
37
+
38
+ #: functions.php:50
39
+ msgid "View"
40
+ msgstr "Megtekint"
41
+
42
+ #: functions.php:51
43
+ msgid "Add page"
44
+ msgstr "Oldal hozzáadása"
45
+
46
+ #: functions.php:52
47
+ msgid "Add new page after"
48
+ msgstr "Oldal hozzáadása ezután"
49
+
50
+ #: functions.php:53
51
+ msgid "after"
52
+ msgstr "utána"
53
+
54
+ #: functions.php:54
55
+ msgid "inside"
56
+ msgstr "belső"
57
+
58
+ #: functions.php:55
59
+ msgid "Add new page inside"
60
+ msgstr "Új oldal bele"
61
+
62
+ #: functions.php:56
63
+ msgid "draft"
64
+ msgstr "Vázlat"
65
+
66
+ #: functions.php:57
67
+ msgid "future"
68
+ msgstr "jövő"
69
+
70
+ #: functions.php:58
71
+ msgid "protected"
72
+ msgstr "védett"
73
+
74
+ #: functions.php:59
75
+ msgid "pending"
76
+ msgstr "függőben"
77
+
78
+ #: functions.php:60
79
+ msgid "private"
80
+ msgstr "privát"
81
+
82
+ #: functions.php:61
83
+ msgid "Password protected page"
84
+ msgstr "Jelszóval védett"
85
+
86
+ #: functions.php:113
87
+ msgid "settings"
88
+ msgstr "beállítások"
89
+
90
+ #: functions.php:120
91
+ msgid "Show tree"
92
+ msgstr "Fa mutatása"
93
+
94
+ #: functions.php:124
95
+ msgid "on the dashboard"
96
+ msgstr "a Vezérlőpulton"
97
+
98
+ #: functions.php:128
99
+ msgid "under the pages menu"
100
+ msgstr "az oldalak menüje alatt"
101
+
102
+ #: functions.php:135
103
+ msgid "Save Changes"
104
+ msgstr "Változtatások mentése"
105
+
106
+ #: functions.php:150
107
+ msgid "No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?"
108
+ msgstr "Nem található az oldal. Szeretnél hozzáadni egy <a href='post-new.php?post_type=page'>új oldalt</a>?"
109
+
110
+ #: functions.php:157
111
+ msgid "All"
112
+ msgstr "Összes"
113
+
114
+ #: functions.php:158
115
+ msgid "Public"
116
+ msgstr "Publikus"
117
+
118
+ #: functions.php:160
119
+ msgid "Expand"
120
+ msgstr "Kibont"
121
+
122
+ #: functions.php:161
123
+ msgid "Collapse"
124
+ msgstr "Becsuk"
125
+
126
+ #: functions.php:166
127
+ msgid "Clear search"
128
+ msgstr "Keresés törlése"
129
+
130
+ #: functions.php:167
131
+ msgid "Search"
132
+ msgstr "Keresés"
133
+
134
+ #: functions.php:168
135
+ msgid "Searching..."
136
+ msgstr "Keresés..."
137
+
138
+ #: functions.php:173
139
+ msgid "Loading..."
140
+ msgstr "Betöltés..."
141
+
142
+ #: functions.php:175
143
+ msgid "Search: no pages found"
144
+ msgstr "Keresés: nem találhatók oldalak"
145
+
146
+ #: functions.php:177
147
+ msgid "Loading tree"
148
+ msgstr "Fa betöltése"
149
+
150
+ #: functions.php:277
151
+ msgid "<Untitled page>"
152
+ msgstr "<Névtelen oldal>"
153
+
154
+ #: functions.php:295
155
+ msgid "Click to edit. Drag to move."
156
+ msgstr "Kattints a szerkesztésért. Fogd a mozgatásért."
157
+
158
+ #: functions.php:432
159
+ msgid "New page"
160
+ msgstr "Új oldal"
161
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 0.7.17
8
 
9
  Adds a tree of all your pages or custom posts. Use drag & drop to reorder your pages, and edit, view, add, and search your pages.
10
 
@@ -47,6 +47,7 @@ This plugin is available in the following languages:
47
  * Czech
48
  * Italian
49
  * Dutch
 
50
 
51
  #### Making the tree available for your vistors
52
  If you're looking for a version of this page tree that the vistors of your site can use, then check out
@@ -81,8 +82,13 @@ Now the tree with the pages will be visible both on the dashboard and in the men
81
 
82
  == Changelog ==
83
 
84
- = 0.7.17 =
 
 
 
 
85
 
 
86
  * Removed cookie.js
87
  * Updated jstree
88
  * If Keyboard Shortcuts was enabled for a user, title and content of a post could not be edited.
4
  Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 0.7.18
8
 
9
  Adds a tree of all your pages or custom posts. Use drag & drop to reorder your pages, and edit, view, add, and search your pages.
10
 
47
  * Czech
48
  * Italian
49
  * Dutch
50
+ * Hungarian
51
 
52
  #### Making the tree available for your vistors
53
  If you're looking for a version of this page tree that the vistors of your site can use, then check out
82
 
83
  == Changelog ==
84
 
85
+ = 0.7.18 =
86
+ * Second try: Hopefully fixed the problem that moving a page resulted in WPML losing the connection between the languages
87
+ * Hungarian translation added
88
+ * Small CSS fixes
89
+ * Fixed compatiblity issue with ALO EasyMail Newsletter
90
 
91
+ = 0.7.17 =
92
  * Removed cookie.js
93
  * Updated jstree
94
  * If Keyboard Shortcuts was enabled for a user, title and content of a post could not be edited.
scripts/cms_tree_page_view.js CHANGED
@@ -269,7 +269,7 @@ function cms_tpv_mouseover_li(li) {
269
  var width = $a.outerWidth(true);
270
  $li.append(div_actions_for_post_type);
271
  left_pos = width+28;
272
- top_pos = -3;
273
  div_actions_for_post_type.css("left", left_pos);
274
  div_actions_for_post_type.css("top", top_pos);
275
  div_actions_for_post_type.show();
269
  var width = $a.outerWidth(true);
270
  $li.append(div_actions_for_post_type);
271
  left_pos = width+28;
272
+ top_pos = -8;
273
  div_actions_for_post_type.css("left", left_pos);
274
  div_actions_for_post_type.css("top", top_pos);
275
  div_actions_for_post_type.show();
trunk/FirePHPCore/FirePHP.class.php ADDED
@@ -0,0 +1,1529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * *** BEGIN LICENSE BLOCK *****
4
+ *
5
+ * This file is part of FirePHP (http://www.firephp.org/).
6
+ *
7
+ * Software License Agreement (New BSD License)
8
+ *
9
+ * Copyright (c) 2006-2009, Christoph Dorn
10
+ * All rights reserved.
11
+ *
12
+ * Redistribution and use in source and binary forms, with or without modification,
13
+ * are permitted provided that the following conditions are met:
14
+ *
15
+ * * Redistributions of source code must retain the above copyright notice,
16
+ * this list of conditions and the following disclaimer.
17
+ *
18
+ * * Redistributions in binary form must reproduce the above copyright notice,
19
+ * this list of conditions and the following disclaimer in the documentation
20
+ * and/or other materials provided with the distribution.
21
+ *
22
+ * * Neither the name of Christoph Dorn nor the names of its
23
+ * contributors may be used to endorse or promote products derived from this
24
+ * software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ *
37
+ * ***** END LICENSE BLOCK *****
38
+ *
39
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
40
+ * @author Christoph Dorn <christoph@christophdorn.com>
41
+ * @license http://www.opensource.org/licenses/bsd-license.php
42
+ * @package FirePHP
43
+ */
44
+
45
+
46
+ /**
47
+ * Sends the given data to the FirePHP Firefox Extension.
48
+ * The data can be displayed in the Firebug Console or in the
49
+ * "Server" request tab.
50
+ *
51
+ * For more information see: http://www.firephp.org/
52
+ *
53
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
54
+ * @author Christoph Dorn <christoph@christophdorn.com>
55
+ * @license http://www.opensource.org/licenses/bsd-license.php
56
+ * @package FirePHP
57
+ */
58
+ class FirePHP {
59
+
60
+ /**
61
+ * FirePHP version
62
+ *
63
+ * @var string
64
+ */
65
+ const VERSION = '0.3';
66
+
67
+ /**
68
+ * Firebug LOG level
69
+ *
70
+ * Logs a message to firebug console.
71
+ *
72
+ * @var string
73
+ */
74
+ const LOG = 'LOG';
75
+
76
+ /**
77
+ * Firebug INFO level
78
+ *
79
+ * Logs a message to firebug console and displays an info icon before the message.
80
+ *
81
+ * @var string
82
+ */
83
+ const INFO = 'INFO';
84
+
85
+ /**
86
+ * Firebug WARN level
87
+ *
88
+ * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.
89
+ *
90
+ * @var string
91
+ */
92
+ const WARN = 'WARN';
93
+
94
+ /**
95
+ * Firebug ERROR level
96
+ *
97
+ * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
98
+ *
99
+ * @var string
100
+ */
101
+ const ERROR = 'ERROR';
102
+
103
+ /**
104
+ * Dumps a variable to firebug's server panel
105
+ *
106
+ * @var string
107
+ */
108
+ const DUMP = 'DUMP';
109
+
110
+ /**
111
+ * Displays a stack trace in firebug console
112
+ *
113
+ * @var string
114
+ */
115
+ const TRACE = 'TRACE';
116
+
117
+ /**
118
+ * Displays an exception in firebug console
119
+ *
120
+ * Increments the firebug error count.
121
+ *
122
+ * @var string
123
+ */
124
+ const EXCEPTION = 'EXCEPTION';
125
+
126
+ /**
127
+ * Displays an table in firebug console
128
+ *
129
+ * @var string
130
+ */
131
+ const TABLE = 'TABLE';
132
+
133
+ /**
134
+ * Starts a group in firebug console
135
+ *
136
+ * @var string
137
+ */
138
+ const GROUP_START = 'GROUP_START';
139
+
140
+ /**
141
+ * Ends a group in firebug console
142
+ *
143
+ * @var string
144
+ */
145
+ const GROUP_END = 'GROUP_END';
146
+
147
+ /**
148
+ * Singleton instance of FirePHP
149
+ *
150
+ * @var FirePHP
151
+ */
152
+ protected static $instance = null;
153
+
154
+ /**
155
+ * Flag whether we are logging from within the exception handler
156
+ *
157
+ * @var boolean
158
+ */
159
+ protected $inExceptionHandler = false;
160
+
161
+ /**
162
+ * Flag whether to throw PHP errors that have been converted to ErrorExceptions
163
+ *
164
+ * @var boolean
165
+ */
166
+ protected $throwErrorExceptions = true;
167
+
168
+ /**
169
+ * Flag whether to convert PHP assertion errors to Exceptions
170
+ *
171
+ * @var boolean
172
+ */
173
+ protected $convertAssertionErrorsToExceptions = true;
174
+
175
+ /**
176
+ * Flag whether to throw PHP assertion errors that have been converted to Exceptions
177
+ *
178
+ * @var boolean
179
+ */
180
+ protected $throwAssertionExceptions = false;
181
+
182
+ /**
183
+ * Wildfire protocol message index
184
+ *
185
+ * @var int
186
+ */
187
+ protected $messageIndex = 1;
188
+
189
+ /**
190
+ * Options for the library
191
+ *
192
+ * @var array
193
+ */
194
+ protected $options = array('maxObjectDepth' => 10,
195
+ 'maxArrayDepth' => 20,
196
+ 'useNativeJsonEncode' => true,
197
+ 'includeLineNumbers' => true);
198
+
199
+ /**
200
+ * Filters used to exclude object members when encoding
201
+ *
202
+ * @var array
203
+ */
204
+ protected $objectFilters = array();
205
+
206
+ /**
207
+ * A stack of objects used to detect recursion during object encoding
208
+ *
209
+ * @var object
210
+ */
211
+ protected $objectStack = array();
212
+
213
+ /**
214
+ * Flag to enable/disable logging
215
+ *
216
+ * @var boolean
217
+ */
218
+ protected $enabled = true;
219
+
220
+ /**
221
+ * The object constructor
222
+ */
223
+ function __construct() {
224
+ }
225
+
226
+ /**
227
+ * When the object gets serialized only include specific object members.
228
+ *
229
+ * @return array
230
+ */
231
+ public function __sleep() {
232
+ return array('options','objectFilters','enabled');
233
+ }
234
+
235
+ /**
236
+ * Gets singleton instance of FirePHP
237
+ *
238
+ * @param boolean $AutoCreate
239
+ * @return FirePHP
240
+ */
241
+ public static function getInstance($AutoCreate=false) {
242
+ if($AutoCreate===true && !self::$instance) {
243
+ self::init();
244
+ }
245
+ return self::$instance;
246
+ }
247
+
248
+ /**
249
+ * Creates FirePHP object and stores it for singleton access
250
+ *
251
+ * @return FirePHP
252
+ */
253
+ public static function init() {
254
+ return self::$instance = new self();
255
+ }
256
+
257
+ /**
258
+ * Enable and disable logging to Firebug
259
+ *
260
+ * @param boolean $Enabled TRUE to enable, FALSE to disable
261
+ * @return void
262
+ */
263
+ public function setEnabled($Enabled) {
264
+ $this->enabled = $Enabled;
265
+ }
266
+
267
+ /**
268
+ * Check if logging is enabled
269
+ *
270
+ * @return boolean TRUE if enabled
271
+ */
272
+ public function getEnabled() {
273
+ return $this->enabled;
274
+ }
275
+
276
+ /**
277
+ * Specify a filter to be used when encoding an object
278
+ *
279
+ * Filters are used to exclude object members.
280
+ *
281
+ * @param string $Class The class name of the object
282
+ * @param array $Filter An array of members to exclude
283
+ * @return void
284
+ */
285
+ public function setObjectFilter($Class, $Filter) {
286
+ $this->objectFilters[strtolower($Class)] = $Filter;
287
+ }
288
+
289
+ /**
290
+ * Set some options for the library
291
+ *
292
+ * Options:
293
+ * - maxObjectDepth: The maximum depth to traverse objects (default: 10)
294
+ * - maxArrayDepth: The maximum depth to traverse arrays (default: 20)
295
+ * - useNativeJsonEncode: If true will use json_encode() (default: true)
296
+ * - includeLineNumbers: If true will include line numbers and filenames (default: true)
297
+ *
298
+ * @param array $Options The options to be set
299
+ * @return void
300
+ */
301
+ public function setOptions($Options) {
302
+ $this->options = array_merge($this->options,$Options);
303
+ }
304
+
305
+ /**
306
+ * Get options from the library
307
+ *
308
+ * @return array The currently set options
309
+ */
310
+ public function getOptions() {
311
+ return $this->options;
312
+ }
313
+
314
+ /**
315
+ * Register FirePHP as your error handler
316
+ *
317
+ * Will throw exceptions for each php error.
318
+ *
319
+ * @return mixed Returns a string containing the previously defined error handler (if any)
320
+ */
321
+ public function registerErrorHandler($throwErrorExceptions=true)
322
+ {
323
+ //NOTE: The following errors will not be caught by this error handler:
324
+ // E_ERROR, E_PARSE, E_CORE_ERROR,
325
+ // E_CORE_WARNING, E_COMPILE_ERROR,
326
+ // E_COMPILE_WARNING, E_STRICT
327
+
328
+ $this->throwErrorExceptions = $throwErrorExceptions;
329
+
330
+ return set_error_handler(array($this,'errorHandler'));
331
+ }
332
+
333
+ /**
334
+ * FirePHP's error handler
335
+ *
336
+ * Throws exception for each php error that will occur.
337
+ *
338
+ * @param int $errno
339
+ * @param string $errstr
340
+ * @param string $errfile
341
+ * @param int $errline
342
+ * @param array $errcontext
343
+ */
344
+ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
345
+ {
346
+ // Don't throw exception if error reporting is switched off
347
+ if (error_reporting() == 0) {
348
+ return;
349
+ }
350
+ // Only throw exceptions for errors we are asking for
351
+ if (error_reporting() & $errno) {
352
+
353
+ $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);
354
+ if($this->throwErrorExceptions) {
355
+ throw $exception;
356
+ } else {
357
+ $this->fb($exception);
358
+ }
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Register FirePHP as your exception handler
364
+ *
365
+ * @return mixed Returns the name of the previously defined exception handler,
366
+ * or NULL on error.
367
+ * If no previous handler was defined, NULL is also returned.
368
+ */
369
+ public function registerExceptionHandler()
370
+ {
371
+ return set_exception_handler(array($this,'exceptionHandler'));
372
+ }
373
+
374
+ /**
375
+ * FirePHP's exception handler
376
+ *
377
+ * Logs all exceptions to your firebug console and then stops the script.
378
+ *
379
+ * @param Exception $Exception
380
+ * @throws Exception
381
+ */
382
+ function exceptionHandler($Exception) {
383
+
384
+ $this->inExceptionHandler = true;
385
+
386
+ header('HTTP/1.1 500 Internal Server Error');
387
+
388
+ $this->fb($Exception);
389
+
390
+ $this->inExceptionHandler = false;
391
+ }
392
+
393
+ /**
394
+ * Register FirePHP driver as your assert callback
395
+ *
396
+ * @param boolean $convertAssertionErrorsToExceptions
397
+ * @param boolean $throwAssertionExceptions
398
+ * @return mixed Returns the original setting or FALSE on errors
399
+ */
400
+ public function registerAssertionHandler($convertAssertionErrorsToExceptions=true, $throwAssertionExceptions=false)
401
+ {
402
+ $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions;
403
+ $this->throwAssertionExceptions = $throwAssertionExceptions;
404
+
405
+ if($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) {
406
+ throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!');
407
+ }
408
+
409
+ return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
410
+ }
411
+
412
+ /**
413
+ * FirePHP's assertion handler
414
+ *
415
+ * Logs all assertions to your firebug console and then stops the script.
416
+ *
417
+ * @param string $file File source of assertion
418
+ * @param int $line Line source of assertion
419
+ * @param mixed $code Assertion code
420
+ */
421
+ public function assertionHandler($file, $line, $code)
422
+ {
423
+
424
+ if($this->convertAssertionErrorsToExceptions) {
425
+
426
+ $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line);
427
+
428
+ if($this->throwAssertionExceptions) {
429
+ throw $exception;
430
+ } else {
431
+ $this->fb($exception);
432
+ }
433
+
434
+ } else {
435
+
436
+ $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line));
437
+
438
+ }
439
+ }
440
+
441
+ /**
442
+ * Set custom processor url for FirePHP
443
+ *
444
+ * @param string $URL
445
+ */
446
+ public function setProcessorUrl($URL)
447
+ {
448
+ $this->setHeader('X-FirePHP-ProcessorURL', $URL);
449
+ }
450
+
451
+ /**
452
+ * Set custom renderer url for FirePHP
453
+ *
454
+ * @param string $URL
455
+ */
456
+ public function setRendererUrl($URL)
457
+ {
458
+ $this->setHeader('X-FirePHP-RendererURL', $URL);
459
+ }
460
+
461
+ /**
462
+ * Start a group for following messages.
463
+ *
464
+ * Options:
465
+ * Collapsed: [true|false]
466
+ * Color: [#RRGGBB|ColorName]
467
+ *
468
+ * @param string $Name
469
+ * @param array $Options OPTIONAL Instructions on how to log the group
470
+ * @return true
471
+ * @throws Exception
472
+ */
473
+ public function group($Name, $Options=null) {
474
+
475
+ if(!$Name) {
476
+ throw $this->newException('You must specify a label for the group!');
477
+ }
478
+
479
+ if($Options) {
480
+ if(!is_array($Options)) {
481
+ throw $this->newException('Options must be defined as an array!');
482
+ }
483
+ if(array_key_exists('Collapsed', $Options)) {
484
+ $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';
485
+ }
486
+ }
487
+
488
+ return $this->fb(null, $Name, FirePHP::GROUP_START, $Options);
489
+ }
490
+
491
+ /**
492
+ * Ends a group you have started before
493
+ *
494
+ * @return true
495
+ * @throws Exception
496
+ */
497
+ public function groupEnd() {
498
+ return $this->fb(null, null, FirePHP::GROUP_END);
499
+ }
500
+
501
+ /**
502
+ * Log object with label to firebug console
503
+ *
504
+ * @see FirePHP::LOG
505
+ * @param mixes $Object
506
+ * @param string $Label
507
+ * @return true
508
+ * @throws Exception
509
+ */
510
+ public function log($Object, $Label=null) {
511
+ return $this->fb($Object, $Label, FirePHP::LOG);
512
+ }
513
+
514
+ /**
515
+ * Log object with label to firebug console
516
+ *
517
+ * @see FirePHP::INFO
518
+ * @param mixes $Object
519
+ * @param string $Label
520
+ * @return true
521
+ * @throws Exception
522
+ */
523
+ public function info($Object, $Label=null) {
524
+ return $this->fb($Object, $Label, FirePHP::INFO);
525
+ }
526
+
527
+ /**
528
+ * Log object with label to firebug console
529
+ *
530
+ * @see FirePHP::WARN
531
+ * @param mixes $Object
532
+ * @param string $Label
533
+ * @return true
534
+ * @throws Exception
535
+ */
536
+ public function warn($Object, $Label=null) {
537
+ return $this->fb($Object, $Label, FirePHP::WARN);
538
+ }
539
+
540
+ /**
541
+ * Log object with label to firebug console
542
+ *
543
+ * @see FirePHP::ERROR
544
+ * @param mixes $Object
545
+ * @param string $Label
546
+ * @return true
547
+ * @throws Exception
548
+ */
549
+ public function error($Object, $Label=null) {
550
+ return $this->fb($Object, $Label, FirePHP::ERROR);
551
+ }
552
+
553
+ /**
554
+ * Dumps key and variable to firebug server panel
555
+ *
556
+ * @see FirePHP::DUMP
557
+ * @param string $Key
558
+ * @param mixed $Variable
559
+ * @return true
560
+ * @throws Exception
561
+ */
562
+ public function dump($Key, $Variable) {
563
+ return $this->fb($Variable, $Key, FirePHP::DUMP);
564
+ }
565
+
566
+ /**
567
+ * Log a trace in the firebug console
568
+ *
569
+ * @see FirePHP::TRACE
570
+ * @param string $Label
571
+ * @return true
572
+ * @throws Exception
573
+ */
574
+ public function trace($Label) {
575
+ return $this->fb($Label, FirePHP::TRACE);
576
+ }
577
+
578
+ /**
579
+ * Log a table in the firebug console
580
+ *
581
+ * @see FirePHP::TABLE
582
+ * @param string $Label
583
+ * @param string $Table
584
+ * @return true
585
+ * @throws Exception
586
+ */
587
+ public function table($Label, $Table) {
588
+ return $this->fb($Table, $Label, FirePHP::TABLE);
589
+ }
590
+
591
+ /**
592
+ * Check if FirePHP is installed on client
593
+ *
594
+ * @return boolean
595
+ */
596
+ public function detectClientExtension() {
597
+ /* Check if FirePHP is installed on client */
598
+ if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) ||
599
+ !version_compare($m[1][0],'0.0.6','>=')) {
600
+ return false;
601
+ }
602
+ return true;
603
+ }
604
+
605
+ /**
606
+ * Log varible to Firebug
607
+ *
608
+ * @see http://www.firephp.org/Wiki/Reference/Fb
609
+ * @param mixed $Object The variable to be logged
610
+ * @return true Return TRUE if message was added to headers, FALSE otherwise
611
+ * @throws Exception
612
+ */
613
+ public function fb($Object) {
614
+
615
+ if(!$this->enabled) {
616
+ return false;
617
+ }
618
+
619
+ if (headers_sent($filename, $linenum)) {
620
+ // If we are logging from within the exception handler we cannot throw another exception
621
+ if($this->inExceptionHandler) {
622
+ // Simply echo the error out to the page
623
+ echo '<div style="border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;"><span style="color: red; font-weight: bold;">FirePHP ERROR:</span> Headers already sent in <b>'.$filename.'</b> on line <b>'.$linenum.'</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>';
624
+ } else {
625
+ throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
626
+ }
627
+ }
628
+
629
+ $Type = null;
630
+ $Label = null;
631
+ $Options = array();
632
+
633
+ if(func_num_args()==1) {
634
+ } else
635
+ if(func_num_args()==2) {
636
+ switch(func_get_arg(1)) {
637
+ case self::LOG:
638
+ case self::INFO:
639
+ case self::WARN:
640
+ case self::ERROR:
641
+ case self::DUMP:
642
+ case self::TRACE:
643
+ case self::EXCEPTION:
644
+ case self::TABLE:
645
+ case self::GROUP_START:
646
+ case self::GROUP_END:
647
+ $Type = func_get_arg(1);
648
+ break;
649
+ default:
650
+ $Label = func_get_arg(1);
651
+ break;
652
+ }
653
+ } else
654
+ if(func_num_args()==3) {
655
+ $Type = func_get_arg(2);
656
+ $Label = func_get_arg(1);
657
+ } else
658
+ if(func_num_args()==4) {
659
+ $Type = func_get_arg(2);
660
+ $Label = func_get_arg(1);
661
+ $Options = func_get_arg(3);
662
+ } else {
663
+ throw $this->newException('Wrong number of arguments to fb() function!');
664
+ }
665
+
666
+
667
+ if(!$this->detectClientExtension()) {
668
+ return false;
669
+ }
670
+
671
+ $meta = array();
672
+ $skipFinalObjectEncode = false;
673
+
674
+ if($Object instanceof Exception) {
675
+
676
+ $meta['file'] = $this->_escapeTraceFile($Object->getFile());
677
+ $meta['line'] = $Object->getLine();
678
+
679
+ $trace = $Object->getTrace();
680
+ if($Object instanceof ErrorException
681
+ && isset($trace[0]['function'])
682
+ && $trace[0]['function']=='errorHandler'
683
+ && isset($trace[0]['class'])
684
+ && $trace[0]['class']=='FirePHP') {
685
+
686
+ $severity = false;
687
+ switch($Object->getSeverity()) {
688
+ case E_WARNING: $severity = 'E_WARNING'; break;
689
+ case E_NOTICE: $severity = 'E_NOTICE'; break;
690
+ case E_USER_ERROR: $severity = 'E_USER_ERROR'; break;
691
+ case E_USER_WARNING: $severity = 'E_USER_WARNING'; break;
692
+ case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break;
693
+ case E_STRICT: $severity = 'E_STRICT'; break;
694
+ case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break;
695
+ case E_DEPRECATED: $severity = 'E_DEPRECATED'; break;
696
+ case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break;
697
+ }
698
+
699
+ $Object = array('Class'=>get_class($Object),
700
+ 'Message'=>$severity.': '.$Object->getMessage(),
701
+ 'File'=>$this->_escapeTraceFile($Object->getFile()),
702
+ 'Line'=>$Object->getLine(),
703
+ 'Type'=>'trigger',
704
+ 'Trace'=>$this->_escapeTrace(array_splice($trace,2)));
705
+ $skipFinalObjectEncode = true;
706
+ } else {
707
+ $Object = array('Class'=>get_class($Object),
708
+ 'Message'=>$Object->getMessage(),
709
+ 'File'=>$this->_escapeTraceFile($Object->getFile()),
710
+ 'Line'=>$Object->getLine(),
711
+ 'Type'=>'throw',
712
+ 'Trace'=>$this->_escapeTrace($trace));
713
+ $skipFinalObjectEncode = true;
714
+ }
715
+ $Type = self::EXCEPTION;
716
+
717
+ } else
718
+ if($Type==self::TRACE) {
719
+
720
+ $trace = debug_backtrace();
721
+ if(!$trace) return false;
722
+ for( $i=0 ; $i<sizeof($trace) ; $i++ ) {
723
+
724
+ if(isset($trace[$i]['class'])
725
+ && isset($trace[$i]['file'])
726
+ && ($trace[$i]['class']=='FirePHP'
727
+ || $trace[$i]['class']=='FB')
728
+ && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
729
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
730
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
731
+ } else
732
+ if(isset($trace[$i]['class'])
733
+ && isset($trace[$i+1]['file'])
734
+ && $trace[$i]['class']=='FirePHP'
735
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
736
+ /* Skip fb() */
737
+ } else
738
+ if($trace[$i]['function']=='fb'
739
+ || $trace[$i]['function']=='trace'
740
+ || $trace[$i]['function']=='send') {
741
+ $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',
742
+ 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',
743
+ 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',
744
+ 'Message'=>$trace[$i]['args'][0],
745
+ 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',
746
+ 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',
747
+ 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',
748
+ 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));
749
+
750
+ $skipFinalObjectEncode = true;
751
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
752
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
753
+ break;
754
+ }
755
+ }
756
+
757
+ } else
758
+ if($Type==self::TABLE) {
759
+
760
+ if(isset($Object[0]) && is_string($Object[0])) {
761
+ $Object[1] = $this->encodeTable($Object[1]);
762
+ } else {
763
+ $Object = $this->encodeTable($Object);
764
+ }
765
+
766
+ $skipFinalObjectEncode = true;
767
+
768
+ } else
769
+ if($Type==self::GROUP_START) {
770
+
771
+ if(!$Label) {
772
+ throw $this->newException('You must specify a label for the group!');
773
+ }
774
+
775
+ } else {
776
+ if($Type===null) {
777
+ $Type = self::LOG;
778
+ }
779
+ }
780
+
781
+ if($this->options['includeLineNumbers']) {
782
+ if(!isset($meta['file']) || !isset($meta['line'])) {
783
+
784
+ $trace = debug_backtrace();
785
+ for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) {
786
+
787
+ if(isset($trace[$i]['class'])
788
+ && isset($trace[$i]['file'])
789
+ && ($trace[$i]['class']=='FirePHP'
790
+ || $trace[$i]['class']=='FB')
791
+ && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
792
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
793
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
794
+ } else
795
+ if(isset($trace[$i]['class'])
796
+ && isset($trace[$i+1]['file'])
797
+ && $trace[$i]['class']=='FirePHP'
798
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
799
+ /* Skip fb() */
800
+ } else
801
+ if(isset($trace[$i]['file'])
802
+ && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {
803
+ /* Skip FB::fb() */
804
+ } else {
805
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
806
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
807
+ break;
808
+ }
809
+ }
810
+
811
+ }
812
+ } else {
813
+ unset($meta['file']);
814
+ unset($meta['line']);
815
+ }
816
+
817
+ $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
818
+ $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION);
819
+
820
+ $structure_index = 1;
821
+ if($Type==self::DUMP) {
822
+ $structure_index = 2;
823
+ $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
824
+ } else {
825
+ $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
826
+ }
827
+
828
+ if($Type==self::DUMP) {
829
+ $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';
830
+ } else {
831
+ $msg_meta = $Options;
832
+ $msg_meta['Type'] = $Type;
833
+ if($Label!==null) {
834
+ $msg_meta['Label'] = $Label;
835
+ }
836
+ if(isset($meta['file']) && !isset($msg_meta['File'])) {
837
+ $msg_meta['File'] = $meta['file'];
838
+ }
839
+ if(isset($meta['line']) && !isset($msg_meta['Line'])) {
840
+ $msg_meta['Line'] = $meta['line'];
841
+ }
842
+ $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';
843
+ }
844
+
845
+ $parts = explode("\n",chunk_split($msg, 5000, "\n"));
846
+
847
+ for( $i=0 ; $i<count($parts) ; $i++) {
848
+
849
+ $part = $parts[$i];
850
+ if ($part) {
851
+
852
+ if(count($parts)>2) {
853
+ // Message needs to be split into multiple parts
854
+ $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
855
+ (($i==0)?strlen($msg):'')
856
+ . '|' . $part . '|'
857
+ . (($i<count($parts)-2)?'\\':''));
858
+ } else {
859
+ $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
860
+ strlen($part) . '|' . $part . '|');
861
+ }
862
+
863
+ $this->messageIndex++;
864
+
865
+ if ($this->messageIndex > 99999) {
866
+ throw $this->newException('Maximum number (99,999) of messages reached!');
867
+ }
868
+ }
869
+ }
870
+
871
+ $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);
872
+
873
+ return true;
874
+ }
875
+
876
+ /**
877
+ * Standardizes path for windows systems.
878
+ *
879
+ * @param string $Path
880
+ * @return string
881
+ */
882
+ protected function _standardizePath($Path) {
883
+ return preg_replace('/\\\\+/','/',$Path);
884
+ }
885
+
886
+ /**
887
+ * Escape trace path for windows systems
888
+ *
889
+ * @param array $Trace
890
+ * @return array
891
+ */
892
+ protected function _escapeTrace($Trace) {
893
+ if(!$Trace) return $Trace;
894
+ for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {
895
+ if(isset($Trace[$i]['file'])) {
896
+ $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);
897
+ }
898
+ if(isset($Trace[$i]['args'])) {
899
+ $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);
900
+ }
901
+ }
902
+ return $Trace;
903
+ }
904
+
905
+ /**
906
+ * Escape file information of trace for windows systems
907
+ *
908
+ * @param string $File
909
+ * @return string
910
+ */
911
+ protected function _escapeTraceFile($File) {
912
+ /* Check if we have a windows filepath */
913
+ if(strpos($File,'\\')) {
914
+ /* First strip down to single \ */
915
+
916
+ $file = preg_replace('/\\\\+/','\\',$File);
917
+
918
+ return $file;
919
+ }
920
+ return $File;
921
+ }
922
+
923
+ /**
924
+ * Send header
925
+ *
926
+ * @param string $Name
927
+ * @param string_type $Value
928
+ */
929
+ protected function setHeader($Name, $Value) {
930
+ return header($Name.': '.$Value);
931
+ }
932
+
933
+ /**
934
+ * Get user agent
935
+ *
936
+ * @return string|false
937
+ */
938
+ protected function getUserAgent() {
939
+ if(!isset($_SERVER['HTTP_USER_AGENT'])) return false;
940
+ return $_SERVER['HTTP_USER_AGENT'];
941
+ }
942
+
943
+ /**
944
+ * Returns a new exception
945
+ *
946
+ * @param string $Message
947
+ * @return Exception
948
+ */
949
+ protected function newException($Message) {
950
+ return new Exception($Message);
951
+ }
952
+
953
+ /**
954
+ * Encode an object into a JSON string
955
+ *
956
+ * Uses PHP's jeson_encode() if available
957
+ *
958
+ * @param object $Object The object to be encoded
959
+ * @return string The JSON string
960
+ */
961
+ public function jsonEncode($Object, $skipObjectEncode=false)
962
+ {
963
+ if(!$skipObjectEncode) {
964
+ $Object = $this->encodeObject($Object);
965
+ }
966
+
967
+ if(function_exists('json_encode')
968
+ && $this->options['useNativeJsonEncode']!=false) {
969
+
970
+ return json_encode($Object);
971
+ } else {
972
+ return $this->json_encode($Object);
973
+ }
974
+ }
975
+
976
+ /**
977
+ * Encodes a table by encoding each row and column with encodeObject()
978
+ *
979
+ * @param array $Table The table to be encoded
980
+ * @return array
981
+ */
982
+ protected function encodeTable($Table) {
983
+
984
+ if(!$Table) return $Table;
985
+
986
+ $new_table = array();
987
+ foreach($Table as $row) {
988
+
989
+ if(is_array($row)) {
990
+ $new_row = array();
991
+
992
+ foreach($row as $item) {
993
+ $new_row[] = $this->encodeObject($item);
994
+ }
995
+
996
+ $new_table[] = $new_row;
997
+ }
998
+ }
999
+
1000
+ return $new_table;
1001
+ }
1002
+
1003
+ /**
1004
+ * Encodes an object including members with
1005
+ * protected and private visibility
1006
+ *
1007
+ * @param Object $Object The object to be encoded
1008
+ * @param int $Depth The current traversal depth
1009
+ * @return array All members of the object
1010
+ */
1011
+ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1)
1012
+ {
1013
+ $return = array();
1014
+
1015
+ if (is_resource($Object)) {
1016
+
1017
+ return '** '.(string)$Object.' **';
1018
+
1019
+ } else
1020
+ if (is_object($Object)) {
1021
+
1022
+ if ($ObjectDepth > $this->options['maxObjectDepth']) {
1023
+ return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';
1024
+ }
1025
+
1026
+ foreach ($this->objectStack as $refVal) {
1027
+ if ($refVal === $Object) {
1028
+ return '** Recursion ('.get_class($Object).') **';
1029
+ }
1030
+ }
1031
+ array_push($this->objectStack, $Object);
1032
+
1033
+ $return['__className'] = $class = get_class($Object);
1034
+ $class_lower = strtolower($class);
1035
+
1036
+ $reflectionClass = new ReflectionClass($class);
1037
+ $properties = array();
1038
+ foreach( $reflectionClass->getProperties() as $property) {
1039
+ $properties[$property->getName()] = $property;
1040
+ }
1041
+
1042
+ $members = (array)$Object;
1043
+
1044
+ foreach( $properties as $raw_name => $property ) {
1045
+
1046
+ $name = $raw_name;
1047
+ if($property->isStatic()) {
1048
+ $name = 'static:'.$name;
1049
+ }
1050
+ if($property->isPublic()) {
1051
+ $name = 'public:'.$name;
1052
+ } else
1053
+ if($property->isPrivate()) {
1054
+ $name = 'private:'.$name;
1055
+ $raw_name = "\0".$class."\0".$raw_name;
1056
+ } else
1057
+ if($property->isProtected()) {
1058
+ $name = 'protected:'.$name;
1059
+ $raw_name = "\0".'*'."\0".$raw_name;
1060
+ }
1061
+
1062
+ if(!(isset($this->objectFilters[$class_lower])
1063
+ && is_array($this->objectFilters[$class_lower])
1064
+ && in_array($raw_name,$this->objectFilters[$class_lower]))) {
1065
+
1066
+ if(array_key_exists($raw_name,$members)
1067
+ && !$property->isStatic()) {
1068
+
1069
+ $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1);
1070
+
1071
+ } else {
1072
+ if(method_exists($property,'setAccessible')) {
1073
+ $property->setAccessible(true);
1074
+ $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1);
1075
+ } else
1076
+ if($property->isPublic()) {
1077
+ $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1);
1078
+ } else {
1079
+ $return[$name] = '** Need PHP 5.3 to get value **';
1080
+ }
1081
+ }
1082
+ } else {
1083
+ $return[$name] = '** Excluded by Filter **';
1084
+ }
1085
+ }
1086
+
1087
+ // Include all members that are not defined in the class
1088
+ // but exist in the object
1089
+ foreach( $members as $raw_name => $value ) {
1090
+
1091
+ $name = $raw_name;
1092
+
1093
+ if ($name{0} == "\0") {
1094
+ $parts = explode("\0", $name);
1095
+ $name = $parts[2];
1096
+ }
1097
+
1098
+ if(!isset($properties[$name])) {
1099
+ $name = 'undeclared:'.$name;
1100
+
1101
+ if(!(isset($this->objectFilters[$class_lower])
1102
+ && is_array($this->objectFilters[$class_lower])
1103
+ && in_array($raw_name,$this->objectFilters[$class_lower]))) {
1104
+
1105
+ $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1);
1106
+ } else {
1107
+ $return[$name] = '** Excluded by Filter **';
1108
+ }
1109
+ }
1110
+ }
1111
+
1112
+ array_pop($this->objectStack);
1113
+
1114
+ } elseif (is_array($Object)) {
1115
+
1116
+ if ($ArrayDepth > $this->options['maxArrayDepth']) {
1117
+ return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';
1118
+ }
1119
+
1120
+ foreach ($Object as $key => $val) {
1121
+
1122
+ // Encoding the $GLOBALS PHP array causes an infinite loop
1123
+ // if the recursion is not reset here as it contains
1124
+ // a reference to itself. This is the only way I have come up
1125
+ // with to stop infinite recursion in this case.
1126
+ if($key=='GLOBALS'
1127
+ && is_array($val)
1128
+ && array_key_exists('GLOBALS',$val)) {
1129
+ $val['GLOBALS'] = '** Recursion (GLOBALS) **';
1130
+ }
1131
+
1132
+ $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1);
1133
+ }
1134
+ } else {
1135
+ if(self::is_utf8($Object)) {
1136
+ return $Object;
1137
+ } else {
1138
+ return utf8_encode($Object);
1139
+ }
1140
+ }
1141
+ return $return;
1142
+ }
1143
+
1144
+ /**
1145
+ * Returns true if $string is valid UTF-8 and false otherwise.
1146
+ *
1147
+ * @param mixed $str String to be tested
1148
+ * @return boolean
1149
+ */
1150
+ protected static function is_utf8($str) {
1151
+ $c=0; $b=0;
1152
+ $bits=0;
1153
+ $len=strlen($str);
1154
+ for($i=0; $i<$len; $i++){
1155
+ $c=ord($str[$i]);
1156
+ if($c > 128){
1157
+ if(($c >= 254)) return false;
1158
+ elseif($c >= 252) $bits=6;
1159
+ elseif($c >= 248) $bits=5;
1160
+ elseif($c >= 240) $bits=4;
1161
+ elseif($c >= 224) $bits=3;
1162
+ elseif($c >= 192) $bits=2;
1163
+ else return false;
1164
+ if(($i+$bits) > $len) return false;
1165
+ while($bits > 1){
1166
+ $i++;
1167
+ $b=ord($str[$i]);
1168
+ if($b < 128 || $b > 191) return false;
1169
+ $bits--;
1170
+ }
1171
+ }
1172
+ }
1173
+ return true;
1174
+ }
1175
+
1176
+ /**
1177
+ * Converts to and from JSON format.
1178
+ *
1179
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
1180
+ * format. It is easy for humans to read and write. It is easy for machines
1181
+ * to parse and generate. It is based on a subset of the JavaScript
1182
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
1183
+ * This feature can also be found in Python. JSON is a text format that is
1184
+ * completely language independent but uses conventions that are familiar
1185
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
1186
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
1187
+ * ideal data-interchange language.
1188
+ *
1189
+ * This package provides a simple encoder and decoder for JSON notation. It
1190
+ * is intended for use with client-side Javascript applications that make
1191
+ * use of HTTPRequest to perform server communication functions - data can
1192
+ * be encoded into JSON notation for use in a client-side javascript, or
1193
+ * decoded from incoming Javascript requests. JSON format is native to
1194
+ * Javascript, and can be directly eval()'ed with no further parsing
1195
+ * overhead
1196
+ *
1197
+ * All strings should be in ASCII or UTF-8 format!
1198
+ *
1199
+ * LICENSE: Redistribution and use in source and binary forms, with or
1200
+ * without modification, are permitted provided that the following
1201
+ * conditions are met: Redistributions of source code must retain the
1202
+ * above copyright notice, this list of conditions and the following
1203
+ * disclaimer. Redistributions in binary form must reproduce the above
1204
+ * copyright notice, this list of conditions and the following disclaimer
1205
+ * in the documentation and/or other materials provided with the
1206
+ * distribution.
1207
+ *
1208
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1209
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1210
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1211
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1212
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1213
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
1214
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1215
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
1216
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1217
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1218
+ * DAMAGE.
1219
+ *
1220
+ * @category
1221
+ * @package Services_JSON
1222
+ * @author Michal Migurski <mike-json@teczno.com>
1223
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
1224
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
1225
+ * @author Christoph Dorn <christoph@christophdorn.com>
1226
+ * @copyright 2005 Michal Migurski
1227
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
1228
+ * @license http://www.opensource.org/licenses/bsd-license.php
1229
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
1230
+ */
1231
+
1232
+
1233
+ /**
1234
+ * Keep a list of objects as we descend into the array so we can detect recursion.
1235
+ */
1236
+ private $json_objectStack = array();
1237
+
1238
+
1239
+ /**
1240
+ * convert a string from one UTF-8 char to one UTF-16 char
1241
+ *
1242
+ * Normally should be handled by mb_convert_encoding, but
1243
+ * provides a slower PHP-only method for installations
1244
+ * that lack the multibye string extension.
1245
+ *
1246
+ * @param string $utf8 UTF-8 character
1247
+ * @return string UTF-16 character
1248
+ * @access private
1249
+ */
1250
+ private function json_utf82utf16($utf8)
1251
+ {
1252
+ // oh please oh please oh please oh please oh please
1253
+ if(function_exists('mb_convert_encoding')) {
1254
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
1255
+ }
1256
+
1257
+ switch(strlen($utf8)) {
1258
+ case 1:
1259
+ // this case should never be reached, because we are in ASCII range
1260
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1261
+ return $utf8;
1262
+
1263
+ case 2:
1264
+ // return a UTF-16 character from a 2-byte UTF-8 char
1265
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1266
+ return chr(0x07 & (ord($utf8{0}) >> 2))
1267
+ . chr((0xC0 & (ord($utf8{0}) << 6))
1268
+ | (0x3F & ord($utf8{1})));
1269
+
1270
+ case 3:
1271
+ // return a UTF-16 character from a 3-byte UTF-8 char
1272
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1273
+ return chr((0xF0 & (ord($utf8{0}) << 4))
1274
+ | (0x0F & (ord($utf8{1}) >> 2)))
1275
+ . chr((0xC0 & (ord($utf8{1}) << 6))
1276
+ | (0x7F & ord($utf8{2})));
1277
+ }
1278
+
1279
+ // ignoring UTF-32 for now, sorry
1280
+ return '';
1281
+ }
1282
+
1283
+ /**
1284
+ * encodes an arbitrary variable into JSON format
1285
+ *
1286
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
1287
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
1288
+ * if var is a strng, note that encode() always expects it
1289
+ * to be in ASCII or UTF-8 format!
1290
+ *
1291
+ * @return mixed JSON string representation of input var or an error if a problem occurs
1292
+ * @access public
1293
+ */
1294
+ private function json_encode($var)
1295
+ {
1296
+
1297
+ if(is_object($var)) {
1298
+ if(in_array($var,$this->json_objectStack)) {
1299
+ return '"** Recursion **"';
1300
+ }
1301
+ }
1302
+
1303
+ switch (gettype($var)) {
1304
+ case 'boolean':
1305
+ return $var ? 'true' : 'false';
1306
+
1307
+ case 'NULL':
1308
+ return 'null';
1309
+
1310
+ case 'integer':
1311
+ return (int) $var;
1312
+
1313
+ case 'double':
1314
+ case 'float':
1315
+ return (float) $var;
1316
+
1317
+ case 'string':
1318
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
1319
+ $ascii = '';
1320
+ $strlen_var = strlen($var);
1321
+
1322
+ /*
1323
+ * Iterate over every character in the string,
1324
+ * escaping with a slash or encoding to UTF-8 where necessary
1325
+ */
1326
+ for ($c = 0; $c < $strlen_var; ++$c) {
1327
+
1328
+ $ord_var_c = ord($var{$c});
1329
+
1330
+ switch (true) {
1331
+ case $ord_var_c == 0x08:
1332
+ $ascii .= '\b';
1333
+ break;
1334
+ case $ord_var_c == 0x09:
1335
+ $ascii .= '\t';
1336
+ break;
1337
+ case $ord_var_c == 0x0A:
1338
+ $ascii .= '\n';
1339
+ break;
1340
+ case $ord_var_c == 0x0C:
1341
+ $ascii .= '\f';
1342
+ break;
1343
+ case $ord_var_c == 0x0D:
1344
+ $ascii .= '\r';
1345
+ break;
1346
+
1347
+ case $ord_var_c == 0x22:
1348
+ case $ord_var_c == 0x2F:
1349
+ case $ord_var_c == 0x5C:
1350
+ // double quote, slash, slosh
1351
+ $ascii .= '\\'.$var{$c};
1352
+ break;
1353
+
1354
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
1355
+ // characters U-00000000 - U-0000007F (same as ASCII)
1356
+ $ascii .= $var{$c};
1357
+ break;
1358
+
1359
+ case (($ord_var_c & 0xE0) == 0xC0):
1360
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
1361
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1362
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
1363
+ $c += 1;
1364
+ $utf16 = $this->json_utf82utf16($char);
1365
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1366
+ break;
1367
+
1368
+ case (($ord_var_c & 0xF0) == 0xE0):
1369
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
1370
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1371
+ $char = pack('C*', $ord_var_c,
1372
+ ord($var{$c + 1}),
1373
+ ord($var{$c + 2}));
1374
+ $c += 2;
1375
+ $utf16 = $this->json_utf82utf16($char);
1376
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1377
+ break;
1378
+
1379
+ case (($ord_var_c & 0xF8) == 0xF0):
1380
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
1381
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1382
+ $char = pack('C*', $ord_var_c,
1383
+ ord($var{$c + 1}),
1384
+ ord($var{$c + 2}),
1385
+ ord($var{$c + 3}));
1386
+ $c += 3;
1387
+ $utf16 = $this->json_utf82utf16($char);
1388
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1389
+ break;
1390
+
1391
+ case (($ord_var_c & 0xFC) == 0xF8):
1392
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
1393
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1394
+ $char = pack('C*', $ord_var_c,
1395
+ ord($var{$c + 1}),
1396
+ ord($var{$c + 2}),
1397
+ ord($var{$c + 3}),
1398
+ ord($var{$c + 4}));
1399
+ $c += 4;
1400
+ $utf16 = $this->json_utf82utf16($char);
1401
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1402
+ break;
1403
+
1404
+ case (($ord_var_c & 0xFE) == 0xFC):
1405
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
1406
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1407
+ $char = pack('C*', $ord_var_c,
1408
+ ord($var{$c + 1}),
1409
+ ord($var{$c + 2}),
1410
+ ord($var{$c + 3}),
1411
+ ord($var{$c + 4}),
1412
+ ord($var{$c + 5}));
1413
+ $c += 5;
1414
+ $utf16 = $this->json_utf82utf16($char);
1415
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1416
+ break;
1417
+ }
1418
+ }
1419
+
1420
+ return '"'.$ascii.'"';
1421
+
1422
+ case 'array':
1423
+ /*
1424
+ * As per JSON spec if any array key is not an integer
1425
+ * we must treat the the whole array as an object. We
1426
+ * also try to catch a sparsely populated associative
1427
+ * array with numeric keys here because some JS engines
1428
+ * will create an array with empty indexes up to
1429
+ * max_index which can cause memory issues and because
1430
+ * the keys, which may be relevant, will be remapped
1431
+ * otherwise.
1432
+ *
1433
+ * As per the ECMA and JSON specification an object may
1434
+ * have any string as a property. Unfortunately due to
1435
+ * a hole in the ECMA specification if the key is a
1436
+ * ECMA reserved word or starts with a digit the
1437
+ * parameter is only accessible using ECMAScript's
1438
+ * bracket notation.
1439
+ */
1440
+
1441
+ // treat as a JSON object
1442
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
1443
+
1444
+ $this->json_objectStack[] = $var;
1445
+
1446
+ $properties = array_map(array($this, 'json_name_value'),
1447
+ array_keys($var),
1448
+ array_values($var));
1449
+
1450
+ array_pop($this->json_objectStack);
1451
+
1452
+ foreach($properties as $property) {
1453
+ if($property instanceof Exception) {
1454
+ return $property;
1455
+ }
1456
+ }
1457
+
1458
+ return '{' . join(',', $properties) . '}';
1459
+ }
1460
+
1461
+ $this->json_objectStack[] = $var;
1462
+
1463
+ // treat it like a regular array
1464
+ $elements = array_map(array($this, 'json_encode'), $var);
1465
+
1466
+ array_pop($this->json_objectStack);
1467
+
1468
+ foreach($elements as $element) {
1469
+ if($element instanceof Exception) {
1470
+ return $element;
1471
+ }
1472
+ }
1473
+
1474
+ return '[' . join(',', $elements) . ']';
1475
+
1476
+ case 'object':
1477
+ $vars = self::encodeObject($var);
1478
+
1479
+ $this->json_objectStack[] = $var;
1480
+
1481
+ $properties = array_map(array($this, 'json_name_value'),
1482
+ array_keys($vars),
1483
+ array_values($vars));
1484
+
1485
+ array_pop($this->json_objectStack);
1486
+
1487
+ foreach($properties as $property) {
1488
+ if($property instanceof Exception) {
1489
+ return $property;
1490
+ }
1491
+ }
1492
+
1493
+ return '{' . join(',', $properties) . '}';
1494
+
1495
+ default:
1496
+ return null;
1497
+ }
1498
+ }
1499
+
1500
+ /**
1501
+ * array-walking function for use in generating JSON-formatted name-value pairs
1502
+ *
1503
+ * @param string $name name of key to use
1504
+ * @param mixed $value reference to an array element to be encoded
1505
+ *
1506
+ * @return string JSON-formatted name-value pair, like '"name":value'
1507
+ * @access private
1508
+ */
1509
+ private function json_name_value($name, $value)
1510
+ {
1511
+ // Encoding the $GLOBALS PHP array causes an infinite loop
1512
+ // if the recursion is not reset here as it contains
1513
+ // a reference to itself. This is the only way I have come up
1514
+ // with to stop infinite recursion in this case.
1515
+ if($name=='GLOBALS'
1516
+ && is_array($value)
1517
+ && array_key_exists('GLOBALS',$value)) {
1518
+ $value['GLOBALS'] = '** Recursion **';
1519
+ }
1520
+
1521
+ $encoded_value = $this->json_encode($value);
1522
+
1523
+ if($encoded_value instanceof Exception) {
1524
+ return $encoded_value;
1525
+ }
1526
+
1527
+ return $this->json_encode(strval($name)) . ':' . $encoded_value;
1528
+ }
1529
+ }
trunk/FirePHPCore/FirePHP.class.php4 ADDED
@@ -0,0 +1,1292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * *** BEGIN LICENSE BLOCK *****
4
+ *
5
+ * This file is part of FirePHP (http://www.firephp.org/).
6
+ *
7
+ * Software License Agreement (New BSD License)
8
+ *
9
+ * Copyright (c) 2006-2009, Christoph Dorn
10
+ * All rights reserved.
11
+ *
12
+ * Redistribution and use in source and binary forms, with or without modification,
13
+ * are permitted provided that the following conditions are met:
14
+ *
15
+ * * Redistributions of source code must retain the above copyright notice,
16
+ * this list of conditions and the following disclaimer.
17
+ *
18
+ * * Redistributions in binary form must reproduce the above copyright notice,
19
+ * this list of conditions and the following disclaimer in the documentation
20
+ * and/or other materials provided with the distribution.
21
+ *
22
+ * * Neither the name of Christoph Dorn nor the names of its
23
+ * contributors may be used to endorse or promote products derived from this
24
+ * software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ *
37
+ * ***** END LICENSE BLOCK *****
38
+ *
39
+ * This verion of FirePHPCore is for use with PHP4. If you do not require PHP4
40
+ * compatibility, it is suggested you use FirePHPCore.class.php instead.
41
+ *
42
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
43
+ * @author Christoph Dorn <christoph@christophdorn.com>
44
+ * @author Michael Day <manveru.alma@gmail.com>
45
+ * @license http://www.opensource.org/licenses/bsd-license.php
46
+ * @package FirePHP
47
+ */
48
+
49
+ /**
50
+ * FirePHP version
51
+ *
52
+ * @var string
53
+ */
54
+ define('FirePHP_VERSION', '0.3');
55
+
56
+ /**
57
+ * Firebug LOG level
58
+ *
59
+ * Logs a message to firebug console
60
+ *
61
+ * @var string
62
+ */
63
+ define('FirePHP_LOG', 'LOG');
64
+
65
+ /**
66
+ * Firebug INFO level
67
+ *
68
+ * Logs a message to firebug console and displays an info icon before the message
69
+ *
70
+ * @var string
71
+ */
72
+ define('FirePHP_INFO', 'INFO');
73
+
74
+ /**
75
+ * Firebug WARN level
76
+ *
77
+ * Logs a message to firebug console, displays a warning icon before the message and colors the line turquoise
78
+ *
79
+ * @var string
80
+ */
81
+ define('FirePHP_WARN', 'WARN');
82
+
83
+ /**
84
+ * Firebug ERROR level
85
+ *
86
+ * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
87
+ *
88
+ * @var string
89
+ */
90
+ define('FirePHP_ERROR', 'ERROR');
91
+
92
+ /**
93
+ * Dumps a variable to firebug's server panel
94
+ *
95
+ * @var string
96
+ */
97
+ define('FirePHP_DUMP', 'DUMP');
98
+
99
+ /**
100
+ * Displays a stack trace in firebug console
101
+ *
102
+ * @var string
103
+ */
104
+ define('FirePHP_TRACE', 'TRACE');
105
+
106
+ /**
107
+ * Displays a table in firebug console
108
+ *
109
+ * @var string
110
+ */
111
+ define('FirePHP_TABLE', 'TABLE');
112
+
113
+ /**
114
+ * Starts a group in firebug console
115
+ *
116
+ * @var string
117
+ */
118
+ define('FirePHP_GROUP_START', 'GROUP_START');
119
+
120
+ /**
121
+ * Ends a group in firebug console
122
+ *
123
+ * @var string
124
+ */
125
+ define('FirePHP_GROUP_END', 'GROUP_END');
126
+
127
+ /**
128
+ * Sends the given data to the FirePHP Firefox Extension.
129
+ * The data can be displayed in the Firebug Console or in the
130
+ * "Server" request tab.
131
+ *
132
+ * For more information see: http://www.firephp.org/
133
+ *
134
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
135
+ * @author Christoph Dorn <christoph@christophdorn.com>
136
+ * @author Michael Day <manveru.alma@gmail.com>
137
+ * @license http://www.opensource.org/licenses/bsd-license.php
138
+ * @package FirePHP
139
+ */
140
+ class FirePHP {
141
+ /**
142
+ * Wildfire protocol message index
143
+ *
144
+ * @var int
145
+ */
146
+ var $messageIndex = 1;
147
+
148
+ /**
149
+ * Options for the library
150
+ *
151
+ * @var array
152
+ */
153
+ var $options = array('maxObjectDepth' => 10,
154
+ 'maxArrayDepth' => 20,
155
+ 'useNativeJsonEncode' => true,
156
+ 'includeLineNumbers' => true);
157
+
158
+ /**
159
+ * Filters used to exclude object members when encoding
160
+ *
161
+ * @var array
162
+ */
163
+ var $objectFilters = array();
164
+
165
+ /**
166
+ * A stack of objects used to detect recursion during object encoding
167
+ *
168
+ * @var object
169
+ */
170
+ var $objectStack = array();
171
+
172
+ /**
173
+ * Flag to enable/disable logging
174
+ *
175
+ * @var boolean
176
+ */
177
+ var $enabled = true;
178
+
179
+ /**
180
+ * The object constructor
181
+ */
182
+ function FirePHP() {
183
+ }
184
+
185
+
186
+ /**
187
+ * When the object gets serialized only include specific object members.
188
+ *
189
+ * @return array
190
+ */
191
+ function __sleep() {
192
+ return array('options','objectFilters','enabled');
193
+ }
194
+
195
+ /**
196
+ * Gets singleton instance of FirePHP
197
+ *
198
+ * @param boolean $AutoCreate
199
+ * @return FirePHP
200
+ */
201
+ function &getInstance($AutoCreate=false) {
202
+ global $FirePHP_Instance;
203
+
204
+ if($AutoCreate===true && !$FirePHP_Instance) {
205
+ $FirePHP_Instance = new FirePHP();
206
+ }
207
+
208
+ return $FirePHP_Instance;
209
+ }
210
+
211
+ /**
212
+ * Enable and disable logging to Firebug
213
+ *
214
+ * @param boolean $Enabled TRUE to enable, FALSE to disable
215
+ * @return void
216
+ */
217
+ function setEnabled($Enabled) {
218
+ $this->enabled = $Enabled;
219
+ }
220
+
221
+ /**
222
+ * Check if logging is enabled
223
+ *
224
+ * @return boolean TRUE if enabled
225
+ */
226
+ function getEnabled() {
227
+ return $this->enabled;
228
+ }
229
+
230
+ /**
231
+ * Specify a filter to be used when encoding an object
232
+ *
233
+ * Filters are used to exclude object members.
234
+ *
235
+ * @param string $Class The class name of the object
236
+ * @param array $Filter An array of members to exclude
237
+ * @return void
238
+ */
239
+ function setObjectFilter($Class, $Filter) {
240
+ $this->objectFilters[strtolower($Class)] = $Filter;
241
+ }
242
+
243
+ /**
244
+ * Set some options for the library
245
+ *
246
+ * Options:
247
+ * - maxObjectDepth: The maximum depth to traverse objects (default: 10)
248
+ * - maxArrayDepth: The maximum depth to traverse arrays (default: 20)
249
+ * - useNativeJsonEncode: If true will use json_encode() (default: true)
250
+ * - includeLineNumbers: If true will include line numbers and filenames (default: true)
251
+ *
252
+ * @param array $Options The options to be set
253
+ * @return void
254
+ */
255
+ function setOptions($Options) {
256
+ $this->options = array_merge($this->options,$Options);
257
+ }
258
+
259
+ /**
260
+ * Get options from the library
261
+ *
262
+ * @return array The currently set options
263
+ */
264
+ function getOptions() {
265
+ return $this->options;
266
+ }
267
+
268
+ /**
269
+ * Register FirePHP as your error handler
270
+ *
271
+ * Will use FirePHP to log each php error.
272
+ *
273
+ * @return mixed Returns a string containing the previously defined error handler (if any)
274
+ */
275
+ function registerErrorHandler()
276
+ {
277
+ //NOTE: The following errors will not be caught by this error handler:
278
+ // E_ERROR, E_PARSE, E_CORE_ERROR,
279
+ // E_CORE_WARNING, E_COMPILE_ERROR,
280
+ // E_COMPILE_WARNING, E_STRICT
281
+
282
+ return set_error_handler(array($this,'errorHandler'));
283
+ }
284
+
285
+ /**
286
+ * FirePHP's error handler
287
+ *
288
+ * Logs each php error that will occur.
289
+ *
290
+ * @param int $errno
291
+ * @param string $errstr
292
+ * @param string $errfile
293
+ * @param int $errline
294
+ * @param array $errcontext
295
+ */
296
+ function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
297
+ {
298
+ global $FirePHP_Instance;
299
+ // Don't log error if error reporting is switched off
300
+ if (error_reporting() == 0) {
301
+ return;
302
+ }
303
+ // Only log error for errors we are asking for
304
+ if (error_reporting() & $errno) {
305
+ $FirePHP_Instance->group($errstr);
306
+ $FirePHP_Instance->error("{$errfile}, line $errline");
307
+ $FirePHP_Instance->groupEnd();
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Register FirePHP driver as your assert callback
313
+ *
314
+ * @return mixed Returns the original setting
315
+ */
316
+ function registerAssertionHandler()
317
+ {
318
+ return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
319
+ }
320
+
321
+ /**
322
+ * FirePHP's assertion handler
323
+ *
324
+ * Logs all assertions to your firebug console and then stops the script.
325
+ *
326
+ * @param string $file File source of assertion
327
+ * @param int $line Line source of assertion
328
+ * @param mixed $code Assertion code
329
+ */
330
+ function assertionHandler($file, $line, $code)
331
+ {
332
+ $this->fb($code, 'Assertion Failed', FirePHP_ERROR, array('File'=>$file,'Line'=>$line));
333
+ }
334
+
335
+ /**
336
+ * Set custom processor url for FirePHP
337
+ *
338
+ * @param string $URL
339
+ */
340
+ function setProcessorUrl($URL)
341
+ {
342
+ $this->setHeader('X-FirePHP-ProcessorURL', $URL);
343
+ }
344
+
345
+ /**
346
+ * Set custom renderer url for FirePHP
347
+ *
348
+ * @param string $URL
349
+ */
350
+ function setRendererUrl($URL)
351
+ {
352
+ $this->setHeader('X-FirePHP-RendererURL', $URL);
353
+ }
354
+
355
+ /**
356
+ * Start a group for following messages.
357
+ *
358
+ * Options:
359
+ * Collapsed: [true|false]
360
+ * Color: [#RRGGBB|ColorName]
361
+ *
362
+ * @param string $Name
363
+ * @param array $Options OPTIONAL Instructions on how to log the group
364
+ * @return true
365
+ * @throws Exception
366
+ */
367
+ function group($Name, $Options=null) {
368
+
369
+ if(!$Name) {
370
+ trigger_error('You must specify a label for the group!');
371
+ }
372
+
373
+ if($Options) {
374
+ if(!is_array($Options)) {
375
+ trigger_error('Options must be defined as an array!');
376
+ }
377
+ if(array_key_exists('Collapsed', $Options)) {
378
+ $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';
379
+ }
380
+ }
381
+
382
+ return $this->fb(null, $Name, FirePHP_GROUP_START, $Options);
383
+ }
384
+
385
+ /**
386
+ * Ends a group you have started before
387
+ *
388
+ * @return true
389
+ * @throws Exception
390
+ */
391
+ function groupEnd() {
392
+ return $this->fb(null, null, FirePHP_GROUP_END);
393
+ }
394
+
395
+ /**
396
+ * Log object with label to firebug console
397
+ *
398
+ * @see FirePHP::LOG
399
+ * @param mixes $Object
400
+ * @param string $Label
401
+ * @return true
402
+ * @throws Exception
403
+ */
404
+ function log($Object, $Label=null) {
405
+ return $this->fb($Object, $Label, FirePHP_LOG);
406
+ }
407
+
408
+ /**
409
+ * Log object with label to firebug console
410
+ *
411
+ * @see FirePHP::INFO
412
+ * @param mixes $Object
413
+ * @param string $Label
414
+ * @return true
415
+ * @throws Exception
416
+ */
417
+ function info($Object, $Label=null) {
418
+ return $this->fb($Object, $Label, FirePHP_INFO);
419
+ }
420
+
421
+ /**
422
+ * Log object with label to firebug console
423
+ *
424
+ * @see FirePHP::WARN
425
+ * @param mixes $Object
426
+ * @param string $Label
427
+ * @return true
428
+ * @throws Exception
429
+ */
430
+ function warn($Object, $Label=null) {
431
+ return $this->fb($Object, $Label, FirePHP_WARN);
432
+ }
433
+
434
+ /**
435
+ * Log object with label to firebug console
436
+ *
437
+ * @see FirePHP::ERROR
438
+ * @param mixes $Object
439
+ * @param string $Label
440
+ * @return true
441
+ * @throws Exception
442
+ */
443
+ function error($Object, $Label=null) {
444
+ return $this->fb($Object, $Label, FirePHP_ERROR);
445
+ }
446
+
447
+ /**
448
+ * Dumps key and variable to firebug server panel
449
+ *
450
+ * @see FirePHP::DUMP
451
+ * @param string $Key
452
+ * @param mixed $Variable
453
+ * @return true
454
+ * @throws Exception
455
+ */
456
+ function dump($Key, $Variable) {
457
+ return $this->fb($Variable, $Key, FirePHP_DUMP);
458
+ }
459
+
460
+ /**
461
+ * Log a trace in the firebug console
462
+ *
463
+ * @see FirePHP::TRACE
464
+ * @param string $Label
465
+ * @return true
466
+ * @throws Exception
467
+ */
468
+ function trace($Label) {
469
+ return $this->fb($Label, FirePHP_TRACE);
470
+ }
471
+
472
+ /**
473
+ * Log a table in the firebug console
474
+ *
475
+ * @see FirePHP::TABLE
476
+ * @param string $Label
477
+ * @param string $Table
478
+ * @return true
479
+ * @throws Exception
480
+ */
481
+ function table($Label, $Table) {
482
+ return $this->fb($Table, $Label, FirePHP_TABLE);
483
+ }
484
+
485
+ /**
486
+ * Check if FirePHP is installed on client
487
+ *
488
+ * @return boolean
489
+ */
490
+ function detectClientExtension() {
491
+ /* Check if FirePHP is installed on client */
492
+ if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) ||
493
+ !version_compare($m[1][0],'0.0.6','>=')) {
494
+ return false;
495
+ }
496
+ return true;
497
+ }
498
+
499
+ /**
500
+ * Log varible to Firebug
501
+ *
502
+ * @see http://www.firephp.org/Wiki/Reference/Fb
503
+ * @param mixed $Object The variable to be logged
504
+ * @return true Return TRUE if message was added to headers, FALSE otherwise
505
+ * @throws Exception
506
+ */
507
+ function fb($Object) {
508
+
509
+ if(!$this->enabled) {
510
+ return false;
511
+ }
512
+
513
+ if (headers_sent($filename, $linenum)) {
514
+ trigger_error('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
515
+ }
516
+
517
+ $Type = null;
518
+ $Label = null;
519
+ $Options = array();
520
+
521
+ if(func_num_args()==1) {
522
+ } else
523
+ if(func_num_args()==2) {
524
+ switch(func_get_arg(1)) {
525
+ case FirePHP_LOG:
526
+ case FirePHP_INFO:
527
+ case FirePHP_WARN:
528
+ case FirePHP_ERROR:
529
+ case FirePHP_DUMP:
530
+ case FirePHP_TRACE:
531
+ case FirePHP_TABLE:
532
+ case FirePHP_GROUP_START:
533
+ case FirePHP_GROUP_END:
534
+ $Type = func_get_arg(1);
535
+ break;
536
+ default:
537
+ $Label = func_get_arg(1);
538
+ break;
539
+ }
540
+ } else
541
+ if(func_num_args()==3) {
542
+ $Type = func_get_arg(2);
543
+ $Label = func_get_arg(1);
544
+ } else
545
+ if(func_num_args()==4) {
546
+ $Type = func_get_arg(2);
547
+ $Label = func_get_arg(1);
548
+ $Options = func_get_arg(3);
549
+ } else {
550
+ trigger_error('Wrong number of arguments to fb() function!');
551
+ }
552
+
553
+
554
+ if(!$this->detectClientExtension()) {
555
+ return false;
556
+ }
557
+
558
+ $meta = array();
559
+ $skipFinalObjectEncode = false;
560
+
561
+ if($Type==FirePHP_TRACE) {
562
+
563
+ $trace = debug_backtrace();
564
+ if(!$trace) return false;
565
+ for( $i=0 ; $i<sizeof($trace) ; $i++ ) {
566
+
567
+ if(isset($trace[$i]['class'])
568
+ && isset($trace[$i]['file'])
569
+ && ($trace[$i]['class']=='FirePHP'
570
+ || $trace[$i]['class']=='FB')
571
+ && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
572
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
573
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
574
+ } else
575
+ if(isset($trace[$i]['class'])
576
+ && isset($trace[$i+1]['file'])
577
+ && $trace[$i]['class']=='FirePHP'
578
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
579
+ /* Skip fb() */
580
+ } else
581
+ if($trace[$i]['function']=='fb'
582
+ || $trace[$i]['function']=='trace'
583
+ || $trace[$i]['function']=='send') {
584
+ $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',
585
+ 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',
586
+ 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',
587
+ 'Message'=>$trace[$i]['args'][0],
588
+ 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',
589
+ 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',
590
+ 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',
591
+ 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));
592
+
593
+ $skipFinalObjectEncode = true;
594
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
595
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
596
+ break;
597
+ }
598
+ }
599
+
600
+ } else
601
+ if($Type==FirePHP_TABLE) {
602
+
603
+ if(isset($Object[0]) && is_string($Object[0])) {
604
+ $Object[1] = $this->encodeTable($Object[1]);
605
+ } else {
606
+ $Object = $this->encodeTable($Object);
607
+ }
608
+
609
+ $skipFinalObjectEncode = true;
610
+
611
+ } else
612
+ if($Type==FirePHP_GROUP_START) {
613
+
614
+ if(!$Label) {
615
+ trigger_error('You must specify a label for the group!');
616
+ }
617
+ } else {
618
+ if($Type===null) {
619
+ $Type = FirePHP_LOG;
620
+ }
621
+ }
622
+
623
+ if($this->options['includeLineNumbers']) {
624
+ if(!isset($meta['file']) || !isset($meta['line'])) {
625
+
626
+ $trace = debug_backtrace();
627
+ for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) {
628
+
629
+ if(isset($trace[$i]['class'])
630
+ && isset($trace[$i]['file'])
631
+ && ($trace[$i]['class']=='FirePHP'
632
+ || $trace[$i]['class']=='FB')
633
+ && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
634
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
635
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
636
+ } else
637
+ if(isset($trace[$i]['class'])
638
+ && isset($trace[$i+1]['file'])
639
+ && $trace[$i]['class']=='FirePHP'
640
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
641
+ /* Skip fb() */
642
+ } else
643
+ if(isset($trace[$i]['file'])
644
+ && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {
645
+ /* Skip FB::fb() */
646
+ } else {
647
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
648
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
649
+ break;
650
+ }
651
+ }
652
+
653
+ }
654
+ } else {
655
+ unset($meta['file']);
656
+ unset($meta['line']);
657
+ }
658
+
659
+ $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
660
+ $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.FirePHP_VERSION);
661
+
662
+ $structure_index = 1;
663
+ if($Type==FirePHP_DUMP) {
664
+ $structure_index = 2;
665
+ $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
666
+ } else {
667
+ $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
668
+ }
669
+
670
+ if($Type==FirePHP_DUMP) {
671
+ $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';
672
+ } else {
673
+ $msg_meta = $Options;
674
+ $msg_meta['Type'] = $Type;
675
+ if($Label!==null) {
676
+ $msg_meta['Label'] = $Label;
677
+ }
678
+ if(isset($meta['file']) && !isset($msg_meta['File'])) {
679
+ $msg_meta['File'] = $meta['file'];
680
+ }
681
+ if(isset($meta['line']) && !isset($msg_meta['Line'])) {
682
+ $msg_meta['Line'] = $meta['line'];
683
+ }
684
+ $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';
685
+ }
686
+
687
+ $parts = explode("\n",chunk_split($msg, 5000, "\n"));
688
+
689
+ for( $i=0 ; $i<count($parts) ; $i++) {
690
+
691
+ $part = $parts[$i];
692
+ if ($part) {
693
+
694
+ if(count($parts)>2) {
695
+ // Message needs to be split into multiple parts
696
+ $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
697
+ (($i==0)?strlen($msg):'')
698
+ . '|' . $part . '|'
699
+ . (($i<count($parts)-2)?'\\':''));
700
+ } else {
701
+ $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
702
+ strlen($part) . '|' . $part . '|');
703
+ }
704
+
705
+ $this->messageIndex++;
706
+
707
+ if ($this->messageIndex > 99999) {
708
+ trigger_error('Maximum number (99,999) of messages reached!');
709
+ }
710
+ }
711
+ }
712
+
713
+ $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);
714
+
715
+ return true;
716
+ }
717
+
718
+
719
+ /**
720
+ * Standardizes path for windows systems.
721
+ *
722
+ * @param string $Path
723
+ * @return string
724
+ */
725
+ function _standardizePath($Path) {
726
+ return preg_replace('/\\\\+/','/',$Path);
727
+ }
728
+
729
+ /**
730
+ * Escape trace path for windows systems
731
+ *
732
+ * @param array $Trace
733
+ * @return array
734
+ */
735
+ function _escapeTrace($Trace) {
736
+ if(!$Trace) return $Trace;
737
+ for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {
738
+ if(isset($Trace[$i]['file'])) {
739
+ $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);
740
+ }
741
+ if(isset($Trace[$i]['args'])) {
742
+ $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);
743
+ }
744
+ }
745
+ return $Trace;
746
+ }
747
+
748
+ /**
749
+ * Escape file information of trace for windows systems
750
+ *
751
+ * @param string $File
752
+ * @return string
753
+ */
754
+ function _escapeTraceFile($File) {
755
+ /* Check if we have a windows filepath */
756
+ if(strpos($File,'\\')) {
757
+ /* First strip down to single \ */
758
+
759
+ $file = preg_replace('/\\\\+/','\\',$File);
760
+
761
+ return $file;
762
+ }
763
+ return $File;
764
+ }
765
+
766
+ /**
767
+ * Send header
768
+ *
769
+ * @param string $Name
770
+ * @param string_type $Value
771
+ */
772
+ function setHeader($Name, $Value) {
773
+ return header($Name.': '.$Value);
774
+ }
775
+
776
+ /**
777
+ * Get user agent
778
+ *
779
+ * @return string|false
780
+ */
781
+ function getUserAgent() {
782
+ if(!isset($_SERVER['HTTP_USER_AGENT'])) return false;
783
+ return $_SERVER['HTTP_USER_AGENT'];
784
+ }
785
+
786
+ /**
787
+ * Encode an object into a JSON string
788
+ *
789
+ * Uses PHP's jeson_encode() if available
790
+ *
791
+ * @param object $Object The object to be encoded
792
+ * @return string The JSON string
793
+ */
794
+ function jsonEncode($Object, $skipObjectEncode=false)
795
+ {
796
+ if(!$skipObjectEncode) {
797
+ $Object = $this->encodeObject($Object);
798
+ }
799
+
800
+ if(function_exists('json_encode')
801
+ && $this->options['useNativeJsonEncode']!=false) {
802
+
803
+ return json_encode($Object);
804
+ } else {
805
+ return $this->json_encode($Object);
806
+ }
807
+ }
808
+
809
+ /**
810
+ * Encodes a table by encoding each row and column with encodeObject()
811
+ *
812
+ * @param array $Table The table to be encoded
813
+ * @return array
814
+ */
815
+ function encodeTable($Table) {
816
+
817
+ if(!$Table) return $Table;
818
+
819
+ $new_table = array();
820
+ foreach($Table as $row) {
821
+
822
+ if(is_array($row)) {
823
+ $new_row = array();
824
+
825
+ foreach($row as $item) {
826
+ $new_row[] = $this->encodeObject($item);
827
+ }
828
+
829
+ $new_table[] = $new_row;
830
+ }
831
+ }
832
+
833
+ return $new_table;
834
+ }
835
+
836
+ /**
837
+ * Encodes an object
838
+ *
839
+ * @param Object $Object The object to be encoded
840
+ * @param int $Depth The current traversal depth
841
+ * @return array All members of the object
842
+ */
843
+ function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1)
844
+ {
845
+ $return = array();
846
+
847
+ if (is_resource($Object)) {
848
+
849
+ return '** '.(string)$Object.' **';
850
+
851
+ } else
852
+ if (is_object($Object)) {
853
+
854
+ if ($ObjectDepth > $this->options['maxObjectDepth']) {
855
+ return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';
856
+ }
857
+
858
+ foreach ($this->objectStack as $refVal) {
859
+ if ($refVal === $Object) {
860
+ return '** Recursion ('.get_class($Object).') **';
861
+ }
862
+ }
863
+ array_push($this->objectStack, $Object);
864
+
865
+ $return['__className'] = $class = get_class($Object);
866
+ $class_lower = strtolower($class);
867
+
868
+ $members = (array)$Object;
869
+
870
+ // Include all members that are not defined in the class
871
+ // but exist in the object
872
+ foreach( $members as $raw_name => $value ) {
873
+
874
+ $name = $raw_name;
875
+
876
+ if ($name{0} == "\0") {
877
+ $parts = explode("\0", $name);
878
+ $name = $parts[2];
879
+ }
880
+
881
+ if(!isset($properties[$name])) {
882
+ $name = 'undeclared:'.$name;
883
+
884
+ if(!(isset($this->objectFilters[$class_lower])
885
+ && is_array($this->objectFilters[$class_lower])
886
+ && in_array($raw_name,$this->objectFilters[$class_lower]))) {
887
+
888
+ $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1);
889
+ } else {
890
+ $return[$name] = '** Excluded by Filter **';
891
+ }
892
+ }
893
+ }
894
+
895
+ array_pop($this->objectStack);
896
+
897
+ } elseif (is_array($Object)) {
898
+
899
+ if ($ArrayDepth > $this->options['maxArrayDepth']) {
900
+ return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';
901
+ }
902
+
903
+ foreach ($Object as $key => $val) {
904
+
905
+ // Encoding the $GLOBALS PHP array causes an infinite loop
906
+ // if the recursion is not reset here as it contains
907
+ // a reference to itself. This is the only way I have come up
908
+ // with to stop infinite recursion in this case.
909
+ if($key=='GLOBALS'
910
+ && is_array($val)
911
+ && array_key_exists('GLOBALS',$val)) {
912
+ $val['GLOBALS'] = '** Recursion (GLOBALS) **';
913
+ }
914
+
915
+ $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1);
916
+ }
917
+ } else {
918
+ if($this->is_utf8($Object)) {
919
+ return $Object;
920
+ } else {
921
+ return utf8_encode($Object);
922
+ }
923
+ }
924
+ return $return;
925
+
926
+ }
927
+
928
+ /**
929
+ * Returns true if $string is valid UTF-8 and false otherwise.
930
+ *
931
+ * @param mixed $str String to be tested
932
+ * @return boolean
933
+ */
934
+ function is_utf8($str) {
935
+ $c=0; $b=0;
936
+ $bits=0;
937
+ $len=strlen($str);
938
+ for($i=0; $i<$len; $i++){
939
+ $c=ord($str[$i]);
940
+ if($c > 128){
941
+ if(($c >= 254)) return false;
942
+ elseif($c >= 252) $bits=6;
943
+ elseif($c >= 248) $bits=5;
944
+ elseif($c >= 240) $bits=4;
945
+ elseif($c >= 224) $bits=3;
946
+ elseif($c >= 192) $bits=2;
947
+ else return false;
948
+ if(($i+$bits) > $len) return false;
949
+ while($bits > 1){
950
+ $i++;
951
+ $b=ord($str[$i]);
952
+ if($b < 128 || $b > 191) return false;
953
+ $bits--;
954
+ }
955
+ }
956
+ }
957
+ return true;
958
+ }
959
+
960
+ /**
961
+ * Converts to and from JSON format.
962
+ *
963
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
964
+ * format. It is easy for humans to read and write. It is easy for machines
965
+ * to parse and generate. It is based on a subset of the JavaScript
966
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
967
+ * This feature can also be found in Python. JSON is a text format that is
968
+ * completely language independent but uses conventions that are familiar
969
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
970
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
971
+ * ideal data-interchange language.
972
+ *
973
+ * This package provides a simple encoder and decoder for JSON notation. It
974
+ * is intended for use with client-side Javascript applications that make
975
+ * use of HTTPRequest to perform server communication functions - data can
976
+ * be encoded into JSON notation for use in a client-side javascript, or
977
+ * decoded from incoming Javascript requests. JSON format is native to
978
+ * Javascript, and can be directly eval()'ed with no further parsing
979
+ * overhead
980
+ *
981
+ * All strings should be in ASCII or UTF-8 format!
982
+ *
983
+ * LICENSE: Redistribution and use in source and binary forms, with or
984
+ * without modification, are permitted provided that the following
985
+ * conditions are met: Redistributions of source code must retain the
986
+ * above copyright notice, this list of conditions and the following
987
+ * disclaimer. Redistributions in binary form must reproduce the above
988
+ * copyright notice, this list of conditions and the following disclaimer
989
+ * in the documentation and/or other materials provided with the
990
+ * distribution.
991
+ *
992
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
993
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
994
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
995
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
996
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
997
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
998
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
999
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
1000
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1001
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1002
+ * DAMAGE.
1003
+ *
1004
+ * @category
1005
+ * @package Services_JSON
1006
+ * @author Michal Migurski <mike-json@teczno.com>
1007
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
1008
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
1009
+ * @author Christoph Dorn <christoph@christophdorn.com>
1010
+ * @copyright 2005 Michal Migurski
1011
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
1012
+ * @license http://www.opensource.org/licenses/bsd-license.php
1013
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
1014
+ */
1015
+
1016
+
1017
+ /**
1018
+ * Keep a list of objects as we descend into the array so we can detect recursion.
1019
+ */
1020
+ var $json_objectStack = array();
1021
+
1022
+
1023
+ /**
1024
+ * convert a string from one UTF-8 char to one UTF-16 char
1025
+ *
1026
+ * Normally should be handled by mb_convert_encoding, but
1027
+ * provides a slower PHP-only method for installations
1028
+ * that lack the multibye string extension.
1029
+ *
1030
+ * @param string $utf8 UTF-8 character
1031
+ * @return string UTF-16 character
1032
+ * @access private
1033
+ */
1034
+ function json_utf82utf16($utf8)
1035
+ {
1036
+ // oh please oh please oh please oh please oh please
1037
+ if(function_exists('mb_convert_encoding')) {
1038
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
1039
+ }
1040
+
1041
+ switch(strlen($utf8)) {
1042
+ case 1:
1043
+ // this case should never be reached, because we are in ASCII range
1044
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1045
+ return $utf8;
1046
+
1047
+ case 2:
1048
+ // return a UTF-16 character from a 2-byte UTF-8 char
1049
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1050
+ return chr(0x07 & (ord($utf8{0}) >> 2))
1051
+ . chr((0xC0 & (ord($utf8{0}) << 6))
1052
+ | (0x3F & ord($utf8{1})));
1053
+
1054
+ case 3:
1055
+ // return a UTF-16 character from a 3-byte UTF-8 char
1056
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1057
+ return chr((0xF0 & (ord($utf8{0}) << 4))
1058
+ | (0x0F & (ord($utf8{1}) >> 2)))
1059
+ . chr((0xC0 & (ord($utf8{1}) << 6))
1060
+ | (0x7F & ord($utf8{2})));
1061
+ }
1062
+
1063
+ // ignoring UTF-32 for now, sorry
1064
+ return '';
1065
+ }
1066
+
1067
+ /**
1068
+ * encodes an arbitrary variable into JSON format
1069
+ *
1070
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
1071
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
1072
+ * if var is a strng, note that encode() always expects it
1073
+ * to be in ASCII or UTF-8 format!
1074
+ *
1075
+ * @return mixed JSON string representation of input var or an error if a problem occurs
1076
+ * @access public
1077
+ */
1078
+ function json_encode($var)
1079
+ {
1080
+
1081
+ if(is_object($var)) {
1082
+ if(in_array($var,$this->json_objectStack)) {
1083
+ return '"** Recursion **"';
1084
+ }
1085
+ }
1086
+
1087
+ switch (gettype($var)) {
1088
+ case 'boolean':
1089
+ return $var ? 'true' : 'false';
1090
+
1091
+ case 'NULL':
1092
+ return 'null';
1093
+
1094
+ case 'integer':
1095
+ return (int) $var;
1096
+
1097
+ case 'double':
1098
+ case 'float':
1099
+ return (float) $var;
1100
+
1101
+ case 'string':
1102
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
1103
+ $ascii = '';
1104
+ $strlen_var = strlen($var);
1105
+
1106
+ /*
1107
+ * Iterate over every character in the string,
1108
+ * escaping with a slash or encoding to UTF-8 where necessary
1109
+ */
1110
+ for ($c = 0; $c < $strlen_var; ++$c) {
1111
+
1112
+ $ord_var_c = ord($var{$c});
1113
+
1114
+ switch (true) {
1115
+ case $ord_var_c == 0x08:
1116
+ $ascii .= '\b';
1117
+ break;
1118
+ case $ord_var_c == 0x09:
1119
+ $ascii .= '\t';
1120
+ break;
1121
+ case $ord_var_c == 0x0A:
1122
+ $ascii .= '\n';
1123
+ break;
1124
+ case $ord_var_c == 0x0C:
1125
+ $ascii .= '\f';
1126
+ break;
1127
+ case $ord_var_c == 0x0D:
1128
+ $ascii .= '\r';
1129
+ break;
1130
+
1131
+ case $ord_var_c == 0x22:
1132
+ case $ord_var_c == 0x2F:
1133
+ case $ord_var_c == 0x5C:
1134
+ // double quote, slash, slosh
1135
+ $ascii .= '\\'.$var{$c};
1136
+ break;
1137
+
1138
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
1139
+ // characters U-00000000 - U-0000007F (same as ASCII)
1140
+ $ascii .= $var{$c};
1141
+ break;
1142
+
1143
+ case (($ord_var_c & 0xE0) == 0xC0):
1144
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
1145
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1146
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
1147
+ $c += 1;
1148
+ $utf16 = $this->json_utf82utf16($char);
1149
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1150
+ break;
1151
+
1152
+ case (($ord_var_c & 0xF0) == 0xE0):
1153
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
1154
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1155
+ $char = pack('C*', $ord_var_c,
1156
+ ord($var{$c + 1}),
1157
+ ord($var{$c + 2}));
1158
+ $c += 2;
1159
+ $utf16 = $this->json_utf82utf16($char);
1160
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1161
+ break;
1162
+
1163
+ case (($ord_var_c & 0xF8) == 0xF0):
1164
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
1165
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1166
+ $char = pack('C*', $ord_var_c,
1167
+ ord($var{$c + 1}),
1168
+ ord($var{$c + 2}),
1169
+ ord($var{$c + 3}));
1170
+ $c += 3;
1171
+ $utf16 = $this->json_utf82utf16($char);
1172
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1173
+ break;
1174
+
1175
+ case (($ord_var_c & 0xFC) == 0xF8):
1176
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
1177
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1178
+ $char = pack('C*', $ord_var_c,
1179
+ ord($var{$c + 1}),
1180
+ ord($var{$c + 2}),
1181
+ ord($var{$c + 3}),
1182
+ ord($var{$c + 4}));
1183
+ $c += 4;
1184
+ $utf16 = $this->json_utf82utf16($char);
1185
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1186
+ break;
1187
+
1188
+ case (($ord_var_c & 0xFE) == 0xFC):
1189
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
1190
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
1191
+ $char = pack('C*', $ord_var_c,
1192
+ ord($var{$c + 1}),
1193
+ ord($var{$c + 2}),
1194
+ ord($var{$c + 3}),
1195
+ ord($var{$c + 4}),
1196
+ ord($var{$c + 5}));
1197
+ $c += 5;
1198
+ $utf16 = $this->json_utf82utf16($char);
1199
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
1200
+ break;
1201
+ }
1202
+ }
1203
+
1204
+ return '"'.$ascii.'"';
1205
+
1206
+ case 'array':
1207
+ /*
1208
+ * As per JSON spec if any array key is not an integer
1209
+ * we must treat the the whole array as an object. We
1210
+ * also try to catch a sparsely populated associative
1211
+ * array with numeric keys here because some JS engines
1212
+ * will create an array with empty indexes up to
1213
+ * max_index which can cause memory issues and because
1214
+ * the keys, which may be relevant, will be remapped
1215
+ * otherwise.
1216
+ *
1217
+ * As per the ECMA and JSON specification an object may
1218
+ * have any string as a property. Unfortunately due to
1219
+ * a hole in the ECMA specification if the key is a
1220
+ * ECMA reserved word or starts with a digit the
1221
+ * parameter is only accessible using ECMAScript's
1222
+ * bracket notation.
1223
+ */
1224
+
1225
+ // treat as a JSON object
1226
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
1227
+
1228
+ $this->json_objectStack[] = $var;
1229
+
1230
+ $properties = array_map(array($this, 'json_name_value'),
1231
+ array_keys($var),
1232
+ array_values($var));
1233
+
1234
+ array_pop($this->json_objectStack);
1235
+
1236
+ return '{' . join(',', $properties) . '}';
1237
+ }
1238
+
1239
+ $this->json_objectStack[] = $var;
1240
+
1241
+ // treat it like a regular array
1242
+ $elements = array_map(array($this, 'json_encode'), $var);
1243
+
1244
+ array_pop($this->json_objectStack);
1245
+
1246
+ return '[' . join(',', $elements) . ']';
1247
+
1248
+ case 'object':
1249
+ $vars = FirePHP::encodeObject($var);
1250
+
1251
+ $this->json_objectStack[] = $var;
1252
+
1253
+ $properties = array_map(array($this, 'json_name_value'),
1254
+ array_keys($vars),
1255
+ array_values($vars));
1256
+
1257
+ array_pop($this->json_objectStack);
1258
+
1259
+ return '{' . join(',', $properties) . '}';
1260
+
1261
+ default:
1262
+ return null;
1263
+ }
1264
+ }
1265
+
1266
+ /**
1267
+ * array-walking function for use in generating JSON-formatted name-value pairs
1268
+ *
1269
+ * @param string $name name of key to use
1270
+ * @param mixed $value reference to an array element to be encoded
1271
+ *
1272
+ * @return string JSON-formatted name-value pair, like '"name":value'
1273
+ * @access private
1274
+ */
1275
+ function json_name_value($name, $value)
1276
+ {
1277
+ // Encoding the $GLOBALS PHP array causes an infinite loop
1278
+ // if the recursion is not reset here as it contains
1279
+ // a reference to itself. This is the only way I have come up
1280
+ // with to stop infinite recursion in this case.
1281
+ if($name=='GLOBALS'
1282
+ && is_array($value)
1283
+ && array_key_exists('GLOBALS',$value)) {
1284
+ $value['GLOBALS'] = '** Recursion **';
1285
+ }
1286
+
1287
+ $encoded_value = $this->json_encode($value);
1288
+
1289
+ return $this->json_encode(strval($name)) . ':' . $encoded_value;
1290
+ }
1291
+ }
1292
+
trunk/FirePHPCore/LICENSE ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Software License Agreement (New BSD License)
2
+
3
+ Copyright (c) 2006-2009, Christoph Dorn
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without modification,
7
+ are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Christoph Dorn nor the names of its
17
+ contributors may be used to endorse or promote products derived from this
18
+ software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
trunk/FirePHPCore/fb.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* ***** BEGIN LICENSE BLOCK *****
4
+ *
5
+ * This file is part of FirePHP (http://www.firephp.org/).
6
+ *
7
+ * Software License Agreement (New BSD License)
8
+ *
9
+ * Copyright (c) 2006-2009, Christoph Dorn
10
+ * All rights reserved.
11
+ *
12
+ * Redistribution and use in source and binary forms, with or without modification,
13
+ * are permitted provided that the following conditions are met:
14
+ *
15
+ * * Redistributions of source code must retain the above copyright notice,
16
+ * this list of conditions and the following disclaimer.
17
+ *
18
+ * * Redistributions in binary form must reproduce the above copyright notice,
19
+ * this list of conditions and the following disclaimer in the documentation
20
+ * and/or other materials provided with the distribution.
21
+ *
22
+ * * Neither the name of Christoph Dorn nor the names of its
23
+ * contributors may be used to endorse or promote products derived from this
24
+ * software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ *
37
+ * ***** END LICENSE BLOCK *****
38
+ *
39
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
40
+ * @author Christoph Dorn <christoph@christophdorn.com>
41
+ * @license http://www.opensource.org/licenses/bsd-license.php
42
+ * @package FirePHP
43
+ */
44
+
45
+ require_once dirname(__FILE__).'/FirePHP.class.php';
46
+
47
+ /**
48
+ * Sends the given data to the FirePHP Firefox Extension.
49
+ * The data can be displayed in the Firebug Console or in the
50
+ * "Server" request tab.
51
+ *
52
+ * @see http://www.firephp.org/Wiki/Reference/Fb
53
+ * @param mixed $Object
54
+ * @return true
55
+ * @throws Exception
56
+ */
57
+ function fb()
58
+ {
59
+ $instance = FirePHP::getInstance(true);
60
+
61
+ $args = func_get_args();
62
+ return call_user_func_array(array($instance,'fb'),$args);
63
+ }
64
+
65
+
66
+ class FB
67
+ {
68
+ /**
69
+ * Enable and disable logging to Firebug
70
+ *
71
+ * @see FirePHP->setEnabled()
72
+ * @param boolean $Enabled TRUE to enable, FALSE to disable
73
+ * @return void
74
+ */
75
+ public static function setEnabled($Enabled) {
76
+ $instance = FirePHP::getInstance(true);
77
+ $instance->setEnabled($Enabled);
78
+ }
79
+
80
+ /**
81
+ * Check if logging is enabled
82
+ *
83
+ * @see FirePHP->getEnabled()
84
+ * @return boolean TRUE if enabled
85
+ */
86
+ public static function getEnabled() {
87
+ $instance = FirePHP::getInstance(true);
88
+ return $instance->getEnabled();
89
+ }
90
+
91
+ /**
92
+ * Specify a filter to be used when encoding an object
93
+ *
94
+ * Filters are used to exclude object members.
95
+ *
96
+ * @see FirePHP->setObjectFilter()
97
+ * @param string $Class The class name of the object
98
+ * @param array $Filter An array or members to exclude
99
+ * @return void
100
+ */
101
+ public static function setObjectFilter($Class, $Filter) {
102
+ $instance = FirePHP::getInstance(true);
103
+ $instance->setObjectFilter($Class, $Filter);
104
+ }
105
+
106
+ /**
107
+ * Set some options for the library
108
+ *
109
+ * @see FirePHP->setOptions()
110
+ * @param array $Options The options to be set
111
+ * @return void
112
+ */
113
+ public static function setOptions($Options) {
114
+ $instance = FirePHP::getInstance(true);
115
+ $instance->setOptions($Options);
116
+ }
117
+
118
+ /**
119
+ * Get options for the library
120
+ *
121
+ * @see FirePHP->getOptions()
122
+ * @return array The options
123
+ */
124
+ public static function getOptions() {
125
+ $instance = FirePHP::getInstance(true);
126
+ return $instance->getOptions();
127
+ }
128
+
129
+ /**
130
+ * Log object to firebug
131
+ *
132
+ * @see http://www.firephp.org/Wiki/Reference/Fb
133
+ * @param mixed $Object
134
+ * @return true
135
+ * @throws Exception
136
+ */
137
+ public static function send()
138
+ {
139
+ $instance = FirePHP::getInstance(true);
140
+ $args = func_get_args();
141
+ return call_user_func_array(array($instance,'fb'),$args);
142
+ }
143
+
144
+ /**
145
+ * Start a group for following messages
146
+ *
147
+ * Options:
148
+ * Collapsed: [true|false]
149
+ * Color: [#RRGGBB|ColorName]
150
+ *
151
+ * @param string $Name
152
+ * @param array $Options OPTIONAL Instructions on how to log the group
153
+ * @return true
154
+ */
155
+ public static function group($Name, $Options=null) {
156
+ $instance = FirePHP::getInstance(true);
157
+ return $instance->group($Name, $Options);
158
+ }
159
+
160
+ /**
161
+ * Ends a group you have started before
162
+ *
163
+ * @return true
164
+ * @throws Exception
165
+ */
166
+ public static function groupEnd() {
167
+ return self::send(null, null, FirePHP::GROUP_END);
168
+ }
169
+
170
+ /**
171
+ * Log object with label to firebug console
172
+ *
173
+ * @see FirePHP::LOG
174
+ * @param mixes $Object
175
+ * @param string $Label
176
+ * @return true
177
+ * @throws Exception
178
+ */
179
+ public static function log($Object, $Label=null) {
180
+ return self::send($Object, $Label, FirePHP::LOG);
181
+ }
182
+
183
+ /**
184
+ * Log object with label to firebug console
185
+ *
186
+ * @see FirePHP::INFO
187
+ * @param mixes $Object
188
+ * @param string $Label
189
+ * @return true
190
+ * @throws Exception
191
+ */
192
+ public static function info($Object, $Label=null) {
193
+ return self::send($Object, $Label, FirePHP::INFO);
194
+ }
195
+
196
+ /**
197
+ * Log object with label to firebug console
198
+ *
199
+ * @see FirePHP::WARN
200
+ * @param mixes $Object
201
+ * @param string $Label
202
+ * @return true
203
+ * @throws Exception
204
+ */
205
+ public static function warn($Object, $Label=null) {
206
+ return self::send($Object, $Label, FirePHP::WARN);
207
+ }
208
+
209
+ /**
210
+ * Log object with label to firebug console
211
+ *
212
+ * @see FirePHP::ERROR
213
+ * @param mixes $Object
214
+ * @param string $Label
215
+ * @return true
216
+ * @throws Exception
217
+ */
218
+ public static function error($Object, $Label=null) {
219
+ return self::send($Object, $Label, FirePHP::ERROR);
220
+ }
221
+
222
+ /**
223
+ * Dumps key and variable to firebug server panel
224
+ *
225
+ * @see FirePHP::DUMP
226
+ * @param string $Key
227
+ * @param mixed $Variable
228
+ * @return true
229
+ * @throws Exception
230
+ */
231
+ public static function dump($Key, $Variable) {
232
+ return self::send($Variable, $Key, FirePHP::DUMP);
233
+ }
234
+
235
+ /**
236
+ * Log a trace in the firebug console
237
+ *
238
+ * @see FirePHP::TRACE
239
+ * @param string $Label
240
+ * @return true
241
+ * @throws Exception
242
+ */
243
+ public static function trace($Label) {
244
+ return self::send($Label, FirePHP::TRACE);
245
+ }
246
+
247
+ /**
248
+ * Log a table in the firebug console
249
+ *
250
+ * @see FirePHP::TABLE
251
+ * @param string $Label
252
+ * @param string $Table
253
+ * @return true
254
+ * @throws Exception
255
+ */
256
+ public static function table($Label, $Table) {
257
+ return self::send($Table, $Label, FirePHP::TABLE);
258
+ }
259
+
260
+ }
261
+
trunk/FirePHPCore/fb.php4 ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* ***** BEGIN LICENSE BLOCK *****
4
+ *
5
+ * This file is part of FirePHP (http://www.firephp.org/).
6
+ *
7
+ * Software License Agreement (New BSD License)
8
+ *
9
+ * Copyright (c) 2006-2009, Christoph Dorn
10
+ * All rights reserved.
11
+ *
12
+ * Redistribution and use in source and binary forms, with or without modification,
13
+ * are permitted provided that the following conditions are met:
14
+ *
15
+ * * Redistributions of source code must retain the above copyright notice,
16
+ * this list of conditions and the following disclaimer.
17
+ *
18
+ * * Redistributions in binary form must reproduce the above copyright notice,
19
+ * this list of conditions and the following disclaimer in the documentation
20
+ * and/or other materials provided with the distribution.
21
+ *
22
+ * * Neither the name of Christoph Dorn nor the names of its
23
+ * contributors may be used to endorse or promote products derived from this
24
+ * software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ *
37
+ * ***** END LICENSE BLOCK *****
38
+ *
39
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
40
+ * @author Christoph Dorn <christoph@christophdorn.com>
41
+ * @author Michael Day <manveru.alma@gmail.com>
42
+ * @license http://www.opensource.org/licenses/bsd-license.php
43
+ * @package FirePHP
44
+ */
45
+
46
+ require_once dirname(__FILE__).'/FirePHP.class.php4';
47
+
48
+ /**
49
+ * Sends the given data to the FirePHP Firefox Extension.
50
+ * The data can be displayed in the Firebug Console or in the
51
+ * "Server" request tab.
52
+ *
53
+ * @see http://www.firephp.org/Wiki/Reference/Fb
54
+ * @param mixed $Object
55
+ * @return true
56
+ * @throws Exception
57
+ */
58
+ function fb()
59
+ {
60
+ $instance =& FirePHP::getInstance(true);
61
+
62
+ $args = func_get_args();
63
+ return call_user_func_array(array(&$instance,'fb'),$args);
64
+ }
65
+
66
+
67
+ class FB
68
+ {
69
+ /**
70
+ * Enable and disable logging to Firebug
71
+ *
72
+ * @see FirePHP->setEnabled()
73
+ * @param boolean $Enabled TRUE to enable, FALSE to disable
74
+ * @return void
75
+ */
76
+ function setEnabled($Enabled) {
77
+ $instance =& FirePHP::getInstance(true);
78
+ $instance->setEnabled($Enabled);
79
+ }
80
+
81
+ /**
82
+ * Check if logging is enabled
83
+ *
84
+ * @see FirePHP->getEnabled()
85
+ * @return boolean TRUE if enabled
86
+ */
87
+ function getEnabled() {
88
+ $instance =& FirePHP::getInstance(true);
89
+ return $instance->getEnabled();
90
+ }
91
+
92
+ /**
93
+ * Specify a filter to be used when encoding an object
94
+ *
95
+ * Filters are used to exclude object members.
96
+ *
97
+ * @see FirePHP->setObjectFilter()
98
+ * @param string $Class The class name of the object
99
+ * @param array $Filter An array or members to exclude
100
+ * @return void
101
+ */
102
+ function setObjectFilter($Class, $Filter) {
103
+ $instance =& FirePHP::getInstance(true);
104
+ $instance->setObjectFilter($Class, $Filter);
105
+ }
106
+
107
+ /**
108
+ * Set some options for the library
109
+ *
110
+ * @see FirePHP->setOptions()
111
+ * @param array $Options The options to be set
112
+ * @return void
113
+ */
114
+ function setOptions($Options) {
115
+ $instance =& FirePHP::getInstance(true);
116
+ $instance->setOptions($Options);
117
+ }
118
+
119
+ /**
120
+ * Get options for the library
121
+ *
122
+ * @see FirePHP->getOptions()
123
+ * @return array The options
124
+ */
125
+ function getOptions() {
126
+ $instance =& FirePHP::getInstance(true);
127
+ return $instance->getOptions();
128
+ }
129
+
130
+ /**
131
+ * Log object to firebug
132
+ *
133
+ * @see http://www.firephp.org/Wiki/Reference/Fb
134
+ * @param mixed $Object
135
+ * @return true
136
+ */
137
+ function send()
138
+ {
139
+ $instance =& FirePHP::getInstance(true);
140
+ $args = func_get_args();
141
+ return call_user_func_array(array(&$instance,'fb'),$args);
142
+ }
143
+
144
+ /**
145
+ * Start a group for following messages
146
+ *
147
+ * Options:
148
+ * Collapsed: [true|false]
149
+ * Color: [#RRGGBB|ColorName]
150
+ *
151
+ * @param string $Name
152
+ * @param array $Options OPTIONAL Instructions on how to log the group
153
+ * @return true
154
+ */
155
+ function group($Name, $Options=null) {
156
+ $instance =& FirePHP::getInstance(true);
157
+ return $instance->group($Name, $Options);
158
+ }
159
+
160
+ /**
161
+ * Ends a group you have started before
162
+ *
163
+ * @return true
164
+ */
165
+ function groupEnd() {
166
+ return FB::send(null, null, FirePHP_GROUP_END);
167
+ }
168
+
169
+ /**
170
+ * Log object with label to firebug console
171
+ *
172
+ * @see FirePHP::LOG
173
+ * @param mixes $Object
174
+ * @param string $Label
175
+ * @return true
176
+ */
177
+ function log($Object, $Label=null) {
178
+ return FB::send($Object, $Label, FirePHP_LOG);
179
+ }
180
+
181
+ /**
182
+ * Log object with label to firebug console
183
+ *
184
+ * @see FirePHP::INFO
185
+ * @param mixes $Object
186
+ * @param string $Label
187
+ * @return true
188
+ */
189
+ function info($Object, $Label=null) {
190
+ return FB::send($Object, $Label, FirePHP_INFO);
191
+ }
192
+
193
+ /**
194
+ * Log object with label to firebug console
195
+ *
196
+ * @see FirePHP::WARN
197
+ * @param mixes $Object
198
+ * @param string $Label
199
+ * @return true
200
+ */
201
+ function warn($Object, $Label=null) {
202
+ return FB::send($Object, $Label, FirePHP_WARN);
203
+ }
204
+
205
+ /**
206
+ * Log object with label to firebug console
207
+ *
208
+ * @see FirePHP::ERROR
209
+ * @param mixes $Object
210
+ * @param string $Label
211
+ * @return true
212
+ */
213
+ function error($Object, $Label=null) {
214
+ return FB::send($Object, $Label, FirePHP_ERROR);
215
+ }
216
+
217
+ /**
218
+ * Dumps key and variable to firebug server panel
219
+ *
220
+ * @see FirePHP::DUMP
221
+ * @param string $Key
222
+ * @param mixed $Variable
223
+ * @return true
224
+ */
225
+ function dump($Key, $Variable) {
226
+ return FB::send($Variable, $Key, FirePHP_DUMP);
227
+ }
228
+
229
+ /**
230
+ * Log a trace in the firebug console
231
+ *
232
+ * @see FirePHP::TRACE
233
+ * @param string $Label
234
+ * @return true
235
+ */
236
+ function trace($Label) {
237
+ return FB::send($Label, FirePHP_TRACE);
238
+ }
239
+
240
+ /**
241
+ * Log a table in the firebug console
242
+ *
243
+ * @see FirePHP::TABLE
244
+ * @param string $Label
245
+ * @param string $Table
246
+ * @return true
247
+ */
248
+ function table($Label, $Table) {
249
+ return FB::send($Table, $Label, FirePHP_TABLE);
250
+ }
251
+ }
trunk/functions.php ADDED
@@ -0,0 +1,1074 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // for debug, remember to comment out (yes.. i *know* i will forget this later on...)
4
+ // require("FirePHPCore/FirePHP.class.php");
5
+ // $firephp = FirePHP::getInstance(true);
6
+
7
+ function cms_tpv_admin_head() {
8
+
9
+ global $cms_tpv_view;
10
+ if (isset($_GET["cms_tpv_view"])) {
11
+ $cms_tpv_view = $_GET["cms_tpv_view"];
12
+ } else {
13
+ $cms_tpv_view = "all";
14
+ }
15
+ ?>
16
+ <script type="text/javascript">
17
+ /* <![CDATA[ */
18
+ var CMS_TPV_URL = "<?php echo CMS_TPV_URL ?>";
19
+ var CMS_TPV_AJAXURL = "?action=cms_tpv_get_childs&view=";
20
+ var CMS_TPV_VIEW = "<?php echo $cms_tpv_view ?>";
21
+ var cms_tpv_jsondata = {};
22
+ /* ]]> */
23
+ </script>
24
+
25
+ <!--[if IE 6]>
26
+ <style>
27
+ .cms_tree_view_search_form {
28
+ display: none !important;
29
+ }
30
+ .cms_tpv_dashboard_widget .subsubsub li {
31
+ }
32
+ </style>
33
+ <![endif]-->
34
+ <?php
35
+ }
36
+
37
+ function cms_tpv_admin_init() {
38
+
39
+ wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
40
+ wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
41
+ wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
42
+ wp_enqueue_script( "jquery-jstree", CMS_TPV_URL . "scripts/jquery.jstree.js", false, CMS_TPV_VERSION);
43
+ wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
44
+ wp_enqueue_script( "jquery-hoverintent", CMS_TPV_URL . "scripts/jquery.hoverIntent.minified.js", false, CMS_TPV_VERSION);
45
+ #wp_enqueue_script( "jquery-ui-dialog", CMS_TPV_URL . "scripts/jquery.ui.dialog.min.js", false, CMS_TPV_VERSION);
46
+ wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
47
+
48
+ // DEBUG
49
+ //wp_enqueue_script( "jquery-hotkeys" );
50
+
51
+ load_plugin_textdomain('cms-tree-page-view', WP_CONTENT_DIR . "/plugins/languages", "/cms-tree-page-view/languages");
52
+ $oLocale = array(
53
+ "Enter_title_of_new_page" => __("Enter title of new page", 'cms-tree-page-view'),
54
+ "child_pages" => __("child pages", 'cms-tree-page-view'),
55
+ "Edit_page" => __("Edit page", 'cms-tree-page-view'),
56
+ "View_page" => __("View page", 'cms-tree-page-view'),
57
+ "Edit" => __("Edit", 'cms-tree-page-view'),
58
+ "View" => __("View", 'cms-tree-page-view'),
59
+ "Add_page" => __("Add page", 'cms-tree-page-view'),
60
+ "Add_new_page_after" => __("Add new page after", 'cms-tree-page-view'),
61
+ "after" => __("after", 'cms-tree-page-view'),
62
+ "inside" => __("inside", 'cms-tree-page-view'),
63
+ "Can_not_add_sub_page_when_status_is_draft" => __("Sorry, can't create a sub page to a page with status \"draft\".", 'cms-tree-page-view'),
64
+ "Can_not_add_sub_page_when_status_is_trash" => __("Sorry, can't create a sub page to a page with status \"trash\".", 'cms-tree-page-view'),
65
+ "Can_not_add_page_after_when_status_is_trash" => __("Sorry, can't create a page after a page with status \"trash\".", 'cms-tree-page-view'),
66
+ "Add_new_page_inside" => __("Add new page inside", 'cms-tree-page-view'),
67
+ "Status_draft" => __("draft", 'cms-tree-page-view'),
68
+ "Status_future" => __("future", 'cms-tree-page-view'),
69
+ "Status_password" => __("protected", 'cms-tree-page-view'), // is "protected" word better than "password" ?
70
+ "Status_pending" => __("pending", 'cms-tree-page-view'),
71
+ "Status_private" => __("private", 'cms-tree-page-view'),
72
+ "Status_trash" => __("trash", 'cms-tree-page-view'),
73
+ "Password_protected_page" => __("Password protected page", 'cms-tree-page-view'),
74
+ "Adding_page" => __("Adding page...", 'cms-tree-page-view'),
75
+ );
76
+ wp_localize_script( "cms_tree_page_view", 'cmstpv_l10n', $oLocale);
77
+
78
+ }
79
+
80
+ // save settings
81
+ function cms_tpv_save_settings() {
82
+ if (isset($_POST["cms_tpv_action"]) && $_POST["cms_tpv_action"] == "save_settings") {
83
+ $options = array();
84
+ $options["dashboard"] = (array) $_POST["post-type-dashboard"];
85
+ $options["menu"] = (array) $_POST["post-type-menu"];
86
+ update_option('cms_tpv_options', $options); // enable this to show box
87
+ }
88
+ /*
89
+ [post-type-dashboard] => Array
90
+ (
91
+ [0] => post
92
+ [1] => page
93
+ )
94
+
95
+ [post-type-menu] => Array
96
+ (
97
+ [0] => post
98
+ [1] => page
99
+ )
100
+
101
+ */
102
+ }
103
+
104
+ function cms_tpv_wp_dashboard_setup() {
105
+ // add dashboard to capability edit_pages only
106
+ if (current_user_can("edit_pages")) {
107
+ $options = cms_tpv_get_options();
108
+ foreach ($options["dashboard"] as $one_dashboard_post_type) {
109
+ $post_type_object = get_post_type_object($one_dashboard_post_type);
110
+ $new_func_name = create_function('', "cms_tpv_dashboard('$one_dashboard_post_type');");
111
+ wp_add_dashboard_widget( "cms_tpv_dashboard_widget_{$one_dashboard_post_type}", $post_type_object->labels->name . " Tree View", $new_func_name );
112
+ }
113
+ }
114
+ }
115
+
116
+
117
+ /**
118
+ * Output on dashboard
119
+ */
120
+ function cms_tpv_dashboard($post_type = "") {
121
+ // cms_tpv_show_annoying_box();
122
+ cms_tpv_print_common_tree_stuff($post_type);
123
+ }
124
+
125
+ function cms_tpv_admin_menu() {
126
+
127
+ // add
128
+ $options = cms_tpv_get_options();
129
+ foreach ($options["menu"] as $one_menu_post_type) {
130
+ // post is a special one.
131
+ if ($one_menu_post_type == "post") {
132
+ $slug = "edit.php";
133
+ } else {
134
+ $slug = "edit.php?post_type=$one_menu_post_type";
135
+ }
136
+ $post_type_object = get_post_type_object($one_menu_post_type);
137
+ add_submenu_page($slug, $post_type_object->labels->name . " Tree View", $post_type_object->labels->name . " Tree View", "edit_pages", "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
138
+ }
139
+
140
+ add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
141
+
142
+ }
143
+
144
+
145
+ /**
146
+ * Output options page
147
+ */
148
+ function cms_tpv_options() {
149
+
150
+ /*
151
+ // Just som testing stuff
152
+ $args = array(
153
+ "numberposts" => "-1",
154
+ "orderby" => "menu_order",
155
+ "order" => "ASC",
156
+ "caller_get_posts" => 1, // get sticky posts in natural order (or so I understand it anyway)
157
+ "post_status" => "publish", // "any" seems to get all but auto-drafts
158
+ "post_type" => "page"
159
+ );
160
+ $posts = get_pages($args); // works
161
+ // $posts = get_posts($args); // does not work
162
+ var_dump($posts);
163
+ echo "num of posts: " . sizeof($posts);
164
+ foreach ($posts as $one_post) {
165
+ #bonny_d($one_post);
166
+ echo "<br><br>title: " . esc_html($one_post->post_title);
167
+ echo "<br>status: " . $one_post->post_status;
168
+ echo "<br>type: " . $one_post->post_type;
169
+ }
170
+ // */
171
+
172
+ ?>
173
+ <div class="wrap">
174
+
175
+ <h2><?php echo CMS_TPV_NAME ?> <?php _e("settings", 'cms-tree-page-view') ?></h2>
176
+
177
+ <form method="post" action="options.php">
178
+ <?php wp_nonce_field('update-options'); ?>
179
+
180
+ <h3><?php _e("Select where to show a tree for pages and custom post types", 'cms-tree-page-view')?></h3>
181
+
182
+ <?php
183
+ $options = cms_tpv_get_options();
184
+
185
+ $post_types = get_post_types(array(), "objects");
186
+ $arr_page_options = array();
187
+ foreach ($post_types as $one_post_type) {
188
+ $name = $one_post_type->name;
189
+
190
+ if ($name == "post") {
191
+ // no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
192
+ continue;
193
+ }
194
+
195
+ if ($one_post_type->show_ui) {
196
+
197
+ $arr_page_options[] = "post-type-dashboard-$name";
198
+ $arr_page_options[] = "post-type-menu-$name";
199
+ echo "<p>";
200
+ echo "<strong>".$one_post_type->label."</strong>";
201
+
202
+ $checked = (in_array($name, $options["dashboard"])) ? " checked='checked' " : "";
203
+ echo "<br />";
204
+ echo "<input $checked type='checkbox' name='post-type-dashboard[]' value='$name' id='post-type-dashboard-$name' /> <label for='post-type-dashboard-$name'>" . __("On dashboard", 'cms-tree-page-view') . "</label>";
205
+
206
+ $checked = (in_array($name, $options["menu"])) ? " checked='checked' " : "";
207
+ echo "<br />";
208
+ echo "<input $checked type='checkbox' name='post-type-menu[]' value='$name' id='post-type-menu-$name' /> <label for='post-type-menu-$name'>" . __("In menu", 'cms-tree-page-view') . "</label>";
209
+ echo "</p>";
210
+ }
211
+ }
212
+
213
+ ?>
214
+
215
+ <input type="hidden" name="action" value="update" />
216
+ <input type="hidden" name="cms_tpv_action" value="save_settings" />
217
+ <input type="hidden" name="page_options" value="<?php echo join($arr_page_options, ",") ?>" />
218
+ <p class="submit">
219
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes', 'cms-tree-page-view') ?>" />
220
+ </p>
221
+ </form>
222
+ </div>
223
+
224
+ <?php
225
+ }
226
+
227
+ function cms_tpv_get_options() {
228
+ $arr_options = (array) get_option('cms_tpv_options');
229
+ $arr_options["dashboard"] = (array) $arr_options["dashboard"];
230
+ $arr_options["menu"] = (array) $arr_options["menu"];
231
+ return $arr_options;
232
+ }
233
+
234
+ function cms_tpv_get_selected_post_type() {
235
+ // fix for Ozh' Admin Drop Down Menu that does something with the urls
236
+ // movies funkar:
237
+ // http://localhost/wp-admin/edit.php?post_type=movies&page=cms-tpv-page-xmovies
238
+ // movies funkar inte:
239
+ // http://localhost/wp-admin/admin.php?page=cms-tpv-page-movies
240
+ $post_type = NULL;
241
+ if (isset($_GET["post_type"])) {
242
+ $post_type = $_GET["post_type"];
243
+ }
244
+ if (!$post_type) {
245
+ // no post type, happens with ozh admin drop down, so get it via page instead
246
+ $page = $_GET["page"];
247
+ $post_type = str_replace("cms-tpv-page-", "", $page);
248
+ }
249
+
250
+ if (!$post_type) { $post_type = "post"; }
251
+ return $post_type;
252
+ }
253
+
254
+ /**
255
+ * Print tree stuff that is common for both dashboard and page
256
+ */
257
+ function cms_tpv_print_common_tree_stuff($post_type = "") {
258
+
259
+ if (!$post_type) {
260
+ $post_type = cms_tpv_get_selected_post_type();
261
+ }
262
+ #echo "post_type: $post_type";
263
+ $post_type_object = get_post_type_object($post_type);
264
+ $get_pages_args = array("post_type" => $post_type);
265
+
266
+ $pages = cms_tpv_get_pages($get_pages_args);
267
+
268
+ $wpml_current_lang = "";
269
+ if (defined("ICL_SITEPRESS_VERSION") && $post_type == "page") {
270
+ global $sitepress;
271
+ $wpml_current_lang = $sitepress->get_current_language();
272
+ }
273
+
274
+ global $cms_tpv_view;
275
+ // output js for the root/top level
276
+ // function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $post_type) {
277
+ // @todo: make into function since used at other places
278
+ $jstree_open = array();
279
+ if ( isset( $_COOKIE["jstree_open"] ) ) {
280
+ $jstree_open = $_COOKIE["jstree_open"]; // like this: [jstree_open] => cms-tpv-1282,cms-tpv-1284,cms-tpv-3
281
+ $jstree_open = explode( ",", $jstree_open );
282
+ for( $i=0; $i<sizeof( $jstree_open ); $i++ ) {
283
+ $jstree_open[$i] = (int) str_replace("#cms-tpv-", "", $jstree_open[$i]);
284
+ }
285
+ }
286
+ ob_start();
287
+ cms_tpv_print_childs(0, $cms_tpv_view, $jstree_open, $post_type);
288
+ $json_data = ob_get_clean();
289
+ ?>
290
+ <script type="text/javascript">
291
+ cms_tpv_jsondata.<?php echo $post_type ?> = <?php echo $json_data ?>;
292
+ </script>
293
+
294
+ <div class="cms_tpv_wrapper">
295
+ <input type="hidden" name="cms_tpv_meta_post_type" value="<?php echo $post_type ?>" />
296
+ <input type="hidden" name="cms_tpv_meta_post_type_hierarchical" value="<?php echo (int) $post_type_object->hierarchical ?>" />
297
+ <input type="hidden" name="cms_tpv_meta_wpml_language" value="<?php echo $wpml_current_lang ?>" />
298
+ <?php
299
+
300
+ // check if WPML is activated
301
+ // if: show a language-menu
302
+ if (defined("ICL_SITEPRESS_VERSION") && $post_type == "page") {
303
+ $wpml_langs = icl_get_languages();
304
+ $wpml_active_lang = null;
305
+ if (sizeof($wpml_langs)>=1) {
306
+ $lang_out = "";
307
+ $lang_out .= "<ul class='cms-tpv-subsubsub cms_tvp_switch_langs'>";
308
+ foreach ($wpml_langs as $one_lang) {
309
+ $one_lang_details = $sitepress->get_language_details($one_lang["language_code"]); // english_name | display_name
310
+ $selected = "";
311
+ if ($one_lang["active"]) {
312
+ $wpml_active_lang = $one_lang;
313
+ $selected = "current";
314
+ }
315
+ $lang_out .= "<li><a class='cms_tvp_switch_lang $selected cms_tpv_switch_language_code_{$one_lang["language_code"]}' href='#'>$one_lang_details[display_name]</a> | </li>";
316
+ }
317
+ $lang_out = preg_replace('/ \| <\/li>$/', "</li>", $lang_out);
318
+ $lang_out .= "</ul>";
319
+ echo $lang_out;
320
+ }
321
+ }
322
+ /*
323
+ Array
324
+ (
325
+ [en] => Array
326
+ (
327
+ [id] => 1
328
+ [active] => 1
329
+ [native_name] => English
330
+ [language_code] => en
331
+ [translated_name] => English
332
+ [url] => http://localhost/wordpress3
333
+ [country_flag_url] => http://localhost/wordpress3/wp-content/plugins/sitepress-multilingual-cms/res/flags/en.png
334
+ )
335
+ */
336
+
337
+ if (empty($pages)) {
338
+ echo '<div class="updated fade below-h2"><p>' . __("No posts found.", 'cms-tree-page-view') . '</p></div>';
339
+ } else {
340
+ // start the party!
341
+ ?>
342
+
343
+ <ul class="cms-tpv-subsubsub">
344
+ <li><a class="cms_tvp_view_all <?php echo ($cms_tpv_view=="all") ? "current" : "" ?>" href="#"><?php _e("All", 'cms-tree-page-view') ?></a> |</li>
345
+ <li><a class="cms_tvp_view_public <?php echo ($cms_tpv_view=="public") ? "current" : "" ?>" href="#"><?php _e("Public", 'cms-tree-page-view') ?></a> |</li>
346
+ <li><a class="cms_tvp_view_trash <?php echo ($cms_tpv_view=="trash") ? "current" : "" ?>" href="#"><?php _e("Trash", 'cms-tree-page-view') ?></a></li>
347
+
348
+ <?php
349
+ if ($post_type_object->hierarchical) {
350
+ ?>
351
+ <li><a href="#" class="cms_tpv_open_all"><?php _e("Expand", 'cms-tree-page-view') ?></a> |</li>
352
+ <li><a href="#" class="cms_tpv_close_all"><?php _e("Collapse", 'cms-tree-page-view') ?></a></li>
353
+ <?php
354
+ }
355
+ ?>
356
+
357
+ <li>
358
+ <form class="cms_tree_view_search_form" method="get" action="">
359
+ <input type="text" name="search" class="cms_tree_view_search" />
360
+ <a title="<?php _e("Clear search", 'cms-tree-page-view') ?>" class="cms_tree_view_search_form_reset" href="#">x</a>
361
+ <input type="submit" class="cms_tree_view_search_submit" value="<?php _e("Search", 'cms-tree-page-view') ?>" />
362
+ <span class="cms_tree_view_search_form_working"><?php _e("Searching...", 'cms-tree-page-view') ?></span>
363
+ <span class="cms_tree_view_search_form_no_hits"><?php _e("Nothing found.", 'cms-tree-page-view') ?></span>
364
+ </form>
365
+ </li>
366
+ </ul>
367
+
368
+ <div class="cms_tpv_working">
369
+ <?php _e("Loading...", 'cms-tree-page-view') ?>
370
+ </div>
371
+
372
+ <div class="cms_tpv_message updated below-h2 hidden"><p>Message goes here.</p></div>
373
+
374
+ <div class="updated below-h2 hidden cms_tpv_search_no_hits"><p><?php _e("Search: no pages found", 'cms-tree-page-view') ?></p></div>
375
+
376
+ <div class="cms_tpv_container tree-default">
377
+ <?php _e("Loading tree", 'cms-tree-page-view') ?>
378
+ </div>
379
+
380
+ <div style="clear: both;"></div>
381
+
382
+ <div class="cms_tpv_page_actions">
383
+ <p>
384
+ <a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a> |
385
+ <a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
386
+ </p>
387
+ <p class="cms_tpv_action_add_and_edit_page">
388
+ <span class='cms_tpv_action_add_page'><?php echo $post_type_object->labels->add_new_item ?></span>
389
+ <a href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_after'><?php _e("After", "cms-tree-page-view")?></a>
390
+ <?php
391
+ // if post type is hierarchical we can add pages inside
392
+ if ($post_type_object->hierarchical) {
393
+ ?> | <a href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_inside'><?php _e("Inside", "cms-tree-page-view")?></a><?php
394
+ }
395
+ // if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
396
+ ?>
397
+ <!-- <span class="cms_tpv_action_add_page_inside_disallowed"><?php _e("Can not create page inside of a page with draft status", "cms-tree-page-view")?></span> -->
398
+ </p>
399
+ <dl>
400
+ <dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
401
+ <dd>
402
+ <span class="cms_tpv_page_actions_modified_time"></span> <?php _e("by", "cms-tree-page-view") ?>
403
+ <span class="cms_tpv_page_actions_modified_by"></span>
404
+ </dd>
405
+ <dt><?php _e("Page ID", "cms-tree-page-view") ?></dt>
406
+ <dd><span class="cms_tpv_page_actions_page_id"></span></dd>
407
+ </dl>
408
+ <div class="cms_tpv_page_actions_columns"></div>
409
+ <span class="cms_tpv_page_actions_arrow"></span>
410
+ </div>
411
+ <?php
412
+ }
413
+ ?>
414
+
415
+ </div>
416
+ <?php
417
+ } // func
418
+
419
+
420
+ /**
421
+ * Pages page
422
+ * A page with the tree. Good stuff.
423
+ */
424
+ function cms_tpv_pages_page() {
425
+
426
+ $post_type = cms_tpv_get_selected_post_type();
427
+ $post_type_object = get_post_type_object($post_type);
428
+
429
+ ?>
430
+ <div class="wrap">
431
+ <h2><?php echo ($post_type_object->labels->name); ?> Tree View</h2>
432
+
433
+ <div class="bonny-plugins-inner-sidebar">
434
+ <h3>Support the author</h3>
435
+ <p>
436
+ If you like this plugin you are welcome to support the author by donating:
437
+ </p>
438
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="text-align: center">
439
+ <input type="hidden" name="cmd" value="_s-xclick">
440
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHXwYJKoZIhvcNAQcEoIIHUDCCB0wCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYArzkksMbzVWCE3kMsAGZ6xe4p6CQcaIaH3w9JF5RS6Z8PIelZw26PHvfrQUVAUCL3IecfDVU0hjDCDfvmQe16lNZSVvy57uwk20ryOTf5IJ7Ujulw1G0T0Fpc7M9Mb0FRWblgnbETeEREzRZiGZBPfI+cn9rghM1Sb3xcYGWFfujELMAkGBSsOAwIaBQAwgdwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIZb6E5mM+R7iAgbgoPH19h/wvJIJR8lPTFEg2qb4bpstEjDo5rgjbdWEBbVp1dtFXdDCf4Nbivm5yvk2Ugf5sDsX1OiOcotl/1E8tW5VesSIkYtVmTgBbr9wkWuZPT8RKrvRVSVgWHxwXV4/eYFwxDsheL04BZYUV6lPSSEBPnEtO4Rn2AfBKo/gYqfb8zdu23FpWKrUMlRQ2ETDFINliKnDNx59aFEbTP85eOQpqetm/fDQKtGebOSpFTJ3TxlM3U54coIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwMTE2MjIyNzQyWjAjBgkqhkiG9w0BCQQxFgQUiaTKjuxCgwQjZm+TAmb0/tQbdWIwDQYJKoZIhvcNAQEBBQAEgYAn4V+IMVl19uvdDieOk8Wahvy1QYm+UfdMQn8ZuHOAswJ9vYreuqcradc4EL0kWH/o2/wzPWxoT3S2fqgdrVeKm8hnsXOWcpuFYMMu9fdLCe0wak8jpzTb02gm+LfYnK/dxe5FkgmzR2HN0tAdl+xlSUUApUZ1yZsXgWe9kFKZdg==-----END PKCS7-----">
441
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
442
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
443
+ </form>
444
+
445
+ <p style="text-align: center">
446
+ <a href="http://flattr.com/thing/117882/CMS-Tree-Page-View-Plugin-for-WordPress" target="_blank">
447
+ <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>
448
+ </p>
449
+
450
+ <p>
451
+ You can also show your appreciation
452
+ by giving the plugin a <a href="http://wordpress.org/extend/plugins/cms-tree-page-view/">good rating over at the plugin directory</a>
453
+ or blog or tweet something nice about this plugin.
454
+ </p>
455
+
456
+ <h3>Support</h3>
457
+ <p>If you have any problems with this plugins please check out the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
458
+
459
+ <h3>More CMS related plugins</h3>
460
+ <p>These are some more plugins that enhance the CMS functionality of WordPress. Please check them out!</p>
461
+ <ul>
462
+ <li><a href="http://wordpress.org/extend/plugins/admin-menu-tree-page-view/">Admin Menu Tree Page View</a></li>
463
+ <li><a href="http://wordpress.org/extend/plugins/simple-history/">Simple History</a></li>
464
+ <li><a href="http://wordpress.org/extend/plugins/simple-fields/">Simple Fields</a></li>
465
+ <li><a href="http://wordpress.org/extend/plugins/simple-front-end-edit-buttons/">Simple Front End Edit Buttons</a></li>
466
+ </ul>
467
+
468
+
469
+ </div>
470
+
471
+ <?php
472
+ // cms_tpv_show_annoying_box();
473
+ cms_tpv_print_common_tree_stuff($post_type);
474
+ ?>
475
+
476
+ </div>
477
+ <?php
478
+ }
479
+
480
+ /**
481
+ * Get the pages
482
+ */
483
+ function cms_tpv_get_pages($args = null) {
484
+
485
+ global $wpdb;
486
+
487
+ $defaults = array(
488
+ "post_type" => "post",
489
+ "parent" => "",
490
+ "view" => "all" // all | public | trash
491
+ );
492
+ $r = wp_parse_args( $args, $defaults );
493
+
494
+ $get_posts_args = array(
495
+ "numberposts" => "-1",
496
+ "orderby" => "menu_order",
497
+ "order" => "ASC",
498
+ "caller_get_posts" => 1, // get sticky posts in natural order (or so I understand it anyway)
499
+ // "post_type" => "any",
500
+ "post_type" => $r["post_type"],
501
+ "xsuppress_filters" => "0"
502
+ );
503
+ if ($r["parent"]) {
504
+ $get_posts_args["post_parent"] = $r["parent"];
505
+ } else {
506
+ $get_posts_args["post_parent"] = "0";
507
+ }
508
+ if ($r["view"] == "all") {
509
+ $get_posts_args["post_status"] = "any"; // "any" seems to get all but auto-drafts
510
+ } elseif ($r["view"] == "trash") {
511
+
512
+ $get_posts_args["post_status"] = "trash";
513
+
514
+ // if getting trash, just get all pages, don't care about parent?
515
+ // because otherwise we have to mix trashed pages and pages with other statuses. messy.
516
+ $get_posts_args["post_parent"] = null;
517
+
518
+ } else {
519
+ $get_posts_args["post_status"] = "publish";
520
+ }
521
+
522
+ // does not work with plugin role scoper. don't know why, but this should fix it
523
+ remove_action("get_pages", array('ScoperHardway', 'flt_get_pages'), 1, 2);
524
+
525
+ // does not work with plugin ALO EasyMail Newsletter
526
+ remove_filter('get_pages','ALO_exclude_page');
527
+
528
+ #do_action_ref_array('parse_query', array(&$this));
529
+ #print_r($get_posts_args);
530
+ $pages = get_posts($get_posts_args);
531
+
532
+ // filter out pages for wpml, by applying same filter as get_pages does
533
+ // only run if wpml is available or always?
534
+ $pages = apply_filters('get_pages', $pages, $get_posts_args);
535
+
536
+ return $pages;
537
+
538
+ }
539
+
540
+ function cms_tpv_parse_query($q) {
541
+ }
542
+
543
+ function cms_tpv_firedebug($var) {
544
+ global $firephp;
545
+ $firephp->log($var);
546
+ }
547
+
548
+ /**
549
+ * Output JSON for the children of a node
550
+ * $arrOpenChilds = array with id of pages to open children on
551
+ */
552
+ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $post_type) {
553
+
554
+ $arrPages = cms_tpv_get_pages("parent=$pageID&view=$view&post_type=$post_type");
555
+
556
+ if ($arrPages) {
557
+
558
+ global $current_screen;
559
+ $screen = convert_to_screen("edit");
560
+ $screen->post_type = null;
561
+
562
+ ob_start(); // some plugins, for example magic fields, return javascript and things here. we're not compatible with that, so just swallow any output
563
+ $posts_columns = get_column_headers($screen);
564
+ ob_get_clean();
565
+
566
+ unset($posts_columns["cb"], $posts_columns["title"], $posts_columns["author"], $posts_columns["categories"], $posts_columns["tags"], $posts_columns["date"]);
567
+
568
+ global $post;
569
+
570
+ #cms_tpv_firedebug(timer_stop());
571
+
572
+ ?>[<?php
573
+ for ($i=0, $pagesCount = sizeof($arrPages); $i<$pagesCount; $i++) {
574
+
575
+ #cms_tpv_firedebug(timer_stop());
576
+ $onePage = $arrPages[$i];
577
+ $tmpPost = $post;
578
+ $post = $onePage;
579
+ $page_id = $onePage->ID;
580
+
581
+ $editLink = get_edit_post_link($onePage->ID, 'notDisplay');
582
+ $content = esc_html($onePage->post_content);
583
+ $content = str_replace(array("\n","\r"), "", $content);
584
+ $hasChildren = false;
585
+
586
+ // if viewing trash, don't get children. we watch them "flat" instead
587
+ if ($view == "trash") {
588
+ } else {
589
+ $arrChildPages = cms_tpv_get_pages("parent={$onePage->ID}&view=$view&post_type=$post_type");
590
+ }
591
+
592
+ if ($arrChildPages) {
593
+ $hasChildren = true;
594
+ }
595
+ // if no children, output no state
596
+ $strState = '"state": "closed",';
597
+ if (!$hasChildren) {
598
+ $strState = '';
599
+ }
600
+
601
+ // type of node
602
+ $rel = $onePage->post_status;
603
+ if ($onePage->post_password) {
604
+ $rel = "password";
605
+ }
606
+
607
+ // modified time
608
+ $post_modified_time = strtotime($onePage->post_modified);
609
+ $post_modified_time = date_i18n(get_option('date_format'), $post_modified_time, false);
610
+
611
+ // last edited by
612
+ setup_postdata($post);
613
+ $post_author = get_the_modified_author();
614
+ if (empty($post_author)) {
615
+ $post_author = __("Unknown user", 'cms-tree-page-view');
616
+ }
617
+
618
+ $title = get_the_title($onePage->ID); // so hooks and stuff will do their work
619
+ if (empty($title)) {
620
+ $title = __("<Untitled page>", 'cms-tree-page-view');
621
+ }
622
+ $title = esc_html($title);
623
+ #$title = html_entity_decode($title, ENT_COMPAT, "UTF-8");
624
+ #$title = html_entity_decode($title, ENT_COMPAT);
625
+
626
+ // can edit?
627
+ if ( current_user_can( 'edit_page', $page_id ) ) {
628
+ $user_can_edit_page = true;
629
+ $user_can_edit_page_css = "cms_tpv_user_can_edit_page_yes";
630
+ } else {
631
+ $user_can_edit_page = false;
632
+ $user_can_edit_page_css = "cms_tpv_user_can_edit_page_no";
633
+ }
634
+
635
+ // fetch columns
636
+ $str_columns = "";
637
+ foreach ( $posts_columns as $column_name => $column_display_name ) {
638
+ $col_name = $column_display_name;
639
+ if ($column_name == "comments") {
640
+ $col_name = __("Comments");
641
+ }
642
+ $str_columns .= "<dt>$col_name</dt>";
643
+ $str_columns .= "<dd>";
644
+ if ($column_name == "comments") {
645
+ $str_columns .= '<div class="post-com-count-wrapper">';
646
+ $left = get_pending_comments_num( $onePage->ID );
647
+ $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
648
+ $pending_phrase2 = "";
649
+ if ($left) {
650
+ $pending_phrase2 = " + $left " . __("pending");
651
+ }
652
+
653
+ if ( $left ) {
654
+ $str_columns .= '<strong>';
655
+ }
656
+ ob_start();
657
+ comments_number("<a href='edit-comments.php?p=$page_id' title='$pending_phrase'><span>" . _x('0', 'comment count') . "$pending_phrase2</span></a>", "<a href='edit-comments.php?p=$page_id' title='$pending_phrase' class=''><span class=''>" . _x('1', 'comment count') . "$pending_phrase2</span></a>", "<a href='edit-comments.php?p=$page_id' title='$pending_phrase' class=''><span class=''>" . _x('%', 'comment count') . "$pending_phrase2</span></a>");
658
+ $str_columns .= ob_get_clean();
659
+ if ( $left ) {
660
+ $str_columns .= '</strong>';
661
+ }
662
+ $str_columns .= "</div>";
663
+ } else {
664
+ ob_start();
665
+ do_action('manage_pages_custom_column', $column_name, $onePage->ID);
666
+ $str_columns .= ob_get_clean();
667
+ }
668
+ $str_columns .= "</dd>";
669
+ }
670
+
671
+ if ($str_columns) {
672
+ $str_columns = "<dl>$str_columns</dl>";
673
+ }
674
+ $str_columns = json_encode($str_columns);
675
+ ?>
676
+ {
677
+ "data": {
678
+ "title": "<?php echo $title ?>",
679
+ "attr": {
680
+ "href": "<?php echo $editLink ?>",
681
+ "xid": "cms-tpv-<?php echo $onePage->ID ?>"
682
+ },
683
+ "xicon": "<?php echo CMS_TPV_URL . "images/page_white_text.png" ?>"
684
+ },
685
+ "attr": {
686
+ "xhref": "<?php echo $editLink ?>",
687
+ "id": "cms-tpv-<?php echo $onePage->ID ?>",
688
+ "xtitle": "<?php _e("Click to edit. Drag to move.", 'cms-tree-page-view') ?>",
689
+ "class": "<?php echo $user_can_edit_page_css ?>"
690
+ },
691
+ <?php echo $strState ?>
692
+ "metadata": {
693
+ "id": "cms-tpv-<?php echo $onePage->ID ?>",
694
+ "post_id": "<?php echo $onePage->ID ?>",
695
+ "post_type": "<?php echo $onePage->post_type ?>",
696
+ "post_status": "<?php echo $onePage->post_status ?>",
697
+ "rel": "<?php echo $rel ?>",
698
+ "childCount": <?php echo sizeof($arrChildPages) ?>,
699
+ "permalink": "<?php echo htmlspecialchars_decode(get_permalink($onePage->ID)) ?>",
700
+ "editlink": "<?php echo htmlspecialchars_decode($editLink) ?>",
701
+ "modified_time": "<?php echo $post_modified_time ?>",
702
+ "modified_author": "<?php echo $post_author ?>",
703
+ "columns": <?php echo $str_columns ?>,
704
+ "user_can_edit_page": "<?php echo (int) $user_can_edit_page ?>"
705
+ }
706
+ <?php
707
+ // if id is in $arrOpenChilds then also output children on this one
708
+ if ($hasChildren && isset($arrOpenChilds) && in_array($onePage->ID, $arrOpenChilds)) {
709
+ ?>, "children": <?php
710
+ cms_tpv_print_childs($onePage->ID, $view, $arrOpenChilds, $post_type);
711
+ ?><?php
712
+ }
713
+ ?>
714
+
715
+ }
716
+ <?php
717
+ // no comma for last page
718
+ if ($i < $pagesCount-1) {
719
+ ?>,<?php
720
+ }
721
+
722
+ // return orgiginal post
723
+ $post = $tmpPost;
724
+
725
+ }
726
+ ?>]<?php
727
+ }
728
+ }
729
+
730
+ // Act on AJAX-call
731
+ function cms_tpv_get_childs() {
732
+
733
+ header("Content-type: application/json");
734
+
735
+ $action = $_GET["action"];
736
+ $view = $_GET["view"]; // all | public | trash
737
+ $post_type = (isset($_GET["post_type"])) ? $_GET["post_type"] : null;
738
+ $search = (isset($_GET["search_string"])) ? trim($_GET["search_string"]) : ""; // exits if we're doing a search
739
+ if ($action) {
740
+
741
+ if ($search) {
742
+
743
+ // find all pages that contains $search
744
+ // collect all post_parent
745
+ // for each parent id traverse up until post_parent is 0, saving all ids on the way
746
+
747
+ // what to search: since all we see in the GUI is the title, just search that
748
+ global $wpdb;
749
+ $sqlsearch = "%{$search}%";
750
+ // feels bad to leave out the "'" in the query, but prepare seems to add it..??
751
+ $sql = $wpdb->prepare("SELECT id, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_title LIKE %s", $sqlsearch);
752
+ $hits = $wpdb->get_results($sql);
753
+ $arrNodesToOpen = array();
754
+ foreach ($hits as $oneHit) {
755
+ $arrNodesToOpen[] = $oneHit->post_parent;
756
+ }
757
+
758
+ $arrNodesToOpen = array_unique($arrNodesToOpen);
759
+ $arrNodesToOpen2 = array();
760
+ // find all parents to the arrnodestopen
761
+ foreach ($arrNodesToOpen as $oneNode) {
762
+ if ($oneNode > 0) {
763
+ // not at top so check it out
764
+ $parentNodeID = $oneNode;
765
+ while ($parentNodeID != 0) {
766
+ $hits = $wpdb->get_results($sql);
767
+ $sql = "SELECT id, post_parent FROM $wpdb->posts WHERE id = $parentNodeID";
768
+ $row = $wpdb->get_row($sql);
769
+ $parentNodeID = $row->post_parent;
770
+ $arrNodesToOpen2[] = $parentNodeID;
771
+ }
772
+ }
773
+ }
774
+
775
+ $arrNodesToOpen = array_merge($arrNodesToOpen, $arrNodesToOpen2);
776
+ $sReturn = "";
777
+ #foreach ($arrNodesToOpen as $oneNodeID) {
778
+ # $sReturn .= "cms-tpv-{$oneNodeID},";
779
+ #}
780
+ #$sReturn = preg_replace("/,$/", "", $sReturn);
781
+
782
+ foreach ($arrNodesToOpen as $oneNodeID) {
783
+ $sReturn .= "\"#cms-tpv-{$oneNodeID}\",";
784
+ }
785
+ $sReturn = preg_replace('/,$/', "", $sReturn);
786
+ if ($sReturn) {
787
+ $sReturn = "[" . $sReturn . "]";
788
+ }
789
+
790
+ if ($sReturn) {
791
+ echo $sReturn;
792
+ } else {
793
+ // if no hits
794
+ echo "[]";
795
+ }
796
+
797
+ exit;
798
+
799
+ } else {
800
+
801
+ // regular get
802
+
803
+ $id = (isset($_GET["id"])) ? $_GET["id"] : null;
804
+ $id = (int) str_replace("cms-tpv-", "", $id);
805
+
806
+ $jstree_open = array();
807
+ if ( isset( $_COOKIE["jstree_open"] ) ) {
808
+ $jstree_open = $_COOKIE["jstree_open"]; // like this: [jstree_open] => cms-tpv-1282,cms-tpv-1284,cms-tpv-3
809
+ #var_dump($jstree_open); string(22) "#cms-tpv-14,#cms-tpv-2"
810
+ $jstree_open = explode( ",", $jstree_open );
811
+ for( $i=0; $i<sizeof( $jstree_open ); $i++ ) {
812
+ $jstree_open[$i] = (int) str_replace("#cms-tpv-", "", $jstree_open[$i]);
813
+ }
814
+ }
815
+ cms_tpv_print_childs($id, $view, $jstree_open, $post_type);
816
+ exit;
817
+ }
818
+ }
819
+
820
+ exit;
821
+ }
822
+
823
+ function cms_tpv_add_page() {
824
+ global $wpdb;
825
+
826
+ /*
827
+ (
828
+ [action] => cms_tpv_add_page
829
+ [pageID] => cms-tpv-1318
830
+ type
831
+ )
832
+ */
833
+ $type = $_POST["type"];
834
+ $pageID = $_POST["pageID"];
835
+ $pageID = str_replace("cms-tpv-", "", $pageID);
836
+ $page_title = trim($_POST["page_title"]);
837
+ $post_type = $_POST["post_type"];
838
+ $wpml_lang = $_POST["wpml_lang"];
839
+ if (!$page_title) { $page_title = __("New page", 'cms-tree-page-view'); }
840
+
841
+ $ref_post = get_post($pageID);
842
+
843
+ if ("after" == $type) {
844
+
845
+ /*
846
+ add page under/below ref_post
847
+ */
848
+
849
+ // update menu_order of all pages below our page
850
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $ref_post->post_parent, $ref_post->menu_order, $ref_post->ID ) );
851
+
852
+ // create a new page and then goto it
853
+ $post_new = array();
854
+ $post_new["menu_order"] = $ref_post->menu_order+1;
855
+ $post_new["post_parent"] = $ref_post->post_parent;
856
+ $post_new["post_type"] = "page";
857
+ $post_new["post_status"] = "draft";
858
+ $post_new["post_title"] = $page_title;
859
+ $post_new["post_content"] = "";
860
+ $post_new["post_type"] = $post_type;
861
+ $newPostID = wp_insert_post($post_new);
862
+
863
+ } else if ( "inside" == $type ) {
864
+
865
+ /*
866
+ add page inside ref_post
867
+ */
868
+
869
+ // update menu_order, so our new post is the only one with order 0
870
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $ref_post->ID) );
871
+
872
+ $post_new = array();
873
+ $post_new["menu_order"] = 0;
874
+ $post_new["post_parent"] = $ref_post->ID;
875
+ $post_new["post_type"] = "page";
876
+ $post_new["post_status"] = "draft";
877
+ $post_new["post_title"] = $page_title;
878
+ $post_new["post_content"] = "";
879
+ $post_new["post_type"] = $post_type;
880
+ $newPostID = wp_insert_post($post_new);
881
+
882
+ }
883
+
884
+ if ($newPostID) {
885
+ // return editlink for the newly created page
886
+ $editLink = get_edit_post_link($newPostID, '');
887
+ if ($wpml_lang) {
888
+ $editLink = add_query_arg("lang", $wpml_lang, $editLink);
889
+ }
890
+ echo $editLink;
891
+ } else {
892
+ // fail, tell js
893
+ echo "0";
894
+ }
895
+
896
+
897
+ exit;
898
+ }
899
+
900
+
901
+ // AJAX: perform move of article
902
+ function cms_tpv_move_page() {
903
+ /*
904
+ the node that was moved,
905
+ the reference node in the move,
906
+ the new position relative to the reference node (one of "before", "after" or "inside"),
907
+ inside = man placerar den under en sida som inte har några barn?
908
+ */
909
+
910
+ global $wpdb;
911
+
912
+ $node_id = $_POST["node_id"]; // the node that was moved
913
+ $ref_node_id = $_POST["ref_node_id"];
914
+ $type = $_POST["type"];
915
+
916
+ $node_id = str_replace("cms-tpv-", "", $node_id);
917
+ $ref_node_id = str_replace("cms-tpv-", "", $ref_node_id);
918
+
919
+ $_POST["skip_sitepress_actions"] = true; // sitepress.class.php->save_post_actions
920
+
921
+ if ($node_id && $ref_node_id) {
922
+ #echo "\nnode_id: $node_id";
923
+ #echo "\ntype: $type";
924
+
925
+ $post_node = get_post($node_id);
926
+ $post_ref_node = get_post($ref_node_id);
927
+
928
+ // first check that post_node (moved post) is not in trash. we do not move them
929
+ if ($post_node->post_status == "trash") {
930
+ exit;
931
+ }
932
+
933
+ if ( "inside" == $type ) {
934
+
935
+ // post_node is moved inside ref_post_node
936
+ // add ref_post_node as parent to post_node and set post_nodes menu_order to 0
937
+ // @todo: shouldn't menu order of existing items be changed?
938
+ $post_to_save = array(
939
+ "ID" => $post_node->ID,
940
+ "menu_order" => 0,
941
+ "post_parent" => $post_ref_node->ID
942
+ );
943
+ wp_update_post( $post_to_save );
944
+
945
+ echo "did inside";
946
+
947
+ } elseif ( "before" == $type ) {
948
+
949
+ // post_node is placed before ref_post_node
950
+ // update menu_order of all pages with a menu order more than or equal ref_node_post and with the same parent as ref_node_post
951
+ // we do this so there will be room for our page if it's the first page
952
+ // so: no move of individial posts yet
953
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $post_ref_node->post_parent ) );
954
+
955
+ // update menu order with +1 for all pages below ref_node, this should fix the problem with "unmovable" pages because of
956
+ // multiple pages with the same menu order (...which is not the fault of this plugin!)
957
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE menu_order >= %d", $post_ref_node->menu_order+1) );
958
+
959
+ $post_to_save = array(
960
+ "ID" => $post_node->ID,
961
+ "menu_order" => $post_ref_node->menu_order,
962
+ "post_parent" => $post_ref_node->post_parent
963
+ );
964
+ wp_update_post( $post_to_save );
965
+
966
+ echo "did before";
967
+
968
+ } elseif ( "after" == $type ) {
969
+
970
+ // post_node is placed after ref_post_node
971
+
972
+ // update menu_order of all posts with the same parent ref_post_node and with a menu_order of the same as ref_post_node, but do not include ref_post_node
973
+ // +2 since multiple can have same menu order and we want our moved post to have a unique "spot"
974
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $post_ref_node->post_parent, $post_ref_node->menu_order, $post_ref_node->ID ) );
975
+
976
+ // update menu_order of post_node to the same that ref_post_node_had+1
977
+ #$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d, post_parent = %d WHERE ID = %d", $post_ref_node->menu_order+1, $post_ref_node->post_parent, $post_node->ID ) );
978
+
979
+ $post_to_save = array(
980
+ "ID" => $post_node->ID,
981
+ "menu_order" => $post_ref_node->menu_order+1,
982
+ "post_parent" => $post_ref_node->post_parent
983
+ );
984
+ wp_update_post( $post_to_save );
985
+
986
+ echo "did after";
987
+ }
988
+
989
+ #echo "ok"; // I'm done here!
990
+
991
+ } else {
992
+ // error
993
+ }
994
+
995
+ // ok, we have updated the order of the pages
996
+ // but we must tell wordpress that we have done something
997
+ // other plugins (cache plugins) will not know to clear the cache otherwise
998
+ // edit_post seems like the most appropriate action to fire
999
+ // fire for the page that was moved? can not fire for all.. would be crazy, right?
1000
+ #wp_update_post(array("ID" => $node_id));
1001
+ #wp_update_post(array("ID" => $post_ref_node));
1002
+ #clean_page_cache($node_id); clean_page_cache($post_ref_node); // hmpf.. db cache reloaded don't care
1003
+
1004
+
1005
+ exit;
1006
+ }
1007
+
1008
+
1009
+ /**
1010
+ * Show a box with some dontate-links and stuff
1011
+ */
1012
+ function cms_tpv_show_annoying_box() {
1013
+ #update_option('cms_tpv_show_annoying_little_box', 1); // enable this to show box
1014
+ if ( isset($_GET["action"]) && "cms_tpv_remove_annoying_box" == $_GET["action"] ) {
1015
+ $show_box = 0;
1016
+ update_option('cms_tpv_show_annoying_little_box', $show_box);
1017
+ } else {
1018
+ $show_box = get_option('cms_tpv_show_annoying_little_box', 1);
1019
+ }
1020
+ if ($show_box) {
1021
+ ?>
1022
+ <div class="cms_tpv_annoying_little_box">
1023
+ <p class="cms_tpv_annoying_little_box_close"><a href="<?php echo add_query_arg("action", "cms_tpv_remove_annoying_box")?>"><?php _e("Close", 'cms-tree-page-view') ?></a></p>
1024
+ <p><?php _e('<strong>Thank you for using this plugin!</strong> If you need help please check out the <a href="http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">plugin homepage</a> or the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.', 'cms-tree-page-view') ?></p>
1025
+ <p><?php _e('If you like this plugin, please <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet.', 'cms-tree-page-view') ?></p>
1026
+ </div>
1027
+ <?php
1028
+ }
1029
+ }
1030
+
1031
+
1032
+ if (!function_exists("bonny_d")) {
1033
+ function bonny_d($var) {
1034
+ echo "<pre>";
1035
+ print_r($var);
1036
+ echo "</pre>";
1037
+ }
1038
+ }
1039
+
1040
+
1041
+ function cms_tpv_install() {
1042
+
1043
+ // after upgrading/re-enabling the plugin, also re-enable the little please-donate-box
1044
+ update_option('cms_tpv_show_annoying_little_box', 1);
1045
+
1046
+ // check and update version
1047
+ $version = get_option('cms_tpv_version', 0);
1048
+ if ($version <= 0) {
1049
+ // first install or pre custom posts version:
1050
+ // make sure pages are enabled by default
1051
+ $options = array();
1052
+ $options["dashboard"] = array("page");
1053
+ $options["menu"] = array("page");
1054
+ update_option('cms_tpv_options', $options);
1055
+ }
1056
+
1057
+ // set to current version
1058
+ update_option('cms_tpv_version', CMS_TPV_VERSION);
1059
+ }
1060
+
1061
+ // when plugins are loaded, check if current plugin version is same as stored
1062
+ // if not = it's an upgrade. right?
1063
+ function cms_tpv_plugins_loaded($a) {
1064
+ $installed_version = get_option('cms_tpv_version', 0);
1065
+ #echo "installed_version: $installed_version";
1066
+ #echo "<br>" . CMS_TPV_VERSION;
1067
+ if ($installed_version != CMS_TPV_VERSION) {
1068
+ // new version!
1069
+ // upgrade stored version to current version + show that annoying litte box again
1070
+ update_option('cms_tpv_version', CMS_TPV_VERSION);
1071
+ update_option('cms_tpv_show_annoying_little_box', 1);
1072
+ }
1073
+
1074
+ }
trunk/images/page_white_text.png ADDED
Binary file
trunk/images/signature.gif ADDED
Binary file
trunk/index.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: CMS Tree Page View
4
+ Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
5
+ Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. Use the tree you to edit, view, add pages and search pages (very useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
6
+ Version: 0.7.19
7
+ Author: Pär Thernström
8
+ Author URI: http://eskapism.se/
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2010 Pär Thernström (email: par.thernstrom@gmail.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ #require("functions.php");
29
+ require(dirname(__FILE__)."/functions.php");
30
+
31
+ define( "CMS_TPV_VERSION", "0.7.19");
32
+ define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
33
+ define( "CMS_TPV_NAME", "CMS Tree Page View");
34
+
35
+ // on admin init: add styles and scripts
36
+ add_action( 'admin_init', 'cms_tpv_admin_init' );
37
+ add_action( 'admin_init', 'cms_tpv_save_settings' );
38
+
39
+ // Hook onto dashboard and admin menu
40
+ add_action( 'wp_dashboard_setup', "cms_tpv_wp_dashboard_setup" );
41
+ add_action( 'admin_menu', "cms_tpv_admin_menu" );
42
+ add_action( 'admin_head', "cms_tpv_admin_head" );
43
+
44
+ // Ajax hooks
45
+ add_action('wp_ajax_cms_tpv_get_childs', 'cms_tpv_get_childs');
46
+ add_action('wp_ajax_cms_tpv_move_page', 'cms_tpv_move_page');
47
+ add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
48
+
49
+ // activation
50
+ register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
51
+
52
+ // catch upgrade
53
+ add_action('plugins_loaded', 'cms_tpv_plugins_loaded' , 1);
54
+
55
+ // hook onto query
56
+ #add_action( 'parse_query', 'cms_tpv_parse_query' );
57
+
trunk/languages/cms-tree-page-view-be_BY.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-be_BY.po ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: CTPV\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-04-09 11:39+0000\n"
11
+ "PO-Revision-Date: 2010-04-15 23:43+0300\n"
12
+ "Last-Translator: FatCow <zhr@tut.by>\n"
13
+ "Language-Team: Marcis G. <by.marcis@gmail.com>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Belarusian\n"
18
+ "X-Poedit-Country: BELARUS\n"
19
+ "X-Poedit-SourceCharset: utf8\n"
20
+
21
+ #: functions.php:84
22
+ msgid "settings"
23
+ msgstr "налады"
24
+
25
+ #: functions.php:91
26
+ msgid "Show tree"
27
+ msgstr "Паказаць дрэва"
28
+
29
+ #: functions.php:95
30
+ msgid "on the dashboard"
31
+ msgstr "у панэлі кіравання"
32
+
33
+ #: functions.php:98
34
+ msgid "under the pages menu"
35
+ msgstr "па старонках меню"
36
+
37
+ #: functions.php:105
38
+ msgid "Save Changes"
39
+ msgstr "Захаваць змены"
40
+
41
+ #: functions.php:127
42
+ msgid "All"
43
+ msgstr "Усё"
44
+
45
+ #: functions.php:128
46
+ msgid "Public"
47
+ msgstr "Публічна"
48
+
49
+ #: functions.php:130
50
+ msgid "Expand"
51
+ msgstr "Разгарнуць"
52
+
53
+ #: functions.php:131
54
+ msgid "Collapse"
55
+ msgstr "Згарнуць"
56
+
57
+ #: functions.php:136
58
+ msgid "Search"
59
+ msgstr "Пошук"
60
+
61
+ #: functions.php:137
62
+ msgid "Searching..."
63
+ msgstr "Пошук..."
64
+
65
+ #: functions.php:142
66
+ msgid "Loading..."
67
+ msgstr "Загрузка..."
68
+
69
+ #: functions.php:144
70
+ msgid "Search: no pages found"
71
+ msgstr "Пошук: старонкі не знойдзены"
72
+
73
+ #: functions.php:146
74
+ msgid "Loading tree"
75
+ msgstr "Загрузка дрэва"
76
+
77
+ #: functions.php:248
78
+ msgid "<Untitled page>"
79
+ msgstr "<Безназоўная старонка>"
80
+
81
+ #: functions.php:264
82
+ msgid "Click to edit. Drag to move."
83
+ msgstr "Націсніце для рэдагавання. Цягніце для перасоўвання."
84
+
85
+ #: functions.php:380
86
+ msgid "New page"
87
+ msgstr "Новая старонка"
88
+
89
+ #: scripts/cms_tree_page_view.php:85
90
+ #: scripts/cms_tree_page_view.php:102
91
+ msgid "Enter title of new page"
92
+ msgstr "Увядзіце назву новай старонкі"
93
+
94
+ #: scripts/cms_tree_page_view.php:283
95
+ msgid "child pages"
96
+ msgstr "даччыныя старонкі"
97
+
98
+ #: scripts/cms_tree_page_view.php:293
99
+ msgid "Edit page"
100
+ msgstr "Рэдагаваць старонку"
101
+
102
+ #: scripts/cms_tree_page_view.php:293
103
+ msgid "Edit"
104
+ msgstr "Рэдагаваць"
105
+
106
+ #: scripts/cms_tree_page_view.php:294
107
+ msgid "View page"
108
+ msgstr "Прагляд старонкі"
109
+
110
+ #: scripts/cms_tree_page_view.php:294
111
+ msgid "View"
112
+ msgstr "Прагляд"
113
+
114
+ #: scripts/cms_tree_page_view.php:296
115
+ msgid "Add page"
116
+ msgstr "Дадаць старонку"
117
+
118
+ #: scripts/cms_tree_page_view.php:297
119
+ msgid "Add new page after"
120
+ msgstr "Дадаць новую старонку пасля "
121
+
122
+ #: scripts/cms_tree_page_view.php:297
123
+ msgid "after"
124
+ msgstr "пасля"
125
+
126
+ #: scripts/cms_tree_page_view.php:298
127
+ msgid "Add new page inside"
128
+ msgstr "Дадаць новую старонку ўсярэдзіне"
129
+
130
+ #: scripts/cms_tree_page_view.php:298
131
+ msgid "inside"
132
+ msgstr "усярэдзіне"
133
+
trunk/languages/cms-tree-page-view-cs_CZ.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-cs_CZ.po ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: CMS Tree Page View\n"
4
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
5
+ "POT-Creation-Date: 2010-08-28 21:55+0000\n"
6
+ "PO-Revision-Date: 2011-01-19 11:55+0100\n"
7
+ "Last-Translator: Georgij Gadjukin <georgij@gadjukin.net>\n"
8
+ "Language-Team: gadjukin.net <georgij@gadjukin.net>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: Czech\n"
14
+ "X-Poedit-Country: \n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: \n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: functions.php:639
23
+ #, php-format
24
+ #@ default
25
+ msgid "%s pending"
26
+ msgstr "%s čeká"
27
+
28
+ #: functions.php:612
29
+ #@ cms-tree-page-view
30
+ msgid "<Untitled page>"
31
+ msgstr "<Nepojmenovaná stránka>"
32
+
33
+ #: functions.php:60
34
+ #: functions.php:384
35
+ #@ cms-tree-page-view
36
+ msgid "Add new page after"
37
+ msgstr "Přidat novou stránku po"
38
+
39
+ #: functions.php:66
40
+ #: functions.php:388
41
+ #@ cms-tree-page-view
42
+ msgid "Add new page inside"
43
+ msgstr "Přidat novou vnořenou stránku "
44
+
45
+ #: functions.php:59
46
+ #@ cms-tree-page-view
47
+ msgid "Add page"
48
+ msgstr "Přidat stránku"
49
+
50
+ #: functions.php:74
51
+ #@ cms-tree-page-view
52
+ msgid "Adding page..."
53
+ msgstr "Přidávám stránku..."
54
+
55
+ #: functions.php:384
56
+ #@ cms-tree-page-view
57
+ msgid "After"
58
+ msgstr "Po"
59
+
60
+ #: functions.php:341
61
+ #@ cms-tree-page-view
62
+ msgid "All"
63
+ msgstr "Vše"
64
+
65
+ #: functions.php:392
66
+ #@ cms-tree-page-view
67
+ msgid "Can not create page inside of a page with draft status"
68
+ msgstr "Nelze vytvořit vnořenou stránku pokud je status Koncept"
69
+
70
+ #: functions.php:357
71
+ #@ cms-tree-page-view
72
+ msgid "Clear search"
73
+ msgstr "Zrušit výběr"
74
+
75
+ #: functions.php:680
76
+ #@ cms-tree-page-view
77
+ msgid "Click to edit. Drag to move."
78
+ msgstr "Kliknutím upravit. Tažením přesunout"
79
+
80
+ #: functions.php:349
81
+ #@ cms-tree-page-view
82
+ msgid "Collapse"
83
+ msgstr "Sbalit"
84
+
85
+ #: functions.php:632
86
+ #@ default
87
+ msgid "Comments"
88
+ msgstr "Komentáře"
89
+
90
+ #: functions.php:57
91
+ #: functions.php:379
92
+ #@ cms-tree-page-view
93
+ msgid "Edit"
94
+ msgstr "Upravit"
95
+
96
+ #: functions.php:55
97
+ #: functions.php:379
98
+ #@ cms-tree-page-view
99
+ msgid "Edit page"
100
+ msgstr "Upravit stránku"
101
+
102
+ #: functions.php:53
103
+ #@ cms-tree-page-view
104
+ msgid "Enter title of new page"
105
+ msgstr "Zadejte název nové stránky"
106
+
107
+ #: functions.php:348
108
+ #@ cms-tree-page-view
109
+ msgid "Expand"
110
+ msgstr "Rozbalit"
111
+
112
+ #: functions.php:208
113
+ #@ cms-tree-page-view
114
+ msgid "In menu"
115
+ msgstr "V menu"
116
+
117
+ #: functions.php:388
118
+ #@ cms-tree-page-view
119
+ msgid "Inside"
120
+ msgstr "Vnořit"
121
+
122
+ #: functions.php:395
123
+ #@ cms-tree-page-view
124
+ msgid "Last modified"
125
+ msgstr "Poslední změna"
126
+
127
+ #: functions.php:372
128
+ #@ cms-tree-page-view
129
+ msgid "Loading tree"
130
+ msgstr "Načítám strom"
131
+
132
+ #: functions.php:366
133
+ #@ cms-tree-page-view
134
+ msgid "Loading..."
135
+ msgstr "Načítám..."
136
+
137
+ #: functions.php:831
138
+ #@ cms-tree-page-view
139
+ msgid "New page"
140
+ msgstr "Nová stránka"
141
+
142
+ #: functions.php:335
143
+ #@ cms-tree-page-view
144
+ msgid "No posts found."
145
+ msgstr "Žádný příspěvek"
146
+
147
+ #: functions.php:360
148
+ #@ cms-tree-page-view
149
+ msgid "Nothing found."
150
+ msgstr "Nic nenalezeno"
151
+
152
+ #: functions.php:204
153
+ #@ cms-tree-page-view
154
+ msgid "On dashboard"
155
+ msgstr "Na nástěnce"
156
+
157
+ #: functions.php:400
158
+ #@ cms-tree-page-view
159
+ msgid "Page ID"
160
+ msgstr "ID stránky"
161
+
162
+ #: functions.php:73
163
+ #@ cms-tree-page-view
164
+ msgid "Password protected page"
165
+ msgstr "Stránka chráněná heslem"
166
+
167
+ #: functions.php:342
168
+ #@ cms-tree-page-view
169
+ msgid "Public"
170
+ msgstr "Veřejné"
171
+
172
+ #: functions.php:219
173
+ #@ cms-tree-page-view
174
+ msgid "Save Changes"
175
+ msgstr "Uložit změny"
176
+
177
+ #: functions.php:358
178
+ #@ cms-tree-page-view
179
+ msgid "Search"
180
+ msgstr "Hledat"
181
+
182
+ #: functions.php:369
183
+ #@ cms-tree-page-view
184
+ msgid "Search: no pages found"
185
+ msgstr "Hledání: nic nenalezeno"
186
+
187
+ #: functions.php:359
188
+ #@ cms-tree-page-view
189
+ msgid "Searching..."
190
+ msgstr "Hledám..."
191
+
192
+ #: functions.php:180
193
+ #@ cms-tree-page-view
194
+ msgid "Select where to show a tree for pages and custom post types"
195
+ msgstr "Vyberte, kde chcete zobrazit strom pro stránky a příspěvky"
196
+
197
+ #: functions.php:63
198
+ #@ cms-tree-page-view
199
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
200
+ msgstr "Sorry, nemůžete vytvořit podstránku u stránky, která má status \"Koncept\""
201
+
202
+ #: functions.php:607
203
+ #@ cms-tree-page-view
204
+ msgid "Unknown user"
205
+ msgstr "Neznámý uživatel"
206
+
207
+ #: functions.php:58
208
+ #: functions.php:380
209
+ #@ cms-tree-page-view
210
+ msgid "View"
211
+ msgstr "Zobrazit"
212
+
213
+ #: functions.php:56
214
+ #: functions.php:380
215
+ #@ cms-tree-page-view
216
+ msgid "View page"
217
+ msgstr "Zobrazit stránku"
218
+
219
+ #: functions.php:61
220
+ #@ cms-tree-page-view
221
+ msgid "after"
222
+ msgstr "po"
223
+
224
+ #: functions.php:397
225
+ #@ cms-tree-page-view
226
+ msgid "by"
227
+ msgstr "od"
228
+
229
+ #: functions.php:54
230
+ #@ cms-tree-page-view
231
+ msgid "child pages"
232
+ msgstr "vnořené stránky"
233
+
234
+ #: functions.php:649
235
+ #@ default
236
+ msgctxt "comment count"
237
+ msgid "%"
238
+ msgstr "%"
239
+
240
+ #: functions.php:649
241
+ #@ default
242
+ msgctxt "comment count"
243
+ msgid "0"
244
+ msgstr "0"
245
+
246
+ #: functions.php:649
247
+ #@ default
248
+ msgctxt "comment count"
249
+ msgid "1"
250
+ msgstr "1"
251
+
252
+ #: functions.php:67
253
+ #@ cms-tree-page-view
254
+ msgid "draft"
255
+ msgstr "koncept"
256
+
257
+ #: functions.php:68
258
+ #@ cms-tree-page-view
259
+ msgid "future"
260
+ msgstr "budoucí"
261
+
262
+ #: functions.php:62
263
+ #@ cms-tree-page-view
264
+ msgid "inside"
265
+ msgstr "vnořit"
266
+
267
+ #: functions.php:70
268
+ #: functions.php:642
269
+ #@ cms-tree-page-view
270
+ #@ default
271
+ msgid "pending"
272
+ msgstr "čekájící"
273
+
274
+ #: functions.php:71
275
+ #@ cms-tree-page-view
276
+ msgid "private"
277
+ msgstr "soukromá"
278
+
279
+ #: functions.php:69
280
+ #@ cms-tree-page-view
281
+ msgid "protected"
282
+ msgstr "chráněná"
283
+
284
+ #: functions.php:175
285
+ #@ cms-tree-page-view
286
+ msgid "settings"
287
+ msgstr "nastavení"
288
+
289
+ #: functions.php:64
290
+ #@ cms-tree-page-view
291
+ msgid "Sorry, can't create a sub page to a page with status \"trash\"."
292
+ msgstr "Sorry, nemůžete vytvořit podstránku u stránky, která má status \"Smazáno\""
293
+
294
+ #: functions.php:65
295
+ #@ cms-tree-page-view
296
+ msgid "Sorry, can't create a page after a page with status \"trash\"."
297
+ msgstr "Sorry, nemůžete vytvořit stránku za stránkou, která má status \"Smazáno\""
298
+
299
+ #: functions.php:72
300
+ #@ cms-tree-page-view
301
+ msgid "trash"
302
+ msgstr "smazáno"
303
+
304
+ #: functions.php:343
305
+ #@ cms-tree-page-view
306
+ msgid "Trash"
307
+ msgstr "Smazáno"
308
+
309
+ #: functions.php:1013
310
+ #@ cms-tree-page-view
311
+ msgid "Close"
312
+ msgstr "Zavřít"
313
+
314
+ #: functions.php:1014
315
+ #@ cms-tree-page-view
316
+ msgid "<strong>Thank you for using this plugin!</strong> If you need help please check out the <a href=\"http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">plugin homepage</a> or the <a href=\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\">support forum</a>."
317
+ msgstr "<strong>Děkujeme vám za používání tohoto pluginu!</strong> Pokud potřebujete poradit, prosím podívejte se na <a href=\\\"http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\\\">domovskou stránku pluginu</a> nebo <a href=\\\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\\\">fórum podpory</a> ."
318
+
319
+ #: functions.php:1015
320
+ #@ cms-tree-page-view
321
+ msgid "If you like this plugin, please <a href=\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet."
322
+ msgstr "Pokud se vám tento plugin líbí, prosím podpořte mou práci <a href=\\\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\\\">malým darem</a> - nebo alespoň řekněte něco pěkného o tomto pluginu v blogu."
323
+
trunk/languages/cms-tree-page-view-de_DE.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-de_DE.po ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: \n"
10
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
11
+ "POT-Creation-Date: 2010-06-30 19:00+0000\n"
12
+ "PO-Revision-Date: 2010-07-21 11:30+0200\n"
13
+ "Last-Translator: Thomas Dullnig <thomas.dullnig@sevenspire.com>\n"
14
+ "Language-Team: \n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=utf-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: functions.php:45
20
+ msgid "Enter title of new page"
21
+ msgstr "Titel der neuen Seite"
22
+
23
+ #: functions.php:46
24
+ msgid "child pages"
25
+ msgstr "Untergeordnete Seiten"
26
+
27
+ #: functions.php:47
28
+ msgid "Edit page"
29
+ msgstr "Seite bearbeiten"
30
+
31
+ #: functions.php:48
32
+ msgid "View page"
33
+ msgstr "Seite anzeigen"
34
+
35
+ #: functions.php:49
36
+ msgid "Edit"
37
+ msgstr "Bearbeiten"
38
+
39
+ #: functions.php:50
40
+ msgid "View"
41
+ msgstr "Anzeigen"
42
+
43
+ #: functions.php:51
44
+ msgid "Add page"
45
+ msgstr "Seite hinzufügen"
46
+
47
+ #: functions.php:52
48
+ msgid "Add new page after"
49
+ msgstr "Neue Seite danach hinzufügen"
50
+
51
+ #: functions.php:53
52
+ msgid "after"
53
+ msgstr "danach"
54
+
55
+ #: functions.php:54
56
+ msgid "inside"
57
+ msgstr "innerhalb"
58
+
59
+ #: functions.php:55
60
+ msgid "Add new page inside"
61
+ msgstr "Neue Seite innerhalb hinzufügen"
62
+
63
+ #: functions.php:56
64
+ msgid "draft"
65
+ msgstr "Entwurf"
66
+
67
+ #: functions.php:57
68
+ msgid "future"
69
+ msgstr "zukünftig"
70
+
71
+ #: functions.php:58
72
+ msgid "protected"
73
+ msgstr "geschützt"
74
+
75
+ #: functions.php:59
76
+ msgid "pending"
77
+ msgstr "unerledigt"
78
+
79
+ #: functions.php:60
80
+ msgid "private"
81
+ msgstr "privat"
82
+
83
+ #: functions.php:61
84
+ msgid "Password protected page"
85
+ msgstr "Passwortgeschützte Seite"
86
+
87
+ #: functions.php:113
88
+ msgid "settings"
89
+ msgstr "Einstellungen"
90
+
91
+ #: functions.php:120
92
+ msgid "Show tree"
93
+ msgstr "Zeige Baum"
94
+
95
+ #: functions.php:124
96
+ msgid "on the dashboard"
97
+ msgstr "im Dashboard"
98
+
99
+ #: functions.php:128
100
+ msgid "under the pages menu"
101
+ msgstr "im Menüpunkt unter 'Seiten'"
102
+
103
+ #: functions.php:135
104
+ msgid "Save Changes"
105
+ msgstr "Änderungen speichern"
106
+
107
+ #: functions.php:150
108
+ msgid ""
109
+ "No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add "
110
+ "a new page</a>?"
111
+ msgstr "Keine Seiten gefunden. Jetzt eine neue Seite <a href='post-new.php?post_type=page'>anlegen</a>?"
112
+
113
+ #: functions.php:157
114
+ msgid "All"
115
+ msgstr "Alle"
116
+
117
+ #: functions.php:158
118
+ msgid "Public"
119
+ msgstr "Öffentlich"
120
+
121
+ #: functions.php:160
122
+ msgid "Expand"
123
+ msgstr "Ausklappen"
124
+
125
+ #: functions.php:161
126
+ msgid "Collapse"
127
+ msgstr "Einklappen"
128
+
129
+ #: functions.php:166
130
+ msgid "Clear search"
131
+ msgstr "Suche leeren"
132
+
133
+ #: functions.php:167
134
+ msgid "Search"
135
+ msgstr "Suche"
136
+
137
+ #: functions.php:168
138
+ msgid "Searching..."
139
+ msgstr "Suche läuft..."
140
+
141
+ #: functions.php:173
142
+ msgid "Loading..."
143
+ msgstr "Lade..."
144
+
145
+ #: functions.php:175
146
+ msgid "Search: no pages found"
147
+ msgstr "Suche: keine Seiten gefunden"
148
+
149
+ #: functions.php:177
150
+ msgid "Loading tree"
151
+ msgstr "Lade Baum"
152
+
153
+ #: functions.php:277
154
+ msgid "<Untitled page>"
155
+ msgstr "<Unbetitelte Seite>"
156
+
157
+ #: functions.php:295
158
+ msgid "Click to edit. Drag to move."
159
+ msgstr "Zum Editieren klicken. Zum Bewegen ziehen."
160
+
161
+ #: functions.php:432
162
+ msgid "New page"
163
+ msgstr "Neue Seite"
trunk/languages/cms-tree-page-view-el.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-el.po ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: CMS tree page view v0.7.18\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
7
+ "POT-Creation-Date: 2011-03-06 14:33:36+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2011-03-21 04:17+0200\n"
12
+ "Last-Translator: Mihalis Papanousis <greekphotographers@gmail.com>\n"
13
+ "Language-Team: Mihalis Papanousis - http://aenaon.biz <fotonews@aenaon.biz>\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1)\n"
15
+ "X-Poedit-Language: Greek\n"
16
+ "X-Poedit-Country: GREECE\n"
17
+ "X-Poedit-SourceCharset: utf-8\n"
18
+
19
+ #: functions.php:53
20
+ msgid "Enter title of new page"
21
+ msgstr "Δώστε τον τίτλο της νέας σελίδας"
22
+
23
+ #: functions.php:54
24
+ msgid "child pages"
25
+ msgstr "θυγατρικές σελίδες"
26
+
27
+ #: functions.php:55
28
+ #: functions.php:381
29
+ msgid "Edit page"
30
+ msgstr "Επεξεργασία σελίδας"
31
+
32
+ #: functions.php:56
33
+ #: functions.php:382
34
+ msgid "View page"
35
+ msgstr "Προβολή σελίδας"
36
+
37
+ #: functions.php:57
38
+ #: functions.php:381
39
+ msgid "Edit"
40
+ msgstr "Επεξεργασία"
41
+
42
+ #: functions.php:58
43
+ #: functions.php:382
44
+ msgid "View"
45
+ msgstr "Προβολή"
46
+
47
+ #: functions.php:59
48
+ msgid "Add page"
49
+ msgstr "Προσθήκη σελίδας"
50
+
51
+ #: functions.php:60
52
+ #: functions.php:386
53
+ msgid "Add new page after"
54
+ msgstr "Προσθήκη σελίδας μετά τη"
55
+
56
+ #: functions.php:61
57
+ msgid "after"
58
+ msgstr "μετά"
59
+
60
+ #: functions.php:62
61
+ msgid "inside"
62
+ msgstr "θυγατρική"
63
+
64
+ #: functions.php:63
65
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
66
+ msgstr "Συγνώμη. Δεν επιτρέπεται η προσθήκη θυγατρικής σελίδας σε σελίδα που είναι \"προσχέδιο\"."
67
+
68
+ #: functions.php:64
69
+ msgid "Sorry, can't create a sub page to a page with status \"trash\"."
70
+ msgstr "Συγνώμη. Δεν επιτρέπεται η προσθήκη θυγατρικής σελίδας σε σελίδα που έχει \"διαγραφή\"."
71
+
72
+ #: functions.php:65
73
+ msgid "Sorry, can't create a page after a page with status \"trash\"."
74
+ msgstr "Συγνώμη. Δεν επιτρέπεται η προσθήκη σελίδας μετά απο μια σελίδα που έχει \"διαγραφή\"."
75
+
76
+ #: functions.php:66
77
+ #: functions.php:390
78
+ msgid "Add new page inside"
79
+ msgstr "Προσθήκη θυγατρικής σελίδας"
80
+
81
+ #: functions.php:67
82
+ msgid "draft"
83
+ msgstr "προσχέδιο"
84
+
85
+ #: functions.php:68
86
+ msgid "future"
87
+ msgstr "προγραμματισμένη"
88
+
89
+ #: functions.php:69
90
+ msgid "protected"
91
+ msgstr "προστατευμένη"
92
+
93
+ #: functions.php:70
94
+ #: functions.php:644
95
+ msgid "pending"
96
+ msgstr "για έλεγχο"
97
+
98
+ #: functions.php:71
99
+ msgid "private"
100
+ msgstr "προσωπική"
101
+
102
+ #: functions.php:72
103
+ msgid "trash"
104
+ msgstr "στον κάδο"
105
+
106
+ #: functions.php:73
107
+ msgid "Password protected page"
108
+ msgstr "Σελίδα προστατευμένη με συνθηματικό "
109
+
110
+ #: functions.php:74
111
+ msgid "Adding page..."
112
+ msgstr "Πρόσθεση σελίδας..."
113
+
114
+ #: functions.php:175
115
+ msgid "settings"
116
+ msgstr "ρυθμίσεις"
117
+
118
+ #: functions.php:180
119
+ msgid "Select where to show a tree for pages and custom post types"
120
+ msgstr "Επιλέξτε που θα θέλατε να εμφανίζεται ένα \"δένδρο\" των σελίδων και των άρθρων ειδικού τύπου"
121
+
122
+ #: functions.php:204
123
+ msgid "On dashboard"
124
+ msgstr "Στον πίνακα ελέγχου"
125
+
126
+ #: functions.php:208
127
+ msgid "In menu"
128
+ msgstr "Στο μενού"
129
+
130
+ #: functions.php:219
131
+ msgid "Save Changes"
132
+ msgstr "Αποθήκευση Αλλαγών"
133
+
134
+ #: functions.php:335
135
+ msgid "No posts found."
136
+ msgstr "Δεν βρέθηκαν άρθρα."
137
+
138
+ #: functions.php:341
139
+ msgid "All"
140
+ msgstr "Όλες"
141
+
142
+ #: functions.php:342
143
+ msgid "Public"
144
+ msgstr "Δημόσιες"
145
+
146
+ #: functions.php:343
147
+ msgid "Trash"
148
+ msgstr "Στον κάδο"
149
+
150
+ #: functions.php:348
151
+ msgid "Expand"
152
+ msgstr "Ανάπτυξη"
153
+
154
+ #: functions.php:349
155
+ msgid "Collapse"
156
+ msgstr "Σύμπτυξη"
157
+
158
+ #: functions.php:357
159
+ msgid "Clear search"
160
+ msgstr "Εκκαθάριση αναζήτησης"
161
+
162
+ #: functions.php:358
163
+ msgid "Search"
164
+ msgstr "Αναζήτηση"
165
+
166
+ #: functions.php:359
167
+ msgid "Searching..."
168
+ msgstr "Αναζήτηση..."
169
+
170
+ #: functions.php:360
171
+ msgid "Nothing found."
172
+ msgstr "Δεν βρέθεικε τίποτα."
173
+
174
+ #: functions.php:366
175
+ msgid "Loading..."
176
+ msgstr "Φόρτωση..."
177
+
178
+ #: functions.php:371
179
+ msgid "Search: no pages found"
180
+ msgstr "Αποτέλεσμα αναζήτησης: δεν βρέθηκαν σελίδες"
181
+
182
+ #: functions.php:374
183
+ msgid "Loading tree"
184
+ msgstr "Φόρτωση \"δένδρου\""
185
+
186
+ #: functions.php:386
187
+ msgid "After"
188
+ msgstr "Μετά"
189
+
190
+ #: functions.php:390
191
+ msgid "Inside"
192
+ msgstr "Θυγατρική"
193
+
194
+ #: functions.php:394
195
+ msgid "Can not create page inside of a page with draft status"
196
+ msgstr "Δεν είναι δυνατή η δημιουργία θυγατρικής σελίδας μέσα σε γονική που έχει διαγραφεί."
197
+
198
+ #: functions.php:397
199
+ msgid "Last modified"
200
+ msgstr "Τελευταία τροποποίηση"
201
+
202
+ #: functions.php:399
203
+ msgid "by"
204
+ msgstr "απο"
205
+
206
+ #: functions.php:402
207
+ msgid "Page ID"
208
+ msgstr "ID σελίδας"
209
+
210
+ #: functions.php:609
211
+ msgid "Unknown user"
212
+ msgstr "Άγνωστο μέλος"
213
+
214
+ #: functions.php:614
215
+ msgid "<Untitled page>"
216
+ msgstr "<Σελίδα χωρίς τίτλο>"
217
+
218
+ #: functions.php:634
219
+ msgid "Comments"
220
+ msgstr "Σχόλια"
221
+
222
+ #: functions.php:641
223
+ msgid "%s pending"
224
+ msgstr "%s είναι για έλεγχο"
225
+
226
+ #: functions.php:651
227
+ msgctxt "comment count"
228
+ msgid "0"
229
+ msgstr "0"
230
+
231
+ #: functions.php:651
232
+ msgctxt "comment count"
233
+ msgid "1"
234
+ msgstr "1"
235
+
236
+ #: functions.php:651
237
+ msgctxt "comment count"
238
+ msgid "%"
239
+ msgstr "%"
240
+
241
+ #: functions.php:682
242
+ msgid "Click to edit. Drag to move."
243
+ msgstr "Κάνετε κλίκ για επεξεργασία. Σύρετε για μετακίνηση."
244
+
245
+ #: functions.php:833
246
+ msgid "New page"
247
+ msgstr "Νέα σελίδα"
248
+
249
+ #: functions.php:1015
250
+ msgid "Close"
251
+ msgstr "Κλείσιμο"
252
+
253
+ #: functions.php:1016
254
+ msgid "<strong>Thank you for using this plugin!</strong> If you need help please check out the <a href=\"http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">plugin homepage</a> or the <a href=\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\">support forum</a>."
255
+ msgstr "<strong>Ευχαριστώ που χρησιμοποιείτε αυτό το πρόσθετο!</strong> Άν χρειάζεστε βοήθεια παρακαλώ πηγαίνετε στην <a href=\"http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">σελίδα του προσθέτου</a> ή το <a href=\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\">φόρουμ υποστήριξης</a>."
256
+
257
+ #: functions.php:1017
258
+ msgid "If you like this plugin, please <a href=\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet."
259
+ msgstr "Αν σας αρέσει αυτό το πρόσθετο, παρακαλώ <a href=\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">υποστηρίξτε την δουλειά μου κάνοντας κάποια δωρεά</a> - ή τουλάχιστον γράψετε κάτι καλό σχετικά με αυτό σε άρθρο κάποιου blog ή κάντε ένα tweet."
260
+
trunk/languages/cms-tree-page-view-es_ES.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-es_ES.po ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: CTPV\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-04-09 11:39+0000\n"
11
+ "PO-Revision-Date: 2010-08-20 03:20-0300\n"
12
+ "Last-Translator: Carlos Janini <carlos@carlosjanini.com.ar>\n"
13
+ "Language-Team: Marcis G. <by.marcis@gmail.com>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Belarusian\n"
18
+ "X-Poedit-Country: BELARUS\n"
19
+ "X-Poedit-SourceCharset: utf8\n"
20
+
21
+ #: functions.php:84
22
+ msgid "settings"
23
+ msgstr "Configuraciones"
24
+
25
+ #: functions.php:91
26
+ msgid "Show tree"
27
+ msgstr "Ver arbol"
28
+
29
+ #: functions.php:95
30
+ msgid "on the dashboard"
31
+ msgstr "En el escritorio"
32
+
33
+ #: functions.php:98
34
+ msgid "under the pages menu"
35
+ msgstr "Abajo de las paginas menu"
36
+
37
+ #: functions.php:105
38
+ msgid "Save Changes"
39
+ msgstr "Guardar carmbios"
40
+
41
+ #: functions.php:127
42
+ msgid "All"
43
+ msgstr "Todo"
44
+
45
+ #: functions.php:128
46
+ msgid "Public"
47
+ msgstr "Publico"
48
+
49
+ #: functions.php:130
50
+ msgid "Expand"
51
+ msgstr "Expandir"
52
+
53
+ #: functions.php:131
54
+ msgid "Collapse"
55
+ msgstr "Colapsar"
56
+
57
+ #: functions.php:136
58
+ msgid "Search"
59
+ msgstr "Buscar"
60
+
61
+ #: functions.php:137
62
+ msgid "Searching..."
63
+ msgstr "Buscando..."
64
+
65
+ #: functions.php:142
66
+ msgid "Loading..."
67
+ msgstr "Cargando.."
68
+
69
+ #: functions.php:144
70
+ msgid "Search: no pages found"
71
+ msgstr "Busqueda: No se encontraron paginas"
72
+
73
+ #: functions.php:146
74
+ msgid "Loading tree"
75
+ msgstr "Cargando arbol"
76
+
77
+ #: functions.php:248
78
+ msgid "<Untitled page>"
79
+ msgstr "< Pagina sin titulo >"
80
+
81
+ #: functions.php:264
82
+ msgid "Click to edit. Drag to move."
83
+ msgstr "Click para editar. Arrastrar para mover."
84
+
85
+ #: functions.php:380
86
+ msgid "New page"
87
+ msgstr "Nueva pagina"
88
+
89
+ #: scripts/cms_tree_page_view.php:85
90
+ #: scripts/cms_tree_page_view.php:102
91
+ msgid "Enter title of new page"
92
+ msgstr "Introducir nuevo titulo para la pagina"
93
+
94
+ #: scripts/cms_tree_page_view.php:283
95
+ msgid "child pages"
96
+ msgstr "Paginas hijos"
97
+
98
+ #: scripts/cms_tree_page_view.php:293
99
+ msgid "Edit page"
100
+ msgstr "Editar pagina"
101
+
102
+ #: scripts/cms_tree_page_view.php:293
103
+ msgid "Edit"
104
+ msgstr "Editar"
105
+
106
+ #: scripts/cms_tree_page_view.php:294
107
+ msgid "View page"
108
+ msgstr "Ver pagina"
109
+
110
+ #: scripts/cms_tree_page_view.php:294
111
+ msgid "View"
112
+ msgstr "Ver"
113
+
114
+ #: scripts/cms_tree_page_view.php:296
115
+ msgid "Add page"
116
+ msgstr "Agregar pagina"
117
+
118
+ #: scripts/cms_tree_page_view.php:297
119
+ msgid "Add new page after"
120
+ msgstr "Agregar nueva pagina posterior"
121
+
122
+ #: scripts/cms_tree_page_view.php:297
123
+ msgid "after"
124
+ msgstr "Posterior"
125
+
126
+ #: scripts/cms_tree_page_view.php:298
127
+ msgid "Add new page inside"
128
+ msgstr "Agregar nueva pagina adentro"
129
+
130
+ #: scripts/cms_tree_page_view.php:298
131
+ msgid "inside"
132
+ msgstr "Adentro"
133
+
trunk/languages/cms-tree-page-view-fr_FR.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-fr_FR.po ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-06-30 19:00+0000\n"
11
+ "PO-Revision-Date: 2010-07-01 14:45+0100\n"
12
+ "Last-Translator: Pär Thernström <par.thernstrom@gmail.com>\n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: French\n"
18
+ "X-Poedit-Country: FRANCE\n"
19
+
20
+ #: functions.php:45
21
+ msgid "Enter title of new page"
22
+ msgstr "Saisissez le titre de la page"
23
+
24
+ #: functions.php:46
25
+ msgid "child pages"
26
+ msgstr "Pages sous cette page"
27
+
28
+ #: functions.php:47
29
+ msgid "Edit page"
30
+ msgstr "Modifier la page"
31
+
32
+ #: functions.php:48
33
+ msgid "View page"
34
+ msgstr "Voir la page"
35
+
36
+ #: functions.php:49
37
+ msgid "Edit"
38
+ msgstr "Modifier"
39
+
40
+ #: functions.php:50
41
+ msgid "View"
42
+ msgstr "Voir"
43
+
44
+ #: functions.php:51
45
+ msgid "Add page"
46
+ msgstr "Ajouter une page"
47
+
48
+ #: functions.php:52
49
+ msgid "Add new page after"
50
+ msgstr "Ajouter une page après cette page"
51
+
52
+ #: functions.php:53
53
+ msgid "after"
54
+ msgstr "après"
55
+
56
+ #: functions.php:54
57
+ msgid "inside"
58
+ msgstr "sous cette page"
59
+
60
+ #: functions.php:55
61
+ msgid "Add new page inside"
62
+ msgstr "Ajouter une page sous cette page"
63
+
64
+ #: functions.php:56
65
+ msgid "draft"
66
+ msgstr "brouillon"
67
+
68
+ #: functions.php:57
69
+ msgid "future"
70
+ msgstr "planifié"
71
+
72
+ #: functions.php:58
73
+ msgid "protected"
74
+ msgstr "protégé"
75
+
76
+ #: functions.php:59
77
+ msgid "pending"
78
+ msgstr "en attente"
79
+
80
+ #: functions.php:60
81
+ msgid "private"
82
+ msgstr "privé"
83
+
84
+ #: functions.php:61
85
+ msgid "Password protected page"
86
+ msgstr "Page protégée par mot de passe"
87
+
88
+ #: functions.php:113
89
+ msgid "settings"
90
+ msgstr "paramètres"
91
+
92
+ #: functions.php:120
93
+ msgid "Show tree"
94
+ msgstr "Voir l'arborescence"
95
+
96
+ #: functions.php:124
97
+ msgid "on the dashboard"
98
+ msgstr "dans le menu"
99
+
100
+ #: functions.php:128
101
+ msgid "under the pages menu"
102
+ msgstr "sous les pages du menu"
103
+
104
+ #: functions.php:135
105
+ msgid "Save Changes"
106
+ msgstr "Enregistrer"
107
+
108
+ #: functions.php:150
109
+ msgid "No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?"
110
+ msgstr "Aucune page trouvée. Peut-être voulez-vous <a href='post-new.php?post_type=page'>ajouter une page</a>?"
111
+
112
+ #: functions.php:157
113
+ msgid "All"
114
+ msgstr "Toutes les pages"
115
+
116
+ #: functions.php:158
117
+ msgid "Public"
118
+ msgstr "Pages publiées"
119
+
120
+ #: functions.php:160
121
+ msgid "Expand"
122
+ msgstr "Dérouler"
123
+
124
+ #: functions.php:161
125
+ msgid "Collapse"
126
+ msgstr "Refermer"
127
+
128
+ #: functions.php:166
129
+ msgid "Clear search"
130
+ msgstr "Effacer la recherche"
131
+
132
+ #: functions.php:167
133
+ msgid "Search"
134
+ msgstr "Rechercher"
135
+
136
+ #: functions.php:168
137
+ msgid "Searching..."
138
+ msgstr "Recherche en cours"
139
+
140
+ #: functions.php:173
141
+ msgid "Loading..."
142
+ msgstr "Chargement en cours"
143
+
144
+ #: functions.php:175
145
+ msgid "Search: no pages found"
146
+ msgstr "Recherche : aucune page trouvée"
147
+
148
+ #: functions.php:177
149
+ msgid "Loading tree"
150
+ msgstr "Chargement de l'arborescence"
151
+
152
+ #: functions.php:277
153
+ msgid "<Untitled page>"
154
+ msgstr "<Sans-titre>"
155
+
156
+ #: functions.php:295
157
+ msgid "Click to edit. Drag to move."
158
+ msgstr "Cliquez pour modifier, vous pouvez aussi déplacer la page"
159
+
160
+ #: functions.php:432
161
+ msgid "New page"
162
+ msgstr "Nouvelle page"
163
+
trunk/languages/cms-tree-page-view-he_IL.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-he_IL.po ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: cms-tree-page-view\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-08-28 21:55+0000\n"
11
+ "PO-Revision-Date: 2011-02-28 23:55+0200\n"
12
+ "Last-Translator: shahar <asafgreenberg@gmail.com>\n"
13
+ "Language-Team: ותודה לאחי דקר <asafgreenberg@gmail.com>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Hebrew\n"
18
+ "X-Poedit-Country: ISRAEL\n"
19
+ "X-Poedit-SourceCharset: utf-8\n"
20
+ "Plural-Forms: Plural-Forms: nplurals=2; plural=n != 1;\n"
21
+
22
+ #: functions.php:53
23
+ msgid "Enter title of new page"
24
+ msgstr "כתבי כותרת לעמוד החדש"
25
+
26
+ #: functions.php:54
27
+ msgid "child pages"
28
+ msgstr "עמודי-בת"
29
+
30
+ #: functions.php:55
31
+ #: functions.php:376
32
+ msgid "Edit page"
33
+ msgstr "עריכת עמוד"
34
+
35
+ #: functions.php:56
36
+ #: functions.php:377
37
+ msgid "View page"
38
+ msgstr "הצגת עמוד"
39
+
40
+ #: functions.php:57
41
+ #: functions.php:376
42
+ msgid "Edit"
43
+ msgstr "עריכה"
44
+
45
+ #: functions.php:58
46
+ #: functions.php:377
47
+ msgid "View"
48
+ msgstr "תצוגה"
49
+
50
+ #: functions.php:59
51
+ msgid "Add page"
52
+ msgstr "הוספת עמוד"
53
+
54
+ #: functions.php:60
55
+ #: functions.php:381
56
+ msgid "Add new page after"
57
+ msgstr "הוסיפי עמוד חדש אחרי"
58
+
59
+ #: functions.php:61
60
+ msgid "after"
61
+ msgstr "אחרי"
62
+
63
+ #: functions.php:62
64
+ msgid "inside"
65
+ msgstr "בתוך"
66
+
67
+ #: functions.php:63
68
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
69
+ msgstr "'צטערת, לא יכולה ליצור תת-עמוד של עמוד בסטטוס \"טיוטה\""
70
+
71
+ #: functions.php:64
72
+ #: functions.php:385
73
+ msgid "Add new page inside"
74
+ msgstr "הוסיפת עמוד חדש בתוך"
75
+
76
+ #: functions.php:65
77
+ msgid "draft"
78
+ msgstr "טיוטה"
79
+
80
+ #: functions.php:66
81
+ msgid "future"
82
+ msgstr "עתידי"
83
+
84
+ #: functions.php:67
85
+ msgid "protected"
86
+ msgstr "מוגן"
87
+
88
+ #: functions.php:68
89
+ #: functions.php:586
90
+ msgid "pending"
91
+ msgstr "ממתין"
92
+
93
+ #: functions.php:69
94
+ msgid "private"
95
+ msgstr "פרטית"
96
+
97
+ #: functions.php:70
98
+ msgid "Password protected page"
99
+ msgstr "עמוד מוגן בסיסמה"
100
+
101
+ #: functions.php:71
102
+ msgid "Adding page..."
103
+ msgstr "מוסיפה עמוד..."
104
+
105
+ #: functions.php:172
106
+ msgid "settings"
107
+ msgstr "הגדרות"
108
+
109
+ #: functions.php:177
110
+ msgid "Select where to show a tree for pages and custom post types"
111
+ msgstr "בחרי היכן להציג עץ עבור עמודים ופוסטים מותאמות אישית"
112
+
113
+ #: functions.php:201
114
+ msgid "On dashboard"
115
+ msgstr "בלוח הבקרה"
116
+
117
+ #: functions.php:205
118
+ msgid "In menu"
119
+ msgstr "בתפריט"
120
+
121
+ #: functions.php:216
122
+ msgid "Save Changes"
123
+ msgstr "שמירת שינויים"
124
+
125
+ #: functions.php:333
126
+ msgid "No posts found."
127
+ msgstr "לא נמצאו פוסטים"
128
+
129
+ #: functions.php:339
130
+ msgid "All"
131
+ msgstr "הכל"
132
+
133
+ #: functions.php:340
134
+ msgid "Public"
135
+ msgstr "ציבורי"
136
+
137
+ #: functions.php:345
138
+ msgid "Expand"
139
+ msgstr "פתח הכל"
140
+
141
+ #: functions.php:346
142
+ msgid "Collapse"
143
+ msgstr "סגור הכל"
144
+
145
+ #: functions.php:354
146
+ msgid "Clear search"
147
+ msgstr "ניקוי"
148
+
149
+ #: functions.php:355
150
+ msgid "Search"
151
+ msgstr "חיפוש"
152
+
153
+ #: functions.php:356
154
+ msgid "Searching..."
155
+ msgstr "מחפשת..."
156
+
157
+ #: functions.php:357
158
+ msgid "Nothing found."
159
+ msgstr "לא מצאתי"
160
+
161
+ #: functions.php:363
162
+ msgid "Loading..."
163
+ msgstr "טוענת..."
164
+
165
+ #: functions.php:366
166
+ msgid "Search: no pages found"
167
+ msgstr "חיפוש: לא נמצאו עמודים"
168
+
169
+ #: functions.php:369
170
+ msgid "Loading tree"
171
+ msgstr "טוענת עץ"
172
+
173
+ #: functions.php:381
174
+ msgid "After"
175
+ msgstr "אחרי"
176
+
177
+ #: functions.php:385
178
+ msgid "Inside"
179
+ msgstr "בתוך"
180
+
181
+ #: functions.php:389
182
+ msgid "Can not create page inside of a page with draft status"
183
+ msgstr "לא יכולה ליצור עמוד בתוך עמוד טיוטה"
184
+
185
+ #: functions.php:392
186
+ msgid "Last modified"
187
+ msgstr "שונתה לאחרונה ב..."
188
+
189
+ #: functions.php:394
190
+ msgid "by"
191
+ msgstr "ע\"י"
192
+
193
+ #: functions.php:397
194
+ msgid "Page ID"
195
+ msgstr "מזהה עמוד (ID)"
196
+
197
+ #: functions.php:551
198
+ msgid "Unknown user"
199
+ msgstr "משתמשת לא ידועה"
200
+
201
+ #: functions.php:556
202
+ msgid "<Untitled page>"
203
+ msgstr "<ללא שם>"
204
+
205
+ #: functions.php:576
206
+ msgid "Comments"
207
+ msgstr "הערות"
208
+
209
+ #: functions.php:583
210
+ #, php-format
211
+ msgid "%s pending"
212
+ msgstr "ממתינה %s"
213
+
214
+ #: functions.php:593
215
+ msgctxt "comment count"
216
+ msgid "0"
217
+ msgstr "0"
218
+
219
+ #: functions.php:593
220
+ msgctxt "comment count"
221
+ msgid "1"
222
+ msgstr "1"
223
+
224
+ #: functions.php:593
225
+ msgctxt "comment count"
226
+ msgid "%"
227
+ msgstr "%"
228
+
229
+ #: functions.php:624
230
+ msgid "Click to edit. Drag to move."
231
+ msgstr "לחצי לעריכה. גררי להזזה"
232
+
233
+ #: functions.php:775
234
+ msgid "New page"
235
+ msgstr "עמוד חדש"
236
+
trunk/languages/cms-tree-page-view-hu_HU.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-hu_HU.po ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-06-30 19:00+0000\n"
11
+ "PO-Revision-Date: 2011-03-08 19:52+0100\n"
12
+ "Last-Translator: Szijártó József <hutchington@gmail.com>\n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+
18
+ #: functions.php:45
19
+ msgid "Enter title of new page"
20
+ msgstr "Új oldal címének megadása"
21
+
22
+ #: functions.php:46
23
+ msgid "child pages"
24
+ msgstr "aloldalak"
25
+
26
+ #: functions.php:47
27
+ msgid "Edit page"
28
+ msgstr "Oldal szerkesztése"
29
+
30
+ #: functions.php:48
31
+ msgid "View page"
32
+ msgstr "Oldal megtekintése"
33
+
34
+ #: functions.php:49
35
+ msgid "Edit"
36
+ msgstr "Szerkeszt"
37
+
38
+ #: functions.php:50
39
+ msgid "View"
40
+ msgstr "Megtekint"
41
+
42
+ #: functions.php:51
43
+ msgid "Add page"
44
+ msgstr "Oldal hozzáadása"
45
+
46
+ #: functions.php:52
47
+ msgid "Add new page after"
48
+ msgstr "Oldal hozzáadása ezután"
49
+
50
+ #: functions.php:53
51
+ msgid "after"
52
+ msgstr "utána"
53
+
54
+ #: functions.php:54
55
+ msgid "inside"
56
+ msgstr "belső"
57
+
58
+ #: functions.php:55
59
+ msgid "Add new page inside"
60
+ msgstr "Új oldal bele"
61
+
62
+ #: functions.php:56
63
+ msgid "draft"
64
+ msgstr "Vázlat"
65
+
66
+ #: functions.php:57
67
+ msgid "future"
68
+ msgstr "jövő"
69
+
70
+ #: functions.php:58
71
+ msgid "protected"
72
+ msgstr "védett"
73
+
74
+ #: functions.php:59
75
+ msgid "pending"
76
+ msgstr "függőben"
77
+
78
+ #: functions.php:60
79
+ msgid "private"
80
+ msgstr "privát"
81
+
82
+ #: functions.php:61
83
+ msgid "Password protected page"
84
+ msgstr "Jelszóval védett"
85
+
86
+ #: functions.php:113
87
+ msgid "settings"
88
+ msgstr "beállítások"
89
+
90
+ #: functions.php:120
91
+ msgid "Show tree"
92
+ msgstr "Fa mutatása"
93
+
94
+ #: functions.php:124
95
+ msgid "on the dashboard"
96
+ msgstr "a Vezérlőpulton"
97
+
98
+ #: functions.php:128
99
+ msgid "under the pages menu"
100
+ msgstr "az oldalak menüje alatt"
101
+
102
+ #: functions.php:135
103
+ msgid "Save Changes"
104
+ msgstr "Változtatások mentése"
105
+
106
+ #: functions.php:150
107
+ msgid "No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?"
108
+ msgstr "Nem található az oldal. Szeretnél hozzáadni egy <a href='post-new.php?post_type=page'>új oldalt</a>?"
109
+
110
+ #: functions.php:157
111
+ msgid "All"
112
+ msgstr "Összes"
113
+
114
+ #: functions.php:158
115
+ msgid "Public"
116
+ msgstr "Publikus"
117
+
118
+ #: functions.php:160
119
+ msgid "Expand"
120
+ msgstr "Kibont"
121
+
122
+ #: functions.php:161
123
+ msgid "Collapse"
124
+ msgstr "Becsuk"
125
+
126
+ #: functions.php:166
127
+ msgid "Clear search"
128
+ msgstr "Keresés törlése"
129
+
130
+ #: functions.php:167
131
+ msgid "Search"
132
+ msgstr "Keresés"
133
+
134
+ #: functions.php:168
135
+ msgid "Searching..."
136
+ msgstr "Keresés..."
137
+
138
+ #: functions.php:173
139
+ msgid "Loading..."
140
+ msgstr "Betöltés..."
141
+
142
+ #: functions.php:175
143
+ msgid "Search: no pages found"
144
+ msgstr "Keresés: nem találhatók oldalak"
145
+
146
+ #: functions.php:177
147
+ msgid "Loading tree"
148
+ msgstr "Fa betöltése"
149
+
150
+ #: functions.php:277
151
+ msgid "<Untitled page>"
152
+ msgstr "<Névtelen oldal>"
153
+
154
+ #: functions.php:295
155
+ msgid "Click to edit. Drag to move."
156
+ msgstr "Kattints a szerkesztésért. Fogd a mozgatásért."
157
+
158
+ #: functions.php:432
159
+ msgid "New page"
160
+ msgstr "Új oldal"
161
+
trunk/languages/cms-tree-page-view-it_IT.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-it_IT.po ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-06-30 19:00+0000\n"
11
+ "PO-Revision-Date: 2011-01-17 19:00+0100\n"
12
+ "Last-Translator: Andrea Bersi\n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Italian\n"
18
+ "X-Poedit-Country: ITALIA\n"
19
+
20
+ #: functions.php:45
21
+ msgid "Enter title of new page"
22
+ msgstr "Inserire titolo pagina"
23
+
24
+ #: functions.php:46
25
+ msgid "child pages"
26
+ msgstr "Pagine figlie"
27
+
28
+ #: functions.php:47
29
+ msgid "Edit page"
30
+ msgstr "Modifica la pagina"
31
+
32
+ #: functions.php:48
33
+ msgid "View page"
34
+ msgstr "Vedi pagina"
35
+
36
+ #: functions.php:49
37
+ msgid "Edit"
38
+ msgstr "Modifica"
39
+
40
+ #: functions.php:50
41
+ msgid "View"
42
+ msgstr "Vedi"
43
+
44
+ #: functions.php:51
45
+ msgid "Add page"
46
+ msgstr "Aggiungi nuova pagina"
47
+
48
+ #: functions.php:52
49
+ msgid "Add new page after"
50
+ msgstr "Aggiungi dopo la pagina"
51
+
52
+ #: functions.php:53
53
+ msgid "after"
54
+ msgstr "dopo"
55
+
56
+ #: functions.php:54
57
+ msgid "inside"
58
+ msgstr "all'interno della pagina"
59
+
60
+ #: functions.php:55
61
+ msgid "Add new page inside"
62
+ msgstr "Aggiungi pagina figlia"
63
+
64
+ #: functions.php:56
65
+ msgid "draft"
66
+ msgstr "Bozza"
67
+
68
+ #: functions.php:57
69
+ msgid "future"
70
+ msgstr "pianificata"
71
+
72
+ #: functions.php:58
73
+ msgid "protected"
74
+ msgstr "protetta"
75
+
76
+ #: functions.php:59
77
+ msgid "pending"
78
+ msgstr "in attesa"
79
+
80
+ #: functions.php:60
81
+ msgid "private"
82
+ msgstr "privata"
83
+
84
+ #: functions.php:61
85
+ msgid "Password protected page"
86
+ msgstr "Pagina protetta da password"
87
+
88
+ #: functions.php:113
89
+ msgid "settings"
90
+ msgstr "impostazioni"
91
+
92
+ #: functions.php:120
93
+ msgid "Show tree"
94
+ msgstr "Mostra gerarchia"
95
+
96
+ #: functions.php:124
97
+ msgid "on the dashboard"
98
+ msgstr "nella bacheca"
99
+
100
+ #: functions.php:128
101
+ msgid "under the pages menu"
102
+ msgstr "nel menù delle pagine"
103
+
104
+ #: functions.php:135
105
+ msgid "Save Changes"
106
+ msgstr "Salva"
107
+
108
+ #: functions.php:150
109
+ msgid "No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?"
110
+ msgstr "Nessuna pagina. Vuoi <a href='post-new.php?post_type=page'>creare una pagina</a>?"
111
+
112
+ #: functions.php:157
113
+ msgid "All"
114
+ msgstr "Tutte le pagine"
115
+
116
+ #: functions.php:158
117
+ msgid "Public"
118
+ msgstr "Pagine pubblicate"
119
+
120
+ #: functions.php:160
121
+ msgid "Expand"
122
+ msgstr "Espandi"
123
+
124
+ #: functions.php:161
125
+ msgid "Collapse"
126
+ msgstr "Contrai"
127
+
128
+ #: functions.php:166
129
+ msgid "Clear search"
130
+ msgstr "Cancella risultati ricerca"
131
+
132
+ #: functions.php:167
133
+ msgid "Search"
134
+ msgstr "Ricerca"
135
+
136
+ #: functions.php:168
137
+ msgid "Searching..."
138
+ msgstr "Ricerca..."
139
+
140
+ #: functions.php:173
141
+ msgid "Loading..."
142
+ msgstr "Caricamento..."
143
+
144
+ #: functions.php:175
145
+ msgid "Search: no pages found"
146
+ msgstr "Ricerca: nessuna pagina trovata"
147
+
148
+ #: functions.php:177
149
+ msgid "Loading tree"
150
+ msgstr "Caricamento gerarchia"
151
+
152
+ #: functions.php:277
153
+ msgid "<Untitled page>"
154
+ msgstr "<Nessun titolo>"
155
+
156
+ #: functions.php:295
157
+ msgid "Click to edit. Drag to move."
158
+ msgstr "Clicca per modificare o per variare la gerarchia"
159
+
160
+ #: functions.php:432
161
+ msgid "New page"
162
+ msgstr "Nuova pagina"
163
+
164
+ #: functions.php:395
165
+ msgid "Last modified"
166
+ msgstr "Modificato il"
167
+
168
+ #: functions.php:384
169
+ msgid "After"
170
+ msgstr "dopo"
171
+
172
+ #: functions.php:388
173
+ msgid "Inside"
174
+ msgstr "all'interno della pagina"
175
+
trunk/languages/cms-tree-page-view-nl_NL.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-nl_NL.po ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: CMS-tree-page-view\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-08-28 21:55+0000\n"
11
+ "PO-Revision-Date: 2011-02-23 13:01+0100\n"
12
+ "Last-Translator: Cees van den Heuvel <cvandenheuvel@intermediad.nl>\n"
13
+ "Language-Team: Intermediad <cvandenheuvel@intermediad.nl>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Dutch\n"
18
+ "X-Poedit-Country: NETHERLANDS\n"
19
+
20
+ #: functions.php:53
21
+ msgid "Enter title of new page"
22
+ msgstr "Voer de titel van de nieuwe pagina in"
23
+
24
+ #: functions.php:54
25
+ msgid "child pages"
26
+ msgstr "dochter paginas"
27
+
28
+ #: functions.php:55
29
+ #: functions.php:376
30
+ msgid "Edit page"
31
+ msgstr "Wijzig pagina"
32
+
33
+ #: functions.php:56
34
+ #: functions.php:377
35
+ msgid "View page"
36
+ msgstr "Toon pagina"
37
+
38
+ #: functions.php:57
39
+ #: functions.php:376
40
+ msgid "Edit"
41
+ msgstr "Wijzig"
42
+
43
+ #: functions.php:58
44
+ #: functions.php:377
45
+ msgid "View"
46
+ msgstr "Toon"
47
+
48
+ #: functions.php:59
49
+ msgid "Add page"
50
+ msgstr "Voeg pagina toe"
51
+
52
+ #: functions.php:60
53
+ #: functions.php:381
54
+ msgid "Add new page after"
55
+ msgstr "Voeg nieuwe pagina toe na"
56
+
57
+ #: functions.php:61
58
+ msgid "after"
59
+ msgstr "na"
60
+
61
+ #: functions.php:62
62
+ msgid "inside"
63
+ msgstr "binnen"
64
+
65
+ #: functions.php:63
66
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
67
+ msgstr "Sorry, kan geen sub pagina maken voor een pagina met de status \"draft\"."
68
+
69
+ #: functions.php:64
70
+ #: functions.php:385
71
+ msgid "Add new page inside"
72
+ msgstr "Voeg nieuwe pagina toe binnen"
73
+
74
+ #: functions.php:65
75
+ msgid "draft"
76
+ msgstr "concept"
77
+
78
+ #: functions.php:66
79
+ msgid "future"
80
+ msgstr "toekomstig"
81
+
82
+ #: functions.php:67
83
+ msgid "protected"
84
+ msgstr "beschermd"
85
+
86
+ #: functions.php:68
87
+ #: functions.php:586
88
+ msgid "pending"
89
+ msgstr "wacht"
90
+
91
+ #: functions.php:69
92
+ msgid "private"
93
+ msgstr "privé"
94
+
95
+ #: functions.php:70
96
+ msgid "Password protected page"
97
+ msgstr "Wachtwoord beschermde pagina"
98
+
99
+ #: functions.php:71
100
+ msgid "Adding page..."
101
+ msgstr "Toevoegen pagina ..."
102
+
103
+ #: functions.php:172
104
+ msgid "settings"
105
+ msgstr "instellingen"
106
+
107
+ #: functions.php:177
108
+ msgid "Select where to show a tree for pages and custom post types"
109
+ msgstr "Kies waar de boom voor pagina's en eigen berichttypes getoond wordt"
110
+
111
+ #: functions.php:201
112
+ msgid "On dashboard"
113
+ msgstr "Op het Dashboard"
114
+
115
+ #: functions.php:205
116
+ msgid "In menu"
117
+ msgstr "In het Menu"
118
+
119
+ #: functions.php:216
120
+ msgid "Save Changes"
121
+ msgstr "Opslaan wijzigingen"
122
+
123
+ #: functions.php:333
124
+ msgid "No posts found."
125
+ msgstr "Geen berichten gevonden."
126
+
127
+ #: functions.php:339
128
+ msgid "All"
129
+ msgstr "Alle"
130
+
131
+ #: functions.php:340
132
+ msgid "Public"
133
+ msgstr "Openbare"
134
+
135
+ #: functions.php:345
136
+ msgid "Expand"
137
+ msgstr "Uitklappen"
138
+
139
+ #: functions.php:346
140
+ msgid "Collapse"
141
+ msgstr "Inklappen"
142
+
143
+ #: functions.php:354
144
+ msgid "Clear search"
145
+ msgstr "Wis zoekcriteria"
146
+
147
+ #: functions.php:355
148
+ msgid "Search"
149
+ msgstr "Zoek"
150
+
151
+ #: functions.php:356
152
+ msgid "Searching..."
153
+ msgstr "Zoeken ..."
154
+
155
+ #: functions.php:357
156
+ msgid "Nothing found."
157
+ msgstr "Niets gevonden."
158
+
159
+ #: functions.php:363
160
+ msgid "Loading..."
161
+ msgstr "Laden ..."
162
+
163
+ #: functions.php:366
164
+ msgid "Search: no pages found"
165
+ msgstr "Zoek: geen paginas gevonden"
166
+
167
+ #: functions.php:369
168
+ msgid "Loading tree"
169
+ msgstr "Boom laden"
170
+
171
+ #: functions.php:381
172
+ msgid "After"
173
+ msgstr "Na"
174
+
175
+ #: functions.php:385
176
+ msgid "Inside"
177
+ msgstr "Binnen"
178
+
179
+ #: functions.php:389
180
+ msgid "Can not create page inside of a page with draft status"
181
+ msgstr "Kan geen pagina maken binnen een pagina met de status concept"
182
+
183
+ #: functions.php:392
184
+ msgid "Last modified"
185
+ msgstr "Laatst gewijzigd"
186
+
187
+ #: functions.php:394
188
+ msgid "by"
189
+ msgstr "door"
190
+
191
+ #: functions.php:397
192
+ msgid "Page ID"
193
+ msgstr "Pagina ID"
194
+
195
+ #: functions.php:551
196
+ msgid "Unknown user"
197
+ msgstr "Onbekende gebruiker"
198
+
199
+ #: functions.php:556
200
+ msgid "<Untitled page>"
201
+ msgstr "<Pagina zonder titel>"
202
+
203
+ #: functions.php:576
204
+ msgid "Comments"
205
+ msgstr "Opmerkingen"
206
+
207
+ #: functions.php:583
208
+ #, php-format
209
+ msgid "%s pending"
210
+ msgstr "% voortgang"
211
+
212
+ #: functions.php:593
213
+ msgctxt "comment count"
214
+ msgid "0"
215
+ msgstr "0"
216
+
217
+ #: functions.php:593
218
+ msgctxt "comment count"
219
+ msgid "1"
220
+ msgstr "1"
221
+
222
+ #: functions.php:593
223
+ msgctxt "comment count"
224
+ msgid "%"
225
+ msgstr "%"
226
+
227
+ #: functions.php:624
228
+ msgid "Click to edit. Drag to move."
229
+ msgstr "Klik om te wijzigen. Sleep om te verplaatsen."
230
+
231
+ #: functions.php:775
232
+ msgid "New page"
233
+ msgstr "Nieuwe pagina"
234
+
trunk/languages/cms-tree-page-view-pt_BR.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-pt_BR.po ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: CMS Tree View\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-10-14 16:53-0300\n"
6
+ "PO-Revision-Date: 2010-10-14 16:57-0300\n"
7
+ "Last-Translator: Ricardo Tomasi <ricardobeat@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: Portuguese\n"
15
+ "X-Poedit-Country: Brazil\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../scripts\n"
19
+
20
+ #: ../functions.php:53
21
+ msgid "Enter title of new page"
22
+ msgstr "Título da nova página"
23
+
24
+ #: ../functions.php:54
25
+ msgid "child pages"
26
+ msgstr "sub-páginas"
27
+
28
+ #: ../functions.php:55
29
+ #: ../functions.php:379
30
+ msgid "Edit page"
31
+ msgstr "Editar página"
32
+
33
+ #: ../functions.php:56
34
+ #: ../functions.php:380
35
+ msgid "View page"
36
+ msgstr "Ver página"
37
+
38
+ #: ../functions.php:57
39
+ #: ../functions.php:379
40
+ msgid "Edit"
41
+ msgstr "Editar"
42
+
43
+ #: ../functions.php:58
44
+ #: ../functions.php:380
45
+ msgid "View"
46
+ msgstr "Ver"
47
+
48
+ #: ../functions.php:59
49
+ msgid "Add page"
50
+ msgstr "Adicionar página"
51
+
52
+ #: ../functions.php:60
53
+ #: ../functions.php:384
54
+ msgid "Add new page after"
55
+ msgstr "Adicionar nova página após"
56
+
57
+ #: ../functions.php:61
58
+ msgid "after"
59
+ msgstr "após"
60
+
61
+ #: ../functions.php:62
62
+ msgid "inside"
63
+ msgstr "sub-página"
64
+
65
+ #: ../functions.php:63
66
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
67
+ msgstr "Desculpe, não é possível criar uma subpágina de uma página com status \"rascunho\""
68
+
69
+ #: ../functions.php:64
70
+ msgid "Sorry, can't create a sub page to a page with status \"trash\"."
71
+ msgstr "Desculpe, não é possível criar uma subpágina de uma página com status \"lixo\""
72
+
73
+ #: ../functions.php:65
74
+ msgid "Sorry, can't create a page after a page with status \"trash\"."
75
+ msgstr "Desculpe, não é possível criar uma página de uma página com status \"lixo\""
76
+
77
+ #: ../functions.php:66
78
+ #: ../functions.php:388
79
+ msgid "Add new page inside"
80
+ msgstr "Adicionar nova sub-página"
81
+
82
+ #: ../functions.php:67
83
+ msgid "draft"
84
+ msgstr "rascunho"
85
+
86
+ #: ../functions.php:68
87
+ msgid "future"
88
+ msgstr "agendado"
89
+
90
+ #: ../functions.php:69
91
+ msgid "protected"
92
+ msgstr "protegida"
93
+
94
+ #: ../functions.php:70
95
+ #: ../functions.php:603
96
+ msgid "pending"
97
+ msgstr "pendente"
98
+
99
+ #: ../functions.php:71
100
+ msgid "private"
101
+ msgstr "privado"
102
+
103
+ #: ../functions.php:72
104
+ msgid "trash"
105
+ msgstr "lixo"
106
+
107
+ #: ../functions.php:73
108
+ msgid "Password protected page"
109
+ msgstr "Página protegida por senha"
110
+
111
+ #: ../functions.php:74
112
+ msgid "Adding page..."
113
+ msgstr "Adicionando página..."
114
+
115
+ #: ../functions.php:175
116
+ msgid "settings"
117
+ msgstr "configurações"
118
+
119
+ #: ../functions.php:180
120
+ msgid "Select where to show a tree for pages and custom post types"
121
+ msgstr "Onde exibir a opção Tree View:"
122
+
123
+ #: ../functions.php:204
124
+ msgid "On dashboard"
125
+ msgstr "No Painel"
126
+
127
+ #: ../functions.php:208
128
+ msgid "In menu"
129
+ msgstr "No menu"
130
+
131
+ #: ../functions.php:219
132
+ msgid "Save Changes"
133
+ msgstr "Salvar alterações"
134
+
135
+ #: ../functions.php:335
136
+ msgid "No posts found."
137
+ msgstr "Nenhum post encontrado."
138
+
139
+ #: ../functions.php:341
140
+ msgid "All"
141
+ msgstr "Todos"
142
+
143
+ #: ../functions.php:342
144
+ msgid "Public"
145
+ msgstr "Público"
146
+
147
+ #: ../functions.php:343
148
+ msgid "Trash"
149
+ msgstr "Lixeira"
150
+
151
+ #: ../functions.php:348
152
+ msgid "Expand"
153
+ msgstr "Expandir"
154
+
155
+ #: ../functions.php:349
156
+ msgid "Collapse"
157
+ msgstr "Minimizar"
158
+
159
+ #: ../functions.php:357
160
+ msgid "Clear search"
161
+ msgstr "Limpar busca"
162
+
163
+ #: ../functions.php:358
164
+ msgid "Search"
165
+ msgstr "Buscar"
166
+
167
+ #: ../functions.php:359
168
+ msgid "Searching..."
169
+ msgstr "Buscando..."
170
+
171
+ #: ../functions.php:360
172
+ msgid "Nothing found."
173
+ msgstr "Nenhum resultado."
174
+
175
+ #: ../functions.php:366
176
+ msgid "Loading..."
177
+ msgstr "Carregando..."
178
+
179
+ #: ../functions.php:369
180
+ msgid "Search: no pages found"
181
+ msgstr "Busca: nenhuma página encontrada"
182
+
183
+ #: ../functions.php:372
184
+ msgid "Loading tree"
185
+ msgstr "Carregando estrutura"
186
+
187
+ #: ../functions.php:384
188
+ msgid "After"
189
+ msgstr "Após"
190
+
191
+ #: ../functions.php:388
192
+ msgid "Inside"
193
+ msgstr "Sub-página"
194
+
195
+ #: ../functions.php:392
196
+ msgid "Can not create page inside of a page with draft status"
197
+ msgstr "Não é possível criar uma página dentro de uma página com status rascunho"
198
+
199
+ #: ../functions.php:395
200
+ msgid "Last modified"
201
+ msgstr "Última modificação"
202
+
203
+ #: ../functions.php:397
204
+ msgid "by"
205
+ msgstr "por"
206
+
207
+ #: ../functions.php:400
208
+ msgid "Page ID"
209
+ msgstr "ID da página"
210
+
211
+ #: ../functions.php:568
212
+ msgid "Unknown user"
213
+ msgstr "Usuário desconhecido"
214
+
215
+ #: ../functions.php:573
216
+ msgid "<Untitled page>"
217
+ msgstr "<Sem título>"
218
+
219
+ #: ../functions.php:593
220
+ msgid "Comments"
221
+ msgstr "Coment&aacute;rios"
222
+
223
+ #: ../functions.php:600
224
+ #, php-format
225
+ msgid "%s pending"
226
+ msgstr "%s pendentes"
227
+
228
+ #: ../functions.php:641
229
+ msgid "Click to edit. Drag to move."
230
+ msgstr "Clique para editar, arraste para mover."
231
+
232
+ #: ../functions.php:792
233
+ msgid "New page"
234
+ msgstr "Nova página"
235
+
236
+ #: ../functions.php:974
237
+ msgid "Close"
238
+ msgstr "Fechar"
239
+
240
+ #: ../functions.php:975
241
+ msgid "<strong>Thank you for using this plugin!</strong> If you need help please check out the <a href=\"http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">plugin homepage</a> or the <a href=\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\">support forum</a>."
242
+ msgstr "<a href=\"http://wordpress.org/tags/cms-tree-page-view?forum_id=10\">Fórum de suporte</a>"
243
+
244
+ #: ../functions.php:976
245
+ msgid "If you like this plugin, please <a href=\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet."
246
+ msgstr "Suporte este plugin <a href=\"http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">fazendo uma doação</a>."
247
+
trunk/languages/cms-tree-page-view-ru_RU.mo ADDED
Binary file
trunk/languages/cms-tree-page-view-ru_RU.po ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: CTPV\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
10
+ "POT-Creation-Date: 2010-04-09 11:39+0000\n"
11
+ "PO-Revision-Date: 2010-05-24 15:24+0300\n"
12
+ "Last-Translator: Александр <alexufo@mail.ru>\n"
13
+ "Language-Team: Marcis G. <alexufo@mail.ru>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Russian\n"
18
+ "X-Poedit-Country: RUSSIAN FEDERATION\n"
19
+ "X-Poedit-SourceCharset: utf8\n"
20
+
21
+ #: functions.php:84
22
+ msgid "settings"
23
+ msgstr "Настройки"
24
+
25
+ #: functions.php:91
26
+ msgid "Show tree"
27
+ msgstr "Показывать плагин"
28
+
29
+ #: functions.php:95
30
+ msgid "on the dashboard"
31
+ msgstr "на панел"
32
+
33
+ #: functions.php:98
34
+ msgid "under the pages menu"
35
+ msgstr " в разделе \"Страницы\""
36
+
37
+ #: functions.php:105
38
+ msgid "Save Changes"
39
+ msgstr "Сохранить изменения"
40
+
41
+ #: functions.php:127
42
+ msgid "All"
43
+ msgstr "Все"
44
+
45
+ #: functions.php:128
46
+ msgid "Public"
47
+ msgstr "Опубликованные"
48
+
49
+ #: functions.php:130
50
+ msgid "Expand"
51
+ msgstr "Раскрыть"
52
+
53
+ #: functions.php:131
54
+ msgid "Collapse"
55
+ msgstr "Собрать"
56
+
57
+ #: functions.php:136
58
+ msgid "Search"
59
+ msgstr "Поиск"
60
+
61
+ #: functions.php:137
62
+ msgid "Searching..."
63
+ msgstr "Поиск..."
64
+
65
+ #: functions.php:142
66
+ msgid "Loading..."
67
+ msgstr "Загрузка..."
68
+
69
+ #: functions.php:144
70
+ msgid "Search: no pages found"
71
+ msgstr "Поиск: страниц не найдено"
72
+
73
+ #: functions.php:146
74
+ msgid "Loading tree"
75
+ msgstr "Загрузка дерева"
76
+
77
+ #: functions.php:248
78
+ msgid "<Untitled page>"
79
+ msgstr "<Без имени>"
80
+
81
+ #: functions.php:264
82
+ msgid "Click to edit. Drag to move."
83
+ msgstr "Щелчок для правки. Схватить для перемещения."
84
+
85
+ #: functions.php:380
86
+ msgid "New page"
87
+ msgstr "Новая страница"
88
+
89
+ #: scripts/cms_tree_page_view.php:85
90
+ #: scripts/cms_tree_page_view.php:102
91
+ msgid "Enter title of new page"
92
+ msgstr "Введите имя новой страницы"
93
+
94
+ #: scripts/cms_tree_page_view.php:283
95
+ msgid "child pages"
96
+ msgstr "Дочерние сраницы"
97
+
98
+ #: scripts/cms_tree_page_view.php:293
99
+ msgid "Edit page"
100
+ msgstr "Править страницу"
101
+
102
+ #: scripts/cms_tree_page_view.php:293
103
+ msgid "Edit"
104
+ msgstr "Правка"
105
+
106
+ #: scripts/cms_tree_page_view.php:294
107
+ msgid "View page"
108
+ msgstr "Смотреть страницу"
109
+
110
+ #: scripts/cms_tree_page_view.php:294
111
+ msgid "View"
112
+ msgstr "Смотреть"
113
+
114
+ #: scripts/cms_tree_page_view.php:296
115
+ msgid "Add page"
116
+ msgstr "Добавить страницу"
117
+
118
+ #: scripts/cms_tree_page_view.php:297
119
+ msgid "Add new page after"
120
+ msgstr "Добавить новую страницу ниже"
121
+
122
+ #: scripts/cms_tree_page_view.php:297
123
+ msgid "after"
124
+ msgstr "ниже"
125
+
126
+ #: scripts/cms_tree_page_view.php:298
127
+ msgid "Add new page inside"
128
+ msgstr "Добавить новую страницу внутри"
129
+
130
+ #: scripts/cms_tree_page_view.php:298
131
+ msgid "inside"
132
+ msgstr "внутри"
133
+
trunk/languages/cms-tree-page-view-sv_SE.mo ADDED
Binary file
trunk/languages/cms-tree-page-view.pot ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
7
+ "POT-Creation-Date: 2011-03-06 14:33:36+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: functions.php:53
16
+ msgid "Enter title of new page"
17
+ msgstr ""
18
+
19
+ #: functions.php:54
20
+ msgid "child pages"
21
+ msgstr ""
22
+
23
+ #: functions.php:55 functions.php:381
24
+ msgid "Edit page"
25
+ msgstr ""
26
+
27
+ #: functions.php:56 functions.php:382
28
+ msgid "View page"
29
+ msgstr ""
30
+
31
+ #: functions.php:57 functions.php:381
32
+ msgid "Edit"
33
+ msgstr ""
34
+
35
+ #: functions.php:58 functions.php:382
36
+ msgid "View"
37
+ msgstr ""
38
+
39
+ #: functions.php:59
40
+ msgid "Add page"
41
+ msgstr ""
42
+
43
+ #: functions.php:60 functions.php:386
44
+ msgid "Add new page after"
45
+ msgstr ""
46
+
47
+ #: functions.php:61
48
+ msgid "after"
49
+ msgstr ""
50
+
51
+ #: functions.php:62
52
+ msgid "inside"
53
+ msgstr ""
54
+
55
+ #: functions.php:63
56
+ msgid "Sorry, can't create a sub page to a page with status \"draft\"."
57
+ msgstr ""
58
+
59
+ #: functions.php:64
60
+ msgid "Sorry, can't create a sub page to a page with status \"trash\"."
61
+ msgstr ""
62
+
63
+ #: functions.php:65
64
+ msgid "Sorry, can't create a page after a page with status \"trash\"."
65
+ msgstr ""
66
+
67
+ #: functions.php:66 functions.php:390
68
+ msgid "Add new page inside"
69
+ msgstr ""
70
+
71
+ #: functions.php:67
72
+ msgid "draft"
73
+ msgstr ""
74
+
75
+ #: functions.php:68
76
+ msgid "future"
77
+ msgstr ""
78
+
79
+ #: functions.php:69
80
+ msgid "protected"
81
+ msgstr ""
82
+
83
+ #: functions.php:70 functions.php:644
84
+ msgid "pending"
85
+ msgstr ""
86
+
87
+ #: functions.php:71
88
+ msgid "private"
89
+ msgstr ""
90
+
91
+ #: functions.php:72
92
+ msgid "trash"
93
+ msgstr ""
94
+
95
+ #: functions.php:73
96
+ msgid "Password protected page"
97
+ msgstr ""
98
+
99
+ #: functions.php:74
100
+ msgid "Adding page..."
101
+ msgstr ""
102
+
103
+ #: functions.php:175
104
+ msgid "settings"
105
+ msgstr ""
106
+
107
+ #: functions.php:180
108
+ msgid "Select where to show a tree for pages and custom post types"
109
+ msgstr ""
110
+
111
+ #: functions.php:204
112
+ msgid "On dashboard"
113
+ msgstr ""
114
+
115
+ #: functions.php:208
116
+ msgid "In menu"
117
+ msgstr ""
118
+
119
+ #: functions.php:219
120
+ msgid "Save Changes"
121
+ msgstr ""
122
+
123
+ #: functions.php:335
124
+ msgid "No posts found."
125
+ msgstr ""
126
+
127
+ #: functions.php:341
128
+ msgid "All"
129
+ msgstr ""
130
+
131
+ #: functions.php:342
132
+ msgid "Public"
133
+ msgstr ""
134
+
135
+ #: functions.php:343
136
+ msgid "Trash"
137
+ msgstr ""
138
+
139
+ #: functions.php:348
140
+ msgid "Expand"
141
+ msgstr ""
142
+
143
+ #: functions.php:349
144
+ msgid "Collapse"
145
+ msgstr ""
146
+
147
+ #: functions.php:357
148
+ msgid "Clear search"
149
+ msgstr ""
150
+
151
+ #: functions.php:358
152
+ msgid "Search"
153
+ msgstr ""
154
+
155
+ #: functions.php:359
156
+ msgid "Searching..."
157
+ msgstr ""
158
+
159
+ #: functions.php:360
160
+ msgid "Nothing found."
161
+ msgstr ""
162
+
163
+ #: functions.php:366
164
+ msgid "Loading..."
165
+ msgstr ""
166
+
167
+ #: functions.php:371
168
+ msgid "Search: no pages found"
169
+ msgstr ""
170
+
171
+ #: functions.php:374
172
+ msgid "Loading tree"
173
+ msgstr ""
174
+
175
+ #: functions.php:386
176
+ msgid "After"
177
+ msgstr ""
178
+
179
+ #: functions.php:390
180
+ msgid "Inside"
181
+ msgstr ""
182
+
183
+ #: functions.php:394
184
+ msgid "Can not create page inside of a page with draft status"
185
+ msgstr ""
186
+
187
+ #: functions.php:397
188
+ msgid "Last modified"
189
+ msgstr ""
190
+
191
+ #: functions.php:399
192
+ msgid "by"
193
+ msgstr ""
194
+
195
+ #: functions.php:402
196
+ msgid "Page ID"
197
+ msgstr ""
198
+
199
+ #: functions.php:609
200
+ msgid "Unknown user"
201
+ msgstr ""
202
+
203
+ #: functions.php:614
204
+ msgid "<Untitled page>"
205
+ msgstr ""
206
+
207
+ #: functions.php:634
208
+ msgid "Comments"
209
+ msgstr ""
210
+
211
+ #: functions.php:641
212
+ msgid "%s pending"
213
+ msgstr ""
214
+
215
+ #: functions.php:651
216
+ msgctxt "comment count"
217
+ msgid "0"
218
+ msgstr ""
219
+
220
+ #: functions.php:651
221
+ msgctxt "comment count"
222
+ msgid "1"
223
+ msgstr ""
224
+
225
+ #: functions.php:651
226
+ msgctxt "comment count"
227
+ msgid "%"
228
+ msgstr ""
229
+
230
+ #: functions.php:682
231
+ msgid "Click to edit. Drag to move."
232
+ msgstr ""
233
+
234
+ #: functions.php:833
235
+ msgid "New page"
236
+ msgstr ""
237
+
238
+ #: functions.php:1015
239
+ msgid "Close"
240
+ msgstr ""
241
+
242
+ #: functions.php:1016
243
+ msgid ""
244
+ "<strong>Thank you for using this plugin!</strong> If you need help please "
245
+ "check out the <a href=\"http://eskapism.se/code-playground/cms-tree-page-"
246
+ "view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">plugin "
247
+ "homepage</a> or the <a href=\"http://wordpress.org/tags/cms-tree-page-view?"
248
+ "forum_id=10\">support forum</a>."
249
+ msgstr ""
250
+
251
+ #: functions.php:1017
252
+ msgid ""
253
+ "If you like this plugin, please <a href=\"http://eskapism.se/sida/donate/?"
254
+ "utm_source=wordpress&utm_medium=banner&utm_campaign=promobox\">support my "
255
+ "work by donating</a> - or at least say something nice about this plugin in a "
256
+ "blog post or tweet."
257
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === CMS Tree Page View ===
2
+ Contributors: eskapism, MarsApril
3
+ Donate link: http://eskapism.se/sida/donate/
4
+ Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
5
+ Requires at least: 3.0
6
+ Tested up to: 3.1
7
+ Stable tag: 0.7.19
8
+
9
+ Adds a tree of all your pages or custom posts. Use drag & drop to reorder your pages, and edit, view, add, and search your pages.
10
+
11
+ == Description ==
12
+
13
+ Adds a CMS-like tree overview of all your pages and custom posts to WordPress - much like the view often found in a page-focused CMS.
14
+ Within this tree you can edit pages, view pages, add pages, search pages, and drag and drop pages to rearrange the order.
15
+
16
+ CMS Tree Page View is a good alternative to plugins such as pageMash, WordPress Page Tree
17
+ and My Page Order.
18
+
19
+ Page management in WordPress won't get any easier than this!
20
+
21
+ #### Features and highlights:
22
+
23
+ * View your pages & posts in a tree-view, like you view files in Windows Explorer or the Finder in OS X
24
+ * Drag and drop to rearrange/order your pages
25
+ * Add pages after or inside a page
26
+ * Edit pages
27
+ * View pages
28
+ * Search pages
29
+ * Available for both regular pages and custom posts
30
+ * View your site hierarchy directly from the WordPress dashboard
31
+ * Support for translation plugin [WPML](http://wordpress.org/extend/plugins/sitepress-multilingual-cms/), so you can manage all the languages of your site
32
+
33
+ #### Screencast
34
+ Watch this screencast to see how easy you could be managing your pages:
35
+ [youtube http://www.youtube.com/watch?v=H4BGomLi_FU]
36
+
37
+ #### Translations/Languages
38
+ This plugin is available in the following languages:
39
+
40
+ * English
41
+ * German
42
+ * French
43
+ * Spanish
44
+ * Russian
45
+ * Belorussian
46
+ * Swedish
47
+ * Czech
48
+ * Italian
49
+ * Dutch
50
+ * Hungarian
51
+
52
+ #### Making the tree available for your vistors
53
+ If you're looking for a version of this page tree that the vistors of your site can use, then check out
54
+ this navigation widget called [Nice Navigation](http://wordpress.org/extend/plugins/nice-navigation/).
55
+
56
+ #### Always show your pages in the admin area
57
+ If you want to always have a list of your pages available in your WordPress admin area, please check out the plugin
58
+ [Admin Menu Tree Page View](http://wordpress.org/extend/plugins/admin-menu-tree-page-view/).
59
+
60
+
61
+ #### Donation and more plugins
62
+ * If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
63
+ * More [WordPress CMS plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author.
64
+
65
+ == Installation ==
66
+
67
+ 1. Upload the folder "cms-tree-page-view" to "/wp-content/plugins/"
68
+ 1. Activate the plugin through the "Plugins" menu in WordPress
69
+ 1. Done!
70
+
71
+ Now the tree with the pages will be visible both on the dashboard and in the menu under pages.
72
+
73
+ == Screenshots ==
74
+
75
+ 1. The page tree in action
76
+ 2. Edit, view and add pages (choices visible upon mouse over).
77
+ 3. Search pages.
78
+ 4. Drag-and-drop to rearrange/change the order of the pages.
79
+ 5. The tree is also available on the dashboard and therefore available immediately after you login.
80
+ 6. The settings page - choose where you want the tree to show up
81
+ 7. Users of WPML can find all their languages in the tree
82
+
83
+ == Changelog ==
84
+
85
+ = 0.7.19 =
86
+ * Greek translation added by Mihalis Papanousis (http://aenaon.biz)
87
+ * Hopefully fixed some more problems with columns
88
+
89
+ = 0.7.18 =
90
+ * Second try: Hopefully fixed the problem that moving a page resulted in WPML losing the connection between the languages
91
+ * Hungarian translation added
92
+ * Small CSS fixes
93
+ * Fixed compatiblity issue with ALO EasyMail Newsletter
94
+
95
+ = 0.7.17 =
96
+ * Removed cookie.js
97
+ * Updated jstree
98
+ * If Keyboard Shortcuts was enabled for a user, title and content of a post could not be edited.
99
+ * Drag and drop is now a bit more accurate and less "jerky"
100
+ * Hopefully fixed the problem that moving a page resulted in WPML losing the connection between the languages
101
+ * Dutch translation added
102
+ * Hebrew translation added
103
+ * Updated POT-file. Translators may want to check for added or updated words and sentences.
104
+ * Fixed a notice-message
105
+
106
+ = 0.7.16 =
107
+ * Fix for wpml-languages with "-" in them, like chinese simplified or chinese traditional.
108
+ http://wordpress.org/support/topic/plugin-cms-tree-page-view-broken-for-languages-with-a-in
109
+ * Fixed some problems with columns and utf-encoding
110
+ * Moved adding page to a box above the tree, so you won't get the feeling that the tree has been deleted when you add a page.
111
+
112
+ = 0.7.15 =
113
+ * Czech translation added
114
+ * Italian translation added, by Andrea Bersi (http://www.andreabersi.com)
115
+ * require(dirname(__FILE__)."/functions.php"); instead of just require("functions.php");. Should fix problems with for example BackWPup.
116
+
117
+ = 0.7.14 =
118
+ - Added links to PayPal and Flattr, so users who like the plugin can donate.
119
+
120
+ = 0.7.13 =
121
+ - Upgraded jstree to rc2. This fixes the problems with drag & drop and mouse over that occured in WordPress 3.1 beta.
122
+
123
+ = 0.7.12 =
124
+ - Readme-fix...
125
+
126
+ = 0.7.11 =
127
+ - If a post has a custom post status, that status will be shown instead of "undefined". So now CMS Tree Page View works better together with plugins like "Edit flow".
128
+
129
+ = 0.7.10 =
130
+ - CSS images loaded from google via https instead of http. Does this solve the problems you guys with https-sites had?
131
+ - Users of IE could not add pages at the right place. All pages where added at the top instead of after or inside another page. Only tested in IE 8, please let me know of the other version..
132
+
133
+ = 0.7.9 =
134
+ - changed so some icons are loaded from ajax.googleapis.com instead of Google Code. Google Code was a bit slow.
135
+
136
+ = 0.7.8 =
137
+ - Something went wrong with last update at wordpress.org, people got 404-error when trying to download plugin. Let's see if this update helps..
138
+
139
+ = 0.7.7 =
140
+ - Added Portuguese translation by Ricardo Tomasi. Thank you!
141
+ - Celebration Edition: over 25.000 downloads of this plugin at WordPress.org!
142
+
143
+ = 0.7.6 =
144
+ - You can now view items in the trash. A bit closer to a complete take over of the pages-page :)
145
+
146
+ = 0.7.5 =
147
+ - fixed some notice-errors and switched some deprecated functions
148
+ - updated swedish translation
149
+ - fixed some strings that where untranslatable and updated POT-file (if I missed any, please let me know)
150
+ - no longer allowed to add sub pages to a page with status draft, because if you edit the page and save it, wordpress will forget about the parent (and you will get confused)
151
+ - started using hoverIntent for popup instead of regular mouseover, so the popups won't feel so aggressive - or no.. reverted this :(
152
+ - when adding a page a text comes up so you know that something is going on
153
+ - possible fix for magic fields and other plugins that deal with post columns
154
+
155
+ = 0.7.4 =
156
+ - Updated POT-file, so translators may wan't to check their translations.
157
+ - Added Spanish translation by Carlos Janini. Thank you!
158
+
159
+ = 0.7.3 =
160
+ - a page can now be moved above a page with the same menu order. moved page will get the menu order of the page that it's moved aboved, and the other page will get a menu order of previous menu order + 1. i think/hope this is finally solved now!
161
+ - using wp_update_post when moving pages (instead of sql directly). this should make this plugin work better with some cache plugins, for example DB Cache Reloaded
162
+ - root of tree is added initially, without the need to run an ajax query. loading the root of the tree = super fast! child nodes that are not previosly open are still loaded with ajax, because I want to be sure that the plugin does not hang if there is a page with super-mega-lots of children.
163
+
164
+ = 0.7.2 =
165
+ - pages that the user is not allowed to edit now get "dimmed". they will still be visible becuase a page a user is not allowed to edit, may have a child-page that they are allowed to edit, so the sub-pages must still be accessible
166
+ - some problems with Ozh' Admin Drop Down Menu fixed (tree showed posts instead of pages)
167
+
168
+ = 0.7.1 =
169
+ - quick fix: capability edit_pages required to view the tree menu, instead of editor (which led to administrators not being able to view the tree...)
170
+
171
+ = 0.7 =
172
+ - added comment count to pop up
173
+ - added support for custom columns in pop up = now you have the same information available in CMS Tree Vage View as in the normal page/post edit screen
174
+ - fixed some colors to better match wordpress own style
175
+ - editor capability required to view tree. previosly only administators chould see the tree in the menu, while everyone could view the tree on the dashboard.
176
+ - no more infinite loops with role scoper installed
177
+ - tested on WordPress Multisite
178
+
179
+ = 0.6.3 =
180
+ - tree is activated for pages during install, so the user does not need to set up anything during first run
181
+
182
+ = 0.6.2 =
183
+ - Was released only as a public beta together with wpml.org, to test the wpml-integration
184
+ - Now supports custom post types.
185
+ - Now compatible with WPML Multilangual CMS (wpml.org).
186
+ - Uses WordPress own functions at some more places.
187
+ - When searching and no posts found you now get a message so you know that there were no matches.
188
+ - German translation added, by Thomas Dullnig (www.sevenspire.com). Thank you!
189
+ - Lots of code rewritten for this update of CMS Tree Page View, so please let me know if it works or if I broke something!
190
+
191
+ = 0.6.1 =
192
+ - Forgot to close a p-tag correctly. Now it should validate again!
193
+ - Fixed a problem where move could seem to not work when trying to move pages when several pages had the same menu_order, so they where sorted by alpha instead.
194
+ - fixed a problem with qtranslate that resulted in endless "loading tree..."
195
+ - the thank you/need help/please donate-box is re-enabled upon upgrade/re-activation of the plugin. Just so you won't forget that you can donate! :)
196
+
197
+ = 0.6 =
198
+ - updated french translation
199
+ - new box for mouse-over/pop-up - please let me know what you think about it
200
+ - new box: it's bigger so it's less likely that you slide out of it with your mouse (happend to me all the time! very annoying...) .
201
+ - new box: more information can be fitted there. let me know if there is any information you would like to see in the popup (right now it will show you the last modified date + the id of the page)
202
+ - new box: edit and view links are real links now, so you can edit or view pages in for example a new tab
203
+ - new box: oh.. and it's much better looking! :)
204
+
205
+ = 0.5.7 =
206
+ - jquery.cookie.js renamed to jquery.biscuit.js to fix problems with apache module mod_security. let me know if it actually works! :)
207
+ - updated .pot-file, so translators out there may want to check if everything is up to date
208
+
209
+ = 0.5.6 =
210
+ - password protected posts now show a lock icon (thanks to [Seebz](http://seebz.net) for contributing)
211
+
212
+ = 0.5.5 =
213
+ - ok, now the texts should be translated. for real! thanks for the bug report!
214
+
215
+ = 0.5.4 =
216
+ - when mouse over the litte arrow the cursor is now a hand again. it just feels a little bit better that way.
217
+ - some texts where not translated due to wp_localize_script being called before load_plugin_textdomain. thanks for reporting this.
218
+
219
+ = 0.5.3 =
220
+ - link to "add new page" when there were no pages now work
221
+ - changed native js prompt to http://abeautifulsite.net/2008/12/jquery-alert-dialogs/ (mostly because you can use your other browser tabs while the dialog/prompt is open)
222
+ - added a thank-you-please-donate-box. please do what it says! :)
223
+ - started using menu_page_url instead of hard-coding path to plugin
224
+ - now requires WordPress 3
225
+
226
+ = 0.5.2 =
227
+ - you could get an error if used together with the "Simple Fields" WordPress plugin (yes, I used the same function name in both plugin! Fool me twice, shame on me.)
228
+
229
+ = 0.5.1 =
230
+ - forgot to add styles to svn
231
+
232
+ = 0.5 =
233
+ - Uses wp_localize_script to translate script. Previous method could lead to 404-error, although the file did exist.
234
+ - More valid output
235
+ - jsTree upgraded to 1.0rc
236
+ - Code rewritten for upgraded jsTree
237
+ - Added a "clear search"-button to the search box
238
+ - Dashboard widget added again! Hooray!
239
+ - Requires WordPress 3 because of jquery 1.4.2. If you are using WP 2.x you can try version 0.4.9 instead: http://downloads.wordpress.org/plugin/cms-tree-page-view.0.4.9.zip
240
+
241
+ = 0.4.9 =
242
+ - added French translation by Bertrand Andres
243
+
244
+ = 0.4.8 =
245
+ - added russian translation by Alexufo (www.serebniti.ru)
246
+ - fixed a link that didn't change color on mouse over
247
+
248
+ = 0.4.7 =
249
+ - remove some code that did not belong...
250
+ - does not show auto-draft-posts in wp3
251
+
252
+ = 0.4.6 =
253
+ - could get database error because post_content had no default value
254
+ - removed usage of console.log and one alert. ouch!
255
+ - when adding page inside, several posts could get menu_order = 0, which led to sorting problems
256
+
257
+ = 0.4.5 =
258
+ - added Belorussian translation by [Marcis G.](http://pc.de/)
259
+ - settings page did not check checkboxes by default
260
+ - tree removed from dashboard due some problems with event bubbling (will be re-added later when problem is fixed)
261
+
262
+ = 0.4.4 =
263
+ - translation now works in javascript (forgot to use load_plugin_textdomain)
264
+ - added swedish translation by Måns Jonasson
265
+
266
+ = 0.4.3 =
267
+ - forgot the domain for _e at some places
268
+
269
+ = 0.4.2 =
270
+ - added .pot-file
271
+
272
+ = 0.4.1 =
273
+ - more prepare for translation
274
+ - fixed some <? into <?php
275
+
276
+ = 0.4 =
277
+ - uses strict json (fix for jquery 1.4)
278
+ - pages with no title now show "untitled" instead of just disappearing
279
+ - uses get_the_title instead of getting the title direct from the db, making plugins such as qtranslate work
280
+ - preparing for translation, using __ and _e
281
+
282
+ = 0.3 =
283
+ - all | public: works on the dasboard
284
+ - all | public: are now loaded using ajax. no more reloads!
285
+ - added options page so you can choose where to show the tree (i.e. the dasboard or under "pages"...or both, of course!). only available for admins.
286
+ - capability "edit_pages" required to view the tree
287
+
288
+ = 0.2 =
289
+ - Possible fix for Fluency Admin
290
+
291
+ = 0.1a =
292
+ - First public version.
293
+
294
+
295
+ == Still on WordPress 2? ==
296
+ If you are using WordPress 2.x you can try this old version instead:
297
+ http://downloads.wordpress.org/plugin/cms-tree-page-view.0.4.9.zip
298
+
trunk/screenshot-1.png ADDED
Binary file
trunk/screenshot-2.png ADDED
Binary file
trunk/screenshot-3.png ADDED
Binary file
trunk/screenshot-4.png ADDED
Binary file
trunk/screenshot-5.png ADDED
Binary file
trunk/screenshot-6.png ADDED
Binary file
trunk/screenshot-7.png ADDED
Binary file
trunk/scripts/cms_tree_page_view.js ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // @todo: add prefix to treeOptions, div_actions
3
+ var cms_tpv_tree, treeOptions, div_actions, cms_tpv_current_li_id = null;
4
+ jQuery(function($) {
5
+
6
+ cms_tpv_tree = $(".cms_tpv_container");
7
+ div_actions = $(".cms_tpv_page_actions");
8
+
9
+ treeOptions = {
10
+ xplugins: ["cookie","ui","crrm","themes","json_data","search","types","dnd"],
11
+ plugins: ["themes","json_data","cookies","search","dnd", "types"],
12
+ core: {
13
+ "html_titles": true
14
+ },
15
+ "json_data": {
16
+ "ajax": {
17
+ "url": ajaxurl + CMS_TPV_AJAXURL + CMS_TPV_VIEW,
18
+ // this function is executed in the instance's scope (this refers to the tree instance)
19
+ // the parameter is the node being loaded (may be -1, 0, or undefined when loading the root nodes)
20
+ "data" : function (n) {
21
+ // the result is fed to the AJAX request `data` option
22
+ if (n.data) {
23
+ var post_id = n.data("post_id");
24
+ return {
25
+ "id": post_id
26
+ }
27
+ }
28
+ }
29
+
30
+ }
31
+ /*
32
+ // data can be initially set like this
33
+ // but it has to be set by type...
34
+ "data": [{
35
+ "data": {
36
+ "title": "I am a new page",
37
+ "attr": {
38
+ "href": "http://localhost/wp-admin/post.php?post=1060&action=edit",
39
+ "xid": "cms-tpv-1060"
40
+ },
41
+ "xicon": "http://localhost/wp-content/plugins/cms-tree-page-view/images/page_white_text.png"
42
+ },
43
+ "attr": {
44
+ "xhref": "http://localhost/wp-admin/post.php?post=1060&action=edit",
45
+ "id": "cms-tpv-1060",
46
+ "xtitle": "Click to edit. Drag to move.",
47
+ "class": "cms_tpv_user_can_edit_page_yes"
48
+ },
49
+ "metadata": {
50
+ "id": "cms-tpv-1060",
51
+ "post_id": "1060",
52
+ "post_type": "page",
53
+ "post_status": "publish",
54
+ "rel": "publish",
55
+ "childCount": 0,
56
+ "permalink": "http://localhost/i-am-a-new-page/",
57
+ "editlink": "http://localhost/wp-admin/post.php?post=1060&action=edit",
58
+ "modified_time": "August 15, 2010",
59
+ "modified_author": "admin",
60
+ "columns": "%3Cdl%3E%3Cdt%3EComments%3C%2Fdt%3E%3Cdd%3E%3Cdiv%20class%3D%22post-com-count-wrapper%22%3E%3Ca%20href%3D%27edit-comments.php%3Fp%3D1060%27%20title%3D%270%20pending%27%3E%3Cspan%3E0%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fdiv%3E%3C%2Fdd%3E%3C%2Fdl%3E",
61
+ "user_can_edit_page": "1"
62
+ }
63
+
64
+ }
65
+ ]*/
66
+ },
67
+ "themes": {
68
+ "theme": "wordpress"
69
+ },
70
+ "search": {
71
+ "ajax" : {
72
+ "url": ajaxurl + CMS_TPV_AJAXURL + CMS_TPV_VIEW
73
+ },
74
+ "case_insensitive": true
75
+ },
76
+ "dnd": {
77
+ }
78
+ }
79
+
80
+ if (cms_tpv_tree.length > 0) {
81
+ cms_tpv_bind_clean_node(); // don't remember why I run this here.. :/
82
+ }
83
+ cms_tpv_tree.each(function(i, elm) {
84
+
85
+ var $elm = $(elm);
86
+
87
+ // init tree, with settings specific for each post type
88
+ var treeOptionsTmp = jQuery.extend(true, {}, treeOptions); // make copy of object
89
+ var post_type = cms_tpv_get_post_type(elm);
90
+ treeOptionsTmp.json_data.ajax.url = treeOptionsTmp.json_data.ajax.url + "&post_type=" + post_type + "&lang=" + cms_tpv_get_wpml_selected_lang(elm);
91
+ treeOptionsTmp.json_data.data = cms_tpv_jsondata[post_type]; // get from js
92
+
93
+ var isHierarchical = $(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type_hierarchical]").val();
94
+ if (isHierarchical == 0) {
95
+ // no move to children if not hierarchical
96
+ treeOptionsTmp.types = {
97
+ "types": {
98
+ "default" : {
99
+ "valid_children" : [ "none" ]
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ $elm.bind("search.jstree", function (event, data) {
106
+ if (data.rslt.nodes.length == 0) {
107
+ // no hits. doh.
108
+ $(this).closest(".cms_tpv_wrapper").find(".cms_tree_view_search_form_no_hits").fadeIn("fast");
109
+ }
110
+ });
111
+
112
+ $elm.jstree(treeOptionsTmp);
113
+
114
+ });
115
+
116
+
117
+ }); // end ondomready
118
+
119
+
120
+ // get post type
121
+ // elm must be within .cms_tpv_wrapper to work
122
+ function cms_tpv_get_post_type(elm) {
123
+ return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type]").val();
124
+ }
125
+ // get selected lang
126
+ function cms_tpv_get_wpml_selected_lang(elm) {
127
+ return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_wpml_language]").val();
128
+ }
129
+
130
+ function cms_tpv_get_page_actions_div(elm) {
131
+ return jQuery(elm).closest(".cms_tpv_wrapper").find(".cms_tpv_page_actions");
132
+ }
133
+ function cms_tpv_get_wrapper(elm) {
134
+ var $wrapper = jQuery(elm).closest(".cms_tpv_wrapper");
135
+ return $wrapper;
136
+ }
137
+
138
+
139
+ // add page after
140
+ jQuery(".cms_tpv_action_add_page_after").live("click", function() {
141
+ var $this = jQuery(this);
142
+ var post_type = cms_tpv_get_post_type(this);
143
+ var selected_lang = cms_tpv_get_wpml_selected_lang(this);
144
+
145
+ var post_status = $this.closest("li").data("post_status");
146
+
147
+ // not allowed when status is trash
148
+ if (post_status == "trash") {
149
+ jAlert(cmstpv_l10n.Can_not_add_page_after_when_status_is_trash);
150
+ return false;
151
+ }
152
+
153
+ jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
154
+ if (new_page_title) {
155
+ var pageID = $this.parents("li:first").attr("id");
156
+ jQuery(".cms_tpv_message").html("<p>"+cmstpv_l10n.Adding_page+"</p>").slideDown("fast");
157
+ jQuery.post(ajaxurl, {
158
+ "action": "cms_tpv_add_page",
159
+ "pageID": pageID,
160
+ "type": "after",
161
+ "page_title": new_page_title,
162
+ "post_type": post_type,
163
+ "wpml_lang": selected_lang
164
+ }, function(data, textStatus) {
165
+ document.location = data;
166
+ });
167
+ }
168
+ });
169
+
170
+ return false;
171
+ });
172
+
173
+ // add page inside
174
+ jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
175
+ var $this = jQuery(this);
176
+ var post_type = cms_tpv_get_post_type(this);
177
+ var selected_lang = cms_tpv_get_wpml_selected_lang(this);
178
+
179
+ var post_status = $this.closest("li").data("post_status");
180
+
181
+ // check page status, because we cant add a page inside a page with status draft or status trash
182
+ // if we edit the page wordpress will forget the parent
183
+ //$li.data("jstree").permalink;
184
+ //var post_status = li.data("jstree").post_status;
185
+ if (post_status == "draft") {
186
+ jAlert(cmstpv_l10n.Can_not_add_sub_page_when_status_is_draft);
187
+ return false;
188
+ }
189
+
190
+ // not allowed when status is trash
191
+ if (post_status == "trash") {
192
+ jAlert(cmstpv_l10n.Can_not_add_sub_page_when_status_is_trash);
193
+ return false;
194
+ }
195
+
196
+ jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
197
+ if (new_page_title) {
198
+ var pageID = $this.parents("li:first").attr("id");
199
+ jQuery(".cms_tpv_message").html("<p>" + cmstpv_l10n.Adding_page + "</p>").slideDown("fast");
200
+ jQuery.post(ajaxurl, {
201
+ "action": "cms_tpv_add_page",
202
+ "pageID": pageID,
203
+ "type": "inside",
204
+ "page_title": new_page_title,
205
+ "post_type": post_type,
206
+ "wpml_lang": selected_lang
207
+ }, function(data, textStatus) {
208
+ document.location = data;
209
+ });
210
+ }
211
+ });
212
+ return false;
213
+ });
214
+
215
+
216
+
217
+ // check if tree is beging dragged
218
+ function cms_tpv_is_dragging() {
219
+ var eDrag = jQuery("#vakata-dragged");
220
+ return eDrag.is(":visible");
221
+ }
222
+
223
+ // fired when mouse is over li
224
+ function cms_tpv_mouseover_li(li) {
225
+
226
+ //console.log("show actions div");
227
+ $li = jQuery(li);
228
+
229
+ var div_actions_for_post_type = cms_tpv_get_page_actions_div(li);
230
+
231
+ if (cms_tpv_is_dragging() == false) {
232
+
233
+ if (div_actions_for_post_type.is(":visible")) {
234
+ // do nada
235
+ } else {
236
+
237
+ $li.find("a:first").addClass("hover");
238
+
239
+ // setup link for view page
240
+ $view = div_actions_for_post_type.find(".cms_tpv_action_view");
241
+ var permalink = $li.data("permalink");
242
+ $view.attr("href", permalink);
243
+
244
+ // setup link for edit page
245
+ $edit = div_actions_for_post_type.find(".cms_tpv_action_edit");
246
+ var editlink = $li.data("editlink");
247
+ $edit.attr("href", editlink);
248
+
249
+ // check if user is allowed to edit page
250
+ var $cms_tpv_action_add_and_edit_page = div_actions_for_post_type.find(".cms_tpv_action_add_and_edit_page");
251
+ if ($li.data("user_can_edit_page") == 0) {
252
+ // nooope
253
+ $edit.hide();
254
+ $cms_tpv_action_add_and_edit_page.hide();
255
+ } else {
256
+ $edit.show();
257
+ $cms_tpv_action_add_and_edit_page.show();
258
+ }
259
+
260
+ // ..and some extras
261
+ div_actions_for_post_type.find(".cms_tpv_page_actions_modified_time").text($li.data("modified_time"));
262
+ div_actions_for_post_type.find(".cms_tpv_page_actions_modified_by").text($li.data("modified_author"));
263
+ div_actions_for_post_type.find(".cms_tpv_page_actions_page_id").text($li.data("post_id"));
264
+
265
+ div_actions_for_post_type.find(".cms_tpv_page_actions_columns").html( unescape($li.data("columns")) );
266
+
267
+ // position and show action div
268
+ var $a = $li.find("a");
269
+ var width = $a.outerWidth(true);
270
+ $li.append(div_actions_for_post_type);
271
+ left_pos = width+28;
272
+ top_pos = -8;
273
+ div_actions_for_post_type.css("left", left_pos);
274
+ div_actions_for_post_type.css("top", top_pos);
275
+ div_actions_for_post_type.show();
276
+ }
277
+ }
278
+
279
+ }
280
+
281
+ // fired when mouse leaves li
282
+ function cms_tpv_mouseout_li(li) {
283
+ $li = jQuery(li);
284
+ $li.find("a:first").removeClass("hover");
285
+ div_actions.hide();
286
+ }
287
+
288
+ // mouse over, show actions
289
+ // but only if the mouse not already is over the li (don't know why it fires multiple times, but it does)
290
+ // 29 August, 2010 this worked nice but it had problems with child-lis...
291
+ /*
292
+ jQuery(".jstree li").live("mouseenter", function(e) {
293
+
294
+ //console.log("mouseenter");
295
+ var $li = jQuery(this);
296
+ var li_id = $li.attr("id");
297
+
298
+ // add hoverIntent, if not prev. attached
299
+ if ($li.data("hasHoverIntent")) {
300
+ // already got it
301
+ } else {
302
+ $li.data("hasHoverIntent", true);
303
+ $li.hoverIntent(function() {
304
+ // console.log("over");
305
+ cms_tpv_mouseover_li(this);
306
+ }, function() {
307
+ console.log("out");
308
+ //cms_tpv_mouseout_li(this);
309
+ });
310
+ // lastlt trigger mouseenter again so the popup will show
311
+ $li.trigger("mouseover");
312
+ }
313
+
314
+ });
315
+ */
316
+
317
+ jQuery(".jstree li").live("mouseover", function(e) {
318
+ var $li = jQuery(this);
319
+ var li_id = $li.attr("id");
320
+ cms_tpv_mouseover_li(this);
321
+ });
322
+ // ..and hide them again
323
+ jQuery(".jstree li").live("mouseout", function() {
324
+ //cms_tpv_current_li_id = null;
325
+ //console.log("out");
326
+ cms_tpv_mouseout_li(this);
327
+ });
328
+
329
+
330
+ // hide action links on drag
331
+ jQuery.jstree.drag_start = function() {
332
+ jQuery(".cms_tpv_action_view, .cms_tpv_action_edit, .cms_tpv_action_add_page, .cms_tpv_action_add_page_after, .cms_tpv_action_add_page_inside").hide();
333
+ }
334
+
335
+ /**
336
+ * add childcount and other things to each li
337
+ */
338
+ function cms_tpv_bind_clean_node() {
339
+
340
+ cms_tpv_tree.bind("move_node.jstree", function (event, data) {
341
+ var nodeBeingMoved = data.rslt.o; // noden vi flyttar
342
+ var nodeNewParent = data.rslt.np;
343
+ var nodePosition = data.rslt.p;
344
+ var nodeR = data.rslt.r;
345
+ var nodeRef = data.rslt.or; // noden som positionen gäller versus
346
+ var selected_lang = cms_tpv_get_wpml_selected_lang(nodeBeingMoved);
347
+ /*
348
+
349
+ // om ovanför
350
+ o ovanför or
351
+
352
+ // om efter
353
+ o efter r
354
+
355
+ // om inside
356
+ o ovanför or
357
+
358
+
359
+ drop_target : ".jstree-drop",
360
+ drop_check : function (data) { return true; },
361
+ drop_finish : $.noop,
362
+ drag_target : ".jstree-draggable",
363
+ drag_finish : $.noop,
364
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
365
+
366
+ Gets executed after a valid drop, you get one parameter, which is as follows:
367
+ data.o - the object being dragged
368
+ data.r - the drop target
369
+ */
370
+
371
+ if (nodePosition == "before") {
372
+ var node_id = jQuery( nodeBeingMoved ).attr( "id" );
373
+ ref_node_id = jQuery( nodeRef ).attr( "id" );
374
+ } else if (nodePosition == "after") {
375
+ var node_id = jQuery( nodeBeingMoved ).attr( "id" );
376
+ ref_node_id = jQuery( nodeR ).attr( "id" );
377
+ } else if (nodePosition == "inside") {
378
+ var node_id = jQuery( nodeBeingMoved ).attr( "id" );
379
+ ref_node_id = jQuery( nodeR ).attr( "id" );
380
+ }
381
+
382
+ // Update parent or menu order
383
+ jQuery.post(ajaxurl, {
384
+ action: "cms_tpv_move_page",
385
+ "node_id": node_id,
386
+ "ref_node_id": ref_node_id,
387
+ "type": nodePosition,
388
+ "icl_post_language": selected_lang
389
+ }, function(data, textStatus) {
390
+ });
391
+
392
+ });
393
+
394
+ cms_tpv_tree.bind("clean_node.jstree", function(event, data) {
395
+ var obj = (data.rslt.obj);
396
+ if (obj && obj != -1) {
397
+ obj.each(function(i, elm) {
398
+ var li = jQuery(elm);
399
+ var aFirst = li.find("a:first");
400
+
401
+ // check that we haven't added our stuff already
402
+ if (li.data("done_cms_tpv_clean_node")) {
403
+ return;
404
+ } else {
405
+ li.data("done_cms_tpv_clean_node", true);
406
+ }
407
+ // new way:
408
+ // console.log(li.data("childCount"));
409
+ // add number of children
410
+ //if (li.data("jstree")) {
411
+ var childCount = li.data("childCount");
412
+ if (childCount > 0) {
413
+ aFirst.append("<span title='" + childCount + " " + cmstpv_l10n.child_pages + "' class='child_count'>("+childCount+")</span>");
414
+ }
415
+
416
+ // add protection type
417
+ var rel = li.data("rel");
418
+ if(rel == "password") {
419
+ aFirst.find("ins").after("<span class='post_protected' title='" + cmstpv_l10n.Password_protected_page + "'>&nbsp;</span>");
420
+ }
421
+
422
+ // add page type
423
+ var post_status = li.data("post_status");
424
+ // post_status can be any value because of plugins like Edit flow
425
+ // check if we have an existing translation for the string, otherwise use the post status directly
426
+ var post_status_to_show = "";
427
+ if (post_status_to_show = cmstpv_l10n["Status_"+post_status]) {
428
+ // it's ok
429
+ } else {
430
+ post_status_to_show = post_status;
431
+ }
432
+ if (post_status != "publish") {
433
+ aFirst.find("ins").first().after("<span class='post_type post_type_"+post_status+"'>" + post_status_to_show + "</span>");
434
+ }
435
+ //}
436
+
437
+ });
438
+ }
439
+ });
440
+ }
441
+
442
+ // search: perform
443
+ jQuery(".cms_tree_view_search_form").live("submit", function() {
444
+ var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
445
+ $wrapper.find(".cms_tpv_search_no_hits").hide();
446
+ var s = $wrapper.find(".cms_tree_view_search").attr("value");
447
+ s = jQuery.trim( s );
448
+ // search, oh the mighty search!
449
+ if (s) {
450
+ $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
451
+ $wrapper.find(".cms_tree_view_search_form_working").fadeIn("fast");
452
+ $wrapper.find(".cms_tree_view_search_form_reset")
453
+ $wrapper.find(".cms_tpv_container").jstree("search", s);
454
+ $wrapper.find(".cms_tree_view_search_form_reset").fadeIn("fast");
455
+ } else {
456
+ $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
457
+ $wrapper.find(".cms_tpv_container").jstree("clear_search");
458
+ $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
459
+ }
460
+ $wrapper.find(".cms_tree_view_search_form_working").fadeOut("fast");
461
+ return false;
462
+ });
463
+
464
+ // search: reset
465
+ jQuery(".cms_tree_view_search_form_reset").live("click", function() {
466
+ var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
467
+ $wrapper.find(".cms_tree_view_search").val("")
468
+ $wrapper.find(".cms_tpv_container").jstree("clear_search");
469
+ $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
470
+ $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
471
+ return false;
472
+ });
473
+
474
+ // open/close links
475
+ jQuery(".cms_tpv_open_all").live("click", function() {
476
+ var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
477
+ $wrapper.find(".cms_tpv_container").jstree("open_all");
478
+ return false;
479
+ });
480
+ jQuery(".cms_tpv_close_all").live("click", function() {
481
+ var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
482
+ $wrapper.find(".cms_tpv_container").jstree("close_all");
483
+ return false;
484
+ });
485
+
486
+ // view all or public or trash
487
+ jQuery(".cms_tvp_view_all").live("click", function() {
488
+ cms_tvp_set_view("all", this);
489
+ return false;
490
+ });
491
+ jQuery(".cms_tvp_view_public").live("click", function() {
492
+ cms_tvp_set_view("public", this);
493
+ return false;
494
+ });
495
+ jQuery(".cms_tvp_view_trash").live("click", function() {
496
+ cms_tvp_set_view("trash", this);
497
+ return false;
498
+ });
499
+
500
+
501
+ // change lang
502
+ jQuery("a.cms_tvp_switch_lang").live("click", function(e) {
503
+ $wrapper = cms_tpv_get_wrapper(this);
504
+ $wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
505
+ jQuery(this).addClass("current");
506
+
507
+ var re = /cms_tpv_switch_language_code_([\w-]+)/;
508
+ var matches = re.exec( jQuery(this).attr("class") );
509
+ var lang_code = matches[1];
510
+ $wrapper.find("[name=cms_tpv_meta_wpml_language]").val(lang_code);
511
+
512
+ var current_view = cms_tpv_get_current_view(this);
513
+ cms_tvp_set_view(current_view, this);
514
+
515
+ return false;
516
+
517
+ });
518
+
519
+ function cms_tpv_get_current_view(elm) {
520
+ $wrapper = cms_tpv_get_wrapper(elm);
521
+ if ($wrapper.find(".cms_tvp_view_all").hasClass("current")) {
522
+ return "all";
523
+ } else if ($wrapper.find(".cms_tvp_view_public").hasClass("current")) {
524
+ return "public";
525
+ } else {
526
+ return false; // like unknown
527
+ }
528
+
529
+ }
530
+
531
+ function cms_tvp_set_view(view, elm) {
532
+
533
+ var $wrapper = jQuery(elm).closest(".cms_tpv_wrapper");
534
+
535
+ var div_actions_for_post_type = cms_tpv_get_page_actions_div(elm);
536
+ $wrapper.append(div_actions_for_post_type);
537
+
538
+ $wrapper.find(".cms_tvp_view_all, .cms_tvp_view_public, .cms_tvp_view_trash").removeClass("current");
539
+ $wrapper.find(".cms_tpv_container").jstree("destroy").html("");
540
+ cms_tpv_bind_clean_node();
541
+
542
+ if (view == "all") {
543
+ $wrapper.find(".cms_tvp_view_all").addClass("current");
544
+ } else if (view == "public") {
545
+ $wrapper.find(".cms_tvp_view_public").addClass("current");
546
+ } else if (view == "trash") {
547
+ $wrapper.find(".cms_tvp_view_trash").addClass("current");
548
+ } else {
549
+
550
+ }
551
+
552
+ var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
553
+ treeOptionsTmp.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view + "&post_type=" + cms_tpv_get_post_type(elm) + "&lang=" + cms_tpv_get_wpml_selected_lang(elm);
554
+ $wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
555
+ }
trunk/scripts/jquery.alerts.js ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // jQuery Alert Dialogs Plugin
2
+ //
3
+ // Version 1.1
4
+ //
5
+ // Cory S.N. LaViska
6
+ // A Beautiful Site (http://abeautifulsite.net/)
7
+ // 14 May 2009
8
+ //
9
+ // Visit http://abeautifulsite.net/notebook/87 for more information
10
+ //
11
+ // Usage:
12
+ // jAlert( message, [title, callback] )
13
+ // jConfirm( message, [title, callback] )
14
+ // jPrompt( message, [value, title, callback] )
15
+ //
16
+ // History:
17
+ //
18
+ // 1.00 - Released (29 December 2008)
19
+ //
20
+ // 1.01 - Fixed bug where unbinding would destroy all resize events
21
+ //
22
+ // License:
23
+ //
24
+ // This plugin is dual-licensed under the GNU General Public License and the MIT License and
25
+ // is copyright 2008 A Beautiful Site, LLC.
26
+ //
27
+ (function($) {
28
+
29
+ $.alerts = {
30
+
31
+ // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
32
+
33
+ verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
34
+ horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
35
+ repositionOnResize: true, // re-centers the dialog on window resize
36
+ overlayOpacity: .01, // transparency level of overlay
37
+ overlayColor: '#FFF', // base color of overlay
38
+ draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
39
+ okButton: '&nbsp;OK&nbsp;', // text for the OK button
40
+ cancelButton: '&nbsp;Cancel&nbsp;', // text for the Cancel button
41
+ dialogClass: null, // if specified, this class will be applied to all dialogs
42
+
43
+ // Public methods
44
+
45
+ alert: function(message, title, callback) {
46
+ if( title == null ) title = 'Alert';
47
+ $.alerts._show(title, message, null, 'alert', function(result) {
48
+ if( callback ) callback(result);
49
+ });
50
+ },
51
+
52
+ confirm: function(message, title, callback) {
53
+ if( title == null ) title = 'Confirm';
54
+ $.alerts._show(title, message, null, 'confirm', function(result) {
55
+ if( callback ) callback(result);
56
+ });
57
+ },
58
+
59
+ prompt: function(message, value, title, callback) {
60
+ if( title == null ) title = 'Prompt';
61
+ $.alerts._show(title, message, value, 'prompt', function(result) {
62
+ if( callback ) callback(result);
63
+ });
64
+ },
65
+
66
+ // Private methods
67
+
68
+ _show: function(title, msg, value, type, callback) {
69
+
70
+ $.alerts._hide();
71
+ $.alerts._overlay('show');
72
+
73
+ $("BODY").append(
74
+ '<div id="popup_container">' +
75
+ '<h1 id="popup_title"></h1>' +
76
+ '<div id="popup_content">' +
77
+ '<div id="popup_message"></div>' +
78
+ '</div>' +
79
+ '</div>');
80
+
81
+ if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
82
+
83
+ // IE6 Fix
84
+ var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
85
+
86
+ $("#popup_container").css({
87
+ position: pos,
88
+ zIndex: 99999,
89
+ padding: 0,
90
+ margin: 0
91
+ });
92
+
93
+ $("#popup_title").text(title);
94
+ $("#popup_content").addClass(type);
95
+ $("#popup_message").text(msg);
96
+ $("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
97
+
98
+ $("#popup_container").css({
99
+ minWidth: $("#popup_container").outerWidth(),
100
+ maxWidth: $("#popup_container").outerWidth()
101
+ });
102
+
103
+ $.alerts._reposition();
104
+ $.alerts._maintainPosition(true);
105
+
106
+ switch( type ) {
107
+ case 'alert':
108
+ $("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
109
+ $("#popup_ok").click( function() {
110
+ $.alerts._hide();
111
+ callback(true);
112
+ });
113
+ $("#popup_ok").focus().keypress( function(e) {
114
+ if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
115
+ });
116
+ break;
117
+ case 'confirm':
118
+ $("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
119
+ $("#popup_ok").click( function() {
120
+ $.alerts._hide();
121
+ if( callback ) callback(true);
122
+ });
123
+ $("#popup_cancel").click( function() {
124
+ $.alerts._hide();
125
+ if( callback ) callback(false);
126
+ });
127
+ $("#popup_ok").focus();
128
+ $("#popup_ok, #popup_cancel").keypress( function(e) {
129
+ if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
130
+ if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
131
+ });
132
+ break;
133
+ case 'prompt':
134
+ $("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
135
+ $("#popup_prompt").width( $("#popup_message").width() );
136
+ $("#popup_ok").click( function() {
137
+ var val = $("#popup_prompt").val();
138
+ $.alerts._hide();
139
+ if( callback ) callback( val );
140
+ });
141
+ $("#popup_cancel").click( function() {
142
+ $.alerts._hide();
143
+ if( callback ) callback( null );
144
+ });
145
+ $("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
146
+ if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
147
+ if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
148
+ });
149
+ if( value ) $("#popup_prompt").val(value);
150
+ $("#popup_prompt").focus().select();
151
+ break;
152
+ }
153
+
154
+ // Make draggable
155
+ if( $.alerts.draggable ) {
156
+ try {
157
+ $("#popup_container").draggable({ handle: $("#popup_title") });
158
+ $("#popup_title").css({ cursor: 'move' });
159
+ } catch(e) { /* requires jQuery UI draggables */ }
160
+ }
161
+ },
162
+
163
+ _hide: function() {
164
+ $("#popup_container").remove();
165
+ $.alerts._overlay('hide');
166
+ $.alerts._maintainPosition(false);
167
+ },
168
+
169
+ _overlay: function(status) {
170
+ switch( status ) {
171
+ case 'show':
172
+ $.alerts._overlay('hide');
173
+ $("BODY").append('<div id="popup_overlay"></div>');
174
+ $("#popup_overlay").css({
175
+ position: 'absolute',
176
+ zIndex: 99998,
177
+ top: '0px',
178
+ left: '0px',
179
+ width: '100%',
180
+ height: $(document).height(),
181
+ background: $.alerts.overlayColor,
182
+ opacity: $.alerts.overlayOpacity
183
+ });
184
+ break;
185
+ case 'hide':
186
+ $("#popup_overlay").remove();
187
+ break;
188
+ }
189
+ },
190
+
191
+ _reposition: function() {
192
+ var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
193
+ var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
194
+ if( top < 0 ) top = 0;
195
+ if( left < 0 ) left = 0;
196
+
197
+ // IE6 fix
198
+ if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
199
+
200
+ $("#popup_container").css({
201
+ top: top + 'px',
202
+ left: left + 'px'
203
+ });
204
+ $("#popup_overlay").height( $(document).height() );
205
+ },
206
+
207
+ _maintainPosition: function(status) {
208
+ if( $.alerts.repositionOnResize ) {
209
+ switch(status) {
210
+ case true:
211
+ $(window).bind('resize', $.alerts._reposition);
212
+ break;
213
+ case false:
214
+ $(window).unbind('resize', $.alerts._reposition);
215
+ break;
216
+ }
217
+ }
218
+ }
219
+
220
+ }
221
+
222
+ // Shortuct functions
223
+ jAlert = function(message, title, callback) {
224
+ $.alerts.alert(message, title, callback);
225
+ }
226
+
227
+ jConfirm = function(message, title, callback) {
228
+ $.alerts.confirm(message, title, callback);
229
+ };
230
+
231
+ jPrompt = function(message, value, title, callback) {
232
+ $.alerts.prompt(message, value, title, callback);
233
+ };
234
+
235
+ })(jQuery);
trunk/scripts/jquery.biscuit.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Cookie plugin
3
+ *
4
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Create a cookie with the given name and value and other optional parameters.
13
+ *
14
+ * @example $.cookie('the_cookie', 'the_value');
15
+ * @desc Set the value of a cookie.
16
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
17
+ * @desc Create a cookie with all available options.
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Create a session cookie.
20
+ * @example $.cookie('the_cookie', null);
21
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
22
+ * used when the cookie was set.
23
+ *
24
+ * @param String name The name of the cookie.
25
+ * @param String value The value of the cookie.
26
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
27
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
28
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
29
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
30
+ * when the the browser exits.
31
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
32
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
33
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
34
+ * require a secure protocol (like HTTPS).
35
+ * @type undefined
36
+ *
37
+ * @name $.cookie
38
+ * @cat Plugins/Cookie
39
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
40
+ */
41
+
42
+ /**
43
+ * Get the value of a cookie with the given name.
44
+ *
45
+ * @example $.cookie('the_cookie');
46
+ * @desc Get the value of a cookie.
47
+ *
48
+ * @param String name The name of the cookie.
49
+ * @return The value of the cookie.
50
+ * @type String
51
+ *
52
+ * @name $.cookie
53
+ * @cat Plugins/Cookie
54
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
55
+ */
56
+ jQuery.cookie = function(name, value, options) {
57
+ if (typeof value != 'undefined') { // name and value given, set cookie
58
+ options = options || {};
59
+ if (value === null) {
60
+ value = '';
61
+ options.expires = -1;
62
+ }
63
+ var expires = '';
64
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
65
+ var date;
66
+ if (typeof options.expires == 'number') {
67
+ date = new Date();
68
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
69
+ } else {
70
+ date = options.expires;
71
+ }
72
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
73
+ }
74
+ // CAUTION: Needed to parenthesize options.path and options.domain
75
+ // in the following expressions, otherwise they evaluate to undefined
76
+ // in the packed version for some reason...
77
+ var path = options.path ? '; path=' + (options.path) : '';
78
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
79
+ var secure = options.secure ? '; secure' : '';
80
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
81
+ } else { // only name given, get cookie
82
+ var cookieValue = null;
83
+ if (document.cookie && document.cookie != '') {
84
+ var cookies = document.cookie.split(';');
85
+ for (var i = 0; i < cookies.length; i++) {
86
+ var cookie = jQuery.trim(cookies[i]);
87
+ // Does this cookie string begin with the name we want?
88
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
89
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
90
+ break;
91
+ }
92
+ }
93
+ }
94
+ return cookieValue;
95
+ }
96
+ };
trunk/scripts/jquery.hoverIntent.minified.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
3
+ * <http://cherne.net/brian/resources/jquery.hoverIntent.html>
4
+ *
5
+ * @param f onMouseOver function || An object with configuration options
6
+ * @param g onMouseOut function || Nothing (use configuration options object)
7
+ * @author Brian Cherne <brian@cherne.net>
8
+ */
9
+ (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
trunk/scripts/jquery.jstree.js ADDED
@@ -0,0 +1,4545 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jsTree 1.0-rc3
3
+ * http://jstree.com/
4
+ *
5
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
6
+ *
7
+ * Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl.html
10
+ *
11
+ * $Date: 2011-02-09 00:17:14 +0100 (Wed, 09 Feb 2011) $
12
+ * $Revision: 236 $
13
+ */
14
+
15
+ /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
16
+ /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
17
+
18
+ "use strict";
19
+
20
+ // top wrapper to prevent multiple inclusion (is this OK?)
21
+ (function () { if(jQuery && jQuery.jstree) { return; }
22
+ var is_ie6 = false, is_ie7 = false, is_ff2 = false;
23
+
24
+ /*
25
+ * jsTree core
26
+ */
27
+ (function ($) {
28
+ // Common functions not related to jsTree
29
+ // decided to move them to a `vakata` "namespace"
30
+ $.vakata = {};
31
+ // CSS related functions
32
+ $.vakata.css = {
33
+ get_css : function(rule_name, delete_flag, sheet) {
34
+ rule_name = rule_name.toLowerCase();
35
+ var css_rules = sheet.cssRules || sheet.rules,
36
+ j = 0;
37
+ do {
38
+ if(css_rules.length && j > css_rules.length + 5) { return false; }
39
+ if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
40
+ if(delete_flag === true) {
41
+ if(sheet.removeRule) { sheet.removeRule(j); }
42
+ if(sheet.deleteRule) { sheet.deleteRule(j); }
43
+ return true;
44
+ }
45
+ else { return css_rules[j]; }
46
+ }
47
+ }
48
+ while (css_rules[++j]);
49
+ return false;
50
+ },
51
+ add_css : function(rule_name, sheet) {
52
+ if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
53
+ if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
54
+ return $.vakata.css.get_css(rule_name);
55
+ },
56
+ remove_css : function(rule_name, sheet) {
57
+ return $.vakata.css.get_css(rule_name, true, sheet);
58
+ },
59
+ add_sheet : function(opts) {
60
+ var tmp = false, is_new = true;
61
+ if(opts.str) {
62
+ if(opts.title) { tmp = $("style[id='" + opts.title + "-stylesheet']")[0]; }
63
+ if(tmp) { is_new = false; }
64
+ else {
65
+ tmp = document.createElement("style");
66
+ tmp.setAttribute('type',"text/css");
67
+ if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }
68
+ }
69
+ if(tmp.styleSheet) {
70
+ if(is_new) {
71
+ document.getElementsByTagName("head")[0].appendChild(tmp);
72
+ tmp.styleSheet.cssText = opts.str;
73
+ }
74
+ else {
75
+ tmp.styleSheet.cssText = tmp.styleSheet.cssText + " " + opts.str;
76
+ }
77
+ }
78
+ else {
79
+ tmp.appendChild(document.createTextNode(opts.str));
80
+ document.getElementsByTagName("head")[0].appendChild(tmp);
81
+ }
82
+ return tmp.sheet || tmp.styleSheet;
83
+ }
84
+ if(opts.url) {
85
+ if(document.createStyleSheet) {
86
+ try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
87
+ }
88
+ else {
89
+ tmp = document.createElement('link');
90
+ tmp.rel = 'stylesheet';
91
+ tmp.type = 'text/css';
92
+ tmp.media = "all";
93
+ tmp.href = opts.url;
94
+ document.getElementsByTagName("head")[0].appendChild(tmp);
95
+ return tmp.styleSheet;
96
+ }
97
+ }
98
+ }
99
+ };
100
+
101
+ // private variables
102
+ var instances = [], // instance array (used by $.jstree.reference/create/focused)
103
+ focused_instance = -1, // the index in the instance array of the currently focused instance
104
+ plugins = {}, // list of included plugins
105
+ prepared_move = {}; // for the move_node function
106
+
107
+ // jQuery plugin wrapper (thanks to jquery UI widget function)
108
+ $.fn.jstree = function (settings) {
109
+ var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
110
+ args = Array.prototype.slice.call(arguments, 1),
111
+ returnValue = this;
112
+
113
+ // if a method call execute the method on all selected instances
114
+ if(isMethodCall) {
115
+ if(settings.substring(0, 1) == '_') { return returnValue; }
116
+ this.each(function() {
117
+ var instance = instances[$.data(this, "jstree-instance-id")],
118
+ methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
119
+ if(typeof methodValue !== "undefined" && (settings.indexOf("is_") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
120
+ });
121
+ }
122
+ else {
123
+ this.each(function() {
124
+ // extend settings and allow for multiple hashes and $.data
125
+ var instance_id = $.data(this, "jstree-instance-id"),
126
+ a = [],
127
+ b = settings ? $.extend({}, true, settings) : {},
128
+ c = $(this),
129
+ s = false,
130
+ t = [];
131
+ a = a.concat(args);
132
+ if(c.data("jstree")) { a.push(c.data("jstree")); }
133
+ b = a.length ? $.extend.apply(null, [true, b].concat(a)) : b;
134
+
135
+ // if an instance already exists, destroy it first
136
+ if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
137
+ // push a new empty object to the instances array
138
+ instance_id = parseInt(instances.push({}),10) - 1;
139
+ // store the jstree instance id to the container element
140
+ $.data(this, "jstree-instance-id", instance_id);
141
+ // clean up all plugins
142
+ b.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();
143
+ b.plugins.unshift("core");
144
+ // only unique plugins
145
+ b.plugins = b.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
146
+
147
+ // extend defaults with passed data
148
+ s = $.extend(true, {}, $.jstree.defaults, b);
149
+ s.plugins = b.plugins;
150
+ $.each(plugins, function (i, val) {
151
+ if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; }
152
+ else { t.push(i); }
153
+ });
154
+ s.plugins = t;
155
+
156
+ // push the new object to the instances array (at the same time set the default classes to the container) and init
157
+ instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
158
+ // init all activated plugins for this instance
159
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
160
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
161
+ // initialize the instance
162
+ setTimeout(function() { instances[instance_id].init(); }, 0);
163
+ });
164
+ }
165
+ // return the jquery selection (or if it was a method call that returned a value - the returned value)
166
+ return returnValue;
167
+ };
168
+ // object to store exposed functions and objects
169
+ $.jstree = {
170
+ defaults : {
171
+ plugins : []
172
+ },
173
+ _focused : function () { return instances[focused_instance] || null; },
174
+ _reference : function (needle) {
175
+ // get by instance id
176
+ if(instances[needle]) { return instances[needle]; }
177
+ // get by DOM (if still no luck - return null
178
+ var o = $(needle);
179
+ if(!o.length && typeof needle === "string") { o = $("#" + needle); }
180
+ if(!o.length) { return null; }
181
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
182
+ },
183
+ _instance : function (index, container, settings) {
184
+ // for plugins to store data in
185
+ this.data = { core : {} };
186
+ this.get_settings = function () { return $.extend(true, {}, settings); };
187
+ this._get_settings = function () { return settings; };
188
+ this.get_index = function () { return index; };
189
+ this.get_container = function () { return container; };
190
+ this.get_container_ul = function () { return container.children("ul:eq(0)"); };
191
+ this._set_settings = function (s) {
192
+ settings = $.extend(true, {}, settings, s);
193
+ };
194
+ },
195
+ _fn : { },
196
+ plugin : function (pname, pdata) {
197
+ pdata = $.extend({}, {
198
+ __init : $.noop,
199
+ __destroy : $.noop,
200
+ _fn : {},
201
+ defaults : false
202
+ }, pdata);
203
+ plugins[pname] = pdata;
204
+
205
+ $.jstree.defaults[pname] = pdata.defaults;
206
+ $.each(pdata._fn, function (i, val) {
207
+ val.plugin = pname;
208
+ val.old = $.jstree._fn[i];
209
+ $.jstree._fn[i] = function () {
210
+ var rslt,
211
+ func = val,
212
+ args = Array.prototype.slice.call(arguments),
213
+ evnt = new $.Event("before.jstree"),
214
+ rlbk = false;
215
+
216
+ if(this.data.core.locked === true && i !== "unlock" && i !== "is_locked") { return; }
217
+
218
+ // Check if function belongs to the included plugins of this instance
219
+ do {
220
+ if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
221
+ func = func.old;
222
+ } while(func);
223
+ if(!func) { return; }
224
+
225
+ // context and function to trigger events, then finally call the function
226
+ if(i.indexOf("_") === 0) {
227
+ rslt = func.apply(this, args);
228
+ }
229
+ else {
230
+ rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args, "plugin" : func.plugin });
231
+ if(rslt === false) { return; }
232
+ if(typeof rslt !== "undefined") { args = rslt; }
233
+
234
+ rslt = func.apply(
235
+ $.extend({}, this, {
236
+ __callback : function (data) {
237
+ this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
238
+ },
239
+ __rollback : function () {
240
+ rlbk = this.get_rollback();
241
+ return rlbk;
242
+ },
243
+ __call_old : function (replace_arguments) {
244
+ return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
245
+ }
246
+ }), args);
247
+ }
248
+
249
+ // return the result
250
+ return rslt;
251
+ };
252
+ $.jstree._fn[i].old = val.old;
253
+ $.jstree._fn[i].plugin = pname;
254
+ });
255
+ },
256
+ rollback : function (rb) {
257
+ if(rb) {
258
+ if(!$.isArray(rb)) { rb = [ rb ]; }
259
+ $.each(rb, function (i, val) {
260
+ instances[val.i].set_rollback(val.h, val.d);
261
+ });
262
+ }
263
+ }
264
+ };
265
+ // set the prototype for all instances
266
+ $.jstree._fn = $.jstree._instance.prototype = {};
267
+
268
+ // load the css when DOM is ready
269
+ $(function() {
270
+ // code is copied from jQuery ($.browser is deprecated + there is a bug in IE)
271
+ var u = navigator.userAgent.toLowerCase(),
272
+ v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
273
+ css_string = '' +
274
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
275
+ '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +
276
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
277
+ '.jstree > ul > li { margin-left:0px; } ' +
278
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
279
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
280
+ '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
281
+ '.jstree a:focus { outline: none; } ' +
282
+ '.jstree a > ins { height:16px; width:16px; } ' +
283
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
284
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
285
+ 'li.jstree-open > ul { display:block; } ' +
286
+ 'li.jstree-closed > ul { display:none; } ';
287
+ // Correct IE 6 (does not support the > CSS selector)
288
+ if(/msie/.test(u) && parseInt(v, 10) == 6) {
289
+ is_ie6 = true;
290
+
291
+ // fix image flicker and lack of caching
292
+ try {
293
+ document.execCommand("BackgroundImageCache", false, true);
294
+ } catch (err) { }
295
+
296
+ css_string += '' +
297
+ '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
298
+ '.jstree li li { margin-left:18px; } ' +
299
+ '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
300
+ 'li.jstree-open ul { display:block; } ' +
301
+ 'li.jstree-closed ul { display:none !important; } ' +
302
+ '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
303
+ '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
304
+ '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
305
+ }
306
+ // Correct IE 7 (shifts anchor nodes onhover)
307
+ if(/msie/.test(u) && parseInt(v, 10) == 7) {
308
+ is_ie7 = true;
309
+ css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
310
+ }
311
+ // correct ff2 lack of display:inline-block
312
+ if(!/compatible/.test(u) && /mozilla/.test(u) && parseFloat(v, 10) < 1.9) {
313
+ is_ff2 = true;
314
+ css_string += '' +
315
+ '.jstree ins { display:-moz-inline-box; } ' +
316
+ '.jstree li { line-height:12px; } ' + // WHY??
317
+ '.jstree a { display:-moz-inline-box; } ' +
318
+ '.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';
319
+ /* this shouldn't be here as it is theme specific */
320
+ }
321
+ // the default stylesheet
322
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
323
+ });
324
+
325
+ // core functions (open, close, create, update, delete)
326
+ $.jstree.plugin("core", {
327
+ __init : function () {
328
+ this.data.core.locked = false;
329
+ this.data.core.to_open = this.get_settings().core.initially_open;
330
+ this.data.core.to_load = this.get_settings().core.initially_load;
331
+ },
332
+ defaults : {
333
+ html_titles : false,
334
+ animation : 500,
335
+ initially_open : [],
336
+ initially_load : [],
337
+ open_parents : true,
338
+ notify_plugins : true,
339
+ rtl : false,
340
+ load_open : false,
341
+ strings : {
342
+ loading : "Loading ...",
343
+ new_node : "New node",
344
+ multiple_selection : "Multiple selection"
345
+ }
346
+ },
347
+ _fn : {
348
+ init : function () {
349
+ this.set_focus();
350
+ if(this._get_settings().core.rtl) {
351
+ this.get_container().addClass("jstree-rtl").css("direction", "rtl");
352
+ }
353
+ this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_string("loading") + "</a></li></ul>");
354
+ this.data.core.li_height = this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height() || 18;
355
+
356
+ this.get_container()
357
+ .delegate("li > ins", "click.jstree", $.proxy(function (event) {
358
+ var trgt = $(event.target);
359
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
360
+ }, this))
361
+ .bind("mousedown.jstree", $.proxy(function () {
362
+ this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
363
+ }, this))
364
+ .bind("dblclick.jstree", function (event) {
365
+ var sel;
366
+ if(document.selection && document.selection.empty) { document.selection.empty(); }
367
+ else {
368
+ if(window.getSelection) {
369
+ sel = window.getSelection();
370
+ try {
371
+ sel.removeAllRanges();
372
+ sel.collapse();
373
+ } catch (err) { }
374
+ }
375
+ }
376
+ });
377
+ if(this._get_settings().core.notify_plugins) {
378
+ this.get_container()
379
+ .bind("load_node.jstree", $.proxy(function (e, data) {
380
+ var o = this._get_node(data.rslt.obj),
381
+ t = this;
382
+ if(o === -1) { o = this.get_container_ul(); }
383
+ if(!o.length) { return; }
384
+ o.find("li").each(function () {
385
+ var th = $(this);
386
+ if(th.data("jstree")) {
387
+ $.each(th.data("jstree"), function (plugin, values) {
388
+ if(t.data[plugin] && $.isFunction(t["_" + plugin + "_notify"])) {
389
+ t["_" + plugin + "_notify"].call(t, th, values);
390
+ }
391
+ });
392
+ }
393
+ });
394
+ }, this));
395
+ }
396
+ if(this._get_settings().core.load_open) {
397
+ this.get_container()
398
+ .bind("load_node.jstree", $.proxy(function (e, data) {
399
+ var o = this._get_node(data.rslt.obj),
400
+ t = this;
401
+ if(o === -1) { o = this.get_container_ul(); }
402
+ if(!o.length) { return; }
403
+ o.find("li.jstree-open:not(:has(ul))").each(function () {
404
+ t.load_node(this, $.noop, $.noop);
405
+ });
406
+ }, this));
407
+ }
408
+ this.__callback();
409
+ this.load_node(-1, function () { this.loaded(); this.reload_nodes(); });
410
+ },
411
+ destroy : function () {
412
+ var i,
413
+ n = this.get_index(),
414
+ s = this._get_settings(),
415
+ _this = this;
416
+
417
+ $.each(s.plugins, function (i, val) {
418
+ try { plugins[val].__destroy.apply(_this); } catch(err) { }
419
+ });
420
+ this.__callback();
421
+ // set focus to another instance if this one is focused
422
+ if(this.is_focused()) {
423
+ for(i in instances) {
424
+ if(instances.hasOwnProperty(i) && i != n) {
425
+ instances[i].set_focus();
426
+ break;
427
+ }
428
+ }
429
+ }
430
+ // if no other instance found
431
+ if(n === focused_instance) { focused_instance = -1; }
432
+ // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
433
+ this.get_container()
434
+ .unbind(".jstree")
435
+ .undelegate(".jstree")
436
+ .removeData("jstree-instance-id")
437
+ .find("[class^='jstree']")
438
+ .andSelf()
439
+ .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
440
+ $(document)
441
+ .unbind(".jstree-" + n)
442
+ .undelegate(".jstree-" + n);
443
+ // remove the actual data
444
+ instances[n] = null;
445
+ delete instances[n];
446
+ },
447
+
448
+ _core_notify : function (n, data) {
449
+ if(data.opened) {
450
+ this.open_node(n, false, true);
451
+ }
452
+ },
453
+
454
+ lock : function () {
455
+ this.data.core.locked = true;
456
+ this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7");
457
+ this.__callback({});
458
+ },
459
+ unlock : function () {
460
+ this.data.core.locked = false;
461
+ this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");
462
+ this.__callback({});
463
+ },
464
+ is_locked : function () { return this.data.core.locked; },
465
+ save_opened : function () {
466
+ var _this = this;
467
+ this.data.core.to_open = [];
468
+ this.get_container_ul().find("li.jstree-open").each(function () {
469
+ if(this.id) { _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); }
470
+ });
471
+ this.__callback(_this.data.core.to_open);
472
+ },
473
+ save_loaded : function () { },
474
+ reload_nodes : function (is_callback) {
475
+ var _this = this,
476
+ done = true,
477
+ current = [],
478
+ remaining = [];
479
+ if(!is_callback) {
480
+ this.data.core.reopen = false;
481
+ this.data.core.refreshing = true;
482
+ this.data.core.to_open = $.map($.makeArray(this.data.core.to_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
483
+ this.data.core.to_load = $.map($.makeArray(this.data.core.to_load), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
484
+ if(this.data.core.to_open.length) {
485
+ this.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open);
486
+ }
487
+ }
488
+ if(this.data.core.to_load.length) {
489
+ $.each(this.data.core.to_load, function (i, val) {
490
+ if(val == "#") { return true; }
491
+ if($(val).length) { current.push(val); }
492
+ else { remaining.push(val); }
493
+ });
494
+ if(current.length) {
495
+ this.data.core.to_load = remaining;
496
+ $.each(current, function (i, val) {
497
+ if(!_this._is_loaded(val)) {
498
+ _this.load_node(val, function () { _this.reload_nodes(true); }, function () { _this.reload_nodes(true); });
499
+ done = false;
500
+ }
501
+ });
502
+ }
503
+ }
504
+ if(this.data.core.to_open.length) {
505
+ $.each(this.data.core.to_open, function (i, val) {
506
+ _this.open_node(val, false, true);
507
+ });
508
+ }
509
+ if(done) {
510
+ // TODO: find a more elegant approach to syncronizing returning requests
511
+ if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
512
+ this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
513
+ this.data.core.refreshing = false;
514
+ this.reopen();
515
+ }
516
+ },
517
+ reopen : function () {
518
+ var _this = this;
519
+ if(this.data.core.to_open.length) {
520
+ $.each(this.data.core.to_open, function (i, val) {
521
+ _this.open_node(val, false, true);
522
+ });
523
+ }
524
+ this.__callback({});
525
+ },
526
+ refresh : function (obj) {
527
+ var _this = this;
528
+ this.save_opened();
529
+ if(!obj) { obj = -1; }
530
+ obj = this._get_node(obj);
531
+ if(!obj) { obj = -1; }
532
+ if(obj !== -1) { obj.children("UL").remove(); }
533
+ else { this.get_container_ul().empty(); }
534
+ this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reload_nodes(); });
535
+ },
536
+ // Dummy function to fire after the first load (so that there is a jstree.loaded event)
537
+ loaded : function () {
538
+ this.__callback();
539
+ },
540
+ // deal with focus
541
+ set_focus : function () {
542
+ if(this.is_focused()) { return; }
543
+ var f = $.jstree._focused();
544
+ if(f) { f.unset_focus(); }
545
+
546
+ this.get_container().addClass("jstree-focused");
547
+ focused_instance = this.get_index();
548
+ this.__callback();
549
+ },
550
+ is_focused : function () {
551
+ return focused_instance == this.get_index();
552
+ },
553
+ unset_focus : function () {
554
+ if(this.is_focused()) {
555
+ this.get_container().removeClass("jstree-focused");
556
+ focused_instance = -1;
557
+ }
558
+ this.__callback();
559
+ },
560
+
561
+ // traverse
562
+ _get_node : function (obj) {
563
+ var $obj = $(obj, this.get_container());
564
+ if($obj.is(".jstree") || obj == -1) { return -1; }
565
+ $obj = $obj.closest("li", this.get_container());
566
+ return $obj.length ? $obj : false;
567
+ },
568
+ _get_next : function (obj, strict) {
569
+ obj = this._get_node(obj);
570
+ if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
571
+ if(!obj.length) { return false; }
572
+ if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
573
+
574
+ if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
575
+ else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
576
+ else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
577
+ },
578
+ _get_prev : function (obj, strict) {
579
+ obj = this._get_node(obj);
580
+ if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
581
+ if(!obj.length) { return false; }
582
+ if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
583
+
584
+ if(obj.prev("li").length) {
585
+ obj = obj.prev("li").eq(0);
586
+ while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
587
+ return obj;
588
+ }
589
+ else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
590
+ },
591
+ _get_parent : function (obj) {
592
+ obj = this._get_node(obj);
593
+ if(obj == -1 || !obj.length) { return false; }
594
+ var o = obj.parentsUntil(".jstree", "li:eq(0)");
595
+ return o.length ? o : -1;
596
+ },
597
+ _get_children : function (obj) {
598
+ obj = this._get_node(obj);
599
+ if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
600
+ if(!obj.length) { return false; }
601
+ return obj.children("ul:eq(0)").children("li");
602
+ },
603
+ get_path : function (obj, id_mode) {
604
+ var p = [],
605
+ _this = this;
606
+ obj = this._get_node(obj);
607
+ if(obj === -1 || !obj || !obj.length) { return false; }
608
+ obj.parentsUntil(".jstree", "li").each(function () {
609
+ p.push( id_mode ? this.id : _this.get_text(this) );
610
+ });
611
+ p.reverse();
612
+ p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
613
+ return p;
614
+ },
615
+
616
+ // string functions
617
+ _get_string : function (key) {
618
+ return this._get_settings().core.strings[key] || key;
619
+ },
620
+
621
+ is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
622
+ is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
623
+ is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
624
+ correct_state : function (obj) {
625
+ obj = this._get_node(obj);
626
+ if(!obj || obj === -1) { return false; }
627
+ obj.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();
628
+ this.__callback({ "obj" : obj });
629
+ },
630
+ // open/close
631
+ open_node : function (obj, callback, skip_animation) {
632
+ obj = this._get_node(obj);
633
+ if(!obj.length) { return false; }
634
+ if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
635
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
636
+ t = this;
637
+ if(!this._is_loaded(obj)) {
638
+ obj.children("a").addClass("jstree-loading");
639
+ this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
640
+ }
641
+ else {
642
+ if(this._get_settings().core.open_parents) {
643
+ obj.parentsUntil(".jstree",".jstree-closed").each(function () {
644
+ t.open_node(this, false, true);
645
+ });
646
+ }
647
+ if(s) { obj.children("ul").css("display","none"); }
648
+ obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
649
+ if(s) { obj.children("ul").stop(true, true).slideDown(s, function () { this.style.display = ""; t.after_open(obj); }); }
650
+ else { t.after_open(obj); }
651
+ this.__callback({ "obj" : obj });
652
+ if(callback) { callback.call(); }
653
+ }
654
+ },
655
+ after_open : function (obj) { this.__callback({ "obj" : obj }); },
656
+ close_node : function (obj, skip_animation) {
657
+ obj = this._get_node(obj);
658
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
659
+ t = this;
660
+ if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
661
+ if(s) { obj.children("ul").attr("style","display:block !important"); }
662
+ obj.removeClass("jstree-open").addClass("jstree-closed");
663
+ if(s) { obj.children("ul").stop(true, true).slideUp(s, function () { this.style.display = ""; t.after_close(obj); }); }
664
+ else { t.after_close(obj); }
665
+ this.__callback({ "obj" : obj });
666
+ },
667
+ after_close : function (obj) { this.__callback({ "obj" : obj }); },
668
+ toggle_node : function (obj) {
669
+ obj = this._get_node(obj);
670
+ if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
671
+ if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
672
+ },
673
+ open_all : function (obj, do_animation, original_obj) {
674
+ obj = obj ? this._get_node(obj) : -1;
675
+ if(!obj || obj === -1) { obj = this.get_container_ul(); }
676
+ if(original_obj) {
677
+ obj = obj.find("li.jstree-closed");
678
+ }
679
+ else {
680
+ original_obj = obj;
681
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
682
+ else { obj = obj.find("li.jstree-closed"); }
683
+ }
684
+ var _this = this;
685
+ obj.each(function () {
686
+ var __this = this;
687
+ if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, do_animation, original_obj); }, !do_animation); }
688
+ else { _this.open_node(this, false, !do_animation); }
689
+ });
690
+ // so that callback is fired AFTER all nodes are open
691
+ if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
692
+ },
693
+ close_all : function (obj, do_animation) {
694
+ var _this = this;
695
+ obj = obj ? this._get_node(obj) : this.get_container();
696
+ if(!obj || obj === -1) { obj = this.get_container_ul(); }
697
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
698
+ this.__callback({ "obj" : obj });
699
+ },
700
+ clean_node : function (obj) {
701
+ obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
702
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
703
+ obj.removeClass("jstree-last")
704
+ .filter("li:last-child").addClass("jstree-last").end()
705
+ .filter(":has(li)")
706
+ .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
707
+ obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
708
+ this.__callback({ "obj" : obj });
709
+ },
710
+ // rollback
711
+ get_rollback : function () {
712
+ this.__callback();
713
+ return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
714
+ },
715
+ set_rollback : function (html, data) {
716
+ this.get_container().empty().append(html);
717
+ this.data = data;
718
+ this.__callback();
719
+ },
720
+ // Dummy functions to be overwritten by any datastore plugin included
721
+ load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
722
+ _is_loaded : function (obj) { return true; },
723
+
724
+ // Basic operations: create
725
+ create_node : function (obj, position, js, callback, is_loaded) {
726
+ obj = this._get_node(obj);
727
+ position = typeof position === "undefined" ? "last" : position;
728
+ var d = $("<li />"),
729
+ s = this._get_settings().core,
730
+ tmp;
731
+
732
+ if(obj !== -1 && !obj.length) { return false; }
733
+ if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
734
+
735
+ this.__rollback();
736
+
737
+ if(typeof js === "string") { js = { "data" : js }; }
738
+ if(!js) { js = {}; }
739
+ if(js.attr) { d.attr(js.attr); }
740
+ if(js.metadata) { d.data(js.metadata); }
741
+ if(js.state) { d.addClass("jstree-" + js.state); }
742
+ if(!js.data) { js.data = this._get_string("new_node"); }
743
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
744
+ $.each(js.data, function (i, m) {
745
+ tmp = $("<a />");
746
+ if($.isFunction(m)) { m = m.call(this, js); }
747
+ if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
748
+ else {
749
+ if(!m.attr) { m.attr = {}; }
750
+ if(!m.attr.href) { m.attr.href = '#'; }
751
+ tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
752
+ if(m.language) { tmp.addClass(m.language); }
753
+ }
754
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
755
+ if(m.icon) {
756
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
757
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
758
+ }
759
+ d.append(tmp);
760
+ });
761
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
762
+ if(obj === -1) {
763
+ obj = this.get_container();
764
+ if(position === "before") { position = "first"; }
765
+ if(position === "after") { position = "last"; }
766
+ }
767
+ switch(position) {
768
+ case "before": obj.before(d); tmp = this._get_parent(obj); break;
769
+ case "after" : obj.after(d); tmp = this._get_parent(obj); break;
770
+ case "inside":
771
+ case "first" :
772
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
773
+ obj.children("ul").prepend(d);
774
+ tmp = obj;
775
+ break;
776
+ case "last":
777
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
778
+ obj.children("ul").append(d);
779
+ tmp = obj;
780
+ break;
781
+ default:
782
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
783
+ if(!position) { position = 0; }
784
+ tmp = obj.children("ul").children("li").eq(position);
785
+ if(tmp.length) { tmp.before(d); }
786
+ else { obj.children("ul").append(d); }
787
+ tmp = obj;
788
+ break;
789
+ }
790
+ if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
791
+ this.clean_node(tmp);
792
+ this.__callback({ "obj" : d, "parent" : tmp });
793
+ if(callback) { callback.call(this, d); }
794
+ return d;
795
+ },
796
+ // Basic operations: rename (deal with text)
797
+ get_text : function (obj) {
798
+ obj = this._get_node(obj);
799
+ if(!obj.length) { return false; }
800
+ var s = this._get_settings().core.html_titles;
801
+ obj = obj.children("a:eq(0)");
802
+ if(s) {
803
+ obj = obj.clone();
804
+ obj.children("INS").remove();
805
+ return obj.html();
806
+ }
807
+ else {
808
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
809
+ return obj.nodeValue;
810
+ }
811
+ },
812
+ set_text : function (obj, val) {
813
+ obj = this._get_node(obj);
814
+ if(!obj.length) { return false; }
815
+ obj = obj.children("a:eq(0)");
816
+ if(this._get_settings().core.html_titles) {
817
+ var tmp = obj.children("INS").clone();
818
+ obj.html(val).prepend(tmp);
819
+ this.__callback({ "obj" : obj, "name" : val });
820
+ return true;
821
+ }
822
+ else {
823
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
824
+ this.__callback({ "obj" : obj, "name" : val });
825
+ return (obj.nodeValue = val);
826
+ }
827
+ },
828
+ rename_node : function (obj, val) {
829
+ obj = this._get_node(obj);
830
+ this.__rollback();
831
+ if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
832
+ },
833
+ // Basic operations: deleting nodes
834
+ delete_node : function (obj) {
835
+ obj = this._get_node(obj);
836
+ if(!obj.length) { return false; }
837
+ this.__rollback();
838
+ var p = this._get_parent(obj), prev = $([]), t = this;
839
+ obj.each(function () {
840
+ prev = prev.add(t._get_prev(this));
841
+ });
842
+ obj = obj.detach();
843
+ if(p !== -1 && p.find("> ul > li").length === 0) {
844
+ p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
845
+ }
846
+ this.clean_node(p);
847
+ this.__callback({ "obj" : obj, "prev" : prev, "parent" : p });
848
+ return obj;
849
+ },
850
+ prepare_move : function (o, r, pos, cb, is_cb) {
851
+ var p = {};
852
+
853
+ p.ot = $.jstree._reference(o) || this;
854
+ p.o = p.ot._get_node(o);
855
+ p.r = r === - 1 ? -1 : this._get_node(r);
856
+ p.p = (typeof pos === "undefined" || pos === false) ? "last" : pos; // TODO: move to a setting
857
+ if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {
858
+ this.__callback(prepared_move);
859
+ if(cb) { cb.call(this, prepared_move); }
860
+ return;
861
+ }
862
+ p.ot = $.jstree._reference(p.o) || this;
863
+ p.rt = $.jstree._reference(p.r) || this; // r === -1 ? p.ot : $.jstree._reference(p.r) || this
864
+ if(p.r === -1 || !p.r) {
865
+ p.cr = -1;
866
+ switch(p.p) {
867
+ case "first":
868
+ case "before":
869
+ case "inside":
870
+ p.cp = 0;
871
+ break;
872
+ case "after":
873
+ case "last":
874
+ p.cp = p.rt.get_container().find(" > ul > li").length;
875
+ break;
876
+ default:
877
+ p.cp = p.p;
878
+ break;
879
+ }
880
+ }
881
+ else {
882
+ if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
883
+ return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
884
+ }
885
+ switch(p.p) {
886
+ case "before":
887
+ p.cp = p.r.index();
888
+ p.cr = p.rt._get_parent(p.r);
889
+ break;
890
+ case "after":
891
+ p.cp = p.r.index() + 1;
892
+ p.cr = p.rt._get_parent(p.r);
893
+ break;
894
+ case "inside":
895
+ case "first":
896
+ p.cp = 0;
897
+ p.cr = p.r;
898
+ break;
899
+ case "last":
900
+ p.cp = p.r.find(" > ul > li").length;
901
+ p.cr = p.r;
902
+ break;
903
+ default:
904
+ p.cp = p.p;
905
+ p.cr = p.r;
906
+ break;
907
+ }
908
+ }
909
+ p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
910
+ p.op = p.ot._get_parent(p.o);
911
+ p.cop = p.o.index();
912
+ if(p.op === -1) { p.op = p.ot ? p.ot.get_container() : this.get_container(); }
913
+ if(!/^(before|after)$/.test(p.p) && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp++; }
914
+ //if(p.p === "before" && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp--; }
915
+ p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
916
+ prepared_move = p;
917
+ this.__callback(prepared_move);
918
+ if(cb) { cb.call(this, prepared_move); }
919
+ },
920
+ check_move : function () {
921
+ var obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;
922
+ if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
923
+ if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
924
+ obj.o.each(function () {
925
+ if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }
926
+ });
927
+ return ret;
928
+ },
929
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
930
+ if(!is_prepared) {
931
+ return this.prepare_move(obj, ref, position, function (p) {
932
+ this.move_node(p, false, false, is_copy, true, skip_check);
933
+ });
934
+ }
935
+ if(is_copy) {
936
+ prepared_move.cy = true;
937
+ }
938
+ if(!skip_check && !this.check_move()) { return false; }
939
+
940
+ this.__rollback();
941
+ var o = false;
942
+ if(is_copy) {
943
+ o = obj.o.clone(true);
944
+ o.find("*[id]").andSelf().each(function () {
945
+ if(this.id) { this.id = "copy_" + this.id; }
946
+ });
947
+ }
948
+ else { o = obj.o; }
949
+
950
+ if(obj.or.length) { obj.or.before(o); }
951
+ else {
952
+ if(!obj.np.children("ul").length) { $("<ul />").appendTo(obj.np); }
953
+ obj.np.children("ul:eq(0)").append(o);
954
+ }
955
+
956
+ try {
957
+ obj.ot.clean_node(obj.op);
958
+ obj.rt.clean_node(obj.np);
959
+ if(!obj.op.find("> ul > li").length) {
960
+ obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
961
+ }
962
+ } catch (e) { }
963
+
964
+ if(is_copy) {
965
+ prepared_move.cy = true;
966
+ prepared_move.oc = o;
967
+ }
968
+ this.__callback(prepared_move);
969
+ return prepared_move;
970
+ },
971
+ _get_move : function () { return prepared_move; }
972
+ }
973
+ });
974
+ })(jQuery);
975
+ //*/
976
+
977
+ /*
978
+ * jsTree ui plugin
979
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes
980
+ */
981
+ (function ($) {
982
+ var scrollbar_width, e1, e2;
983
+ $(function() {
984
+ if (/msie/.test(navigator.userAgent.toLowerCase())) {
985
+ e1 = $('<textarea cols="10" rows="2"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
986
+ e2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
987
+ scrollbar_width = e1.width() - e2.width();
988
+ e1.add(e2).remove();
989
+ }
990
+ else {
991
+ e1 = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: 0 })
992
+ .prependTo('body').append('<div />').find('div').css({ width: '100%', height: 200 });
993
+ scrollbar_width = 100 - e1.width();
994
+ e1.parent().remove();
995
+ }
996
+ });
997
+ $.jstree.plugin("ui", {
998
+ __init : function () {
999
+ this.data.ui.selected = $();
1000
+ this.data.ui.last_selected = false;
1001
+ this.data.ui.hovered = null;
1002
+ this.data.ui.to_select = this.get_settings().ui.initially_select;
1003
+
1004
+ this.get_container()
1005
+ .delegate("a", "click.jstree", $.proxy(function (event) {
1006
+ event.preventDefault();
1007
+ event.currentTarget.blur();
1008
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1009
+ this.select_node(event.currentTarget, true, event);
1010
+ }
1011
+ }, this))
1012
+ .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
1013
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1014
+ this.hover_node(event.target);
1015
+ }
1016
+ }, this))
1017
+ .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
1018
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1019
+ this.dehover_node(event.target);
1020
+ }
1021
+ }, this))
1022
+ .bind("reopen.jstree", $.proxy(function () {
1023
+ this.reselect();
1024
+ }, this))
1025
+ .bind("get_rollback.jstree", $.proxy(function () {
1026
+ this.dehover_node();
1027
+ this.save_selected();
1028
+ }, this))
1029
+ .bind("set_rollback.jstree", $.proxy(function () {
1030
+ this.reselect();
1031
+ }, this))
1032
+ .bind("close_node.jstree", $.proxy(function (event, data) {
1033
+ var s = this._get_settings().ui,
1034
+ obj = this._get_node(data.rslt.obj),
1035
+ clk = (obj && obj.length) ? obj.children("ul").find("a.jstree-clicked") : $(),
1036
+ _this = this;
1037
+ if(s.selected_parent_close === false || !clk.length) { return; }
1038
+ clk.each(function () {
1039
+ _this.deselect_node(this);
1040
+ if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
1041
+ });
1042
+ }, this))
1043
+ .bind("delete_node.jstree", $.proxy(function (event, data) {
1044
+ var s = this._get_settings().ui.select_prev_on_delete,
1045
+ obj = this._get_node(data.rslt.obj),
1046
+ clk = (obj && obj.length) ? obj.find("a.jstree-clicked") : [],
1047
+ _this = this;
1048
+ clk.each(function () { _this.deselect_node(this); });
1049
+ if(s && clk.length) {
1050
+ data.rslt.prev.each(function () {
1051
+ if(this.parentNode) { _this.select_node(this); return false; /* if return false is removed all prev nodes will be selected */}
1052
+ });
1053
+ }
1054
+ }, this))
1055
+ .bind("move_node.jstree", $.proxy(function (event, data) {
1056
+ if(data.rslt.cy) {
1057
+ data.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked");
1058
+ }
1059
+ }, this));
1060
+ },
1061
+ defaults : {
1062
+ select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
1063
+ select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
1064
+ select_range_modifier : "shift",
1065
+ selected_parent_close : "select_parent", // false, "deselect", "select_parent"
1066
+ selected_parent_open : true,
1067
+ select_prev_on_delete : true,
1068
+ disable_selecting_children : false,
1069
+ initially_select : []
1070
+ },
1071
+ _fn : {
1072
+ _get_node : function (obj, allow_multiple) {
1073
+ if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
1074
+ var $obj = $(obj, this.get_container());
1075
+ if($obj.is(".jstree") || obj == -1) { return -1; }
1076
+ $obj = $obj.closest("li", this.get_container());
1077
+ return $obj.length ? $obj : false;
1078
+ },
1079
+ _ui_notify : function (n, data) {
1080
+ if(data.selected) {
1081
+ this.select_node(n, false);
1082
+ }
1083
+ },
1084
+ save_selected : function () {
1085
+ var _this = this;
1086
+ this.data.ui.to_select = [];
1087
+ this.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); } });
1088
+ this.__callback(this.data.ui.to_select);
1089
+ },
1090
+ reselect : function () {
1091
+ var _this = this,
1092
+ s = this.data.ui.to_select;
1093
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
1094
+ // this.deselect_all(); WHY deselect, breaks plugin state notifier?
1095
+ $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
1096
+ this.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode; });
1097
+ this.__callback();
1098
+ },
1099
+ refresh : function (obj) {
1100
+ this.save_selected();
1101
+ return this.__call_old();
1102
+ },
1103
+ hover_node : function (obj) {
1104
+ obj = this._get_node(obj);
1105
+ if(!obj.length) { return false; }
1106
+ //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
1107
+ if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
1108
+ this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
1109
+ this._fix_scroll(obj);
1110
+ this.__callback({ "obj" : obj });
1111
+ },
1112
+ dehover_node : function () {
1113
+ var obj = this.data.ui.hovered, p;
1114
+ if(!obj || !obj.length) { return false; }
1115
+ p = obj.children("a").removeClass("jstree-hovered").parent();
1116
+ if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
1117
+ this.__callback({ "obj" : obj });
1118
+ },
1119
+ select_node : function (obj, check, e) {
1120
+ obj = this._get_node(obj);
1121
+ if(obj == -1 || !obj || !obj.length) { return false; }
1122
+ var s = this._get_settings().ui,
1123
+ is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
1124
+ is_range = (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]),
1125
+ is_selected = this.is_selected(obj),
1126
+ proceed = true,
1127
+ t = this;
1128
+ if(check) {
1129
+ if(s.disable_selecting_children && is_multiple &&
1130
+ (
1131
+ (obj.parentsUntil(".jstree","li").children("a.jstree-clicked").length) ||
1132
+ (obj.children("ul").find("a.jstree-clicked:eq(0)").length)
1133
+ )
1134
+ ) {
1135
+ return false;
1136
+ }
1137
+ proceed = false;
1138
+ switch(!0) {
1139
+ case (is_range):
1140
+ this.data.ui.last_selected.addClass("jstree-last-selected");
1141
+ obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
1142
+ if(s.select_limit == -1 || obj.length < s.select_limit) {
1143
+ this.data.ui.last_selected.removeClass("jstree-last-selected");
1144
+ this.data.ui.selected.each(function () {
1145
+ if(this !== t.data.ui.last_selected[0]) { t.deselect_node(this); }
1146
+ });
1147
+ is_selected = false;
1148
+ proceed = true;
1149
+ }
1150
+ else {
1151
+ proceed = false;
1152
+ }
1153
+ break;
1154
+ case (is_selected && !is_multiple):
1155
+ this.deselect_all();
1156
+ is_selected = false;
1157
+ proceed = true;
1158
+ break;
1159
+ case (!is_selected && !is_multiple):
1160
+ if(s.select_limit == -1 || s.select_limit > 0) {
1161
+ this.deselect_all();
1162
+ proceed = true;
1163
+ }
1164
+ break;
1165
+ case (is_selected && is_multiple):
1166
+ this.deselect_node(obj);
1167
+ break;
1168
+ case (!is_selected && is_multiple):
1169
+ if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
1170
+ proceed = true;
1171
+ }
1172
+ break;
1173
+ }
1174
+ }
1175
+ if(proceed && !is_selected) {
1176
+ if(!is_range) { this.data.ui.last_selected = obj; }
1177
+ obj.children("a").addClass("jstree-clicked");
1178
+ if(s.selected_parent_open) {
1179
+ obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });
1180
+ }
1181
+ this.data.ui.selected = this.data.ui.selected.add(obj);
1182
+ this._fix_scroll(obj.eq(0));
1183
+ this.__callback({ "obj" : obj, "e" : e });
1184
+ }
1185
+ },
1186
+ _fix_scroll : function (obj) {
1187
+ var c = this.get_container()[0], t;
1188
+ if(c.scrollHeight > c.offsetHeight) {
1189
+ obj = this._get_node(obj);
1190
+ if(!obj || obj === -1 || !obj.length || !obj.is(":visible")) { return; }
1191
+ t = obj.offset().top - this.get_container().offset().top;
1192
+ if(t < 0) {
1193
+ c.scrollTop = c.scrollTop + t - 1;
1194
+ }
1195
+ if(t + this.data.core.li_height + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0) > c.offsetHeight) {
1196
+ c.scrollTop = c.scrollTop + (t - c.offsetHeight + this.data.core.li_height + 1 + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0));
1197
+ }
1198
+ }
1199
+ },
1200
+ deselect_node : function (obj) {
1201
+ obj = this._get_node(obj);
1202
+ if(!obj.length) { return false; }
1203
+ if(this.is_selected(obj)) {
1204
+ obj.children("a").removeClass("jstree-clicked");
1205
+ this.data.ui.selected = this.data.ui.selected.not(obj);
1206
+ if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
1207
+ this.__callback({ "obj" : obj });
1208
+ }
1209
+ },
1210
+ toggle_select : function (obj) {
1211
+ obj = this._get_node(obj);
1212
+ if(!obj.length) { return false; }
1213
+ if(this.is_selected(obj)) { this.deselect_node(obj); }
1214
+ else { this.select_node(obj); }
1215
+ },
1216
+ is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
1217
+ get_selected : function (context) {
1218
+ return context ? $(context).find("a.jstree-clicked").parent() : this.data.ui.selected;
1219
+ },
1220
+ deselect_all : function (context) {
1221
+ var ret = context ? $(context).find("a.jstree-clicked").parent() : this.get_container().find("a.jstree-clicked").parent();
1222
+ ret.children("a.jstree-clicked").removeClass("jstree-clicked");
1223
+ this.data.ui.selected = $([]);
1224
+ this.data.ui.last_selected = false;
1225
+ this.__callback({ "obj" : ret });
1226
+ }
1227
+ }
1228
+ });
1229
+ // include the selection plugin by default
1230
+ $.jstree.defaults.plugins.push("ui");
1231
+ })(jQuery);
1232
+ //*/
1233
+
1234
+ /*
1235
+ * jsTree CRRM plugin
1236
+ * Handles creating/renaming/removing/moving nodes by user interaction.
1237
+ */
1238
+ (function ($) {
1239
+ $.jstree.plugin("crrm", {
1240
+ __init : function () {
1241
+ this.get_container()
1242
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1243
+ if(this._get_settings().crrm.move.open_onmove) {
1244
+ var t = this;
1245
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1246
+ t.open_node(this, false, true);
1247
+ });
1248
+ }
1249
+ }, this));
1250
+ },
1251
+ defaults : {
1252
+ input_width_limit : 200,
1253
+ move : {
1254
+ always_copy : false, // false, true or "multitree"
1255
+ open_onmove : true,
1256
+ default_position : "last",
1257
+ check_move : function (m) { return true; }
1258
+ }
1259
+ },
1260
+ _fn : {
1261
+ _show_input : function (obj, callback) {
1262
+ obj = this._get_node(obj);
1263
+ var rtl = this._get_settings().core.rtl,
1264
+ w = this._get_settings().crrm.input_width_limit,
1265
+ w1 = obj.children("ins").width(),
1266
+ w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1267
+ t = this.get_text(obj),
1268
+ h1 = $("<div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1269
+ h2 = obj.css("position","relative").append(
1270
+ $("<input />", {
1271
+ "value" : t,
1272
+ "class" : "jstree-rename-input",
1273
+ // "size" : t.length,
1274
+ "css" : {
1275
+ "padding" : "0",
1276
+ "border" : "1px solid silver",
1277
+ "position" : "absolute",
1278
+ "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1279
+ "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1280
+ "top" : "0px",
1281
+ "height" : (this.data.core.li_height - 2) + "px",
1282
+ "lineHeight" : (this.data.core.li_height - 2) + "px",
1283
+ "width" : "150px" // will be set a bit further down
1284
+ },
1285
+ "blur" : $.proxy(function () {
1286
+ var i = obj.children(".jstree-rename-input"),
1287
+ v = i.val();
1288
+ if(v === "") { v = t; }
1289
+ h1.remove();
1290
+ i.remove(); // rollback purposes
1291
+ this.set_text(obj,t); // rollback purposes
1292
+ this.rename_node(obj, v);
1293
+ callback.call(this, obj, v, t);
1294
+ obj.css("position","");
1295
+ }, this),
1296
+ "keyup" : function (event) {
1297
+ var key = event.keyCode || event.which;
1298
+ if(key == 27) { this.value = t; this.blur(); return; }
1299
+ else if(key == 13) { this.blur(); return; }
1300
+ else {
1301
+ h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1302
+ }
1303
+ },
1304
+ "keypress" : function(event) {
1305
+ var key = event.keyCode || event.which;
1306
+ if(key == 13) { return false; }
1307
+ }
1308
+ })
1309
+ ).children(".jstree-rename-input");
1310
+ this.set_text(obj, "");
1311
+ h1.css({
1312
+ fontFamily : h2.css('fontFamily') || '',
1313
+ fontSize : h2.css('fontSize') || '',
1314
+ fontWeight : h2.css('fontWeight') || '',
1315
+ fontStyle : h2.css('fontStyle') || '',
1316
+ fontStretch : h2.css('fontStretch') || '',
1317
+ fontVariant : h2.css('fontVariant') || '',
1318
+ letterSpacing : h2.css('letterSpacing') || '',
1319
+ wordSpacing : h2.css('wordSpacing') || ''
1320
+ });
1321
+ h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1322
+ },
1323
+ rename : function (obj) {
1324
+ obj = this._get_node(obj);
1325
+ this.__rollback();
1326
+ var f = this.__callback;
1327
+ this._show_input(obj, function (obj, new_name, old_name) {
1328
+ f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1329
+ });
1330
+ },
1331
+ create : function (obj, position, js, callback, skip_rename) {
1332
+ var t, _this = this;
1333
+ obj = this._get_node(obj);
1334
+ if(!obj) { obj = -1; }
1335
+ this.__rollback();
1336
+ t = this.create_node(obj, position, js, function (t) {
1337
+ var p = this._get_parent(t),
1338
+ pos = $(t).index();
1339
+ if(callback) { callback.call(this, t); }
1340
+ if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1341
+ if(!skip_rename) {
1342
+ this._show_input(t, function (obj, new_name, old_name) {
1343
+ _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1344
+ });
1345
+ }
1346
+ else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1347
+ });
1348
+ return t;
1349
+ },
1350
+ remove : function (obj) {
1351
+ obj = this._get_node(obj, true);
1352
+ var p = this._get_parent(obj), prev = this._get_prev(obj);
1353
+ this.__rollback();
1354
+ obj = this.delete_node(obj);
1355
+ if(obj !== false) { this.__callback({ "obj" : obj, "prev" : prev, "parent" : p }); }
1356
+ },
1357
+ check_move : function () {
1358
+ if(!this.__call_old()) { return false; }
1359
+ var s = this._get_settings().crrm.move;
1360
+ if(!s.check_move.call(this, this._get_move())) { return false; }
1361
+ return true;
1362
+ },
1363
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1364
+ var s = this._get_settings().crrm.move;
1365
+ if(!is_prepared) {
1366
+ if(typeof position === "undefined") { position = s.default_position; }
1367
+ if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1368
+ return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1369
+ }
1370
+ // if the move is already prepared
1371
+ if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1372
+ is_copy = true;
1373
+ }
1374
+ this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1375
+ },
1376
+
1377
+ cut : function (obj) {
1378
+ obj = this._get_node(obj, true);
1379
+ if(!obj || !obj.length) { return false; }
1380
+ this.data.crrm.cp_nodes = false;
1381
+ this.data.crrm.ct_nodes = obj;
1382
+ this.__callback({ "obj" : obj });
1383
+ },
1384
+ copy : function (obj) {
1385
+ obj = this._get_node(obj, true);
1386
+ if(!obj || !obj.length) { return false; }
1387
+ this.data.crrm.ct_nodes = false;
1388
+ this.data.crrm.cp_nodes = obj;
1389
+ this.__callback({ "obj" : obj });
1390
+ },
1391
+ paste : function (obj) {
1392
+ obj = this._get_node(obj);
1393
+ if(!obj || !obj.length) { return false; }
1394
+ var nodes = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes;
1395
+ if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1396
+ if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); this.data.crrm.ct_nodes = false; }
1397
+ if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1398
+ this.__callback({ "obj" : obj, "nodes" : nodes });
1399
+ }
1400
+ }
1401
+ });
1402
+ // include the crr plugin by default
1403
+ // $.jstree.defaults.plugins.push("crrm");
1404
+ })(jQuery);
1405
+ //*/
1406
+
1407
+ /*
1408
+ * jsTree themes plugin
1409
+ * Handles loading and setting themes, as well as detecting path to themes, etc.
1410
+ */
1411
+ (function ($) {
1412
+ var themes_loaded = [];
1413
+ // this variable stores the path to the themes folder - if left as false - it will be autodetected
1414
+ $.jstree._themes = false;
1415
+ $.jstree.plugin("themes", {
1416
+ __init : function () {
1417
+ this.get_container()
1418
+ .bind("init.jstree", $.proxy(function () {
1419
+ var s = this._get_settings().themes;
1420
+ this.data.themes.dots = s.dots;
1421
+ this.data.themes.icons = s.icons;
1422
+ this.set_theme(s.theme, s.url);
1423
+ }, this))
1424
+ .bind("loaded.jstree", $.proxy(function () {
1425
+ // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1426
+ if(!this.data.themes.dots) { this.hide_dots(); }
1427
+ else { this.show_dots(); }
1428
+ if(!this.data.themes.icons) { this.hide_icons(); }
1429
+ else { this.show_icons(); }
1430
+ }, this));
1431
+ },
1432
+ defaults : {
1433
+ theme : "default",
1434
+ url : false,
1435
+ dots : true,
1436
+ icons : true
1437
+ },
1438
+ _fn : {
1439
+ set_theme : function (theme_name, theme_url) {
1440
+ if(!theme_name) { return false; }
1441
+ if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1442
+ if($.inArray(theme_url, themes_loaded) == -1) {
1443
+ $.vakata.css.add_sheet({ "url" : theme_url });
1444
+ themes_loaded.push(theme_url);
1445
+ }
1446
+ if(this.data.themes.theme != theme_name) {
1447
+ this.get_container().removeClass('jstree-' + this.data.themes.theme);
1448
+ this.data.themes.theme = theme_name;
1449
+ }
1450
+ this.get_container().addClass('jstree-' + theme_name);
1451
+ if(!this.data.themes.dots) { this.hide_dots(); }
1452
+ else { this.show_dots(); }
1453
+ if(!this.data.themes.icons) { this.hide_icons(); }
1454
+ else { this.show_icons(); }
1455
+ this.__callback();
1456
+ },
1457
+ get_theme : function () { return this.data.themes.theme; },
1458
+
1459
+ show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1460
+ hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1461
+ toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1462
+
1463
+ show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1464
+ hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1465
+ toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1466
+ }
1467
+ });
1468
+ // autodetect themes path
1469
+ $(function () {
1470
+ if($.jstree._themes === false) {
1471
+ $("script").each(function () {
1472
+ if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1473
+ $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1474
+ return false;
1475
+ }
1476
+ });
1477
+ }
1478
+ if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1479
+ });
1480
+ // include the themes plugin by default
1481
+ $.jstree.defaults.plugins.push("themes");
1482
+ })(jQuery);
1483
+ //*/
1484
+
1485
+ /*
1486
+ * jsTree hotkeys plugin
1487
+ * Enables keyboard navigation for all tree instances
1488
+ * Depends on the jstree ui & jquery hotkeys plugins
1489
+ */
1490
+ (function ($) {
1491
+ var bound = [];
1492
+ function exec(i, event) {
1493
+ var f = $.jstree._focused(), tmp;
1494
+ if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1495
+ tmp = f._get_settings().hotkeys[i];
1496
+ if(tmp) { return tmp.call(f, event); }
1497
+ }
1498
+ }
1499
+ $.jstree.plugin("hotkeys", {
1500
+ __init : function () {
1501
+ if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1502
+ if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1503
+ $.each(this._get_settings().hotkeys, function (i, v) {
1504
+ if(v !== false && $.inArray(i, bound) == -1) {
1505
+ $(document).bind("keydown", i, function (event) { return exec(i, event); });
1506
+ bound.push(i);
1507
+ }
1508
+ });
1509
+ this.get_container()
1510
+ .bind("lock.jstree", $.proxy(function () {
1511
+ if(this.data.hotkeys.enabled) { this.data.hotkeys.enabled = false; this.data.hotkeys.revert = true; }
1512
+ }, this))
1513
+ .bind("unlock.jstree", $.proxy(function () {
1514
+ if(this.data.hotkeys.revert) { this.data.hotkeys.enabled = true; }
1515
+ }, this));
1516
+ this.enable_hotkeys();
1517
+ },
1518
+ defaults : {
1519
+ "up" : function () {
1520
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1521
+ this.hover_node(this._get_prev(o));
1522
+ return false;
1523
+ },
1524
+ "ctrl+up" : function () {
1525
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1526
+ this.hover_node(this._get_prev(o));
1527
+ return false;
1528
+ },
1529
+ "shift+up" : function () {
1530
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1531
+ this.hover_node(this._get_prev(o));
1532
+ return false;
1533
+ },
1534
+ "down" : function () {
1535
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1536
+ this.hover_node(this._get_next(o));
1537
+ return false;
1538
+ },
1539
+ "ctrl+down" : function () {
1540
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1541
+ this.hover_node(this._get_next(o));
1542
+ return false;
1543
+ },
1544
+ "shift+down" : function () {
1545
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1546
+ this.hover_node(this._get_next(o));
1547
+ return false;
1548
+ },
1549
+ "left" : function () {
1550
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1551
+ if(o) {
1552
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1553
+ else { this.hover_node(this._get_prev(o)); }
1554
+ }
1555
+ return false;
1556
+ },
1557
+ "ctrl+left" : function () {
1558
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1559
+ if(o) {
1560
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1561
+ else { this.hover_node(this._get_prev(o)); }
1562
+ }
1563
+ return false;
1564
+ },
1565
+ "shift+left" : function () {
1566
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1567
+ if(o) {
1568
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1569
+ else { this.hover_node(this._get_prev(o)); }
1570
+ }
1571
+ return false;
1572
+ },
1573
+ "right" : function () {
1574
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1575
+ if(o && o.length) {
1576
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1577
+ else { this.hover_node(this._get_next(o)); }
1578
+ }
1579
+ return false;
1580
+ },
1581
+ "ctrl+right" : function () {
1582
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1583
+ if(o && o.length) {
1584
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1585
+ else { this.hover_node(this._get_next(o)); }
1586
+ }
1587
+ return false;
1588
+ },
1589
+ "shift+right" : function () {
1590
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1591
+ if(o && o.length) {
1592
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1593
+ else { this.hover_node(this._get_next(o)); }
1594
+ }
1595
+ return false;
1596
+ },
1597
+ "space" : function () {
1598
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1599
+ return false;
1600
+ },
1601
+ "ctrl+space" : function (event) {
1602
+ event.type = "click";
1603
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1604
+ return false;
1605
+ },
1606
+ "shift+space" : function (event) {
1607
+ event.type = "click";
1608
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1609
+ return false;
1610
+ },
1611
+ "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1612
+ "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1613
+ },
1614
+ _fn : {
1615
+ enable_hotkeys : function () {
1616
+ this.data.hotkeys.enabled = true;
1617
+ },
1618
+ disable_hotkeys : function () {
1619
+ this.data.hotkeys.enabled = false;
1620
+ }
1621
+ }
1622
+ });
1623
+ })(jQuery);
1624
+ //*/
1625
+
1626
+ /*
1627
+ * jsTree JSON plugin
1628
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1629
+ */
1630
+ (function ($) {
1631
+ $.jstree.plugin("json_data", {
1632
+ __init : function() {
1633
+ var s = this._get_settings().json_data;
1634
+ if(s.progressive_unload) {
1635
+ this.get_container().bind("after_close.jstree", function (e, data) {
1636
+ data.rslt.obj.children("ul").remove();
1637
+ });
1638
+ }
1639
+ },
1640
+ defaults : {
1641
+ // `data` can be a function:
1642
+ // * accepts two arguments - node being loaded and a callback to pass the result to
1643
+ // * will be executed in the current tree's scope & ajax won't be supported
1644
+ data : false,
1645
+ ajax : false,
1646
+ correct_state : true,
1647
+ progressive_render : false,
1648
+ progressive_unload : false
1649
+ },
1650
+ _fn : {
1651
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
1652
+ _is_loaded : function (obj) {
1653
+ var s = this._get_settings().json_data;
1654
+ obj = this._get_node(obj);
1655
+ return obj == -1 || !obj || (!s.ajax && !s.progressive_render && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").length > 0;
1656
+ },
1657
+ refresh : function (obj) {
1658
+ obj = this._get_node(obj);
1659
+ var s = this._get_settings().json_data;
1660
+ if(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {
1661
+ obj.removeData("jstree-children");
1662
+ }
1663
+ return this.__call_old();
1664
+ },
1665
+ load_node_json : function (obj, s_call, e_call) {
1666
+ var s = this.get_settings().json_data, d,
1667
+ error_func = function () {},
1668
+ success_func = function () {};
1669
+ obj = this._get_node(obj);
1670
+
1671
+ if(obj && obj !== -1 && (s.progressive_render || s.progressive_unload) && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1672
+ d = this._parse_json(obj.data("jstree-children"), obj);
1673
+ if(d) {
1674
+ obj.append(d);
1675
+ if(!s.progressive_unload) { obj.removeData("jstree-children"); }
1676
+ }
1677
+ this.clean_node(obj);
1678
+ if(s_call) { s_call.call(this); }
1679
+ return;
1680
+ }
1681
+
1682
+ if(obj && obj !== -1) {
1683
+ if(obj.data("jstree-is-loading")) { return; }
1684
+ else { obj.data("jstree-is-loading",true); }
1685
+ }
1686
+ switch(!0) {
1687
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1688
+ // function option added here for easier model integration (also supporting async - see callback)
1689
+ case ($.isFunction(s.data)):
1690
+ s.data.call(this, obj, $.proxy(function (d) {
1691
+ d = this._parse_json(d, obj);
1692
+ if(!d) {
1693
+ if(obj === -1 || !obj) {
1694
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1695
+ }
1696
+ else {
1697
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1698
+ obj.removeData("jstree-is-loading");
1699
+ if(s.correct_state) { this.correct_state(obj); }
1700
+ }
1701
+ if(e_call) { e_call.call(this); }
1702
+ }
1703
+ else {
1704
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1705
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1706
+ this.clean_node(obj);
1707
+ if(s_call) { s_call.call(this); }
1708
+ }
1709
+ }, this));
1710
+ break;
1711
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1712
+ if(!obj || obj == -1) {
1713
+ d = this._parse_json(s.data, obj);
1714
+ if(d) {
1715
+ this.get_container().children("ul").empty().append(d.children());
1716
+ this.clean_node();
1717
+ }
1718
+ else {
1719
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1720
+ }
1721
+ }
1722
+ if(s_call) { s_call.call(this); }
1723
+ break;
1724
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1725
+ error_func = function (x, t, e) {
1726
+ var ef = this.get_settings().json_data.ajax.error;
1727
+ if(ef) { ef.call(this, x, t, e); }
1728
+ if(obj != -1 && obj.length) {
1729
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1730
+ obj.removeData("jstree-is-loading");
1731
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
1732
+ }
1733
+ else {
1734
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1735
+ }
1736
+ if(e_call) { e_call.call(this); }
1737
+ };
1738
+ success_func = function (d, t, x) {
1739
+ var sf = this.get_settings().json_data.ajax.success;
1740
+ if(sf) { d = sf.call(this,d,t,x) || d; }
1741
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "") || (!$.isArray(d) && !$.isPlainObject(d))) {
1742
+ return error_func.call(this, x, t, "");
1743
+ }
1744
+ d = this._parse_json(d, obj);
1745
+ if(d) {
1746
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1747
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1748
+ this.clean_node(obj);
1749
+ if(s_call) { s_call.call(this); }
1750
+ }
1751
+ else {
1752
+ if(obj === -1 || !obj) {
1753
+ if(s.correct_state) {
1754
+ this.get_container().children("ul").empty();
1755
+ if(s_call) { s_call.call(this); }
1756
+ }
1757
+ }
1758
+ else {
1759
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1760
+ obj.removeData("jstree-is-loading");
1761
+ if(s.correct_state) {
1762
+ this.correct_state(obj);
1763
+ if(s_call) { s_call.call(this); }
1764
+ }
1765
+ }
1766
+ }
1767
+ };
1768
+ s.ajax.context = this;
1769
+ s.ajax.error = error_func;
1770
+ s.ajax.success = success_func;
1771
+ if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1772
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1773
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1774
+ $.ajax(s.ajax);
1775
+ break;
1776
+ }
1777
+ },
1778
+ _parse_json : function (js, obj, is_callback) {
1779
+ var d = false,
1780
+ p = this._get_settings(),
1781
+ s = p.json_data,
1782
+ t = p.core.html_titles,
1783
+ tmp, i, j, ul1, ul2;
1784
+
1785
+ if(!js) { return d; }
1786
+ if(s.progressive_unload && obj && obj !== -1) {
1787
+ obj.data("jstree-children", d);
1788
+ }
1789
+ if($.isArray(js)) {
1790
+ d = $();
1791
+ if(!js.length) { return false; }
1792
+ for(i = 0, j = js.length; i < j; i++) {
1793
+ tmp = this._parse_json(js[i], obj, true);
1794
+ if(tmp.length) { d = d.add(tmp); }
1795
+ }
1796
+ }
1797
+ else {
1798
+ if(typeof js == "string") { js = { data : js }; }
1799
+ if(!js.data && js.data !== "") { return d; }
1800
+ d = $("<li />");
1801
+ if(js.attr) { d.attr(js.attr); }
1802
+ if(js.metadata) { d.data(js.metadata); }
1803
+ if(js.state) { d.addClass("jstree-" + js.state); }
1804
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1805
+ $.each(js.data, function (i, m) {
1806
+ tmp = $("<a />");
1807
+ if($.isFunction(m)) { m = m.call(this, js); }
1808
+ if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1809
+ else {
1810
+ if(!m.attr) { m.attr = {}; }
1811
+ if(!m.attr.href) { m.attr.href = '#'; }
1812
+ tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1813
+ if(m.language) { tmp.addClass(m.language); }
1814
+ }
1815
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1816
+ if(!m.icon && js.icon) { m.icon = js.icon; }
1817
+ if(m.icon) {
1818
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1819
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1820
+ }
1821
+ d.append(tmp);
1822
+ });
1823
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1824
+ if(js.children) {
1825
+ if(s.progressive_render && js.state !== "open") {
1826
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1827
+ }
1828
+ else {
1829
+ if(s.progressive_unload) { d.data("jstree-children", js.children); }
1830
+ if($.isArray(js.children) && js.children.length) {
1831
+ tmp = this._parse_json(js.children, obj, true);
1832
+ if(tmp.length) {
1833
+ ul2 = $("<ul />");
1834
+ ul2.append(tmp);
1835
+ d.append(ul2);
1836
+ }
1837
+ }
1838
+ }
1839
+ }
1840
+ }
1841
+ if(!is_callback) {
1842
+ ul1 = $("<ul />");
1843
+ ul1.append(d);
1844
+ d = ul1;
1845
+ }
1846
+ return d;
1847
+ },
1848
+ get_json : function (obj, li_attr, a_attr, is_callback) {
1849
+ var result = [],
1850
+ s = this._get_settings(),
1851
+ _this = this,
1852
+ tmp1, tmp2, li, a, t, lang;
1853
+ obj = this._get_node(obj);
1854
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1855
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1856
+ if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1857
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
1858
+
1859
+ obj.each(function () {
1860
+ li = $(this);
1861
+ tmp1 = { data : [] };
1862
+ if(li_attr.length) { tmp1.attr = { }; }
1863
+ $.each(li_attr, function (i, v) {
1864
+ tmp2 = li.attr(v);
1865
+ if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*/ig,'').length) {
1866
+ tmp1.attr[v] = (" " + tmp2).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1867
+ }
1868
+ });
1869
+ if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1870
+ if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1871
+ if(li.data()) { tmp1.metadata = li.data(); }
1872
+ a = li.children("a");
1873
+ a.each(function () {
1874
+ t = $(this);
1875
+ if(
1876
+ a_attr.length ||
1877
+ $.inArray("languages", s.plugins) !== -1 ||
1878
+ t.children("ins").get(0).style.backgroundImage.length ||
1879
+ (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1880
+ ) {
1881
+ lang = false;
1882
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1883
+ $.each(s.languages, function (l, lv) {
1884
+ if(t.hasClass(lv)) {
1885
+ lang = lv;
1886
+ return false;
1887
+ }
1888
+ });
1889
+ }
1890
+ tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1891
+ $.each(a_attr, function (k, z) {
1892
+ tmp2.attr[z] = (" " + (t.attr(z) || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1893
+ });
1894
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1895
+ $.each(s.languages, function (k, z) {
1896
+ if(t.hasClass(z)) { tmp2.language = z; return true; }
1897
+ });
1898
+ }
1899
+ if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1900
+ tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1901
+ }
1902
+ if(t.children("ins").get(0).style.backgroundImage.length) {
1903
+ tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1904
+ }
1905
+ }
1906
+ else {
1907
+ tmp2 = _this.get_text(t);
1908
+ }
1909
+ if(a.length > 1) { tmp1.data.push(tmp2); }
1910
+ else { tmp1.data = tmp2; }
1911
+ });
1912
+ li = li.find("> ul > li");
1913
+ if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1914
+ result.push(tmp1);
1915
+ });
1916
+ return result;
1917
+ }
1918
+ }
1919
+ });
1920
+ })(jQuery);
1921
+ //*/
1922
+
1923
+ /*
1924
+ * jsTree languages plugin
1925
+ * Adds support for multiple language versions in one tree
1926
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1927
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1928
+ */
1929
+ (function ($) {
1930
+ $.jstree.plugin("languages", {
1931
+ __init : function () { this._load_css(); },
1932
+ defaults : [],
1933
+ _fn : {
1934
+ set_lang : function (i) {
1935
+ var langs = this._get_settings().languages,
1936
+ st = false,
1937
+ selector = ".jstree-" + this.get_index() + ' a';
1938
+ if(!$.isArray(langs) || langs.length === 0) { return false; }
1939
+ if($.inArray(i,langs) == -1) {
1940
+ if(!!langs[i]) { i = langs[i]; }
1941
+ else { return false; }
1942
+ }
1943
+ if(i == this.data.languages.current_language) { return true; }
1944
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1945
+ if(st !== false) { st.style.display = "none"; }
1946
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1947
+ if(st !== false) { st.style.display = ""; }
1948
+ this.data.languages.current_language = i;
1949
+ this.__callback(i);
1950
+ return true;
1951
+ },
1952
+ get_lang : function () {
1953
+ return this.data.languages.current_language;
1954
+ },
1955
+ _get_string : function (key, lang) {
1956
+ var langs = this._get_settings().languages,
1957
+ s = this._get_settings().core.strings;
1958
+ if($.isArray(langs) && langs.length) {
1959
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1960
+ }
1961
+ if(s[lang] && s[lang][key]) { return s[lang][key]; }
1962
+ if(s[key]) { return s[key]; }
1963
+ return key;
1964
+ },
1965
+ get_text : function (obj, lang) {
1966
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1967
+ if(!obj.size()) { return false; }
1968
+ var langs = this._get_settings().languages,
1969
+ s = this._get_settings().core.html_titles;
1970
+ if($.isArray(langs) && langs.length) {
1971
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1972
+ obj = obj.children("a." + lang);
1973
+ }
1974
+ else { obj = obj.children("a:eq(0)"); }
1975
+ if(s) {
1976
+ obj = obj.clone();
1977
+ obj.children("INS").remove();
1978
+ return obj.html();
1979
+ }
1980
+ else {
1981
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1982
+ return obj.nodeValue;
1983
+ }
1984
+ },
1985
+ set_text : function (obj, val, lang) {
1986
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1987
+ if(!obj.size()) { return false; }
1988
+ var langs = this._get_settings().languages,
1989
+ s = this._get_settings().core.html_titles,
1990
+ tmp;
1991
+ if($.isArray(langs) && langs.length) {
1992
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1993
+ obj = obj.children("a." + lang);
1994
+ }
1995
+ else { obj = obj.children("a:eq(0)"); }
1996
+ if(s) {
1997
+ tmp = obj.children("INS").clone();
1998
+ obj.html(val).prepend(tmp);
1999
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
2000
+ return true;
2001
+ }
2002
+ else {
2003
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
2004
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
2005
+ return (obj.nodeValue = val);
2006
+ }
2007
+ },
2008
+ _load_css : function () {
2009
+ var langs = this._get_settings().languages,
2010
+ str = "/* languages css */",
2011
+ selector = ".jstree-" + this.get_index() + ' a',
2012
+ ln;
2013
+ if($.isArray(langs) && langs.length) {
2014
+ this.data.languages.current_language = langs[0];
2015
+ for(ln = 0; ln < langs.length; ln++) {
2016
+ str += selector + "." + langs[ln] + " {";
2017
+ if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
2018
+ str += " } ";
2019
+ }
2020
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });
2021
+ }
2022
+ },
2023
+ create_node : function (obj, position, js, callback) {
2024
+ var t = this.__call_old(true, obj, position, js, function (t) {
2025
+ var langs = this._get_settings().languages,
2026
+ a = t.children("a"),
2027
+ ln;
2028
+ if($.isArray(langs) && langs.length) {
2029
+ for(ln = 0; ln < langs.length; ln++) {
2030
+ if(!a.is("." + langs[ln])) {
2031
+ t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
2032
+ }
2033
+ }
2034
+ a.not("." + langs.join(", .")).remove();
2035
+ }
2036
+ if(callback) { callback.call(this, t); }
2037
+ });
2038
+ return t;
2039
+ }
2040
+ }
2041
+ });
2042
+ })(jQuery);
2043
+ //*/
2044
+
2045
+ /*
2046
+ * jsTree cookies plugin
2047
+ * Stores the currently opened/selected nodes in a cookie and then restores them
2048
+ * Depends on the jquery.cookie plugin
2049
+ */
2050
+ (function ($) {
2051
+ $.jstree.plugin("cookies", {
2052
+ __init : function () {
2053
+ if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
2054
+
2055
+ var s = this._get_settings().cookies,
2056
+ tmp;
2057
+ if(!!s.save_loaded) {
2058
+ tmp = $.cookie(s.save_loaded);
2059
+ if(tmp && tmp.length) { this.data.core.to_load = tmp.split(","); }
2060
+ }
2061
+ if(!!s.save_opened) {
2062
+ tmp = $.cookie(s.save_opened);
2063
+ if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
2064
+ }
2065
+ if(!!s.save_selected) {
2066
+ tmp = $.cookie(s.save_selected);
2067
+ if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
2068
+ }
2069
+ this.get_container()
2070
+ .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
2071
+ this.get_container()
2072
+ .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
2073
+ if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
2074
+ }, this));
2075
+ }, this));
2076
+ },
2077
+ defaults : {
2078
+ save_loaded : "jstree_load",
2079
+ save_opened : "jstree_open",
2080
+ save_selected : "jstree_select",
2081
+ auto_save : true,
2082
+ cookie_options : {}
2083
+ },
2084
+ _fn : {
2085
+ save_cookie : function (c) {
2086
+ if(this.data.core.refreshing) { return; }
2087
+ var s = this._get_settings().cookies;
2088
+ if(!c) { // if called manually and not by event
2089
+ if(s.save_loaded) {
2090
+ this.save_loaded();
2091
+ $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);
2092
+ }
2093
+ if(s.save_opened) {
2094
+ this.save_opened();
2095
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
2096
+ }
2097
+ if(s.save_selected && this.data.ui) {
2098
+ this.save_selected();
2099
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
2100
+ }
2101
+ return;
2102
+ }
2103
+ switch(c) {
2104
+ case "open_node":
2105
+ case "close_node":
2106
+ if(!!s.save_opened) {
2107
+ this.save_opened();
2108
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
2109
+ }
2110
+ if(!!s.save_loaded) {
2111
+ this.save_loaded();
2112
+ $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);
2113
+ }
2114
+ break;
2115
+ case "select_node":
2116
+ case "deselect_node":
2117
+ if(!!s.save_selected && this.data.ui) {
2118
+ this.save_selected();
2119
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
2120
+ }
2121
+ break;
2122
+ }
2123
+ }
2124
+ }
2125
+ });
2126
+ // include cookies by default
2127
+ // $.jstree.defaults.plugins.push("cookies");
2128
+ })(jQuery);
2129
+ //*/
2130
+
2131
+ /*
2132
+ * jsTree sort plugin
2133
+ * Sorts items alphabetically (or using any other function)
2134
+ */
2135
+ (function ($) {
2136
+ $.jstree.plugin("sort", {
2137
+ __init : function () {
2138
+ this.get_container()
2139
+ .bind("load_node.jstree", $.proxy(function (e, data) {
2140
+ var obj = this._get_node(data.rslt.obj);
2141
+ obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
2142
+ this.sort(obj);
2143
+ }, this))
2144
+ .bind("rename_node.jstree create_node.jstree create.jstree", $.proxy(function (e, data) {
2145
+ this.sort(data.rslt.obj.parent());
2146
+ }, this))
2147
+ .bind("move_node.jstree", $.proxy(function (e, data) {
2148
+ var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
2149
+ this.sort(m.children("ul"));
2150
+ }, this));
2151
+ },
2152
+ defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
2153
+ _fn : {
2154
+ sort : function (obj) {
2155
+ var s = this._get_settings().sort,
2156
+ t = this;
2157
+ obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
2158
+ obj.find("> li > ul").each(function() { t.sort($(this)); });
2159
+ this.clean_node(obj);
2160
+ }
2161
+ }
2162
+ });
2163
+ })(jQuery);
2164
+ //*/
2165
+
2166
+ /*
2167
+ * jsTree DND plugin
2168
+ * Drag and drop plugin for moving/copying nodes
2169
+ */
2170
+ (function ($) {
2171
+ var o = false,
2172
+ r = false,
2173
+ m = false,
2174
+ ml = false,
2175
+ sli = false,
2176
+ sti = false,
2177
+ dir1 = false,
2178
+ dir2 = false,
2179
+ last_pos = false;
2180
+ $.vakata.dnd = {
2181
+ is_down : false,
2182
+ is_drag : false,
2183
+ helper : false,
2184
+ scroll_spd : 10,
2185
+ init_x : 0,
2186
+ init_y : 0,
2187
+ threshold : 5,
2188
+ helper_left : 5,
2189
+ helper_top : 10,
2190
+ user_data : {},
2191
+
2192
+ drag_start : function (e, data, html) {
2193
+ if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
2194
+ try {
2195
+ e.currentTarget.unselectable = "on";
2196
+ e.currentTarget.onselectstart = function() { return false; };
2197
+ if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
2198
+ } catch(err) { }
2199
+ $.vakata.dnd.init_x = e.pageX;
2200
+ $.vakata.dnd.init_y = e.pageY;
2201
+ $.vakata.dnd.user_data = data;
2202
+ $.vakata.dnd.is_down = true;
2203
+ $.vakata.dnd.helper = $("<div id='vakata-dragged' />").html(html); //.fadeTo(10,0.25);
2204
+ $(document).bind("mousemove", $.vakata.dnd.drag);
2205
+ $(document).bind("mouseup", $.vakata.dnd.drag_stop);
2206
+ return false;
2207
+ },
2208
+ drag : function (e) {
2209
+ if(!$.vakata.dnd.is_down) { return; }
2210
+ if(!$.vakata.dnd.is_drag) {
2211
+ if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
2212
+ $.vakata.dnd.helper.appendTo("body");
2213
+ $.vakata.dnd.is_drag = true;
2214
+ $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2215
+ }
2216
+ else { return; }
2217
+ }
2218
+
2219
+ // maybe use a scrolling parent element instead of document?
2220
+ if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
2221
+ var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
2222
+ if(e.pageY - t < 20) {
2223
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
2224
+ if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
2225
+ }
2226
+ else {
2227
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
2228
+ }
2229
+ if($(window).height() - (e.pageY - t) < 20) {
2230
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
2231
+ if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
2232
+ }
2233
+ else {
2234
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
2235
+ }
2236
+
2237
+ if(e.pageX - l < 20) {
2238
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
2239
+ if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
2240
+ }
2241
+ else {
2242
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
2243
+ }
2244
+ if($(window).width() - (e.pageX - l) < 20) {
2245
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
2246
+ if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
2247
+ }
2248
+ else {
2249
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
2250
+ }
2251
+ }
2252
+
2253
+ $.vakata.dnd.helper.css({ left : (e.pageX + $.vakata.dnd.helper_left) + "px", top : (e.pageY + $.vakata.dnd.helper_top) + "px" });
2254
+ $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2255
+ },
2256
+ drag_stop : function (e) {
2257
+ if(sli) { clearInterval(sli); }
2258
+ if(sti) { clearInterval(sti); }
2259
+ $(document).unbind("mousemove", $.vakata.dnd.drag);
2260
+ $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
2261
+ $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2262
+ $.vakata.dnd.helper.remove();
2263
+ $.vakata.dnd.init_x = 0;
2264
+ $.vakata.dnd.init_y = 0;
2265
+ $.vakata.dnd.user_data = {};
2266
+ $.vakata.dnd.is_down = false;
2267
+ $.vakata.dnd.is_drag = false;
2268
+ }
2269
+ };
2270
+ $(function() {
2271
+ var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';
2272
+ $.vakata.css.add_sheet({ str : css_string, title : "vakata" });
2273
+ });
2274
+
2275
+ $.jstree.plugin("dnd", {
2276
+ __init : function () {
2277
+ this.data.dnd = {
2278
+ active : false,
2279
+ after : false,
2280
+ inside : false,
2281
+ before : false,
2282
+ off : false,
2283
+ prepared : false,
2284
+ w : 0,
2285
+ to1 : false,
2286
+ to2 : false,
2287
+ cof : false,
2288
+ cw : false,
2289
+ ch : false,
2290
+ i1 : false,
2291
+ i2 : false,
2292
+ mto : false
2293
+ };
2294
+ this.get_container()
2295
+ .bind("mouseenter.jstree", $.proxy(function (e) {
2296
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2297
+ if(this.data.themes) {
2298
+ m.attr("class", "jstree-" + this.data.themes.theme);
2299
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2300
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2301
+ }
2302
+ //if($(e.currentTarget).find("> ul > li").length === 0) {
2303
+ if(e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree
2304
+ var tr = $.jstree._reference(e.target), dc;
2305
+ if(tr.data.dnd.foreign) {
2306
+ dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2307
+ if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {
2308
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2309
+ }
2310
+ }
2311
+ else {
2312
+ tr.prepare_move(o, tr.get_container(), "last");
2313
+ if(tr.check_move()) {
2314
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2315
+ }
2316
+ }
2317
+ }
2318
+ }
2319
+ }, this))
2320
+ .bind("mouseup.jstree", $.proxy(function (e) {
2321
+ //if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && $(e.currentTarget).find("> ul > li").length === 0) {
2322
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree
2323
+ var tr = $.jstree._reference(e.currentTarget), dc;
2324
+ if(tr.data.dnd.foreign) {
2325
+ dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2326
+ if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {
2327
+ tr._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2328
+ }
2329
+ }
2330
+ else {
2331
+ tr.move_node(o, tr.get_container(), "last", e[tr._get_settings().dnd.copy_modifier + "Key"]);
2332
+ }
2333
+ }
2334
+ }, this))
2335
+ .bind("mouseleave.jstree", $.proxy(function (e) {
2336
+ if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {
2337
+ return false;
2338
+ }
2339
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2340
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2341
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2342
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2343
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2344
+ if($.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2345
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2346
+ }
2347
+ }
2348
+ }, this))
2349
+ .bind("mousemove.jstree", $.proxy(function (e) {
2350
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2351
+ var cnt = this.get_container()[0];
2352
+
2353
+ // Horizontal scroll
2354
+ if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
2355
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2356
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
2357
+ }
2358
+ else if(e.pageX - 24 < this.data.dnd.cof.left) {
2359
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2360
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
2361
+ }
2362
+ else {
2363
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2364
+ }
2365
+
2366
+ // Vertical scroll
2367
+ if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
2368
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2369
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
2370
+ }
2371
+ else if(e.pageY - 24 < this.data.dnd.cof.top) {
2372
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2373
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
2374
+ }
2375
+ else {
2376
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2377
+ }
2378
+
2379
+ }
2380
+ }, this))
2381
+ .bind("scroll.jstree", $.proxy(function (e) {
2382
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && m && ml) {
2383
+ m.hide();
2384
+ ml.hide();
2385
+ }
2386
+ }, this))
2387
+ .delegate("a", "mousedown.jstree", $.proxy(function (e) {
2388
+ if(e.which === 1) {
2389
+ this.start_drag(e.currentTarget, e);
2390
+ return false;
2391
+ }
2392
+ }, this))
2393
+ .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
2394
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2395
+ this.dnd_enter(e.currentTarget);
2396
+ }
2397
+ }, this))
2398
+ .delegate("a", "mousemove.jstree", $.proxy(function (e) {
2399
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2400
+ if(!r || !r.length || r.children("a")[0] !== e.currentTarget) {
2401
+ this.dnd_enter(e.currentTarget);
2402
+ }
2403
+ if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
2404
+ this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
2405
+ if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
2406
+ this.dnd_show();
2407
+ }
2408
+ }, this))
2409
+ .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
2410
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2411
+ if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {
2412
+ return false;
2413
+ }
2414
+ if(m) { m.hide(); }
2415
+ if(ml) { ml.hide(); }
2416
+ /*
2417
+ var ec = $(e.currentTarget).closest("li"),
2418
+ er = $(e.relatedTarget).closest("li");
2419
+ if(er[0] !== ec.prev()[0] && er[0] !== ec.next()[0]) {
2420
+ if(m) { m.hide(); }
2421
+ if(ml) { ml.hide(); }
2422
+ }
2423
+ */
2424
+ this.data.dnd.mto = setTimeout(
2425
+ (function (t) { return function () { t.dnd_leave(e); }; })(this),
2426
+ 0);
2427
+ }
2428
+ }, this))
2429
+ .delegate("a", "mouseup.jstree", $.proxy(function (e) {
2430
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2431
+ this.dnd_finish(e);
2432
+ }
2433
+ }, this));
2434
+
2435
+ $(document)
2436
+ .bind("drag_stop.vakata", $.proxy(function () {
2437
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2438
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2439
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2440
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2441
+ this.data.dnd.after = false;
2442
+ this.data.dnd.before = false;
2443
+ this.data.dnd.inside = false;
2444
+ this.data.dnd.off = false;
2445
+ this.data.dnd.prepared = false;
2446
+ this.data.dnd.w = false;
2447
+ this.data.dnd.to1 = false;
2448
+ this.data.dnd.to2 = false;
2449
+ this.data.dnd.i1 = false;
2450
+ this.data.dnd.i2 = false;
2451
+ this.data.dnd.active = false;
2452
+ this.data.dnd.foreign = false;
2453
+ if(m) { m.css({ "top" : "-2000px" }); }
2454
+ if(ml) { ml.css({ "top" : "-2000px" }); }
2455
+ }, this))
2456
+ .bind("drag_start.vakata", $.proxy(function (e, data) {
2457
+ if(data.data.jstree) {
2458
+ var et = $(data.event.target);
2459
+ if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2460
+ this.dnd_enter(et);
2461
+ }
2462
+ }
2463
+ }, this));
2464
+ /*
2465
+ .bind("keydown.jstree-" + this.get_index() + " keyup.jstree-" + this.get_index(), $.proxy(function(e) {
2466
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && !this.data.dnd.foreign) {
2467
+ var h = $.vakata.dnd.helper.children("ins");
2468
+ if(e[this._get_settings().dnd.copy_modifier + "Key"] && h.hasClass("jstree-ok")) {
2469
+ h.parent().html(h.parent().html().replace(/ \(Copy\)$/, "") + " (Copy)");
2470
+ }
2471
+ else {
2472
+ h.parent().html(h.parent().html().replace(/ \(Copy\)$/, ""));
2473
+ }
2474
+ }
2475
+ }, this)); */
2476
+
2477
+
2478
+
2479
+ var s = this._get_settings().dnd;
2480
+ if(s.drag_target) {
2481
+ $(document)
2482
+ .delegate(s.drag_target, "mousedown.jstree-" + this.get_index(), $.proxy(function (e) {
2483
+ o = e.target;
2484
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2485
+ if(this.data.themes) {
2486
+ if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }
2487
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2488
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2489
+ }
2490
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2491
+ var cnt = this.get_container();
2492
+ this.data.dnd.cof = cnt.offset();
2493
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2494
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2495
+ this.data.dnd.foreign = true;
2496
+ e.preventDefault();
2497
+ }, this));
2498
+ }
2499
+ if(s.drop_target) {
2500
+ $(document)
2501
+ .delegate(s.drop_target, "mouseenter.jstree-" + this.get_index(), $.proxy(function (e) {
2502
+ if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target), "e" : e })) {
2503
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2504
+ }
2505
+ }, this))
2506
+ .delegate(s.drop_target, "mouseleave.jstree-" + this.get_index(), $.proxy(function (e) {
2507
+ if(this.data.dnd.active) {
2508
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2509
+ }
2510
+ }, this))
2511
+ .delegate(s.drop_target, "mouseup.jstree-" + this.get_index(), $.proxy(function (e) {
2512
+ if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2513
+ this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target), "e" : e });
2514
+ }
2515
+ }, this));
2516
+ }
2517
+ },
2518
+ defaults : {
2519
+ copy_modifier : "ctrl",
2520
+ check_timeout : 100,
2521
+ open_timeout : 500,
2522
+ drop_target : ".jstree-drop",
2523
+ drop_check : function (data) { return true; },
2524
+ drop_finish : $.noop,
2525
+ drag_target : ".jstree-draggable",
2526
+ drag_finish : $.noop,
2527
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
2528
+ },
2529
+ _fn : {
2530
+ dnd_prepare : function () {
2531
+ if(!r || !r.length) { return; }
2532
+ this.data.dnd.off = r.offset();
2533
+ if(this._get_settings().core.rtl) {
2534
+ this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2535
+ }
2536
+ if(this.data.dnd.foreign) {
2537
+ var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2538
+ this.data.dnd.after = a.after;
2539
+ this.data.dnd.before = a.before;
2540
+ this.data.dnd.inside = a.inside;
2541
+ this.data.dnd.prepared = true;
2542
+ return this.dnd_show();
2543
+ }
2544
+ this.prepare_move(o, r, "before");
2545
+ this.data.dnd.before = this.check_move();
2546
+ this.prepare_move(o, r, "after");
2547
+ this.data.dnd.after = this.check_move();
2548
+ if(this._is_loaded(r)) {
2549
+ this.prepare_move(o, r, "inside");
2550
+ this.data.dnd.inside = this.check_move();
2551
+ }
2552
+ else {
2553
+ this.data.dnd.inside = false;
2554
+ }
2555
+ this.data.dnd.prepared = true;
2556
+ return this.dnd_show();
2557
+ },
2558
+ dnd_show : function () {
2559
+ if(!this.data.dnd.prepared) { return; }
2560
+ var o = ["before","inside","after"],
2561
+ r = false,
2562
+ rtl = this._get_settings().core.rtl,
2563
+ pos;
2564
+ if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2565
+ else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2566
+ o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2567
+ }
2568
+ else { o = ["after","inside","before"]; }
2569
+ $.each(o, $.proxy(function (i, val) {
2570
+ if(this.data.dnd[val]) {
2571
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2572
+ r = val;
2573
+ return false;
2574
+ }
2575
+ }, this));
2576
+ if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2577
+
2578
+ pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2579
+ switch(r) {
2580
+ case "before":
2581
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2582
+ if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top - 1) + "px" }).show(); }
2583
+ break;
2584
+ case "after":
2585
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 6) + "px" }).show();
2586
+ if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 1) + "px" }).show(); }
2587
+ break;
2588
+ case "inside":
2589
+ m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2590
+ if(ml) { ml.hide(); }
2591
+ break;
2592
+ default:
2593
+ m.hide();
2594
+ if(ml) { ml.hide(); }
2595
+ break;
2596
+ }
2597
+ last_pos = r;
2598
+ return r;
2599
+ },
2600
+ dnd_open : function () {
2601
+ this.data.dnd.to2 = false;
2602
+ this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2603
+ },
2604
+ dnd_finish : function (e) {
2605
+ if(this.data.dnd.foreign) {
2606
+ if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2607
+ this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r, "p" : last_pos });
2608
+ }
2609
+ }
2610
+ else {
2611
+ this.dnd_prepare();
2612
+ this.move_node(o, r, last_pos, e[this._get_settings().dnd.copy_modifier + "Key"]);
2613
+ }
2614
+ o = false;
2615
+ r = false;
2616
+ m.hide();
2617
+ if(ml) { ml.hide(); }
2618
+ },
2619
+ dnd_enter : function (obj) {
2620
+ if(this.data.dnd.mto) {
2621
+ clearTimeout(this.data.dnd.mto);
2622
+ this.data.dnd.mto = false;
2623
+ }
2624
+ var s = this._get_settings().dnd;
2625
+ this.data.dnd.prepared = false;
2626
+ r = this._get_node(obj);
2627
+ if(s.check_timeout) {
2628
+ // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2629
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2630
+ this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2631
+ }
2632
+ else {
2633
+ this.dnd_prepare();
2634
+ }
2635
+ if(s.open_timeout) {
2636
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2637
+ if(r && r.length && r.hasClass("jstree-closed")) {
2638
+ // if the node is closed - open it, then recalculate
2639
+ this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2640
+ }
2641
+ }
2642
+ else {
2643
+ if(r && r.length && r.hasClass("jstree-closed")) {
2644
+ this.dnd_open();
2645
+ }
2646
+ }
2647
+ },
2648
+ dnd_leave : function (e) {
2649
+ this.data.dnd.after = false;
2650
+ this.data.dnd.before = false;
2651
+ this.data.dnd.inside = false;
2652
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2653
+ m.hide();
2654
+ if(ml) { ml.hide(); }
2655
+ if(r && r[0] === e.target.parentNode) {
2656
+ if(this.data.dnd.to1) {
2657
+ clearTimeout(this.data.dnd.to1);
2658
+ this.data.dnd.to1 = false;
2659
+ }
2660
+ if(this.data.dnd.to2) {
2661
+ clearTimeout(this.data.dnd.to2);
2662
+ this.data.dnd.to2 = false;
2663
+ }
2664
+ }
2665
+ },
2666
+ start_drag : function (obj, e) {
2667
+ o = this._get_node(obj);
2668
+ if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2669
+ var dt = o.length > 1 ? this._get_string("multiple_selection") : this.get_text(o),
2670
+ cnt = this.get_container();
2671
+ if(!this._get_settings().core.html_titles) { dt = dt.replace(/</ig,"&lt;").replace(/>/ig,"&gt;"); }
2672
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + dt );
2673
+ if(this.data.themes) {
2674
+ if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }
2675
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2676
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2677
+ }
2678
+ this.data.dnd.cof = cnt.offset();
2679
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2680
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2681
+ this.data.dnd.active = true;
2682
+ }
2683
+ }
2684
+ });
2685
+ $(function() {
2686
+ var css_string = '' +
2687
+ '#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; ' +
2688
+ ' -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; ' +
2689
+ '} ' +
2690
+ '#vakata-dragged .jstree-ok { background:green; } ' +
2691
+ '#vakata-dragged .jstree-invalid { background:red; } ' +
2692
+ '#jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } ' +
2693
+ '#jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43; ' +
2694
+ ' cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666; ' +
2695
+ ' -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; ' +
2696
+ '}' +
2697
+ '';
2698
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
2699
+ m = $("<div />").attr({ id : "jstree-marker" }).hide().html("&raquo;")
2700
+ .bind("mouseleave mouseenter", function (e) {
2701
+ m.hide();
2702
+ ml.hide();
2703
+ e.preventDefault();
2704
+ e.stopImmediatePropagation();
2705
+ return false;
2706
+ })
2707
+ .appendTo("body");
2708
+ ml = $("<div />").attr({ id : "jstree-marker-line" }).hide()
2709
+ .bind("mouseup", function (e) {
2710
+ if(r && r.length) {
2711
+ r.children("a").trigger(e);
2712
+ e.preventDefault();
2713
+ e.stopImmediatePropagation();
2714
+ return false;
2715
+ }
2716
+ })
2717
+ .bind("mouseleave", function (e) {
2718
+ var rt = $(e.relatedTarget);
2719
+ if(rt.is(".jstree") || rt.closest(".jstree").length === 0) {
2720
+ if(r && r.length) {
2721
+ r.children("a").trigger(e);
2722
+ m.hide();
2723
+ ml.hide();
2724
+ e.preventDefault();
2725
+ e.stopImmediatePropagation();
2726
+ return false;
2727
+ }
2728
+ }
2729
+ })
2730
+ .appendTo("body");
2731
+ $(document).bind("drag_start.vakata", function (e, data) {
2732
+ if(data.data.jstree) { m.show(); if(ml) { ml.show(); } }
2733
+ });
2734
+ $(document).bind("drag_stop.vakata", function (e, data) {
2735
+ if(data.data.jstree) { m.hide(); if(ml) { ml.hide(); } }
2736
+ });
2737
+ });
2738
+ })(jQuery);
2739
+ //*/
2740
+
2741
+ /*
2742
+ * jsTree checkbox plugin
2743
+ * Inserts checkboxes in front of every node
2744
+ * Depends on the ui plugin
2745
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2746
+ */
2747
+ (function ($) {
2748
+ $.jstree.plugin("checkbox", {
2749
+ __init : function () {
2750
+ this.data.checkbox.noui = this._get_settings().checkbox.override_ui;
2751
+ if(this.data.ui && this.data.checkbox.noui) {
2752
+ this.select_node = this.deselect_node = this.deselect_all = $.noop;
2753
+ this.get_selected = this.get_checked;
2754
+ }
2755
+
2756
+ this.get_container()
2757
+ .bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree", $.proxy(function (e, data) {
2758
+ this._prepare_checkboxes(data.rslt.obj);
2759
+ }, this))
2760
+ .bind("loaded.jstree", $.proxy(function (e) {
2761
+ this._prepare_checkboxes();
2762
+ }, this))
2763
+ .delegate( (this.data.ui && this.data.checkbox.noui ? "a" : "ins.jstree-checkbox") , "click.jstree", $.proxy(function (e) {
2764
+ e.preventDefault();
2765
+ if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2766
+ else { this.check_node(e.target); }
2767
+ if(this.data.ui && this.data.checkbox.noui) {
2768
+ this.save_selected();
2769
+ if(this.data.cookies) { this.save_cookie("select_node"); }
2770
+ }
2771
+ else {
2772
+ e.stopImmediatePropagation();
2773
+ return false;
2774
+ }
2775
+ }, this));
2776
+ },
2777
+ defaults : {
2778
+ override_ui : false,
2779
+ two_state : false,
2780
+ real_checkboxes : false,
2781
+ checked_parent_open : true,
2782
+ real_checkboxes_names : function (n) { return [ ("check_" + (n[0].id || Math.ceil(Math.random() * 10000))) , 1]; }
2783
+ },
2784
+ __destroy : function () {
2785
+ this.get_container()
2786
+ .find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end()
2787
+ .find("ins.jstree-checkbox").remove();
2788
+ },
2789
+ _fn : {
2790
+ _checkbox_notify : function (n, data) {
2791
+ if(data.checked) {
2792
+ this.check_node(n, false);
2793
+ }
2794
+ },
2795
+ _prepare_checkboxes : function (obj) {
2796
+ obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
2797
+ if(obj === false) { return; } // added for removing root nodes
2798
+ var c, _this = this, t, ts = this._get_settings().checkbox.two_state, rc = this._get_settings().checkbox.real_checkboxes, rcn = this._get_settings().checkbox.real_checkboxes_names;
2799
+ obj.each(function () {
2800
+ t = $(this);
2801
+ c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";
2802
+ t.find("li").andSelf().each(function () {
2803
+ var $t = $(this), nm;
2804
+ $t.children("a" + (_this.data.languages ? "" : ":eq(0)") ).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass( ts ? "jstree-unchecked" : c );
2805
+ if(rc) {
2806
+ if(!$t.children(":checkbox").length) {
2807
+ nm = rcn.call(_this, $t);
2808
+ $t.prepend("<input type='checkbox' class='jstree-real-checkbox' id='" + nm[0] + "' name='" + nm[0] + "' value='" + nm[1] + "' />");
2809
+ }
2810
+ else {
2811
+ $t.children(":checkbox").addClass("jstree-real-checkbox");
2812
+ }
2813
+ if(c === "jstree-checked") {
2814
+ $t.children(":checkbox").attr("checked","checked");
2815
+ }
2816
+ }
2817
+ if(c === "jstree-checked" && !ts) {
2818
+ $t.find("li").addClass("jstree-checked");
2819
+ }
2820
+ });
2821
+ });
2822
+ if(!ts) {
2823
+ if(obj.length === 1 && obj.is("li")) { this._repair_state(obj); }
2824
+ if(obj.is("li")) { obj.each(function () { _this._repair_state(this); }); }
2825
+ else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2826
+ obj.find(".jstree-checked").parent().parent().each(function () { _this._repair_state(this); });
2827
+ }
2828
+ },
2829
+ change_state : function (obj, state) {
2830
+ obj = this._get_node(obj);
2831
+ var coll = false, rc = this._get_settings().checkbox.real_checkboxes;
2832
+ if(!obj || obj === -1) { return false; }
2833
+ state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2834
+ if(this._get_settings().checkbox.two_state) {
2835
+ if(state) {
2836
+ obj.removeClass("jstree-checked").addClass("jstree-unchecked");
2837
+ if(rc) { obj.children(":checkbox").removeAttr("checked"); }
2838
+ }
2839
+ else {
2840
+ obj.removeClass("jstree-unchecked").addClass("jstree-checked");
2841
+ if(rc) { obj.children(":checkbox").attr("checked","checked"); }
2842
+ }
2843
+ }
2844
+ else {
2845
+ if(state) {
2846
+ coll = obj.find("li").andSelf();
2847
+ if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }
2848
+ coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2849
+ if(rc) { coll.children(":checkbox").removeAttr("checked"); }
2850
+ }
2851
+ else {
2852
+ coll = obj.find("li").andSelf();
2853
+ if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }
2854
+ coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2855
+ if(rc) { coll.children(":checkbox").attr("checked","checked"); }
2856
+ if(this.data.ui) { this.data.ui.last_selected = obj; }
2857
+ this.data.checkbox.last_selected = obj;
2858
+ }
2859
+ obj.parentsUntil(".jstree", "li").each(function () {
2860
+ var $this = $(this);
2861
+ if(state) {
2862
+ if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
2863
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2864
+ if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2865
+ return false;
2866
+ }
2867
+ else {
2868
+ $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2869
+ if(rc) { $this.children(":checkbox").removeAttr("checked"); }
2870
+ }
2871
+ }
2872
+ else {
2873
+ if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
2874
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2875
+ if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2876
+ return false;
2877
+ }
2878
+ else {
2879
+ $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2880
+ if(rc) { $this.children(":checkbox").attr("checked","checked"); }
2881
+ }
2882
+ }
2883
+ });
2884
+ }
2885
+ if(this.data.ui && this.data.checkbox.noui) { this.data.ui.selected = this.get_checked(); }
2886
+ this.__callback(obj);
2887
+ return true;
2888
+ },
2889
+ check_node : function (obj) {
2890
+ if(this.change_state(obj, false)) {
2891
+ obj = this._get_node(obj);
2892
+ if(this._get_settings().checkbox.checked_parent_open) {
2893
+ var t = this;
2894
+ obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });
2895
+ }
2896
+ this.__callback({ "obj" : obj });
2897
+ }
2898
+ },
2899
+ uncheck_node : function (obj) {
2900
+ if(this.change_state(obj, true)) { this.__callback({ "obj" : this._get_node(obj) }); }
2901
+ },
2902
+ check_all : function () {
2903
+ var _this = this,
2904
+ coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
2905
+ coll.each(function () {
2906
+ _this.change_state(this, false);
2907
+ });
2908
+ this.__callback();
2909
+ },
2910
+ uncheck_all : function () {
2911
+ var _this = this,
2912
+ coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
2913
+ coll.each(function () {
2914
+ _this.change_state(this, true);
2915
+ });
2916
+ this.__callback();
2917
+ },
2918
+
2919
+ is_checked : function(obj) {
2920
+ obj = this._get_node(obj);
2921
+ return obj.length ? obj.is(".jstree-checked") : false;
2922
+ },
2923
+ get_checked : function (obj, get_all) {
2924
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2925
+ return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-checked") : obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2926
+ },
2927
+ get_unchecked : function (obj, get_all) {
2928
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2929
+ return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-unchecked") : obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2930
+ },
2931
+
2932
+ show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2933
+ hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2934
+
2935
+ _repair_state : function (obj) {
2936
+ obj = this._get_node(obj);
2937
+ if(!obj.length) { return; }
2938
+ var rc = this._get_settings().checkbox.real_checkboxes,
2939
+ a = obj.find("> ul > .jstree-checked").length,
2940
+ b = obj.find("> ul > .jstree-undetermined").length,
2941
+ c = obj.find("> ul > li").length;
2942
+ if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.change_state(obj, false); } }
2943
+ else if(a === 0 && b === 0) { this.change_state(obj, true); }
2944
+ else if(a === c) { this.change_state(obj, false); }
2945
+ else {
2946
+ obj.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2947
+ if(rc) { obj.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2948
+ }
2949
+ },
2950
+ reselect : function () {
2951
+ if(this.data.ui && this.data.checkbox.noui) {
2952
+ var _this = this,
2953
+ s = this.data.ui.to_select;
2954
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
2955
+ this.deselect_all();
2956
+ $.each(s, function (i, val) { _this.check_node(val); });
2957
+ this.__callback();
2958
+ }
2959
+ else {
2960
+ this.__call_old();
2961
+ }
2962
+ },
2963
+ save_loaded : function () {
2964
+ var _this = this;
2965
+ this.data.core.to_load = [];
2966
+ this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function () {
2967
+ if(this.id) { _this.data.core.to_load.push("#" + this.id); }
2968
+ });
2969
+ }
2970
+ }
2971
+ });
2972
+ $(function() {
2973
+ var css_string = '.jstree .jstree-real-checkbox { display:none; } ';
2974
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
2975
+ });
2976
+ })(jQuery);
2977
+ //*/
2978
+
2979
+ /*
2980
+ * jsTree XML plugin
2981
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2982
+ */
2983
+ (function ($) {
2984
+ $.vakata.xslt = function (xml, xsl, callback) {
2985
+ var rs = "", xm, xs, processor, support;
2986
+ // TODO: IE9 no XSLTProcessor, no document.recalc
2987
+ if(document.recalc) {
2988
+ xm = document.createElement('xml');
2989
+ xs = document.createElement('xml');
2990
+ xm.innerHTML = xml;
2991
+ xs.innerHTML = xsl;
2992
+ $("body").append(xm).append(xs);
2993
+ setTimeout( (function (xm, xs, callback) {
2994
+ return function () {
2995
+ callback.call(null, xm.transformNode(xs.XMLDocument));
2996
+ setTimeout( (function (xm, xs) { return function () { $(xm).remove(); $(xs).remove(); }; })(xm, xs), 200);
2997
+ };
2998
+ })(xm, xs, callback), 100);
2999
+ return true;
3000
+ }
3001
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor === "undefined") {
3002
+ xml = new DOMParser().parseFromString(xml, "text/xml");
3003
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
3004
+ // alert(xml.transformNode());
3005
+ // callback.call(null, new XMLSerializer().serializeToString(rs));
3006
+
3007
+ }
3008
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
3009
+ processor = new XSLTProcessor();
3010
+ support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
3011
+ if(!support) { return false; }
3012
+ xml = new DOMParser().parseFromString(xml, "text/xml");
3013
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
3014
+ if($.isFunction(processor.transformDocument)) {
3015
+ rs = document.implementation.createDocument("", "", null);
3016
+ processor.transformDocument(xml, xsl, rs, null);
3017
+ callback.call(null, new XMLSerializer().serializeToString(rs));
3018
+ return true;
3019
+ }
3020
+ else {
3021
+ processor.importStylesheet(xsl);
3022
+ rs = processor.transformToFragment(xml, document);
3023
+ callback.call(null, $("<div />").append(rs).html());
3024
+ return true;
3025
+ }
3026
+ }
3027
+ return false;
3028
+ };
3029
+ var xsl = {
3030
+ 'nest' : '<' + '?xml version="1.0" encoding="utf-8" ?>' +
3031
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
3032
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
3033
+ '<xsl:template match="/">' +
3034
+ ' <xsl:call-template name="nodes">' +
3035
+ ' <xsl:with-param name="node" select="/root" />' +
3036
+ ' </xsl:call-template>' +
3037
+ '</xsl:template>' +
3038
+ '<xsl:template name="nodes">' +
3039
+ ' <xsl:param name="node" />' +
3040
+ ' <ul>' +
3041
+ ' <xsl:for-each select="$node/item">' +
3042
+ ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
3043
+ ' <li>' +
3044
+ ' <xsl:attribute name="class">' +
3045
+ ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
3046
+ ' <xsl:choose>' +
3047
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
3048
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
3049
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
3050
+ ' </xsl:choose>' +
3051
+ ' <xsl:value-of select="@class" />' +
3052
+ ' </xsl:attribute>' +
3053
+ ' <xsl:for-each select="@*">' +
3054
+ ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
3055
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3056
+ ' </xsl:if>' +
3057
+ ' </xsl:for-each>' +
3058
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
3059
+ ' <xsl:for-each select="content/name">' +
3060
+ ' <a>' +
3061
+ ' <xsl:attribute name="href">' +
3062
+ ' <xsl:choose>' +
3063
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
3064
+ ' <xsl:otherwise>#</xsl:otherwise>' +
3065
+ ' </xsl:choose>' +
3066
+ ' </xsl:attribute>' +
3067
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
3068
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
3069
+ ' <xsl:for-each select="@*">' +
3070
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
3071
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3072
+ ' </xsl:if>' +
3073
+ ' </xsl:for-each>' +
3074
+ ' <ins>' +
3075
+ ' <xsl:attribute name="class">jstree-icon ' +
3076
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
3077
+ ' </xsl:attribute>' +
3078
+ ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
3079
+ ' <xsl:text>&#xa0;</xsl:text>' +
3080
+ ' </ins>' +
3081
+ ' <xsl:copy-of select="./child::node()" />' +
3082
+ ' </a>' +
3083
+ ' </xsl:for-each>' +
3084
+ ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
3085
+ ' </li>' +
3086
+ ' </xsl:for-each>' +
3087
+ ' </ul>' +
3088
+ '</xsl:template>' +
3089
+ '</xsl:stylesheet>',
3090
+
3091
+ 'flat' : '<' + '?xml version="1.0" encoding="utf-8" ?>' +
3092
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
3093
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
3094
+ '<xsl:template match="/">' +
3095
+ ' <ul>' +
3096
+ ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
3097
+ ' <xsl:call-template name="nodes">' +
3098
+ ' <xsl:with-param name="node" select="." />' +
3099
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
3100
+ ' </xsl:call-template>' +
3101
+ ' </xsl:for-each>' +
3102
+ ' </ul>' +
3103
+ '</xsl:template>' +
3104
+ '<xsl:template name="nodes">' +
3105
+ ' <xsl:param name="node" />' +
3106
+ ' <xsl:param name="is_last" />' +
3107
+ ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
3108
+ ' <li>' +
3109
+ ' <xsl:attribute name="class">' +
3110
+ ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
3111
+ ' <xsl:choose>' +
3112
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
3113
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
3114
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
3115
+ ' </xsl:choose>' +
3116
+ ' <xsl:value-of select="@class" />' +
3117
+ ' </xsl:attribute>' +
3118
+ ' <xsl:for-each select="@*">' +
3119
+ ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
3120
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3121
+ ' </xsl:if>' +
3122
+ ' </xsl:for-each>' +
3123
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
3124
+ ' <xsl:for-each select="content/name">' +
3125
+ ' <a>' +
3126
+ ' <xsl:attribute name="href">' +
3127
+ ' <xsl:choose>' +
3128
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
3129
+ ' <xsl:otherwise>#</xsl:otherwise>' +
3130
+ ' </xsl:choose>' +
3131
+ ' </xsl:attribute>' +
3132
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
3133
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
3134
+ ' <xsl:for-each select="@*">' +
3135
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
3136
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3137
+ ' </xsl:if>' +
3138
+ ' </xsl:for-each>' +
3139
+ ' <ins>' +
3140
+ ' <xsl:attribute name="class">jstree-icon ' +
3141
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
3142
+ ' </xsl:attribute>' +
3143
+ ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
3144
+ ' <xsl:text>&#xa0;</xsl:text>' +
3145
+ ' </ins>' +
3146
+ ' <xsl:copy-of select="./child::node()" />' +
3147
+ ' </a>' +
3148
+ ' </xsl:for-each>' +
3149
+ ' <xsl:if test="$children">' +
3150
+ ' <ul>' +
3151
+ ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
3152
+ ' <xsl:call-template name="nodes">' +
3153
+ ' <xsl:with-param name="node" select="." />' +
3154
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
3155
+ ' </xsl:call-template>' +
3156
+ ' </xsl:for-each>' +
3157
+ ' </ul>' +
3158
+ ' </xsl:if>' +
3159
+ ' </li>' +
3160
+ '</xsl:template>' +
3161
+ '</xsl:stylesheet>'
3162
+ },
3163
+ escape_xml = function(string) {
3164
+ return string
3165
+ .toString()
3166
+ .replace(/&/g, '&amp;')
3167
+ .replace(/</g, '&lt;')
3168
+ .replace(/>/g, '&gt;')
3169
+ .replace(/"/g, '&quot;')
3170
+ .replace(/'/g, '&apos;');
3171
+ };
3172
+ $.jstree.plugin("xml_data", {
3173
+ defaults : {
3174
+ data : false,
3175
+ ajax : false,
3176
+ xsl : "flat",
3177
+ clean_node : false,
3178
+ correct_state : true,
3179
+ get_skip_empty : false,
3180
+ get_include_preamble : true
3181
+ },
3182
+ _fn : {
3183
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
3184
+ _is_loaded : function (obj) {
3185
+ var s = this._get_settings().xml_data;
3186
+ obj = this._get_node(obj);
3187
+ return obj == -1 || !obj || (!s.ajax && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3188
+ },
3189
+ load_node_xml : function (obj, s_call, e_call) {
3190
+ var s = this.get_settings().xml_data,
3191
+ error_func = function () {},
3192
+ success_func = function () {};
3193
+
3194
+ obj = this._get_node(obj);
3195
+ if(obj && obj !== -1) {
3196
+ if(obj.data("jstree-is-loading")) { return; }
3197
+ else { obj.data("jstree-is-loading",true); }
3198
+ }
3199
+ switch(!0) {
3200
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
3201
+ case ($.isFunction(s.data)):
3202
+ s.data.call(this, obj, $.proxy(function (d) {
3203
+ this.parse_xml(d, $.proxy(function (d) {
3204
+ if(d) {
3205
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3206
+ if(d.length > 10) {
3207
+ d = $(d);
3208
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
3209
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3210
+ if(s.clean_node) { this.clean_node(obj); }
3211
+ if(s_call) { s_call.call(this); }
3212
+ }
3213
+ else {
3214
+ if(obj && obj !== -1) {
3215
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3216
+ obj.removeData("jstree-is-loading");
3217
+ if(s.correct_state) {
3218
+ this.correct_state(obj);
3219
+ if(s_call) { s_call.call(this); }
3220
+ }
3221
+ }
3222
+ else {
3223
+ if(s.correct_state) {
3224
+ this.get_container().children("ul").empty();
3225
+ if(s_call) { s_call.call(this); }
3226
+ }
3227
+ }
3228
+ }
3229
+ }
3230
+ }, this));
3231
+ }, this));
3232
+ break;
3233
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3234
+ if(!obj || obj == -1) {
3235
+ this.parse_xml(s.data, $.proxy(function (d) {
3236
+ if(d) {
3237
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3238
+ if(d.length > 10) {
3239
+ d = $(d);
3240
+ this.get_container().children("ul").empty().append(d.children());
3241
+ if(s.clean_node) { this.clean_node(obj); }
3242
+ if(s_call) { s_call.call(this); }
3243
+ }
3244
+ }
3245
+ else {
3246
+ if(s.correct_state) {
3247
+ this.get_container().children("ul").empty();
3248
+ if(s_call) { s_call.call(this); }
3249
+ }
3250
+ }
3251
+ }, this));
3252
+ }
3253
+ break;
3254
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3255
+ error_func = function (x, t, e) {
3256
+ var ef = this.get_settings().xml_data.ajax.error;
3257
+ if(ef) { ef.call(this, x, t, e); }
3258
+ if(obj !== -1 && obj.length) {
3259
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3260
+ obj.removeData("jstree-is-loading");
3261
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
3262
+ }
3263
+ else {
3264
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3265
+ }
3266
+ if(e_call) { e_call.call(this); }
3267
+ };
3268
+ success_func = function (d, t, x) {
3269
+ d = x.responseText;
3270
+ var sf = this.get_settings().xml_data.ajax.success;
3271
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3272
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {
3273
+ return error_func.call(this, x, t, "");
3274
+ }
3275
+ this.parse_xml(d, $.proxy(function (d) {
3276
+ if(d) {
3277
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3278
+ if(d.length > 10) {
3279
+ d = $(d);
3280
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
3281
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3282
+ if(s.clean_node) { this.clean_node(obj); }
3283
+ if(s_call) { s_call.call(this); }
3284
+ }
3285
+ else {
3286
+ if(obj && obj !== -1) {
3287
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3288
+ obj.removeData("jstree-is-loading");
3289
+ if(s.correct_state) {
3290
+ this.correct_state(obj);
3291
+ if(s_call) { s_call.call(this); }
3292
+ }
3293
+ }
3294
+ else {
3295
+ if(s.correct_state) {
3296
+ this.get_container().children("ul").empty();
3297
+ if(s_call) { s_call.call(this); }
3298
+ }
3299
+ }
3300
+ }
3301
+ }
3302
+ }, this));
3303
+ };
3304
+ s.ajax.context = this;
3305
+ s.ajax.error = error_func;
3306
+ s.ajax.success = success_func;
3307
+ if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
3308
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3309
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3310
+ $.ajax(s.ajax);
3311
+ break;
3312
+ }
3313
+ },
3314
+ parse_xml : function (xml, callback) {
3315
+ var s = this._get_settings().xml_data;
3316
+ $.vakata.xslt(xml, xsl[s.xsl], callback);
3317
+ },
3318
+ get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
3319
+ var result = "",
3320
+ s = this._get_settings(),
3321
+ _this = this,
3322
+ tmp1, tmp2, li, a, lang;
3323
+ if(!tp) { tp = "flat"; }
3324
+ if(!is_callback) { is_callback = 0; }
3325
+ obj = this._get_node(obj);
3326
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
3327
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
3328
+ if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
3329
+
3330
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
3331
+
3332
+ if(!is_callback) {
3333
+ if(s.xml_data.get_include_preamble) {
3334
+ result += '<' + '?xml version="1.0" encoding="UTF-8"?' + '>';
3335
+ }
3336
+ result += "<root>";
3337
+ }
3338
+ obj.each(function () {
3339
+ result += "<item";
3340
+ li = $(this);
3341
+ $.each(li_attr, function (i, v) {
3342
+ var t = li.attr(v);
3343
+ if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {
3344
+ result += " " + v + "=\"" + escape_xml((" " + (t || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\"";
3345
+ }
3346
+ });
3347
+ if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
3348
+ if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
3349
+ if(tp === "flat") { result += " parent_id=\"" + escape_xml(is_callback) + "\""; }
3350
+ result += ">";
3351
+ result += "<content>";
3352
+ a = li.children("a");
3353
+ a.each(function () {
3354
+ tmp1 = $(this);
3355
+ lang = false;
3356
+ result += "<name";
3357
+ if($.inArray("languages", s.plugins) !== -1) {
3358
+ $.each(s.languages, function (k, z) {
3359
+ if(tmp1.hasClass(z)) { result += " lang=\"" + escape_xml(z) + "\""; lang = z; return false; }
3360
+ });
3361
+ }
3362
+ if(a_attr.length) {
3363
+ $.each(a_attr, function (k, z) {
3364
+ var t = tmp1.attr(z);
3365
+ if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {
3366
+ result += " " + z + "=\"" + escape_xml((" " + t || "").replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\"";
3367
+ }
3368
+ });
3369
+ }
3370
+ if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
3371
+ result += ' icon="' + escape_xml(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + '"';
3372
+ }
3373
+ if(tmp1.children("ins").get(0).style.backgroundImage.length) {
3374
+ result += ' icon="' + escape_xml(tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,"")) + '"';
3375
+ }
3376
+ result += ">";
3377
+ result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
3378
+ result += "</name>";
3379
+ });
3380
+ result += "</content>";
3381
+ tmp2 = li[0].id || true;
3382
+ li = li.find("> ul > li");
3383
+ if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
3384
+ else { tmp2 = ""; }
3385
+ if(tp == "nest") { result += tmp2; }
3386
+ result += "</item>";
3387
+ if(tp == "flat") { result += tmp2; }
3388
+ });
3389
+ if(!is_callback) { result += "</root>"; }
3390
+ return result;
3391
+ }
3392
+ }
3393
+ });
3394
+ })(jQuery);
3395
+ //*/
3396
+
3397
+ /*
3398
+ * jsTree search plugin
3399
+ * Enables both sync and async search on the tree
3400
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
3401
+ */
3402
+ (function ($) {
3403
+ $.expr[':'].jstree_contains = function(a,i,m){
3404
+ return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3405
+ };
3406
+ $.expr[':'].jstree_title_contains = function(a,i,m) {
3407
+ return (a.getAttribute("title") || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3408
+ };
3409
+ $.jstree.plugin("search", {
3410
+ __init : function () {
3411
+ this.data.search.str = "";
3412
+ this.data.search.result = $();
3413
+ if(this._get_settings().search.show_only_matches) {
3414
+ this.get_container()
3415
+ .bind("search.jstree", function (e, data) {
3416
+ $(this).children("ul").find("li").hide().removeClass("jstree-last");
3417
+ data.rslt.nodes.parentsUntil(".jstree").andSelf().show()
3418
+ .filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
3419
+ })
3420
+ .bind("clear_search.jstree", function () {
3421
+ $(this).children("ul").find("li").css("display","").end().end().jstree("clean_node", -1);
3422
+ });
3423
+ }
3424
+ },
3425
+ defaults : {
3426
+ ajax : false,
3427
+ search_method : "jstree_contains", // for case insensitive - jstree_contains
3428
+ show_only_matches : false
3429
+ },
3430
+ _fn : {
3431
+ search : function (str, skip_async) {
3432
+ if($.trim(str) === "") { this.clear_search(); return; }
3433
+ var s = this.get_settings().search,
3434
+ t = this,
3435
+ error_func = function () { },
3436
+ success_func = function () { };
3437
+ this.data.search.str = str;
3438
+
3439
+ if(!skip_async && s.ajax !== false && this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length > 0) {
3440
+ this.search.supress_callback = true;
3441
+ error_func = function () { };
3442
+ success_func = function (d, t, x) {
3443
+ var sf = this.get_settings().search.ajax.success;
3444
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3445
+ this.data.search.to_open = d;
3446
+ this._search_open();
3447
+ };
3448
+ s.ajax.context = this;
3449
+ s.ajax.error = error_func;
3450
+ s.ajax.success = success_func;
3451
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
3452
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
3453
+ if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
3454
+ if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
3455
+ $.ajax(s.ajax);
3456
+ return;
3457
+ }
3458
+ if(this.data.search.result.length) { this.clear_search(); }
3459
+ this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.search_method) + "(" + this.data.search.str + ")");
3460
+ this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function () {
3461
+ t.open_node(this, false, true);
3462
+ });
3463
+ this.__callback({ nodes : this.data.search.result, str : str });
3464
+ },
3465
+ clear_search : function (str) {
3466
+ this.data.search.result.removeClass("jstree-search");
3467
+ this.__callback(this.data.search.result);
3468
+ this.data.search.result = $();
3469
+ },
3470
+ _search_open : function (is_callback) {
3471
+ var _this = this,
3472
+ done = true,
3473
+ current = [],
3474
+ remaining = [];
3475
+ if(this.data.search.to_open.length) {
3476
+ $.each(this.data.search.to_open, function (i, val) {
3477
+ if(val == "#") { return true; }
3478
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
3479
+ else { remaining.push(val); }
3480
+ });
3481
+ if(current.length) {
3482
+ this.data.search.to_open = remaining;
3483
+ $.each(current, function (i, val) {
3484
+ _this.open_node(val, function () { _this._search_open(true); });
3485
+ });
3486
+ done = false;
3487
+ }
3488
+ }
3489
+ if(done) { this.search(this.data.search.str, true); }
3490
+ }
3491
+ }
3492
+ });
3493
+ })(jQuery);
3494
+ //*/
3495
+
3496
+ /*
3497
+ * jsTree contextmenu plugin
3498
+ */
3499
+ (function ($) {
3500
+ $.vakata.context = {
3501
+ hide_on_mouseleave : false,
3502
+
3503
+ cnt : $("<div id='vakata-contextmenu' />"),
3504
+ vis : false,
3505
+ tgt : false,
3506
+ par : false,
3507
+ func : false,
3508
+ data : false,
3509
+ rtl : false,
3510
+ show : function (s, t, x, y, d, p, rtl) {
3511
+ $.vakata.context.rtl = !!rtl;
3512
+ var html = $.vakata.context.parse(s), h, w;
3513
+ if(!html) { return; }
3514
+ $.vakata.context.vis = true;
3515
+ $.vakata.context.tgt = t;
3516
+ $.vakata.context.par = p || t || null;
3517
+ $.vakata.context.data = d || null;
3518
+ $.vakata.context.cnt
3519
+ .html(html)
3520
+ .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
3521
+
3522
+ if($.vakata.context.hide_on_mouseleave) {
3523
+ $.vakata.context.cnt
3524
+ .one("mouseleave", function(e) { $.vakata.context.hide(); });
3525
+ }
3526
+
3527
+ h = $.vakata.context.cnt.height();
3528
+ w = $.vakata.context.cnt.width();
3529
+ if(x + w > $(document).width()) {
3530
+ x = $(document).width() - (w + 5);
3531
+ $.vakata.context.cnt.find("li > ul").addClass("right");
3532
+ }
3533
+ if(y + h > $(document).height()) {
3534
+ y = y - (h + t[0].offsetHeight);
3535
+ $.vakata.context.cnt.find("li > ul").addClass("bottom");
3536
+ }
3537
+
3538
+ $.vakata.context.cnt
3539
+ .css({ "left" : x, "top" : y })
3540
+ .find("li:has(ul)")
3541
+ .bind("mouseenter", function (e) {
3542
+ var w = $(document).width(),
3543
+ h = $(document).height(),
3544
+ ul = $(this).children("ul").show();
3545
+ if(w !== $(document).width()) { ul.toggleClass("right"); }
3546
+ if(h !== $(document).height()) { ul.toggleClass("bottom"); }
3547
+ })
3548
+ .bind("mouseleave", function (e) {
3549
+ $(this).children("ul").hide();
3550
+ })
3551
+ .end()
3552
+ .css({ "visibility" : "visible" })
3553
+ .show();
3554
+ $(document).triggerHandler("context_show.vakata");
3555
+ },
3556
+ hide : function () {
3557
+ $.vakata.context.vis = false;
3558
+ $.vakata.context.cnt.attr("class","").css({ "visibility" : "hidden" });
3559
+ $(document).triggerHandler("context_hide.vakata");
3560
+ },
3561
+ parse : function (s, is_callback) {
3562
+ if(!s) { return false; }
3563
+ var str = "",
3564
+ tmp = false,
3565
+ was_sep = true;
3566
+ if(!is_callback) { $.vakata.context.func = {}; }
3567
+ str += "<ul>";
3568
+ $.each(s, function (i, val) {
3569
+ if(!val) { return true; }
3570
+ $.vakata.context.func[i] = val.action;
3571
+ if(!was_sep && val.separator_before) {
3572
+ str += "<li class='vakata-separator vakata-separator-before'></li>";
3573
+ }
3574
+ was_sep = false;
3575
+ str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
3576
+ if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
3577
+ if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
3578
+ str += ">&#160;</ins><a href='#' rel='" + i + "'>";
3579
+ if(val.submenu) {
3580
+ str += "<span style='float:" + ($.vakata.context.rtl ? "left" : "right") + ";'>&raquo;</span>";
3581
+ }
3582
+ str += val.label + "</a>";
3583
+ if(val.submenu) {
3584
+ tmp = $.vakata.context.parse(val.submenu, true);
3585
+ if(tmp) { str += tmp; }
3586
+ }
3587
+ str += "</li>";
3588
+ if(val.separator_after) {
3589
+ str += "<li class='vakata-separator vakata-separator-after'></li>";
3590
+ was_sep = true;
3591
+ }
3592
+ });
3593
+ str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
3594
+ str += "</ul>";
3595
+ $(document).triggerHandler("context_parse.vakata");
3596
+ return str.length > 10 ? str : false;
3597
+ },
3598
+ exec : function (i) {
3599
+ if($.isFunction($.vakata.context.func[i])) {
3600
+ // if is string - eval and call it!
3601
+ $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
3602
+ return true;
3603
+ }
3604
+ else { return false; }
3605
+ }
3606
+ };
3607
+ $(function () {
3608
+ var css_string = '' +
3609
+ '#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
3610
+ '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
3611
+ '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
3612
+ '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
3613
+ '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
3614
+ '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
3615
+ '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
3616
+ '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
3617
+ '#vakata-contextmenu .right { right:100%; left:auto; } ' +
3618
+ '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
3619
+ '#vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ';
3620
+ $.vakata.css.add_sheet({ str : css_string, title : "vakata" });
3621
+ $.vakata.context.cnt
3622
+ .delegate("a","click", function (e) { e.preventDefault(); })
3623
+ .delegate("a","mouseup", function (e) {
3624
+ if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
3625
+ $.vakata.context.hide();
3626
+ }
3627
+ else { $(this).blur(); }
3628
+ })
3629
+ .delegate("a","mouseover", function () {
3630
+ $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
3631
+ })
3632
+ .appendTo("body");
3633
+ $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
3634
+ // modified by pär to fix problems with wordpress hotkeys
3635
+ if(false && typeof $.hotkeys !== "undefined") {
3636
+ $(document)
3637
+ .bind("keydown", "up", function (e) {
3638
+ if($.vakata.context.vis) {
3639
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
3640
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
3641
+ o.addClass("vakata-hover");
3642
+ e.stopImmediatePropagation();
3643
+ e.preventDefault();
3644
+ }
3645
+ })
3646
+ .bind("keydown", "down", function (e) {
3647
+ if($.vakata.context.vis) {
3648
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
3649
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
3650
+ o.addClass("vakata-hover");
3651
+ e.stopImmediatePropagation();
3652
+ e.preventDefault();
3653
+ }
3654
+ })
3655
+ .bind("keydown", "right", function (e) {
3656
+ if($.vakata.context.vis) {
3657
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
3658
+ e.stopImmediatePropagation();
3659
+ e.preventDefault();
3660
+ }
3661
+ })
3662
+ .bind("keydown", "left", function (e) {
3663
+ if($.vakata.context.vis) {
3664
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
3665
+ e.stopImmediatePropagation();
3666
+ e.preventDefault();
3667
+ }
3668
+ })
3669
+ .bind("keydown", "esc", function (e) {
3670
+ $.vakata.context.hide();
3671
+ e.preventDefault();
3672
+ })
3673
+ .bind("keydown", "space", function (e) {
3674
+ $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
3675
+ e.preventDefault();
3676
+ });
3677
+ }
3678
+ });
3679
+
3680
+ $.jstree.plugin("contextmenu", {
3681
+ __init : function () {
3682
+ this.get_container()
3683
+ .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
3684
+ e.preventDefault();
3685
+ if(!$(e.currentTarget).hasClass("jstree-loading")) {
3686
+ this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
3687
+ }
3688
+ }, this))
3689
+ .delegate("a", "click.jstree", $.proxy(function (e) {
3690
+ if(this.data.contextmenu) {
3691
+ $.vakata.context.hide();
3692
+ }
3693
+ }, this))
3694
+ .bind("destroy.jstree", $.proxy(function () {
3695
+ // TODO: move this to descruct method
3696
+ if(this.data.contextmenu) {
3697
+ $.vakata.context.hide();
3698
+ }
3699
+ }, this));
3700
+ $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
3701
+ },
3702
+ defaults : {
3703
+ select_node : false, // requires UI plugin
3704
+ show_at_node : true,
3705
+ items : { // Could be a function that should return an object like this one
3706
+ "create" : {
3707
+ "separator_before" : false,
3708
+ "separator_after" : true,
3709
+ "label" : "Create",
3710
+ "action" : function (obj) { this.create(obj); }
3711
+ },
3712
+ "rename" : {
3713
+ "separator_before" : false,
3714
+ "separator_after" : false,
3715
+ "label" : "Rename",
3716
+ "action" : function (obj) { this.rename(obj); }
3717
+ },
3718
+ "remove" : {
3719
+ "separator_before" : false,
3720
+ "icon" : false,
3721
+ "separator_after" : false,
3722
+ "label" : "Delete",
3723
+ "action" : function (obj) { if(this.is_selected(obj)) { this.remove(); } else { this.remove(obj); } }
3724
+ },
3725
+ "ccp" : {
3726
+ "separator_before" : true,
3727
+ "icon" : false,
3728
+ "separator_after" : false,
3729
+ "label" : "Edit",
3730
+ "action" : false,
3731
+ "submenu" : {
3732
+ "cut" : {
3733
+ "separator_before" : false,
3734
+ "separator_after" : false,
3735
+ "label" : "Cut",
3736
+ "action" : function (obj) { this.cut(obj); }
3737
+ },
3738
+ "copy" : {
3739
+ "separator_before" : false,
3740
+ "icon" : false,
3741
+ "separator_after" : false,
3742
+ "label" : "Copy",
3743
+ "action" : function (obj) { this.copy(obj); }
3744
+ },
3745
+ "paste" : {
3746
+ "separator_before" : false,
3747
+ "icon" : false,
3748
+ "separator_after" : false,
3749
+ "label" : "Paste",
3750
+ "action" : function (obj) { this.paste(obj); }
3751
+ }
3752
+ }
3753
+ }
3754
+ }
3755
+ },
3756
+ _fn : {
3757
+ show_contextmenu : function (obj, x, y) {
3758
+ obj = this._get_node(obj);
3759
+ var s = this.get_settings().contextmenu,
3760
+ a = obj.children("a:visible:eq(0)"),
3761
+ o = false,
3762
+ i = false;
3763
+ if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3764
+ this.deselect_all();
3765
+ this.select_node(obj, true);
3766
+ }
3767
+ if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3768
+ o = a.offset();
3769
+ x = o.left;
3770
+ y = o.top + this.data.core.li_height;
3771
+ }
3772
+ i = obj.data("jstree") && obj.data("jstree").contextmenu ? obj.data("jstree").contextmenu : s.items;
3773
+ if($.isFunction(i)) { i = i.call(this, obj); }
3774
+ this.data.contextmenu = true;
3775
+ $.vakata.context.show(i, a, x, y, this, obj, this._get_settings().core.rtl);
3776
+ if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3777
+ }
3778
+ }
3779
+ });
3780
+ })(jQuery);
3781
+ //*/
3782
+
3783
+ /*
3784
+ * jsTree types plugin
3785
+ * Adds support types of nodes
3786
+ * You can set an attribute on each li node, that represents its type.
3787
+ * According to the type setting the node may get custom icon/validation rules
3788
+ */
3789
+ (function ($) {
3790
+ $.jstree.plugin("types", {
3791
+ __init : function () {
3792
+ var s = this._get_settings().types;
3793
+ this.data.types.attach_to = [];
3794
+ this.get_container()
3795
+ .bind("init.jstree", $.proxy(function () {
3796
+ var types = s.types,
3797
+ attr = s.type_attr,
3798
+ icons_css = "",
3799
+ _this = this;
3800
+
3801
+ $.each(types, function (i, tp) {
3802
+ $.each(tp, function (k, v) {
3803
+ if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3804
+ });
3805
+ if(!tp.icon) { return true; }
3806
+ if( tp.icon.image || tp.icon.position) {
3807
+ if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3808
+ else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '="' + i + '"] > a > .jstree-icon { '; }
3809
+ if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3810
+ if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3811
+ else { icons_css += ' background-position:0 0; '; }
3812
+ icons_css += '} ';
3813
+ }
3814
+ });
3815
+ if(icons_css !== "") { $.vakata.css.add_sheet({ 'str' : icons_css, title : "jstree-types" }); }
3816
+ }, this))
3817
+ .bind("before.jstree", $.proxy(function (e, data) {
3818
+ var s, t,
3819
+ o = this._get_settings().types.use_data ? this._get_node(data.args[0]) : false,
3820
+ d = o && o !== -1 && o.length ? o.data("jstree") : false;
3821
+ if(d && d.types && d.types[data.func] === false) { e.stopImmediatePropagation(); return false; }
3822
+ if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3823
+ if(!data.args[0] || (!data.args[0].tagName && !data.args[0].jquery)) { return; }
3824
+ s = this._get_settings().types.types;
3825
+ t = this._get_type(data.args[0]);
3826
+ if(
3827
+ (
3828
+ (s[t] && typeof s[t][data.func] !== "undefined") ||
3829
+ (s["default"] && typeof s["default"][data.func] !== "undefined")
3830
+ ) && this._check(data.func, data.args[0]) === false
3831
+ ) {
3832
+ e.stopImmediatePropagation();
3833
+ return false;
3834
+ }
3835
+ }
3836
+ }, this));
3837
+ if(is_ie6) {
3838
+ this.get_container()
3839
+ .bind("load_node.jstree set_type.jstree", $.proxy(function (e, data) {
3840
+ var r = data && data.rslt && data.rslt.obj && data.rslt.obj !== -1 ? this._get_node(data.rslt.obj).parent() : this.get_container_ul(),
3841
+ c = false,
3842
+ s = this._get_settings().types;
3843
+ $.each(s.types, function (i, tp) {
3844
+ if(tp.icon && (tp.icon.image || tp.icon.position)) {
3845
+ c = i === "default" ? r.find("li > a > .jstree-icon") : r.find("li[" + s.type_attr + "='" + i + "'] > a > .jstree-icon");
3846
+ if(tp.icon.image) { c.css("backgroundImage","url(" + tp.icon.image + ")"); }
3847
+ c.css("backgroundPosition", tp.icon.position || "0 0");
3848
+ }
3849
+ });
3850
+ }, this));
3851
+ }
3852
+ },
3853
+ defaults : {
3854
+ // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3855
+ max_children : -1,
3856
+ // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3857
+ max_depth : -1,
3858
+ // defines valid node types for the root nodes
3859
+ valid_children : "all",
3860
+
3861
+ // whether to use $.data
3862
+ use_data : false,
3863
+ // where is the type stores (the rel attribute of the LI element)
3864
+ type_attr : "rel",
3865
+ // a list of types
3866
+ types : {
3867
+ // the default type
3868
+ "default" : {
3869
+ "max_children" : -1,
3870
+ "max_depth" : -1,
3871
+ "valid_children": "all"
3872
+
3873
+ // Bound functions - you can bind any other function here (using boolean or function)
3874
+ //"select_node" : true
3875
+ }
3876
+ }
3877
+ },
3878
+ _fn : {
3879
+ _types_notify : function (n, data) {
3880
+ if(data.type && this._get_settings().types.use_data) {
3881
+ this.set_type(data.type, n);
3882
+ }
3883
+ },
3884
+ _get_type : function (obj) {
3885
+ obj = this._get_node(obj);
3886
+ return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3887
+ },
3888
+ set_type : function (str, obj) {
3889
+ obj = this._get_node(obj);
3890
+ var ret = (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3891
+ if(ret) { this.__callback({ obj : obj, type : str}); }
3892
+ return ret;
3893
+ },
3894
+ _check : function (rule, obj, opts) {
3895
+ obj = this._get_node(obj);
3896
+ var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types, data = false;
3897
+ if(obj === -1) {
3898
+ if(!!s[rule]) { v = s[rule]; }
3899
+ else { return; }
3900
+ }
3901
+ else {
3902
+ if(t === false) { return; }
3903
+ data = s.use_data ? obj.data("jstree") : false;
3904
+ if(data && data.types && typeof data.types[rule] !== "undefined") { v = data.types[rule]; }
3905
+ else if(!!s.types[t] && typeof s.types[t][rule] !== "undefined") { v = s.types[t][rule]; }
3906
+ else if(!!s.types["default"] && typeof s.types["default"][rule] !== "undefined") { v = s.types["default"][rule]; }
3907
+ }
3908
+ if($.isFunction(v)) { v = v.call(this, obj); }
3909
+ if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3910
+ // also include the node itself - otherwise if root node it is not checked
3911
+ obj.children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3912
+ // check if current depth already exceeds global tree depth
3913
+ if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3914
+ d = (i === 0) ? v : _this._check(rule, this, false);
3915
+ // check if current node max depth is already matched or exceeded
3916
+ if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3917
+ // otherwise - set the max depth to the current value minus current depth
3918
+ if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3919
+ // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3920
+ if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3921
+ });
3922
+ }
3923
+ return v;
3924
+ },
3925
+ check_move : function () {
3926
+ if(!this.__call_old()) { return false; }
3927
+ var m = this._get_move(),
3928
+ s = m.rt._get_settings().types,
3929
+ mc = m.rt._check("max_children", m.cr),
3930
+ md = m.rt._check("max_depth", m.cr),
3931
+ vc = m.rt._check("valid_children", m.cr),
3932
+ ch = 0, d = 1, t;
3933
+
3934
+ if(vc === "none") { return false; }
3935
+ if($.isArray(vc) && m.ot && m.ot._get_type) {
3936
+ m.o.each(function () {
3937
+ if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3938
+ });
3939
+ if(d === false) { return false; }
3940
+ }
3941
+ if(s.max_children !== -2 && mc !== -1) {
3942
+ ch = m.cr === -1 ? this.get_container().find("> ul > li").not(m.o).length : m.cr.find("> ul > li").not(m.o).length;
3943
+ if(ch + m.o.length > mc) { return false; }
3944
+ }
3945
+ if(s.max_depth !== -2 && md !== -1) {
3946
+ d = 0;
3947
+ if(md === 0) { return false; }
3948
+ if(typeof m.o.d === "undefined") {
3949
+ // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3950
+ t = m.o;
3951
+ while(t.length > 0) {
3952
+ t = t.find("> ul > li");
3953
+ d ++;
3954
+ }
3955
+ m.o.d = d;
3956
+ }
3957
+ if(md - m.o.d < 0) { return false; }
3958
+ }
3959
+ return true;
3960
+ },
3961
+ create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3962
+ if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3963
+ var p = (typeof position == "string" && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3964
+ s = this._get_settings().types,
3965
+ mc = this._check("max_children", p),
3966
+ md = this._check("max_depth", p),
3967
+ vc = this._check("valid_children", p),
3968
+ ch;
3969
+ if(typeof js === "string") { js = { data : js }; }
3970
+ if(!js) { js = {}; }
3971
+ if(vc === "none") { return false; }
3972
+ if($.isArray(vc)) {
3973
+ if(!js.attr || !js.attr[s.type_attr]) {
3974
+ if(!js.attr) { js.attr = {}; }
3975
+ js.attr[s.type_attr] = vc[0];
3976
+ }
3977
+ else {
3978
+ if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3979
+ }
3980
+ }
3981
+ if(s.max_children !== -2 && mc !== -1) {
3982
+ ch = p === -1 ? this.get_container().find("> ul > li").length : p.find("> ul > li").length;
3983
+ if(ch + 1 > mc) { return false; }
3984
+ }
3985
+ if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3986
+ }
3987
+ return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3988
+ }
3989
+ }
3990
+ });
3991
+ })(jQuery);
3992
+ //*/
3993
+
3994
+ /*
3995
+ * jsTree HTML plugin
3996
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3997
+ */
3998
+ (function ($) {
3999
+ $.jstree.plugin("html_data", {
4000
+ __init : function () {
4001
+ // this used to use html() and clean the whitespace, but this way any attached data was lost
4002
+ this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
4003
+ // remove white space from LI node - otherwise nodes appear a bit to the right
4004
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
4005
+ },
4006
+ defaults : {
4007
+ data : false,
4008
+ ajax : false,
4009
+ correct_state : true
4010
+ },
4011
+ _fn : {
4012
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
4013
+ _is_loaded : function (obj) {
4014
+ obj = this._get_node(obj);
4015
+ return obj == -1 || !obj || (!this._get_settings().html_data.ajax && !$.isFunction(this._get_settings().html_data.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
4016
+ },
4017
+ load_node_html : function (obj, s_call, e_call) {
4018
+ var d,
4019
+ s = this.get_settings().html_data,
4020
+ error_func = function () {},
4021
+ success_func = function () {};
4022
+ obj = this._get_node(obj);
4023
+ if(obj && obj !== -1) {
4024
+ if(obj.data("jstree-is-loading")) { return; }
4025
+ else { obj.data("jstree-is-loading",true); }
4026
+ }
4027
+ switch(!0) {
4028
+ case ($.isFunction(s.data)):
4029
+ s.data.call(this, obj, $.proxy(function (d) {
4030
+ if(d && d !== "" && d.toString && d.toString().replace(/^[\s\n]+$/,"") !== "") {
4031
+ d = $(d);
4032
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4033
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
4034
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.removeData("jstree-is-loading"); }
4035
+ this.clean_node(obj);
4036
+ if(s_call) { s_call.call(this); }
4037
+ }
4038
+ else {
4039
+ if(obj && obj !== -1) {
4040
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4041
+ obj.removeData("jstree-is-loading");
4042
+ if(s.correct_state) {
4043
+ this.correct_state(obj);
4044
+ if(s_call) { s_call.call(this); }
4045
+ }
4046
+ }
4047
+ else {
4048
+ if(s.correct_state) {
4049
+ this.get_container().children("ul").empty();
4050
+ if(s_call) { s_call.call(this); }
4051
+ }
4052
+ }
4053
+ }
4054
+ }, this));
4055
+ break;
4056
+ case (!s.data && !s.ajax):
4057
+ if(!obj || obj == -1) {
4058
+ this.get_container()
4059
+ .children("ul").empty()
4060
+ .append(this.data.html_data.original_container_html)
4061
+ .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
4062
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
4063
+ this.clean_node();
4064
+ }
4065
+ if(s_call) { s_call.call(this); }
4066
+ break;
4067
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
4068
+ if(!obj || obj == -1) {
4069
+ d = $(s.data);
4070
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4071
+ this.get_container()
4072
+ .children("ul").empty().append(d.children())
4073
+ .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
4074
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
4075
+ this.clean_node();
4076
+ }
4077
+ if(s_call) { s_call.call(this); }
4078
+ break;
4079
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
4080
+ obj = this._get_node(obj);
4081
+ error_func = function (x, t, e) {
4082
+ var ef = this.get_settings().html_data.ajax.error;
4083
+ if(ef) { ef.call(this, x, t, e); }
4084
+ if(obj != -1 && obj.length) {
4085
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4086
+ obj.removeData("jstree-is-loading");
4087
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
4088
+ }
4089
+ else {
4090
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
4091
+ }
4092
+ if(e_call) { e_call.call(this); }
4093
+ };
4094
+ success_func = function (d, t, x) {
4095
+ var sf = this.get_settings().html_data.ajax.success;
4096
+ if(sf) { d = sf.call(this,d,t,x) || d; }
4097
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {
4098
+ return error_func.call(this, x, t, "");
4099
+ }
4100
+ if(d) {
4101
+ d = $(d);
4102
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4103
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
4104
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.removeData("jstree-is-loading"); }
4105
+ this.clean_node(obj);
4106
+ if(s_call) { s_call.call(this); }
4107
+ }
4108
+ else {
4109
+ if(obj && obj !== -1) {
4110
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4111
+ obj.removeData("jstree-is-loading");
4112
+ if(s.correct_state) {
4113
+ this.correct_state(obj);
4114
+ if(s_call) { s_call.call(this); }
4115
+ }
4116
+ }
4117
+ else {
4118
+ if(s.correct_state) {
4119
+ this.get_container().children("ul").empty();
4120
+ if(s_call) { s_call.call(this); }
4121
+ }
4122
+ }
4123
+ }
4124
+ };
4125
+ s.ajax.context = this;
4126
+ s.ajax.error = error_func;
4127
+ s.ajax.success = success_func;
4128
+ if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
4129
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
4130
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
4131
+ $.ajax(s.ajax);
4132
+ break;
4133
+ }
4134
+ }
4135
+ }
4136
+ });
4137
+ // include the HTML data plugin by default
4138
+ $.jstree.defaults.plugins.push("html_data");
4139
+ })(jQuery);
4140
+ //*/
4141
+
4142
+ /*
4143
+ * jsTree themeroller plugin
4144
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
4145
+ */
4146
+ (function ($) {
4147
+ $.jstree.plugin("themeroller", {
4148
+ __init : function () {
4149
+ var s = this._get_settings().themeroller;
4150
+ this.get_container()
4151
+ .addClass("ui-widget-content")
4152
+ .addClass("jstree-themeroller")
4153
+ .delegate("a","mouseenter.jstree", function (e) {
4154
+ if(!$(e.currentTarget).hasClass("jstree-loading")) {
4155
+ $(this).addClass(s.item_h);
4156
+ }
4157
+ })
4158
+ .delegate("a","mouseleave.jstree", function () {
4159
+ $(this).removeClass(s.item_h);
4160
+ })
4161
+ .bind("init.jstree", $.proxy(function (e, data) {
4162
+ data.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh");
4163
+ this._themeroller(data.inst.get_container().find("> ul > li"));
4164
+ }, this))
4165
+ .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
4166
+ this._themeroller(data.rslt.obj);
4167
+ }, this))
4168
+ .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
4169
+ this._themeroller();
4170
+ }, this))
4171
+ .bind("close_node.jstree", $.proxy(function (e, data) {
4172
+ this._themeroller(data.rslt.obj);
4173
+ }, this))
4174
+ .bind("delete_node.jstree", $.proxy(function (e, data) {
4175
+ this._themeroller(data.rslt.parent);
4176
+ }, this))
4177
+ .bind("correct_state.jstree", $.proxy(function (e, data) {
4178
+ data.rslt.obj
4179
+ .children("ins.jstree-icon").removeClass(s.opened + " " + s.closed + " ui-icon").end()
4180
+ .find("> a > ins.ui-icon")
4181
+ .filter(function() {
4182
+ return this.className.toString()
4183
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4184
+ .indexOf("ui-icon-") === -1;
4185
+ }).removeClass(s.item_open + " " + s.item_clsd).addClass(s.item_leaf || "jstree-no-icon");
4186
+ }, this))
4187
+ .bind("select_node.jstree", $.proxy(function (e, data) {
4188
+ data.rslt.obj.children("a").addClass(s.item_a);
4189
+ }, this))
4190
+ .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
4191
+ this.get_container()
4192
+ .find("a." + s.item_a).removeClass(s.item_a).end()
4193
+ .find("a.jstree-clicked").addClass(s.item_a);
4194
+ }, this))
4195
+ .bind("dehover_node.jstree", $.proxy(function (e, data) {
4196
+ data.rslt.obj.children("a").removeClass(s.item_h);
4197
+ }, this))
4198
+ .bind("hover_node.jstree", $.proxy(function (e, data) {
4199
+ this.get_container()
4200
+ .find("a." + s.item_h).not(data.rslt.obj).removeClass(s.item_h);
4201
+ data.rslt.obj.children("a").addClass(s.item_h);
4202
+ }, this))
4203
+ .bind("move_node.jstree", $.proxy(function (e, data) {
4204
+ this._themeroller(data.rslt.o);
4205
+ this._themeroller(data.rslt.op);
4206
+ }, this));
4207
+ },
4208
+ __destroy : function () {
4209
+ var s = this._get_settings().themeroller,
4210
+ c = [ "ui-icon" ];
4211
+ $.each(s, function (i, v) {
4212
+ v = v.split(" ");
4213
+ if(v.length) { c = c.concat(v); }
4214
+ });
4215
+ this.get_container()
4216
+ .removeClass("ui-widget-content")
4217
+ .find("." + c.join(", .")).removeClass(c.join(" "));
4218
+ },
4219
+ _fn : {
4220
+ _themeroller : function (obj) {
4221
+ var s = this._get_settings().themeroller;
4222
+ obj = !obj || obj == -1 ? this.get_container_ul() : this._get_node(obj).parent();
4223
+ obj
4224
+ .find("li.jstree-closed")
4225
+ .children("ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
4226
+ .children("a").addClass(s.item)
4227
+ .children("ins.jstree-icon").addClass("ui-icon")
4228
+ .filter(function() {
4229
+ return this.className.toString()
4230
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4231
+ .indexOf("ui-icon-") === -1;
4232
+ }).removeClass(s.item_leaf + " " + s.item_open).addClass(s.item_clsd || "jstree-no-icon")
4233
+ .end()
4234
+ .end()
4235
+ .end()
4236
+ .end()
4237
+ .find("li.jstree-open")
4238
+ .children("ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
4239
+ .children("a").addClass(s.item)
4240
+ .children("ins.jstree-icon").addClass("ui-icon")
4241
+ .filter(function() {
4242
+ return this.className.toString()
4243
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4244
+ .indexOf("ui-icon-") === -1;
4245
+ }).removeClass(s.item_leaf + " " + s.item_clsd).addClass(s.item_open || "jstree-no-icon")
4246
+ .end()
4247
+ .end()
4248
+ .end()
4249
+ .end()
4250
+ .find("li.jstree-leaf")
4251
+ .children("ins.jstree-icon").removeClass(s.closed + " ui-icon " + s.opened).end()
4252
+ .children("a").addClass(s.item)
4253
+ .children("ins.jstree-icon").addClass("ui-icon")
4254
+ .filter(function() {
4255
+ return this.className.toString()
4256
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4257
+ .indexOf("ui-icon-") === -1;
4258
+ }).removeClass(s.item_clsd + " " + s.item_open).addClass(s.item_leaf || "jstree-no-icon");
4259
+ }
4260
+ },
4261
+ defaults : {
4262
+ "opened" : "ui-icon-triangle-1-se",
4263
+ "closed" : "ui-icon-triangle-1-e",
4264
+ "item" : "ui-state-default",
4265
+ "item_h" : "ui-state-hover",
4266
+ "item_a" : "ui-state-active",
4267
+ "item_open" : "ui-icon-folder-open",
4268
+ "item_clsd" : "ui-icon-folder-collapsed",
4269
+ "item_leaf" : "ui-icon-document"
4270
+ }
4271
+ });
4272
+ $(function() {
4273
+ var css_string = '' +
4274
+ '.jstree-themeroller .ui-icon { overflow:visible; } ' +
4275
+ '.jstree-themeroller a { padding:0 2px; } ' +
4276
+ '.jstree-themeroller .jstree-no-icon { display:none; }';
4277
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
4278
+ });
4279
+ })(jQuery);
4280
+ //*/
4281
+
4282
+ /*
4283
+ * jsTree unique plugin
4284
+ * Forces different names amongst siblings (still a bit experimental)
4285
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
4286
+ */
4287
+ (function ($) {
4288
+ $.jstree.plugin("unique", {
4289
+ __init : function () {
4290
+ this.get_container()
4291
+ .bind("before.jstree", $.proxy(function (e, data) {
4292
+ var nms = [], res = true, p, t;
4293
+ if(data.func == "move_node") {
4294
+ // obj, ref, position, is_copy, is_prepared, skip_check
4295
+ if(data.args[4] === true) {
4296
+ if(data.args[0].o && data.args[0].o.length) {
4297
+ data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
4298
+ res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o), "move_node");
4299
+ }
4300
+ }
4301
+ }
4302
+ if(data.func == "create_node") {
4303
+ // obj, position, js, callback, is_loaded
4304
+ if(data.args[4] || this._is_loaded(data.args[0])) {
4305
+ p = this._get_node(data.args[0]);
4306
+ if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
4307
+ p = this._get_parent(data.args[0]);
4308
+ if(!p || p === -1) { p = this.get_container(); }
4309
+ }
4310
+ if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
4311
+ else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_string("new_node")); }
4312
+ else { nms.push(data.args[2].data); }
4313
+ res = this._check_unique(nms, p.find("> ul > li"), "create_node");
4314
+ }
4315
+ }
4316
+ if(data.func == "rename_node") {
4317
+ // obj, val
4318
+ nms.push(data.args[1]);
4319
+ t = this._get_node(data.args[0]);
4320
+ p = this._get_parent(t);
4321
+ if(!p || p === -1) { p = this.get_container(); }
4322
+ res = this._check_unique(nms, p.find("> ul > li").not(t), "rename_node");
4323
+ }
4324
+ if(!res) {
4325
+ e.stopPropagation();
4326
+ return false;
4327
+ }
4328
+ }, this));
4329
+ },
4330
+ defaults : {
4331
+ error_callback : $.noop
4332
+ },
4333
+ _fn : {
4334
+ _check_unique : function (nms, p, func) {
4335
+ var cnms = [];
4336
+ p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
4337
+ if(!cnms.length || !nms.length) { return true; }
4338
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
4339
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
4340
+ this._get_settings().unique.error_callback.call(null, nms, p, func);
4341
+ return false;
4342
+ }
4343
+ return true;
4344
+ },
4345
+ check_move : function () {
4346
+ if(!this.__call_old()) { return false; }
4347
+ var p = this._get_move(), nms = [];
4348
+ if(p.o && p.o.length) {
4349
+ p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
4350
+ return this._check_unique(nms, p.np.find("> ul > li").not(p.o), "check_move");
4351
+ }
4352
+ return true;
4353
+ }
4354
+ }
4355
+ });
4356
+ })(jQuery);
4357
+ //*/
4358
+
4359
+ /*
4360
+ * jsTree wholerow plugin
4361
+ * Makes select and hover work on the entire width of the node
4362
+ * MAY BE HEAVY IN LARGE DOM
4363
+ */
4364
+ (function ($) {
4365
+ $.jstree.plugin("wholerow", {
4366
+ __init : function () {
4367
+ if(!this.data.ui) { throw "jsTree wholerow: jsTree UI plugin not included."; }
4368
+ this.data.wholerow.html = false;
4369
+ this.data.wholerow.to = false;
4370
+ this.get_container()
4371
+ .bind("init.jstree", $.proxy(function (e, data) {
4372
+ this._get_settings().core.animation = 0;
4373
+ }, this))
4374
+ .bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree", $.proxy(function (e, data) {
4375
+ this._prepare_wholerow_span( data && data.rslt && data.rslt.obj ? data.rslt.obj : -1 );
4376
+ }, this))
4377
+ .bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree", $.proxy(function (e, data) {
4378
+ if(this.data.to) { clearTimeout(this.data.to); }
4379
+ this.data.to = setTimeout( (function (t, o) { return function() { t._prepare_wholerow_ul(o); }; })(this, data && data.rslt && data.rslt.obj ? data.rslt.obj : -1), 0);
4380
+ }, this))
4381
+ .bind("deselect_all.jstree", $.proxy(function (e, data) {
4382
+ this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked " + (this.data.themeroller ? this._get_settings().themeroller.item_a : "" ));
4383
+ }, this))
4384
+ .bind("select_node.jstree deselect_node.jstree ", $.proxy(function (e, data) {
4385
+ data.rslt.obj.each(function () {
4386
+ var ref = data.inst.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt((($(this).offset().top - data.inst.get_container().offset().top + data.inst.get_container()[0].scrollTop) / data.inst.data.core.li_height),10)) + ")");
4387
+ // ref.children("a")[e.type === "select_node" ? "addClass" : "removeClass"]("jstree-clicked");
4388
+ ref.children("a").attr("class",data.rslt.obj.children("a").attr("class"));
4389
+ });
4390
+ }, this))
4391
+ .bind("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
4392
+ this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered " + (this.data.themeroller ? this._get_settings().themeroller.item_h : "" ));
4393
+ if(e.type === "hover_node") {
4394
+ var ref = this.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt(((data.rslt.obj.offset().top - this.get_container().offset().top + this.get_container()[0].scrollTop) / this.data.core.li_height),10)) + ")");
4395
+ // ref.children("a").addClass("jstree-hovered");
4396
+ ref.children("a").attr("class",data.rslt.obj.children(".jstree-hovered").attr("class"));
4397
+ }
4398
+ }, this))
4399
+ .delegate(".jstree-wholerow-span, ins.jstree-icon, li", "click.jstree", function (e) {
4400
+ var n = $(e.currentTarget);
4401
+ if(e.target.tagName === "A" || (e.target.tagName === "INS" && n.closest("li").is(".jstree-open, .jstree-closed"))) { return; }
4402
+ n.closest("li").children("a:visible:eq(0)").click();
4403
+ e.stopImmediatePropagation();
4404
+ })
4405
+ .delegate("li", "mouseover.jstree", $.proxy(function (e) {
4406
+ e.stopImmediatePropagation();
4407
+ if($(e.currentTarget).children(".jstree-hovered, .jstree-clicked").length) { return false; }
4408
+ this.hover_node(e.currentTarget);
4409
+ return false;
4410
+ }, this))
4411
+ .delegate("li", "mouseleave.jstree", $.proxy(function (e) {
4412
+ if($(e.currentTarget).children("a").hasClass("jstree-hovered").length) { return; }
4413
+ this.dehover_node(e.currentTarget);
4414
+ }, this));
4415
+ if(is_ie7 || is_ie6) {
4416
+ $.vakata.css.add_sheet({ str : ".jstree-" + this.get_index() + " { position:relative; } ", title : "jstree" });
4417
+ }
4418
+ },
4419
+ defaults : {
4420
+ },
4421
+ __destroy : function () {
4422
+ this.get_container().children(".jstree-wholerow").remove();
4423
+ this.get_container().find(".jstree-wholerow-span").remove();
4424
+ },
4425
+ _fn : {
4426
+ _prepare_wholerow_span : function (obj) {
4427
+ obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
4428
+ if(obj === false) { return; } // added for removing root nodes
4429
+ obj.each(function () {
4430
+ $(this).find("li").andSelf().each(function () {
4431
+ var $t = $(this);
4432
+ if($t.children(".jstree-wholerow-span").length) { return true; }
4433
+ $t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");
4434
+ });
4435
+ });
4436
+ },
4437
+ _prepare_wholerow_ul : function () {
4438
+ var o = this.get_container().children("ul").eq(0), h = o.html();
4439
+ o.addClass("jstree-wholerow-real");
4440
+ if(this.data.wholerow.last_html !== h) {
4441
+ this.data.wholerow.last_html = h;
4442
+ this.get_container().children(".jstree-wholerow").remove();
4443
+ this.get_container().append(
4444
+ o.clone().removeClass("jstree-wholerow-real")
4445
+ .wrapAll("<div class='jstree-wholerow' />").parent()
4446
+ .width(o.parent()[0].scrollWidth)
4447
+ .css("top", (o.height() + ( is_ie7 ? 5 : 0)) * -1 )
4448
+ .find("li[id]").each(function () { this.removeAttribute("id"); }).end()
4449
+ );
4450
+ }
4451
+ }
4452
+ }
4453
+ });
4454
+ $(function() {
4455
+ var css_string = '' +
4456
+ '.jstree .jstree-wholerow-real { position:relative; z-index:1; } ' +
4457
+ '.jstree .jstree-wholerow-real li { cursor:pointer; } ' +
4458
+ '.jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } ' +
4459
+ '.jstree .jstree-wholerow { position:relative; z-index:0; height:0; } ' +
4460
+ '.jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } ' +
4461
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } ' +
4462
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }' +
4463
+ '.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }' +
4464
+ '.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } ' +
4465
+ '.jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }';
4466
+ if(is_ff2) {
4467
+ css_string += '' +
4468
+ '.jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } ' +
4469
+ '.jstree .jstree-wholerow-real a { border-color:transparent !important; } ';
4470
+ }
4471
+ if(is_ie7 || is_ie6) {
4472
+ css_string += '' +
4473
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } ' +
4474
+ '.jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ';
4475
+ }
4476
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
4477
+ });
4478
+ })(jQuery);
4479
+ //*/
4480
+
4481
+ /*
4482
+ * jsTree model plugin
4483
+ * This plugin gets jstree to use a class model to retrieve data, creating great dynamism
4484
+ */
4485
+ (function ($) {
4486
+ var nodeInterface = ["getChildren","getChildrenCount","getAttr","getName","getProps"],
4487
+ validateInterface = function(obj, inter) {
4488
+ var valid = true;
4489
+ obj = obj || {};
4490
+ inter = [].concat(inter);
4491
+ $.each(inter, function (i, v) {
4492
+ if(!$.isFunction(obj[v])) { valid = false; return false; }
4493
+ });
4494
+ return valid;
4495
+ };
4496
+ $.jstree.plugin("model", {
4497
+ __init : function () {
4498
+ if(!this.data.json_data) { throw "jsTree model: jsTree json_data plugin not included."; }
4499
+ this._get_settings().json_data.data = function (n, b) {
4500
+ var obj = (n == -1) ? this._get_settings().model.object : n.data("jstree_model");
4501
+ if(!validateInterface(obj, nodeInterface)) { return b.call(null, false); }
4502
+ if(this._get_settings().model.async) {
4503
+ obj.getChildren($.proxy(function (data) {
4504
+ this.model_done(data, b);
4505
+ }, this));
4506
+ }
4507
+ else {
4508
+ this.model_done(obj.getChildren(), b);
4509
+ }
4510
+ };
4511
+ },
4512
+ defaults : {
4513
+ object : false,
4514
+ id_prefix : false,
4515
+ async : false
4516
+ },
4517
+ _fn : {
4518
+ model_done : function (data, callback) {
4519
+ var ret = [],
4520
+ s = this._get_settings(),
4521
+ _this = this;
4522
+
4523
+ if(!$.isArray(data)) { data = [data]; }
4524
+ $.each(data, function (i, nd) {
4525
+ var r = nd.getProps() || {};
4526
+ r.attr = nd.getAttr() || {};
4527
+ if(nd.getChildrenCount()) { r.state = "closed"; }
4528
+ r.data = nd.getName();
4529
+ if(!$.isArray(r.data)) { r.data = [r.data]; }
4530
+ if(_this.data.types && $.isFunction(nd.getType)) {
4531
+ r.attr[s.types.type_attr] = nd.getType();
4532
+ }
4533
+ if(r.attr.id && s.model.id_prefix) { r.attr.id = s.model.id_prefix + r.attr.id; }
4534
+ if(!r.metadata) { r.metadata = { }; }
4535
+ r.metadata.jstree_model = nd;
4536
+ ret.push(r);
4537
+ });
4538
+ callback.call(null, ret);
4539
+ }
4540
+ }
4541
+ });
4542
+ })(jQuery);
4543
+ //*/
4544
+
4545
+ })();
trunk/scripts/themes/wordpress/d.png ADDED
Binary file
trunk/scripts/themes/wordpress/d_old.png ADDED
Binary file
trunk/scripts/themes/wordpress/dot_for_ie.gif ADDED
Binary file
trunk/scripts/themes/wordpress/iconsxx.png ADDED
Binary file
trunk/scripts/themes/wordpress/style.css ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jsTree default theme 1.0
3
+ * Supported features: dots/no-dots, icons/no-icons, focused, loading
4
+ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
5
+ */
6
+
7
+ .jstree-wordpress li,
8
+ .jstree-wordpress ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }
9
+ .jstree-wordpress li { background-position:-90px 0; background-repeat:repeat-y; }
10
+ .jstree-wordpress li.jstree-last { background:transparent; }
11
+ .jstree-wordpress .jstree-open > ins { background-position:-72px 0; }
12
+ .jstree-wordpress .jstree-closed > ins { background-position:-54px 0; cursor: pointer; }
13
+ .jstree-wordpress .jstree-leaf > ins { background-position:-36px 0; }
14
+
15
+ .jstree-wordpress .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px; }
16
+ .jstree-wordpress .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; }
17
+ .jstree-wordpress a .jstree-icon { background-position:-56px -19px; }
18
+ .jstree-wordpress a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }
19
+
20
+ .jstree-wordpress.jstree-focused { /* background:#ffffee; */ }
21
+
22
+ .jstree-wordpress .jstree-no-dots li,
23
+ .jstree-wordpress .jstree-no-dots .jstree-leaf > ins { background:transparent; }
24
+ .jstree-wordpress .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
25
+ .jstree-wordpress .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
26
+
27
+ .jstree-wordpress .jstree-no-icons a .jstree-icon { display:none; }
28
+
29
+ .jstree-wordpress .jstree-search { /* font-style:italic; */ }
30
+
31
+ .jstree-wordpress .jstree-no-icons .checkbox { display:inline-block; }
32
+ .jstree-wordpress .jstree-no-checkboxes .checkbox { display:none !important; }
33
+ .jstree-wordpress .jstree-checked > a > .checkbox { background-position:-38px -19px; }
34
+ .jstree-wordpress .jstree-unchecked > a > .checkbox { background-position:-2px -19px; }
35
+ .jstree-wordpress .jstree-undetermined > a > .checkbox { background-position:-20px -19px; }
36
+ .jstree-wordpress .jstree-checked > a > .checkbox:hover { background-position:-38px -37px; }
37
+ .jstree-wordpress .jstree-unchecked > a > .checkbox:hover { background-position:-2px -37px; }
38
+ .jstree-wordpress .jstree-undetermined > a > .checkbox:hover { background-position:-20px -37px; }
39
+
40
+ #vakata-dragged.jstree-wordpress ins { background:transparent !important; }
41
+ #vakata-dragged.jstree-wordpress .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
42
+ #vakata-dragged.jstree-wordpress .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
43
+ #jstree-marker.jstree-wordpress { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
44
+
45
+ .jstree-wordpress a.jstree-search { font-weight: bold; background-color: #FFEFBA; }
46
+
47
+ #vakata-contextmenu.jstree-wordpress-context,
48
+ #vakata-contextmenu.jstree-wordpress-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
49
+ #vakata-contextmenu.jstree-wordpress-context li { }
50
+ #vakata-contextmenu.jstree-wordpress-context a { color:black; }
51
+ #vakata-contextmenu.jstree-wordpress-context a:hover,
52
+ #vakata-contextmenu.jstree-wordpress-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
53
+ #vakata-contextmenu.jstree-wordpress-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
54
+ #vakata-contextmenu.jstree-wordpress-context li ul { margin-left:-4px; }
55
+
56
+
57
+ /* IE6 BEGIN */
58
+ .jstree-wordpress li,
59
+ .jstree-wordpress ins,
60
+ #vakata-dragged.jstree-wordpress .jstree-invalid,
61
+ #vakata-dragged.jstree-wordpress .jstree-ok,
62
+ #jstree-marker.jstree-default { _background-image:url("d.gif"); }
63
+ .jstree-wordpress .jstree-open ins { _background-position:-72px 0; }
64
+ .jstree-wordpress .jstree-closed ins { _background-position:-54px 0; }
65
+ .jstree-wordpress .jstree-leaf ins { _background-position:-36px 0; }
66
+ .jstree-wordpress a ins.jstree-icon { _background-position:-56px -19px; }
67
+ #vakata-contextmenu.jstree-wordpress-context ins { _display:none; }
68
+ #vakata-contextmenu.jstree-wordpress-context li { _zoom:1; }
69
+ .jstree-wordpress .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; }
70
+ .jstree-wordpress .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; }
71
+ .jstree-wordpress .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }
72
+ /* IE6 END */
73
+
74
+
75
+ /* added by pär */
76
+ .jstree-wordpress li {
77
+ /*padding-top: 2px;
78
+ padding-bottom: 2px;*/
79
+ position: relative;
80
+ }
81
+ .jstree li.jstree-closed,
82
+ .jstree li.jstree-open
83
+ {
84
+ /* padding-top: 4px;
85
+ padding-bottom: 4px; */
86
+ }
87
+ .jstree li.hover a,
88
+ .jstree li a.hover
89
+ {
90
+ background-color: #e7f4f9;
91
+ }
trunk/scripts/themes/wordpress/throbber.gif ADDED
Binary file
trunk/styles/images/arrow-left.gif ADDED
Binary file
trunk/styles/images/help.gif ADDED
Binary file
trunk/styles/images/important.gif ADDED
Binary file
trunk/styles/images/info.gif ADDED
Binary file
trunk/styles/images/lock.png ADDED
Binary file
trunk/styles/images/title.gif ADDED
Binary file
trunk/styles/jquery.alerts.css ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #popup_container {
2
+ font-family: Arial, sans-serif;
3
+ font-size: 12px;
4
+ min-width: 300px; /* Dialog will be no smaller than this */
5
+ max-width: 600px; /* Dialog will wrap after this width */
6
+ background: #FFF;
7
+ border: solid 5px #999;
8
+ color: #000;
9
+ -moz-border-radius: 5px;
10
+ -webkit-border-radius: 5px;
11
+ border-radius: 5px;
12
+ }
13
+
14
+ #popup_title {
15
+ font-size: 14px;
16
+ font-weight: bold;
17
+ text-align: center;
18
+ line-height: 1.75em;
19
+ color: #666;
20
+ background: #CCC url(images/title.gif) top repeat-x;
21
+ border: solid 1px #FFF;
22
+ border-bottom: solid 1px #999;
23
+ cursor: default;
24
+ padding: 0em;
25
+ margin: 0em;
26
+ }
27
+
28
+ #popup_content {
29
+ background: 16px 16px no-repeat url(images/info.gif);
30
+ padding: 1em 1.75em;
31
+ margin: 0em;
32
+ }
33
+
34
+ #popup_content.alert {
35
+ background-image: url(images/info.gif);
36
+ }
37
+
38
+ #popup_content.confirm {
39
+ background-image: url(images/important.gif);
40
+ }
41
+
42
+ #popup_content.prompt {
43
+ background-image: url(images/help.gif);
44
+ }
45
+
46
+ #popup_message {
47
+ padding-left: 48px;
48
+ }
49
+
50
+ #popup_panel {
51
+ text-align: center;
52
+ margin: 1em 0em 0em 1em;
53
+ }
54
+
55
+ #popup_prompt {
56
+ margin: .5em 0em;
57
+ }
trunk/styles/styles.css ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*
3
+ #cms_tpv_dashboard_widget {
4
+ z-index: 10;
5
+ }
6
+ */
7
+
8
+
9
+ .cms_tpv_wrapper {
10
+ z-index: 10;
11
+ margin-right: 250px;
12
+ }
13
+
14
+ .postbox .cms_tpv_wrapper {
15
+ width: auto;
16
+ }
17
+
18
+ .cms_tpv_container {
19
+ /* clear: both; */
20
+ overflow: visible;
21
+ margin-top: 1.5em;
22
+ }
23
+
24
+ #wpbody-content .cms_tpv_container {
25
+ margin-right: 250px;
26
+ }
27
+
28
+ #dashboard-widgets-wrap .cms_tpv_container {
29
+ margin-right: 0;
30
+ }
31
+
32
+ .pages_page_cms-tpv-pages-page .updated {
33
+ clear: both;
34
+ }
35
+
36
+ .cms-tpv-subsubsub li {
37
+ display: inline;
38
+ }
39
+
40
+ .cms-tpv-subsubsub li a.current {
41
+ font-weight: bold;
42
+ text-decoration: none;
43
+ color: black;
44
+ }
45
+
46
+ .pages_page_cms-tpv-pages-page .cms-tpv-subsubsub li {
47
+ zoom: 1; /* weird ie-problems otherwise, like li-items that disappear on search. */
48
+ }
49
+
50
+ .cms_tpv_search_no_hits {
51
+ clear: both;
52
+ }
53
+
54
+ /*
55
+ span.cms_tpv_action_edit,
56
+ li span.cms_tpv_action_view,
57
+ li span.cms_tpv_action_add_page_after,
58
+ li span.cms_tpv_action_add_page_inside
59
+ {
60
+ display: none;
61
+ text-decoration: underline;
62
+ border: 0;
63
+ -moz-border-radius: 0;
64
+ -webkit-border-radius: 0;
65
+ border-radius: 0;
66
+ padding: 0 0 0 .5ex;
67
+
68
+ }
69
+ li span.cms_tpv_action_add_page {
70
+ display: none;
71
+ border: 0;
72
+ padding: 0 0 0 .5em;
73
+ color: #666;
74
+ }
75
+ */
76
+
77
+ .cms-tree-view-search
78
+ {
79
+ background-color: #ffefba;
80
+ font-weight: bold;
81
+ font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
82
+ font-size: 12px;
83
+ }
84
+
85
+
86
+ .jstree a ins {
87
+ cursor: move;
88
+ }
89
+
90
+ .tree-default li.open,
91
+ .tree-default li.closed
92
+ {
93
+ margin-top: 4px !important;
94
+ margin-bottom: 4px !important;
95
+ cursor: pointer;
96
+ }
97
+
98
+ .tree-default span.child_count {
99
+ background-color: transparent;
100
+ color: #999;
101
+ border: none;
102
+ font-size: .8em;
103
+ margin-left: .5em;
104
+ }
105
+
106
+ .tree-default span.post_protected {
107
+ display:inline-block;
108
+ margin:0 3px 0 0; padding:0;
109
+ width:16px; height:16px;
110
+ /* icon source => http://www.famfamfam.com/lab/icons/silk/ */
111
+ background:transparent url(images/lock.png) center no-repeat;
112
+ }
113
+
114
+
115
+ .tree-default span.post_type {
116
+ background-color: #f85b11;
117
+ -moz-border-radius: 3px;
118
+ -webkit-border-radius: 3px;
119
+ border-radius: 3px;
120
+ padding: 1px 4px 1px 4px;
121
+ color: white;
122
+ border: none;
123
+ font-size: .8em;
124
+ display: inline;
125
+ margin-right: .75ex;
126
+ }
127
+ .tree-default span.post_type_draft {
128
+
129
+ }
130
+ .tree-default span.post_type_password {
131
+ background-color: #25b61a;
132
+ }
133
+ .tree-default span.post_type_private {
134
+ background-color: #25b61a;
135
+ }
136
+ .tree-default span.post_type_pending,
137
+ .tree-default span.post_type_future
138
+ {
139
+ background-color: #0069e0;
140
+ }
141
+
142
+
143
+ #jstree-dragged {
144
+ background-color: white;
145
+ opacity: .9;
146
+ }
147
+
148
+ .cms_tpv_open_all {
149
+ margin-left: 1em;
150
+ }
151
+
152
+ .cms_tree_view_search_form {
153
+ display: inline;
154
+ position: relative;
155
+ margin-left: 1em;
156
+ white-space: nowrap;
157
+ }
158
+
159
+
160
+ #cms_tpv_dashboard_widget .cms_tree_view_search_form {
161
+ display: block;
162
+ margin-left: 0;
163
+ margin-top: .5em;
164
+ }
165
+
166
+ #cms_tpv_dashboard_widget .cms-tpv-subsubsub {
167
+ margin-top: -6px;
168
+ position: relative;
169
+ right: auto;
170
+ left: auto;
171
+ top: auto;
172
+ bottom: auto;
173
+ }
174
+
175
+ .cms_tree_view_search {
176
+ width: 130px;
177
+ }
178
+ .cms_tree_view_search_form_working,
179
+ .cms_tree_view_search_form_no_hits
180
+ {
181
+ position: absolute;
182
+ left: .5em;
183
+ top: 2em;
184
+ display: none;
185
+ }
186
+ .cms_tree_view_search_form_no_hits {
187
+ font-weight: bold;
188
+ }
189
+
190
+ .cms_tpv_working {
191
+ position: absolute;
192
+ line-height: 1;
193
+ display: none;
194
+ }
195
+
196
+ .cms_tree_view_search_form_reset {
197
+ display: none;
198
+ position: absolute;
199
+ top: 2px;
200
+ left: 112px;
201
+ width: 16px;
202
+ height: 16px;
203
+ background: transparent url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_cccccc_256x240.png) no-repeat -32px -194px;
204
+ text-indent: -9999px;
205
+ }
206
+ #cms_tpv_dashboard_widget .cms_tree_view_search_form_reset {
207
+ top: 8px;
208
+ }
209
+ .cms_tree_view_search_form_reset:hover {
210
+ background: transparent url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-lightness/images/ui-icons_222222_256x240.png) no-repeat -32px -194px;
211
+ }
212
+
213
+ .cms_tpv_annoying_little_box {
214
+ padding: 1em;
215
+ background-color: #FFFBCC;
216
+ border: 1px solid #E6DB55;
217
+ margin: 1em 0 1em 0;
218
+ -moz-border-radius: 6px;
219
+ -webkit-border-radius: 6px;
220
+ border-radius: 6px;
221
+ }
222
+ .cms_tpv_annoying_little_box p {
223
+ margin: 0 0 .5em 0;
224
+ }
225
+ p.cms_tpv_annoying_little_box_close {
226
+ float: right;
227
+ margin-left: 2em;
228
+ font-size: .8em;
229
+ margin-top: -1em;
230
+ margin-right: -.5em;
231
+ }
232
+
233
+ .cms_tpv_page_actions {
234
+ width: auto;
235
+ min-width: 125px;
236
+ height: auto;
237
+ background-color: white;
238
+ position: absolute;
239
+ top: 0;
240
+ white-space: normal;
241
+ z-index: 100;
242
+ padding: 7px;
243
+ display: none;
244
+ -moz-box-shadow: 2px 2px 8px #ddd; /* FF3.5+ */
245
+ border: 1px solid #bbb;
246
+ }
247
+ .cms_tpv_page_actions p {
248
+ margin: 0 0 .5em 0;
249
+ }
250
+ .cms_tpv_wrapper .cms_tpv_page_actions a {
251
+ display: inline;
252
+ background: transparent;
253
+ text-decoration: underline;
254
+ padding: 0;
255
+ color: #21759B;
256
+ }
257
+
258
+ .cms_tpv_wrapper .cms_tpv_page_actions a:hover
259
+ {
260
+ color: #d54e21;
261
+ }
262
+
263
+ .cms_tpv_page_actions ul {
264
+ display: block;
265
+ overflow: auto;
266
+ margin: 0 0 1em 0;
267
+ }
268
+ .cms_tpv_page_actions li {
269
+ padding: 0;
270
+ margin: 0;
271
+ background: none;
272
+ display: inline;
273
+ }
274
+ .cms_tpv_action_add_page {
275
+ display: block;
276
+ }
277
+ .cms_tpv_page_actions dl {
278
+ margin-top: 1em;
279
+ color: #333;
280
+ font-size: 11px;
281
+ }
282
+ .cms_tpv_page_actions dl dd {
283
+ }
284
+ .cms_tpv_page_actions dl dt {
285
+ color: #999;
286
+ }
287
+
288
+ .cms_tpv_page_actions_arrow {
289
+ width: 8px;
290
+ height: 15px;
291
+ background: url(images/arrow-left.gif) no-repeat top left;
292
+ position: absolute;
293
+ display: block;
294
+ top: 7px;
295
+ left: -8px;
296
+ }
297
+
298
+ .cms_tpv_page_actions_columns table td {
299
+ font-size: 11px;
300
+ }
301
+
302
+ .cms_tpv_page_actions_columns .vers {
303
+ display: inline;
304
+ padding-right: 2px;
305
+ vertical-align: middle;
306
+ }
307
+ .cms_tpv_page_actions_columns .post-com-count-wrapper {
308
+ }
309
+ .cms_tpv_wrapper .cms_tpv_page_actions_columns a.post-com-count {
310
+ }
311
+
312
+ li.cms_tpv_user_can_edit_page_no a {
313
+ opacity: .6; /* Standard: FF gt 1.5, Opera, Safari */
314
+ -ms-filter: "alpha(opacity=60)"; /* IE 8 */
315
+ }
316
+
317
+ .bonny-plugins-inner-sidebar {
318
+ float: right;
319
+ width: 210px;
320
+ padding-right: 10px;
321
+ padding-left: 10px;
322
+ border-left: 1px solid #E3E3E3;
323
+ }