37 Commits

Author SHA1 Message Date
8aa3aa1415 Merge branch 'release-0.3' 2011-08-29 19:28:03 +01:00
ab5d242750 Version bump to 0.3 2011-08-29 19:27:40 +01:00
f8ba99932c Merge branch 'feature-settings' into develop 2011-08-29 19:24:09 +01:00
4818193d37 Sort admin settings by name to make searching easier 2011-08-29 19:22:56 +01:00
196f80bbf5 Expose UI for renaming admin settings 2011-08-29 19:20:28 +01:00
cf250c39f6 Merge branch 'feature-settings' into develop 2011-08-28 16:19:52 +01:00
5d851dd977 Add support for removing admin settings 2011-08-28 16:19:26 +01:00
7be1279a80 Merge branch 'feature-settings' into develop 2011-08-28 13:04:01 +01:00
aec18cb810 Admin settings updated with add new setting feature 2011-08-28 13:03:31 +01:00
25449d4d3d Rename add-setting to new-setting. Will reuse name for the backend 2011-08-28 10:32:54 +01:00
cab3a51323 Add initial support for adding settings.
Adds "Add Setting" button to table, and shows a popup with form
elements for adding a new setting. Does not yet add setting to the db.
2011-08-27 20:25:48 +01:00
5807af8b8f Move admin settings value into dedicated template file 2011-08-27 19:53:35 +01:00
c377d6bd84 Merge branch 'feature-settings' into develop 2011-08-26 19:05:05 +01:00
7e823d5d91 Tidy names of javascript functions in setting handling 2011-08-26 19:03:54 +01:00
7ddacb2426 Removed temporary directories, as these have moved to /tmp (default) 2011-08-26 19:02:46 +01:00
4603a290e8 Merge branch 'feature-settings' into develop 2011-08-26 18:58:39 +01:00
f884e93021 Complete settings update including success dialog 2011-08-26 18:41:40 +01:00
91749f7f85 Set dialog title for source deletion 2011-08-26 18:40:48 +01:00
e7cf24bb4f Bug fix: add dir to smarty plugin dir list rather than replacing orig 2011-08-26 17:41:07 +01:00
3497eb8e1e First attempt at admin settings page with writeable database backend.
Currently broken due to PHP's transparent conversion of "." to "_" in
POST variable names!
2011-08-24 02:40:16 +01:00
807514daa8 Merge branch 'release-0.2.1' into develop 2011-08-23 02:11:48 +01:00
6648fd8b24 Merge branch 'release-0.2.1' 2011-08-23 02:11:32 +01:00
073da2c4e2 Bumped version to 0.2.1 2011-08-23 02:11:02 +01:00
d474fba2b3 Merge branch 'feature-summaries' into develop 2011-08-23 02:08:40 +01:00
c5eb93dd46 Add hostname to job details worker logs 2011-08-23 01:35:51 +01:00
fbc6f7da48 Add date to job details page. 2011-08-23 01:29:54 +01:00
49e5635a71 Bug fix: save plugin information in job record 2011-08-23 01:28:37 +01:00
8739f6c516 Expose job log display options in the UI 2011-08-23 00:05:21 +01:00
5f786d16d7 Add control of job log message count and sort order via URL 2011-08-22 23:18:57 +01:00
22a3d94dc3 Move job details page and update references 2011-08-22 22:51:46 +01:00
f3415ff57a Merge commit 'release-0.2' into develop 2011-08-22 19:05:40 +01:00
6a57a6fca5 Merge branch 'release-0.2' 2011-08-22 19:04:36 +01:00
a061c23041 Bumped version number to 0.2 2011-08-22 19:03:36 +01:00
4300034afa Merge branch 'feature-ajax' into develop 2011-08-22 18:48:59 +01:00
eb1e330bc4 Added ajax support, and verified with an ajaxified Delete Source feature 2011-08-22 18:47:45 +01:00
41fc0a2cc3 Improve logging in HandBrake worker 2011-08-21 16:12:32 +01:00
95fe2e7641 Add additional logging for batch job runner 2011-08-21 16:11:51 +01:00
50 changed files with 1451 additions and 131 deletions

View File

@@ -67,18 +67,18 @@ class Net_Gearman_Job_HandBrake extends Net_Gearman_Job_Common implements Rippin
// Remove any temporary output files // Remove any temporary output files
if (file_exists($args['temp_output_filename'])) { if (file_exists($args['temp_output_filename'])) {
$result = unlink($args['temp_output_filename']); $result = unlink($args['temp_output_filename']);
if ($result) { if (!$result) {
RippingCluster_WorkerLogEntry::warning($log, $this->job->id(), "Failed to remove temporary output file, still exists at '{$args['temp_output_filename']}'."); RippingCluster_WorkerLogEntry::warning($log, $this->job->id(), "Failed to remove temporary output file, still exists at '{$args['temp_output_filename']}'.");
} }
} }
$this->fail($return_val); $this->fail("Call to HandBrake failed with return code {$return_val}.");
} else { } else {
// Copy the temporary output file to the desired destination // Copy the temporary output file to the desired destination
$move = copy($args['temp_output_filename'], $args['rip_options']['output_filename']); $move = copy($args['temp_output_filename'], $args['rip_options']['output_filename']);
if ($move) { if ($move) {
// Remove the temporary output file // Remove the temporary output file
$result = unlink($args['temp_output_filename']); $result = unlink($args['temp_output_filename']);
if ($result) { if (!$result) {
RippingCluster_WorkerLogEntry::warning($log, $this->job->id(), "Failed to remove temporary output file, still exists at '{$args['temp_output_filename']}'."); RippingCluster_WorkerLogEntry::warning($log, $this->job->id(), "Failed to remove temporary output file, still exists at '{$args['temp_output_filename']}'.");
} }
@@ -90,7 +90,7 @@ class Net_Gearman_Job_HandBrake extends Net_Gearman_Job_Common implements Rippin
} else { } else {
RippingCluster_WorkerLogEntry::error($log, $this->job->id(), "Failed to copy temporary output file to proper destination. File retained as '{$args['temp_output_filename']}'."); RippingCluster_WorkerLogEntry::error($log, $this->job->id(), "Failed to copy temporary output file to proper destination. File retained as '{$args['temp_output_filename']}'.");
$this->job->updateStatus(RippingCluster_JobStatus::FAILED); $this->job->updateStatus(RippingCluster_JobStatus::FAILED);
$this->fail('-1'); $this->fail('Encode complete, but output file could not be copied to the correct place.');
} }
} }
} }
@@ -133,7 +133,7 @@ class Net_Gearman_Job_HandBrake extends Net_Gearman_Job_Common implements Rippin
$status = $rip->job->currentStatus(); $status = $rip->job->currentStatus();
$status->updateRipProgress($matches[1]); $status->updateRipProgress($matches[1]);
$this->status($matches[1], 100); $this->status($matches[1], 100);
} else { } else if (!preg_match('/^\s+$/', $line)) {
$log = RippingCluster_Main::instance()->log(); $log = RippingCluster_Main::instance()->log();
RippingCluster_WorkerLogEntry::debug($log, $rip->job->id(), $line); RippingCluster_WorkerLogEntry::debug($log, $rip->job->id(), $line);
} }

