Worktime, Modify Current Handler

We are going to add a requested feature to loncapa. We want the name of the file being editted to show up while in CSTR and editing an html Page

  1. First you will need to add the author role to domcc
    Use the CUSR button on the remote, type in the username 'domcc' and then add the author role. Logout, and log back in. (You will also need to let the webserver have permission to enter domcc's home directory, do this by having domcc do chmod a+x

  2. Next we need to find who controls HTML file creation. And understand where to make a change.

  3. First we check loncapa_apache.conf, and it says
    
    <LocationMatch "^/(res|\~).*\.(xml|html|htm|xhtml|xhtm)$">
    SetHandler perl-script
    PerlHandler Apache::lonxml
    </LocationMatch>
    	
  4. Next we check the lonxml.pm handler subroutine (line 1180). And read the subrotine. Notice the comment:
    
    #
    # Edit action? Insert editing commands
    #
    	

    that make take a closer look at the surrounding code. Looks like the line

     
        $result='<html><body bgcolor="#FFFFFF"></body></html>';
           
    Creates the webpage that has the edit field in it.

  5. Lets change that line to be instead:
    
          $result='<html><body bgcolor="#FFFFFF">';
          $result.='<b>Hey is the correct location?</b>';
          $result.='</body></html>';
            
    And create a new .html file.

  6. Looks like we were correct. So let us take a look around and see if the file name is somewhere in a local variable. Notice the line
      my $file=&Apache::lonnet::filelocation("",$request->uri);
    	
    and
      my $filecontents=&Apache::lonnet::getfile($file);
    
    Looks like $file contains the file name ,a $request->uri would be the requested url.

  7. Lets put the $request->uri in the message we print. Change
          $result.=';<b>Hey is the correct location?</b>';
    
    to
          $result.='<b>Editing file: '.$request->uri.'</b>';
    


Guy Albertelli
Last modified: Tue Jun 11 12:02:22 EDT 2002