Annotation of rat/lonratedt.pm, revision 1.112

1.1       www         1: # The LearningOnline Network with CAPA
                      2: # Edit Handler for RAT Maps
1.5       www         3: #
1.112   ! damieng     4: # $Id: lonratedt.pm,v 1.111 2014/05/20 14:36:39 raeburn Exp $
1.5       www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.55      www        28: 
1.1       www        29: 
                     30: package Apache::lonratedt;
1.46      bowersj2   31: 
1.1       www        32: use strict;
                     33: use Apache::Constants qw(:common);
1.3       www        34: use Apache::lonnet;
1.85      albertel   35: use Apache::lonsequence();
                     36: use Apache::loncommon();
1.47      www        37: use Apache::lonlocal;
1.84      albertel   38: use LONCAPA::map();
1.34      www        39: use File::Copy;
1.78      www        40: use LONCAPA;
1.87      albertel   41: use HTML::Entities();
1.16      www        42: 
1.3       www        43: # --------------------------------------------------------- Build up RAT screen
                     44: sub ratedt {
                     45:   my ($r,$url)=@_;
1.75      albertel   46:   $r->print(<<ENDDOCUMENT);
1.112   ! damieng    47: <!DOCTYPE html>
        !            48: <html>
        !            49:   <head>
        !            50:     <title>Edit Sequence</title>
        !            51:     
        !            52:     <style>
        !            53: html, body {
        !            54:   margin: 0;
        !            55:   padding: 0;
        !            56: }
        !            57: #server {
        !            58:   display: none;
        !            59: }
        !            60: #top {
        !            61:   position: absolute;
        !            62:   left: 0;
        !            63:   top: 0;
        !            64:   width: 100%;
        !            65:   height: 20%;
        !            66:   border: 0;
        !            67: }
        !            68: #bottom {
        !            69:   position: absolute;
        !            70:   left: 0;
        !            71:   bottom: 0;
        !            72:   width: 100%;
        !            73:   height: 80%;
        !            74:   border: 0;
        !            75: }
        !            76: #code, #mapout {
        !            77:   position: absolute;
        !            78:   width: 100%;
        !            79:   height: 100%;
        !            80:   border: 0;
        !            81: }
        !            82: #infout {
        !            83:   position: absolute;
        !            84:   z-index: 1;
        !            85:   right: 16px;
        !            86:   bottom: 0;
        !            87:   width: 420px;
        !            88:   min-width: 200px;
        !            89:   height: 300px;
        !            90:   border: 1px solid black;
        !            91:   overflow: auto;
        !            92: }
        !            93:     </style>
        !            94:   </head>
        !            95:   
        !            96:   <body>
        !            97:     <iframe id="server" name="server" src="$url/loadonly/ratserver"></iframe>
        !            98:     <div id="top"><iframe id="code" name="code" src="$url/loadonly/adveditmenu"></iframe></div>
        !            99:     <div id="bottom"><iframe id="mapout" name="mapout" src="/adm/rat/map.html"></iframe></div>
        !           100:     <iframe id="infout"></iframe>
        !           101:     <script>
        !           102: var flag=0;
        !           103: 
        !           104: var resize = function(e) {
        !           105:     // auto-resize top iframe
        !           106:     var code = document.getElementById('code');
        !           107:     var codedoc = (code.contentDocument) ? code.contentDocument : code.contentWindow.document;
        !           108:     var top = document.getElementById('top');
        !           109:     top.style.height = ''; // reset height in case it needs to be reduced
        !           110:     codedoc.body.style.overflow = 'hidden'; // to hide scrollbar
        !           111:     var topHeight = codedoc.body.scrollHeight;
        !           112:     top.style.height = topHeight + 'px';
        !           113:     // set remainder to the other iframe
        !           114:     var bottom = document.getElementById('bottom');
        !           115:     bottom.style.height = window.innerHeight - topHeight + 'px';
        !           116:     // fix right position of infout depending on scrollbar width
        !           117:     var mapout = document.getElementById('mapout');
        !           118:     var mapoutdoc = (mapout.contentDocument) ? mapout.contentDocument : mapout.contentWindow.document;
        !           119:     var infout = document.getElementById('infout');
        !           120:     infout.style.right = (mapout.offsetWidth - mapoutdoc.body.clientWidth) + 'px';
        !           121: }
        !           122: var iframe = document.getElementById('code');
        !           123: iframe.onload = resize;
        !           124: window.addEventListener('resize', resize, false);
        !           125:     </script>
        !           126:     
        !           127:   </body>
        !           128: </html>
1.1       www       129: ENDDOCUMENT
1.3       www       130: }
                    131: 
1.8       www       132: # ---------------------------------------------------------------- Make buttons
                    133: 
                    134: sub buttons {
                    135:     my $adv=shift;
1.107     raeburn   136:     my $output='<form method="post" action="">';     
1.8       www       137:     if ($adv==1) {
1.98      bisitz    138:         $output.=
                    139:             '<input type="submit" name="forceadv"'
                    140:            .' value="'.&mt('Edit').'" />'
                    141:            .&Apache::loncommon::help_open_topic(
                    142:                 'Sequence_Advanced_Editor_Creation');
1.8       www       143:     } else {
                    144:         unless ($adv==2) {
1.98      bisitz    145:            $output.=
                    146:                '<input type="submit" name="forcesmp"'
                    147:               .' value="'.&mt('Simple Edit').'" />'
                    148:               .&Apache::loncommon::help_open_topic(
                    149:                    'Sequence_Simple_Editor_Creation')
                    150:               .' ';
1.8       www       151:         }
1.98      bisitz    152:         $output.=
                    153:             '<input type="submit" name="forceadv"'
                    154:            .' value="'.&mt('Advanced Edit').'" />'
                    155:            .&Apache::loncommon::help_open_topic(
                    156:                 'Sequence_Advanced_Editor_Creation');
1.8       www       157:     }
1.95      bisitz    158:     return $output.'</form>';
1.8       www       159: }
                    160: 
