Dotclear

source: themes/ductile/_prepend.php @ 3709:c88e69474c34

Revision 3709:c88e69474c34, 1.7 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

use strict and no more linter warnings/errors as far as possible, switch from inline js to separate loaded file

Line 
1<?php
2namespace 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
14if (!defined('DC_RC_PATH')) { return; }
15// public part below
16
17if (!defined('DC_CONTEXT_ADMIN')) { return false; }
18// admin part below
19
20# Behaviors
21$GLOBALS['core']->addBehavior('adminPageHTMLHead',array(__NAMESPACE__.'\tplDuctileThemeAdmin','adminPageHTMLHead'));
22
23class 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>
57EOT;
58          }
59
60     }
61}
Note: See TracBrowser for help on using the repository browser.

Sites map