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 (22 years, 4 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_5_msu, version_2_11_5, 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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Worktime, Modify Current Handler</title>
  </head>

  <body>
    <h1>Worktime, Modify Current Handler</h1>
    <p>
      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
    </p>
    <ol>
      <li>
	First you will need to add the author role to domcc<br />
	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 <tt>chmod a+x 
	</tt>
	<br />
	<br />
      </li>
      <li>
	Next we need to find who controls HTML file creation. And
	understand where to make a change.
	<br />
	<br />
      </li>
      <li>
	First we check loncapa_apache.conf, and it says
	<pre><tt>
&lt;LocationMatch "^/(res|\~).*\.(xml|html|htm|xhtml|xhtm)$"&gt;
SetHandler perl-script
PerlHandler Apache::lonxml
&lt;/LocationMatch&gt;
	</tt></pre>
      </li>
      <li>
	Next we check the lonxml.pm handler subroutine (line
	1180). And read the subrotine. Notice the comment:
	<pre><tt>
#
# Edit action? Insert editing commands
#
	</tt></pre>
	<p> that make take a closer look at the surrounding
	  code. Looks like the line
	<pre><tt> 
    $result='&lt;html&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;&lt;/body&gt;&lt;/html&gt;';
       </tt></pre>
	Creates the webpage that has the edit field in it.
	<br />	<br />
      </li>
      <li>
	Lets change that line to be instead:
	<pre><tt>
      $result='&lt;html&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;';
      $result.='&lt;b&gt;Hey is the correct location?&lt;/b&gt;';
      $result.='&lt;/body&gt;&lt;/html&gt;';
        </tt></pre>
	And create a new .html file.
	<br />	<br />
      </li>
      <li>
	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 <pre>
  my $file=&Apache::lonnet::filelocation("",$request->uri);
	</pre>
and 
<pre>
  my $filecontents=&Apache::lonnet::getfile($file);
</pre>
	Looks like $file contains the file name ,a $request-&gt;uri
	would be the requested url.
	<br />	<br />
      </li>
      <li>
	Lets put the $request->uri in the message we print. Change
<pre>
      $result.=';&lt;b&gt;Hey is the correct location?&lt;/b&gt;';
</pre>
to 
<pre>
      $result.='&lt;b&gt;Editing file: '.$request-&gt;uri.'&lt;/b&gt;';
</pre>
	<br />
      </li>
    </ol>
    <hr>
    <address><a href="mailto:albertel@mileva.lite.msu.edu">Guy Albertelli</a></address>
<!-- Created: Tue Jun 11 11:22:10 EDT 2002 -->
<!-- hhmts start -->
Last modified: Tue Jun 11 12:02:22 EDT 2002
<!-- hhmts end -->
  </body>
</html>

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