1.56      www       161: # ----------------------------------------------------------------- Edit script
1.32      www       162: sub editscript {
                    163:     my $mode=shift;
1.83      albertel  164:     my $resurl=
                    165: 	&Apache::loncommon::escape_single(&Apache::loncommon::lastresurl());
1.32      www       166:     return(<<ENDSCRIPT);
                    167: var srch;
                    168: var srchflag=-1; // 1 means currently open
                    169:                  // 0 means closed (but has been open)
                    170:                  // -1 means never yet opened/defined
                    171: var srchmode='';
                    172: 
                    173: var idx;
                    174: var idxflag=-1; // 1 means currently open
                    175:                  // 0 means closed (but has been open)
                    176:                  // -1 means never yet opened/defined
                    177: var idxmode='';
                    178: 
                    179: // ------------------------------------------------------ Clears indexer window
                    180: function idxclear() {
                    181:   idx.document.clear();
                    182: }
                    183: 
                    184: // ------------------------------------------------------- Clears search window
                    185: function srchclear() {
                    186:   srch.document.clear();
                    187: }
                    188: 
                    189: // ------------------------------------------------------ Closes indexer window
                    190: function idxclose() {
                    191:   if (idx && !idx.closed) {
                    192:     idxflag=0;
                    193:     idx.close();
                    194:   }
                    195: }
                    196: 
                    197: // ------------------------------------------------------- Closes search window
                    198: function srchclose() {
                    199:   if (srch && !srch.closed) {
                    200:     srchflag=0;
                    201:     srch.close();
                    202:   }
                    203: }
                    204: 
                    205: // -------------------------------------------------------- Open indexer window
                    206: function idxopen(mode) {
1.81      albertel  207:    var options="scrollbars=1,resizable=1,menubar=0,location=1,toolbar=1";
1.32      www       208:    idxmode=mode;
                    209:    idxflag=1;
1.88      albertel  210:    idx=open('$resurl/?inhibitmenu=yes&launch=1&mode=$mode&catalogmode='+mode,'idxout',options);
1.32      www       211:    idx.focus();
                    212: }
                    213: 
1.73      www       214: // ------------------------------------------------------ Open groupsort window
1.101     wenzelju  215: function groupopen(url,recover) {
1.73      www       216:    var options="scrollbars=1,resizable=1,menubar=0";
                    217:    idxflag=1;
1.101     wenzelju  218:    idx=open("/adm/groupsort?inhibitmenu=yes&mode=$mode&recover="+recover+"&readfile="+url,"idxout",options);
1.73      www       219:    idx.focus();
                    220: }
                    221: 
1.32      www       222: // --------------------------------------------------------- Open search window
                    223: function srchopen(mode) {
                    224:    var options="scrollbars=1,resizable=1,menubar=0";
                    225:    srchmode=mode;
                    226:    srchflag=1;
1.88      albertel  227:    srch=open("/adm/searchcat?inhibitmenu=yes&launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
1.32      www       228:    srch.focus();
                    229: }
                    230: // ----------------------------------------------------- launch indexer browser
                    231: function groupsearch() {
1.79      www       232:    srchcheck('import');
1.32      www       233: }
                    234: 
                    235: function groupimport() {
1.79      www       236:    idxcheck('import');
1.32      www       237: }
1.73      www       238: 
1.32      www       239: // ------------------------------------------------------- Do srch status check
                    240: function srchcheck(mode) {
                    241:    if (!srch || srch.closed || srchmode!=mode) {
                    242:       srchopen(mode);
                    243:    }
                    244:    srch.focus();
                    245: }
                    246: 
                    247: // -------------------------------------------------------- Do idx status check
                    248: function idxcheck(mode) {
                    249:    if (!idx || idx.closed || idxmode!=mode) {
                    250:       idxopen(mode);
                    251:    }
                    252:    idx.focus();
                    253: }
                    254: 
                    255: 
                    256:     var editbrowser;
                    257:     function openbrowser(formname,elementname,only,omit) {
1.51      www       258:         var url = '$resurl/?';
1.32      www       259:         if (editbrowser == null) {
                    260:             url += 'launch=1&';
                    261:         }
1.88      albertel  262:         url += 'inhibitmenu=yes&';
1.32      www       263:         url += 'catalogmode=interactive&';
                    264:         url += 'mode=edit&';
                    265:         url += 'form=' + formname + '&';
                    266:         if (only != null) {
                    267:             url += 'only=' + only + '&';
                    268:         } 
                    269:         if (omit != null) {
                    270:             url += 'omit=' + omit + '&';
                    271:         }
                    272:         url += 'element=' + elementname + '';
                    273:         var title = 'Browser';
1.82      albertel  274:         var options = 'scrollbars=1,resizable=1,menubar=0,toolbar=1,location=1';
1.32      www       275:         options += ',width=700,height=600';
                    276:         editbrowser = open(url,title,options,'1');
                    277:         editbrowser.focus();
                    278:     }
                    279: ENDSCRIPT
                    280: }
1.20      www       281: # ------------------------------------------------------- Simple edit processor
                    282: 
1.3       www       283: sub smpedt {
1.22      www       284:    my ($r,$url,$errtext)=@_;
1.34      www       285:    my $tmpfn=&Apache::lonnet::filelocation('',$url).'.tmp';
                    286:    my $targetmsg='';
1.65      albertel  287:    if ($env{'form.save'}) {
1.34      www       288:        copy($tmpfn,&Apache::lonnet::filelocation('',$url));
                    289:        unlink($tmpfn);
1.35      www       290:        my ($errtext,$fatal)=
1.84      albertel  291: 	   &LONCAPA::map::mapread(&Apache::lonnet::filelocation('',$url),'');
1.60      www       292:        unless ($fatal) {
1.109     bisitz    293: 	   $targetmsg=&Apache::lonhtmlcommon::confirm_success(&mt('Saved'));
1.60      www       294:        } else {
1.109     bisitz    295: 	   $targetmsg=&Apache::lonhtmlcommon::confirm_success(
                    296:                           &mt('An error occurred while saving.'),1);
1.60      www       297:        }
1.34      www       298:    }
1.65      albertel  299:    if ($env{'form.revert'}) {
1.109     bisitz    300:        $targetmsg=&Apache::lonhtmlcommon::confirm_success(&mt('Reverted'));
1.34      www       301:        unlink($tmpfn);
1.35      www       302:        my ($errtext,$fatal)=
1.84      albertel  303: 	   &LONCAPA::map::mapread(&Apache::lonnet::filelocation('',$url),'');
1.34      www       304:    }
1.110     raeburn   305:    $targetmsg = &Apache::loncommon::confirmwrapper($targetmsg) if ($targetmsg);
1.34      www       306:    if (-e $tmpfn) {
                    307:       $targetmsg=
1.109     bisitz    308:         '<p class="LC_warning">'
                    309:        .&mt('You are working with an unsaved version of your map.')
                    310:        .'</p>';
1.84      albertel  311:       my ($errtext,$fatal)=&LONCAPA::map::mapread($tmpfn,'');
1.34      www       312:    }
1.109     bisitz    313:    $errtext = '<p class="LC_error">'.$errtext.'</p>' if ($errtext);
1.12      www       314: # ---------------------------------------------------------- Process form input
                    315: 
1.66      albertel  316:    my @importselect=&Apache::loncommon::get_env_multiple('form.importsel');
                    317:    my @targetselect=&Apache::loncommon::get_env_multiple('form.target');
1.13      www       318: # ============================================================ Process commands
1.12      www       319: 
1.65      albertel  320:    my $targetdetail=$env{'form.targetdetail'};
                    321:    my $importdetail=$env{'form.curimpdetail'};
1.13      www       322: 
                    323: # ---------------------------------------------------- Importing from groupsort
1.65      albertel  324:    if (($env{'form.importdetail'}) && (!$env{'form.impfortarget'})) {
1.13      www       325: 
1.14      www       326:        $importdetail='';
1.65      albertel  327:        my @curimport=split(/\&/,$env{'form.curimpdetail'});
1.13      www       328: 
                    329:        my $lastsel;
                    330: 
                    331:        if (defined($importselect[-1])) {
                    332: 	   $lastsel=$importselect[-1];
                    333:        } else {
                    334:            $lastsel=$#curimport;
                    335:        }
                    336: 
                    337:        for (my $i=0;$i<=$lastsel;$i++) {
                    338:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    339:            if ($url) {
1.18      www       340:               $importdetail.='&'.$name.'='.$url;
1.13      www       341: 	   }
                    342:        }
                    343: 
1.65      albertel  344:       $importdetail.='&'.$env{'form.importdetail'};
1.13      www       345: 
                    346:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
                    347:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    348:            if ($url) {
1.18      www       349:               $importdetail.='&'.$name.'='.$url;
1.13      www       350: 	  }
                    351:        }
                    352:        $importdetail=~s/\&+/\&/g;
                    353:        $importdetail=~s/^\&//;
                    354: 
1.14      www       355: # ------------------------------------------------------------------- Clear all
1.65      albertel  356:    } elsif ($env{'form.clear'}) {
1.14      www       357:        $importdetail='';
                    358: # ------------------------------------------------------------ Discard selected
1.65      albertel  359:    } elsif ($env{'form.discard'}) {
1.14      www       360:        $importdetail='';
1.65      albertel  361:        my @curimport=split(/\&/,$env{'form.curimpdetail'});
1.14      www       362:        foreach (@importselect) {
                    363: 	   $curimport[$_]='';
                    364:        }
                    365:        for (my $i=0;$i<=$#curimport;$i++) {
                    366:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    367:            if ($url) {
1.18      www       368:               $importdetail.='&'.$name.'='.$url;
1.14      www       369: 	   }
                    370:        }
1.17      www       371: # --------------------------------------------------------- Loading another map
1.65      albertel  372:    } elsif ($env{'form.loadmap'}) {
1.17      www       373:        $importdetail='';
1.65      albertel  374:        my @curimport=split(/\&/,$env{'form.curimpdetail'});
1.17      www       375: 
                    376:        my $lastsel;
                    377: 
                    378:        if (defined($importselect[-1])) {
                    379: 	   $lastsel=$importselect[-1];
                    380:        } else {
                    381:            $lastsel=$#curimport;
                    382:        }
                    383: 
                    384:        for (my $i=0;$i<=$lastsel;$i++) {
                    385:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    386:            if ($url) {
1.18      www       387:               $importdetail.='&'.$name.'='.$url;
1.17      www       388: 	   }
                    389:        }
                    390: 
                    391:        foreach (
1.65      albertel  392:     &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) {
1.17      www       393: 	   my ($name,$url)=split(/\:/,$_);
                    394:            if ($url) {
1.78      www       395:               $importdetail.='&'.&escape($name).'='.
                    396: 		 	         &escape($url);
1.17      www       397: 	  }
                    398:        }
                    399: 
                    400:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
                    401:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    402:            if ($url) {
1.18      www       403:               $importdetail.='&'.$name.'='.$url;
1.17      www       404: 	  }
                    405:        }
                    406:        $importdetail=~s/\&+/\&/g;
                    407:        $importdetail=~s/^\&//;
                    408: 
1.20      www       409: # ------------------------------------------------ Groupimport/search to target
1.65      albertel  410:    } elsif ($env{'form.importdetail'}) {
1.20      www       411:        my $lastsel;
                    412:        if (defined($targetselect[-1])) {
                    413: 	   $lastsel=$targetselect[-1];
                    414:        } else {
1.84      albertel  415:            $lastsel=$#LONCAPA::map::order+1;
1.20      www       416:        }
1.84      albertel  417:        &LONCAPA::map::pastetarget($lastsel,split(/\&/,$env{'form.importdetail'}));
                    418:        &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));
