Changeset 3415


Ignore:
Timestamp:
10/26/10 15:40:00 (10 years ago)
Author:
amuller
Message:

Ticket #1391 - Implementando notificação do FM

Location:
branches/2.2/filemanager
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/upload.php

    r3019 r3415  
    1818$upload_max_size = $current_config['filemanager_Max_file_size']; 
    1919$path = $_POST['path']; 
     20$notifUser = $_POST['notifTo']; 
    2021$show_upload_boxes = count($_FILES['upload_file']['name'])-1; 
    2122 
     
    183184                } 
    184185        } 
     186 
     187if(count($notifUser) > 0) 
     188{ 
     189        define('PHPGW_INCLUDE_ROOT','../../'); 
     190        define('PHPGW_API_INC','../../phpgwapi/inc'); 
     191        include_once(PHPGW_API_INC.'/class.phpmailer.inc.php'); 
     192        $mail = new PHPMailer(); 
     193        $mail->IsSMTP(); 
     194        $boemailadmin = CreateObject('emailadmin.bo'); 
     195        $emailadmin_profile = $boemailadmin->getProfileList(); 
     196        $emailadmin = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); 
     197        $mail->Host = $emailadmin['smtpServer']; 
     198        $mail->Port = $emailadmin['smtpPort']; 
     199        $mail->From = $GLOBALS['phpgw']->preferences->values['email']; 
     200        $mail->FromName = $GLOBALS['phpgw_info']['user']['fullname']; 
     201        $mail->IsHTML(true); 
     202        foreach ($notifUser as $userMail) 
     203        { 
     204                $mail->AddAddress($userMail); 
     205                $mail->Subject = lang("Filemanager notification"); 
     206                $mail->Body = lang("The user %1, sent the file \"%2\" (type %3) and asked to notify you.",$GLOBALS['phpgw_info']['user']['fullname'],$_FILES['upload_file']['name'][0],$_FILES['upload_file']['type'][0])."<br>"; 
     207                $mail->Body .= lang("Comments by user: %1",$_POST['upload_comment'][0])."<br>"; 
     208                $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("index.php").">link</a><br>"); 
     209//              $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("../index.php","menuaction=filemanager.uifilemanager.view&file=" . urlencode(base64_encode($_FILES['upload_file']['name'][0]))."&path=".urlencode(base64_encode($path)))."\">link</a><br>"); 
     210                if(!$mail->Send()) { 
     211                        $return[] = $mail->ErrorInfo; 
     212                } 
     213        } 
     214} 
     215 
    185216if (count($return) > 0){ 
    186217                $_SESSION['response'] = serialize($return); 
  • branches/2.2/filemanager/js/common_functions.js

    r3408 r3415  
    307307} 
    308308 
     309function sendNotification(){ 
     310        var winEl = document.getElementById('uploadOption').parentNode; 
     311        var emailTo = document.createElement("INPUT"); 
     312        emailTo.name="notifTo[]"; 
     313        emailTo.type="text"; 
     314        emailTo.size="38"; 
     315        var labelTo = document.createElement("SPAN"); 
     316        labelTo.innerHTML = get_lang("Send Notification email to:"); 
     317        winEl.insertBefore(labelTo,document.getElementById('uploadOption')); 
     318        winEl.insertBefore(emailTo,document.getElementById('uploadOption')); 
     319} 
     320 
    309321function sendFiles(){ 
    310322                cExecuteForm_(document.getElementById('form_up'),handler.upload); 
  • branches/2.2/filemanager/setup/phpgw_pt-br.lang

    r3386 r3415  
    179179who     filemanager     pt-br   Quem 
    180180you do not have access to %1    filemanager     pt-br   Você não tem acesso a %1 
    181 your home dir did not exist, created a new one. filemanager     pt-br   Seu Diretório Home não existia, foi criado um novo. 
     181Your Home Dir did not exist, eGroupWare created a new one.      filemanager     pt-br   Seu Diretório Home não existia, foi criado um novo. 
     182Filemanager notification        filemanager     pt-br   Gerenciador de arquivos notifica 
     183The user %1, sent the file "%2" (type %3) and asked to notify you.      filemanager     pt-br   O usu&aacute;rio %1, enviou o arquivo "%2" (tipo %3) e solicitou o notificar. 
     184Comments by user: %1    filemanager     pt-br   Coment&aacute;rios do usu&aacute;rio: %1 
     185The file can be accessed by: %1 filemanager     pt-br   O arquivo pode ser acessado pelo endere&ccedil;o: %1 
     186Send Notification email to:     filemanager     pt-br   Enviar email de notifica&ccedil;&atilde;o a: 
  • branches/2.2/filemanager/templates/default/upload.tpl

    r3367 r3415  
    77                <td><strong>{lang_file}</strong></td> 
    88                <td><strong>{lang_comment}</strong></td> 
     9                <td></td> 
    910        </tr> 
    1011<!-- END upload_header --> 
     
    1415        <td><input onchange="javascript:addNewInput();" maxlength="255" name="upload_file[]" type="file"></td> 
    1516        <td><input name="upload_comment[]" type="text"></td> 
     17        <td><img src="filemanager/images/mail.png" alt="Send email" title="Send email" onclick="sendNotification();"></td> 
    1618        </tr> 
    1719<!-- END row --> 
Note: See TracChangeset for help on using the changeset viewer.