View File

@@ -183,10 +183,12 @@ class RippingCluster_Job {
$database = RippingCluster_Main::instance()->database(); $database = RippingCluster_Main::instance()->database();
$database->insert( $database->insert(
'INSERT INTO jobs 'INSERT INTO jobs
(id,name,source,destination,title,format,video_codec,video_width,video_height,quantizer,deinterlace,audio_tracks,audio_codecs,audio_names,subtitle_tracks) (id,name,source_plugin,rip_plugin,source,destination,title,format,video_codec,video_width,video_height,quantizer,deinterlace,audio_tracks,audio_codecs,audio_names,subtitle_tracks)
VALUES(NULL,:name,:source,:destination,:title,:format,:video_codec,:video_width,:video_height,:quantizer,:deinterlace,:audio_tracks,:audio_codecs,:audio_names,:subtitle_tracks)', VALUES(NULL,:name,:source,:destination,:title,:format,:video_codec,:video_width,:video_height,:quantizer,:deinterlace,:audio_tracks,:audio_codecs,:audio_names,:subtitle_tracks)',
array( array(
array('name' => 'name', 'value' => $this->name, 'type' => PDO::PARAM_STR), array('name' => 'name', 'value' => $this->name, 'type' => PDO::PARAM_STR),
array('name' => 'source_plugin', 'value' => $this->source_plugin, 'type' => PDO::PARAM_STR),
array('name' => 'rip_plugin', 'value' => $this->rip_plugin, 'type' => PDO::PARAM_STR),
array('name' => 'source', 'value' => $this->source_filename, 'type' => PDO::PARAM_STR), array('name' => 'source', 'value' => $this->source_filename, 'type' => PDO::PARAM_STR),
array('name' => 'destination', 'value' => $this->destination_filename, 'type' => PDO::PARAM_STR), array('name' => 'destination', 'value' => $this->destination_filename, 'type' => PDO::PARAM_STR),
array('name' => 'title', 'value' => $this->title, 'type' => PDO::PARAM_INT), array('name' => 'title', 'value' => $this->title, 'type' => PDO::PARAM_INT),
@@ -333,6 +335,14 @@ class RippingCluster_Job {
return $this->name; return $this->name;
} }
public function sourcePlugin() {
return $this->source_plugin;
}
public function ripPlugin() {
return $this->rip_plugin;
}
public function sourceFilename() { public function sourceFilename() {
return $this->source_filename; return $this->source_filename;
} }

View File

@@ -17,6 +17,7 @@ class RippingCluster_Main extends SihnonFramework_Main {
$this->request = new RippingCluster_RequestParser($request_string); $this->request = new RippingCluster_RequestParser($request_string);
switch (HBC_File) { switch (HBC_File) {
case 'ajax':
case 'index': { case 'index': {
$smarty_tmp = '/tmp/ripping-cluster'; $smarty_tmp = '/tmp/ripping-cluster';
$this->smarty = new Smarty(); $this->smarty = new Smarty();
@@ -24,14 +25,17 @@ class RippingCluster_Main extends SihnonFramework_Main {
$this->smarty->compile_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/templates'); $this->smarty->compile_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/templates');
$this->smarty->cache_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/cache'); $this->smarty->cache_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/cache');
$this->smarty->config_dir = static::makeAbsolutePath($smarty_tmp . '/config'); $this->smarty->config_dir = static::makeAbsolutePath($smarty_tmp . '/config');
$this->smarty->plugins_dir[]= static::makeAbsolutePath('./source/smarty/plugins');
$this->smarty->registerPlugin('modifier', 'formatDuration', array('RippingCluster_Main', 'formatDuration')); $this->smarty->registerPlugin('modifier', 'formatDuration', array('RippingCluster_Main', 'formatDuration'));
$this->smarty->registerPlugin('modifier', 'formatFilesize', array('RippingCluster_Main', 'formatFilesize')); $this->smarty->registerPlugin('modifier', 'formatFilesize', array('RippingCluster_Main', 'formatFilesize'));
$this->smarty->assign('version', '0.1'); $this->smarty->assign('version', '0.3');
$this->smarty->assign('messages', array()); $this->smarty->assign('messages', array());
$this->smarty->assign('base_uri', $this->base_uri); $this->smarty->assign('base_uri', $this->base_uri);
$this->smarty->assign('base_url', static::absoluteUrl(''));
} break; } break;
} }

View File

@@ -1,6 +1,13 @@
<?php <?php
require_once '/etc/ripping-cluster/config.php'; if (isset($_SERVER['RIPPING_CLUSTER_CONFIG']) &&
file_exists($_SERVER['RIPPING_CLUSTER_CONFIG']) &&
is_readable($_SERVER['RIPPING_CLUSTER_CONFIG'])) {
require_once($_SERVER['RIPPING_CLUSTER_CONFIG']);
} else {
require_once '/etc/ripping-cluster/config.php';
}
require_once SihnonFramework_Lib . 'SihnonFramework/Main.class.php'; require_once SihnonFramework_Lib . 'SihnonFramework/Main.class.php';
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib, SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,

22
webui/a.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
define('HBC_File', 'ajax');
require '_inc.php';
try {
$main = RippingCluster_Main::instance();
RippingCluster_LogEntry::setLocalProgname('webui');
$smarty = $main->smarty();
$page = new RippingCluster_Page($smarty, $main->request());
if ($page->evaluate()) {
//header('Content-Type: text/json');
$smarty->display('ajax.tpl');
}
} catch (RippingCluster_Exception $e) {
die("Uncaught Exception: " . $e->getMessage());
}
?>

View File

@@ -29,8 +29,12 @@ try {
$set->addTask($task); $set->addTask($task);
$job->updateStatus(RippingCluster_JobStatus::QUEUED); $job->updateStatus(RippingCluster_JobStatus::QUEUED);
RippingCluster_ClientLogEntry::info($log, $rip_options['id'], 'Job queued', 'client');
} }
$job_count = count($jobs);
RippingCluster_ClientLogEntry::info($log, null, "Job queue started with {$job_count} jobs.", 'batch');
// Start the job queue // Start the job queue
$result = $client->runSet($set); $result = $client->runSet($set);
@@ -58,7 +62,7 @@ function gearman_fail($task) {
$job = RippingCluster_Job::fromId($task->arg['rip_options']['id']); $job = RippingCluster_Job::fromId($task->arg['rip_options']['id']);
$job->updateStatus(RippingCluster_JobStatus::FAILED); $job->updateStatus(RippingCluster_JobStatus::FAILED);
RippingCluster_ClientLogEntry::info($log, $job->id(), 'Job failed'); RippingCluster_ClientLogEntry::info($log, $job->id(), "Job failed with message: {$task->result}");
} }

339
webui/scripts/main.js Normal file
View File

@@ -0,0 +1,339 @@
var rc = {
init: function() {
rc.ajax.init();
rc.dialog.init();
rc.page.init();
},
ajax: {
init: function() {
},
get: function(url) {
$.ajax({
url: url,
type: "GET",
dataType: "json",
success: rc.ajax.success,
error: rc.ajax.failure
});
},
post: function(url, data) {
$.ajax({
url: url,
type: "POST",
dataType: "json",
data: data,
success: rc.ajax.success,
error: rc.ajax.failure
});
},
success: function(d, s, x) {
rc.page.update(d);
rc.dialog.prepare(d);
rc.trigger_all(d);
},
failure: function(x, s, e) {
console.log("Ajax Failure: " + s, e);
console.log(x.responseText);
}
},
dialog: {
init: function() {
$("#dialogheaderclose").click(rc.dialog.close);
},
prepare: function(d) {
if (d.dialog && d.dialog.show) {
if (d.dialog.buttons) {
switch (d.dialog.buttons.type) {
case 'ok':
$("#dialogfooterok").click(
function() {
rc.trigger(d.dialog.buttons.actions.ok, d.dialog.buttons.params);
}
);
$("#dialogfooterok").show();
break;
case 'okcancel':
$("#dialogfooterokcancel_ok").click(function() {
rc.trigger(d.dialog.buttons.actions.ok, d.dialog.buttons.params);
});
$("#dialogfooterokcancel_cancel").click(function() {
rc.trigger(d.dialog.buttons.actions.cancel, d.dialog.buttons.params);
});
$("#dialogfooterokcancel").show();
break;
case 'yesno':
$("#dialogfooteryes").click(
function() {
rc.trigger(d.dialog.buttons.actions.yes, d.dialog.buttons.params);
}
);
$("#dialogfooterno").click(
function() {
rc.trigger(d.dialog.buttons.actions.no, d.dialog.buttons.params);
}
);
$("#dialogfooteryesno").show();
break;
}
}
if (d.dialog.title) {
$('#dialogheadertitle').html(d.dialog.title);
}
if (d.dialog.content) {
$('#dialogcontent').html(d.dialog.content);
}
$("#dialog").show();
}
},
close: function() {
// Hide the dialog
$("#dialog").hide();
// Remove the dialog content
$("#dialogcontent").html();
// Hide all buttons
$(".dialogfooterbuttonset").hide();
// Strip all event handlers
$(".dialogfooterbuttonset input[type='button']").unbind('click');
},
error: function(title, content, messages) {
var formatted_content = $('<div>').append($('<p>').text('content'));
if (messages) {
var formatted_messages = $('<ul>');
for (var message in messages) {
formatted_messages.append($('<li>').text(message));
}
formatted_content.append($('<p>').text('These messages were reported:').append(formatted_messages));
}
rc.dialog.prepare({
dialog: {
show: true,
title: title,
content: formatted_content,
buttons: {
type: 'ok',
actions: {
ok: 'close-dialog'
}
}
}
});
}
},
page: {
init: function() {
},
update: function(d) {
for ( var f in d.page_replacements) {
$("#" + f).html(d.page_replacements[f].content);
}
}
},
sources: {
remove: function(plugin, source) {
rc.ajax.get(base_url + "ajax/delete-source/plugin/" + plugin + "/id/" + source);
},
remove_confirmed: function(plugin, source) {
rc.ajax.get(base_url + "ajax/delete-source/plugin/" + plugin + "/id/" + source + "/confirm/");
}
},
actions: {
'close-dialog': function(params) {
rc.dialog.close();
},
'delete-source-confirm': function(params) {
rc.sources.remove_confirmed(params['plugin'], params['id']);
},
'add-setting': function(params) {
rc.ajax.post(base_url + 'ajax/admin/add-setting/name/' + $('#'+params.name).val() + '/type/' + $('#'+params.type).val() + '/');
},
'add_setting_row': function(params) {
$("#settings tbody").append(params.content);
},
'rename_setting': function(params) {
rc.ajax.post(base_url + 'ajax/admin/rename-setting/name/' + params.name + '/new-name/' + $('#'+params.new_name_field).val() + '/confirm/');
},
'rename_setting_confirm': function(params) {
$('#setting_'+params.old_id+'_row').replaceWith($(params.content));
},
'remove_setting': function(params) {
rc.ajax.post(base_url + 'ajax/admin/remove-setting/name/' + params.name + '/');
rc.trigger('remove_setting_row', params);
},
'remove_setting_row': function(params) {
$('#setting_' + params.id + '_row').remove();
}
},
trigger: function(action, params) {
// Handle a list of actions by repeated calling self for each argument
if (action instanceof Array) {
for(i in action) {
rc.trigger(action[i], params);
}
return;
}
// Check if action is supported, and execute it
if (rc.actions[action]) {
rc.actions[action](params);
} else {
console.log("Action not supported: " +action);
}
},
trigger_all: function(params) {
if (params.actions) {
for (var action in params.actions) {
rc.trigger(action, params.actions[action]);
}
}
},
settings: {
init: function() {
$("#settings_save").click(function() {
rc.settings.save();
});
$("#settings_new").click(function() {
rc.settings.new_setting();
});
},
new_setting: function() {
rc.ajax.get(base_url + "ajax/admin/new-setting/");
},
rename_setting: function(id, name) {
rc.ajax.get(base_url + "ajax/admin/rename-setting/name/" + name + "/");
},
remove_setting: function(id, name) {
rc.dialog.prepare({
dialog: {
show: true,
title: 'Remove setting',
content: "Do you really want to remove setting '" + name + "'",
buttons: {
type: 'okcancel',
actions: {
ok: [
'remove_setting',
'close-dialog'
],
cancel: 'close-dialog'
},
params: {
id: id,
name: name
}
}
}
});
},
add_stringlist_field: function(id) {
var container = $('#container_'+id);
var next = $('#settings_'+id+'_next');
var next_value = next.val();
var line = $('<div>');
line.attr('id', 'settings_'+id+'_line'+next.val());
line.append($('<input type="text" class="settings_field_string" />'));
line.append(' ');
var button = $('<input type="button" value="-" class="settings_field_remove"/>');
button.click(function() {
rc.settings.remove_field(id, next_value);
});
line.append(button);
// Add the new item
container.append(line);
// Increment the next counter
next.val(parseInt(next_value)+1);
},
remove_stringlist_field: function(id, line) {
$("#settings_"+id+"_line"+line).remove();
},
save: function() {
var settings = {};
var fields = $("input.setting").get();
for (var i in fields) {
var setting = fields[i];
var name = setting.name;
var value;
switch(setting.type) {
case 'checkbox':
value = $(setting).is(':checked') ? 1 : 0;
break;
default:
value = setting.value;
}
if (/\[\]$/.test(name)) {
if (! settings[name]) {
settings[name] = [];
}
settings[name].push(value);
} else {
settings[name] = value;
}
}
rc.ajax.post(base_url + "ajax/update-settings/", settings);
}
}
};
$(document).ready(rc.init);

View File

@@ -0,0 +1,11 @@
<?php
$main = RippingCluster_Main::instance();
$config = $main->config();
$settings = $config->enumerateAll();
asort($settings);
$this->smarty->assign('settings', $settings);
$this->smarty->assign('config', $config);
?>

View File

@@ -0,0 +1,51 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
$messages = array();
$result = false;
try {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$type = $req->get('type', 'RippingCluster_Exception_InvalidParameters');
// Convert the web-friendly type field into the correct internal name
$value = null;
switch($type) {
case 'bool': {
$type = Sihnon_Config::TYPE_BOOL;
$value = false;
} break;
case 'int': {
$type = Sihnon_Config::TYPE_INT;
$value = 0;
} break;
case 'string': {
$type = Sihnon_Config::TYPE_STRING;
$value = '';
} break;
case 'string-list': {
$type = Sihnon_Config::TYPE_STRING_LIST;
$value = array();
} break;
}
// Add the new (empty) value. This is because no suitable UI has been presented yet.
// Possible future fix, to insert intermediate dialog to capture the value using the correct UI.
$result = $config->add($name, $type, $value);
$this->smarty->assign('success', $result);
$this->smarty->assign('name', $name);
$this->smarty->assign('id', str_replace('.', '-',$name));
$this->smarty->assign('type', $type);
$this->smarty->assign('value', '');
} catch(RippingCluster_Exception $e) {
$messages[] = get_class($e) . ':' . $e->getMessage();
$this->smarty->assign('messages', $messages);
$this->smarty->assign('success', false);
}
?>

View File

@@ -0,0 +1,23 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
$messages = array();
$result = false;
try {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$result = $config->remove($name);
$this->smarty->assign('success', $result);
} catch(RippingCluster_Exception $e) {
$messages[] = get_class($e) . ':' . $e->getMessage();
$this->smarty->assign('messages', $messages);
$this->smarty->assign('success', false);
}
?>

View File

@@ -0,0 +1,39 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
$messages = array();
$result = false;
$confirm = $req->exists('confirm');
$this->smarty->assign('confirm', $confirm);
if ($confirm) {
try {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$new_name = $req->get('new-name', 'RippingCluster_Exception_InvalidParameters');
$result = $config->rename($name, $new_name);
$this->smarty->assign('success', $result);
$this->smarty->assign('old_name', $name);
$this->smarty->assign('old_id', str_replace('.', '-', $name));
$this->smarty->assign('name', $new_name);
$this->smarty->assign('id', str_replace('.', '-', $new_name));
$this->smarty->assign('type', $config->type($new_name));
$this->smarty->assign('value', $config->get($new_name));
} catch(RippingCluster_Exception $e) {
$messages[] = get_class($e) . ':' . $e->getMessage();
$this->smarty->assign('messages', $messages);
$this->smarty->assign('success', false);
}
} else {
$name = $req->get('name', 'RippingCluster_Exception_InvalidParameters');
$this->smarty->assign('name', $name);
}
?>

View File

@@ -0,0 +1,35 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$config = $main->config();
// Grab the name of this source
$encoded_filename = null;
if ($req->exists('confirm')) {
$this->smarty->assign('confirmed', true);
$plugin = $req->get('plugin', 'RippingCluster_Exception_InvalidParameters');
$encoded_filename = $req->get('id', 'RippingCluster_Exception_InvalidParameters');
$source = RippingCluster_Source_PluginFactory::loadEncoded($plugin, $encoded_filename, false);
$source->delete();
// Generate a new list of sources to update the page with
$all_sources = RippingCluster_Source_PluginFactory::enumerateAll();
$this->smarty->assign('all_sources', $all_sources);
} else {
$this->smarty->assign('confirmed', false);
$plugin = $req->get('plugin', 'RippingCluster_Exception_InvalidParameters');
$encoded_filename = $req->get('id', 'RippingCluster_Exception_InvalidParameters');
$source = RippingCluster_Source_PluginFactory::loadEncoded($plugin, $encoded_filename, false);
$this->smarty->assign('source', $source);
$this->smarty->assign('source_plugin', $plugin);
$this->smarty->assign('source_id', $encoded_filename);
}
?>

View File

@@ -0,0 +1,9 @@
<?php
$main = RippingCluster_Main::instance();
$config = $main->config();
$all_sources = RippingCluster_Source_PluginFactory::enumerateAll();
$this->smarty->assign('all_sources', $all_sources);
?>

View File

@@ -0,0 +1,22 @@
<?php
$main = RippingCluster_Main::instance();
$config = $main->config();
$messages = array();
// Iterate over the settings and store each one back to the backend
foreach($_POST as $key => $value) {
// Convert - to . (to work around the PHP register global backwards compatibility that renames input variables)
$key = str_replace("-", ".", $key);
if ($config->exists($key)) {
$config->set($key, $value);
} else {
$messages[] = "Unknown config key '{$key}', value not updated.";
}
}
$this->smarty->assign('messages', $messages);
?>

View File

@@ -1,15 +0,0 @@
<?php
$job_id = $this->request->get('id');
$job = RippingCluster_Job::fromId($job_id);
$this->smarty->assign('job', $job);
$log = RippingCluster_Main::instance()->log();
$client_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'webui', 'job_id', $job_id, 'ctime', SihnonFramework_Log::ORDER_DESC, 30);
$worker_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'worker', 'job_id', $job_id, 'ctime', SihnonFramework_Log::ORDER_DESC, 30);
$this->smarty->assign('client_log_entries', $client_log_entries);
$this->smarty->assign('worker_log_entries', $worker_log_entries);
?>

