Ignore:
Timestamp:
1999-08-20T12:56:38+12:00 (25 years ago)
Author:
sjboddie
Message:

added cgisafe option - you can now do something like [cgisafe:Title] if
you want Title to be entered safely into a url

File:
1 edited

Legend:

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

    r442 r462  
    1212/*
    1313   $Log$
     14   Revision 1.8  1999/08/20 00:56:38  sjboddie
     15   added cgisafe option - you can now do something like [cgisafe:Title] if
     16   you want Title to be entered safely into a url
     17
    1418   Revision 1.7  1999/08/10 22:38:08  sjboddie
    1519   added some more format options
     
    4145
    4246#include "formattools.h"
    43 
     47#include "cgiutils.h"
    4448
    4549// a few function prototypes
     
    5458  metaname.clear();
    5559  metaindex = 0;
     60  metacommand = mNone;
    5661  parentcommand = pNone;
    5762  parentindex = 0;
     
    194199  else {
    195200    formatlistptr->command = comMeta;
     201
     202    if (meta.size() > 8 && (substr(meta.begin(), meta.begin()+8) == "cgisafe:")) {
     203      formatlistptr->meta.metacommand = mCgiSafe;
     204      meta = substr (meta.begin()+8, meta.end());
     205    }
     206
    196207    if (meta.size() > 7 && (substr (meta.begin(), meta.begin()+6) == "parent")) {
    197208      getParents = true;
     
    199210      get_parent_options (meta, metaoption);
    200211      formatlistptr->meta = metaoption;
    201     }
     212    }
     213
    202214    text_tmap::const_iterator it;
    203215    if ((it = metamap.find(meta)) != metamap.end()) {
     
    408420  switch (meta.parentcommand) {
    409421  case pNone:
    410     if (meta.metaname == "Date") 
     422    if (meta.metaname == "Date")
    411423      return format_date (docinfo.metadata[mindex].values.back());
    412     return docinfo.metadata[mindex].values.back();
     424    if (meta.metacommand == mCgiSafe)
     425      return cgi_safe (docinfo.metadata[mindex].values.back());
     426    else return docinfo.metadata[mindex].values.back();
    413427
    414428  case pImmediate:
     
    416430      if (meta.metaname == "Date")
    417431    return format_date (docinfo.metadata[mindex].values[metasize-2]);
    418       return docinfo.metadata[mindex].values[metasize-2];
     432    if (meta.metacommand == mCgiSafe)
     433      return cgi_safe (docinfo.metadata[mindex].values[metasize-2]);
     434    else return docinfo.metadata[mindex].values[metasize-2];
    419435    }
    420436    break;
     
    424440      if (meta.metaname == "Date")
    425441    return format_date (docinfo.metadata[mindex].values[0]);
    426       return docinfo.metadata[mindex].values[0];
     442    if (meta.metacommand == mCgiSafe)
     443      return cgi_safe (docinfo.metadata[mindex].values[0]);
     444    else return docinfo.metadata[mindex].values[0];
    427445    }
    428446    break;
     
    432450      if (meta.metaname == "Date")
    433451    return format_date (docinfo.metadata[mindex].values[meta.parentindex]);
    434       return docinfo.metadata[mindex].values[meta.parentindex];
     452      if (meta.metacommand == mCgiSafe)
     453    return cgi_safe (docinfo.metadata[mindex].values[meta.parentindex]);
     454      else return docinfo.metadata[mindex].values[meta.parentindex];
    435455    }
    436456    break;
     
    452472      }
    453473    }
    454     return tmp;
     474    if (meta.metacommand == mCgiSafe) return cgi_safe (tmp);
     475    else return tmp;
    455476  }
    456477  return "";
Note: See TracChangeset for help on using the changeset viewer.