1.20      www       419: # ------------------------------------------------------------------------- Cut
1.65      albertel  420:    } elsif (($env{'form.cut'}) || ($env{'form.copy'})) {
1.25      www       421:        $importdetail='';
1.65      albertel  422:        my @curimport=split(/\&/,$env{'form.curimpdetail'});
1.25      www       423: 
                    424:        my $lastsel;
                    425: 
                    426:        if (defined($importselect[-1])) {
                    427: 	   $lastsel=$importselect[-1];
                    428:        } else {
                    429:            $lastsel=$#curimport;
                    430:        }
                    431: 
                    432:        for (my $i=0;$i<=$lastsel;$i++) {
                    433:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    434:            if ($url) {
                    435:               $importdetail.='&'.$name.'='.$url;
                    436: 	   }
                    437:        }
                    438: 
                    439:        foreach (@targetselect) {
1.84      albertel  440: 	   my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$LONCAPA::map::order[$_-1]]);
1.25      www       441:            if ($url) {
1.78      www       442:               $importdetail.='&'.&escape($name).'='.
                    443: 		 	         &escape($url);
1.25      www       444: 	  }
                    445:        }
                    446: 
                    447:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
                    448:            my ($name,$url)=split(/\=/,$curimport[$i]);
                    449:            if ($url) {
                    450:               $importdetail.='&'.$name.'='.$url;
                    451: 	  }
                    452:        }
                    453:        $importdetail=~s/\&+/\&/g;
                    454:        $importdetail=~s/^\&//;
                    455: 
