This commit is contained in:
Romain Neutron
2012-04-25 17:38:49 +02:00
parent 68527a48f2
commit dd994a9bd6
31 changed files with 182 additions and 125 deletions

View File

@@ -39,5 +39,6 @@ return call_user_func(
$app->error(function($e){
return new \Symfony\Component\HttpFoundation\Response($e->getMessage(), 403);
});
return $app;
});

View File

@@ -73,7 +73,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
}
$auth = new \Session_Authentication_None($user);

View File

@@ -31,7 +31,7 @@ use Symfony\Component\HttpFoundation\Request;
return call_user_func(function()
{
$app = new \Silex\Application();
$app['Core'] = \bootstrap::getCore();
$app->register(new \Silex\Provider\ValidatorServiceProvider(), array(
@@ -171,7 +171,7 @@ return call_user_func(function()
}
$account = $oauth2_adapter->updateAccount($session->get_usr_id());
$params['account_id'] = $account->get_id();
if ( ! $app_authorized && $action_accept === null)
@@ -225,7 +225,7 @@ return call_user_func(function()
{
throw new HttpException(400, 'require the use of the https', null, array('content-type'=> 'application/json'));
}
$app['oauth']->grantAccessToken();
ob_flush();
flush();
@@ -343,7 +343,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -378,7 +378,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -404,7 +404,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -428,7 +428,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -455,13 +455,13 @@ return call_user_func(function()
$code = 500;
$msg = 'We are sorry, but something went wrong';
$headers = array();
if($e instanceof HttpExceptionInterface)
{
$headers = $e->getHeaders();
$msg = $e->getMessage();
$code = $e->getStatusCode();
if(isset($headers['content-type']) && $headers['content-type'] == 'application/json')
{
$obj = new \stdClass();
@@ -470,7 +470,7 @@ return call_user_func(function()
$msg = json_encode($obj);
}
}
return new Response($msg, $code, $headers);
});

View File

@@ -444,7 +444,7 @@ class Push implements ControllerProviderInterface
}
catch (\Exception_NotFound $e)
{
}
$Participant = new \Entities\ValidationParticipant();
@@ -641,7 +641,7 @@ class Push implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
if (!$user instanceof \User_Adapter)

View File

@@ -88,6 +88,7 @@ class Tools implements ControllerProviderInterface
'metadatasFirst' => $metadatasFirst,
'metadatasSecond' => $metadatasSecond
);
return new Response($app['Core']->getTwig()->render($template, $var));
});
@@ -115,6 +116,7 @@ class Tools implements ControllerProviderInterface
}
$json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 200, array('content-type' => 'application/json'));
});
@@ -143,6 +145,7 @@ class Tools implements ControllerProviderInterface
}
$json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 200, array('content-type' => 'application/json'));
});
@@ -251,6 +254,7 @@ class Tools implements ControllerProviderInterface
, 'fileName' => $fileName
, 'errorMessage' => $errorMessage
);
return new Response($app['Core']->getTwig()->render($template, $var));
}
});
@@ -276,6 +280,7 @@ class Tools implements ControllerProviderInterface
}
$json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 201, array('content-type' => 'application/json'));
});
@@ -307,6 +312,7 @@ class Tools implements ControllerProviderInterface
}
$json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 201, array('content-type' => 'application/json'));
});

View File

@@ -86,7 +86,7 @@ class Autoloader extends UniversalClassLoader
{
return $this->classmap[$classname];
}
$normalized_classname = str_replace('_', '/', $classname);
foreach ($this->paths as $path)

View File

@@ -51,4 +51,4 @@ class Boolean implements OptionType
return $this->value;
}
}
}

View File

@@ -69,4 +69,4 @@ class Enum implements OptionType
return $this->value;
}
}
}

View File

@@ -76,4 +76,4 @@ class Range implements OptionType
return $this->max_value;
}
}
}

View File