View File

@@ -0,0 +1,45 @@
<?php
$main = RippingCluster_Main::instance();
$req = $main->request();
$log = $main->log();
$config = $main->config();
$job_id = $req->get('id');
$job = RippingCluster_Job::fromId($job_id);
$this->smarty->assign('job', $job);
// Fetch log entries for this job
$log_count = $req->get('logs', $config->get('job.logs.default_display_count'));
$default_log_order = $config->get('job.logs.default_order');
$log_order = $req->get('order', $default_log_order);
if ( ! in_array($log_order, array(SihnonFramework_Log::ORDER_ASC, SihnonFramework_Log::ORDER_DESC))) {
$log_order = $default_log_order;
}
$this->smarty->assign('log_order', $log_order);
$this->smarty->assign('log_order_reverse', ($log_order == SihnonFramework_Log::ORDER_ASC ? SihnonFramework_Log::ORDER_DESC : SihnonFramework_Log::ORDER_ASC));
$client_log_entries = array();
$worker_log_entries = array();
$log_count_display = null;
if ($log_count == 'all') {
$log_count_display = 'all';
$log_count = '18446744073709551615'; // see mysql man page for LIMIT
} else if(!is_int($log_count)) {
$log_count = $config->get('job.logs.default_display_count');
$log_count_display = $log_count;
} else {
$log_count_display = $log_count;
}
$client_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'webui', 'job_id', $job_id, 'ctime', $log_order, $log_count);
$worker_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'worker', 'job_id', $job_id, 'ctime', $log_order, $log_count);
$this->smarty->assign('log_count_display', $log_count_display);
$this->smarty->assign('client_log_entries', $client_log_entries);
$this->smarty->assign('worker_log_entries', $worker_log_entries);
?>

