Version Description
- link to "add new page" when there were no pages now work
- 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)
- added a thank-you-please-donate-box. please do what it says! :)
- started using menu_page_url instead of hard-coding path to plugin
- now requires WordPress 3
Download this release
Release Info
Developer | eskapism |
Plugin | CMS Tree Page View |
Version | 0.5.3 |
Comparing to | |
See all releases |
Code changes from version 0.5.2 to 0.5.3
- functions.php +40 -6
- images/signature.gif +0 -0
- index.php +2 -3
- readme.txt +12 -3
- scripts/cms_tree_page_view.js +41 -25
- scripts/jquery.alerts.js +235 -0
- scripts/themes/wordpress/d_old.png +0 -0
- styles/images/help.gif +0 -0
- styles/images/important.gif +0 -0
- styles/images/info.gif +0 -0
- styles/images/title.gif +0 -0
- styles/jquery.alerts.css +57 -0
- styles/styles.css +16 -0
functions.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
function cms_tpv_admin_head() {
|
|
|
4 |
global $cms_tpv_view;
|
5 |
if (isset($_GET["cms_tpv_view"])) {
|
6 |
$cms_tpv_view = $_GET["cms_tpv_view"];
|
@@ -29,9 +30,13 @@ function cms_tpv_admin_head() {
|
|
29 |
}
|
30 |
|
31 |
function cms_tpv_admin_init() {
|
|
|
|
|
32 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
|
|
33 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.cookie.js", array("jquery"));
|
34 |
wp_enqueue_script( "jquery-jstree", CMS_TPV_URL . "scripts/jquery.jstree.js", false, CMS_TPV_VERSION);
|
|
|
35 |
|
36 |
wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
|
37 |
$oLocale = array(
|
@@ -79,6 +84,7 @@ function cms_tpv_show_under_pages() {
|
|
79 |
*/
|
80 |
function cms_tpv_dashboard() {
|
81 |
|
|
|
82 |
cms_tpv_print_common_tree_stuff();
|
83 |
|
84 |
}
|
@@ -135,7 +141,7 @@ function cms_tpv_options() {
|
|
135 |
function cms_tpv_print_common_tree_stuff() {
|
136 |
$pages = cms_tpv_get_pages();
|
137 |
if (empty($pages)) {
|
138 |
-
echo '<div class="updated fade below-h2"><p>No pages found. Maybe you want to <a href=
|
139 |
} else {
|
140 |
// start the party!
|
141 |
global $cms_tpv_view;
|
@@ -177,21 +183,19 @@ function cms_tpv_print_common_tree_stuff() {
|
|
177 |
function cms_tpv_pages_page() {
|
178 |
?>
|
179 |
<div class="wrap">
|
180 |
-
|
181 |
<h2><?php echo CMS_TPV_NAME ?></h2>
|
182 |
-
|
183 |
<?php
|
|
|
|
|
184 |
cms_tpv_print_common_tree_stuff();
|
185 |
?>
|
186 |
-
|
187 |
</div>
|
188 |
<?php
|
189 |
}
|
190 |
|
191 |
/**
|
192 |
* Stripped down code from get_pages. Modified to get drafts and some other stuff too.
|
193 |
-
*
|
194 |
-
* @todo: cache, check permissions for private pages
|
195 |
*/
|
196 |
function cms_tpv_get_pages($args = null) {
|
197 |
|
@@ -550,6 +554,36 @@ function cms_tpv_move_page() {
|
|
550 |
exit;
|
551 |
}
|
552 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
if (!function_exists("bonny_d")) {
|
554 |
function bonny_d($var) {
|
555 |
echo "<pre>";
|
1 |
<?php
|
2 |
|
3 |
function cms_tpv_admin_head() {
|
4 |
+
|
5 |
global $cms_tpv_view;
|
6 |
if (isset($_GET["cms_tpv_view"])) {
|
7 |
$cms_tpv_view = $_GET["cms_tpv_view"];
|
30 |
}
|
31 |
|
32 |
function cms_tpv_admin_init() {
|
33 |
+
|
34 |
+
define( "CMS_TPV_PAGE_FILE", menu_page_url("cms-tpv-pages-page", false)); // this no longer feels nasty! :)
|
35 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
36 |
+
wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
|
37 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.cookie.js", array("jquery"));
|
38 |
wp_enqueue_script( "jquery-jstree", CMS_TPV_URL . "scripts/jquery.jstree.js", false, CMS_TPV_VERSION);
|
39 |
+
wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
|
40 |
|
41 |
wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
|
42 |
$oLocale = array(
|
84 |
*/
|
85 |
function cms_tpv_dashboard() {
|
86 |
|
87 |
+
cms_tpv_show_annoying_box();
|
88 |
cms_tpv_print_common_tree_stuff();
|
89 |
|
90 |
}
|
141 |
function cms_tpv_print_common_tree_stuff() {
|
142 |
$pages = cms_tpv_get_pages();
|
143 |
if (empty($pages)) {
|
144 |
+
echo '<div class="updated fade below-h2"><p>' . __("No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?", 'cms-tree-page-view') . '</p></div>';
|
145 |
} else {
|
146 |
// start the party!
|
147 |
global $cms_tpv_view;
|
183 |
function cms_tpv_pages_page() {
|
184 |
?>
|
185 |
<div class="wrap">
|
|
|
186 |
<h2><?php echo CMS_TPV_NAME ?></h2>
|
187 |
+
|
188 |
<?php
|
189 |
+
cms_tpv_show_annoying_box();
|
190 |
+
|
191 |
cms_tpv_print_common_tree_stuff();
|
192 |
?>
|
|
|
193 |
</div>
|
194 |
<?php
|
195 |
}
|
196 |
|
197 |
/**
|
198 |
* Stripped down code from get_pages. Modified to get drafts and some other stuff too.
|
|
|
|
|
199 |
*/
|
200 |
function cms_tpv_get_pages($args = null) {
|
201 |
|
554 |
exit;
|
555 |
}
|
556 |
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Show a box with some dontate-links and stuff
|
560 |
+
*/
|
561 |
+
function cms_tpv_show_annoying_box() {
|
562 |
+
#update_option('cms_tpv_show_annoying_little_box', 1); // enable this to show box
|
563 |
+
if ( "cms_tpv_remove_annoying_box" == $_GET["action"] ) {
|
564 |
+
$show_box = 0;
|
565 |
+
update_option('cms_tpv_show_annoying_little_box', $show_box);
|
566 |
+
} else {
|
567 |
+
$show_box = get_option('cms_tpv_show_annoying_little_box', 1);
|
568 |
+
}
|
569 |
+
if ($show_box) {
|
570 |
+
?>
|
571 |
+
<div id="cms_tpv_annoying_little_box">
|
572 |
+
<p id="cms_tpv_annoying_little_box_close"><a href="<?php echo CMS_TPV_PAGE_FILE ?>&action=cms_tpv_remove_annoying_box">Close</a></p>
|
573 |
+
<p><strong>Thank you for using my 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>.</p>
|
574 |
+
<p>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.</p>
|
575 |
+
<!-- <p>Thank you</p>
|
576 |
+
<p><img src="<?php echo CMS_TPV_URL ?>/images/signature.gif" alt="Pär Thernström's signature" /></p>
|
577 |
+
<p>Pär Thernström
|
578 |
+
<br /><a href="mailto:par.thernstrom@gmail.com">par.thernstrom@gmail.com</a>
|
579 |
+
<br /><a href="twitter.com/eskapism">twitter.com/eskapism</a>
|
580 |
+
</p> -->
|
581 |
+
</div>
|
582 |
+
<?php
|
583 |
+
}
|
584 |
+
}
|
585 |
+
|
586 |
+
|
587 |
if (!function_exists("bonny_d")) {
|
588 |
function bonny_d($var) {
|
589 |
echo "<pre>";
|
images/signature.gif
ADDED
Binary file
|
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. By using the tree you can edit, view, add pages and even search pages (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.5.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -28,10 +28,9 @@ License: GPL2
|
|
28 |
|
29 |
require("functions.php");
|
30 |
|
|
|
31 |
define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
|
32 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
33 |
-
define( "CMS_TPV_VERSION", "0.5.2");
|
34 |
-
define( "CMS_TPV_PAGE_FILE", "edit-pages.php?page=cms-tpv-pages-page"); // this feels nasty
|
35 |
|
36 |
// on admin init: add styles and scripts
|
37 |
add_action( 'admin_init', 'cms_tpv_admin_init' );
|
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. By using the tree you can edit, view, add pages and even search pages (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.5.3
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
28 |
|
29 |
require("functions.php");
|
30 |
|
31 |
+
define( "CMS_TPV_VERSION", "0.5.3");
|
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' );
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: eskapism
|
3 |
Donate link: http://eskapism.se/sida/donate/
|
4 |
Tags: page, pages, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Adds a CMS-like tree overview of all your pages. Edit, view, add pages, search pages, and drag and drop to rearrange the order of your pages.
|
@@ -15,6 +15,8 @@ Within this page tree you can edit pages, view pages, add pages, search pages, a
|
|
15 |
|
16 |
Page management won't get any easier than this!
|
17 |
|
|
|
|
|
18 |
#### Features and highlights:
|
19 |
|
20 |
* drag and drop to rearrange your pages
|
@@ -45,8 +47,15 @@ Now the tree with the pages will be visible both on the dashboard and in the men
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
= 0.5.2 =
|
49 |
-
- you
|
50 |
|
51 |
= 0.5.1 =
|
52 |
- forgot to add styles to svn
|
2 |
Contributors: eskapism
|
3 |
Donate link: http://eskapism.se/sida/donate/
|
4 |
Tags: page, pages, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.0
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Adds a CMS-like tree overview of all your pages. Edit, view, add pages, search pages, and drag and drop to rearrange the order of your pages.
|
15 |
|
16 |
Page management won't get any easier than this!
|
17 |
|
18 |
+
Please note that this plugin now requires WordPress 3. If you are using WordPress 2.x you can try this old version instead: http://downloads.wordpress.org/plugin/cms-tree-page-view.0.4.9.zip
|
19 |
+
|
20 |
#### Features and highlights:
|
21 |
|
22 |
* drag and drop to rearrange your pages
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 0.5.3 =
|
51 |
+
- link to "add new page" when there were no pages now work
|
52 |
+
- 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)
|
53 |
+
- added a thank-you-please-donate-box. please do what it says! :)
|
54 |
+
- started using menu_page_url instead of hard-coding path to plugin
|
55 |
+
- now requires WordPress 3
|
56 |
+
|
57 |
= 0.5.2 =
|
58 |
+
- 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.)
|
59 |
|
60 |
= 0.5.1 =
|
61 |
- forgot to add styles to svn
|
scripts/cms_tree_page_view.js
CHANGED
@@ -80,35 +80,40 @@ jQuery(".cms_tpv_action_edit").live("click", function() {
|
|
80 |
|
81 |
// add page after
|
82 |
jQuery(".cms_tpv_action_add_page_after").live("click", function() {
|
83 |
-
var
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
95 |
return false;
|
96 |
});
|
97 |
|
98 |
// add page inside
|
99 |
jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
|
100 |
-
var
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
112 |
return false;
|
113 |
});
|
114 |
|
@@ -300,10 +305,21 @@ jQuery("#cms_tvp_view_public").live("click", function() {
|
|
300 |
jQuery(this).addClass("current");
|
301 |
return false;
|
302 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
function cms_tvp_set_view(view) {
|
304 |
jQuery("#cms_tvp_view_all,#cms_tvp_view_public").removeClass("current");
|
305 |
jQuery("#cms_tpv_container").jstree("destroy").html("");
|
306 |
cms_tpv_bind_clean_node();
|
307 |
treeOptions.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view;
|
308 |
cms_tpv_tree.jstree(treeOptions);
|
309 |
-
}
|
|
80 |
|
81 |
// add page after
|
82 |
jQuery(".cms_tpv_action_add_page_after").live("click", function() {
|
83 |
+
var $this = jQuery(this);
|
84 |
+
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
85 |
+
if (new_page_title) {
|
86 |
+
var pageID = $this.closest("li").attr("id");
|
87 |
+
jQuery.post(ajaxurl, {
|
88 |
+
action: "cms_tpv_add_page",
|
89 |
+
pageID: pageID,
|
90 |
+
type: "after",
|
91 |
+
page_title: new_page_title
|
92 |
+
}, function(data, textStatus) {
|
93 |
+
document.location = data;
|
94 |
+
});
|
95 |
+
}
|
96 |
+
});
|
97 |
+
|
98 |
return false;
|
99 |
});
|
100 |
|
101 |
// add page inside
|
102 |
jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
|
103 |
+
var $this = jQuery(this);
|
104 |
+
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
105 |
+
if (new_page_title) {
|
106 |
+
var pageID = $this.closest("li").attr("id");
|
107 |
+
jQuery.post(ajaxurl, {
|
108 |
+
action: "cms_tpv_add_page",
|
109 |
+
pageID: pageID,
|
110 |
+
type: "inside",
|
111 |
+
page_title: new_page_title
|
112 |
+
}, function(data, textStatus) {
|
113 |
+
document.location = data;
|
114 |
+
});
|
115 |
+
}
|
116 |
+
});
|
117 |
return false;
|
118 |
});
|
119 |
|
305 |
jQuery(this).addClass("current");
|
306 |
return false;
|
307 |
});
|
308 |
+
|
309 |
+
// premium-link
|
310 |
+
/*
|
311 |
+
jQuery("#cms_tpv_upgrade_box_link").live("click", function() {
|
312 |
+
jQuery("#cms_tpv_upgrade_box").toggle();
|
313 |
+
return false;
|
314 |
+
});
|
315 |
+
*/
|
316 |
+
|
317 |
+
|
318 |
function cms_tvp_set_view(view) {
|
319 |
jQuery("#cms_tvp_view_all,#cms_tvp_view_public").removeClass("current");
|
320 |
jQuery("#cms_tpv_container").jstree("destroy").html("");
|
321 |
cms_tpv_bind_clean_node();
|
322 |
treeOptions.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view;
|
323 |
cms_tpv_tree.jstree(treeOptions);
|
324 |
+
}
|
325 |
+
|
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: ' OK ', // text for the OK button
|
40 |
+
cancelButton: ' Cancel ', // 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);
|
scripts/themes/wordpress/d_old.png
ADDED
Binary file
|
styles/images/help.gif
ADDED
Binary file
|
styles/images/important.gif
ADDED
Binary file
|
styles/images/info.gif
ADDED
Binary file
|
styles/images/title.gif
ADDED
Binary file
|
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 |
+
}
|
styles/styles.css
CHANGED
@@ -190,3 +190,19 @@ li span.cms_tpv_action_add_page {
|
|
190 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_454545_256x240.png) no-repeat -32px -194px;
|
191 |
}
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_454545_256x240.png) no-repeat -32px -194px;
|
191 |
}
|
192 |
|
193 |
+
#cms_tpv_annoying_little_box {
|
194 |
+
padding: 1em;
|
195 |
+
background-color: #FFFFE0;
|
196 |
+
border: 1px solid #E6DB55;
|
197 |
+
margin: 1em 0 1em 0;
|
198 |
+
}
|
199 |
+
#cms_tpv_annoying_little_box p {
|
200 |
+
margin: 0 0 .5em 0;
|
201 |
+
}
|
202 |
+
p#cms_tpv_annoying_little_box_close {
|
203 |
+
float: right;
|
204 |
+
margin-left: 2em;
|
205 |
+
font-size: .8em;
|
206 |
+
margin-top: -1em;
|
207 |
+
margin-right: -.5em;
|
208 |
+
}
|