1.65      albertel  456:        if ($env{'form.cut'}) {
1.25      www       457:            my @neworder=();
1.84      albertel  458:            for (my $i=0;$i<=$#LONCAPA::map::order;$i++) {
1.25      www       459:                my $include=1;
                    460:                foreach (@targetselect) {
                    461: 		   if ($_-1==$i) { $include=0; }
                    462:                }
1.71      www       463:                if ($include) { 
1.84      albertel  464: 		   $neworder[$#neworder+1]=$LONCAPA::map::order[$i]; 
1.71      www       465: 	       } else {
1.84      albertel  466: 		   &LONCAPA::map::makezombie($LONCAPA::map::order[$i]);
1.71      www       467: 	       }
1.25      www       468:            }
1.84      albertel  469:            @LONCAPA::map::order=@neworder;
                    470:            &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));      
1.25      www       471:        }
                    472: 
1.20      www       473: # ----------------------------------------------------------------------- Paste
1.65      albertel  474:    } elsif ($env{'form.paste'}) {
1.24      www       475:        my $lastsel;
                    476:        if (defined($targetselect[-1])) {
                    477: 	   $lastsel=$targetselect[-1];
                    478:        } else {
1.84      albertel  479:            $lastsel=$#LONCAPA::map::order+1;
1.24      www       480:        }
                    481:        my @newsequence;
1.65      albertel  482:        my @curimport=split(/\&/,$env{'form.curimpdetail'});
1.24      www       483:        foreach (@importselect) {
                    484:           $newsequence[$#newsequence+1]=$curimport[$_];
                    485:        }
1.84      albertel  486:        &LONCAPA::map::pastetarget($lastsel,@newsequence);
                    487:        &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));
1.39      www       488: # -------------------------------------------------------------------- Move up 
1.65      albertel  489:    } elsif ($env{'form.moveup'}) {
1.39      www       490:        foreach (sort @targetselect) {
                    491:            if ($_-1>0) {
1.84      albertel  492:               my $movethis=$LONCAPA::map::order[$_-1];
                    493:               $LONCAPA::map::order[$_-1]=$LONCAPA::map::order[$_-2];
                    494:               $LONCAPA::map::order[$_-2]=$movethis;
1.39      www       495: 	  }
                    496:        }
1.84      albertel  497:        &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));
1.39      www       498: # ------------------------------------------------------------------ Move down
1.65      albertel  499:    } elsif ($env{'form.movedown'}) {
1.39      www       500:        foreach (reverse sort @targetselect) {
1.84      albertel  501:            if ($_-1<$#LONCAPA::map::order) {
                    502:               my $movethis=$LONCAPA::map::order[$_-1];
                    503:               $LONCAPA::map::order[$_-1]=$LONCAPA::map::order[$_];
                    504:               $LONCAPA::map::order[$_]=$movethis;
1.39      www       505: 	   }
                    506:        }
1.84      albertel  507:        &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));
1.39      www       508: # --------------------------------------------------------------------- Rename
1.65      albertel  509:    } elsif ($env{'form.renameres'}) {
1.84      albertel  510:        my $residx=$LONCAPA::map::order[$env{'form.renameidx'}-1];
                    511:        my ($name,@resrest)=split(/\:/,$LONCAPA::map::resources[$residx]);
1.65      albertel  512:        $name=$env{'form.renametitle'};
1.40      www       513:        $name=~s/\:/\&colon\;/g;
1.84      albertel  514:        $LONCAPA::map::resources[$residx]=$name.':'.join(':',@resrest);
                    515:        &LONCAPA::map::storemap(&Apache::lonnet::filelocation('',$url));
1.13      www       516:    }
1.12      www       517: # ------------------------------------------------------------ Assemble windows
1.20      www       518:    
1.13      www       519:    my $idx=-1;
1.34      www       520:    $importdetail='&'.$importdetail;
                    521:    $importdetail=~s/^\&+/\&/;
