1 | <?php |
---|
2 | namespace themes\ductile; |
---|
3 | |
---|
4 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
5 | # This file is part of Ductile, a theme for Dotclear |
---|
6 | # |
---|
7 | # Copyright (c) 2011 - Association Dotclear |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # See LICENSE file or |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # |
---|
12 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
13 | |
---|
14 | if (!defined('DC_RC_PATH')) { return; } |
---|
15 | // public part below |
---|
16 | |
---|
17 | if (!defined('DC_CONTEXT_ADMIN')) { return false; } |
---|
18 | // admin part below |
---|
19 | |
---|
20 | # Behaviors |
---|
21 | $GLOBALS['core']->addBehavior('adminPageHTMLHead',array(__NAMESPACE__.'\tplDuctileThemeAdmin','adminPageHTMLHead')); |
---|
22 | |
---|
23 | class tplDuctileThemeAdmin |
---|
24 | { |
---|
25 | public static function adminPageHTMLHead() |
---|
26 | { |
---|
27 | global $core; |
---|
28 | if ($core->blog->settings->system->theme != 'ductile') { return; } |
---|
29 | |
---|
30 | echo "\n".'<!-- Header directives for Ductile configuration -->'."\n"; |
---|
31 | $core->auth->user_prefs->addWorkspace('accessibility'); |
---|
32 | if (!$core->auth->user_prefs->accessibility->nodragdrop) { |
---|
33 | echo |
---|
34 | \dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
35 | \dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); |
---|
36 | echo <<<EOT |
---|
37 | <script type="text/javascript"> |
---|
38 | $(function() { |
---|
39 | $('#stickerslist').sortable({'cursor':'move'}); |
---|
40 | $('#stickerslist tr').hover(function () { |
---|
41 | $(this).css({'cursor':'move'}); |
---|
42 | }, function () { |
---|
43 | $(this).css({'cursor':'auto'}); |
---|
44 | }); |
---|
45 | $('#theme_config').submit(function() { |
---|
46 | var order=[]; |
---|
47 | $('#stickerslist tr td input.position').each(function() { |
---|
48 | order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1')); |
---|
49 | }); |
---|
50 | $('input[name=ds_order]')[0].value = order.join(','); |
---|
51 | return true; |
---|
52 | }); |
---|
53 | $('#stickerslist tr td input.position').hide(); |
---|
54 | $('#stickerslist tr td.handle').addClass('handler'); |
---|
55 | }); |
---|
56 | </script> |
---|
57 | EOT; |
---|
58 | } |
---|
59 | |
---|
60 | } |
---|
61 | } |
---|