View File

@@ -15,7 +15,7 @@ if ($req->exists('submit')) {
// Spawn the background client process to run all the jobs // Spawn the background client process to run all the jobs
RippingCluster_Job::runAllJobs(); RippingCluster_Job::runAllJobs();
RippingCluster_Page::redirect('rips/setup-rip/queued'); RippingCluster_Page::redirect('rips/setup/queued');
} elseif ($req->exists('queued')) { } elseif ($req->exists('queued')) {
$this->smarty->assign('rips_submitted', true); $this->smarty->assign('rips_submitted', true);

View File

@@ -0,0 +1,292 @@
<?php
/**
* Switch statement plugin for smarty.
* This smarty plugin provides php switch statement functionality in smarty tags.
* To install this plugin drop it into your smarty plugins folder. You will also need to manually
* load the plugin sot hat all the hooks are registered properly. Add the following line after
* you load smarty and create an instance of it in your source code.
*
* <code>
* $this->smartyObj->loadPlugin('smarty_compiler_switch');
* </code>
*
* @author Jeremy Pyne <jeremy.pyne@gmail.com>
* - Donations: Accepted via PayPal at the above address.
* - Updated: 02/10/2010 - Version 3.2
* - File: smarty/plugins/compiler.switch.php
* - Licence: CC:BY/NC/SA http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* - Updates
* Version 2:
* Changed the break attribute to cause a break to be printed before the next case, instead of before this
* case. This way makes more sense and simplifies the code. This change in incompatible with code in
* from version one. This is written to support nested switches and will work as expected.
* Version 2.1:
* Added {/case} tag, this is identical to {break}.
* Version 3:
* Updated switch statment to support Smarty 3. This update is NOT backwards compatible but the old version is still maintained.
* Version 3.1:
* Added a prefilter to re-enable the shorthand {switch $myvar} support. To use the shorthand form you will need to add the following line to your code.
* $smarty->loadPlugin('smarty_compiler_switch');
* Version 3.2:
* Fixed a bug when chaining multiple {case} statements without a {break}.
* Version 3.5:
* Updated to work with Smarty 3.0 release. (Tested and working with 3.0.5, no longer compatible with 3.0rcx releases.)
*
* - Bugs/Notes:
*
* @package Smarty
* @subpackage plugins
*
* Sample usage:
* <code>
* {foreach item=$debugItem from=$debugData}
* // Switch on $debugItem.type
* {switch $debugItem.type}
* {case 1}
* {case "invalid_field"}
* // Case checks for string and numbers.
* {/case}
* {case $postError}
* {case $getError|cat:"_ajax"|lower}
* // Case checks can also use variables and modifiers.
* {break}
* {default}
* // Default case is supported.
* {/switch}
* {/foreach}
* </code>
*
* Note in the above example that the break statements work exactly as expected. Also the switch and default
* tags can take the break attribute. If set they will break automatically before the next case is printed.
*
* Both blocks produce the same switch logic:
* <code>
* {case 1 break}
* Code 1
* {case 2}
* Code 2
* {default break}
* Code 3
* </code>
*
* <code>
* {case 1}
* Code 1
* {break}
* {case 2}
* Code 2
* {default}
* Code 3
* {break}
* </code>
*
* Finally, there is an alternate long hand style for the switch statments that you may need to use in some cases.
*
* <code>
* {switch var=$type}
* {case value="box" break}
* {case value="line"}
* {break}
* {default}
* {/switch}
* </code>
*/
//Register the post and pre filters as they are not auto-registered.
$this->registerFilter('post', 'smarty_postfilter_switch');
class Smarty_Compiler_Switch extends Smarty_Internal_CompileBase {
public $required_attributes = array('var');
public $optional_attributes = array();
public $shorttag_order = array('var');
/**
* Start a new switch statement.
* A variable must be passed to switch on.
* Also, the switch can only directly contain {case} and {default} tags.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
$_output = '';
$this->_open_tag('switch',array($compiler->tag_nocache));
if (is_array($attr['var'])) {
$_output .= "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$attr['var']['var']."])) \$_smarty_tpl->tpl_vars[".$attr['var']['var']."] = new Smarty_Variable;";
$_output .= "switch (\$_smarty_tpl->tpl_vars[".$attr['var']['var']."]->value = ".$attr['var']['value']."){?>";
} else {
$_output .= '<?php switch (' . $attr['var'] . '){?>';
}
return $_output;
}
}
class Smarty_Compiler_Case extends Smarty_Internal_CompileBase {
public $required_attributes = array('value');
public $optional_attributes = array('break');
public $shorttag_order = array('value', 'break');
/**
* Print out a case line for this switch.
* A condition must be passed to match on.
* This can only go in {switch} tags.
* If break is passed, a {break} will be rendered before the next case.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
$_output = '';
list($last_tag, $last_attr) = $this->compiler->_tag_stack[count($this->compiler->_tag_stack) - 1];
if($last_tag == 'case')
{
list($break, $compiler->tag_nocache) = $this->_close_tag(array('case'));
if($last_attr[0])
$_output .= '<?php break;?>';
}
$this->_open_tag('case', array(isset($attr['break']) ? $attr['break'] : false, $compiler->tag_nocache));
if (is_array($attr['value'])) {
$_output .= "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$attr['value']['var']."])) \$_smarty_tpl->tpl_vars[".$attr['value']['var']."] = new Smarty_Variable;";
$_output .= "case \$_smarty_tpl->tpl_vars[".$attr['value']['var']."]->value = ".$attr['value']['value'].":?>";
} else {
$_output .= '<?php case ' . $attr['value'] . ':?>';
}
return $_output;
}
}
class Smarty_Compiler_Default extends Smarty_Internal_CompileBase {
public $required_attributes = array();
public $optional_attributes = array('break');
public $shorttag_order = array('break');
/**
* Print out a default line for this switch.
* This can only go in {switch} tags.
* If break is passed, a {break} will be rendered before the next case.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
$_output = '';
list($last_tag, $last_attr) = $this->compiler->_tag_stack[count($this->compiler->_tag_stack) - 1];
if($last_tag == 'case')
{
list($break, $compiler->tag_nocache) = $this->_close_tag(array('case'));
if($last_attr[0])
$_output .= '<?php break;?>';
}
$this->_open_tag('case', array(isset($attr['break']) ? $attr['break'] : false, $compiler->tag_nocache));
$_output .= '<?php default:?>';
return $_output;
}
}
class Smarty_Compiler_Break extends Smarty_Internal_CompileBase {
public $required_attributes = array();
public $optional_attributes = array();
public $shorttag_order = array();
/**
* Print out a break command for the switch.
* This can only go inside of {case} tags.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
list($break, $compiler->tag_nocache) = $this->_close_tag(array('case'));
return '<?php break;?>';
}
}
class Smarty_Compiler_Caseclose extends Smarty_Internal_CompileBase {
public $required_attributes = array();
public $optional_attributes = array();
public $shorttag_order = array();
/**
* Print out a break command for the switch.
* This can only go inside of {case} tags.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
list($break, $compiler->tag_nocache) = $this->_close_tag(array('case'));
return '<?php break;?>';
}
}
class Smarty_Compiler_Switchclose extends Smarty_Internal_CompileBase {
public $required_attributes = array();
public $optional_attributes = array();
public $shorttag_order = array();
/**
* End a switch statement.
*
* @param string $tag_arg
* @param Smarty_Compiler $smarty
* @return string
*/
public function compile($args, $compiler){
$this->compiler = $compiler;
$attr = $this->_get_attributes($args);
list($last_tag, $last_attr) = $this->compiler->_tag_stack[count($this->compiler->_tag_stack) - 1];
if(($last_tag == 'case' || $last_tag == 'default'))
list($break, $compiler->tag_nocache) = $this->_close_tag(array('case'));
list($compiler->tag_nocache) = $this->_close_tag(array('switch'));
return '<?php }?>';
}
}
/**
* Filter the template after it is generated to fix switch bugs.
* Remove any spaces after the 'switch () {' code and before the first case. Any tabs or spaces
* for layout would cause php errors witch this reged will fix.
*
* @param string $compiled
* @param Smarty_Compiler $smarty
* @return string
*/
function smarty_postfilter_switch($compiled, &$smarty) {
// Remove the extra spaces after the start of the switch tag and before the first case statement.
return preg_replace('/({ ?\?>)\s+(<\?php case)/', "$1\n$2", $compiled);
}
?>

View File

@@ -1 +1,29 @@
Not yet implemented. <h2>Settings</h2>
<table id="settings">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
{foreach from=$settings item=name}
{assign var='value' value=$config->get($name)}
{assign var='type' value=$config->type($name)}
{assign var='id' value=str_replace('.', '-',$name)}
{include file="fragments/admin-setting-row.tpl"}
{/foreach}
</tbody>
<tfoot>
<tr>
<td colspan="2">
<input type="button" id="settings_save" name="save" value="Save" />
<input type="button" id="settings_new" name="new_setting" value="New Setting" />
</td>
</tr>
</tfoot>
</table>
<script type="text/javascript">
rc.settings.init();
</script>

View File

@@ -0,0 +1,12 @@
{
{if $messages}
"messages": [
{foreach from=$messages item=message name=messages}
{$message|json_encode}{if ! $smarty.foreach.messages.last},{/if}
{/foreach}
]{if $page_content},{/if}
{/if}
{$page_content}
}

View File

@@ -0,0 +1,11 @@
{if $success}
"actions": {
"add_setting_row": {
{include file="fragments/admin-setting-row.tpl" assign=content}
"content": {$content|json_encode}
}
},
{/if}
"success": {$success|json_encode}

View File

@@ -0,0 +1,30 @@
"page_replacements": {
"dialogheadertitle": {
"content": "Add Setting"
},
"dialogcontent": {
{include file="fragments/new-setting-dialog.tpl" assign=new_setting_dialog_content}
"content": {$new_setting_dialog_content|json_encode}
}
},
"dialog": {
"show": true,
"buttons": {
"type": "okcancel",
"actions": {
"ok": [
"add-setting",
"close-dialog"
],
"cancel": "close-dialog"
},
"params": {
"name": "settings_add_name",
"type": "settings_add_type"
}
}
}

View File

@@ -0,0 +1 @@
"success": {$success|json_encode}

View File

@@ -0,0 +1,44 @@
{if $confirm}
{if $success}
"actions": {
"rename_setting_confirm": {
"old_name": {$old_name|json_encode},
"old_id": {$old_id|json_encode},
"name": {$name|json_encode},
{include file="fragments/admin-setting-row.tpl" assign="content"}
"content": {$content|json_encode}
}
},
{/if}
"success": {$success|json_encode}
{else}
"page_replacements": {
"dialogheadertitle": {
"content": "Rename Setting"
},
"dialogcontent": {
{include file="fragments/rename-setting-dialog.tpl" assign="content"}
"content": {$content|json_encode}
}
},
"dialog": {
"show": true,
"buttons": {
"type": "okcancel",
"actions": {
"ok": [
"rename_setting",
"close-dialog"
],
"cancel": "close-dialog"
},
"params": {
"name": {$name|json_encode},
"new_name_field": "settings_rename_name"
}
}
}
{/if}

View File

@@ -0,0 +1,41 @@
"page_replacements": {
{if $confirmed}
"source-list": {
{include file="fragments/source-list.tpl" assign="sources_html"}
"content": {$sources_html|json_encode}
}
{else}
"dialogheadertitle" {
"content": "Delete Source"
},
"dialogcontent": {
{include file="fragments/delete-source.tpl" assign="delete_source_html"}
"content": {$delete_source_html|json_encode}
}
{/if}
{if ! $confirmed}
},
"dialog": {
"show": true,
"buttons": {
"type": "yesno",
"actions": {
"yes": [
"delete-source-confirm",
"close-dialog"
],
"no": "close-dialog"
},
"params": {
"plugin": {$source_plugin|json_encode},
"id": {$source_id|json_encode}
}
}
}
{else}
}
{/if}

