[Pmwiki-users] upload link format

Eugene Van den Bulke [EGN] evandenbulke
Tue Aug 31 01:58:11 CDT 2004


I found a solution which I don't find very elegant

changing the code of FmtAttachLink in upload.php (problem when I will 
update PmWiki it will disappear).

function FmtAttachLink($pat,$ref,$txt) {
  global $UploadName,$UploadFileFmt,$pagename,$UploadFormTarget,$FmtUrlLink;
  preg_match("/^([^:]*):(.*)$/",$ref,$match);
  $rtxt=$ref;  if (!is_null($txt)) $rtxt=$txt;
  $UploadName = $match[2];
  $filepath = FmtPageName($UploadFileFmt,$pagename).$UploadName;
  if (!file_exists($filepath)) {
    $target = ($UploadFormTarget) ? "target='$UploadFormTarget'" : '';
    return "$rtxt<a href='".FmtPageName('$PageUrl?action=upload',$pagename).
      "&amp;upname=".urlencode($UploadName)."' $target>?</a>";
  } else {
      //file exist special format required adding [u] for update
      $target = ($UploadFormTarget) ? "target='$UploadFormTarget'" : '';
      $man=$FmtUrlLink($pat,$ref,$txt)." [<a 
href='".FmtPageName('$PageUrl?action=upload',$pagename).
      "&amp;upname=".urlencode($UploadName)."' $target>u</a>]";
      return $man;
  }
 //I don't want that format     
 // return $FmtUrlLink($pat,$ref,$txt);
}

feedback and advices are more than welcome it is the first time I fiddle 
with the code ;)

Eugene Van den Bulke [EGN] wrote:

> Hi all,
>
> I would like an Attach:foo.bar link to look like Attach:foo.bar[u] 
> where cliking on the u will open the upload form for an update of the 
> Attach document.
>
> How can I do that?
>
> Thanks for your help
>
> EuGeNe
>




More information about the pmwiki-users mailing list