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