View File

@@ -0,0 +1,6 @@
"page_replacements": {
"source-list": {
{include file="fragments/source-list.tpl" assign="sources_html"}
"content": {$sources_html|json_encode}
}
}

View File

@@ -0,0 +1,22 @@
"page_replacements": {
"dialogheadertitle": {
"content": "Update Settings"
},
"dialogcontent": {
{include file="fragments/update-settings-dialog.tpl" assign=dialog_content}
"content": {$dialog_content|json_encode}
}
},
"dialog": {
"show": true,
"buttons": {
"type": "ok",
"actions": {
"ok": "close-dialog"
}
}
}

View File

@@ -0,0 +1,12 @@
<tr id="setting_{$id}_row">
<td>
<p>
{$name}<br />
<input type="button" id="setting_{$id}_rename" value="Rename" onclick="rc.settings.rename_setting('{$id}', '{$name}');" />
<input type="button" id="setting_{$id}_remove" value="Remove" onclick="rc.settings.remove_setting('{$id}', '{$name}');" />
</p>
</td>
<td>
{include file="fragments/admin-setting-value.tpl"}
</td>
</tr>

View File

@@ -0,0 +1,25 @@
{switch $type}
{case Sihnon_Config::TYPE_BOOL}
<input type="checkbox" id="setting_{$id}" name="{$id}" value="1" {if $value}checked="checked" {/if} class="setting" />
{/case}
{case Sihnon_Config::TYPE_INT}
<input type="text" id="setting_{$id}" name="{$id}" value="{$value}" class="setting settings_field_numeric" />
{/case}
{case Sihnon_Config::TYPE_STRING}
<input type="text" id="setting_{$id}" name="{$id}" value="{$value}" class="setting settings_field_string" />
{/case}
{case Sihnon_Config::TYPE_STRING_LIST}
<div id="container_{$id}">
{foreach from=$value item=line name=settings}
<div id="settings_{$id}_line{$smarty.foreach.settings.iteration}">
<input type="text" name="{$id}[]" value="{$line}" class="setting settings_field_string" />
<input type="button" value="-" class="settings_field_remove" onclick="rc.settings.remove_stringlist_field('{$id}', '{$smarty.foreach.settings.iteration}')" />
</div>
{/foreach}
</div>
<div class="settings_addfieldcontainer">
<input type="hidden" id="settings_{$id}_next" value="{$smarty.foreach.settings.iteration+1}" />
<input type="button" value="+" class="settings_field_add" onclick="rc.settings.add_stringlist_field('{$id}')" />
</div>
{/case}
{/switch}