@@ -195,6 +195,7 @@ class API_OAuth2_Adapter extends OAuth2
$application = API_OAuth2_Application::load_from_client_id($this->appbox, $client_id);
if ($client_secret === NULL)
return true;
$crypted = $this->crypt_secret($client_secret, $application->get_nonce());
@@ -203,7 +204,7 @@ class API_OAuth2_Adapter extends OAuth2
}
catch (Exception $e)
{
}
return false;
@@ -248,7 +249,7 @@ class API_OAuth2_Adapter extends OAuth2
}
catch (Exception $e)
{
}
return $result;
@@ -321,7 +322,7 @@ class API_OAuth2_Adapter extends OAuth2
}
catch (Exception $e)
{
}
return null;
@@ -375,7 +376,7 @@ class API_OAuth2_Adapter extends OAuth2
}
catch (Exception $e)
{
}
return null;
@@ -498,7 +499,7 @@ class API_OAuth2_Adapter extends OAuth2
$input["redirect_uri"] = $redirect_uri;
}
/**
* Check response_type
*/
@@ -507,7 +508,7 @@ class API_OAuth2_Adapter extends OAuth2
$this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_INVALID_REQUEST, 'Invalid response type.', NULL, $input["state"]);
}
/**
* Check requested auth response type against the list of supported types
*/
@@ -521,7 +522,7 @@ class API_OAuth2_Adapter extends OAuth2
if ($this->checkRestrictedAuthResponseType($input["client_id"], $input["response_type"]) === FALSE)
$this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_UNAUTHORIZED_CLIENT, NULL, NULL, $input["state"]);
/**
* Validate that the requested scope is supported
*/
@@ -628,7 +629,7 @@ class API_OAuth2_Adapter extends OAuth2
}
catch (Exception $e)
{
}
return false;
@@ -640,11 +641,13 @@ class API_OAuth2_Adapter extends OAuth2
if ($token_param === FALSE) // Access token was not provided
return $exit_not_present ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_BAD_REQUEST, $realm, OAUTH2_ERROR_INVALID_REQUEST, 'The request is missing a required parameter, includes an unsupported parameter or parameter value, repeats the same parameter, uses more than one method for including an access token, or is otherwise malformed.', NULL, $scope) : FALSE;
// Get the stored token data (from the implementing subclass)
$token = $this->getAccessToken($token_param);
if ($token === NULL)
return $exit_invalid ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_UNAUTHORIZED, $realm, OAUTH2_ERROR_INVALID_TOKEN, 'The access token provided is invalid.', NULL, $scope) : FALSE;
if (isset($token['revoked']) && $token['revoked'])
@@ -656,11 +659,13 @@ class API_OAuth2_Adapter extends OAuth2
{
// Check token expiration (I'm leaving this check separated, later we'll fill in better error messages)
if (isset($token["expires"]) && time() > $token["expires"])
return $exit_expired ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_UNAUTHORIZED, $realm, OAUTH2_ERROR_EXPIRED_TOKEN, 'The access token provided has expired.', NULL, $scope) : FALSE;
}
// Check scope, if provided
// If token doesn't have a scope, it's NULL/empty, or it's insufficient, then throw an error
if ($scope && ( ! isset($token["scope"]) || ! $token["scope"] || ! $this->checkScope($scope, $token["scope"])))
return $exit_scope ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_FORBIDDEN, $realm, OAUTH2_ERROR_INSUFFICIENT_SCOPE, 'The request requires higher privileges than provided by the access token.', NULL, $scope) : FALSE;
//save token's linked ses_id
@@ -729,7 +734,7 @@ class API_OAuth2_Adapter extends OAuth2
if ( ! $this->checkRestrictedGrantType($client[0], $input["grant_type"]))
$this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_UNAUTHORIZED_CLIENT);
// Do the granting
switch ($input["grant_type"])
{
@@ -839,9 +844,9 @@ class API_OAuth2_Adapter extends OAuth2
$auth = new \Session_Authentication_Native($appbox, $username, $password);
$auth->challenge_password();
$account = API_OAuth2_Account::load_with_user($appbox, $application, $auth->get_user());
return array(
'redirect_uri' => $application->get_redirect_uri()
, 'client_id' => $application->get_client_id()

View File

@@ -1156,6 +1156,7 @@ class API_V1_adapter extends API_V1_Abstract
* @todo ajouter une option pour avoir les values serialisées
* dans un cas multi
*/
return array(
'meta_id' => $value->getId()
, 'meta_structure_id' => $field->get_meta_struct_id()

View File

@@ -115,6 +115,7 @@ class API_V1_result
protected function parse_response_type()
{
if (trim($this->request->get('callback')) !== '')
return $this->response_type = self::FORMAT_JSONP;
$accept = $this->request->getAcceptableContentTypes();

View File

@@ -329,7 +329,7 @@ class Session_Handler
$this->phrasea_session->open();
$ses_id = $this->phrasea_session->get_id();
$this->storage()->set('usr_id', $user->get_id());
$this->storage()->set('ses_id', $ses_id);
}

View File

@@ -224,6 +224,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
foreach ($this->get_fields() as $meta_struct_id => $field)
{
if ($field->get_name() == $fieldname)
return $field;
}

View File

@@ -448,6 +448,7 @@ class databox extends base
$stmt->closeCursor();
if ($row)
return self::get_instance((int) $row['sbas_id']);
try
@@ -701,6 +702,7 @@ class databox extends base
}
}
if ($n > $limit)
return true;
return false;
@@ -1217,6 +1219,7 @@ class databox extends base
public function get_structure()
{
if ($this->structure)
return $this->structure;
$this->structure = $this->retrieve_structure();
@@ -1257,6 +1260,7 @@ class databox extends base
public function get_cterms()
{
if ($this->cterms)
return $this->cterms;
$sql = "SELECT value FROM pref WHERE prop='cterms'";
@@ -1423,6 +1427,7 @@ class databox extends base
public function get_cgus()
{
if ($this->cgus)
return $this->cgus;
$this->load_cgus();

View File

@@ -93,7 +93,7 @@ class patch_3604 implements patchInterface
{
}
$sql = 'SELECT m . *
FROM metadatas_structure s, metadatas m
WHERE m.meta_struct_id = s.id

View File

@@ -1080,7 +1080,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return $this;
@@ -1696,6 +1696,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
if ( ! $subdefs)
{
$Core['monolog']->addInfo(sprintf('Nothing to do for %s', $this->get_type()));
return;
}

View File

@@ -646,6 +646,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
);
if ( ! isset($res['results']) || ! is_array($res['results']))
return array();
$rs = $res['results'];
$res = array_shift($rs);

View File

@@ -138,7 +138,7 @@ class set_exportftp extends set_export
. $properties['exportExt'];
$bfields = isset($properties['businessfields']) ? $properties['businessfields'] : null;
$params = array(
':ftp_export_id' => $ftp_export_id
, ':base_id' => $file['base_id']

View File

@@ -264,6 +264,7 @@ class system_file extends SplFileObject
if (in_array($this->get_mime(), $raws))
return true;
return false;
}
@@ -292,8 +293,10 @@ class system_file extends SplFileObject
}
if ($lowercase)
return mb_strtolower($extension);
else
return $extension;
}
@@ -486,6 +489,7 @@ class system_file extends SplFileObject
$this->technical_datas = array();
if ( ! is_executable($registry->get('GV_mplayer')))
return $this;
$cmd = $registry->get('GV_mplayer')
@@ -708,6 +712,7 @@ class system_file extends SplFileObject
public function read_uuid()
{
if ($this->uuid)
return $this->uuid;
$datas = exiftool::extract_metadatas($this, exiftool::EXTRACT_XML_RDF);
@@ -746,6 +751,7 @@ class system_file extends SplFileObject
public function is_new_in_base($sbas_id)
{
if ( ! $this->uuid)
return true;
$connbas = connection::getPDOConnection($sbas_id);
@@ -817,6 +823,7 @@ class system_file extends SplFileObject
{
$value = $base64_encoded ? base64_decode($v->nodeValue) : $v->nodeValue;
if (uuid::is_valid($value))
return $value;
}
}
@@ -921,6 +928,7 @@ class system_file extends SplFileObject
public function get_phrasea_tech_field($field)
{
if (isset($this->phrasea_tech_field[$field]))
return $this->phrasea_tech_field[$field];
return null;
}
@@ -1255,6 +1263,7 @@ class system_file extends SplFileObject
for ($i = strlen($mac); $i;)
{
if (strpos($macchars, $mac[ -- $i]) !== false)
return(iconv('MACINTOSH', 'UTF-8', $mac));
}
@@ -1265,6 +1274,7 @@ class system_file extends SplFileObject
for ($i = strlen($s); $i;)
{
if (strpos($macchars, $s[ -- $i]) !== false)
return(iconv('MACINTOSH', 'UTF-8', $s));
}

View File

@@ -50,6 +50,7 @@ class task_Scheduler
{
file_put_contents($logdir . "scheduler_l.log", $message . "\n", FILE_APPEND);
}
return $this;
}

View File

@@ -20,7 +20,7 @@ abstract class task_abstract
const STATE_MAXMEGSREACHED = 'STATE_MAXMEGS';
const STATE_MAXRECSDONE = 'STATE_MAXRECS';
const STATE_FINISHED = 'STATE_FINISHED';
const SIGNAL_SCHEDULER_DIED = 'SIGNAL_SCHEDULER_DIED';
protected $suicidable = false;
@@ -89,7 +89,7 @@ abstract class task_abstract
*/
protected $return_value;
protected $runner;
private $input;
private $output;
@@ -115,6 +115,7 @@ abstract class task_abstract
$stmt->closeCursor();
if(!$row)
throw new Exception('Unknown task id');
return $row['status'];
}
@@ -169,7 +170,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
//
// return $this;
// }
// 'active' means 'auto-start when scheduler starts'
// 'active' means 'auto-start when scheduler starts'
public function set_active($boolean)
{
$conn = connection::getPDOConnection();
@@ -251,7 +252,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
return $this->settings;
}
// 'active' means 'auto-start when scheduler starts'
// 'active' means 'auto-start when scheduler starts'
public function is_active()
{
return $this->active;
@@ -446,6 +447,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
}
fclose($fd);
}
return $pid;
}
@@ -532,7 +534,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
return $this;
}
public function set_running($stat)
{
$this->running = $stat;
@@ -604,6 +606,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
$this->delete();
else
$this->set_status($this->return_value);
return $this;
}
@@ -615,7 +618,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
$this->maxrecs = max(10, min(1000, (int) $sx_task_settings->maxrecs));
$this->maxmegs = max(16, min(512, (int) $sx_task_settings->maxmegs));
$this->record_buffer_size = max(1, min(100, (int) $sx_task_settings->flush));
return $this;
}
@@ -682,8 +685,8 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
return $this;
}
public static function interfaceAvailable()
{
return true;
@@ -766,7 +769,7 @@ $this->log(sprintf("task %d <- %s", $this->get_task_id(), $status));
}
catch(Exception $e)
{
}
return $this;

