ImportOOI a tweak of Importppt ?

ImportOOI a tweak of Importppt ?

by Chris Collman -
Number of replies: 7
Picture of Documentation writers
Just a thought.  I would love to have a tweaked version of Importppt.php called ImportOOI.php.   

Essentially I want to insert a series of jpg images only into the content of a series of branch pages.   Frankly, I don't care what the page names are.  Page 1, 2, 3 works for me.   Just jpg images that come from a zipped folder.

The file names are img0.jpg, img1.jpg, img2.jpg, ...img10.jpg, img11.jpg etc.  This is the way OO Impress labels its web pages after an export.  So it would be nice if img10.jpg followed img9.jpg in the logical order.   However, if the price to pay is for me to move those pages or rename the files, so be it.  

I don't care about bullets, or extracting text or classes and all that stuff that causes programers to lose sleep at night when dealing with that higher priced program.   Yeah, these are going to be fixed images of my instructor's existing powerpoints.    I will add questions and do some navigational editing later.  

My instructors have fancy masterslides and do things that drives ImportPPT crazy, thus creating entirely too much editing for this lazy bald guy.   The boss says "I want all our existing content up on our Moodle yesterday".   The boss is happy when I methodically insert one jpg image after another into branch pages and does not like other Moodle options I have suggested.  

Is this a big project?   I got lost at the line with preg_match_all () smile

Average of ratings: -
In reply to Chris Collman

Re: ImportOOI a tweak of Importppt ?

by Mark Nielsen -
Hi Chris,

Compared to writing the original importppt.php, this should be an easy undertaking smile

Steps for completing this:
  1. Create a form for uploading the zip file
  2. Process the zip file, first create a temp directory to store the zipped file (dataroot/temp/lesson)
  3. Unzip the file
  4. Get the directory listing to process the images (perhaps check to make sure a file is indeed an image before processing it)
  5. Copy all images to dataroot/courseid/moddata/(subfolder?)
  6. Create a series of branch tables with an <img /> tag as its content linking to one of the uploaded images (this link should respect the $CFG->slasharguments setting)
You can find examples of doing all of this in the importppt.php file.  You should not need to use any preg functions because you are not processing the contents of any files.  With that said, you will not need a lot of the code in importppt.php.

Hope this helps you out, cheers,
Mark
In reply to Mark Nielsen

Re: ImportOOI a tweak of Importppt ?

by Chris Collman -
Picture of Documentation writers
Thank you Mark,
Looks like nobody else is interested in this idea, except as a philosophical concept.  I will move on.

Honestly,  I am so close to clueless about PHP that being called an idiot would be an overstatement.  I knew more about rural development at 20 than I do at 60 about PHP.  Laughing at myself.

I will just have to start inserting my  687 jpg Open Office generated images into as many branch pages, spread over 6 lessons.  Sigh.   Gotta keep the boss happy.

I do appreciate all your efforts.  I can see all the frustrations in the importppt // comments smile Chris
In reply to Chris Collman

ImportOOI.php ugly start but it works for my Localhost 1.6

by Chris Collman -
Picture of Documentation writers
I now have a documented hack I am calling Import00I_0.3.php  for 1.6 (might work in earlier versions).  I replaced the contents of importppt.php with my version.  It does not convert a slide to text, but rather inserts what amounts to a screen shot of each slide into a page.  Thus perserving background, page numbers, position of graphics but losing links and other special effects.   I have customized it further (see below).

Causual readers should note: Importppt can not deal with MS PowerPoint 2003 or higher.   Open Office Impress 2.0 (a useful open source program) will easily import any PowerPoint version.   My teachers do not use a lot of fancy features in PowerPoint, so I have not run into many conversion problems.

The process is similar to importppt.  Open Office Impress (OOI) exports a web document to a folder, a special file is added to the folder, and then the folder is zipped and imported into a new lesson using the existing "Import PowerPoint" button.   I have clearly documented my basic change to importppt 6/7/2006 and also my 2 customizations.

