Ignore:
Timestamp:
1999-06-17T15:06:58+12:00 (25 years ago)
Author:
sjboddie
Message:

got detach button working properly - the close book icon is now disabled
when page is detached as the javascript close() function I was using is
too unreliable over different browsers
note that in my last comment I meant the "cl" arg (not the "c" arg).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/documentaction.cpp

    r281 r282  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/06/17 03:06:58  sjboddie
     15   got detach button working properly - the close book icon is now disabled
     16   when page is detached as the javascript close() function I was using is
     17   too unreliable over different browsers
     18   note that in my last comment I meant the "cl" arg (not the "c" arg).
     19
    1420   Revision 1.6  1999/06/16 23:53:15  sjboddie
    1521   tidied a few things up. documentaction::define_external_macros now
     
    131137  arg_ainfo.defaultstatus = cgiarginfo::weak;
    132138  arg_ainfo.argdefault = "0";
    133   arg_ainfo.savedarginfo = cgiarginfo::can;
     139  arg_ainfo.savedarginfo = cgiarginfo::must;
    134140  argsinfo.addarginfo (NULL, arg_ainfo);
    135141}
     
    240246  }
    241247
    242   get_top (arg_cl, topparent);
    243 
    244   collectproto->get_filterinfo (collection, filterinfo, err, logout);
    245   if (err == noError) {
    246     // check that there's a browse filter
    247     if (filterinfo.filterNames.find ("BrowseFilter") != filterinfo.filterNames.end()) {
    248      
    249       metadata.push_back ("Title");
    250       metadata.push_back ("classifytype");
    251       get_children ("", collection, metadata, collectproto, response, logout);
    252 
    253       // don't do anything unless there are classifications
    254       if (!response.docInfo.empty()) {
    255 
    256     ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();
    257     ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();
     248  // don't want navigation bar if page is 'detached'
     249  if (!args.getintarg("x")) {
     250
     251    get_top (arg_cl, topparent);
     252   
     253    collectproto->get_filterinfo (collection, filterinfo, err, logout);
     254    if (err == noError) {
     255      // check that there's a browse filter
     256      if (filterinfo.filterNames.find ("BrowseFilter") != filterinfo.filterNames.end()) {
    258257   
    259     navigationbar = "<!-- Navigation Bar -->\n";
     258    metadata.push_back ("Title");
     259    metadata.push_back ("classifytype");
     260    get_children ("", collection, metadata, collectproto, response, logout);
     261   
     262    // don't do anything unless there are classifications
     263    if (!response.docInfo.empty()) {
    260264     
    261     // calculate width of spacers and set macro
    262     if (args.getintarg("v") == 0) {
    263       disp.expandstring ("Global", "_pagewidth_", width);
    264       twidth = width.getint();
     265      ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();
     266      ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();
    265267     
    266       disp.expandstring ("query", "_searchwidth_", width);
    267       iwidth += width.getint();
     268      navigationbar = "<!-- Navigation Bar -->\n";
    268269     
     270      // calculate width of spacers and set macro
     271      if (args.getintarg("v") == 0) {
     272        disp.expandstring ("Global", "_pagewidth_", width);
     273        twidth = width.getint();
     274       
     275        disp.expandstring ("query", "_searchwidth_", width);
     276        iwidth += width.getint();
     277       
     278        while (dochere != docend) {
     279          disp.expandstring ("document", "_" + (*dochere).metadata[0].values[0] + "width_", width);
     280          iwidth += width.getint();
     281          dochere ++;
     282        }
     283        if ((twidth - iwidth) < int(response.docInfo.size())) swidth = 2;
     284        else swidth = (twidth - iwidth) / response.docInfo.size();
     285        disp.setmacro ("widthtspace", "Global", swidth);
     286      }
     287     
     288      navigationbar += "<nobr>\n";
     289      if (args["a"] == "q") {
     290        navigationbar += "_icontabsearchgreen_";
     291      } else {
     292        navigationbar += "_imagesearch_";
     293        javaimagesnavbar = "_javasearch_";
     294      }
     295      dochere = response.docInfo.begin();
    269296      while (dochere != docend) {
    270         disp.expandstring ("document", "_" + (*dochere).metadata[0].values[0] + "width_", width);
    271         iwidth += width.getint();
     297        const text_t &title = (*dochere).metadata[0].values[0];
     298        const text_t &classifytype = (*dochere).metadata[1].values[0];
     299       
     300        // if we're inside a document all the classification buttons should be enabled
     301        if (arg_d.empty() && ((*dochere).OID == topparent))
     302          navigationbar += "_imagespacer__icontab" + title + "green_";
     303        else {
     304          navigationbar += "_imagespacer__image" + title + "_";
     305         
     306          // set the _httpbrowseXXX_ macro for this classification
     307          text_t link = (*dochere).OID;
     308          if (classifytype == "AZList" || classifytype == "Datelist") link += ".fc";
     309          disp.setmacro ("httpbrowse" + title, "Global",
     310                 "_httpdocument_&cl=" + link);
     311        }
     312        javaimagesnavbar += "_java" + title + "_";
    272313        dochere ++;
    273314      }
    274       if ((twidth - iwidth) < int(response.docInfo.size())) swidth = 2;
    275       else swidth = (twidth - iwidth) / response.docInfo.size();
    276       disp.setmacro ("widthtspace", "Global", swidth);
     315      navigationbar += "\n</nobr>\n";
     316      navigationbar += "<!-- End of Navigation Bar -->\n";
     317      disp.setmacro ("navigationbar", "Global", navigationbar);
     318      if (args.getintarg("v") == 0)
     319        disp.setmacro ("javaimagesnavbar", "Global", javaimagesnavbar);
    277320    }
    278    
    279     navigationbar += "<nobr>\n";
    280     if (args["a"] == "q") {
    281       navigationbar += "_icontabsearchgreen_";
    282     } else {
    283       navigationbar += "_imagesearch_";
    284       javaimagesnavbar = "_javasearch_";
    285     }
    286     dochere = response.docInfo.begin();
    287     while (dochere != docend) {
    288       const text_t &title = (*dochere).metadata[0].values[0];
    289       const text_t &classifytype = (*dochere).metadata[1].values[0];
    290 
    291       // if we're inside a document all the classification buttons should be enabled
    292       if (arg_d.empty() && ((*dochere).OID == topparent))
    293         navigationbar += "_imagespacer__icontab" + title + "green_";
    294       else {
    295         navigationbar += "_imagespacer__image" + title + "_";
    296 
    297         // set the _httpbrowseXXX_ macro for this classification
    298         text_t link = (*dochere).OID;
    299         if (classifytype == "AZList" || classifytype == "Datelist") link += ".fc";
    300         disp.setmacro ("httpbrowse" + title, "Global",
    301                "_httpdocument_&cl=" + link);
    302       }
    303       javaimagesnavbar += "_java" + title + "_";
    304       dochere ++;
    305     }
    306     navigationbar += "\n</nobr>\n";
    307     navigationbar += "<!-- End of Navigation Bar -->\n";
    308     disp.setmacro ("navigationbar", "Global", navigationbar);
    309     if (args.getintarg("v") == 0)
    310       disp.setmacro ("javaimagesnavbar", "Global", javaimagesnavbar);
    311       }
    312     }
    313   } else {
    314     logout << text_t2ascii
    315        << "Error (documentaction::define_external_macros()) in call to get_filterinfo() "
    316        << get_comerror_string (err);
     321      }
     322    } else {
     323      logout << text_t2ascii
     324         << "Error (documentaction::define_external_macros()) in call to get_filterinfo() "
     325         << get_comerror_string (err);
     326    }
    317327  }
    318328}
     
    326336  // define_internal_macros sets the following macros:
    327337
     338  // _random_               a random number - used for setting target tags to display
     339  //                        a random page when you hit the 'detach' button
     340
    328341  // _pagetitle_            the title to be displayed at the top of the browser window
    329342 
     
    347360  if (collectproto == NULL) return;
    348361
     362  disp.setmacro("random", "document", rand());
    349363 
    350364  text_tarray metadata;
Note: See TracChangeset for help on using the changeset viewer.