View File

@@ -68,6 +68,7 @@ class task_manager
public function get_tasks($refresh = false)
{
if ($this->tasks && !$refresh)
return $this->tasks;
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";

View File

@@ -172,6 +172,7 @@ class task_period_archive extends task_abstract
<?php echo $form ?>.copy_spe.checked = <?php echo p4field::isyes($sxml->copy_spe) ? "true" : "false" ?>;
</script>
<?php
return("");
}
else // ... so we NEVER come here
@@ -204,6 +205,7 @@ class task_period_archive extends task_abstract
}
</script>
<?php
return;
}
@@ -514,6 +516,7 @@ class task_period_archive extends task_abstract
}
}
$this->return_value = $ret;
return($ret);
}
@@ -589,6 +592,7 @@ class task_period_archive extends task_abstract
$stmt->closeCursor();
if($row && $row['status'] == 'tostop')
return('NORECSTODO');
sleep(2);
$cold -= 2;
@@ -736,8 +740,10 @@ class task_period_archive extends task_abstract
{
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
if($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
return;
elseif($magicmethod == 'UNLOCK' && !file_exists($path . '/' . $magicfile))
return;
}
@@ -790,7 +796,7 @@ class task_period_archive extends task_abstract
}
catch(Exception $e)
{
}
return($nnew);
@@ -843,12 +849,14 @@ class task_period_archive extends task_abstract
{
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
if($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
return;
elseif($magicmethod == 'UNLOCK' && !file_exists($path . '/' . $magicfile))
return;
}
}
while(($file = $listFolder->read()) !== NULL)
{
if($this->isIgnoredFile($file))
@@ -906,7 +914,7 @@ class task_period_archive extends task_abstract
}
catch(Exception $e)
{
}
return;
@@ -935,6 +943,7 @@ class task_period_archive extends task_abstract
$iloop = 0;
if($depth == 0 && ($node->getAttribute('temperature') == 'hot' || $node->getAttribute('cid') == '-1'))
return;
$xpath = new DOMXPath($dom); // useful
@@ -1093,6 +1102,7 @@ class task_period_archive extends task_abstract
$ret = false;
if($depth == 0 && $node->getAttribute('temperature') == 'hot') // if root of hotfolder if hot, die...
return($ret);
$nodesToDel = array();
@@ -1174,6 +1184,7 @@ class task_period_archive extends task_abstract
$iloop = 0;
if($node->getAttribute('temperature') == 'hot')
return;
$nodesToDel = array();
@@ -1250,6 +1261,7 @@ class task_period_archive extends task_abstract
$iloop = 0;
if($node->getAttribute('temperature') == 'hot')
return;
$ret = 0;
@@ -1313,6 +1325,7 @@ class task_period_archive extends task_abstract
$ret = false;
if($depth == 0 && $node->getAttribute('temperature') == 'hot') // if root of hotfolder if hot, die...
return($ret);
//printf("%s : \n", __LINE__);
@@ -1696,6 +1709,7 @@ class task_period_archive extends task_abstract
{
$match = $node->getAttribute('match');
if($match == '*')
return;
$file = $node->getAttribute('name');
@@ -1843,7 +1857,7 @@ class task_period_archive extends task_abstract
}
catch(Exception $e)
{
}
}

