Update directory layout to fit with other projects
This commit is contained in:
11
source/webui/pages/admin/settings.php
Normal file
11
source/webui/pages/admin/settings.php
Normal 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);
|
||||
|
||||
?>
|
||||
55
source/webui/pages/ajax/admin/add-setting.php
Normal file
55
source/webui/pages/ajax/admin/add-setting.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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;
|
||||
case 'hash': {
|
||||
$type = Sihnon_Config::TYPE_HASH;
|
||||
$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);
|
||||
}
|
||||
|
||||
?>
|
||||
23
source/webui/pages/ajax/admin/remove-setting.php
Normal file
23
source/webui/pages/ajax/admin/remove-setting.php
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
39
source/webui/pages/ajax/admin/rename-setting.php
Normal file
39
source/webui/pages/ajax/admin/rename-setting.php
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
35
source/webui/pages/ajax/delete-source.php
Normal file
35
source/webui/pages/ajax/delete-source.php
Normal 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);
|
||||
}
|
||||
|
||||
?>
|
||||
9
source/webui/pages/ajax/source-list.php
Normal file
9
source/webui/pages/ajax/source-list.php
Normal 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);
|
||||
|
||||
?>
|
||||
22
source/webui/pages/ajax/update-settings.php
Normal file
22
source/webui/pages/ajax/update-settings.php
Normal 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);
|
||||
|
||||
?>
|
||||
9
source/webui/pages/errors/404.php
Normal file
9
source/webui/pages/errors/404.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
|
||||
$this->smarty->assign('requested_page', htmlspecialchars($req->request_string()));
|
||||
|
||||
|
||||
?>
|
||||
10
source/webui/pages/errors/unhandled-exception.php
Normal file
10
source/webui/pages/errors/unhandled-exception.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$config = $main->config();
|
||||
|
||||
$this->smarty->assign('display_exceptions', $config->get('debug.display_exceptions'));
|
||||
$this->smarty->assign('exception', $exception);
|
||||
$this->smarty->assign('exception_type', get_class($exception));
|
||||
|
||||
?>
|
||||
13
source/webui/pages/home.php
Normal file
13
source/webui/pages/home.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$running_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::RUNNING, 10);
|
||||
$queued_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::QUEUED, 10);
|
||||
$completed_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::COMPLETE, 10);
|
||||
$failed_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::FAILED, 10);
|
||||
|
||||
$this->smarty->assign('running_jobs', $running_jobs);
|
||||
$this->smarty->assign('queued_jobs', $queued_jobs);
|
||||
$this->smarty->assign('completed_jobs', $completed_jobs);
|
||||
$this->smarty->assign('failed_jobs', $failed_jobs);
|
||||
|
||||
?>
|
||||
96
source/webui/pages/jobs.php
Normal file
96
source/webui/pages/jobs.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
if ($req->exists('submit')) {
|
||||
$action = RippingCluster_Main::issetelse($_POST['action'], 'RippingCluster_Exception_InvalidParameters');
|
||||
|
||||
# If a bulk action was selected, the action will be a single term, otherwise it will also contain
|
||||
# the id of the single item to act upon. Work out which was used now.
|
||||
$matches = $job_ids = array();
|
||||
if (preg_match('/^(.*)\[(\d+)\]$/', $action, $matches)) {
|
||||
$action = $matches[1];
|
||||
$job_ids = array($matches[2]);
|
||||
}
|
||||
else {
|
||||
$job_ids = $_POST['include'];
|
||||
}
|
||||
|
||||
$jobs = array();
|
||||
foreach ($job_ids as $job_id) {
|
||||
$job = RippingCluster_Job::fromId($job_id);
|
||||
if (!$job) {
|
||||
throw new RippingCluster_Exception_InvalidParameters('job_id');
|
||||
}
|
||||
$jobs[] = $job;
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'mark-failed': {
|
||||
foreach ($jobs as $job) {
|
||||
$job->updateStatus(RippingCluster_JobStatus::FAILED);
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'retry': {
|
||||
# Clone each of the selected jobs
|
||||
foreach ($jobs as $job) {
|
||||
$new_job = clone $job;
|
||||
}
|
||||
|
||||
# Dispatch all the jobs in one run
|
||||
RippingCluster_Job::runAllJobs();
|
||||
|
||||
# Redirect to the job queued page to show the jobs were successfully dispatched
|
||||
RippingCluster_Page::redirect('rips/setup/queued');
|
||||
} break;
|
||||
|
||||
case 'delete': {
|
||||
foreach ($jobs as $job) {
|
||||
$job->delete();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'fix-broken-timestamps': {
|
||||
foreach ($jobs as $job) {
|
||||
$job->fixBrokenTimestamps();
|
||||
}
|
||||
} break;
|
||||
|
||||
default: {
|
||||
throw new RippingCluster_Exception_InvalidParameters('action');
|
||||
}
|
||||
}
|
||||
|
||||
RippingCluster_Page::redirect('jobs');
|
||||
|
||||
} else {
|
||||
|
||||
if (isset($_POST['view'])) {
|
||||
$statusName = urlencode($_POST['view']);
|
||||
RippingCluster_Page::redirect("jobs/view/{$statusName}");
|
||||
}
|
||||
|
||||
$statusName = $req->get('view', 'any');
|
||||
switch ($statusName) {
|
||||
case 'any': $status = null; break;
|
||||
case 'queued': $status = RippingCluster_JobStatus::QUEUED; break;
|
||||
case 'running': $status = RippingCluster_JobStatus::RUNNING; break;
|
||||
case 'complete': $status = RippingCluster_JobStatus::COMPLETE; break;
|
||||
case 'failed': $status = RippingCluster_JobStatus::FAILED; break;
|
||||
default: throw new RippingCluster_Exception_InvalidParameters('view');
|
||||
}
|
||||
|
||||
$jobs = array();
|
||||
if ($status) {
|
||||
$jobs = RippingCluster_Job::allWithStatus($status);
|
||||
} else {
|
||||
$jobs = RippingCluster_Job::all();
|
||||
}
|
||||
|
||||
$this->smarty->assign('jobs', $jobs);
|
||||
}
|
||||
|
||||
?>
|
||||
45
source/webui/pages/jobs/details.php
Normal file
45
source/webui/pages/jobs/details.php
Normal 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);
|
||||
|
||||
|
||||
?>
|
||||
11
source/webui/pages/logs.php
Normal file
11
source/webui/pages/logs.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
$log = RippingCluster_Main::instance()->log();
|
||||
|
||||
$client_log_entries = RippingCluster_LogEntry::recentEntries($log, 'webui', 'ctime', SihnonFramework_Log::ORDER_DESC, 30);
|
||||
$worker_log_entries = RippingCluster_LogEntry::recentEntries($log, 'worker', 'ctime', SihnonFramework_Log::ORDER_DESC, 30);
|
||||
|
||||
$this->smarty->assign('client_log_entries', $client_log_entries);
|
||||
$this->smarty->assign('worker_log_entries', $worker_log_entries);
|
||||
|
||||
?>
|
||||
49
source/webui/pages/rips/setup.php
Normal file
49
source/webui/pages/rips/setup.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
// Grab the name of this source
|
||||
$encoded_filename = null;
|
||||
if ($req->exists('submit')) {
|
||||
$encoded_filename = RippingCluster_Main::issetelse($_POST['id'], 'RippingCluster_Exception_InvalidParameters');
|
||||
|
||||
// Update the recently used list
|
||||
$recent_output_directories = $config->get('rips.output_directories.recent');
|
||||
if ( ! in_array($_POST['rip-options']['output-directory'], $recent_output_directories)) {
|
||||
array_unshift($recent_output_directories, $_POST['rip-options']['output-directory']);
|
||||
$config->set('rips.output_directories.recent', array_slice($recent_output_directories, 0, $config->get('rips.output_directories.recent_limit', 10)));
|
||||
}
|
||||
|
||||
// Create the jobs from the request
|
||||
$jobs = RippingCluster_Job::fromPostRequest($_POST['plugin'], $_POST['id'], $_POST['rip-options'], $_POST['rips']);
|
||||
|
||||
// Spawn the background client process to run all the jobs
|
||||
RippingCluster_Job::runAllJobs();
|
||||
|
||||
RippingCluster_Page::redirect('rips/setup/queued');
|
||||
|
||||
} elseif ($req->exists('queued')) {
|
||||
$this->smarty->assign('rips_submitted', true);
|
||||
|
||||
} else {
|
||||
$this->smarty->assign('rips_submitted', false);
|
||||
$encoded_filename = $req->get('id', 'RippingCluster_Exception_InvalidParameters');
|
||||
|
||||
$plugin = $req->get('plugin', 'RippingCluster_Exception_InvalidParameters');
|
||||
$source = RippingCluster_Source_PluginFactory::loadEncoded($plugin, $encoded_filename);
|
||||
|
||||
$this->smarty->assign('source', $source);
|
||||
$this->smarty->assign('titles', $source->titles());
|
||||
$this->smarty->assign('longest_title', $source->longestTitle());
|
||||
$this->smarty->assign('default_output_directory', $config->get('rips.default.output_directory'));
|
||||
|
||||
$default_output_directories = $config->get('rips.output_directories.default');
|
||||
$recent_output_directories = $config->get('rips.output_directories.recent');
|
||||
$this->smarty->assign('default_output_directories', $default_output_directories);
|
||||
$this->smarty->assign('recent_output_directories', $recent_output_directories);
|
||||
$this->smarty->assign('next_output_directory_index', count($default_output_directories) + count($recent_output_directories) + 1);
|
||||
}
|
||||
|
||||
?>
|
||||
28
source/webui/pages/sources/delete.php
Normal file
28
source/webui/pages/sources/delete.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
// Grab the name of this source
|
||||
$encoded_filename = null;
|
||||
if ($req->exists('confirm')) {
|
||||
$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();
|
||||
|
||||
// Redirect back to the sources page
|
||||
RippingCluster_Page::redirect('rips/sources');
|
||||
|
||||
} else {
|
||||
$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);
|
||||
}
|
||||
|
||||
?>
|
||||
13
source/webui/pages/sources/details.php
Normal file
13
source/webui/pages/sources/details.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$main = RippingCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
$plugin = $req->get('plugin', 'RippingCluster_Exception_InvalidParameters');
|
||||
$source = RippingCluster_Source_PluginFactory::loadEncoded($plugin, $req->get('id', 'RippingCluster_Exception_InvalidParameters'));
|
||||
|
||||
$this->smarty->assign('source', $source);
|
||||
$this->smarty->assign('titles', $source->titles());
|
||||
|
||||
?>
|
||||
9
source/webui/pages/sources/list.php
Normal file
9
source/webui/pages/sources/list.php
Normal 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);
|
||||
|
||||
?>
|
||||
292
source/webui/smarty/plugins/compiler.switch.php
Normal file
292
source/webui/smarty/plugins/compiler.switch.php
Normal 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);
|
||||
}
|
||||
?>
|
||||
29
source/webui/templates/admin/settings.tpl
Normal file
29
source/webui/templates/admin/settings.tpl
Normal file
@@ -0,0 +1,29 @@
|
||||
<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>
|
||||
12
source/webui/templates/ajax.tpl
Normal file
12
source/webui/templates/ajax.tpl
Normal 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}
|
||||
|
||||
}
|
||||
11
source/webui/templates/ajax/admin/add-setting.tpl
Normal file
11
source/webui/templates/ajax/admin/add-setting.tpl
Normal 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}
|
||||
|
||||
30
source/webui/templates/ajax/admin/new-setting.tpl
Normal file
30
source/webui/templates/ajax/admin/new-setting.tpl
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
source/webui/templates/ajax/admin/remove-setting.tpl
Normal file
1
source/webui/templates/ajax/admin/remove-setting.tpl
Normal file
@@ -0,0 +1 @@
|
||||
"success": {$success|json_encode}
|
||||
44
source/webui/templates/ajax/admin/rename-setting.tpl
Normal file
44
source/webui/templates/ajax/admin/rename-setting.tpl
Normal 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}
|
||||
41
source/webui/templates/ajax/delete-source.tpl
Normal file
41
source/webui/templates/ajax/delete-source.tpl
Normal 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}
|
||||
6
source/webui/templates/ajax/source-list.tpl
Normal file
6
source/webui/templates/ajax/source-list.tpl
Normal file
@@ -0,0 +1,6 @@
|
||||
"page_replacements": {
|
||||
"source-list": {
|
||||
{include file="fragments/source-list.tpl" assign="sources_html"}
|
||||
"content": {$sources_html|json_encode}
|
||||
}
|
||||
}
|
||||
22
source/webui/templates/ajax/update-settings.tpl
Normal file
22
source/webui/templates/ajax/update-settings.tpl
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
6
source/webui/templates/errors/404.tpl
Normal file
6
source/webui/templates/errors/404.tpl
Normal file
@@ -0,0 +1,6 @@
|
||||
<h2>The requested page could not be found</h2>
|
||||
<p>
|
||||
The file you requested ({$requested_page}) could not be found.
|
||||
If you typed in the address manually, check that you have spelled it correctly,
|
||||
or if you followed a link, let us know and we'll look into it.
|
||||
</p>
|
||||
46
source/webui/templates/errors/unhandled-exception.tpl
Normal file
46
source/webui/templates/errors/unhandled-exception.tpl
Normal file
@@ -0,0 +1,46 @@
|
||||
<h2>An unhandled error has occurred</h2>
|
||||
<p>
|
||||
There was a problem trying to complete the requested action. Please try again and if the problem persists, let us know.
|
||||
</p>
|
||||
|
||||
{if $display_exceptions}
|
||||
<p>
|
||||
An unhandled exception was caught during the page template processing. The full details are shown below:
|
||||
</p>
|
||||
<table class="exception-details">
|
||||
<colgroup id="header">
|
||||
<col />
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Exception</th>
|
||||
<td>{$exception_type}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<td>{$exception->getFile()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Line</th>
|
||||
<td>{$exception->getLine()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Message</th>
|
||||
<td>{$exception->getMessage()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Stack Trace</th>
|
||||
<td><pre>{$exception->getTrace()|print_r}</pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<em>Note:</em> Exception details should not be displayed on production systems.
|
||||
Disable the <a href="{$base_uri}admin/settings/key/debug.show_exceptions/"><code>debug.show_exceptions</code></a>
|
||||
setting to omit the exception details from this page.
|
||||
</p>
|
||||
{/if}
|
||||
12
source/webui/templates/fragments/admin-setting-row.tpl
Normal file
12
source/webui/templates/fragments/admin-setting-row.tpl
Normal 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>
|
||||
43
source/webui/templates/fragments/admin-setting-value.tpl
Normal file
43
source/webui/templates/fragments/admin-setting-value.tpl
Normal file
@@ -0,0 +1,43 @@
|
||||
{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}
|
||||
{case Sihnon_Config::TYPE_HASH}
|
||||
<div id="container_{$id}">
|
||||
{foreach from=$value item=hash_value key=hash_key name=settings}
|
||||
<div id="settings_{$id}_line{$smarty.foreach.settings.iteration}">
|
||||
<input type="text" value="{$hash_key}" class="setting hash_key" />
|
||||
<input type="text" name="{$id}[{$hash_key}]" value="{$hash_value}" class="setting hash_value" />
|
||||
<input type="button" value="-" class="settings_field_remove" onclick="rc.settings.remove_hash_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_hash_field('{$id}')" />
|
||||
</div>
|
||||
|
||||
{/case}
|
||||
{default}
|
||||
<em>Unsupported setting type!</em>
|
||||
{/switch}
|
||||
3
source/webui/templates/fragments/delete-source.tpl
Normal file
3
source/webui/templates/fragments/delete-source.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
<p>
|
||||
Are you sure you want to delete {$source->plugin()|escape:"html"}:{$source->filename()|escape:"html"}?
|
||||
</p>
|
||||
7
source/webui/templates/fragments/messages.tpl
Normal file
7
source/webui/templates/fragments/messages.tpl
Normal file
@@ -0,0 +1,7 @@
|
||||
{if $messages}
|
||||
<ul>
|
||||
{foreach from=$messages item=message}
|
||||
<li>{$message|escape}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
22
source/webui/templates/fragments/new-setting-dialog.tpl
Normal file
22
source/webui/templates/fragments/new-setting-dialog.tpl
Normal file
@@ -0,0 +1,22 @@
|
||||
<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>
|
||||
<option value="hash">Hash</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -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>
|
||||
25
source/webui/templates/fragments/source-list.tpl
Normal file
25
source/webui/templates/fragments/source-list.tpl
Normal 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}
|
||||
|
||||
10
source/webui/templates/fragments/update-settings-dialog.tpl
Normal file
10
source/webui/templates/fragments/update-settings-dialog.tpl
Normal 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}
|
||||
64
source/webui/templates/home.tpl
Normal file
64
source/webui/templates/home.tpl
Normal file
@@ -0,0 +1,64 @@
|
||||
<h2>Summary</h2>
|
||||
|
||||
<h3>Running Jobs</h3>
|
||||
|
||||
{if $running_jobs}
|
||||
{foreach from=$running_jobs item=job}
|
||||
<li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a> <span class="progressBar" id="job_progress_{$job->id()}">{$job->currentStatus()->ripProgress()}%</span> ({RippingCluster_Main::formatDuration($job->calculateETA(), 1)} remaining)</li>
|
||||
{/foreach}
|
||||
<script type="text/javascript">
|
||||
$('.progressBar').each(
|
||||
function() {
|
||||
$(this).progressBar({
|
||||
steps: 100,
|
||||
width: 120,
|
||||
height: 12,
|
||||
boxImage: '{$base_uri}images/jquery.progressbar/progressbar.gif',
|
||||
barImage: {
|
||||
0: '{$base_uri}images/jquery.progressbar/progressbg_red.gif',
|
||||
25: '{$base_uri}images/jquery.progressbar/progressbg_orange.gif',
|
||||
50: '{$base_uri}images/jquery.progressbar/progressbg_yellow.gif',
|
||||
75: '{$base_uri}images/jquery.progressbar/progressbg_green.gif',
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
{else}
|
||||
<em>There are no currently running jobs.</em>
|
||||
{/if}
|
||||
|
||||
<h3>Queued Jobs</h3>
|
||||
|
||||
{if $queued_jobs}
|
||||
{foreach from=$queued_jobs item=job}
|
||||
<li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
|
||||
{/foreach}
|
||||
{else}
|
||||
<em>There are no currently running jobs.</em>
|
||||
{/if}
|
||||
|
||||
<h3>Recently Completed Jobs</h3>
|
||||
|
||||
{if $completed_jobs}
|
||||
<ul>
|
||||
{foreach from=$completed_jobs item=job}
|
||||
<li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
<em>There are no recently completed jobs.</em>
|
||||
{/if}
|
||||
|
||||
<h3>Recently Failed Jobs</h3>
|
||||
|
||||
{if $failed_jobs}
|
||||
<ul>
|
||||
{foreach from=$failed_jobs item=job}
|
||||
<li><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
<em>There are no recently failed jobs.</em>
|
||||
{/if}
|
||||
|
||||
93
source/webui/templates/index.tpl
Normal file
93
source/webui/templates/index.tpl
Normal file
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Ripping Cluster WebUI</title>
|
||||
<script lang="javascript">
|
||||
</script>
|
||||
<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="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="{$base_uri}styles/3rdparty/jquery.asmselect.css" rel="Stylesheet" />
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery.jec-1.3.2.js"></script>
|
||||
<script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery.asmselect.js"></script>
|
||||
<script type="text/javascript" src="{$base_uri}scripts/3rdparty/jquery.progressbar.min.js"></script>
|
||||
<script type="text/javascript" src="{$base_uri}scripts/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="banner">
|
||||
<h1>Ripping Cluster WebUI</h1>
|
||||
</div>
|
||||
|
||||
<div id="navigation">
|
||||
{include file="navigation.tpl"}
|
||||
</div>
|
||||
|
||||
<div id="page-container">
|
||||
|
||||
<div id="sidebar">
|
||||
{include file="sidebar.tpl"}
|
||||
</div>
|
||||
|
||||
<div id="page">
|
||||
|
||||
{if $messages}
|
||||
<div id="messages">
|
||||
{foreach from=$messages item=message}
|
||||
{$message}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{$page_content}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
Powered by RippingCluster WebUI {$version}. Written by Ben Roberts.
|
||||
</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>
|
||||
</html>
|
||||
88
source/webui/templates/jobs.tpl
Normal file
88
source/webui/templates/jobs.tpl
Normal file
@@ -0,0 +1,88 @@
|
||||
<h2>Jobs</h2>
|
||||
|
||||
{if $jobs}
|
||||
|
||||
<form name="view-jobs" id="view-jobs" action="{$base_uri}jobs" method="post">
|
||||
<fieldset>
|
||||
<legend>View</legend>
|
||||
|
||||
<label for="view-status">View only jobs with status:</label>
|
||||
<select id="view-status" name="view">
|
||||
<option value="any">Any Status</option>
|
||||
<option value="queued">Queued</option>
|
||||
<option value="running">Running</option>
|
||||
<option value="complete">Complete</option>
|
||||
<option value="failed">Failed</option>
|
||||
</select>
|
||||
|
||||
<input type="submit" name="submit" value="view" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form name="manage-jobs" id="manage-jobs" action="{$base_uri}jobs/submit" method="post">
|
||||
<fieldset>
|
||||
<legend>Bulk Actions</legend>
|
||||
|
||||
<input type="image" class="icon" name="action" id="mark-failed-top" value="mark-failed" src="{$base_uri}images/caution.png" alt="Mark all marked jobs as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-top" value="retry" src="{$base_uri}images/redo.png" alt="Repeat all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="delete-top" value="delete" src="{$base_uri}images/trash.png" alt="Delete all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-top" value="fix-broken-timestamps" src="{$base_uri}images/clock.png" alt="Fix Broken Timestamps in Statuses" />
|
||||
</fieldset>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Destination</th>
|
||||
<th>Title</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$jobs item=job}
|
||||
{assign var=current_status value=$job->currentStatus()}
|
||||
<tr>
|
||||
<td><a href="{$base_uri}jobs/details/id/{$job->id()}" title="View job details">{$job->name()}</a></td>
|
||||
<td>
|
||||
{$job->destinationFilename()}
|
||||
{if $job->isFinished()}
|
||||
({$job->outputFilesize()|formatFilesize})
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$job->title()}</td>
|
||||
<td>
|
||||
{$current_status->statusName()}
|
||||
{if $current_status->hasProgressInfo()}
|
||||
<br />
|
||||
Started: <em>{$current_status->ctime()|date_format:"%D %T"}</em><br />
|
||||
Progress: {$current_status->ripProgress()}%<br />
|
||||
Last update: <em>{$current_status->mtime()|date_format:"%D %T"}</em><br />
|
||||
ETA: <em>{$job->calculateETA()|formatDuration}</em>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<fieldset>
|
||||
<input type="checkbox" name="include[]" value="{$job->id()}" />
|
||||
<input type="image" class="icon" name="action" id="mark-failed-{$job->id()}" value="mark-failed[{$job->id()}]" src="{$base_uri}images/caution.png" alt="Mark job as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-{$job->id()}" value="retry[{$job->id()}]" src="{$base_uri}images/redo.png" alt="Repeat job" />
|
||||
<input type="image" class="icon" name="action" id="delete-{$job->id()}" value="delete[{$job->id()}]" src="{$base_uri}images/trash.png" alt="Delete job" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-{$job->id()}" value="fix-broken-timestamps[{$job->id()}]" src="{$base_uri}images/clock.png" alt="Fix broken status timestamps" />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<fieldset>
|
||||
<legend>Bulk Actions</legend>
|
||||
|
||||
<input type="image" class="icon" name="action" id="mark-failed-bottom" value="mark-failed" src="{$base_uri}images/caution.png" alt="Mark all marked jobs as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-bottom" value="retry" src="{$base_uri}images/redo.png" alt="Repeat all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="delete-bottom" value="delete" src="{$base_uri}images/trash.png" alt="Delete all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-bottom" value="fix-broken-timestamps" src="{$base_uri}images/clock.png" alt="Fix Broken Timestamps in Statuses" />
|
||||
</fieldset>
|
||||
</form>
|
||||
{else}
|
||||
<em>There are no jobs</em>
|
||||
{/if}
|
||||
|
||||
91
source/webui/templates/jobs/details.tpl
Normal file
91
source/webui/templates/jobs/details.tpl
Normal 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}
|
||||
|
||||
59
source/webui/templates/logs.tpl
Normal file
59
source/webui/templates/logs.tpl
Normal file
@@ -0,0 +1,59 @@
|
||||
<h2>Recent Client Logs</h2>
|
||||
|
||||
{if $client_log_entries}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Job</th>
|
||||
<th>Level</th>
|
||||
<th>Time</th>
|
||||
<th>Hostname</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$client_log_entries item=log_entry}
|
||||
<tr>
|
||||
<td>{$log_entry->jobId()}</td>
|
||||
<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 client log entries.</em>
|
||||
{/if}
|
||||
|
||||
|
||||
<h2>Recent Worker Logs</h2>
|
||||
|
||||
{if $worker_log_entries}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Job</th>
|
||||
<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->jobId()}</td>
|
||||
<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}
|
||||
|
||||
5
source/webui/templates/navigation.tpl
Normal file
5
source/webui/templates/navigation.tpl
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li><a href="{$base_uri}home/" title="Home">Home</a></li>
|
||||
<li><a href="{$base_uri}jobs/" title="Jobs">Jobs</a></li>
|
||||
<li><a href="{$base_uri}logs/" title="Logs">Logs</a></li>
|
||||
</ul>
|
||||
194
source/webui/templates/rips/setup.tpl
Normal file
194
source/webui/templates/rips/setup.tpl
Normal file
@@ -0,0 +1,194 @@
|
||||
<h2>Setup Rips</h2>
|
||||
|
||||
{if $rips_submitted}
|
||||
<h3>Jobs Queued</h3>
|
||||
|
||||
<p>
|
||||
The rips have been queued, and processing has begun in the background. View the <a href="{$base_uri}jobs/" title="View running jobs">Jobs</a> page
|
||||
to see a list of running jobs, or the <a href="{$base_uri}logs/" title="View logs">logs</a> page for more detailed progress information.
|
||||
</p>
|
||||
{else}
|
||||
<h3>{$source->filename()|escape:"html"}</h3>
|
||||
|
||||
<form name="setup" id="setup-rips" action="{$base_uri}rips/setup/submit/" method="post">
|
||||
<input type="hidden" name="plugin" value="{$source->plugin()|escape:"html"}" />
|
||||
<fieldset>
|
||||
<legend>Configure global rip options</legend>
|
||||
|
||||
<input type="hidden" name="id" value="{$source->filenameEncoded()|escape:"html"}" />
|
||||
|
||||
<div>
|
||||
<label for="global-output-directory">Output directory</label>
|
||||
<select id="global-output-directory" name="rip-options[output-directory]">
|
||||
<optgroup label="Custom"></optgroup>
|
||||
<optgroup label="Defaults">
|
||||
{foreach from=$default_output_directories item=dir key=name}
|
||||
<option value="{$dir}">{$name}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
<optgroup label="Recently Used">
|
||||
{foreach from=$recent_output_directories item=dir name=recent}
|
||||
{if $smarty.foreach.recent.iteration eq 1}
|
||||
<option value="{$dir}" selected="selected">{$dir}</option>
|
||||
{else}
|
||||
<option value="{$dir}">{$dir}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
</select>
|
||||
<script type="text/javascript">
|
||||
$('#global-output-directory').jec({
|
||||
position: 1,
|
||||
blinkingCursor: true
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="global-format">Output format</label>
|
||||
<select id="global-format" name="rip-options[format]">
|
||||
<option value="mkv" selected="selected">MKV</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="global-video-codec">Video codec</label>
|
||||
<select id="global-video-codec" name="rip-options[video-codec]">
|
||||
<option value="x264" selected="selected">x264</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="global-video-width">Video width</label>
|
||||
<input type="text" id="global-video-width" name="rip-options[video-width]" value="0" />
|
||||
<em>(Use 0 to leave size unchanged from source.)</em>
|
||||
</div>
|
||||
<div>
|
||||
<label for="global-video-height">Video height</label>
|
||||
<input type="text" id="global-video-height" name="rip-options[video-height]" value="0" />
|
||||
<em>(Use 0 to leave size unchanged from source.)</em>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="global-quantizer">Quantizer</label>
|
||||
<input type="text" id="global-quantizer" name="rip-options[quantizer]" value="" readonly="readonly" />
|
||||
<em>(Defaults to 0.61, x264's quantizer value for 20)</em>
|
||||
<div id="quantizer-slider"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="submit" name="submit" value="Queue rips" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="available-titles">
|
||||
{foreach from=$titles item=title}
|
||||
<h3 id="configure-rip-{$title->id()}"><a href="#">Title {$title->id()} (Duration: {$title->duration()}, Chapters: {$title->chapterCount()})</a></h3>
|
||||
<div id="rips-{$title->id()}">
|
||||
<fieldset>
|
||||
<legend>Configure title rip options</legend>
|
||||
|
||||
<div>
|
||||
<label for="rip-title-{$title->id()}">Rip this title</label>
|
||||
<input type="checkbox" id="rip-title-{$title->id()}" name="rips[{$title->id()}][queue]" value="1" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="rip-name-{$title->id()}">Short Name</label>
|
||||
<input type="text" id="rip-name-{$title->id()}" name="rips[{$title->id()}][name]" value="" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="rip-audio-{$title->id()}">Audio tracks</label>
|
||||
<select id="rip-audio-{$title->id()}" name="rips[{$title->id()}][audio][]" title="Select audio tracks" size="5" multiple="multiple" class="rip-streams">
|
||||
{foreach from=$title->audioTracks() item=audio}
|
||||
<option value="{$audio->id()}">{$audio->name()} - {$audio->channels()} ({$audio->language()}) </option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
<table class="audio-tracks">
|
||||
<caption>Selected audio tracks</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Track</th>
|
||||
<th>Encoder</th>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="rip-subtitle-{$title->id()}">Subtitle tracks</label>
|
||||
<select id="rip-subtitle-{$title->id()}" name="rips[{$title->id()}][subtitles][]" title="Select subtitle tracks" size="5" multiple="multiple" class="rip-streams">
|
||||
{foreach from=$title->subtitleTracks() item=subtitle}
|
||||
<option value="{$subtitle->id()}">{$subtitle->language()}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
<table class="subtitle-tracks">
|
||||
<caption>Selected subtitle tracks</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Track</th>
|
||||
<th>Language</th>
|
||||
<th>Format</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="rips-output-{$title->id()}">Output filename</label>
|
||||
<input type="text" id="rips-output-{$title->id()}" name="rips[{$title->id()}][output_filename]" value="" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="rip-deinterlace-{$title->id()}">Deinterlacing</label>
|
||||
<select id="rip-deinterlace-{$title->id()}" name="rips[{$title->id()}][deinterlace]">
|
||||
<option value="0">None</option>
|
||||
<option value="1">Full</option>
|
||||
<option value="2" selected="selected">Selective</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Queue rips</legend>
|
||||
<input type="submit" name="submit" value="Queue rips" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
{literal}
|
||||
<script language="javascript">
|
||||
$(function() {
|
||||
$("#available-titles").accordion({active: {/literal}{$source->longestTitleIndex()}{literal}});
|
||||
$("input:submit").button();
|
||||
$("#quantizer-slider").slider({
|
||||
value:0.61,
|
||||
min: 0,
|
||||
max: 1.0,
|
||||
step: 0.01,
|
||||
slide: function(event, ui) {
|
||||
$("#global-quantizer").val(ui.value);
|
||||
}
|
||||
});
|
||||
$("#global-quantizer").val($("#quantizer-slider").slider("value"));
|
||||
$('select[multiple]').asmSelect({
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
17
source/webui/templates/sidebar.tpl
Normal file
17
source/webui/templates/sidebar.tpl
Normal file
@@ -0,0 +1,17 @@
|
||||
<ul>
|
||||
<li><a href="{$base_uri}home/" title="Home">Home</a></li>
|
||||
<li><a href="{$base_uri}jobs/" title="Jobs">Jobs</a></li>
|
||||
<li><a href="{$base_uri}logs/" title="Logs">Logs</a></li>
|
||||
|
||||
<li>Browse
|
||||
<ul>
|
||||
<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>
|
||||
</li>
|
||||
</ul>
|
||||
7
source/webui/templates/sources/delete.tpl
Normal file
7
source/webui/templates/sources/delete.tpl
Normal file
@@ -0,0 +1,7 @@
|
||||
<h2>Delete Source</h2>
|
||||
|
||||
<p>
|
||||
Are you sure you want to delete {$source->plugin()|escape:"html"}:{$source->filename()|escape:"html"}?
|
||||
[ <a href="{$base_uri}sources/delete/plugin/{$source->plugin()}/id/{$source->filenameEncoded()}/confirm" title="Delete it">Delete</a>
|
||||
| <a href="{$base_uri}rips/sources" title="Return to sources list">Cancel</a> ]
|
||||
</p>
|
||||
76
source/webui/templates/sources/details.tpl
Normal file
76
source/webui/templates/sources/details.tpl
Normal file
@@ -0,0 +1,76 @@
|
||||
<h2>Source details</h2>
|
||||
|
||||
{if $source}
|
||||
<table class="source-details">
|
||||
<colgroup class="header">
|
||||
<col />
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col />
|
||||
</colgroup>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Source</th>
|
||||
<td>{$source->filename()|escape:"html"}</td>
|
||||
</tr>
|
||||
{if $titles}
|
||||
<tr>
|
||||
<th>Titles</th>
|
||||
<td>
|
||||
<table class="titles">
|
||||
<colgroup class="title-number">
|
||||
<col />
|
||||
</colgroup>
|
||||
<colgroup class="title-header">
|
||||
<col />
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col />
|
||||
</colgroup>
|
||||
|
||||
<tbody>
|
||||
{foreach from=$titles item=title}
|
||||
<tr>
|
||||
<th rowspan="5">{$title->id()}</th>
|
||||
<td>Duration</td>
|
||||
<td>{$title->duration()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Display</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>Size: {$title->width()}x{$title->height()}</li>
|
||||
<li>Pixel aspect ratio: {$title->pixelAspect()}</li>
|
||||
<li>Display aspect ratio: {$title->displayAspect()}</li>
|
||||
<li>Framerate: {$title->framerate()}</li>
|
||||
<li>Autocrop: {$title->autocrop()}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Chapters</td>
|
||||
<td>{$title->chapterCount()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Audio Tracks</td>
|
||||
<td>{$title->audioTrackCount()}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Subtitle Tracks</td>
|
||||
<td>{$title->subtitleTrackCount()}</td>
|
||||
</tr>
|
||||
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
{else}
|
||||
<p>
|
||||
<em>This is not a valid source.</em>
|
||||
</p>
|
||||
{/if}
|
||||
18
source/webui/templates/sources/list.tpl
Normal file
18
source/webui/templates/sources/list.tpl
Normal 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}
|
||||
Reference in New Issue
Block a user