View File

@@ -0,0 +1,3 @@
<p>
Are you sure you want to delete {$source->plugin()|escape:"html"}:{$source->filename()|escape:"html"}?
</p>

View File

@@ -0,0 +1,7 @@
{if $messages}
<ul>
{foreach from=$messages item=message}
<li>{$message|escape}</li>
{/foreach}
</ul>
{/if}

View File

@@ -0,0 +1,21 @@
<table>
<thead>
<th>Name</th>
<th>Type</th>
</thead>
<tbody>
<tr>
<td>
<input type="text" id="settings_add_name" value="" />
</td>
<td>
<select id="settings_add_type">
<option value="int">Integer</option>
<option value="bool">Boolean</option>
<option value="string">String</option>
<option value="string-list">String List</option>
</select>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,6 @@
<div>
<p>
Enter a new name for setting '{$name|escape}' below.
</p>
<input type="text" id="settings_rename_name" value="" />
</div>

View File

@@ -0,0 +1,25 @@
{foreach from=$all_sources key=type item=sources}
<li>{$type}
{if $sources}
<ul>
{foreach from=$sources item=source}
{assign var='source_plugin' value=$source->plugin()}
{assign var='source_filename' value=$source->filename()}
{assign var='source_filename_encoded' value=$source->filenameEncoded()}
{assign var='source_cached' value=$source->isCached()}
<li>
[ <a href="{$base_uri}sources/details/plugin/{$source_plugin}/id/{$source_filename_encoded}" title="Browse source details">Browse</a> |
<a href="{$base_uri}rips/setup/plugin/{$source_plugin}/id/{$source_filename_encoded}" title="Rip this source">Rip</a> |
<a href="javascript:rc.sources.remove('{$source_plugin|escape:'quote'}', '{$source_filename_encoded|escape:'quote'}');" title="Delete this source">Delete</a> ]
{$source_filename|escape:'html'}{if $source_cached} (cached){/if}
</li>
{/foreach}
</ul>
{else}
<p>
<em>There are no {$type} sources available to rip.</em>
</p>
{/if}
</li>
{/foreach}