1.29      www       522:    my $importwindow=
1.50      sakharuk  523:        '<option value="-1"> ---- '.&mt('Import and Paste Area').' ---- </option>'.
1.29      www       524:      join("\n",map {
1.13      www       525:        $idx++;
                    526:        if ($_) { 
1.15      www       527:           my ($name,$url)=split(/\=/,$_);
                    528:           unless ($name) { $name=(split(/\//,$url))[-1]; }
                    529:           unless ($name) { $name='EMPTY'; }
1.78      www       530:           '<option value="'.$idx.'">'.&unescape($name).
1.13      www       531:                                     '</option>';
                    532:       }
                    533:    } split(/\&/,$importdetail));
1.12      www       534: 
1.13      www       535:    $idx=0;
1.39      www       536:    $targetdetail='';
1.29      www       537:    my $targetwindow=       
1.49      sakharuk  538:        '<option value="0"> ------- '.&mt('Target Edit Map').' ------- </option>'.
1.29      www       539:      join("\n",map { 
1.84      albertel  540:        my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]);
1.15      www       541:        unless ($name) {  $name=(split(/\//,$url))[-1]; }
                    542:        unless ($name) { $name='EMPTY'; }
1.87      albertel  543:        $name = &LONCAPA::map::qtescape($name);
                    544:        $url  = &LONCAPA::map::qtescape($url);
1.78      www       545:        $targetdetail.='&'.&escape($name).'='.
                    546: 	                  &escape($url);
1.13      www       547:        $idx++;
1.87      albertel  548:        $name = &HTML::Entities::encode($name,'\'"<>&');
1.20      www       549:        '<option value="'.$idx.'">'.$name.'</option>';
1.84      albertel  550:    } @LONCAPA::map::order);
1.11      www       551: 
1.8       www       552: # ----------------------------------------------------- Start simple RAT screen
1.32      www       553:    my $editscript=&editscript('simple');
1.75      albertel  554: 
1.47      www       555:    my %lt=&Apache::lonlocal::texthash(
1.109     bisitz    556: 				      'sm' => 'Select Map',
1.47      www       557: 				      'sa' => 'Save',
                    558: 				      'nt' => 'New Title',
                    559: 				      'se' => 'Search',
                    560: 				      'im' => 'Import',
1.106     raeburn   561:                                       'wl' => 'Import from Stored Links',
1.47      www       562: 				      'vi' => 'View',
                    563: 				      'lm' => 'Load Map',
                    564: 				      'ds' => 'Discard Selected',
                    565: 				      'ca' => 'Clear All',
                    566: 				      'ta' => 'Temporary Assembly Workspace',
                    567: 				      'rv' => 'Revert to Last Saved',
                    568:                                       'sa' => 'Save',
                    569:                                       'mu' => 'Move Up',
                    570:                                       'md' => 'Move Down',
                    571:                                       're' => 'Rename',
1.49      sakharuk  572:                                       'as' => 'after selected',
                    573:                                       'cs' => 'Cut selected',
                    574:                                       'ps' => 'Copy selected',
                    575:                                       'pas' => 'Paste after selected',
1.74      www       576:                                       'reco' => 'Recover Deleted'
1.47      www       577: 				      );
1.109     bisitz    578:    my $js=&Apache::lonhtmlcommon::scripttag("
1.32      www       579:    $editscript
1.19      www       580: 
                    581:    function openview(entry) {
                    582:        var url=unescape((entry.split('='))[1]);
1.20      www       583:        var parts=new Array;
1.19      www       584:        if (url) { open(url,'cat'); }
                    585:    }
                    586: 
                    587:    function viewtarget() {
                    588:        openview((document.forms.simpleedit.targetdetail.value.split('&'))
1.34      www       589:                 [document.forms.simpleedit.target.selectedIndex]);
1.19      www       590:    }
                    591: 
                    592:    function viewimport() {
                    593:        openview((document.forms.simpleedit.curimpdetail.value.split('&'))
1.34      www       594:                 [document.forms.simpleedit.importsel.selectedIndex]);
1.19      www       595:    }
                    596: 
1.39      www       597:    function renametarget() {
                    598:        var selidx=document.forms.simpleedit.target.selectedIndex;
                    599:        var entry=(document.forms.simpleedit.targetdetail.value.split('&'))
                    600:                 [selidx];
1.41      www       601:        var oldname=unescape((entry.split('='))[0]);
1.47      www       602:        newtitle=prompt('$lt{'nt'}',oldname);
1.39      www       603:        if (newtitle) {
                    604:            document.forms.simpleedit.renameres.value=1;
                    605:            document.forms.simpleedit.renameidx.value=selidx;
                    606:            document.forms.simpleedit.renametitle.value=newtitle;
                    607: 	   document.forms.simpleedit.submit();
                    608:        }
                    609:    }
1.109     bisitz    610: ");
1.75      albertel  611: 
1.96      bisitz    612:     &Apache::lonhtmlcommon::clear_breadcrumbs();
                    613:     &Apache::lonhtmlcommon::add_breadcrumb({
1.108     raeburn   614:         text  => 'Authoring Space',
1.104     raeburn   615:         href  => &Apache::loncommon::authorspace($url),
1.96      bisitz    616:         faq   => 6,
                    617:         bug   => 'RAT',
                    618:         help  => 'Sequence_Simple_Editor_Creation',});
                    619:     &Apache::lonhtmlcommon::add_breadcrumb({
                    620:         text  => 'RAT',
                    621:         title => 'Resource Assembly Tool',
                    622:         href  => '',});
                    623:     &Apache::lonhtmlcommon::add_breadcrumb({
                    624:         text  => 'Editor',
                    625:         title => 'Simple Editor',
                    626:         href  => '',});
                    627: 
1.98      bisitz    628:     # Breadcrumbs are included by &start_page
1.108     raeburn   629:     my $start_page = &Apache::loncommon::start_page('Authoring Space',$js)
1.95      bisitz    630:                     .&Apache::loncommon::head_subbox(
                    631:                          &Apache::loncommon::CSTR_pageheader()
                    632:                         .&buttons(2));
1.75      albertel  633:     my $end_page = &Apache::loncommon::end_page();
                    634: 
1.109     bisitz    635:     my $filetext = &mt('File: [_1]','<span class="LC_filename">'.$url.'</span>');
1.75      albertel  636:     $r->print(<<ENDSMPHEAD);
                    637: $start_page
1.109     bisitz    638: $targetmsg
                    639: $errtext
1.107     raeburn   640: <form name="simpleedit" method="post" action="">
1.93      bisitz    641: <input type="hidden" name="forcesmp" value="1" />
                    642: <input type="hidden" name="renameres" value="0" />
                    643: <input type="hidden" name="renametitle" value="" />
                    644: <input type="hidden" name="renameidx" value="0" />
1.11      www       645: <table>
1.47      www       646:     <tr><th width="40%">$lt{'ta'}</th>
1.12      www       647: <th>&nbsp;</th>
1.109     bisitz    648: <th width="40%">$filetext</th></tr>
1.12      www       649: <tr><td bgcolor="#FFFFCC">
1.107     raeburn   650: <input type="button" onclick="javascript:groupsearch()" value="$lt{'se'}" />
                    651: <input type="button" onclick="javascript:groupimport();" value="$lt{'im'}" />
1.49      sakharuk  652: $lt{'as'}
1.93      bisitz    653: <hr />
                    654: <input type="text" size="20" name="importmap" />
                    655: <input type="button" 
1.107     raeburn   656: onclick="javascript:openbrowser('simpleedit','importmap','sequence,page','')"
1.109     bisitz    657: value="$lt{'sm'}" /><input type="submit" name="loadmap" value="$lt{'lm'}" /><hr />
1.93      bisitz    658: <input type="submit" name="discard" value="$lt{'ds'}" />
                    659: <input type="submit" name="clear" value="$lt{'ca'}" />
1.107     raeburn   660: <input type="button" onclick="javascript:viewimport()" value="$lt{'vi'}" />
1.16      www       661: 
1.12      www       662:     </td><td>&nbsp;</td><td bgcolor="#FFFFCC">
1.16      www       663: 
1.107     raeburn   664: <input type="button" onclick=
1.93      bisitz    665: "javascript:impfortarget.value=1;groupsearch()" value="$lt{'se'}" />
1.107     raeburn   666: <input type="button" onclick=
1.93      bisitz    667: "javascript:impfortarget.value=1;groupimport();" value="$lt{'im'}" />
1.107     raeburn   668: <input type="button" onclick=
1.106     raeburn   669: "javascript:impfortarget.value=1;open_StoredLinks_Import('simple');" value="$lt{'wl'}" />
1.107     raeburn   670: <input type="button" onclick=
1.101     wenzelju  671: "javascript:impfortarget.value=1;groupopen('$url',1);" value="$lt{'reco'}" />
1.49      sakharuk  672: $lt{'as'}
1.93      bisitz    673: <hr />
                    674: <input type="submit" name="moveup" value="$lt{'mu'}" />
                    675: <input type="submit" name="movedown" value="$lt{'md'}" />
1.107     raeburn   676: <input type="button" onclick="javascript:renametarget()" value="$lt{'re'}" />
1.109     bisitz    677: <hr />
1.93      bisitz    678: <input type="submit" name="revert" value="$lt{'rv'}" />
                    679: <input type="submit" name="save" value="$lt{'sa'}" />
1.107     raeburn   680: <input type="button" onclick="javascript:viewtarget()" value="$lt{'vi'}" />
1.12      www       681: </td></tr>
1.16      www       682: 
1.92      bisitz    683: <tr><td bgcolor="#FFFFCC"><select name="importsel" size="10" multiple="multiple">
1.12      www       684: $importwindow
                    685: </select>
1.11      www       686: </td>
1.12      www       687: <td bgcolor="#FFFFAA" align="center">
1.93      bisitz    688: $lt{'cs'}<br />
1.109     bisitz    689: <input type="submit" name="cut" value="&lt;&lt;&lt;" />
1.93      bisitz    690: <hr />
                    691: $lt{'ps'}<br />
1.109     bisitz    692: <input type="submit" name="copy" value="&lt;--" />
                    693: <hr />
1.93      bisitz    694: $lt{'pas'}<br />
1.109     bisitz    695: <input type="submit" name="paste" value="--&gt;" />
1.11      www       696: </td>
1.92      bisitz    697: <td bgcolor="#FFFFCC"><select name="target" size="10" multiple="multiple">
1.11      www       698: $targetwindow
                    699: </select>
1.109     bisitz    700: </td></tr>
1.12      www       701: </table>
1.93      bisitz    702: <input type="hidden" name="importdetail" value="" />
                    703: <input type="hidden" name="curimpdetail" value="$importdetail" />
                    704: <input type="hidden" name="targetdetail" value="$targetdetail" />
                    705: <input type="hidden" name="impfortarget" value="0" />
1.12      www       706: </form>
1.75      albertel  707: $end_page
1.3       www       708: ENDSMPHEAD
                    709: }
                    710: 
1.11      www       711: # ----------------------------------------------------------------- No such dir
1.4       www       712: sub nodir {
                    713:    my ($r,$dir)=@_;
1.103     raeburn   714:    my $londocroot = $r->dir_config('lonDocRoot');
1.104     raeburn   715:    my ($path) = ($dir =~ m{^\Q$londocroot\E?(/priv/[^/]+/[^/]+/)});
1.103     raeburn   716:    $dir=~s{^\Q$londocroot/priv/\E[^/]+/[^/]+}{};
1.104     raeburn   717:    my $brcrum = [{'href' => &Apache::loncommon::authorspace($path),
1.108     raeburn   718:                   'text' => 'Authoring Space'}];
1.97      bisitz    719: #                 {'href' => '',
                    720: #                  'text' => 'No such directory'}];
1.108     raeburn   721:    $r->print(&Apache::loncommon::start_page('Authoring Space',
1.97      bisitz    722:                                             undef,
                    723:                                             {'bread_crumbs' => $brcrum,})
1.95      bisitz    724:             .&Apache::loncommon::head_subbox(
                    725:                  &Apache::loncommon::CSTR_pageheader())
                    726:             .'<p class="LC_error">'
                    727:             .&mt('No such directory: [_1]','<span class="LC_filename">'.$dir.'</span>'
                    728:             .'</p>'
                    729:             .&Apache::loncommon::end_page())
                    730:    );
1.4       www       731: }
                    732: 
1.8       www       733: # ---------------------------------------------------------------- View Handler
                    734: 
                    735: sub viewmap {
1.17      www       736:     my ($r,$url,$adv,$errtext)=@_;
1.96      bisitz    737: 
                    738:     &Apache::lonhtmlcommon::clear_breadcrumbs();
                    739:     &Apache::lonhtmlcommon::add_breadcrumb({
1.108     raeburn   740:         text  => 'Authoring Space',
1.104     raeburn   741:         href  => &Apache::loncommon::authorspace($url),
1.96      bisitz    742:         faq   => 6,
                    743:         bug   => 'RAT',
                    744:         help  => 'Sequence_Simple_Editor_Creation',});
                    745:     &Apache::lonhtmlcommon::add_breadcrumb({
                    746:         text  => 'RAT',
                    747:         title => 'Resource Assembly Tool',
                    748:         href  => '',});
                    749: 
1.98      bisitz    750:     # Breadcrumbs are included by &start_page
1.95      bisitz    751:     $r->print(&Apache::loncommon::start_page('Edit Content of a Map')
                    752:              .&Apache::loncommon::head_subbox(
                    753:                   &Apache::loncommon::CSTR_pageheader()
                    754:                  .&buttons($adv))
                    755:     );
1.10      www       756:     if ($errtext) {
1.90      bisitz    757: 	$r->print('<div class="LC_error">'
                    758:                  .$errtext
                    759:                  .'</div>'
                    760:                  .'<hr />'
                    761:         );
1.10      www       762:     }
1.26      www       763:     my $idx=0;
1.97      bisitz    764:     $r->print('<p><span class="LC_filename">'.$url.'</span></p>');
1.44      www       765:     if ($adv) {
1.90      bisitz    766: 	$r->print('<p class="LC_warning">'
                    767:                  .&mt('Map contents are not shown in order.')
                    768:                  .'</p><br />'
                    769:         );
1.44      www       770:     }
1.90      bisitz    771:     $r->print(&Apache::loncommon::start_data_table()
                    772:              .&Apache::loncommon::start_data_table_header_row()
                    773:              .'<th>'.&mt('Type').'</th>'
                    774:              .'<th>'.&mt('Title in map').'</th>'
                    775:              .'<th>'.&mt('Filename of resource').'</th>'
                    776:              .'<th>'.&mt('Link to published resource').'</th>'
1.108     raeburn   777:              .'<th>'.&mt('Link to resource in Authoring Space').'</th>'
1.90      bisitz    778:              .&Apache::loncommon::end_data_table_header_row()
                    779:     );
1.84      albertel  780:     foreach (&LONCAPA::map::attemptread(&Apache::lonnet::filelocation('',$url))) {
1.9       www       781: 	if (defined($_)) {
1.26      www       782:             $idx++;
1.62      albertel  783: 	    my ($title,$url,$cond)=split(/\:/,$_);
                    784: 	    if ($cond eq 'cond') { next; }
1.87      albertel  785:             $title= &LONCAPA::map::qtescape($title);
                    786:             $url  = &LONCAPA::map::qtescape($url);
1.15      www       787:             unless ($title) { $title=(split(/\//,$url))[-1] };
1.64      raeburn   788:             unless ($title) { $title='<i>'.&mt('Empty').'</i>'; }
1.87      albertel  789:             my $resurl = $url;
1.64      raeburn   790:             my $resfilepath = $Apache::lonnet::perlvar{'lonDocRoot'}.$resurl;
                    791:             my $filename; 
                    792:             if ($resurl =~ m#/([^/]+)$#) {
                    793:                 $filename = $1;
                    794:             }
                    795:             my $cstrurl = $resurl;
1.105     raeburn   796:             $cstrurl =~ s{^/res/}{/priv/};
1.90      bisitz    797:             $r->print(&Apache::loncommon::start_data_table_row()
                    798:                      .'<td>'
1.107     raeburn   799:                      .'<img src="'.&Apache::loncommon::icon($resfilepath).'" alt="" />'
1.90      bisitz    800:                      .'</td>'
                    801:                      .'<td>'
                    802:                      .&HTML::Entities::encode(&LONCAPA::map::qtescape($title))
                    803:                      .'</td>'
                    804:                      .'<td>'.$filename.'</td>'
                    805:                      .'<td>'
                    806:             );
1.64      raeburn   807:             if ($url) {
1.68      www       808: 		$r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>');
1.90      bisitz    809:             } else {
                    810:                 $r->print('&nbsp;');
1.64      raeburn   811:             }
                    812:             $r->print('</td><td>');
1.9       www       813:             if ($url) {
1.64      raeburn   814:                $r->print('<a href="'.$cstrurl.'">'.
1.111     raeburn   815:                          &mt('Authoring Space').'</a>');
1.90      bisitz    816:             } else {
                    817:                 $r->print('&nbsp;');
1.9       www       818:             }
1.90      bisitz    819:             $r->print('</td>'
                    820:                      .&Apache::loncommon::end_data_table_row()
                    821:             );
1.9       www       822:         }
                    823:     }
1.90      bisitz    824:     $r->print(&Apache::loncommon::end_data_table());
1.75      albertel  825:     $r->print(&Apache::loncommon::end_page());
1.8       www       826: }
                    827: 
1.3       www       828: # ================================================================ Main Handler
                    829: 
                    830: sub handler {
                    831:   my $r=shift;
1.47      www       832:   &Apache::loncommon::content_type($r,'text/html');
1.3       www       833:   $r->send_http_header;
                    834: 
                    835:   return OK if $r->header_only;
1.65      albertel  836:   my $target = $env{'form.grade_target'};
1.48      albertel  837:   if ($target eq 'meta') {
                    838:       &Apache::loncommon::content_type($r,'text/html');
                    839:       $r->send_http_header;
                    840:       return OK;
                    841:   }
                    842:   
1.3       www       843:   my $url=$r->uri;
                    844:   my $fn=&Apache::lonnet::filelocation('',$url);
                    845: 
1.4       www       846:   my ($dir)=($fn=~/^(.+)\/[^\/]+$/);
                    847:   unless (-e $dir) {
                    848:       &nodir($r,$dir);
                    849:       return OK;
                    850:   }
1.8       www       851: 
                    852: # ------------------------------------------- Determine which tools can be used
1.3       www       853:   my $adv=0;
                    854: 
1.65      albertel  855:   unless ($env{'form.forcesmp'}) {
                    856:      if ($env{'form.forceadv'}) {
1.3       www       857:         $adv=1;
                    858:      } elsif (my $fh=Apache::File->new($fn)) {
                    859: 	 my $allmap=join('',<$fh>);
                    860:          $adv=($allmap=~/\<map[^\>]+mode\s*\=\s*(\'|\")rat/is);
                    861:      }
                    862:   }
                    863: 
1.8       www       864:   my $errtext='';
                    865:   my $fatal=0;
                    866: 
                    867: # -------------------------------------------------------------------- Load map
1.84      albertel  868:   ($errtext,$fatal)=&LONCAPA::map::mapread($fn,$errtext);
1.8       www       869: 
                    870:   if ($fatal==1) { $adv=1; }
                    871: 
                    872: # ----------------------------------- adv==1 now means "graphical MUST be used"
                    873: 
1.65      albertel  874:   if ($env{'form.forceadv'}) {
1.3       www       875:       &ratedt($r,$url);
1.65      albertel  876:   } elsif ($env{'form.forcesmp'}) {
1.22      www       877:       &smpedt($r,$url,$errtext);
1.3       www       878:   } else {
1.17      www       879:       &viewmap($r,$url,$adv,$errtext);
1.3       www       880:   }
1.1       www       881:   return OK;
                    882: }
                    883: 
                    884: 1;
                    885: __END__
                    886: 
                    887: 
                    888: 
1.91      jms       889: =pod
                    890: 
                    891: =head1 NAME
                    892: 
                    893: Apache::lonratedt: simple resource assembly tool
                    894: 
                    895: =head1 SYNOPSIS
                    896: 
                    897: lonratedt provides the routines and the handler for the Advanced
                    898:     Resource Assembly Tool (RAT), and ties the various pieces together
                    899:     with Javascript.
                    900: 
                    901: =head1 OVERVIEW
                    902: 
                    903: =head2 Map Representation
                    904: 
                    905: =begin latex
                    906: 
                    907: %
                    908: \begin{figure}
                    909: \begin{center}\includegraphics[%
                    910:   width=0.55\paperwidth,bb = 0 0 200 100, draft, type=eps]{Map_Example}\end{center}
                    911: 
                    912: 
                    913: \caption{\label{Map_In_Advanced_Editor}Example of a Map in the Advanced Editor}
                    914: \end{figure}
                    915: %
                    916: \begin{figure}
                    917: \begin{lyxcode}
                    918: <map>
                    919: 
                    920: ~~<resource~id=\char`\"{}1\char`\"{}
                    921: 
                    922: ~~~~src=\char`\"{}/res/msu/korte/phy231welcome.html\char`\"{}
                    923: 
                    924: ~~~~type=\char`\"{}start\char`\"{}
                    925: 
                    926: ~~~~title=\char`\"{}Start\char`\"{}>
                    927: 
                    928: ~~~~</resource>
                    929: 
                    930: ~~<resource~id=\char`\"{}2\char`\"{}
                    931: 
                    932: ~~~~src=\char`\"{}\char`\"{}~type=\char`\"{}finish\char`\"{}
                    933: 
                    934: ~~~~title=\char`\"{}Finish\char`\"{}>
                    935: 
                    936: ~~~~</resource>
                    937: 
                    938: ~~<resource~id=\char`\"{}6\char`\"{}
                    939: 
                    940: ~~~~src=\char`\"{}/res/msu/korte/tests/units.problem\char`\"{}
                    941: 
                    942: ~~~~type=\char`\"{}mandatory\char`\"{}
                    943: 
                    944: ~~~~title=\char`\"{}Physical~Units~Test\char`\"{}>
                    945: 
                    946: ~~~~</resource>
                    947: 
                    948: ~~<resource~id=\char`\"{}9\char`\"{}
                    949: 
                    950: ~~~~src=\char`\"{}/res/msu/korte/chapters/onedim.sequence\char`\"{}
                    951: 
                    952: ~~~~title=\char`\"{}Motion~in~One~Dimension\char`\"{}>
                    953: 
                    954: ~~~~</resource>
                    955: 
                    956: ~~<resource~id=\char`\"{}11\char`\"{}
                    957: 
                    958: ~~~~src=\char`\"{}/res/msu/bauer/bridges/units.sequence\char`\"{}
                    959: 
                    960: ~~~~title=\char`\"{}Physical~Units~Refresher\char`\"{}>
                    961: 
                    962: ~~~~</resource>
                    963: 
                    964: ~~<condition~id=\char`\"{}19\char`\"{}
                    965: 
                    966: ~~~~type=\char`\"{}stop\char`\"{}
                    967: 
                    968: ~~~~value=\char`\"{}user.assessments{[}this./res/msu/korte/tests/units.problem{]}.status=solved\char`\"{}>
                    969: 
                    970: ~~~~</condition>
                    971: 
                    972: ~~<link~from=\char`\"{}1\char`\"{}~to=\char`\"{}6\char`\"{}></link>
                    973: 
                    974: ~~<link~from=\char`\"{}6\char`\"{}~to=\char`\"{}9\char`\"{}~condition=\char`\"{}19\char`\"{}></link>
                    975: 
                    976: ~~<link~from=\char`\"{}6\char`\"{}~to=\char`\"{}11\char`\"{}></link>
1.1       www       977: 
1.91      jms       978: ~~<link~from=\char`\"{}11\char`\"{}~to=\char`\"{}6\char`\"{}></link>
                    979: 
                    980: ~~</map>
                    981: \end{lyxcode}
                    982: 
                    983: \caption{\label{XML}XML for Map in Figure \ref{Map_In_Advanced_Editor}}
                    984: \end{figure}
                    985: 
                    986: =end latex
                    987: 
                    988: Fig. "XML for Map in Figure" shows the XML representation of the
                    989: resource map shown in Fig. "Example of a Map in the Advanced Editor",
                    990: which is the format in which maps are stored. In the figure, however,
                    991: additional graphical map layout information generated by the Advanced
                    992: Resource Assembly Tool is not displayed. This graphical information is
                    993: optional to re-generate the same graphical layout when the map is
                    994: brought up again in the Resource Assembly Tool, and is not needed for
                    995: any other system functionality.
                    996: 
                    997: Maps can be generated by tools other than the Resource Assembly
                    998: Tool. In particular, an author might have some other representation of
                    999: a course sequence, which can be converted into a map using scripts. If
                   1000: this map then were to be brought up in the Resource Assembly Tool, the
                   1001: Tool would automatically generate a graphical layout for it. Each
                   1002: entry of the map (resources, conditions and links) is stored in a
                   1003: separate tag.
                   1004: 
                   1005: Resources and conditionsX<conditions> have to have unique ID
                   1006: numbers. These numbers are automatically generated by the Resource
                   1007: Assembly Tool when the entry is first created, or added to the entries
                   1008: when a map generated outside the Resource Assembly Tool is first
                   1009: retrieved. They can also be assigned by custom scripts or added in by
                   1010: hand.
                   1011: 
                   1012: In the XML example, entry 1 is the start resource of the map. When
                   1013: this map is accessed, the source (src) URL of this tag will be the
                   1014: first resource rendered. Entry 2 is the finish resource of this
                   1015: map. This resource will be the last resource in the sequence of
                   1016: resources. Entry 6 is a problem resource with the given URL and title,
                   1017: as well as the priority "mandatory". Entry 19 is a condition, which is
                   1018: used by the link between entries 6, the problem, and 9, a
                   1019: sequence. I<The final syntax for conditions has not yet been
                   1020: determined.>
                   1021: 
                   1022: =cut
1.1       www      1023: 
                   1024: 
                   1025: 

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