misc:software:Gauche:アップローダー

misc:software:Gauche:アップローダー

ソースコードの配布ページ

*download-only* の値によって、表示するフォームを切り替える

(define (control-form category selected-files)
  (define (category-options)
    (map
     (lambda (path)
       `(,(html:option
           :name "c"
           :value path
           :selected (equal? path category)
           path)))
     (category-names)))
  (if (not *download-only*)
      (html:div
       :class "controls"
       (html:form
        :action (script-name)
        :method "POST"
        :enctype "multipart/form-data"
        (html:div
         :class "upload-control"
         (html:input :type "hidden" :name "s" :value category)
         (html:input :type "file" :name "uploaded-file" :value "")
         " "
         (html:input :type "submit" :name "upload-file" :value "アップロード")))
       (html:form
        :action (script-name)
        :method "POST"
        (html:div
         :class "category-control"
         (html:input :type "hidden" :name "s" :value category)
         (html:select :name "c" :title "カテゴリ" (category-options))
         " "
         (html:input :type "submit" :name "change-category" :value "変更")
         " "
         (html:input :type "text" :name "new-category-name" :value "")
         " "
         (html:input :type "submit" :name "create-category" :value "作成")
         " "
         (html:input :type "submit" :name "delete-category" :value "削除"))
        (html:div
         :class "file-control"
         (html:input :type "submit" :name "toggle-files" :value "反転")
         " "
         (html:input :type "submit" :name "move-files" :value "移動")
         " "
         (html:input :type "submit" :name "copy-files" :value "コピー")
         " "
         (html:input :type "submit" :name "delete-files" :value "削除"))
        (html:div
         :class "files-selector"
         (files-view category selected-files))))
      (html:form
       :action (script-name)
       :method "POST"
       (html:div
        :class "files-selector"
        (files-view category selected-files)))))

html の head の中で、ページの文字コードを設定する

(define (main-page category selected-files)
  `(,(cgi-header
       :content-type #`"text/html; char-set=,(gauche-character-encoding)"
       :Pragma "no-cache"
       :Cache-control "no-cache")
     ,(html-doctype)
     ,(html:html
        (html:head 
         (html:title (html-escape-string category))
         (html:meta :http-equiv "Content-Type" :content "text/html; charset=utf-8" )
         (map
          (lambda (css)
            (html:link :rel "stylesheet" :href css))
          *css-files*))
        (html:body
          (html:div (or *menu-html* ""))
          (html:h1 (html-escape-string category))
          (control-form category selected-files)
          (html:div
            :class "footer"
            :style "text-align: right"
            (sys-basename (script-name)) " / version: " *my-version*)))))

Last modified : 2016/12/28 17:30:56 JST