From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qkofl-0006Wv-FY for garchives@archives.gentoo.org; Sun, 24 Jul 2011 02:44:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0D29221C123; Sun, 24 Jul 2011 02:43:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8E3ED21C123 for ; Sun, 24 Jul 2011 02:43:37 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CDB031B400E for ; Sun, 24 Jul 2011 02:43:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2C91080040 for ; Sun, 24 Jul 2011 02:43:36 +0000 (UTC) From: "Liam McLoughlin" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Liam McLoughlin" Message-ID: <603e8f6106dc66596b29131ac2e2b804d0e35934.hexxeh@gentoo> Subject: [gentoo-commits] proj/gentoaster:webui commit in: web/js/, /, web/ X-VCS-Repository: proj/gentoaster X-VCS-Files: daemon.php web/index.php web/js/gentoaster.js web/process.php web/status.php web/testdrive.php X-VCS-Directories: web/js/ / web/ X-VCS-Committer: hexxeh X-VCS-Committer-Name: Liam McLoughlin X-VCS-Revision: 603e8f6106dc66596b29131ac2e2b804d0e35934 Date: Sun, 24 Jul 2011 02:43:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 7f41886990982b4138c418645dfae8fb Message-ID: <20110724024336.yfXku_cPHnLdynUJz0Hegbp4B5elsoQ7iE4xcm7puz4@z> commit: 603e8f6106dc66596b29131ac2e2b804d0e35934 Author: Liam McLoughlin hexxeh net> AuthorDate: Sun Jul 24 00:58:03 2011 +0000 Commit: Liam McLoughlin hexxeh net> CommitDate: Sun Jul 24 00:58:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoaster.gi= t;a=3Dcommit;h=3D603e8f61 Changed code to be closer to Zend standard --- daemon.php | 4 +- web/index.php | 10 +- web/js/gentoaster.js | 102 ++++++++++++++++++++ web/process.php | 61 ++++++------ web/status.php | 135 +++++++++++++++----------- web/testdrive.php | 256 +++++++++++++++++++++++++-------------------= ------ 6 files changed, 347 insertions(+), 221 deletions(-) diff --git a/daemon.php b/daemon.php index a25861e..6570185 100644 --- a/daemon.php +++ b/daemon.php @@ -3,11 +3,11 @@ // Gentoaster build daemon worker // Licensed under GPL v3, see COPYING file =20 - $configurationsPath =3D "/var/www/gentoaster"; + $configurationsPath =3D "/var/www/gentoaster/images"; $gentoasterPath =3D "/usr/share/gentoaster"; $buildToolName =3D "create_image.sh"; $wrapToolName =3D "wrap.sh"; - $externalHost =3D "192.168.2.167"; + $externalHost =3D "192.168.2.169"; $lowPort =3D 5900; $highPort =3D 5999; =20 diff --git a/web/index.php b/web/index.php index 181d07b..1fd4d7d 100644 --- a/web/index.php +++ b/web/index.php @@ -3,10 +3,9 @@ =20 $timezones =3D array(); $zonetab =3D file(ZONETAB); - foreach ($zonetab as $buf) - { - if (substr($buf,0,1)=3D=3D'#') continue; - $rec =3D preg_split('/\s+/',$buf); + foreach ($zonetab as $buf) { + if (substr($buf, 0, 1)=3D=3D'#') continue; + $rec =3D preg_split('/\s+/', $buf); $key =3D $rec[2]; $val =3D $rec[2]; $c =3D count($rec); @@ -15,8 +14,7 @@ ksort($timezones); } $timezoneOption =3D ""; - foreach ($timezones as $timezone =3D> $description) - { + foreach ($timezones as $timezone =3D> $description) { $timezoneOption .=3D "\n"; } ?> diff --git a/web/js/gentoaster.js b/web/js/gentoaster.js new file mode 100644 index 0000000..99cd514 --- /dev/null +++ b/web/js/gentoaster.js @@ -0,0 +1,102 @@ +$(function(){ + $("#wizard").formwizard({=20 + validationEnabled: true, + focusFirstInput: true, + disableUIStyles: true, + //historyEnabled: true, + validationOptions: { + rules: { + username: { + minlength: 2 + }, + password: { + minlength: 5 + }, + confirmpassword: { + minlength: 5, + equalTo: "#user_password" + }, + boot_size: { + min: 32 + }, + swap_size: { + min: 16 + }, + root_size: { + min: 3072 + }, + size: { + min: 4020 + } + }, + messages: { + username: { + minlength: "Your username must consist of at least 2 characters" + }, + password: { + minlength: "Your password must be at least 5 characters long" + }, + confirmpassword: { + minlength: "Your password must be at least 5 characters long", + equalTo: "Please enter the same password in both boxes" + }, + boot_size: { + min: "Your boot partition must be at least 32MB" + }, + swap_size: { + min: "Your swap partition must be at least 128MB" + }, + root_size: { + min: "Your root partition must be at least 3072MB" + }, + size: { + min: "Your disk image must be at least 4020MB" + } + } + } + }); +=09 + function partitioning_update(event, ui) { + if(!ui.values) { + ui.values =3D ui; + } + $('.partitionrange').css('width', $('.ui-slider-range').css('le= ft')); + var boot_size =3D ui.values[0]; + var swap_size =3D ui.values[1]-ui.values[0]; + var root_size =3D $("#partitioning_split").slider( "option", "m= ax" )-ui.values[1]; + var image_size =3D boot_size+swap_size+root_size; + $("#partitioning_display").html("Disk image size: "+image_size+= "MB
Boot partition size: "+boot_size+"MB
Swap partition size: "+swa= p_size+"MB
Root partition size: "+root_size+"MB"); + $("#partitioning_boot").attr("value", boot_size); + $("#partitioning_swap").attr("value", swap_size); + $("#partitioning_root").attr("value", root_size); + =20 + //since it doesn't seem to redraw by itself, hacky fix! + $("#partitioning_split").slider("option", "values", $("#partiti= oning_split").slider("option", "values"));=09 + } +=09 + $("#partitioning_split").slider({ + range: true, + min: 0, + max: 4096, + values: [128, 640], + slide: partitioning_update, + change: partitioning_update, + create: function(event, ui) { + var slider =3D $(event.target); + var range =3D slider.find('.ui-slider-range'); + var newrange =3D $('
'); + newrange.appendTo(slider).addClass('ui-slider-range partitionra= nge').css('width', range.css('left')); + } + }); +=09 + function update_slider() { + var new_size =3D $("#partitioning_size").val(); + $("#partitioning_split").slider("option", "max", new_size); + partitioning_update(null, $("#partitioning_split").slider("option", "v= alues")); + } + +=09 + $("#partitioning_size").change(update_slider); +=09 + partitioning_update(null, $("#partitioning_split").slider("option", "va= lues")); +}); \ No newline at end of file diff --git a/web/process.php b/web/process.php index 1b68d03..93c5d68 100644 --- a/web/process.php +++ b/web/process.php @@ -1,46 +1,47 @@ addServer(); - $handle =3D $client->doBackground("invoke_image_build", $ini_string); + $client =3D new GearmanClient(); + $client->addServer(); + $handle =3D $client->doBackground("invoke_image_build", $iniString); =20 - $db =3D mysql_connect("localhost","gentoaster",""); - if(!$db) die("Could not connect to database ".mysql_error()); - mysql_select_db("gentoaster"); - mysql_query("INSERT INTO builds (id, handle) VALUES('".$build_id."','".= $handle."')"); + $db =3D mysql_connect("localhost", "gentoaster", ""); + if(!$db) die("Could not connect to database ".mysql_error()); + mysql_select_db("gentoaster"); + $query =3D "INSERT INTO builds (id, handle) ". + "VALUES('".$buildID."','".$handle."')"; + mysql_query($query); =20 - header("Location: finished.php?uuid=3D".$build_id); -?> + header("Location: finished.php?uuid=3D".$buildID); \ No newline at end of file diff --git a/web/status.php b/web/status.php index 7371c16..20aacec 100644 --- a/web/status.php +++ b/web/status.php @@ -1,38 +1,55 @@ addServer(); =20 $status =3D $client->jobStatus($handle); - if($status[0]) { - if($status[3] !=3D 0) { + if ($status[0]) { + if ($status[3] !=3D 0) { $percentage =3D ceil($status[2]/$status[3]*1= 00); - $buildresult =3D "Your build is currently ru= nning and is ".$percentage."% complete"; + $buildresult =3D "Your build is currently ru= nning". + " and is ".$percentage."% com= plete"; $inprogress =3D true; } else { $buildresult =3D "Task has not yet been proc= essed"; } } else { - $result =3D mysql_query("SELECT returncode, result F= ROM builds WHERE id =3D '".mysql_real_escape_string($build_id)."'"); + $cleanBuildID =3D mysql_real_escape_string($buildID)= ; + $query =3D "SELECT returncode, result FROM builds ". + "WHERE id =3D '".$cleanBuildID."'"; + $result =3D mysql_query($query); $jobres =3D mysql_fetch_array($result); - if($jobres[0] !=3D=3D NULL) { - if($jobres[0] =3D=3D 0) { - $buildresult =3D "Your build is complete! What= would you like to do now?