View File

@@ -0,0 +1,10 @@
<p>
Settings have been saved.
</p>
{if $messages}
<p>
Some messages were generated during this operation:
{include file="fragments/messages.tpl"}
</p>
{/if}

View File

@@ -4,7 +4,7 @@
{if $running_jobs} {if $running_jobs}
{foreach from=$running_jobs item=job} {foreach from=$running_jobs item=job}
<li><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">{$job->name()} ({$job->currentStatus()->ripProgress()}%)</a></li> <li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()} ({$job->currentStatus()->ripProgress()}%)</a></li>
{/foreach} {/foreach}
{else} {else}
<em>There are no currently running jobs.</em> <em>There are no currently running jobs.</em>
@@ -14,7 +14,7 @@
{if $queued_jobs} {if $queued_jobs}
{foreach from=$queued_jobs item=job} {foreach from=$queued_jobs item=job}
<li><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></li> <li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
{/foreach} {/foreach}
{else} {else}
<em>There are no currently running jobs.</em> <em>There are no currently running jobs.</em>
@@ -25,7 +25,7 @@
{if $completed_jobs} {if $completed_jobs}
<ul> <ul>
{foreach from=$completed_jobs item=job} {foreach from=$completed_jobs item=job}
<li><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></li> <li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
{/foreach} {/foreach}
</ul> </ul>
{else} {else}
@@ -37,7 +37,7 @@
{if $failed_jobs} {if $failed_jobs}
<ul> <ul>
{foreach from=$failed_jobs item=job} {foreach from=$failed_jobs item=job}
<li><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></li> <li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
{/foreach} {/foreach}
</ul> </ul>
{else} {else}

View File

