Dotclear

source: inc/admin/lib.dc.page.php @ 37:89b90dfd3913

Revision 37:89b90dfd3913, 23.2 KB checked in by Tomtom33 <tbouron@…>, 14 years ago (diff)

Fixed text messages

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14define('DC_AUTH_PAGE','auth.php');
15
16class dcPage
17{
18     # Auth check
19     public static function check($permissions)
20     {
21          global $core;
22         
23          if ($core->blog && $core->auth->check($permissions,$core->blog->id))
24          {
25               return;
26          }
27         
28          if (session_id()) {
29               $core->session->destroy();
30          }
31          http::redirect(DC_AUTH_PAGE);
32     }
33     
34     # Check super admin
35     public static function checkSuper()
36     {
37          global $core;
38         
39          if (!$core->auth->isSuperAdmin())
40          {
41               if (session_id()) {
42                    $core->session->destroy();
43               }
44               http::redirect(DC_AUTH_PAGE);
45          }
46     }
47     
48     # Top of admin page
49     public static function open($title='', $head='')
50     {
51          global $core;
52         
53          # List of user's blogs
54          if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20)
55          {
56               $blog_box =
57               __('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'.
58               html::escapeHTML($core->blog->name).'</strong>';
59               
60               if ($core->auth->blog_count > 20) {
61                    $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>';
62               }
63          }
64          else
65          {
66               $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20));
67               $blogs = array();
68               while ($rs_blogs->fetch()) {
69                    $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id;
70               }
71               $blog_box =
72               __('Blogs:').' '.
73               $core->formNonce().
74               form::combo('switchblog',$blogs,$core->blog->id,  '',1).
75               '<noscript><div><input type="submit" value="'.__('ok').'" /></div></noscript>';
76          }
77         
78          $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'];
79         
80          # Display
81          header('Content-Type: text/html; charset=UTF-8');
82          echo
83          '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
84          ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
85          '<html xmlns="http://www.w3.org/1999/xhtml" '.
86          'xml:lang="'.$core->auth->getInfo('user_lang').'" '.
87          'lang="'.$core->auth->getInfo('user_lang').'">'."\n".
88          "<head>\n".
89          '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n".
90          '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n".
91         
92          '  <meta name="MSSmartTagsPreventParsing" content="TRUE" />'."\n".
93          '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
94          '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n".
95         
96          self::jsLoadIE7().
97          '  <style type="text/css">'."\n". 
98          '  @import "style/default.css";'."\n".
99          "  </style>\n";
100          if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
101               echo '  <style type="text/css">'."\n".'  @import "style/default-rtl.css";'."\n"."  </style>\n";
102          }
103         
104          echo
105          self::jsCommon().
106          $head;
107         
108          # --BEHAVIOR-- adminPageHTMLHead
109          $core->callBehavior('adminPageHTMLHead');
110         
111          echo
112          "</head>\n".
113          '<body id="dotclear-admin'.
114          ($safe_mode ? ' safe-mode' : '').
115          '">'."\n".
116         
117          '<div id="top"><h1><a href="index.php">'.DC_VENDOR_NAME.'</a></h1></div>'."\n";
118         
119         
120          echo
121          '<div id="info-box">'.
122          '<form action="index.php" method="post"><div>'.
123          $blog_box.
124          ' - <a href="'.$core->blog->url.'" class="button">'.__('View site').'</a>'.
125          ' - '.__('User:').' <strong>'.$core->auth->userID().'</strong>'.
126          ' - <a href="index.php?logout=1" class="logout">'.__('Logout').'</a>'.
127          '</div></form>'.
128          '</div>';
129         
130          echo
131          '<div id="wrapper">'."\n".
132          '<div id="main">'."\n".
133          '<div id="content">'."\n";
134         
135          # Safe mode
136          if ($safe_mode)
137          {
138               echo
139               '<div class="error"><h3>'.__('Safe mode').'</h3>'.
140               '<p>'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'</p>'.
141               '</div>';
142          }
143         
144          if ($core->error->flag()) {
145               echo
146               '<div class="error"><strong>'.__('Errors:').'</strong>'.
147               $core->error->toHTML().
148               '</div>';
149          }
150     }
151     
152     public static function close()
153     {
154          $menu =& $GLOBALS['_menu'];
155         
156          echo
157          "</div>\n".         // End of #content
158          "</div>\n".         // End of #main
159         
160          '<div id="main-menu">'."\n";
161         
162          foreach ($menu as $k => $v) {
163               echo $menu[$k]->draw();
164          }
165         
166          echo
167          '</div>'."\n".      // End of #main-menu
168          '<div id="footer"><p><img src="images/dotclear_pw.png" alt="Dotclear" /> '.
169          sprintf(__('Thank you for using %s.'),'<a href="http://dotclear.org/">Dotclear</a>').
170          '</p></div>'."\n".
171          "</div>\n";         // End of #wrapper
172         
173          if (defined('DC_DEV') && DC_DEV === true) {
174               echo self::debugInfo();
175          }
176         
177          echo
178          '</body></html>';
179     }
180     
181     public static function openPopup($title='', $head='')
182     {
183          global $core;
184         
185          # Display
186          header('Content-Type: text/html; charset=UTF-8');
187          echo
188          '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
189          ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
190          '<html xmlns="http://www.w3.org/1999/xhtml" '.
191          'xml:lang="'.$core->auth->getInfo('user_lang').'" '.
192          'lang="'.$core->auth->getInfo('user_lang').'">'."\n".
193          "<head>\n".
194          '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n".
195          '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n".
196         
197          '  <meta name="MSSmartTagsPreventParsing" content="TRUE" />'."\n".
198          '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
199          '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n".
200         
201          self::jsLoadIE7().
202          '  <style type="text/css">'."\n". 
203          '  @import "style/default.css";'."\n".
204          "  </style>\n";
205          if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
206               echo '  <style type="text/css">'."\n".'  @import "style/default-rtl.css";'."\n"."  </style>\n";
207          }
208         
209          echo
210          self::jsCommon().
211          $head;
212         
213          # --BEHAVIOR-- adminPageHTMLHead
214          $core->callBehavior('adminPageHTMLHead');
215         
216          echo
217          "</head>\n".
218          '<body id="dotclear-admin" class="popup">'."\n".
219         
220          '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n";
221         
222          echo
223          '<div id="wrapper">'."\n".
224          '<div id="main">'."\n".
225          '<div id="content">'."\n";
226         
227          if ($core->error->flag()) {
228               echo
229               '<div class="error"><strong>'.__('Errors:').'</strong>'.
230               $core->error->toHTML().
231               '</div>';
232          }
233     }
234     
235     public static function closePopup()
236     {
237          echo
238          "</div>\n".         // End of #content
239          "</div>\n".         // End of #main
240          '<div id="footer"><p>&nbsp;</p></div>'."\n".
241          "</div>\n".         // End of #wrapper
242          '</body></html>';
243     }
244     
245     private static function debugInfo()
246     {
247          $global_vars = implode(', ',array_keys($GLOBALS));
248         
249          $res =
250          '<div id="debug"><div>'.
251          '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>';
252         
253          if (function_exists('xdebug_get_profiler_filename'))
254          {
255               $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>';
256               
257               $prof_file = xdebug_get_profiler_filename();
258               if ($prof_file) {
259                    $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>';
260               } else {
261                    $prof_url = http::getSelfURI();
262                    $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&amp;';
263                    $prof_url .= 'XDEBUG_PROFILE';
264                    $res .= '<p><a href="'.$prof_url.'">Trigger profiler</a></p>';
265               }
266               
267               /* xdebug configuration:
268               zend_extension = /.../xdebug.so
269               xdebug.auto_trace = On
270               xdebug.trace_format = 0
271               xdebug.trace_options = 1
272               xdebug.show_mem_delta = On
273               xdebug.profiler_enable = 0
274               xdebug.profiler_enable_trigger = 1
275               xdebug.profiler_output_dir = /tmp
276               xdebug.profiler_append = 0
277               xdebug.profiler_output_name = timestamp
278               */
279          }
280         
281          $res .=
282          '<p>Global vars: '.$global_vars.'</p>'.
283          '</div></div>';
284         
285          return $res;
286     }
287     
288     public static function help($page,$index='')
289     {
290          # Deprecated but we keep this for plugins.
291     }
292     
293     public static function helpBlock()
294     {
295          $args = func_get_args();
296          if (empty($args)) {
297               return;
298          };
299         
300          global $__resources;
301          if (empty($__resources['help'])) {
302               return;
303          }
304         
305          $content = '';
306          foreach ($args as $v)
307          {
308               if (is_object($v) && isset($v->content)) {
309                    $content .= $v->content;
310                    continue;
311               }
312               
313               if (!isset($__resources['help'][$v])) {
314                    continue;
315               }
316               $f = $__resources['help'][$v];
317               if (!file_exists($f) || !is_readable($f)) {
318                    continue;
319               }
320               
321               $fc = file_get_contents($f);
322               if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) {
323                    $content .= $matches[1];
324               } else {
325                    $content .= $fc;
326               }
327          }
328         
329          if (trim($content) == '') {
330               return;
331          }
332         
333          echo
334          '<div id="help"><hr /><div class="help-content"><h2>'.__('Help').'</h2>'.
335          $content.
336          '</div></div>';
337     }
338     
339     public static function jsLoad($src)
340     {
341          return '<script type="text/javascript" src="'.html::escapeHTML($src).'"></script>'."\n";
342     }
343     
344     public static function jsVar($n,$v)
345     {
346          return $n." = '".html::escapeJS($v)."';\n";
347     }
348     
349     public static function jsCommon()
350     {
351          return
352          self::jsLoad('js/jquery/jquery.js').
353          self::jsLoad('js/jquery/jquery.biscuit.js').
354          self::jsLoad('js/jquery/jquery.bgFade.js').
355          self::jsLoad('js/common.js').
356         
357          '<script type="text/javascript">'."\n".
358          "//<![CDATA[\n".
359          self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()).
360         
361          self::jsVar('dotclear.img_plus_src','images/plus.png').
362          self::jsVar('dotclear.img_plus_alt',__('uncover')).
363          self::jsVar('dotclear.img_minus_src','images/minus.png').
364          self::jsVar('dotclear.img_minus_alt',__('hide')).
365          self::jsVar('dotclear.img_menu_on','images/menu_on.png').
366          self::jsVar('dotclear.img_menu_off','images/menu_off.png').
367         
368          self::jsVar('dotclear.msg.help',
369               __('help')).
370          self::jsVar('dotclear.msg.no_selection',
371               __('no selection')).
372          self::jsVar('dotclear.msg.select_all',
373               __('select all')).
374          self::jsVar('dotclear.msg.invert_sel',
375               __('invert selection')).
376          self::jsVar('dotclear.msg.website',
377               __('Web site:')).
378          self::jsVar('dotclear.msg.email',
379               __('Email:')).
380          self::jsVar('dotclear.msg.ip_address',
381               __('IP address:')).
382          self::jsVar('dotclear.msg.error',
383               __('Error:')).
384          self::jsVar('dotclear.msg.entry_created',
385               __('Entry has been successfully created.')).
386          self::jsVar('dotclear.msg.edit_entry',
387               __('Edit entry')).
388          self::jsVar('dotclear.msg.view_entry',
389               __('view entry')).
390          self::jsVar('dotclear.msg.confirm_delete_posts',
391               __("Are you sure you want to delete selected entries (%s)?")).
392          self::jsVar('dotclear.msg.confirm_delete_post',
393               __("Are you sure you want to delete this entry?")).
394          self::jsVar('dotclear.msg.confirm_delete_comments',
395               __('Are you sure you want to delete selected comments (%s)?')).
396          self::jsVar('dotclear.msg.confirm_delete_comment',
397               __('Are you sure you want to delete this comment?')).
398          self::jsVar('dotclear.msg.cannot_delete_users',
399               __('Users with posts cannot be deleted.')).
400          self::jsVar('dotclear.msg.confirm_delete_user',
401               __('Are you sure you want to delete selected users (%s)?')).
402          self::jsVar('dotclear.msg.confirm_delete_category',
403               __('Are you sure you want to delete category "%s"?')).
404          self::jsVar('dotclear.msg.confirm_reorder_categories',
405               __('Are you sure you want to reorder all categories?')).
406          self::jsVar('dotclear.msg.confirm_delete_media',
407               __('Are you sure you want to remove media "%s"?')).
408          self::jsVar('dotclear.msg.confirm_extract_current',
409               __('Are you sure you want to extract archive in current directory?')).
410          self::jsVar('dotclear.msg.confirm_remove_attachment',
411               __('Are you sure you want to remove attachment "%s"?')).
412          self::jsVar('dotclear.msg.confirm_delete_lang',
413               __('Are you sure you want to delete "%s" language?')).
414          self::jsVar('dotclear.msg.confirm_delete_plugin',
415               __('Are you sure you want to delete "%s" plugin?')).
416          self::jsVar('dotclear.msg.use_this_theme',
417               __('Use this theme')).
418          self::jsVar('dotclear.msg.remove_this_theme',
419               __('Remove this theme')).
420          self::jsVar('dotclear.msg.confirm_delete_theme',
421               __('Are you sure you want to delete "%s" theme?')).
422          self::jsVar('dotclear.msg.zip_file_content',
423               __('Zip file content')).
424          self::jsVar('dotclear.msg.xhtml_validator',
425               __('XHTML markup validator')).
426          self::jsVar('dotclear.msg.xhtml_valid',
427               __('XHTML content is valid.')).
428          self::jsVar('dotclear.msg.xhtml_not_valid',
429               __('There are XHTML markup errors.')).
430          self::jsVar('dotclear.msg.confirm_change_post_format',
431               __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')).
432          "\n//]]>\n".
433          "</script>\n";
434     }
435     
436     public static function jsLoadIE7()
437     {
438          return
439          '<!--[if lt IE 8]>'."\n".
440          self::jsLoad('js/ie7/IE8.js').
441          '<link rel="stylesheet" type="text/css" href="style/iesucks.css" />'."\n".
442          '<![endif]-->'."\n";
443     }
444     
445     public static function jsConfirmClose()
446     {
447          $args = func_get_args();
448          if (count($args) > 0) {
449               foreach ($args as $k => $v) {
450                    $args[$k] = "'".html::escapeJS($v)."'";
451               }
452               $args = implode(',',$args);
453          } else {
454               $args = '';
455          }
456         
457          return
458          self::jsLoad('js/confirm-close.js').
459          '<script type="text/javascript">'."\n".
460          "//<![CDATA[\n".
461          "confirmClosePage = new confirmClose(".$args."); ".
462          "confirmClose.prototype.prompt = '".html::escapeJS(__('You have unsaved changes.'))."'; ".
463          "\n//]]>\n".
464          "</script>\n";
465     }
466     
467     public static function jsPageTabs($default=null)
468     {
469          if ($default) {
470               $default = "'".html::escapeJS($default)."'";
471          }
472         
473          return
474          self::jsLoad('js/jquery/jquery.pageTabs.js').
475          '<script type="text/javascript">'."\n".
476          "//<![CDATA[\n".
477          "\$(function() {\n".
478          "    \$.pageTabs(".$default.");\n".
479          "});\n".
480          "\n//]]>\n".
481          "</script>\n";
482     }
483     
484     public static function jsModal()
485     {
486          return
487          '<link rel="stylesheet" type="text/css" href="style/modal/modal.css" />'."\n".
488          self::jsLoad('js/jquery/jquery.modal.js').
489          '<script type="text/javascript">'."\n".
490          "//<![CDATA[\n".
491          self::jsVar('$.modal.prototype.params.loader_img','style/modal/loader.gif').
492          self::jsVar('$.modal.prototype.params.close_img','style/modal/close.png').
493          "\n//]]>\n".
494          "</script>\n";
495     }
496     
497     public static function jsColorPicker()
498     {
499          return
500          '<link rel="stylesheet" type="text/css" href="style/farbtastic/farbtastic.css" />'."\n".
501          self::jsLoad('js/jquery/jquery.farbtastic.js').
502          self::jsLoad('js/color-picker.js');
503     }
504     
505     public static function jsDatePicker()
506     {
507          return
508          '<link rel="stylesheet" type="text/css" href="style/date-picker.css" />'."\n".
509          self::jsLoad('js/date-picker.js').
510          '<script type="text/javascript">'."\n".
511          "//<![CDATA[\n".
512         
513          "datePicker.prototype.months[0] = '".html::escapeJS(__('January'))."'; ".
514          "datePicker.prototype.months[1] = '".html::escapeJS(__('February'))."'; ".
515          "datePicker.prototype.months[2] = '".html::escapeJS(__('March'))."'; ".
516          "datePicker.prototype.months[3] = '".html::escapeJS(__('April'))."'; ".
517          "datePicker.prototype.months[4] = '".html::escapeJS(__('May'))."'; ".
518          "datePicker.prototype.months[5] = '".html::escapeJS(__('June'))."'; ".
519          "datePicker.prototype.months[6] = '".html::escapeJS(__('July'))."'; ".
520          "datePicker.prototype.months[7] = '".html::escapeJS(__('August'))."'; ".
521          "datePicker.prototype.months[8] = '".html::escapeJS(__('September'))."'; ".
522          "datePicker.prototype.months[9] = '".html::escapeJS(__('October'))."'; ".
523          "datePicker.prototype.months[10] = '".html::escapeJS(__('November'))."'; ".
524          "datePicker.prototype.months[11] = '".html::escapeJS(__('December'))."'; ".
525         
526          "datePicker.prototype.days[0] = '".html::escapeJS(__('Monday'))."'; ".
527          "datePicker.prototype.days[1] = '".html::escapeJS(__('Tuesday'))."'; ".
528          "datePicker.prototype.days[2] = '".html::escapeJS(__('Wednesday'))."'; ".
529          "datePicker.prototype.days[3] = '".html::escapeJS(__('Thursday'))."'; ".
530          "datePicker.prototype.days[4] = '".html::escapeJS(__('Friday'))."'; ".
531          "datePicker.prototype.days[5] = '".html::escapeJS(__('Saturday'))."'; ".
532          "datePicker.prototype.days[6] = '".html::escapeJS(__('Sunday'))."'; ".
533         
534          "datePicker.prototype.img_src = 'images/date-picker.png'; ".
535         
536          "datePicker.prototype.close_msg = '".html::escapeJS(__('close'))."'; ".
537          "datePicker.prototype.now_msg = '".html::escapeJS(__('now'))."'; ".
538         
539          "\n//]]>\n".
540          "</script>\n";
541     }
542     
543     public static function jsToolBar()
544     {
545          $res =
546          '<link rel="stylesheet" type="text/css" href="style/jsToolBar/jsToolBar.css" />'.
547          '<script type="text/javascript" src="js/jsToolBar/jsToolBar.js"></script>';
548         
549          if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) {
550               $res .= '<script type="text/javascript" src="js/jsToolBar/jsToolBar.wysiwyg.js"></script>';
551          }
552         
553          $res .=
554          '<script type="text/javascript" src="js/jsToolBar/jsToolBar.dotclear.js"></script>'.
555          '<script type="text/javascript">'."\n".
556          "//<![CDATA[\n".
557          "jsToolBar.prototype.dialog_url = 'popup.php'; ".
558          "jsToolBar.prototype.iframe_css = '".
559               'body{'.
560                    'font: 12px "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;'.
561                    'color : #000;'.
562                    'background: #f9f9f9;'.
563                    'margin: 0;'.
564                    'padding : 2px;'.
565                    'border: none;'.
566                    (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction:rtl;' : '').
567               '}'.
568               'pre, code, kbd, samp {'.
569                    'font-family:"Courier New",Courier,monospace;'.
570                    'font-size : 1.1em;'.
571               '}'.
572               'code {'.
573                    'color : #666;'.
574                    'font-weight : bold;'.
575               '}'.
576               'body > p:first-child {'.
577                    'margin-top: 0;'.
578               '}'.
579          "'; ".
580          "jsToolBar.prototype.base_url = '".html::escapeJS($GLOBALS['core']->blog->host)."'; ".
581          "jsToolBar.prototype.switcher_visual_title = '".html::escapeJS(__('visual'))."'; ".
582          "jsToolBar.prototype.switcher_source_title = '".html::escapeJS(__('source'))."'; ".
583          "jsToolBar.prototype.legend_msg = '".
584          html::escapeJS(__('You can use the following shortcuts to format your text.'))."'; ".
585          "jsToolBar.prototype.elements.blocks.options.none = '".html::escapeJS(__('-- none --'))."'; ".
586          "jsToolBar.prototype.elements.blocks.options.nonebis = '".html::escapeJS(__('-- block format --'))."'; ".
587          "jsToolBar.prototype.elements.blocks.options.p = '".html::escapeJS(__('Paragraph'))."'; ".
588          "jsToolBar.prototype.elements.blocks.options.h1 = '".html::escapeJS(__('Level 1 header'))."'; ".
589          "jsToolBar.prototype.elements.blocks.options.h2 = '".html::escapeJS(__('Level 2 header'))."'; ".
590          "jsToolBar.prototype.elements.blocks.options.h3 = '".html::escapeJS(__('Level 3 header'))."'; ".
591          "jsToolBar.prototype.elements.blocks.options.h4 = '".html::escapeJS(__('Level 4 header'))."'; ".
592          "jsToolBar.prototype.elements.blocks.options.h5 = '".html::escapeJS(__('Level 5 header'))."'; ".
593          "jsToolBar.prototype.elements.blocks.options.h6 = '".html::escapeJS(__('Level 6 header'))."'; ".
594          "jsToolBar.prototype.elements.strong.title = '".html::escapeJS(__('Strong emphasis'))."'; ".
595          "jsToolBar.prototype.elements.em.title = '".html::escapeJS(__('Emphasis'))."'; ".
596          "jsToolBar.prototype.elements.ins.title = '".html::escapeJS(__('Inserted'))."'; ".
597          "jsToolBar.prototype.elements.del.title = '".html::escapeJS(__('Deleted'))."'; ".
598          "jsToolBar.prototype.elements.quote.title = '".html::escapeJS(__('Inline quote'))."'; ".
599          "jsToolBar.prototype.elements.code.title = '".html::escapeJS(__('Code'))."'; ".
600          "jsToolBar.prototype.elements.br.title = '".html::escapeJS(__('Line break'))."'; ".
601          "jsToolBar.prototype.elements.blockquote.title = '".html::escapeJS(__('Blockquote'))."'; ".
602          "jsToolBar.prototype.elements.pre.title = '".html::escapeJS(__('Preformated text'))."'; ".
603          "jsToolBar.prototype.elements.ul.title = '".html::escapeJS(__('Unordered list'))."'; ".
604          "jsToolBar.prototype.elements.ol.title = '".html::escapeJS(__('Ordered list'))."'; ".
605         
606          "jsToolBar.prototype.elements.link.title = '".html::escapeJS(__('Link'))."'; ".
607          "jsToolBar.prototype.elements.link.href_prompt = '".html::escapeJS(__('URL?'))."'; ".
608          "jsToolBar.prototype.elements.link.hreflang_prompt = '".html::escapeJS(__('Language?'))."'; ".
609         
610          "jsToolBar.prototype.elements.img.title = '".html::escapeJS(__('External image'))."'; ".
611          "jsToolBar.prototype.elements.img.src_prompt = '".html::escapeJS(__('URL?'))."'; ".
612         
613          "jsToolBar.prototype.elements.img_select.title = '".html::escapeJS(__('Media chooser'))."'; ".
614          "jsToolBar.prototype.elements.post_link.title = '".html::escapeJS(__('Link to an entry'))."'; ";
615         
616          if (!$GLOBALS['core']->auth->check('media,media_admin',$GLOBALS['core']->blog->id)) {
617               $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n";
618          }
619         
620          $res .=
621          "\n//]]>\n".
622          "</script>\n";
623         
624          return $res;
625     }
626     
627     public static function jsCandyUpload($params=array(),$base_url=null)
628     {
629          if (!$base_url) {
630               $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/','',$_SERVER['REQUEST_URI']))).'/';
631          }
632         
633          $params = array_merge($params,array(
634               'sess_id='.session_id(),
635               'sess_uid='.$_SESSION['sess_browser_uid'],
636               'xd_check='.$GLOBALS['core']->getNonce()
637          ));
638         
639          return
640          '<link rel="stylesheet" type="text/css" href="style/candyUpload/style.css" />'."\n".
641          self::jsLoad('js/jquery/jquery.candyUpload.js').
642         
643          '<script type="text/javascript">'."\n".
644          "//<![CDATA[\n".
645          "dotclear.candyUpload = {};\n".
646          self::jsVar('dotclear.msg.activate_enhanced_uploader',__('Activate enhanced uploader')).
647          self::jsVar('dotclear.msg.disable_enhanced_uploader',__('Disable enhanced uploader')).
648          self::jsVar('$._candyUpload.prototype.locales.file_uploaded',__('File successfully uploaded.')).
649          self::jsVar('$._candyUpload.prototype.locales.max_file_size',__('Maximum file size allowed:')).
650          self::jsVar('$._candyUpload.prototype.locales.limit_exceeded',__('Limit exceeded.')).
651          self::jsVar('$._candyUpload.prototype.locales.size_limit_exceeded',__('File size exceeds allowed limit.')).
652          self::jsVar('$._candyUpload.prototype.locales.canceled',__('Canceled.')).
653          self::jsVar('$._candyUpload.prototype.locales.http_error',__('HTTP Error:')).
654          self::jsVar('$._candyUpload.prototype.locales.error',__('Error:')).
655          self::jsVar('$._candyUpload.prototype.locales.choose_file',__('Choose file')).
656          self::jsVar('$._candyUpload.prototype.locales.choose_files',__('Choose files')).
657          self::jsVar('$._candyUpload.prototype.locales.cancel',__('Cancel')).
658          self::jsVar('$._candyUpload.prototype.locales.clean',__('Clean')).
659          self::jsVar('$._candyUpload.prototype.locales.upload',__('Upload')).
660          self::jsVar('$._candyUpload.prototype.locales.no_file_in_queue',__('No file in queue.')).
661          self::jsVar('$._candyUpload.prototype.locales.file_in_queue',__('1 file in queue.')).
662          self::jsVar('$._candyUpload.prototype.locales.files_in_queue',__('%d files in queue.')).
663          self::jsVar('$._candyUpload.prototype.locales.queue_error',__('Queue error:')).
664          self::jsVar('dotclear.candyUpload.base_url',$base_url).
665          self::jsVar('dotclear.candyUpload.movie_url',$base_url.'index.php?pf=swfupload.swf').
666          self::jsVar('dotclear.candyUpload.params',implode('&',$params)).
667          "\n//]]>\n".
668          "</script>\n";
669     }
670     
671     public static function jsToolMan()
672     {
673          return
674          '<script type="text/javascript" src="js/tool-man/core.js"></script>'.
675          '<script type="text/javascript" src="js/tool-man/events.js"></script>'.
676          '<script type="text/javascript" src="js/tool-man/css.js"></script>'.
677          '<script type="text/javascript" src="js/tool-man/coordinates.js"></script>'.
678          '<script type="text/javascript" src="js/tool-man/drag.js"></script>'.
679          '<script type="text/javascript" src="js/tool-man/dragsort.js"></script>'.
680          '<script type="text/javascript" src="js/dragsort-tablerows.js"></script>';
681     }
682     
683     public static function jsMetaEditor()
684     {
685          return
686          '<script type="text/javascript" src="js/meta-editor.js"></script>';
687     }
688}
689?>
Note: See TracBrowser for help on using the repository browser.

Sites map