mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merged latest changes in module Attachments (bug fix on install and cosmetic improvements)
SVN:1.2[1604]
This commit is contained in:
@@ -36,5 +36,6 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Attachment:Max_Go' => '(Maximale Datei-Größe: %1$s Go)',
|
||||
'Attachment:Max_Mo' => '(Maximale Datei-Größe: %1$s Mo)',
|
||||
'Attachment:Max_Ko' => '(Maximale Datei-Größe: %1$s Ko)',
|
||||
'Attachments:NoAttachment' => 'Kein Attachment.',
|
||||
));
|
||||
?>
|
||||
|
||||
@@ -35,5 +35,6 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Attachment:Max_Go' => '(Maximum file size: %1$s Go)',
|
||||
'Attachment:Max_Mo' => '(Maximum file size: %1$s Mo)',
|
||||
'Attachment:Max_Ko' => '(Maximum file size: %1$s Ko)',
|
||||
'Attachments:NoAttachment' => 'No attachment. ',
|
||||
));
|
||||
?>
|
||||
|
||||
@@ -35,5 +35,6 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Attachment:Max_Go' => '(Taille de fichier max.: %1$s Gb)',
|
||||
'Attachment:Max_Mo' => '(Taille de fichier max.: %1$s Mb)',
|
||||
'Attachment:Max_Ko' => '(Taille de fichier max.: %1$s Kb)',
|
||||
'Attachments:NoAttachment' => 'Aucune pièce jointe.',
|
||||
));
|
||||
?>
|
||||
@@ -394,7 +394,7 @@ EOF
|
||||
function ajaxFileUpload()
|
||||
{
|
||||
//starting setting some animation when the ajax starts and completes
|
||||
$("#loading").ajaxStart(function(){
|
||||
$("#attachment_loading").ajaxStart(function(){
|
||||
$(this).show();
|
||||
}).ajaxComplete(function(){
|
||||
$(this).hide();
|
||||
@@ -462,9 +462,9 @@ EOF
|
||||
$oPage->add('</span>');
|
||||
$oPage->add('<div style="clear:both"></div>');
|
||||
$sMaxUpload = $this->GetMaxUpload();
|
||||
$oPage->p(Dict::S('Attachments:AddAttachment').'<input type="file" name="file" id="file" onChange="ajaxFileUpload();"><span style="display:none;" id="loading"> <img src="../images/indicator.gif"></span> '.$sMaxUpload);
|
||||
$oPage->p(Dict::S('Attachments:AddAttachment').'<input type="file" name="file" id="file" onChange="ajaxFileUpload();"><span style="display:none;" id="attachment_loading"> <img src="../images/indicator.gif"></span> '.$sMaxUpload);
|
||||
//$oPage->p('<input type="button" onClick="ajaxFileUpload();" value=" Upload !">');
|
||||
$oPage->p('<span style="display:none;" id="loading">Loading, please wait...</span>');
|
||||
$oPage->p('<span style="display:none;" id="attachment_loading">Loading, please wait...</span>');
|
||||
$oPage->add('</fieldset>');
|
||||
if ($this->m_bDeleteEnabled)
|
||||
{
|
||||
@@ -474,14 +474,21 @@ EOF
|
||||
else
|
||||
{
|
||||
$oPage->add('<span id="attachments">');
|
||||
while ($oAttachment = $oSet->Fetch())
|
||||
if ($oSet->Count() == 0)
|
||||
{
|
||||
$iAttId = $oAttachment->GetKey();
|
||||
$oDoc = $oAttachment->Get('contents');
|
||||
$sFileName = $oDoc->GetFileName();
|
||||
$sIcon = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($sFileName);
|
||||
$sDownloadLink = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php/?operation=download_document&class=Attachment&id='.$iAttId.'&field=contents';
|
||||
$oPage->add('<div class="attachment" id="attachment_'.$iAttId.'"><a href="'.$sDownloadLink.'"><img src="'.$sIcon.'"><br/>'.$sFileName.'</a><input type="hidden" name="attachments[]" value="'.$iAttId.'"/><br/> </div>');
|
||||
$oPage->add(Dict::S('Attachments:NoAttachment'));
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($oAttachment = $oSet->Fetch())
|
||||
{
|
||||
$iAttId = $oAttachment->GetKey();
|
||||
$oDoc = $oAttachment->Get('contents');
|
||||
$sFileName = $oDoc->GetFileName();
|
||||
$sIcon = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($sFileName);
|
||||
$sDownloadLink = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php/?operation=download_document&class=Attachment&id='.$iAttId.'&field=contents';
|
||||
$oPage->add('<div class="attachment" id="attachment_'.$iAttId.'"><a href="'.$sDownloadLink.'"><img src="'.$sIcon.'"><br/>'.$sFileName.'</a><input type="hidden" name="attachments[]" value="'.$iAttId.'"/><br/> </div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +99,12 @@ class AttachmentInstaller extends ModuleInstallerAPI
|
||||
//
|
||||
// Prerequisite: change null into 0 (workaround to the fact that we cannot use IS NULL in OQL)
|
||||
SetupWebPage::log_info("Initializing attachment/item_org_id - null to zero");
|
||||
$sRepair = "UPDATE `Attachment` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL";
|
||||
$sTableName = MetaModel::DBGetTable('Attachment');
|
||||
$sRepair = "UPDATE `$sTableName` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL";
|
||||
CMDBSource::Query($sRepair);
|
||||
|
||||
SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container");
|
||||
$oSearch = DBObjectSearch::FromOQL('SELECT Attachment WHERE item_org_id = 0');
|
||||
SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container");
|
||||
$oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_org_id = 0");
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
$iUpdated = 0;
|
||||
while ($oAttachment = $oSet->Fetch())
|
||||
|
||||
Reference in New Issue
Block a user