View File

@@ -183,6 +183,7 @@ class task_period_cindexer extends task_abstract
parent.calccmd();
</script>
<?php
return("");
}
else // ... so we NEVER come here
@@ -251,6 +252,7 @@ class task_period_cindexer extends task_abstract
}
</script>
<?php
return;
}
@@ -417,7 +419,7 @@ class task_period_cindexer extends task_abstract
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$this->return_value = self::RETURNSTATUS_STOPPED; // will be normal ending
if($this->method == self::METHOD_PROC_OPEN)
{
$descriptors = array();
@@ -545,7 +547,7 @@ class task_period_cindexer extends task_abstract
// $fdERR = fopen($nullfile, 'a+');
$fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+");
$fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+");
pcntl_exec($cmd, $args);
sleep(2);
@@ -571,7 +573,7 @@ class task_period_cindexer extends task_abstract
break;
}
}
$this->check_task_status();
if($this->task_status == self::STATUS_TOSTOP)
@@ -579,7 +581,7 @@ class task_period_cindexer extends task_abstract
posix_kill($pid, ($sigsent=SIGINT));
sleep(2);
}
$status = NULL;
if(pcntl_wait($status, WNOHANG) == $pid)
{
@@ -622,12 +624,12 @@ class task_period_cindexer extends task_abstract
$fdIN = fopen($nullfile, 'r');
$fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+");
$fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+");
pcntl_exec($cmd, $args);
sleep(2);
}
return($this->return_value);
}

