File:  [LON-CAPA] / doc / techtips / worktime-modify.html
Revision 1.1: download - view: text, annotated - select for diffs
Fri Jun 28 20:56:50 2002 UTC (21 years, 10 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_X, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, version_0_99_3, version_0_99_2, version_0_99_1, version_0_99_0, version_0_6_2, version_0_6, version_0_5_1, version_0_5, version_0_4, stable_2002_july, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, conference_2003, bz6209-base, bz6209, STABLE, HEAD, GCI_3, GCI_2, GCI_1, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
- adding examples of programming in LON-CAPA

    1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    2: <html>
    3:   <head>
    4:     <title>Worktime, Modify Current Handler</title>
    5:   </head>
    6: 
    7:   <body>
    8:     <h1>Worktime, Modify Current Handler</h1>
    9:     <p>
   10:       We are going to add a requested feature to loncapa. We want the
   11:       name of the file being editted to show up while in CSTR and
   12:       editing an html Page
   13:     </p>
   14:     <ol>
   15:       <li>
   16: 	First you will need to add the author role to domcc<br />
   17: 	Use the
   18: 	CUSR button on the remote, type in the username 'domcc' and then
   19: 	add the author role. Logout, and log back in. (You will also need
   20: 	to let the webserver have permission to enter domcc's home
   21: 	directory, do this by having domcc do <tt>chmod a+x 
   22: 	</tt>
   23: 	<br />
   24: 	<br />
   25:       </li>
   26:       <li>
   27: 	Next we need to find who controls HTML file creation. And
   28: 	understand where to make a change.
   29: 	<br />
   30: 	<br />
   31:       </li>
   32:       <li>
   33: 	First we check loncapa_apache.conf, and it says
   34: 	<pre><tt>
   35: &lt;LocationMatch "^/(res|\~).*\.(xml|html|htm|xhtml|xhtm)$"&gt;
   36: SetHandler perl-script
   37: PerlHandler Apache::lonxml
   38: &lt;/LocationMatch&gt;
   39: 	</tt></pre>
   40:       </li>
   41:       <li>
   42: 	Next we check the lonxml.pm handler subroutine (line
   43: 	1180). And read the subrotine. Notice the comment:
   44: 	<pre><tt>
   45: #
   46: # Edit action? Insert editing commands
   47: #
   48: 	</tt></pre>
   49: 	<p> that make take a closer look at the surrounding
   50: 	  code. Looks like the line
   51: 	<pre><tt> 
   52:     $result='&lt;html&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;&lt;/body&gt;&lt;/html&gt;';
   53:        </tt></pre>
   54: 	Creates the webpage that has the edit field in it.
   55: 	<br />	<br />
   56:       </li>
   57:       <li>
   58: 	Lets change that line to be instead:
   59: 	<pre><tt>
   60:       $result='&lt;html&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;';
   61:       $result.='&lt;b&gt;Hey is the correct location?&lt;/b&gt;';
   62:       $result.='&lt;/body&gt;&lt;/html&gt;';
   63:         </tt></pre>
   64: 	And create a new .html file.
   65: 	<br />	<br />
   66:       </li>
   67:       <li>
   68: 	Looks like we were correct. So let us take a look around and
   69: 	see if the file name is somewhere in a local variable. Notice
   70: 	the line <pre>
   71:   my $file=&Apache::lonnet::filelocation("",$request->uri);
   72: 	</pre>
   73: and 
   74: <pre>
   75:   my $filecontents=&Apache::lonnet::getfile($file);
   76: </pre>
   77: 	Looks like $file contains the file name ,a $request-&gt;uri
   78: 	would be the requested url.
   79: 	<br />	<br />
   80:       </li>
   81:       <li>
   82: 	Lets put the $request->uri in the message we print. Change
   83: <pre>
   84:       $result.=';&lt;b&gt;Hey is the correct location?&lt;/b&gt;';
   85: </pre>
   86: to 
   87: <pre>
   88:       $result.='&lt;b&gt;Editing file: '.$request-&gt;uri.'&lt;/b&gt;';
   89: </pre>
   90: 	<br />
   91:       </li>
   92:     </ol>
   93:     <hr>
   94:     <address><a href="mailto:albertel@mileva.lite.msu.edu">Guy Albertelli</a></address>
   95: <!-- Created: Tue Jun 11 11:22:10 EDT 2002 -->
   96: <!-- hhmts start -->
   97: Last modified: Tue Jun 11 12:02:22 EDT 2002
   98: <!-- hhmts end -->
   99:   </body>
  100: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>