Dotclear


Ignore:
Timestamp:
11/10/18 15:07:01 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Switching from inline JS variables to JSON script. Date picker is on the way

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.page.php

    r3921 r3922  
    5555    { 
    5656        $core = self::getCore(); 
    57         $js = []; 
     57        $js   = []; 
    5858 
    5959        # List of user's blogs 
     
    7373                $blogs[html::escapeHTML($rs_blogs->blog_name . ' - ' . $rs_blogs->blog_url)] = $rs_blogs->blog_id; 
    7474            } 
    75             $blog_box = 
    76             '<p><label for="switchblog" class="classic">' . 
    77             __('Blogs:') . '</label> ' . 
    78             $core->formNonce() . 
    79             form::combo('switchblog', $blogs, $core->blog->id) . 
     75            $blog_box = '<p><label for="switchblog" class="classic">' . __('Blogs:') . '</label> ' . 
     76            $core->formNonce() . form::combo('switchblog', $blogs, $core->blog->id) . 
    8077            '<input type="submit" value="' . __('ok') . '" class="hidden-if-js" /></p>'; 
    8178        } 
     
    190187            $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 
    191188        } 
    192         $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 
     189        $js['hideMoreInfo']   = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 
    193190        $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 
    194191 
     
    260257    } 
    261258 
     259    /** 
     260    @deprecated Please use $core->notices->getNotices() 
     261     **/ 
    262262    public static function notices() 
    263263    { 
     
    266266    } 
    267267 
     268    /** 
     269    @deprecated Please use $core->notices->addNotice() 
     270     **/ 
    268271    public static function addNotice($type, $message, $options = []) 
    269272    { 
     
    272275    } 
    273276 
     277    /** 
     278    @deprecated Please use $core->notices->addSuccessNotice() 
     279     **/ 
    274280    public static function addSuccessNotice($message, $options = []) 
    275281    { 
     
    277283    } 
    278284 
     285    /** 
     286    @deprecated Please use $core->notices->addWarningNotice() 
     287     **/ 
    279288    public static function addWarningNotice($message, $options = []) 
    280289    { 
     
    282291    } 
    283292 
     293    /** 
     294    @deprecated Please use $core->notices->addErrorNotice() 
     295     **/ 
    284296    public static function addErrorNotice($message, $options = []) 
    285297    { 
     
    302314 
    303315        echo 
    304         "</div>\n" . // End of #content 
     316        "</div>\n" .  // End of #content 
    305317        "</main>\n" . // End of #main 
    306318 
     
    363375    { 
    364376        $core = self::getCore(); 
    365         $js = []; 
     377        $js   = []; 
    366378 
    367379        # Display 
     
    381393        '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\n" . 
    382394        '  <title>' . $title . ' - ' . html::escapeHTML($core->blog->name) . ' - ' . html::escapeHTML(DC_VENDOR_NAME) . ' - ' . DC_VERSION . '</title>' . "\n" . 
    383         '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" . 
    384         '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n"; 
     395            '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" . 
     396            '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n"; 
    385397 
    386398        if ($core->auth->user_prefs->interface->darkmode) { 
     
    399411            $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 
    400412        } 
    401         $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 
     413        $js['hideMoreInfo']   = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 
    402414        $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 
    403415 
     
    438450    { 
    439451        echo 
    440         "</div>\n" . // End of #content 
     452        "</div>\n" .  // End of #content 
    441453        "</main>\n" . // End of #main 
    442         "</div>\n" . // End of #wrapper 
     454        "</div>\n" .  // End of #wrapper 
    443455 
    444456        '<p id="gototop"><a href="#wrapper">' . __('Page top') . '</a></p>' . "\n" . 
     
    475487    } 
    476488 
     489    /** 
     490    @deprecated Please use $core->notices->message() 
     491     **/ 
    477492    public static function message($msg, $timestamp = true, $div = false, $echo = true, $class = 'message') 
    478493    { 
     
    481496    } 
    482497 
     498    /** 
     499    @deprecated Please use $core->notices->success() 
     500     **/ 
    483501    public static function success($msg, $timestamp = true, $div = false, $echo = true) 
    484502    { 
     
    486504    } 
    487505 
     506    /** 
     507    @deprecated Please use $core->notices->warning() 
     508     **/ 
    488509    public static function warning($msg, $timestamp = true, $div = false, $echo = true) 
    489510    { 
     
    647668 
    648669        return $ret; 
     670    } 
     671 
     672    public static function jsJson($id, $vars) 
     673    { 
     674        return dcUtils::jsJson($id, $vars); 
    649675    } 
    650676 
     
    887913    public static function jsDatePicker() 
    888914    { 
     915        $js = [ 
     916            'months'    => [ 
     917                __('January'), 
     918                __('February'), 
     919                __('March'), 
     920                __('April'), 
     921                __('May'), 
     922                __('June'), 
     923                __('July'), 
     924                __('August'), 
     925                __('September'), 
     926                __('October'), 
     927                __('November'), 
     928                __('December') 
     929            ], 
     930            'days'      => [ 
     931                __('Monday'), 
     932                __('Tuesday'), 
     933                __('Wednesday'), 
     934                __('Thursday'), 
     935                __('Friday'), 
     936                __('Saturday'), 
     937                __('Sunday') 
     938            ], 
     939            'img_src'   => 'images/date-picker.png', 
     940            'img_alt'   => __('Choose date'), 
     941            'close_msg' => __('close'), 
     942            'now_msg'   => __('now') 
     943        ]; 
    889944        return 
    890945        self::cssLoad('style/date-picker.css') . 
    891         self::jsLoad('js/date-picker.js') . 
    892         '<script type="text/javascript">' . "\n" . 
    893  
    894         "datePicker.prototype.months[0] = '" . html::escapeJS(__('January')) . "'; " . 
    895         "datePicker.prototype.months[1] = '" . html::escapeJS(__('February')) . "'; " . 
    896         "datePicker.prototype.months[2] = '" . html::escapeJS(__('March')) . "'; " . 
    897         "datePicker.prototype.months[3] = '" . html::escapeJS(__('April')) . "'; " . 
    898         "datePicker.prototype.months[4] = '" . html::escapeJS(__('May')) . "'; " . 
    899         "datePicker.prototype.months[5] = '" . html::escapeJS(__('June')) . "'; " . 
    900         "datePicker.prototype.months[6] = '" . html::escapeJS(__('July')) . "'; " . 
    901         "datePicker.prototype.months[7] = '" . html::escapeJS(__('August')) . "'; " . 
    902         "datePicker.prototype.months[8] = '" . html::escapeJS(__('September')) . "'; " . 
    903         "datePicker.prototype.months[9] = '" . html::escapeJS(__('October')) . "'; " . 
    904         "datePicker.prototype.months[10] = '" . html::escapeJS(__('November')) . "'; " . 
    905         "datePicker.prototype.months[11] = '" . html::escapeJS(__('December')) . "'; " . 
    906  
    907         "datePicker.prototype.days[0] = '" . html::escapeJS(__('Monday')) . "'; " . 
    908         "datePicker.prototype.days[1] = '" . html::escapeJS(__('Tuesday')) . "'; " . 
    909         "datePicker.prototype.days[2] = '" . html::escapeJS(__('Wednesday')) . "'; " . 
    910         "datePicker.prototype.days[3] = '" . html::escapeJS(__('Thursday')) . "'; " . 
    911         "datePicker.prototype.days[4] = '" . html::escapeJS(__('Friday')) . "'; " . 
    912         "datePicker.prototype.days[5] = '" . html::escapeJS(__('Saturday')) . "'; " . 
    913         "datePicker.prototype.days[6] = '" . html::escapeJS(__('Sunday')) . "'; " . 
    914  
    915         "datePicker.prototype.img_src = 'images/date-picker.png'; " . 
    916         "datePicker.prototype.img_alt = '" . html::escapeJS(__('Choose date')) . "'; " . 
    917  
    918         "datePicker.prototype.close_msg = '" . html::escapeJS(__('close')) . "'; " . 
    919         "datePicker.prototype.now_msg = '" . html::escapeJS(__('now')) . "'; " . 
    920  
    921             "</script>\n"; 
     946        self::jsJson('date_picker', $js) . 
     947        self::jsLoad('js/date-picker.js'); 
    922948    } 
    923949 
Note: See TracChangeset for help on using the changeset viewer.

Sites map