Subject: [LON-CAPA-dev] Suggestion of new author tool: upload of .ZIP files and unzip it in the current work directory in the Construction Space area

From: Ricardo Luis Kulzer <[email-masked]>
Date: Thu, 11 Sep 2003 22:58:34 -0300

Hello.  
    I'm a new user of LON-CAPA, and I don't know many thinks about its 
code, but I'm investigating it. now.  
    In our laboratory, we used another e-learning software called 
TELEDUC (http://teleduc.nied.unicamp.br/teleduc/), very good, but it 
doesn't bring all the advantages offered by the LON-CAPA.  
    However, an important feature that is missing in LON-CAPA, and it 
exists TELEDUC, is a tool that allows to do upload of several files 
compacted in one only .ZIP file, and allow to unzip the .ZIP file in the 
server later.   
    So, when developing a page using some HTML editor like Netscape 
Composer, we used compact the file .HTML and << many >> images files 
(.GIF, .JPG) in only one .ZIP file. Soon after, through the WEB 
interface of TELEDUC, we transfer (upload) the .ZIP file in to the 
TELEDUC server. Then, the WEB interface provides a new button that 
allows unzip that file in the server and to publish them as a new 
Content Page, with the .HTML and images files totally decompressed.
    I tried to do the same task in LON-CAPA, but it doesn't present this 
resource. So I needed to do upload of file by file, using the tool 
Construction Space, and that is a annoying task (upload file by file...).
    I know that I can use SSH file transfer or Samba, but It's difficult 
to teach all this thinks to a Geography teacher, for example, that 
usually don't know and don't like computer a lot. And another advantage 
is that we don't need to open smb and ssh ports to every author. He can 
do all this thinks through http server, in a much more secure way, using 
the simple and easy Construction Space tool of LON-CAPA.
    Then I would like to propose to the LON-CAPA development, to create 
a new tool in the Construction Space area of LON-CAPA, that allows to 
upload a .ZIP file, and automatically unzip it into the server. Or 
alternatively, a tool that allows to upload of a whole paste with many 
files at the same time (like select many files in Windows Explorer using 
Shift key), without the need of currently file by file upload tool 
available today in LON-CAPA.  
    I saw in the TELEDUC code 
<http://teleduc.nied.unicamp.br/teleduc/download.php?download=sim&usuario=2147483648> 
that the function responsible for unzip the .ZIP file in the server 
after the upload is implemented in PHP. The PHP code is more or less 
like this:  
 
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * *  
   DescompactarArquivoZip function - Unzip compressed cribs.  
   Input: $zip - path and name of the zip cribs  
             $destination - destination path to unzip   
   Output: true i all ok  
* /  
function DescompactarArquivoZip ($zip,$destination)  
{  
  $command = " unzip -q -o \"". $zip ". \ " -d \"". $destination ". \"";  
  system($command,$status);  
  CreateIndexFile ($destination);  
  SetPermissions($destination);  
  return (! $status);  
}  
 
    So, I think it's not difficult to insert an equivalent function in 
LON-CAPA code, not in PHP, but in perl, the main LON-CAPA language. It 
would be enough to add a button in the Construction Space area to allow 
the upload of .ZIP files. After the upload, the system of the LON- CAPA 
will be able to automatically unzip the file in the current work 
directory of Construction Space area, or to show a new option for the 
.ZIP file that allows unzip it into the server, to be published later.  
    I await suggestions to implement this new tool. And sorry for my 
poor English.

    Thanks,
    Ricardo Luis Kulzer.
    http://www.decom.fee.unicamp.br/~ricardol/www/

---

From: Gerd Kortemeyer <[email-masked]>
Date: Thu, 11 Sep 2003 22:17:37 -0400

Ricardo,

Thank you very much for your input. There is actually a bug report 
regarding ZIP files, see

  http://bugs.lon-capa.org/show_bug.cgi?id=659

I have changed the milestone on that enhancement request to "1.1" - I 
had similar experiences trying to teach faculty about having to upload 
ALL files associated with an HTML file.

If you open an account on Bugzilla, you can put yourself on the cc-list 
of the above bug to see what happens.

Please let us know if you would like your machine connected to a 
cluster.

- Gerd.

On Thursday, September 11, 2003, at 09:58  PM, Ricardo Luis Kulzer 
wrote:

>     Hello.  
>     I’m a new user of LON-CAPA, and I don’t know many thinks about its 
> code, but I’m investigating it. now.  
> compacted in one only .ZIP file, and allow to unzip the .ZIP file in 
> the server later.   
>     I tried to do the same task in LON-CAPA, but it doesn't present 
> this resource. So I needed to do upload of file by file, using the 
> tool Construction Space, and that is a annoying task (upload file by 
> file…).
>     I know that I can use SSH file transfer or Samba, but It’s 
> difficult to teach all this thinks to a Geography teacher, for 
> example, that usually don’t know and don’t like computer a lot. And 
> another advantage is that we don’t need to open smb and ssh ports to 
> every author. He can do all this thinks through http server, in a much 
> more secure way, using the simple and easy Construction Space tool of 
> LON-CAPA.
>     Then I would like to propose to the LON-CAPA development, to 
> create a new tool in the Construction Space area of LON-CAPA, that 
> allows to upload a .ZIP file, and automatically unzip it into the 
> server. Or alternatively, a tool that allows to upload of a whole 
> paste with many files at the same time (like select many files in 
> Windows Explorer using Shift key), without the need of currently file 
> by file upload tool available today in LON-CAPA.  
>     I saw in the TELEDUC code that the function responsible for unzip 
> the .ZIP file in the server after the upload is implemented in PHP. 
> The PHP code is more or less like this:  
>  
> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> * * * *  
>     So, I think it’s not difficult to insert an equivalent function in 
> would be enough to add a button in the Construction Space area to 
> allow the upload of .ZIP files. After the upload, the system of the 
> LON- CAPA will be able to automatically unzip the file in the current 
> work directory of Construction Space area, or to show a new option for 
> the .ZIP file that allows unzip it into the server, to be published 
> later.

---

From: Gerd Kortemeyer <[email-masked]>
Date: Sat, 18 Oct 2003 13:52:04 -0400

Ricardo,

> compacted in one only .ZIP file, and allow to unzip the .ZIP file in 

Joshua just implemented that feature.

- Gerd.

---

From: Ricardo Luis Kulzer <[email-masked]>
Date: Sun, 19 Oct 2003 12:29:52 -0300

I tested the new feature of the construction space - upload and of  
compressed files and decompress, for mass uploading. But I get some erros.

When I enter as author user, and call my construction space, I get a 
form reporting the error, like this:
Could Not Process Request      
Somewhere something went wrong - please help us to find out what.
Please take a moment to fill out the form below. Your information, 
together with internal debugging information, will be emailed to the 
system and server administrators.
...

The server reports at /etc/httpd/logs/error_log the following:
[Sun Oct 19 12:03:24 2003] [error] Bad name after SERVER_NAME' at 
/home/httpd/lib/perl/Apache/lonconstruct.pm line 126.
Compilation failed in require at (eval 33) line 3.
[Sun Oct 19 12:03:24 2003] [error] Undefined subroutine 
&Apache::lonconstruct::handler called.

I changed the line 126 of   
"/home/httpd/lib/perl/Apache/lonconstruct.pm". The original text was
    
$lowerframe='http://$ENV{'SERVER_NAME'}/cgi-bin/decompress.pl?decompress';
and I changed it to:
    $lowerframe='/cgi-bin/decompress.pl?decompress';

After restart the services (/etc/init.d/loncontrol restart  and  
/etc/init.d/httpd restart), I did't get that form reporting the error,  
and the construction space runs ok.

I tried to upload a "TEST.zip" file. After the upload, appears a new 
option (Decompress 
<http://lyra.mc21.fee.unicamp.br/priv/author/APOSTILA_win2000-Server.zip?decompress=1>) 
to "TEST.zip" file in the construction space. But when I click in the 
(Decompress 
<http://lyra.mc21.fee.unicamp.br/priv/author/APOSTILA_win2000-Server.zip?decompress=1>) 
option, nothing happens. And nothing appears in the 
/etc/httpd/logs/error_log file.

---

From: Ricardo Luis Kulzer <[email-masked]>
Date: Sun, 19 Oct 2003 12:38:23 -0300

Sorry. I forgot to report a detail: I commented the following line in 
the /etc/httpd/conf/loncapa_apache.conf file:
 Include conf/loncapa_apache_local*.conf
The httpd server didn't start with this line.
I don't know if this change that I did can cause my error in the 
construction space.
Ricardo.

Ricardo Luis Kulzer wrote:

> /etc/init.d/httpd restart), I did't get that form reporting the 
> error,  and the construction space runs ok.
>

---

From: Guy Albertelli II <[email-masked]>
Date: Sun, 19 Oct 2003 22:38:49 -0400 (EDT)

Hi Ricardo,

> The httpd server didn't start with this line.

Which version of Apache didn't start with this line?

-- 
[email-masked]  LON-CAPA Developer  0-7-5-5-

---

From: Ricardo Luis Kulzer <[email-masked]>
Date: Mon, 20 Oct 2003 07:54:39 -0300

The apache version is 1.3.23-14:
------------------------------------------------------------------------
[root@lyra t]# rpm -q apache
apache-1.3.23-14

[root@lyra root]# lynx -dump -head http://192.168.0.33
HTTP/1.1 200 OK
Date: Mon, 20 Oct 2003 09:48:28 GMT
Server: Apache/1.3.23 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.7 
OpenSSL/0.9.6b DAV/
1.0.3 mod_perl/1.26
Last-Modified: Sun, 21 Sep 2003 00:40:42 GMT
ETag: "680b9-1ec-3f6cf38a"
Accept-Ranges: bytes
Content-Length: 492
Connection: close
Content-Type: text/html
------------------------------------------------------------------------

If I keep the line
Include conf/loncapa_apache_local*.conf
I get the following error message:
httpd: could not open document config file 
/etc/httpd/conf/loncapa_apache_local*.conf

Ricardo.

---

From: Guy Albertelli II <[email-masked]>
Date: Mon, 20 Oct 2003 12:57:47 -0400 (EDT)

Hi Ricardo,

> The apache version is 1.3.23-14:

Hrrm, Are you running Redhat? If so which version?

> /etc/httpd/conf/loncapa_apache_local*.conf

What happens if you keep the line and create the file
/etc/httpd/conf/loncapa_apache_local.conf
?