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