branch switcher UI (no functionality yet...)
git-svn-id: file:///home/shish/svn/shimmie2/trunk@620 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
18b97444d4
commit
8398a1076b
@ -15,12 +15,17 @@ class SVNUpdate extends Extension {
|
|||||||
|
|
||||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) {
|
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) {
|
||||||
if($event->user->is_admin()) {
|
if($event->user->is_admin()) {
|
||||||
if($event->get_arg(0) == "log") {
|
if($event->get_arg(0) == "view_changes") {
|
||||||
$this->theme->display_update_todo($event->page, $this->get_update_log());
|
$this->theme->display_update_todo($event->page,
|
||||||
|
$this->get_update_log(),
|
||||||
|
$this->get_branches());
|
||||||
}
|
}
|
||||||
if($event->get_arg(0) == "run") {
|
if($event->get_arg(0) == "update") {
|
||||||
$this->theme->display_update_log($event->page, $this->run_update());
|
$this->theme->display_update_log($event->page, $this->run_update());
|
||||||
}
|
}
|
||||||
|
//if($event->get_arg(0) == "switch") {
|
||||||
|
// $this->theme->display_update_log($event->page, $this->run_update());
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,11 +36,26 @@ class SVNUpdate extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function get_update_log() {
|
private function get_update_log() {
|
||||||
return shell_exec("svn log -r BASE:HEAD .");
|
return shell_exec("svn log -r HEAD:BASE .");
|
||||||
}
|
}
|
||||||
private function run_update() {
|
private function run_update() {
|
||||||
return shell_exec("svn update");
|
return shell_exec("svn update");
|
||||||
}
|
}
|
||||||
|
private function get_branches() {
|
||||||
|
$data = shell_exec("svn ls http://svn.shishnet.org/shimmie2/branches/");
|
||||||
|
$list = array();
|
||||||
|
foreach(split("\n", $data) as $line) {
|
||||||
|
$matches = array();
|
||||||
|
if(preg_match("/branch_(\d.\d+)/", $line, $matches)) {
|
||||||
|
$ver = $matches[1];
|
||||||
|
$list["branch_$ver"] = "Stable ($ver.X)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ksort($list);
|
||||||
|
$list = array_reverse($list, true);
|
||||||
|
$list["trunk"] = "Unstable (Trunk)";
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add_event_listener(new SVNUpdate());
|
add_event_listener(new SVNUpdate());
|
||||||
?>
|
?>
|
||||||
|
@ -3,22 +3,38 @@
|
|||||||
class SVNUpdateTheme extends Themelet {
|
class SVNUpdateTheme extends Themelet {
|
||||||
public function display_form($page) {
|
public function display_form($page) {
|
||||||
$html = "
|
$html = "
|
||||||
<a href='".make_link("update/log")."'>Check for Updates</a>
|
<a href='".make_link("update/view_changes")."'>Check for Updates</a>
|
||||||
";
|
";
|
||||||
$page->add_block(new Block("Update", $html));
|
$page->add_block(new Block("Update", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_update_todo($page, $log) {
|
public function display_update_todo($page, $log, $branches) {
|
||||||
$h_log = html_escape($log);
|
$h_log = html_escape($log);
|
||||||
$html = "
|
$updates = "
|
||||||
<textarea rows='20' cols='80'>$h_log</textarea>
|
<textarea rows='20' cols='80'>$h_log</textarea>
|
||||||
<br/><a href='".make_link("update/run")."'>Install Updates</a>
|
<br/>
|
||||||
|
<form action='".make_link("update/update")."' method='POST'>
|
||||||
|
<input type='submit' value='Install Updates'>
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
$options = "";
|
||||||
|
foreach($branches as $name => $nice) {
|
||||||
|
$options .= "<option value='$name'>$nice</option>";
|
||||||
|
}
|
||||||
|
$branches = "
|
||||||
|
<form action='".make_link("update/switch")."' method='POST'>
|
||||||
|
<select name='branch'>
|
||||||
|
$options
|
||||||
|
</select>
|
||||||
|
<input type='submit' value='Change Branch'>
|
||||||
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
$page->set_title("Updates Available");
|
$page->set_title("Updates Available");
|
||||||
$page->set_heading("Updates Available");
|
$page->set_heading("Updates Available");
|
||||||
$page->add_block(new NavBlock());
|
$page->add_block(new NavBlock());
|
||||||
$page->add_block(new Block("Updates", $html));
|
$page->add_block(new Block("Updates For Current Branch", $updates));
|
||||||
|
$page->add_block(new Block("Available Branches", $branches));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_update_log($page, $log) {
|
public function display_update_log($page, $log) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user