Dotclear


Ignore:
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r3918 r3947  
    149149# Dashboard drag'n'drop switch for its elements 
    150150$core->auth->user_prefs->addWorkspace('accessibility'); 
    151 $dragndrop = ''; 
     151$dragndrop      = ''; 
     152$dragndrop_head = ''; 
     153$dragndrop_msg  = [ 
     154    'dragndrop_off' => __('Dashboard area\'s drag and drop is disabled'), 
     155    'dragndrop_on'  => __('Dashboard area\'s drag and drop is enabled') 
     156]; 
    152157if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
    153     $dragndrop = 
    154     '<script type="text/javascript">' . "\n" . 
    155     dcPage::jsVar('dotclear.dragndrop_off', __('Dashboard area\'s drag and drop is disabled')) . "\n" . 
    156     dcPage::jsVar('dotclear.dragndrop_on', __('Dashboard area\'s drag and drop is enabled')) . "\n" . 
    157     "</script>\n" . 
    158     '<input type="checkbox" id="dragndrop" class="sr-only" title="' . 
    159         __('Dashboard area\'s drag and drop is disabled') . '" />' . 
     158    $dragndrop_head = dcPage::jsJson('dotclear_dragndrop', $dragndrop_msg); 
     159    $dragndrop      = 
     160    '<input type="checkbox" id="dragndrop" class="sr-only" title="' . $dragndrop_msg['dragndrop_off'] . '" />' . 
    160161    '<label for="dragndrop">' . 
    161162    '<svg aria-hidden="true" focusable="false" class="dragndrop-svg">' . 
    162163    '<use xlink:href="images/dragndrop.svg#mask"></use>' . 
    163164    '</svg>' . 
    164     '<span id="dragndrop-label" class="sr-only">' . __('Dashboard area\'s drag and drop is disabled') . '</span>' . 
    165     '</label>'; 
     165    '<span id="dragndrop-label" class="sr-only">' . $dragndrop_msg['dragndrop_off'] . '</span>' . 
     166        '</label>'; 
    166167} 
    167168 
     
    172173    dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') . 
    173174    dcPage::jsLoad('js/_index.js') . 
     175    $dragndrop_head . 
    174176    $admin_post_behavior . 
    175177    # --BEHAVIOR-- adminDashboardHeaders 
  • admin/js/_index.js

    r3936 r3947  
    1 /*global $, dotclear, jsToolBar */ 
     1/*global $, dotclear, jsToolBar, getData */ 
    22'use strict'; 
    33 
     
    249249    // Set or reset sortable depending on #dragndrop checbkox value 
    250250    $('#dragndrop').click(function() { 
     251      Object.assign(dotclear, getData('dotclear_dragndrop')); 
    251252      if ($(this).is(':checked')) { 
    252253        // Activate sorting feature 
  • admin/js/prepend.js

    r3930 r3945  
    1 /*exported getData */ 
     1/*exported getData, isObject, mergeDeep */ 
    22'use strict'; 
    33 
     
    1818  return data; 
    1919} 
     20 
     21function isObject(item) { 
     22  return (item && typeof item === 'object' && !Array.isArray(item)); 
     23} 
     24 
     25/** 
     26 * Deep merge two objects. 
     27 * @param target 
     28 * @param ...sources 
     29 */ 
     30function mergeDeep(target, ...sources) { 
     31  if (!sources.length) return target; 
     32  const source = sources.shift(); 
     33  if (isObject(target) && isObject(source)) { 
     34    for (const key in source) { 
     35      if (isObject(source[key])) { 
     36        if (!target[key]) Object.assign(target, { [key]: {} }); 
     37        mergeDeep(target[key], source[key]); 
     38      } else { 
     39        Object.assign(target, { [key]: source[key] }); 
     40      } 
     41    } 
     42  } 
     43  return mergeDeep(target, ...sources); 
     44} 
  • admin/style/default-dark.css

    r3935 r3943  
    32473247  background-color: #4c4d4f; } 
    32483248 
    3249 .ui-sortable-handle { 
     3249div.ui-sortable-handle { 
    32503250  border: 1px dashed currentColor !important; 
    32513251  border-radius: .75em !important; } 
  • admin/style/default.css

    r3935 r3943  
    32473247  background-color: #f3f3f3; } 
    32483248 
    3249 .ui-sortable-handle { 
     3249div.ui-sortable-handle { 
    32503250  border: 1px dashed currentColor !important; 
    32513251  border-radius: .75em !important; } 
  • admin/style/scss/partials/_utils.scss

    r3935 r3943  
    88} 
    99 
    10 .ui-sortable-handle { 
     10div.ui-sortable-handle { 
    1111  border: 1px dashed currentColor !important; 
    1212  border-radius: .75em !important; 
  • inc/admin/lib.dc.page.php

    r3934 r3946  
    7575            $blog_box = '<p><label for="switchblog" class="classic">' . __('Blogs:') . '</label> ' . 
    7676            $core->formNonce() . form::combo('switchblog', $blogs, $core->blog->id) . 
     77            form::hidden(['redir'], $_SERVER['REQUEST_URI']) . 
    7778            '<input type="submit" value="' . __('ok') . '" class="hidden-if-js" /></p>'; 
    7879        } 
  • inc/admin/prepend.php

    r3923 r3946  
    135135        } 
    136136 
    137         # Removing switchblog from URL 
    138         $redir = $_SERVER['REQUEST_URI']; 
    139         $redir = preg_replace('/switchblog=(.*?)(&|$)/', '', $redir); 
    140         $redir = preg_replace('/\?$/', '', $redir); 
     137        if (!empty($_REQUEST['redir'])) { 
     138            # Keep context as far as possible 
     139            $redir = $_REQUEST['redir']; 
     140        } else { 
     141            # Removing switchblog from URL 
     142            $redir = $_SERVER['REQUEST_URI']; 
     143            $redir = preg_replace('/switchblog=(.*?)(&|$)/', '', $redir); 
     144            $redir = preg_replace('/\?$/', '', $redir); 
     145        } 
    141146        http::redirect($redir); 
    142147        exit; 
  • inc/public/default-templates/dotty/_top.html

    r3246 r3949  
    1 <header class="header"> 
    2      <nav role="navigation"> 
     1<div class="header"> 
    32          <ul class="skip-links" id="prelude"> 
    43               <li><a href="#main">{{tpl:lang To content}}</a></li> 
     
    65               <li><a href="#search">{{tpl:lang To search}}</a></li> 
    76          </ul> 
    8      </nav> 
    97 
    10      <div class="banner" role="banner"> 
     8     <header class="banner" role="banner"> 
    119          <h1 class="site-title"><a class="site-title__link" 
    1210               href="{{tpl:BlogURL}}"><span class="site-title__text">{{tpl:BlogName encode_html="1"}}</span></a></h1> 
    1311          <p class="site-baseline">{{tpl:BlogDescription}}</p> 
    14      </div> 
     12     </header> 
    1513 
    1614     <!-- # --BEHAVIOR-- publicTopAfterContent --> 
     
    1816 
    1917     {{tpl:SimpleMenu class="nav header__nav"}} 
    20 </header> 
     18</div> 
  • plugins/dcLegacyEditor/inc/dc.legacy.editor.behaviors.php

    r3915 r3945  
    2626        if (empty($editor) || $editor != 'dcLegacyEditor') {return;} 
    2727 
     28        $js = [ 
     29            'legacy_editor_context' => $context, 
     30            'legacy_editor_syntax' => $syntax, 
     31            'legacy_editor_tags_context' => [$context => $tags] 
     32        ]; 
     33 
    2834        return 
    2935        self::jsToolBar() . 
    30         dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/_post_editor.js')) . 
    31         '<script type="text/javascript">' . "\n" . 
    32         dcPage::jsVar('dotclear.legacy_editor_context', $context) . 
    33         dcPage::jsVar('dotclear.legacy_editor_syntax', $syntax) . 
    34         'dotclear.legacy_editor_tags_context = ' . sprintf('{%s:["%s"]};' . "\n", $context, implode('","', $tags)) . "\n" . 
    35             "</script>\n"; 
     36        dcPage::jsJson('legacy_editor_ctx', $js) . 
     37        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/_post_editor.js')); 
    3638    } 
    3739 
     
    5961    protected static function jsToolBar() 
    6062    { 
     63        $rtl = l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction: rtl;' : ''; 
     64        $css = <<<EOT 
     65body { 
     66    color: #000; 
     67    background: #f9f9f9; 
     68    margin: 0; 
     69    padding: 2px; 
     70    border: none; 
     71    $rtl 
     72} 
     73code { 
     74    color: #666; 
     75    font-weight: bold; 
     76} 
     77body > p:first-child { 
     78    margin-top: 0; 
     79} 
     80EOT; 
     81        $js = [ 
     82            'dialog_url'            => 'popup.php', 
     83            'iframe_css'            => $css, 
     84            'base_url'              => $GLOBALS['core']->blog->host, 
     85            'switcher_visual_title' => __('visual'), 
     86            'switcher_source_title' => __('source'), 
     87            'legend_msg'            => __('You can use the following shortcuts to format your text.'), 
     88            'elements'              => [ 
     89                    'blocks' => ['options' => [ 
     90                        'none' => __('-- none --'), 
     91                        'nonebis' => __('-- block format --'), 
     92                        'p' => __('Paragraph'), 
     93                        'h1' => __('Level 1 header'), 
     94                        'h2' => __('Level 2 header'), 
     95                        'h3' => __('Level 3 header'), 
     96                        'h4' => __('Level 4 header'), 
     97                        'h5' => __('Level 5 header'), 
     98                        'h6' => __('Level 6 header'), 
     99                    ]], 
     100 
     101                    'strong' => ['title' => __('Strong emphasis')], 
     102                    'em' => ['title' => __('Emphasis')], 
     103                    'ins' => ['title' => __('Inserted')], 
     104                    'del' => ['title' => __('Deleted')], 
     105                    'quote' => ['title' => __('Inline quote')], 
     106                    'code' => ['title' => __('Code')], 
     107                    'mark' => ['title' => __('Mark')], 
     108                    'br' => ['title' => __('Line break')], 
     109                    'blockquote' => ['title' => __('Blockquote')], 
     110                    'pre' => ['title' => __('Preformated text')], 
     111                    'ul' => ['title' => __('Unordered list')], 
     112                    'ol' => ['title' => __('Ordered list')], 
     113 
     114                    'link' => [ 
     115                        'title' => __('Link'), 
     116                        'accesskey' => __('l'), 
     117                        'href_prompt' => __('URL?'), 
     118                        'hreflang_prompt' => __('Language?') 
     119                    ], 
     120 
     121                    'img' => [ 
     122                        'title' => __('External image'), 
     123                        'src_prompt' => __('URL?') 
     124                    ], 
     125 
     126                    'img_select' => [ 
     127                        'title' => __('Media chooser'), 
     128                        'accesskey' => __('m') 
     129                    ], 
     130 
     131                    'post_link' => ['title' => __('Link to an entry')], 
     132                    'removeFormat' => ['title' => __('Remove text formating')] 
     133            ], 
     134            'toolbar_bottom' => (boolean) isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('toolbar_bottom') 
     135        ]; 
     136        if (!$GLOBALS['core']->auth->check('media,media_admin', $GLOBALS['core']->blog->id)) { 
     137            $js['elements']['img_select']['disabled'] = true; 
     138        } 
     139 
    61140        $res = 
     141        dcPage::jsJson('legacy_editor', $js) . 
    62142        dcPage::cssLoad(dcPage::getPF('dcLegacyEditor/css/jsToolBar/jsToolBar.css')) . 
    63143        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.js')); 
     
    69149        $res .= 
    70150        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.dotclear.js')) . 
    71         '<script type="text/javascript">' . "\n" . 
    72         "jsToolBar.prototype.dialog_url = 'popup.php'; " . "\n" . 
    73         "jsToolBar.prototype.iframe_css = '" . 
    74         'body {' . 
    75         '   color: #000;' . 
    76         '   background: #f9f9f9;' . 
    77         '   margin: 0;' . 
    78         '   padding: 2px;' . 
    79         '   border: none;' . 
    80         (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? ' direction: rtl;' : '') . 
    81         '}' . 
    82         'code {' . 
    83         '   color: #666;' . 
    84         '   font-weight: bold;' . 
    85         '}' . 
    86         'body > p:first-child {' . 
    87         '   margin-top: 0;' . 
    88         '}' . 
    89         "'; " . "\n" . 
    90         "jsToolBar.prototype.base_url = '" . html::escapeJS($GLOBALS['core']->blog->host) . "'; " . "\n" . 
    91         "jsToolBar.prototype.switcher_visual_title = '" . html::escapeJS(__('visual')) . "'; " . "\n" . 
    92         "jsToolBar.prototype.switcher_source_title = '" . html::escapeJS(__('source')) . "'; " . "\n" . 
    93         "jsToolBar.prototype.legend_msg = '" . 
    94         html::escapeJS(__('You can use the following shortcuts to format your text.')) . "'; " . "\n" . 
    95         "jsToolBar.prototype.elements.blocks.options.none = '" . html::escapeJS(__('-- none --')) . "'; " . "\n" . 
    96         "jsToolBar.prototype.elements.blocks.options.nonebis = '" . html::escapeJS(__('-- block format --')) . "'; " . "\n" . 
    97         "jsToolBar.prototype.elements.blocks.options.p = '" . html::escapeJS(__('Paragraph')) . "'; " . "\n" . 
    98         "jsToolBar.prototype.elements.blocks.options.h1 = '" . html::escapeJS(__('Level 1 header')) . "'; " . "\n" . 
    99         "jsToolBar.prototype.elements.blocks.options.h2 = '" . html::escapeJS(__('Level 2 header')) . "'; " . "\n" . 
    100         "jsToolBar.prototype.elements.blocks.options.h3 = '" . html::escapeJS(__('Level 3 header')) . "'; " . "\n" . 
    101         "jsToolBar.prototype.elements.blocks.options.h4 = '" . html::escapeJS(__('Level 4 header')) . "'; " . "\n" . 
    102         "jsToolBar.prototype.elements.blocks.options.h5 = '" . html::escapeJS(__('Level 5 header')) . "'; " . "\n" . 
    103         "jsToolBar.prototype.elements.blocks.options.h6 = '" . html::escapeJS(__('Level 6 header')) . "'; " . "\n" . 
    104         "jsToolBar.prototype.elements.strong.title = '" . html::escapeJS(__('Strong emphasis')) . "'; " . "\n" . 
    105         "jsToolBar.prototype.elements.em.title = '" . html::escapeJS(__('Emphasis')) . "'; " . "\n" . 
    106         "jsToolBar.prototype.elements.ins.title = '" . html::escapeJS(__('Inserted')) . "'; " . "\n" . 
    107         "jsToolBar.prototype.elements.del.title = '" . html::escapeJS(__('Deleted')) . "'; " . "\n" . 
    108         "jsToolBar.prototype.elements.quote.title = '" . html::escapeJS(__('Inline quote')) . "'; " . "\n" . 
    109         "jsToolBar.prototype.elements.code.title = '" . html::escapeJS(__('Code')) . "'; " . "\n" . 
    110         "jsToolBar.prototype.elements.mark.title = '" . html::escapeJS(__('Mark')) . "'; " . "\n" . 
    111         "jsToolBar.prototype.elements.br.title = '" . html::escapeJS(__('Line break')) . "'; " . "\n" . 
    112         "jsToolBar.prototype.elements.blockquote.title = '" . html::escapeJS(__('Blockquote')) . "'; " . "\n" . 
    113         "jsToolBar.prototype.elements.pre.title = '" . html::escapeJS(__('Preformated text')) . "'; " . "\n" . 
    114         "jsToolBar.prototype.elements.ul.title = '" . html::escapeJS(__('Unordered list')) . "'; " . "\n" . 
    115         "jsToolBar.prototype.elements.ol.title = '" . html::escapeJS(__('Ordered list')) . "'; " . "\n" . 
    116  
    117         "jsToolBar.prototype.elements.link.title = '" . html::escapeJS(__('Link')) . "'; " . "\n" . 
    118         "jsToolBar.prototype.elements.link.accesskey = '" . html::escapeJS(__('l')) . "'; " . "\n" . 
    119         "jsToolBar.prototype.elements.link.href_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "\n" . 
    120         "jsToolBar.prototype.elements.link.hreflang_prompt = '" . html::escapeJS(__('Language?')) . "'; " . "\n" . 
    121  
    122         "jsToolBar.prototype.elements.img.title = '" . html::escapeJS(__('External image')) . "'; " . "\n" . 
    123         "jsToolBar.prototype.elements.img.src_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "\n" . 
    124  
    125         "jsToolBar.prototype.elements.img_select.title = '" . html::escapeJS(__('Media chooser')) . "'; " . "\n" . 
    126         "jsToolBar.prototype.elements.img_select.accesskey = '" . html::escapeJS(__('m')) . "'; " . "\n" . 
    127         "jsToolBar.prototype.elements.post_link.title = '" . html::escapeJS(__('Link to an entry')) . "'; " . "\n" . 
    128         "jsToolBar.prototype.elements.removeFormat = jsToolBar.prototype.elements.removeFormat || {}; " . "\n" . 
    129         "jsToolBar.prototype.elements.removeFormat.title = '" . html::escapeJS(__('Remove text formating')) . "'; " . "\n"; 
    130  
    131         if (!$GLOBALS['core']->auth->check('media,media_admin', $GLOBALS['core']->blog->id)) { 
    132             $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n"; 
    133         } 
    134  
    135         $res .= "jsToolBar.prototype.toolbar_bottom = " . 
    136             (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('toolbar_bottom') ? 'true' : 'false') . ";\n"; 
    137  
    138         $res .= 
    139             "</script>\n"; 
     151        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.config.js')); 
    140152 
    141153        return $res; 
  • plugins/dcLegacyEditor/js/_post_editor.js

    r3880 r3945  
    1 /*global $, dotclear, jsToolBar */ 
     1/*global $, dotclear, jsToolBar, getData */ 
    22'use strict'; 
     3 
     4// Get context 
     5Object.assign(dotclear, getData('legacy_editor_ctx')); 
    36 
    47$(function() { 
     
    69    return; 
    710  } 
     11 
    812  if (dotclear.legacy_editor_context === undefined || 
    913    dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context] === undefined) { 
  • plugins/importExport/inc/class.dc.ieModule.php

    r3874 r3944  
    1010 */ 
    1111 
    12 if (!defined('DC_RC_PATH')) {return;} 
     12if (!defined('DC_RC_PATH')) { 
     13    return; 
     14} 
    1315 
    1416abstract class dcIeModule 
     
    7476        '<h3>' . __('Congratulation!') . '</h3>' . 
    7577        '<p class="success">' . __('Your blog has been successfully imported. Welcome on Dotclear 2!') . '</p>' . 
    76         '<ul><li><strong><a href="' . $this->core->decode('admin.post') . '">' . __('Why don\'t you blog this now?') . '</a></strong></li>' . 
    77         '<li>' . __('or') . ' <a href="' . $this->core->decode('admin.home') . '">' . __('visit your dashboard') . '</a></li></ul>'; 
     78        '<ul><li><strong><a href="' . $this->core->adminurl->decode('admin.post') . '">' . __('Why don\'t you blog this now?') . '</a></strong></li>' . 
     79        '<li>' . __('or') . ' <a href="' . $this->core->adminurl->decode('admin.home') . '">' . __('visit your dashboard') . '</a></li></ul>'; 
    7880    } 
    7981} 
  • plugins/widgets/_widgets_functions.php

    r3874 r3948  
    3636            ($w->title ? $w->renderTitle('<label for="q">' . html::escapeHTML($w->title) . '</label>') : '') . 
    3737            '<form action="' . $core->blog->url . '" method="get" role="search">' . 
    38             '<fieldset>' . 
    3938            '<p><input type="text" size="10" maxlength="255" id="q" name="q" value="' . $value . '" ' . 
    4039            ($w->placeholder ? 'placeholder="' . html::escapeHTML($w->placeholder) . '"' : '') . 
    4140            ' aria-label="' . __('Search') . '"/> ' . 
    42             '<input type="submit" class="submit" value="ok" /></p>' . 
    43             '</fieldset>' . 
     41            '<input type="submit" class="submit" value="ok" title="' . __('Search') . '" /></p>' . 
    4442            '</form>'); 
    4543    } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map