DownloadTestdrive
"; - $builddone =3D true; + if ($jobres[0] !=3D=3D NULL) { + if ($jobres[0] =3D=3D 0) { + $buildresult =3D "Your build is complete= ! ". + "What would you like to d= o now?". + "

". + "". + "Testdrive". + "
". + "". + "". + "". + "". + "". + "
Download
"; + $builddone =3D true; } else { - $buildresult =3D "Job returned with code ".= $jobres[0].": ".$jobres[1]; + $buildresult =3D "Job returned with code= ".$jobres[0].": ".$jobres[1]; } } else { $buildresult =3D "Job failed"; @@ -44,44 +61,50 @@ =20 ?> - - Gentoaster - - - - - $(document).ready(function() { - $("#progressbar").progressbar({ value: '.$percentage.' }); - }); - '; - } - ?> - - -
-
-
-
-
- -

How's things?

- -

It's showtime!

- -

- -

-

-
-
-
+ + Gentoaster + + + =20 + + + $(document).ready(function() { + $("#progressbar").progressbar({ value: '.$percentage= .' }); + }); + '; + } + ?> + + +
+
+
+
+
+ +

How's things?

+ +

It's showtime!

+ +

+ +

+

+
+
+
=20 -
-
-
- - +
+
+
+ + \ No newline at end of file diff --git a/web/testdrive.php b/web/testdrive.php index b6e65b8..a313f39 100644 --- a/web/testdrive.php +++ b/web/testdrive.php @@ -1,37 +1,39 @@ addServer(); =20 $status =3D $client->jobStatus($handle); - if($status[0]) { - header("Location: status.php?uuid=3D".$build_id); + if ($status[0]) { + header("Location: status.php?uuid=3D".$buildID); } else { - $result =3D mysql_query("SELECT returncode, result F= ROM builds WHERE id =3D '".mysql_real_escape_string($build_id)."'"); + $cleanBuildID =3D mysql_real_escape_string($buildID)= ; + $query =3D "SELECT returncode, result FROM builds WH= ERE id =3D '".$cleanBuildID."'"; + $result =3D mysql_query(); $jobres =3D mysql_fetch_array($result); - if($jobres[0] !=3D=3D NULL) { - if($jobres[0] =3D=3D 0) { - // we're built, let's do this - $client =3D new GearmanClient(); - $client->addServer(); - $server =3D $client->do("invoke_start_image", $build_id); - $server =3D unserialize($server); + if ($jobres[0] !=3D=3D NULL) { + if ($jobres[0] =3D=3D 0) { + // we're built, let's do this + $client =3D new GearmanClient(); + $client->addServer(); + $server =3D $client->do("invoke_start_im= age", $buildID); + $server =3D unserialize($server); } else { - header("Location: status.php?uuid=3D".$buil= d_id); + header("Location: status.php?uuid=3D".$b= uildID); } } else { - header("Location: status.php?uuid=3D".$build= _id); + header("Location: status.php?uuid=3D".$bu= ildID); } } } else { @@ -40,114 +42,114 @@ =20 ?> - - Gentoaster - - - + + Gentoaster + + + =20 + -
- -
+ + +
+
+
+
+
+

Let's fire her up!

+
+
+
+ + + +
Loading
+ +
+
+ + Canvas not supported. + +
+
+ =20 + +
+
+
=20 -
-
-
- - +
+ + + + \ No newline at end of file