@@ -6,9 +6,15 @@
</script> </script>
<link rel="stylesheet" type="text/css" href="{$base_uri}styles/normal.css" /> <link rel="stylesheet" type="text/css" href="{$base_uri}styles/normal.css" />
<script type="text/javascript">
var base_uri = "{$base_uri|escape:'quote'}";
var base_url = "{$base_url|escape:'quote'}";
</script>
<link type="text/css" href="{$base_uri}styles/3rdparty/jquery-ui/smoothness/jquery-ui-1.8.custom.css" rel="Stylesheet" /> <link type="text/css" href="{$base_uri}styles/3rdparty/jquery-ui/smoothness/jquery-ui-1.8.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery-1.4.2.js"></script> <script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery-1.4.2.js"></script>
<script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery-ui-1.8.custom.min.js"></script>
<script type="text/javascript" src="{$base_uri}scripts/main.js"></script>
</head> </head>
<body> <body>
@@ -50,5 +56,34 @@
</div> </div>
<div id="centrepoint">
<div id="dialog">
<div id="dialogheader">
<div id="dialogheadertitle">Dialog</div>
<div id="dialogheaderclose">X</div>
</div>
<div id="dialogcontent"></div>
<div id="dialogfooter">
<div id="dialogfooterok" class="dialogfooterbuttonset">
<fieldset>
<input type="button" class="dialogbutton" id="dialogfooterok" value="Ok" />
</fieldset>
</div>
<div id="dialogfooterokcancel" class="dialogfooterbuttonset">
<fieldset>
<input type="button" class="dialogbutton" id="dialogfooterokcancel_ok" value="Ok" />
<input type="button" class="dialogbutton" id="dialogfooterokcancel_cancel" value="Cancel" />
</fieldset>
</div>
<div id="dialogfooteryesno" class="dialogfooterbuttonset">
<fieldset>
<input type="button" class="dialogbutton" id="dialogfooteryes" value="Yes" />
<input type="button" class="dialogbutton" id="dialogfooterno" value="No" />
</fieldset>
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -1,57 +0,0 @@
<h2>Job Details</h2>
<h3>Summary</h3>
<em>Summary details here</em>
<h3>Recent Client Logs</h3>
{if $client_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$client_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no client log entries.</em>
{/if}
<h3>Recent Worker Logs</h3>
{if $worker_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$worker_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no worker log entries.</em>
{/if}

View File

@@ -42,7 +42,7 @@
{foreach from=$jobs item=job} {foreach from=$jobs item=job}
{assign var=current_status value=$job->currentStatus()} {assign var=current_status value=$job->currentStatus()}
<tr> <tr>
<td><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></td> <td><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></td>
<td> <td>
{$job->destinationFilename()} {$job->destinationFilename()}
{if $job->isFinished()} {if $job->isFinished()}

View File

@@ -0,0 +1,91 @@
<h2>Job Details</h2>
<h3>Summary</h3>
<dl>
<dt>Source Plugin</dt>
<dd>{$job->sourcePlugin()}</dd>
<dt>Rip Plugin</dt>
<dd>{$job->ripPlugin()}</dd>
<dt>Source Filename</dt>
<dd>{$job->sourceFilename()}</dd>
<dt>Source Title</dt>
<dd>{$job->title()}</dd>
<dt>Status</dt>
<dd>{$job->currentStatus()->statusName()} ({$job->currentStatus()->mtime()|date_format:'%Y-%m-%d %H:%M:%S'})</dd>
<dt>Destination Filename</dt>
<dd>{$job->destinationFilename()}</dd>
{if $job->isFinished()}
<dt>Destination Filesize</dt>
<dd>{$job->outputFilesize()|formatFilesize}</dd>
{/if}
</dl>
<h3>Log messages</h3>
<h4>Options</h4>
<ul>
{if $log_count_display eq 'all'}
<li><a href="{$base_uri}jobs/details/id/{$job->id()}/order/{$log_order}/" title="View recent logs only">View recent messages only</a></li>
{else}
<li><a href="{$base_uri}jobs/details/id/{$job->id()}/logs/all/" title="View all logs">View all messages</a></li>
{/if}
<li><a href="{$base_uri}jobs/details/id/{$job->id()}/logs/{$log_count_display}/order/{$log_order_reverse}/" title="Reverse display order of log messages">Reverse display order</a></li>
</ul>
<h4>Recent Client Logs</h4>
{if $client_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$client_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no client log entries.</em>
{/if}
<h4>Recent Worker Logs</h4>
{if $worker_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Hostname</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$worker_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->hostname()}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no worker log entries.</em>
{/if}

View File

@@ -10,7 +10,7 @@
{else} {else}
<h3>{$source->filename()|escape:"html"}</h3> <h3>{$source->filename()|escape:"html"}</h3>
<form name="setup-rips" id="setup-rips" action="{$base_uri}rips/setup-rip/submit/" method="post"> <form name="setup" id="setup-rips" action="{$base_uri}rips/setup/submit/" method="post">
<input type="hidden" name="plugin" value="{$source->plugin()|escape:"html"}" /> <input type="hidden" name="plugin" value="{$source->plugin()|escape:"html"}" />
<fieldset> <fieldset>
<legend>Configure global rip options</legend> <legend>Configure global rip options</legend>

View File

@@ -1,41 +0,0 @@
<h2>Sources</h2>
{if $all_sources}
<p>
The list below contains all the DVD sources that are available and ready for ripping.
</p>
<p>
Sources that have recently been scanned are marked <em>(cached)</em> and will load fairly quickly.
Sources that have not been cached will be scanned when the link is clicked, and this may take several minutes so please be patient.
</p>
<ul>
{foreach from=$all_sources key=type item=sources}
<li>{$type}
{if $sources}
<ul>
{foreach from=$sources item=source}
{assign var='source_plugin' value=$source->plugin()}
{assign var='source_filename' value=$source->filename()}
{assign var='source_filename_encoded' value=$source->filenameEncoded()}
{assign var='source_cached' value=$source->isCached()}
<li>
[ <a href="{$base_uri}rips/source-details/plugin/{$source_plugin}/id/{$source_filename_encoded}" title="Browse source details">Browse</a> |
<a href="{$base_uri}rips/setup-rip/plugin/{$source_plugin}/id/{$source_filename_encoded}" title="Rip this source">Rip</a> |
<a href="{$base_uri}sources/delete/plugin/{$source_plugin}/id/{$source_filename_encoded}" title="Delete this source">Delete</a> ]
{$source_filename|escape:'html'}{if $source_cached} (cached){/if}
</li>
{/foreach}
</ul>
{else}
<p>
<em>There are no {$type} sources available to rip.</em>
</p>
{/if}
</li>
{/foreach}
</ul>
{else}
<p>
<em>There are currently no sources available to rip.</em>
</p>
{/if}

View File

@@ -5,7 +5,13 @@
<li>Browse <li>Browse
<ul> <ul>
<li><a href="{$base_uri}rips/sources" title="Browse Sources">Sources</a></li> <li><a href="{$base_uri}sources/list" title="Browse Sources">Sources</a></li>
</ul>
</li>
<li>Admin
<ul>
<li><a href="{$base_uri}admin/settings" title="Edit Settings">Settings</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@@ -0,0 +1,18 @@
<h2>Sources</h2>
{if $all_sources}
<p>
The list below contains all the DVD sources that are available and ready for ripping.
</p>
<p>
Sources that have recently been scanned are marked <em>(cached)</em> and will load fairly quickly.
Sources that have not been cached will be scanned when the link is clicked, and this may take several minutes so please be patient.
</p>
<ul id="source-list">
{include file="fragments/source-list.tpl"}
</ul>
{else}
<p>
<em>There are currently no sources available to rip.</em>
</p>
{/if}

View File

@@ -93,6 +93,72 @@ label {
margin: 1em; margin: 1em;
} }
/* Centred dialog taken from http://stackoverflow.com/questions/1205457/how-to-design-a-css-for-a-centered-floating-confirm-dialog */
#centrepoint {
top: 50%;
left: 50%;
position: absolute;
}
#dialog {
position: relative;
width: 600px;
margin-left: -300px;
/*height: 20em;*/
margin-top: -20em;
display: none;
background: #eeeeee;
border: 2px solid #a7a09a;
}
#dialogheader {
height: 2em;
width: 100%;
margin: 0.3em;
}
#dialogheadertitle {
color: black;
font-weight: bold;
float: left;
}
#dialogheaderclose {
width: 1.2em;
height: 1.2em;
background-color: crimson;
color: white;
border: 1px solid fireBrick;
float: right;
margin-right: 1em;
text-align: center;
vertical-align: middle;
display: table-cell;
font-weight: bold;
cursor: pointer;
}
#dialogcontent {
padding: 0.5em;
}
.dialogfooterbuttonset {
display: none;
text-align: right;
}
table#settings {
}
table#settings td {
padding: 1.0em;
border: 1px solid;
border-collapse: collapse;
}
table#settings input[type=text] {
width: 40em;
}
.settings_addfieldcontainer {
text-align: right;
}
.default { .default {
background: beige; background: beige;
color: darkgray; color: darkgray;

View File

View File