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){ $app->error(function($e){
return new \Symfony\Component\HttpFoundation\Response($e->getMessage(), 403); return new \Symfony\Component\HttpFoundation\Response($e->getMessage(), 403);
}); });
return $app; return $app;
}); });

View File

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

View File

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

View File

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

View File

@@ -88,6 +88,7 @@ class Tools implements ControllerProviderInterface
'metadatasFirst' => $metadatasFirst, 'metadatasFirst' => $metadatasFirst,
'metadatasSecond' => $metadatasSecond 'metadatasSecond' => $metadatasSecond
); );
return new Response($app['Core']->getTwig()->render($template, $var)); return new Response($app['Core']->getTwig()->render($template, $var));
}); });
@@ -115,6 +116,7 @@ class Tools implements ControllerProviderInterface
} }
$json = $app['Core']->getSerializer()->serialize($return, 'json'); $json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 200, array('content-type' => 'application/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'); $json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 200, array('content-type' => 'application/json')); return new Response($json, 200, array('content-type' => 'application/json'));
}); });
@@ -251,6 +254,7 @@ class Tools implements ControllerProviderInterface
, 'fileName' => $fileName , 'fileName' => $fileName
, 'errorMessage' => $errorMessage , 'errorMessage' => $errorMessage
); );
return new Response($app['Core']->getTwig()->render($template, $var)); return new Response($app['Core']->getTwig()->render($template, $var));
} }
}); });
@@ -276,6 +280,7 @@ class Tools implements ControllerProviderInterface
} }
$json = $app['Core']->getSerializer()->serialize($return, 'json'); $json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 201, array('content-type' => 'application/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'); $json = $app['Core']->getSerializer()->serialize($return, 'json');
return new Response($json, 201, array('content-type' => 'application/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]; return $this->classmap[$classname];
} }
$normalized_classname = str_replace('_', '/', $classname); $normalized_classname = str_replace('_', '/', $classname);
foreach ($this->paths as $path) foreach ($this->paths as $path)

View File

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

View File

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

View File

