[Zope] HTML EDITORS

John A Chaves chaves@acm.org
Fri, 26 May 2000 17:19:55 -0500


Phil Harris wrote:
> 
> I'd like to third that but Can't because GVIM doesn't have a FTP client.

You can simulate one fairly easily.  The attached script (which would need
to be tweaked for your environment) ftp-gets the zope object into a temp
directory.  It also creates a Makefile in the temp directory which ftp-puts
the object back into zope.  You can then use the GVIM "make" button (looks
like a hammer) to save your changes and push them back to zope.

==== zope-ftpedit ====
#!/bin/sh

. $HOME/zope/setenv
TOOL=gvim

usage="$0 [hostname] filepath"

case $# in
  1)  MACHINE=`uname -n`
      TARGET=$1
      ;;
  2)  MACHINE=$1
      TARGET=$2
      ;;
  *)  echo "$usage"; exit 1;;
esac

# account name and password kept in separate file
OPTS="-f $HOME/zope/etc/ncftp.$MACHINE -P $ZOPE_FTP"
TDIR="`dirname $TARGET`"
TFILE="`basename $TARGET`"


# make tmp dir

TMPBASE=/tmp/`basename $0`
NUM=$$
while [ -e $TMPBASE.$NUM ]
do
  NUM=`expr $NUM + 1`
done
TMPDIR=$TMPBASE.$NUM

mkdir $TMPDIR || exit 1
cd $TMPDIR || exit 1

# load requested file

GETCMD="ncftpget $OPTS . $TARGET"
PUTCMD="ncftpput $OPTS $TDIR $TFILE"

cat <<!! >Makefile || exit 1
# tmpdir is $TMPDIR

timestamp: $TFILE
        $PUTCMD
        touch timestamp

put:
        $PUTCMD

get:
        $GETCMD

edit:
        $TOOL $TFILE
!!

echo "$0 tmpdir is $TMPDIR"
make get edit

# vim:sw=2:sts=2