~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/extensions/xmlterm/scripts/xls.csh

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/csh
 
2
# xls.csh: a C-shell XMLterm wrapper for the UNIX "ls" command
 
3
# Usage: xls.csh [-i] [-x]
 
4
 
 
5
set files=(`/bin/ls -d $cwd/*`)
 
6
set ncols=4
 
7
 
 
8
##set echocmd="/usr/bin/echo"
 
9
set echocmd="/bin/echo -e"
 
10
 
 
11
set iconic=0
 
12
set create=0
 
13
 
 
14
set options=""
 
15
foreach arg ($*)
 
16
   switch ($arg)
 
17
   case "-i":
 
18
      set iconic=1
 
19
      set options=($options $arg)
 
20
      breaksw
 
21
   case "-c":
 
22
      set create=1
 
23
      set options=($options $arg)
 
24
      breaksw
 
25
   endsw
 
26
end
 
27
 
 
28
$echocmd "\033{S${LTERM_COOKIE}\007\c"
 
29
$echocmd '<TABLE FRAME=none BORDER=0>'
 
30
$echocmd "<COLGROUP COLSPAN=$ncols WIDTH=1*>"
 
31
 
 
32
set rowimg=""
 
33
set rowtxt=""
 
34
set nfile=0
 
35
foreach file ($files)
 
36
   if (-d $file) then       #directory
 
37
      set filetype="directory"
 
38
      set sendtxt="cd $file; xls $options"
 
39
      set sendimg="file:/usr/share/pixmaps/mc/i-directory.png"
 
40
#      set sendimg="chrome://xmlterm/skin/default/images/ficon3.gif"
 
41
   else if (-x $file) then  #executable
 
42
      set filetype="executable"
 
43
      set sendtxt="$file"
 
44
      set sendimg="file:/usr/share/pixmaps/mc/i-executable.png"
 
45
   else                     #plain file
 
46
      set filetype="plainfile"
 
47
      set sendtxt=""
 
48
      set sendimg="file:/usr/share/pixmaps/mc/i-regular.png"
 
49
   endif
 
50
 
 
51
   set tail=${file:t}
 
52
 
 
53
   if ($create) then
 
54
      set cmd="createln"
 
55
   else
 
56
      set cmd="sendln"
 
57
   endif
 
58
   set clickcmd="onClick="'"'"return ClickXMLTerm('$cmd',-1,'$sendtxt')"'"'
 
59
 
 
60
   set rowimg="${rowimg}<TD><IMG SRC='$sendimg' $clickcmd>"
 
61
   set rowtxt="${rowtxt}<TD><SPAN CLASS='$filetype' $clickcmd>"
 
62
   set rowtxt="${rowtxt}$tail<SPAN/>"
 
63
@  nfile++
 
64
 
 
65
   if (($nfile % $ncols) == 0) then
 
66
      if ($iconic) $echocmd "<TR>$rowimg"
 
67
      $echocmd "<TR>$rowtxt"
 
68
      set rowimg=""
 
69
      set rowtxt=""
 
70
   endif
 
71
 
 
72
end
 
73
 
 
74
if ("$rowtxt" != "") then
 
75
   if ($iconic) $echocmd "<TR>$rowimg"
 
76
   $echocmd "<TR>$rowtxt"
 
77
endif
 
78
 
 
79
$echocmd '</TABLE>'
 
80
$echocmd '\000\c'
 
81