fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17402] controller, procedure, documents


From: sigurdne
Subject: [Fmsystem-commits] [17402] controller, procedure, documents
Date: Wed, 6 Dec 2017 09:49:01 -0500 (EST)

Revision: 17402
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17402
Author:   sigurdne
Date:     2017-12-06 09:49:01 -0500 (Wed, 06 Dec 2017)
Log Message:
-----------
controller, procedure, documents

Modified Paths:
--------------
    trunk/controller/inc/class.uidocument.inc.php
    trunk/controller/inc/class.uiprocedure.inc.php

Modified: trunk/controller/inc/class.uidocument.inc.php
===================================================================
--- trunk/controller/inc/class.uidocument.inc.php       2017-12-06 11:52:48 UTC 
(rev 17401)
+++ trunk/controller/inc/class.uidocument.inc.php       2017-12-06 14:49:01 UTC 
(rev 17402)
@@ -250,7 +250,9 @@
                                //Create a document object
                                $document = new controller_document();
                                
$document->set_title(phpgw::get_var('document_title'));
-                               
$document->set_name($_FILES["file_path"]["name"]);
+
+                               $file_name = @str_replace(' ', '_', 
$_FILES['file_path']['name']);
+                               $document->set_name($file_name);
                                
$document->set_type_id(phpgw::get_var('document_type'));
                                $desc = phpgw::get_var('document_description', 
'html');
                                $desc = str_replace(" ", " ", $desc);
@@ -263,7 +265,7 @@
                                // Move file from temporary storage to vfs
                                $result = $this->so->write_document_to_vfs
                                        (
-                                       $document_properties['document_type'], 
$_FILES["file_path"]["tmp_name"], $document_properties['id'], 
$_FILES["file_path"]["name"]
+                                       $document_properties['document_type'], 
$_FILES["file_path"]["tmp_name"], $document_properties['id'], $file_name
                                );
 
                                if ($result)
@@ -279,6 +281,7 @@
                                        }
                                        else
                                        {
+                                               
phpgwapi_cache::message_set('feil ved opplasting', 'error');
                                                // Handle failure on storing 
document
                                                $this->redirect($document, 
$document_properties, '', '');
                                        }
@@ -285,7 +288,8 @@
                                }
                                else
                                {
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uidocument.show',
+                                       phpgwapi_cache::message_set('feil ved 
opplasting', 'error');
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uidocument.show',
                                                        'procedure_id' => 
$procedure->get_id(),
                                                        'tab' => 'documents'));
                                        //Handle vfs failure to store document
@@ -306,8 +310,11 @@
                        $document = $this->so->get_single($document_id);
                        $document_properties = 
$this->get_type_and_id($document);
 
+                       $mime_magic = createObject('phpgwapi.mime_magic');
+                       $mime = 
$mime_magic->filename2mime($document->get_name());
+
                        header("Content-Disposition: attachment; 
filename={$document->get_name()}");
-                       header("Content-Type: $file_type");
+                       header("Content-Type: {$mime}");
                        header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
 
                        echo $this->so->read_document_from_vfs

Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php      2017-12-06 11:52:48 UTC 
(rev 17401)
+++ trunk/controller/inc/class.uiprocedure.inc.php      2017-12-06 14:49:01 UTC 
(rev 17402)
@@ -124,18 +124,19 @@
                                        'new_item' => 
self::link(array('menuaction' => 'controller.uiprocedure.add')),
                                        'allrows' => true,
                                        'field' => array(
+//                                             array(
+//                                                     'key' => 'id',
+//                                                     'label' => lang('ID'),
+//                                                     'sortable' => true,
+//                                                     'formatter' => 
'JqueryPortico.formatLink'
+//                                             ),
                                                array(
-                                                       'key' => 'id',
-                                                       'label' => lang('ID'),
+                                                       'key' => 'title',
+                                                       'label' => 
lang('Procedure title'),
                                                        'sortable' => true,
                                                        'formatter' => 
'JqueryPortico.formatLink'
                                                ),
                                                array(
-                                                       'key' => 'title',
-                                                       'label' => 
lang('Procedure title'),
-                                                       'sortable' => true
-                                               ),
-                                               array(
                                                        'key' => 'purpose',
                                                        'label' => 
lang('Procedure purpose'),
                                                        'sortable' => false
@@ -156,6 +157,16 @@
                                                        'sortable' => true
                                                ),
                                                array(
+                                                       'key' => 
'modified_by_name',
+                                                       'label' => 
lang('modified by'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 
'modified_date',
+                                                       'label' => 
lang('Modified date'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -359,6 +370,16 @@
                                                $this->so->transaction_begin();
                                                if ($proc_id = 
$this->so->add($new_procedure)) //add the revised prosedure as new
                                                {
+                                                       $sodocuments = 
createObject('controller.sodocument');
+                                                       $documents = 
$sodocuments->get(0, 0, '', false, '', '', array('procedure_id' => 
$procedure_id));
+                                                       foreach ($documents as 
$document)
+                                                       {
+                                                               
$document->set_id(0);//new
+                                                               
$document->set_type_id(1);
+                                                               
$document->set_procedure_id($proc_id);
+                                                               
$sodocuments->store($document);
+                                                       }
+
                                                        $old_end_date = 
$start_date ? $start_date : time();
                                                        
$old_procedure->set_end_date($old_end_date);
                                                        
$old_procedure->set_revision_date($revision_date);
@@ -819,6 +840,15 @@
                                }
                        }
 
+                       foreach ($rows as &$row)
+                       {
+                               if(!empty($row['modified_by']))
+                               {
+                                       $row['modified_by_name'] = 
$GLOBALS['phpgw']->accounts->id2name($row['modified_by']);
+                               }
+                               $row['modified_date'] = 
$GLOBALS['phpgw']->common->show_date($row['modified_date'],$this->dateformat);
+                       }
+
                        // ... add result data
                        $results = array('results' => $rows);
 
@@ -834,6 +864,7 @@
                                array_walk(
                                        $results['results'], array($this, 
'_add_links'), "controller.uiprocedure.view");
                        }
+
                        return $this->jquery_results($results);
                }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]