The only strange part is the special file.  Still laughing at myself, but it works.
I created a 173 line file called Outlinelong.txt which my hacked version of importOOI needs to read.  It contains an ordered list of files that creates lesson pages (it looks similar to the higher priced program's outline.htm file.  I delete the extra lines after I have copied it over to the folder I am going to zip. 

OOI creates the first html file with the presentation name.  While I am in the folder, I rename that file to img0.htm .  
 
I customized the lesson page so it only shows the continue button (lesson branch table default) to the student.

I customized the way it stored the image files.   I hate drilling down, so they are stored in a folders called "Image_LessonName" on the same level as the backup folder.  

Don't expect any support from me because I am literally  still discovering some basics in php, not mention programming in general.  I really hope a student who knows PHP will take this on as a project and do it right.   As Mark has said, should be very straightforward.    For example, I do not believe an outline file is really necessary, but since I don't understand arrays, it is the only way I can get things to work.

Now I can let it go.  smile
In reply to Chris Collman

Re: ImportOOI.php ugly start but it works for my Localhost 1.6

by Suresh K -
Hi..
I installed Moodle 1.8 version.Everything working fine.I want to add ooimpress slides to lesson.I used tweak of importppt.php means i replaced the contents with importOOI_0.3.php.
Its uploading slides without any error.But when I click preview nothing displaying.
When I click edit its showing my slides.
Students doesnt see anything how to fix this...
Please help me I dont have much idea about php..

I attached the zip file.This was i am getting when i export slides as a html pages


Thanks in advance..

regards
Suresh

In reply to Suresh K

Re: ImportOOI.php ugly start but it works for my Localhost 1.6

by Chris Collman -
Picture of Documentation writers
Suresh,
I think this issue is that my little tweak was designed for 1.6 and of course the Moodle Code has changed a great deal. Perhaps we can look forward to a an importing OO in 2.0 . Vote on this tracker item http://tracker.moodle.org/browse/MDL-5655

Thanks for the post. I will add this to my things to look at today in 1.8. I am not very quick. Do you know the story about 1000 monkeys? It is said that sooner or later a 1000 monkeys can type any book in the world by pure chance. That is me. But I will look at it when I get to work because we will be upgrading sometime in the next 4 months.

If this has value to others, please vote other wise it looks like just Suresh and I want to support OO and MS.

Best to all,

In reply to Suresh K

Re: ImportOOI.php ugly start but it works for my Localhost 1.8

by Chris Collman -
Picture of Documentation writers
Hi Suresh,
I think I can upload this file zip file. Sure wish someone would clean up my hack so no tweaking had to be done to the OO exported folder, etc.

Allora, here is a zip file with what worked for me in a clean version of Moodle 1.8. It has a php file that should be saved as mod\lesson\importppt.php and a slightly updated readme file.

I have prepared a TestImport zip file with 4 pages that should import. Plus, I have included a slightly revised instruction file.

And I included an outline201.txt file that is part of the tweak. My hack wants to see a file called outlineOO.txt. As I discovered (after hours), this file must be in UTF-8 format when saved in the exported folder.

There are two changes which are different. 1) I decided that ImportOO should store images in the same way as Importppt . So I reverted part of the code back. As an editing teacher you can find the images in the admin block under files then moddata, then lesson and folders called images_Lesson1 or what ever. 2) I was confused with all the uses of the word outline, so I am calling the index file outlineOO to keep things straight in my mind.

Hope this helps. I uploaded this zip in Moodle Tracker.

Chris


In reply to Mark Nielsen

Re: ImportOOI a tweak of Importppt ?

by Chris Collman -
Picture of Documentation writers
Awesome what a night with little sleep will do.  
I exported my OOI to a folder and  decided to look at the img1.htm, text1.htm, img1.jpg files just before I started doing my thing with the 687 jpgs (groan, at least 15 hours of mindless tasking).

There was a reference in the img1.htm (for example) which referenced the img1.jpg !   The old copy cat realized he made a wrong assumption days ago when he knew less.  I saw that $imgs variable with the preg_match_all and the "_slide" which is the way Bill likes to do things.   So I changed that to .jpg  whoa.

Here is the funny part.  First using in DOS the good old  dir /b img*.html > outline2.txt, I created a list of all files in my folder.  So I had a file with img1.htm, img2.htm etc.  Don't laugh, I edited the text file with search and replace, so I ended up with a bunch of lines that looked like
href="javascript:GoToSld('img1.html');"
To all you php programmers, that is the way to conquer an "preg_match_all"  in importppt !  I am rolling on the floor laughing here in New Hampshire.

Went back to importppt, change the file name to outline2.txt, went down a bit and change the $file from slide to img set the length to 3.   Inserted $file for the $title.   remarked out  everything that had to do with answer (forgot one of those pesky brackets) because I hate those buttons. 

Worked !    Well they are not sorted the way I want but moving in collapsed view is so much easier than inserting 687 images.  Yeah the slide title is off from the actual page number by 1 but who cares?  I think I can tweak that later.

Even better, it will only work for me.  I know you are jealous, no pesky users with their own weird systems    wink big grin   LOL

Thanks again, believe it or not, you were a help.   Now I can go back and tweak a few things at some later time.  Now I got to produce.

Chris