1
0

Restructured the page layout and first attempt at displaying a movie.

This commit is contained in:
Tim Almdal 2009-12-15 20:41:10 -08:00
parent b3415f9e8d
commit 8796f0bb64
6 changed files with 85 additions and 38 deletions

View File

@ -26,8 +26,7 @@ class G3_Client_Controller extends Template_Controller {
if (Session::instance()->get("g3_client_access_token")) {
$resource = G3Remote::instance()->get_resource("gallery");
$this->template->album_tree = $this->_get_album_tree($resource);
$this->template->detail = $this->_get_detail($resource);
$this->template->content = $this->_get_main_view($resource);
} else {
$this->template->content = new View('login.html');
$this->template->content->errors = $this->template->content->form =
@ -45,9 +44,8 @@ class G3_Client_Controller extends Template_Controller {
$token = G3Remote::instance()->get_access_token($post["user"], $post["password"]);
Session::instance()->set("g3_client_access_token", $token);
$resource = G3Remote::instance()->get_resource("gallery");
$content = array(
"album_tree" => $this->_get_album_tree($resource),
"detail" => $this->_get_detail($resource));
$valid = true;
$content = $this->_get_main_view($resource);
} catch (Exception $e) {
Kohana_Log::add("error", Kohana_Exception::text($e));
$valid = false;
@ -61,7 +59,7 @@ class G3_Client_Controller extends Template_Controller {
}
$this->auto_render = false;
print json_encode(array("status" => $valid ? "ok" : "error", "content" => $content));
print json_encode(array("status" => $valid ? "ok" : "error", "content" => (string)$content));
}
public function albums() {
@ -91,6 +89,13 @@ class G3_Client_Controller extends Template_Controller {
return $v;
}
private function _get_main_view($resource) {
$v = new View("main.html");
$v->album_tree = $this->_get_album_tree($resource);
$v->detail = $this->_get_detail($resource);
return $v;
}
private function _get_detail($resource) {
$v = new View("{$resource->type}_detail.html");
$v->resource = $resource;

View File

@ -18,10 +18,11 @@
<?= html::script("js/jquery.js") ?>
<?= html::script("js/jquery.form.js") ?>
<?= html::script("js/jquery-ui.js") ?>
<?= html::script("lib/flowplayer.js") ?>
<?= html::script("js/g3_client.js") ?>
<script type="text/javascript">
$(document).ready(function () {
$("#body div").gallery3_client();
$("#body").gallery3_client();
});
</script>
</head>
@ -31,12 +32,7 @@
<div>&nbsp;</div>
</div>
<div id="body">
<div id="left">
<ul id="album_tree"><?= $album_tree ?></ul>
</div>
<div id="center">
<?= $detail ?>
</div>
<?= $content ?>
</div>
<div id="footer" class="ui-helper-clearfix">
<p class="copyright">

View File

@ -1,27 +1,29 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul>
<li id="g-login-form">
<?= form::open("g3_client/login") ?>
<fieldset>
<legend>Please provide your userid and password for the remote system</legend>
<ul>
<li>
<?= form::label("user", "User Id:") ?><br/>
<?= form::input("user", $form["user"]) ?>
<?= empty($errors["user"]) ? "" : "<span class=\"error\">{$errors["user"]}</span>" ?>
</li>
<li>
<?= form::label("password", "Password") ?><br/>
<?= form::password("password", $form["password"]) ?>
<?= empty($errors["password"]) ? "" : "<span class=\"error\">{$errors["password"]}</span>" ?>
</li>
<li>
<?= form::submit("submit", "Login") ?>
<?= form::input(array('type'=>'reset','name'=>'reset'), "Reset") ?>
</li>
</ul>
</fieldset>
</form>
</li>
</ul>
<div id="login">
<ul>
<li id="g-login-form">
<?= form::open("g3_client/login") ?>
<fieldset>
<legend>Please provide your userid and password for the remote system</legend>
<ul>
<li>
<?= form::label("user", "User Id:") ?><br/>
<?= form::input("user", $form["user"]) ?>
<?= empty($errors["user"]) ? "" : "<span class=\"error\">{$errors["user"]}</span>" ?>
</li>
<li>
<?= form::label("password", "Password") ?><br/>
<?= form::password("password", $form["password"]) ?>
<?= empty($errors["password"]) ? "" : "<span class=\"error\">{$errors["password"]}</span>" ?>
</li>
<li>
<?= form::submit("submit", "Login") ?>
<?= form::input(array('type'=>'reset','name'=>'reset'), "Reset") ?>
</li>
</ul>
</fieldset>
</form>
</li>
</ul>
</div>

View File

@ -0,0 +1,7 @@
<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<div id="left">
<ul id="album_tree"><?= $album_tree ?></ul>
</div>
<div id="center">
<?= $detail ?>
</div>

View File

@ -0,0 +1,25 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="movie">
<a id="movie-link" href="<?= $resource->url ?>" title="<?= $resource->title ?>" />
</div>
<script type="text/javascript">
flowplayer(
"movie-link",
{
src: "http://sandbox.timalmdal.com/g3_client/lib/flowplayer.swf",
wmode: "transparent"
},
{
plugins: {
h264streaming: {
url: "http://sandbox.timalmdal.com/g3_client/lib/flowplayer.h264streaming.swf"
},
controls: {
autoHide: 'always',
hideDelay: 2000
}
}
}
)
</script>

View File

@ -59,6 +59,18 @@ span.error {
color: #557d10;
}
#body #login {
background-color: #FFFFFF;
border: 2px inset;
bottom: 20px;
left: 20px;
margin: 0;
padding: 5px;
position: absolute;
right: 20px;
top: 11px;
}
#body #left {
background-color: #FFFFFF;
border: 2px inset;