View File

@@ -799,7 +799,7 @@ class task_period_outofdate extends task_abstract
$sql = "UPDATE prop AS p1 INNER JOIN record USING(record_id)
SET " . $sqlset[0] .
" WHERE " . $w;
$ret[] = array('sql'=>$sql, 'params'=>$params);
}
@@ -882,7 +882,7 @@ class task_period_outofdate extends task_abstract
}
public function facility()
{
$ret = NULL;

View File

@@ -22,4 +22,4 @@
</tbody>
</table>
</div>
</div>

View File

@@ -4,4 +4,4 @@
{% trans ' an error occured '%}
{{errorMessage}}
{% endif %}
</div>
</div>

View File

@@ -20,7 +20,7 @@
{% endfor %}
<div id='prod-tool-box' class="PNB10">
{# jquery Tabs #}
<div id="tool-tabs">
{# jquery menu #}
@@ -106,13 +106,13 @@
</div>
</form>
</div>
{% if selectionLength == 1%}
{% for record in selection %}
{% if record.get_type() == 'video' %}
<div id="thumbExtractor" class="tabBox">
<div class="PNB10 main_title">
<img src='/skins/prod/ThumbExtractor/camera_title.png'/>
<img src='/skins/prod/ThumbExtractor/camera_title.png'/>
{% trans "screenshot video" %}
</div>
<hr style='margin-top:25px;'/>
@@ -166,7 +166,7 @@
<img id="contrast" src="/skins/prod/ThumbExtractor/contrast.png" />
</div>
</div>
<div id="thumb_slider" class="PNB">
<div id="thumb_wrapper">
@@ -219,7 +219,7 @@
<button class="apply-contrast">{% trans 'validate'%}</button>
</div>
</div>
<div id="thumb_validate_button" class="PNB">
<input type="hidden" value='{{record.get_sbas_id()}}' name='sbas_id'>
<input type="hidden" value='{{record.get_record_id()}}' name='record_id'>
@@ -229,7 +229,7 @@
{% endif %}
{% endfor %}
{% endif %}
{# image section #}
{% if selectionLength == 1%}
{% for record in selection %}
@@ -260,21 +260,21 @@
{% endif %}
{% endfor %}
{% endif %}
{# hd sub section #}
{% if selectionLength == 1 %}
{% for record in selection %}
<div id="substitution" class="tabBox">
{% if registry.get('GV_seeOngChgDoc') %}
<div id="substitution-hd">
<form
name ="formchgHD"
action="/prod/tools/hddoc/"
enctype="multipart/form-data"
<form
name ="formchgHD"
action="/prod/tools/hddoc/"
enctype="multipart/form-data"
method="post"
target="uploadHdsub">
<fieldset style='border:1px solid #999;padding:20px;'>
<legend style='color:#EEE'>&nbsp;<b>{% trans "substitution HD" %}</b>&nbsp;</legend>
<div>
@@ -303,13 +303,13 @@
<div class='resultAction'></div>
</div>
{% endif %}
{% if registry.get('GV_seeNewThumb') %}
<div id="substitution-sd">
<form
name="formchgHD"
action="/prod/tools/chgthumb/"
enctype="multipart/form-data"
<form
name="formchgHD"
action="/prod/tools/chgthumb/"
enctype="multipart/form-data"
method="post"
target="uploadHdsub">
<fieldset style='border:1px solid #999;padding:20px;'>
@@ -336,24 +336,24 @@
{% endif %}
</div>
{% endfor %}
{% endif %}
{% endif %}
{# exiftool section #}
{% if metadatas %}
{% for record in selection %}
<div id="exiftool" class="tabBox">
{% set thumbnail = record.get_thumbnail() %}
<img style='float:left; margin-right:15px'
src="{{thumbnail.get_url()}}"
width="{{thumbnail.get_width()}}"
src="{{thumbnail.get_url()}}"
width="{{thumbnail.get_width()}}"
height="{{thumbnail.get_height()}}" />
{#{% if record is not none %}
<h1><b>{{record.get_title()}}</b></h1>
{% endif %}#}
<div>
<h1><b>HTML</b></h1>
<hr>
@@ -363,7 +363,7 @@
{% endspaceless %}
{% endfor %}
</div>
<div>
<h1><b>XML</b></h1>
<hr />
@@ -375,14 +375,14 @@
{% endfor %}
{% endif %}
</div>
{# hidden iframe to handle upload #}
<iframe
<iframe
id="uploadHdsub"
name="uploadHdsub"
height="0"
width="0"
height="0"
width="0"
>
</iframe>
</div>
@@ -391,9 +391,9 @@
$(document).ready(function(){
var scope = $("#prod-tool-box");
var width = 0;
$("#tool-tabs", scope).tabs();
$(".iframe_submiter", scope).bind("click", function(){
var form = $(this).closest("form");
form.submit();
@@ -420,20 +420,20 @@
}
});
});
$(".action_cancel", scope).bind("click", function(){
var dialog = p4.Dialog.get(1);
dialog.Close();
});
//thumbExtractor
$("#slider-brightness", scope).slider({
slide: function() {
$("#value-brightness").val(Math.round($("#slider-brightness").slider("value") / 100 * 300) - 150);
}
}).slider( "option", "value", 50);
}).slider( "option", "value", 50);
$("#slider-contrast").slider({
slide: function() {
$("#value-contrast").val(
@@ -444,8 +444,8 @@
-1
).toFixed(1));
}
}).slider( "option", "value", 1/3*100);
}).slider( "option", "value", 1/3*100);
var sliderWrapper = $("#thumb_wrapper", scope);
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas");
@@ -489,11 +489,11 @@
img.remove();
ThumbEditor.store.remove(id);
});
$(".close_action_frame", scope).bind("click", function(){
$(this).closest(".action_frame").hide();
});
$("#flipV", scope).bind("click", function(){
Pixastic.process($("#thumb_canvas").get(0),
"flipv",
@@ -504,21 +504,21 @@
$("#flipH", scope).bind("click", function(){
Pixastic.process($("#thumb_canvas").get(0),
"fliph",
"fliph",
null, function(canvas){$("#thumb_canvas").trigger("tool_event");}
);
});
$("#brightness", scope).bind("click", function(){
$("#action_frame_brightness", scope).show();
$("#action_frame_contrast", scope).hide();
});
$("#contrast", scope).bind("click", function(){
$("#action_frame_brightness", scope).hide();
$("#action_frame_contrast", scope).show();
});
$(".apply-brightness", scope).bind("click", function(){
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
brightness: $("#value-brightness").val(),
@@ -526,7 +526,7 @@
legacy: false
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
});
$(".apply-contrast").bind("click", function(){
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
brightness: $("#value-brightness").val(),
@@ -534,7 +534,7 @@
legacy: false
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
});
$("img", sliderWrapper).live("click", function(){
$('.selected', sliderWrapper).removeClass('selected');
$(this).addClass('selected');
@@ -546,7 +546,7 @@
$("#thumb_info", scope).hide();
$("#thumb_delete_button", scope).show();
$("#thumb_reset_button",scope).show();
var screenshot = ThumbEditor.screenshot();
var img = $("<img />");
$('.selected', sliderWrapper).removeClass('selected');
@@ -556,22 +556,23 @@
.attr("alt", screenshot.getVideoTime())
.appendTo(sliderWrapper);
});
$("#thumb_canvas").live('tool_event', function(){
var thumbnail = $('.selected', sliderWrapper);
if(thumbnail.length === 0)
{
console.error('No image selected');
return;
}
thumbnail.attr('src', ThumbEditor.getCanvaImage());
});
$("#thumb_validate_button", scope).bind("click", function(){
var thumbnail = $('.selected', sliderWrapper);
if(thumbnail.length === 0)
@@ -581,41 +582,41 @@
title: '{% trans "alert" %}',
closeOnEscape:true
}, 3);
var content = $("<div />").css({
'text-align':'center',
'width': '100%',
'font-size':'14px'
}).append('{% trans "no image selected" %}');
dialog.setContent(content);
return;
}
var buttons = {};
var record_id = $("input[name=record_id]").val();
var sbas_id = $("input[name=sbas_id]").val();
function disableConfirmButton(dialog){
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
return $(this).text() == language.valider;
}).addClass("ui-state-disabled").attr("disabled", true);
}
function enableConfirmButton(dialog){
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
return $(this).text() == language.valider;
}).removeClass("ui-state-disabled").attr("disabled", false);
}
buttons[language.valider] = function(){
var dialog = p4.Dialog.get(2);
var buttonPanel = dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane");
var loadingDiv = buttonPanel.find('.info-div');
if(loadingDiv.length == 0)
{
loadingDiv = $("<div />").css({
@@ -628,7 +629,7 @@
'background-position' : 'left center'
}).attr('class', 'info-div').prependTo(buttonPanel);
}
$.ajax({
type: "POST",
url: "/prod/tools/thumb-extractor/apply/",
@@ -643,7 +644,7 @@
},
success: function(data){
loadingDiv.empty().removeClass('loading');
if(data.success)
{
dialog.Close();
@@ -658,27 +659,27 @@
}
});
};
//show confirm box, content is loaded here /prod/tools/thumb-extractor/confirm-box/
var dialog = p4.Dialog.Create({
size:'Small',
title:"{% trans 'thumbnail validation' %}",
cancelButton:true,
buttons: buttons
buttons: buttons
}, 2);
var datas = {
image: $('.selected', sliderWrapper).attr("src"),
sbas_id: sbas_id,
record_id: record_id
};
$.ajax({
type: "POST",
url: "/prod/tools/thumb-extractor/confirm-box/",
data: datas,
success: function(data){
if(data.error)
{
var content = $("<div />").css({'font-size':'16px', 'text-align':'center'}).append(data.datas);
@@ -694,4 +695,4 @@
});
scope.find('button').button();
});
</script>
</script>

View File

@@ -66,6 +66,7 @@ foreach(array('l' => 'log', 'o' => 'stdout', 'e' => 'stderr') as $k => $v)
if($parm['act'] == 'CLR')
{
file_put_contents($logfile, '');
return phrasea::redirect(sprintf("/admin/showlogtask.php?fil=%s&log=%s&id=%s"
, urlencode($parm['fil'])
, urlencode($parm['log'])

View File

@@ -254,6 +254,7 @@ foreach($tasks as $t)
beforeShow:function()
{
if(!retPing)
return;
if(retPing.scheduler && retPing.scheduler.pid)
{
@@ -321,6 +322,7 @@ foreach($tasks as $t)
var tid = $($(this)[0].target).parent().attr('id').split('_').pop();
if(!retPing || !retPing.tasks[tid])
return;
if(retPing.tasks[tid].pid)