@@ -76,4 +76,4 @@ class Range implements OptionType
return $this->max_value; 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); $application = API_OAuth2_Application::load_from_client_id($this->appbox, $client_id);
if ($client_secret === NULL) if ($client_secret === NULL)
return true; return true;
$crypted = $this->crypt_secret($client_secret, $application->get_nonce()); $crypted = $this->crypt_secret($client_secret, $application->get_nonce());
@@ -203,7 +204,7 @@ class API_OAuth2_Adapter extends OAuth2
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return false; return false;
@@ -248,7 +249,7 @@ class API_OAuth2_Adapter extends OAuth2
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return $result; return $result;
@@ -321,7 +322,7 @@ class API_OAuth2_Adapter extends OAuth2
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return null; return null;
@@ -375,7 +376,7 @@ class API_OAuth2_Adapter extends OAuth2
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return null; return null;
@@ -498,7 +499,7 @@ class API_OAuth2_Adapter extends OAuth2
$input["redirect_uri"] = $redirect_uri; $input["redirect_uri"] = $redirect_uri;
} }
/** /**
* Check response_type * 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"]); $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 * 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) if ($this->checkRestrictedAuthResponseType($input["client_id"], $input["response_type"]) === FALSE)
$this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_UNAUTHORIZED_CLIENT, NULL, NULL, $input["state"]); $this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_UNAUTHORIZED_CLIENT, NULL, NULL, $input["state"]);
/** /**
* Validate that the requested scope is supported * Validate that the requested scope is supported
*/ */
@@ -628,7 +629,7 @@ class API_OAuth2_Adapter extends OAuth2
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return false; return false;
@@ -640,11 +641,13 @@ class API_OAuth2_Adapter extends OAuth2
if ($token_param === FALSE) // Access token was not provided 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; 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) // Get the stored token data (from the implementing subclass)
$token = $this->getAccessToken($token_param); $token = $this->getAccessToken($token_param);
if ($token === NULL) 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; 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']) 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) // Check token expiration (I'm leaving this check separated, later we'll fill in better error messages)
if (isset($token["expires"]) && time() > $token["expires"]) 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; 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 // Check scope, if provided
// If token doesn't have a scope, it's NULL/empty, or it's insufficient, then throw an error // 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"]))) 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; 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 //save token's linked ses_id
@@ -729,7 +734,7 @@ class API_OAuth2_Adapter extends OAuth2
if ( ! $this->checkRestrictedGrantType($client[0], $input["grant_type"])) if ( ! $this->checkRestrictedGrantType($client[0], $input["grant_type"]))
$this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_UNAUTHORIZED_CLIENT); $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_UNAUTHORIZED_CLIENT);
// Do the granting // Do the granting
switch ($input["grant_type"]) switch ($input["grant_type"])
{ {
@@ -839,9 +844,9 @@ class API_OAuth2_Adapter extends OAuth2
$auth = new \Session_Authentication_Native($appbox, $username, $password); $auth = new \Session_Authentication_Native($appbox, $username, $password);
$auth->challenge_password(); $auth->challenge_password();
$account = API_OAuth2_Account::load_with_user($appbox, $application, $auth->get_user()); $account = API_OAuth2_Account::load_with_user($appbox, $application, $auth->get_user());
return array( return array(
'redirect_uri' => $application->get_redirect_uri() 'redirect_uri' => $application->get_redirect_uri()
, 'client_id' => $application->get_client_id() , '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 * @todo ajouter une option pour avoir les values serialisées
* dans un cas multi * dans un cas multi
*/ */
return array( return array(
'meta_id' => $value->getId() 'meta_id' => $value->getId()
, 'meta_structure_id' => $field->get_meta_struct_id() , 'meta_structure_id' => $field->get_meta_struct_id()

View File

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

View File

@@ -329,7 +329,7 @@ class Session_Handler
$this->phrasea_session->open(); $this->phrasea_session->open();
$ses_id = $this->phrasea_session->get_id(); $ses_id = $this->phrasea_session->get_id();
$this->storage()->set('usr_id', $user->get_id()); $this->storage()->set('usr_id', $user->get_id());
$this->storage()->set('ses_id', $ses_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) foreach ($this->get_fields() as $meta_struct_id => $field)
{ {
if ($field->get_name() == $fieldname) if ($field->get_name() == $fieldname)
return $field; return $field;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -183,6 +183,7 @@ class task_period_cindexer extends task_abstract
parent.calccmd(); parent.calccmd();
</script> </script>
<?php <?php
return(""); return("");
} }
else // ... so we NEVER come here else // ... so we NEVER come here
@@ -251,6 +252,7 @@ class task_period_cindexer extends task_abstract
} }
</script> </script>
<?php <?php
return; return;
} }
@@ -417,7 +419,7 @@ class task_period_cindexer extends task_abstract
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); $logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$this->return_value = self::RETURNSTATUS_STOPPED; // will be normal ending $this->return_value = self::RETURNSTATUS_STOPPED; // will be normal ending
if($this->method == self::METHOD_PROC_OPEN) if($this->method == self::METHOD_PROC_OPEN)
{ {
$descriptors = array(); $descriptors = array();
@@ -545,7 +547,7 @@ class task_period_cindexer extends task_abstract
// $fdERR = fopen($nullfile, 'a+'); // $fdERR = fopen($nullfile, 'a+');
$fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+"); $fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+");
$fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+"); $fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+");
pcntl_exec($cmd, $args); pcntl_exec($cmd, $args);
sleep(2); sleep(2);
@@ -571,7 +573,7 @@ class task_period_cindexer extends task_abstract
break; break;
} }
} }
$this->check_task_status(); $this->check_task_status();
if($this->task_status == self::STATUS_TOSTOP) if($this->task_status == self::STATUS_TOSTOP)
@@ -579,7 +581,7 @@ class task_period_cindexer extends task_abstract
posix_kill($pid, ($sigsent=SIGINT)); posix_kill($pid, ($sigsent=SIGINT));
sleep(2); sleep(2);
} }
$status = NULL; $status = NULL;
if(pcntl_wait($status, WNOHANG) == $pid) if(pcntl_wait($status, WNOHANG) == $pid)
{ {
@@ -622,12 +624,12 @@ class task_period_cindexer extends task_abstract
$fdIN = fopen($nullfile, 'r'); $fdIN = fopen($nullfile, 'r');
$fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+"); $fdOUT = fopen($logdir . "/task_o_" . $this->get_task_id() . ".log", "a+");
$fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+"); $fdERR = fopen($logdir . "/task_e_" . $this->get_task_id() . ".log", "a+");
pcntl_exec($cmd, $args); pcntl_exec($cmd, $args);
sleep(2); sleep(2);
} }
return($this->return_value); 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) $sql = "UPDATE prop AS p1 INNER JOIN record USING(record_id)
SET " . $sqlset[0] . SET " . $sqlset[0] .
" WHERE " . $w; " WHERE " . $w;
$ret[] = array('sql'=>$sql, 'params'=>$params); $ret[] = array('sql'=>$sql, 'params'=>$params);
} }
@@ -882,7 +882,7 @@ class task_period_outofdate extends task_abstract
} }
public function facility() public function facility()
{ {
$ret = NULL; $ret = NULL;

View File

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

View File

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

View File

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

View File

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