Commit 24567343 authored by Penny Leach's avatar Penny Leach
Browse files

more install/upgrade stuff

parent 037c0395
......@@ -32,7 +32,13 @@ $smarty = &smarty();
$upgrades = check_upgrades();
$smarty->assign_by_ref('upgrades',$upgrades);
$smarty->display('admin/index.tpl');
if (isset($upgrades['core']) && !empty($upgrades['core']->install)) {
$smarty->assign('installing',true);
$smarty->assign('releaseargs',array($upgrades['core']->torelease,$upgrades['core']->to));
$smarty->display('admin/installgpl.tpl');
exit;
}
// normal admin page starts here
?>
\ No newline at end of file
......@@ -25,7 +25,28 @@
*/
define('INTERNAL',1);
require('init.php');
require(dirname(dirname(__FILE__)) . '/init.php');
$name = clean_requestdata('name',PARAM_ALPHAEXT,REQUEST_EITHER);
// todo upgrade stuff
sleep(1);
// key, success, newversion ,errormessage
$data = array(
'key' => $name,
'success' => true,
'newversion' => 0.1,
);
echo json_encode($data);
?>
\ No newline at end of file
......@@ -28,10 +28,41 @@ define('INTERNAL',1);
require(dirname(dirname(__FILE__)).'/init.php');
$smarty = &smarty();
$upgrades = check_upgrades();
$js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n";
$js .= <<< EOJS
function processNext() {
var element = todo.shift();
if ( ! element ) {
// we're done
return;
}
var d = loadJSONDoc('upgrade.json.php', { 'name': element });
$(element).innerHTML = 'working... ';
d.addCallback(function (data) {
if ( data.success ) {
$(data.key).innerHTML = 'Done! Upgraded to version ' + data.newversion;
}
else {
$(data.key).innerHTML = 'Poo, Error: ' + data.errormessage;
}
processNext();
});
}
addLoadEvent( processNext );
EOJS;
$smarty = &smarty(array('mochikit'));
$smarty->assign('INLINEJAVASCRIPT',$js);
$smarty->assign_by_ref('upgrades',$upgrades);
$smarty->display('admin/upgrade.tpl');
......
......@@ -29,7 +29,7 @@ require('init.php');
// check to see if we're installed...
if (!get_config('version')) {
header("Location: ".get_config('wwwroot').'admin/upgrade.php');
header("Location: ".get_config('wwwroot').'admin/index.php');
die();
}
......
<?php
$string['release'] = 'Release %s (%s)';
$string['component'] = 'Component or plugin';
$string['fromversion'] = 'From version';
$string['toversion'] = 'To version';
$string['notinstalled'] = 'Not installed';
?>
\ No newline at end of file
{include file='header.tpl'}
admin
{include file='footer.tpl'}
\ No newline at end of file
{include file='header.tpl'}
<a href="http://mahara.org">Mahara</a> {str section='admin' tag='release' args=$releaseargs}
Copyright &copy; 2006 onwards, Catalyst IT Ltd<br />
<a href="http://www.gnu.org/licenses/gpl.html">GNU Public License</a><br />
<a href="{$WWWROOT}admin/upgrade.php">Agree</a>
{include file='footer.tpl'}
\ No newline at end of file
{include file='header.tpl'}
{if $upgrades}
<table>
<tr>
<th>{str section=admin tag=component}</th>
<th>{str section=admin tag=fromversion}</th>
<th>{str section=admin tag=toversion}</th>
<th></th>
</tr>
{foreach from=$upgrades key=name item=upgrade}
<tr>
<td>{$name}</td>
<td>{if $upgrade->install} {str section='admin' tag='notinstalled'} {else} {$upgrade->fromrelease} {/if} </td>
<td>{$upgrade->torelease}</td>
<td id="{$name}">&nbsp;</td>
</tr>
{/foreach}
</table>
{else}
{str section=admin tag=noupgrades}
{/if}
{include file='footer.tpl'}
\ No newline at end of file
......@@ -7,8 +7,12 @@
<script language="javascript" type="text/javascript" src="{$script}">
</script>
{/foreach}
{if $INLINEJAVASCRIPT}
<script language="javascript" type="text/javascript">
{$INLINEJAVASCRIPT}
</script>
{/if}
{foreach from=$HEADERS item=header}{$header}{/foreach}
{/strip}
</head>
<body {if $ONLOAD} {$ONLOAD} {/if}>
\ No newline at end of file
<body>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment