11
tomodea
How to Handle Office 2007 File Attachments?
  • 2010/3/11 22:21

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I’ve been trying to work out the modifications needed to handle Office 2007 file attachments: docx, xlsx and pptx.

I’ve been working on modifications to a number of modules, testing with a docx file sent to me by someone who is using Word 2007. I have Office 2002.

In summary, I have found that some modified modules:
1. Can handle docx files correctly: xmail, news and liaise
2. Allow you to attach a docx file but you cannot open the file: xhelp and extcal
3. Do not allow you to attach a docx file: smartsection

mimetypes
According to Microsoft (http://technet.microsoft.com/en-us/library/ee309278.aspx) these are the mimetypes:
.docx - application/vnd.openxmlformats-officedocument.wordprocessingml.document
.xlsx - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.pptx - application/vnd.openxmlformats-officedocument.presentationml.presentation


xmail module
Modify include/mimetype.php.

Look for this statement:
"doc" => "application/msword",


Add these statements:
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
         
"ppt" => "application/mspowerpoint",
         
"pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
         
"xls" => "application/msexcel",
         
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",


You then go into xmail admin and select the required filetypes from the list of Allowed Mimetypes.

This modification allows you to attach a docx file and send the email. Once the email has been received, the user can open the docx file. If the user has a version of Office which is earlier than 2007, then the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 file formats will be required to open the file. The important point is that this modification to xmail will do the trick.


news module
You can update the list of mimetypes in news admin by adding to the list under the heading: Enter authorized Mime Types for upload
application/msword
application
/vnd.openxmlformats-officedocument.wordprocessingml.document
application
/vnd.ms-excel
application
/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application
/vnd.ms-powerpoint
application
/vnd.openxmlformats-officedocument.presentationml.presentation


You can then attach a docx file to a news item. When you open the attached file, the file is converted by the Compatibility Pack and you can work with the file without any problems.


liaise module
The list of allowable file extensions is defined when you use a form element called File upload. In the list of Allowed filename extensions I entered this list:
doc|xls|ppt|docx|xlsx|pptx|pdf


You can then attach a docx file and submit the form. Once the email has been received, the user can open the docx file without any problems.


xhelp module

You can easily add new mimetypes by going into xhelp admin and updating the list of mimetypes. For example:
File Extension – docx
Application Type/Name - Word Document
Mimetypes - application/vnd.openxmlformats-officedocument.wordprocessingml.document

You can then attach a docx file. However, when you try to open the file, you get an error message:
This is a pre-release version of the Compatibility Pack and can open pre-release Office 2007 files only. Do you want to check for a newer version of the Compatibility Pack?

I have the latest version of the Compatibility Pack installed so this message suggests that there is something wrong with the mimetype.


extcal module
Modify the XOOPS file include/mimetypes.inc.php.

Look for:
"doc"        => "application/msword",


Add:
"docx"     => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",


Look for:
"xls"        => "application/vnd.ms-excel",


Add:
"xlsx"     => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",


Look for:
"ppt"        => "application/vnd.ms-powerpoint",


Add:
"pptx"     => "application/vnd.openxmlformats-officedocument.presentationml.presentation",


You then have to update the extcal module for the changes to be applied.

You can then attach a docx file to a calendar item. However, when you try to open the file, you get an error message:
This is a pre-release version of the Compatibility Pack and can open pre-release Office 2007 files only. Do you want to check for a newer version of the Compatibility Pack?

I have the latest version of the Compatibility Pack installed so this message suggests that there is something wrong with the mimetype.


smartsection module
You can easily add new mimetypes by going into smartsection admin and updating the list of mimetypes. For example:
File Extension – docx
Application Type/Name - Word Document
Mimetypes - application/vnd.openxmlformats-officedocument.wordprocessingml.document

When you try to attach a docx file to a smartsection item, you get an error message that says:
An error occured while uploading the File. mimetype must be shorter than 64 characters.


Questions
1. What needs to be done to get smartsection to accept a docx file as a file attachment?
2. What needs to be done to get xhelp to work correctly?
3. What needs to be done to get extcal to work correctly?



12
tomodea
Re: Modifying xmail module to allow latest MS Office filetypes as attachments
  • 2010/3/11 20:47

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Although the statements shown above will work, the proper mimetypes can be found here:http://technet.microsoft.com/en-us/library/ee309278.aspx

The modified statements should therefore be:
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
          
"ppt" => "application/mspowerpoint",
          
"pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
          
"xls" => "application/msexcel",
          
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",



13
tomodea
Re: mxdirectory error in uploading logo
  • 2010/3/11 11:48

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I discovered another error in mxdirectory image uploading.

The error message "Only png, gif, or jpg !!!" should only appear if you are trying to upload an image which is not a proper image file (png, gif or jpg). We were trying to upload a jpg file so it should be accepted. The mxdirectory module tests for image/gif, image/png or image/jpeg. This is fine under Firefox but not if you are using Internet Explorer.

If you are using Internet Explorer and you try to upload a jpg file then the file is treated as a pjpeg file and we need to test for this file type as well as the other possible file types.

The solution is to update these files:
modlink.php
submit.php
admin/index.php

Look for this statement:
if (($_FILES['logoup']['type']=="image/gif") || ($_FILES['logoup']['type']=="image/png") || ($_FILES['logoup']['type']=="image/jpeg")) {


Change it to:
if (($_FILES['logoup']['type']=="image/gif") || ($_FILES['logoup']['type']=="image/png") || ($_FILES['logoup']['type']=="image/jpeg") || ($_FILES['logoup']['type']=="image/pjpeg")) {




14
tomodea
Modifying xmail module to allow latest MS Office filetypes as attachments
  • 2010/3/6 4:57

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I discovered that xmail does not allow attachments of the new MS Office filetypes: docx, etc.

The modification appears to be a simple one. I modified the include file called mimetype.php.

Look for this statement:
"doc" => "application/msword",


Add these statements:
"docx" => "application/mswordx",
          
"ppt" => "application/mspowerpoint",
          
"pptx" => "application/mspowerpointx",
          
"xls" => "application/msexcel",
          
"xlsx" => "application/msexcelx",


I hope this helps.



15
tomodea
Re: mxdirectory error in uploading logo
  • 2010/3/6 2:15

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I also struck this problem and I'm happy to share my solution.

My analysis shows that there is a logic error in one of the PHP script files.

The PHP script used to submit a new listing is called submit.php. The logic includes a test to check that the maximum file size is not exceeded. The PHP script to handle updates is called modlink.php. This also includes a test to check that the maximum file size is not exceeded. However, it was testing against the maximum image width instead of the maximum file size. Since the maximum image width in my case is set to 300, this will produce an error every time.

Here is the line of code in submit.php:
$modlinkform->addElement(new XoopsFormFile(_MD_LOGOUP 'logoup'$xoopsModuleConfig['logo_maxfilesize']));


Here is the line of code that was in modlink.php:
$modlinkform->addElement(new XoopsFormFile(_MD_LOGOUP'logoup',$xoopsModuleConfig['logo_maximgwidth']));


The solution is to simply change logo_maximgwidth to logo_maxfilesize.



16
tomodea
Re: extgallery - Problem getting link to a new photo in the notification message
  • 2009/5/27 3:15

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:

DarinAllan wrote:
There is a "Last photo" block which you could display in extgallery, but apart from that fairly obvious thing to do, maybe the code used to create that block may help achieve what you want.

From the file extgallery/blocks/extgallery_blocks.php

The code for that particular block is below I think, I am just guessing ;o)

function extgalleryLastShow($options) {
    
    
$photoHandler xoops_getmodulehandler('publicphoto''extgallery');
    
    
$param = array('limit'=>$options[0]);
    
$direction $options[1];
    
$desc $options[2];
    
    
array_shift($options);
    
array_shift($options);
    
array_shift($options);
    
    
$categories = array();
    foreach(
$options as $cat) {
        if(
$cat == 0) {
            
$categories = array();
            break;
        }
        
$categories[] = $cat;
    }
    
$param['cat'] = $categories;
    
    
$photos $photoHandler->objectToArray($photoHandler->getLastPhoto($param));
    
    if(
count($photos) == 0) {
        return array();
    }
    
    
$ret =     array(
                
'photos'=>$photos
                
'direction'=>$direction
                
'desc'=>$desc
            
);
    return 
$ret;
}


Would anything in the above help?


Thanks for the suggestion.

I'll work on this and let you know.
Regards, Tom O'Dea
Melbourne, Australia



17
tomodea
extgallery - Problem getting link to a new photo in the notification message
  • 2009/5/22 3:37

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I have been using extgallery for some time and I'm very happy with it.

However, when a new photo is uploaded the notification message has a link to the Category/Album not the photo. This means that the user can click on the link then scroll through the photos within the Category/Album and try and figure out which photo is the new one.

It would be better to change the notification message so that it has a link to the photo instead of the Category/Album.

Please see my post at zoullou.net for details:
http://www.zoullou.net/modules/newbb/viewtopic.php?forum=2&post_id=2583#forumpost2583
Regards, Tom O'Dea
Melbourne, Australia



18
tomodea
Re: Comments Manager – Immediate logout and “Sorry, you don't have the permission to access this are
  • 2009/1/3 6:35

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:

dbman wrote:
just skimmed the post you mention. It looks like poster is overriding the main php.ini directives (register_globals, session.use_trans_sid) turning them to off and 0 respectively. This makes sense from a security prospective. If your host has these directives enabled I would follow the advice in the post.


I've just received a response from my host re how to set the php.ini path in .htaccess.

"Our configuration does not allow you to set this in your .htaccess file."

I'll just have to remember to continue to add it whenever I have a dir with php code in it.
Regards, Tom O'Dea
Melbourne, Australia



19
tomodea
Re: Comments Manager – Immediate logout and “Sorry, you don't have the permission to access this are
  • 2009/1/3 5:35

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


dbman,

I read about the need to have multiple copies of php.ini in the XOOPS forums.

This advice is very clear in this post: xoops forum post re php.ini
Quote:
I believe the php.ini replacement has to be copied in every entry page directory. For XOOPS this would mean every directory with php files (other than class or include, because these can normally not be called directly), such as the root, modules, admin and blocks.


I will check with the host about how to add it to my path using a .htaccess file.
Regards, Tom O'Dea
Melbourne, Australia



20
tomodea
Re: Comments Manager – Immediate logout and “Sorry, you don't have the permission to access this are
  • 2009/1/3 3:30

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


dbman,

I got the web host technical support guys to check the modsec_audit.log. They found something but after a number of interactions we finally discovered that I needed a php.ini file in the comments folder within the admin folder.

I had copied my php.ini fle into my XOOPS root directory and all of my second level and third level folders but I had overlooked the fourth level folders. Once I had copied my php.ini into these folders the problem was resolved. I'm not sure what parameter was needed but I suspect it could have been register_globals = off.
Regards, Tom O'Dea
Melbourne, Australia




TopTop
« 1 (2) 3 4 5 »



Login

Who's Online

272 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 272


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits