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

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

Sites map