Archived
1
0

Include JS in installer and upgrader

This should fix issue #80 by giving serendipity_editor.js of default to the
installer and  the normal template JS to the upgrader
This commit is contained in:
onli
2014-03-09 16:00:38 +01:00
parent 3ef2575788
commit 7f4dbb3e2e
3 changed files with 6 additions and 10 deletions
+2 -1
View File
@@ -279,8 +279,9 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') {
return $serendipity[$key] . $templateFile; return $serendipity[$key] . $templateFile;
} }
if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl")) { if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl") && IS_installed) {
# catch .js.tpl files served via the template-plugin-api # catch .js.tpl files served via the template-plugin-api
# this won't work in the installer
return $serendipity['baseURL'] . 'index.php?/plugin/' . $file; return $serendipity['baseURL'] . 'index.php?/plugin/' . $file;
} }
} }
+2 -4
View File
@@ -395,16 +395,14 @@ $serendipity['permissionLevels'] = array(USERLEVEL_EDITOR => USERLEVEL_EDITOR_DE
USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC, USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC,
USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC); USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC);
/*
* Check if the installed version is higher than the version of the config
*/
// Redirect to the upgrader
if (IS_up2date === false && !defined('IN_upgrader')) { if (IS_up2date === false && !defined('IN_upgrader')) {
if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) { if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) {
$css_mode = 'serendipity_admin.css'; $css_mode = 'serendipity_admin.css';
return 1; return 1;
} }
if ( preg_match('@/(serendipity_editor\.js|serendipity\.js)@', $_SERVER['REQUEST_URI'], $matches)) { if (preg_match('@/(serendipity_editor\.js$)@', $_SERVER['REQUEST_URI'], $matches)) {
return 1; return 1;
} }
serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php')); serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php'));
+2 -5
View File
@@ -6,7 +6,8 @@
<title>{$CONST.SERENDIPITY_ADMIN_SUITE}</title> <title>{$CONST.SERENDIPITY_ADMIN_SUITE}</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{serendipity_getFile file='admin/style.css'}"> <link rel="stylesheet" href="{serendipity_getFile file='admin/style.css'}">
<script src="{$installerHTTPPath}{$templatePath}jquery.js"></script> <script src="{serendipity_getFile file='jquery.js'}"></script>
<script src="{serendipity_getFile file='admin/serendipity_editor.js'}"></script>
</head> </head>
<body id="serendipity_admin_page"> <body id="serendipity_admin_page">
<header id="top"> <header id="top">
@@ -286,12 +287,8 @@
{/if} {/if}
</div> </div>
</main> </main>
<footer id="meta"> <footer id="meta">
<p>{$ADMIN_FOOTER_POWERED_BY|sprintf:$versionInstalled:$phpversion}</p> <p>{$ADMIN_FOOTER_POWERED_BY|sprintf:$versionInstalled:$phpversion}</p>
</footer> </footer>
{* <script src="{$serendipityHTTPPath}{serendipity_getFile file='admin/js/installer_editor.js'}"></script> *}
</body> </body>
</html> </html>