mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 05:23:21 +00:00
Merge with master
This commit is contained in:
@@ -200,6 +200,10 @@ class collection implements cache_cacheableInterface
|
|||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':pub_wm' => $publi, ':coll_id' => $this->get_coll_id()));
|
$stmt->execute(array(':pub_wm' => $publi, ':coll_id' => $this->get_coll_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->pub_wm = $publi;
|
||||||
|
|
||||||
|
$this->delete_data_from_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -220,6 +224,8 @@ class collection implements cache_cacheableInterface
|
|||||||
|
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
|
||||||
|
$this->delete_data_from_cache();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,6 +403,8 @@ class collection implements cache_cacheableInterface
|
|||||||
$stmt->execute(array(':prefs' => $this->prefs, ':coll_id' => $this->get_coll_id()));
|
$stmt->execute(array(':prefs' => $this->prefs, ':coll_id' => $this->get_coll_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->delete_data_from_cache();
|
||||||
|
|
||||||
return $this->prefs;
|
return $this->prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -137,7 +137,8 @@ class lazaretFile
|
|||||||
$pathfile = $registry->get('GV_RootPath') . 'tmp/lazaret/' . $this->filepath;
|
$pathfile = $registry->get('GV_RootPath') . 'tmp/lazaret/' . $this->filepath;
|
||||||
|
|
||||||
$record = new record_adapter($sbas_id, $record_id);
|
$record = new record_adapter($sbas_id, $record_id);
|
||||||
p4file::substitute($record, $pathfile, $this->filename, false);
|
$record->substitute_subdef('document', new system_file($pathfile));
|
||||||
|
|
||||||
$this->delete();
|
$this->delete();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -214,311 +214,4 @@ class p4file
|
|||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function substitute(record_Interface $record, $new_pathfile, $filename, $update_filename = false)
|
|
||||||
{
|
|
||||||
$appbox = appbox::get_instance();
|
|
||||||
$session = $appbox->get_session();
|
|
||||||
$registry = $appbox->get_registry();
|
|
||||||
|
|
||||||
$sbas_id = $record->get_sbas_id();
|
|
||||||
$record_id = $record->get_record_id();
|
|
||||||
$base_id = $record->get_base_id();
|
|
||||||
$connbas = connection::getPDOConnection($sbas_id);
|
|
||||||
|
|
||||||
|
|
||||||
$databox = databox::get_instance($sbas_id);
|
|
||||||
if ($baseprefs = $databox->get_sxml_structure())
|
|
||||||
{
|
|
||||||
$pathhd = p4string::addEndSlash((string) ($baseprefs->path));
|
|
||||||
$baseurl = (string) ($baseprefs->baseurl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new Exception(_('prod::erreur : impossible de lire les preferences de base'));
|
|
||||||
|
|
||||||
if (trim($pathhd) == "" || !is_dir($pathhd))
|
|
||||||
throw new Exception(_('prod::substitution::erreur : impossible d\'acceder au dossier de stockage "' . $pathhd . '" '));
|
|
||||||
|
|
||||||
$sd = $record->get_subdefs('document');
|
|
||||||
|
|
||||||
if (isset($sd) && isset($sd["document"]))
|
|
||||||
{
|
|
||||||
$sd["document"]["path"] = p4string::addEndSlash($sd["document"]["path"]);
|
|
||||||
|
|
||||||
$pathhd = p4string::addEndSlash($sd["document"]["path"]);
|
|
||||||
$filehd = $sd["document"]["file"];
|
|
||||||
|
|
||||||
$pathfile = $pathhd . $filehd;
|
|
||||||
|
|
||||||
if (file_exists($pathfile) && !is_dir($pathfile))
|
|
||||||
{
|
|
||||||
if (!@unlink($pathfile))
|
|
||||||
throw new Exception(_('prod::substitution::erreur : impossible de supprimer l\'ancien document'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ext = "";
|
|
||||||
$pitmp = pathinfo($filename);
|
|
||||||
if (isset($pitmp['extension']))
|
|
||||||
$ext = $pitmp['extension'];
|
|
||||||
$filehd = $record_id . "_document." . $ext;
|
|
||||||
$pathhd = databox::dispatch($pathhd);
|
|
||||||
|
|
||||||
$pathfile = $pathhd . $filehd;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM subdef WHERE record_id = :record_id AND name='document'";
|
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute(array(':record_id' => $record_id));
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$width = $height = 0;
|
|
||||||
|
|
||||||
if (!rename($new_pathfile, $pathfile))
|
|
||||||
throw new Exception(_('prod::substitution::document remplace avec succes'));
|
|
||||||
|
|
||||||
if ($tempHD = getimagesize($pathfile))
|
|
||||||
{
|
|
||||||
$width = $tempHD[0];
|
|
||||||
$height = $tempHD[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$system_file = new system_file($pathfile);
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "INSERT INTO subdef (record_id, name, path, file, baseurl, width, height, mime, size) VALUES
|
|
||||||
(:record_id, 'document', :pathhd, :file_hd , :baseurl, :width , :height , :mime, :filesize)";
|
|
||||||
|
|
||||||
$params = array(
|
|
||||||
':record_id' => $record_id
|
|
||||||
, ':pathhd' => $pathhd
|
|
||||||
, ':file_hd' => $filehd
|
|
||||||
, ':baseurl' => $baseurl
|
|
||||||
, ':width' => $width
|
|
||||||
, ':height' => $height
|
|
||||||
, ':mime' => $system_file->get_mime()
|
|
||||||
, ':filesize' => filesize($pathfile)
|
|
||||||
);
|
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute($params);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$session->get_logger($record->get_databox())
|
|
||||||
->log($record, Session_Logger::EVENT_SUBSTITUTE, 'HD', '');
|
|
||||||
|
|
||||||
$desc = $record->get_xml();
|
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
|
||||||
$doc->loadXML($desc);
|
|
||||||
$params = $doc->getElementsByTagName('doc');
|
|
||||||
$newname = null;
|
|
||||||
|
|
||||||
foreach ($params as $param)
|
|
||||||
{
|
|
||||||
$oldname = $param->getAttribute('originalname');
|
|
||||||
if ($oldname)
|
|
||||||
{
|
|
||||||
$oldpi = pathinfo($oldname);
|
|
||||||
$val = "";
|
|
||||||
$pi = pathinfo($filename);
|
|
||||||
if (isset($pi["extension"]))
|
|
||||||
$val = $pi["extension"];
|
|
||||||
|
|
||||||
if ($update_filename)
|
|
||||||
$newname = $pi['basename'];
|
|
||||||
else
|
|
||||||
$newname = $oldpi['filename'] . "." . $val;
|
|
||||||
}
|
|
||||||
if ($newname)
|
|
||||||
$param->setAttribute('originalname', $newname);
|
|
||||||
$param->removeAttribute('channels');
|
|
||||||
$param->removeAttribute('bits');
|
|
||||||
|
|
||||||
$param->setAttribute('height', $height);
|
|
||||||
$param->setAttribute('width', $width);
|
|
||||||
$param->setAttribute('size', filesize($pathfile));
|
|
||||||
$param->setAttribute('mime', $system_file->get_mime());
|
|
||||||
if (isset($tempHD["bits"]))
|
|
||||||
$param->setAttribute('bits', $tempHD["bits"]);
|
|
||||||
if (isset($tempHD["channels"]))
|
|
||||||
$param->setAttribute('channels', $tempHD["channels"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$xp_rec = new DOMXPath($doc);
|
|
||||||
$databox = databox::get_instance($sbas_id);
|
|
||||||
$sx_struct = $databox->get_sxml_structure();
|
|
||||||
foreach ($sx_struct->description->children() as $fn => $fv)
|
|
||||||
{
|
|
||||||
if (isset($fv["src"]) && (substr($fv["src"], 0, 2) == "tf"))
|
|
||||||
{
|
|
||||||
switch ($fv["src"])
|
|
||||||
{
|
|
||||||
case "tf-chgdocdate":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = date('Y/m/d H:i:s', time());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = date('Y/m/d H:i:s', time());
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-filename":
|
|
||||||
if ($newname && ($recdesc = $xp_rec->query("/record/description/$fn")))
|
|
||||||
{
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $newname;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $newname;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-extension":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
$val = "";
|
|
||||||
$pi = pathinfo($filename);
|
|
||||||
if (isset($pi["extension"]))
|
|
||||||
$val = $pi["extension"];
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $val;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $val;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-mimetype":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
$val = $system_file->get_mime();
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $val;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $val;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-size":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = filesize($pathfile);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = filesize($pathfile);
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-width":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $width;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $width;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-height":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $height;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $height;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-bits":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
$val = "";
|
|
||||||
if (isset($tempHD["bits"]))
|
|
||||||
$val = $tempHD["bits"];
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $val;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $val;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tf-channels":
|
|
||||||
if ($recdesc = $xp_rec->query("/record/description/$fn"))
|
|
||||||
{
|
|
||||||
$val = "";
|
|
||||||
if (isset($tempHD["channels"]))
|
|
||||||
$val = $tempHD["channels"];
|
|
||||||
if ($recdesc->item(0))
|
|
||||||
$recdesc->item(0)->nodeValue = $val;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$recdesc = $xp_rec->query("/record/description")->item(0);
|
|
||||||
$node = $doc->createElement($fn);
|
|
||||||
$node->nodeValue = $val;
|
|
||||||
$newnode = $recdesc->appendChild($node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$newXml = $doc->savexml();
|
|
||||||
|
|
||||||
$record->set_xml($newXml);
|
|
||||||
|
|
||||||
$sql = "UPDATE record SET status=status & ~3, moddate=NOW()
|
|
||||||
WHERE record_id = :record_id";
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute(array(':record_id' => $record_id));
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$record->write_metas();
|
|
||||||
$filesToSet = null;
|
|
||||||
$filesToSet[] = $pathfile;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -825,6 +825,43 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
return $this->original_name;
|
return $this->original_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function set_original_name($original_name)
|
||||||
|
{
|
||||||
|
$this->original_name = $original_name;
|
||||||
|
|
||||||
|
foreach ($this->get_caption()->get_fields() as $field)
|
||||||
|
{
|
||||||
|
if ($field->get_databox_field()->get_source() != metadata_description_PHRASEANET_tffilename::get_source())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set_metadatas(
|
||||||
|
array(
|
||||||
|
'meta_struct_id' => $field->get_meta_struct_id()
|
||||||
|
, 'meta_id' => get_meta_id
|
||||||
|
, 'value' => array($original_name)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE record
|
||||||
|
SET originalname = :originalname WHERE record_id = :record_id';
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
':originalname' => $original_name
|
||||||
|
, ':record_id' => $this->get_record_id()
|
||||||
|
);
|
||||||
|
|
||||||
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute($params);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->delete_data_from_cache();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -1028,8 +1065,26 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
. '.' . $pathfile->get_extension();
|
. '.' . $pathfile->get_extension();
|
||||||
|
|
||||||
$base_url = '';
|
$base_url = '';
|
||||||
|
|
||||||
$original_file = $subdef_def = false;
|
$original_file = $subdef_def = false;
|
||||||
|
|
||||||
|
if ($name == 'document')
|
||||||
|
{
|
||||||
|
$baseprefs = $this->get_databox()->get_sxml_structure();
|
||||||
|
|
||||||
|
$pathhd = p4string::addEndSlash((string) ($baseprefs->path));
|
||||||
|
|
||||||
|
$filehd = $this->get_record_id() . "_document." . $pathfile->get_extension(true);
|
||||||
|
$pathhd = databox::dispatch($pathhd);
|
||||||
|
|
||||||
|
copy($pathfile->getPathname(), $pathhd . $filehd);
|
||||||
|
|
||||||
|
$system_file = new system_file($pathhd . $filehd);
|
||||||
|
|
||||||
|
$meta_writable = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$subdefs = $this->get_databox()->get_subdef_structure();
|
$subdefs = $this->get_databox()->get_subdef_structure();
|
||||||
|
|
||||||
foreach ($subdefs as $type => $datas)
|
foreach ($subdefs as $type => $datas)
|
||||||
@@ -1077,6 +1132,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$registry = registry::get_instance();
|
||||||
|
|
||||||
|
$adapter = new binaryAdapter_image_resize($registry);
|
||||||
|
$adapter->execute($pathfile, $path_file_dest, $subdef_def->get_options());
|
||||||
|
|
||||||
|
$system_file = new system_file($path_file_dest);
|
||||||
|
$system_file->chmod();
|
||||||
|
|
||||||
|
$meta_writable = $subdef_def->meta_writeable();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
@@ -1090,14 +1156,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$registry = registry::get_instance();
|
|
||||||
|
|
||||||
$adapter = new binaryAdapter_image_resize($registry);
|
|
||||||
$adapter->execute($pathfile, $path_file_dest, $subdef_def->get_options());
|
|
||||||
|
|
||||||
$system_file = new system_file($path_file_dest);
|
|
||||||
$system_file->chmod();
|
|
||||||
|
|
||||||
$image_size = $system_file->get_technical_datas();
|
$image_size = $system_file->get_technical_datas();
|
||||||
|
|
||||||
$sql = 'INSERT INTO subdef
|
$sql = 'INSERT INTO subdef
|
||||||
@@ -1107,6 +1165,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
(:record_id, :name, :baseurl, :filename,
|
(:record_id, :name, :baseurl, :filename,
|
||||||
:width, :height, :mime, :path, :filesize, "1")';
|
:width, :height, :mime, :path, :filesize, "1")';
|
||||||
|
|
||||||
|
echo "substitute subdef $name with $base_url ".$system_file->getPath()." ".$system_file->getFilename()."<br>";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
|
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
@@ -1129,7 +1188,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
|
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
|
||||||
|
|
||||||
|
|
||||||
if ($subdef_def->meta_writeable())
|
if ($meta_writable)
|
||||||
{
|
{
|
||||||
$this->write_metas();
|
$this->write_metas();
|
||||||
}
|
}
|
||||||
@@ -1137,12 +1196,18 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$this->rebuild_subdefs();
|
$this->rebuild_subdefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$type = $name == 'document' ? 'HD' : $name;
|
||||||
|
|
||||||
|
$session->get_logger($record->get_databox())
|
||||||
|
->log($record, Session_Logger::EVENT_SUBSTITUTE, $type, '');
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
unset($e);
|
unset($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1163,6 +1228,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->reindex();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -381,11 +381,22 @@ class record_preview extends record_adapter
|
|||||||
|
|
||||||
if (!isset($tab[$hour][$site][$action][$row['usr_id']]))
|
if (!isset($tab[$hour][$site][$action][$row['usr_id']]))
|
||||||
{
|
{
|
||||||
|
$user = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$user = \User_Adapter::getInstance($row['usr_id'], $appbox);
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$tab[$hour][$site][$action][$row['usr_id']] =
|
$tab[$hour][$site][$action][$row['usr_id']] =
|
||||||
array(
|
array(
|
||||||
'final' => array()
|
'final' => array()
|
||||||
, 'comment' => array()
|
, 'comment' => array()
|
||||||
, 'user' => \User_Adapter::getInstance($row['usr_id'], $appbox)
|
, 'user' => $user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -434,6 +434,7 @@ class set_export extends set_abstract
|
|||||||
|
|
||||||
foreach ($this->elements as $download_element)
|
foreach ($this->elements as $download_element)
|
||||||
{
|
{
|
||||||
|
echo "eleme";
|
||||||
$id = count($files);
|
$id = count($files);
|
||||||
|
|
||||||
$files[$id] = array(
|
$files[$id] = array(
|
||||||
@@ -490,10 +491,6 @@ class set_export extends set_abstract
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isset($sd[$name]))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_time_limit(100);
|
set_time_limit(100);
|
||||||
$subdef_export = $subdef_alive = false;
|
$subdef_export = $subdef_alive = false;
|
||||||
@@ -689,7 +686,9 @@ class set_export extends set_abstract
|
|||||||
system_file::mkdir($caption_dir);
|
system_file::mkdir($caption_dir);
|
||||||
|
|
||||||
$desc = self::get_caption(
|
$desc = self::get_caption(
|
||||||
$download_element->get_base_id(), $download_element->get_record_id(), $session->get_ses_id()
|
$download_element->get_base_id()
|
||||||
|
, $download_element->get_record_id()
|
||||||
|
, $session->get_ses_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = $files[$id]["export_name"]
|
$file = $files[$id]["export_name"]
|
||||||
@@ -717,7 +716,11 @@ class set_export extends set_abstract
|
|||||||
|
|
||||||
|
|
||||||
$desc = self::get_caption(
|
$desc = self::get_caption(
|
||||||
$download_element->get_base_id(), $download_element->get_record_id(), $session->get_ses_id(), true, 'yaml'
|
$download_element->get_base_id()
|
||||||
|
, $download_element->get_record_id()
|
||||||
|
, $session->get_ses_id()
|
||||||
|
, true
|
||||||
|
, 'yaml'
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = $files[$id]["export_name"]
|
$file = $files[$id]["export_name"]
|
||||||
@@ -736,6 +739,7 @@ class set_export extends set_abstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->list = array(
|
$this->list = array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'names' => $file_names,
|
'names' => $file_names,
|
||||||
@@ -743,6 +747,7 @@ class set_export extends set_abstract
|
|||||||
'count' => $n_files
|
'count' => $n_files
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return $this->list;
|
return $this->list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,7 +767,6 @@ class set_export extends set_abstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isset($list['complete']) && $list['complete'] === true)
|
if (isset($list['complete']) && $list['complete'] === true)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -48,7 +48,10 @@ if (!isset($_FILES["newHD"]) || $_FILES["newHD"]["tmp_name"] == "" || $_FILES["n
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$record = new record_adapter($parm['sbas_id'], $parm['record_id']);
|
$record = new record_adapter($parm['sbas_id'], $parm['record_id']);
|
||||||
p4file::substitute($record, $_FILES["newHD"]["tmp_name"], $_FILES["newHD"]["name"], ($parm['ccfilename'] == '1'));
|
$record->substitute_subdef('document', new system_file($_FILES["newHD"]["tmp_name"]));
|
||||||
|
if($parm['ccfilename'] == '1')
|
||||||
|
{
|
||||||
|
$record->set_original_name($_FILES["newHD"]["name"]);
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
|
@@ -1836,27 +1836,27 @@ function preset_load(preset_id)
|
|||||||
{
|
{
|
||||||
if(p4.edit.T_fields[i].preset != null)
|
if(p4.edit.T_fields[i].preset != null)
|
||||||
{
|
{
|
||||||
|
if(!(""+i in p4.edit.T_records[r].fields))
|
||||||
|
{
|
||||||
|
p4.edit.T_records[r].fields[""+i] = {};
|
||||||
|
}
|
||||||
|
|
||||||
if(p4.edit.T_fields[i].multi)
|
if(p4.edit.T_fields[i].multi)
|
||||||
{
|
{
|
||||||
p4.edit.T_records[r].fields[""+i] = {
|
p4.edit.T_records[r].fields[""+i].value = [];
|
||||||
value:[],
|
p4.edit.T_records[r].fields[""+i].meta_struct_id = p4.edit.T_fields[i].meta_struct_id;
|
||||||
"meta_struct_id":p4.edit.T_fields[i].meta_struct_id,
|
p4.edit.T_records[r].fields[""+i].dirty = true;
|
||||||
dirty:true
|
|
||||||
};// = {
|
|
||||||
var n = 0;
|
|
||||||
for(val in p4.edit.T_fields[i].preset)
|
for(val in p4.edit.T_fields[i].preset)
|
||||||
{
|
{
|
||||||
p4.edit.T_records[r].fields[""+i].value[n] = p4.edit.T_fields[i].preset[val];
|
p4.edit.T_records[r].fields[""+i].push(p4.edit.T_fields[i].preset[val]);
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p4.edit.T_records[r].fields[""+i] = {
|
p4.edit.T_records[r].fields[""+i].value = p4.edit.T_fields[i].preset[0];
|
||||||
"value":p4.edit.T_fields[i].preset[0],
|
p4.edit.T_records[r].fields[""+i].meta_struct_id = p4.edit.T_fields[i].meta_struct_id;
|
||||||
"meta_struct_id":p4.edit.T_fields[i].meta_struct_id,
|
p4.edit.T_records[r].fields[""+i].dirty = true;
|
||||||
"dirty":true
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user