Changeset 15969 in project


Ignore:
Timestamp:
09/19/09 16:24:50 (10 years ago)
Author:
sjamaan
Message:

Implement a hook to delete qwiki files, and hook it in the search plugin

Location:
release/4/qwiki/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/qwiki/trunk/qwiki-search.scm

    r15967 r15969  
    9090    (put-document (search-server-uri) "qwiki" contents attribs)))
    9191
    92 (define (remove-search-entry! path)
    93   (delete-document (search-server-uri) uri: (string-join path "/")))
     92(define (delete-search-entry! path)
     93  (delete-document (search-server-uri) "qwiki" uri: (string-join path "/")))
    9494
    9595(define search-rules
     
    144144                                      (qwiki-global-action-handlers)))
    145145  (qwiki-extensions (cons search-rules (qwiki-extensions)))
    146   (qwiki-update-handlers (cons update-search-entry! (qwiki-update-handlers))))
     146  (qwiki-update-handlers (cons update-search-entry! (qwiki-update-handlers)))
     147  (qwiki-delete-handlers (cons delete-search-entry! (qwiki-delete-handlers))))
    147148
    148149)
  • release/4/qwiki/trunk/qwiki.scm

    r15967 r15969  
    4848   qwiki-page-action-handlers
    4949   qwiki-update-handlers
     50   qwiki-update-file!
     51   qwiki-delete-handlers
     52   qwiki-delete-file!
    5053   send-content)
    5154
     
    7477
    7578(define qwiki-update-handlers
     79  (make-parameter (list)))
     80
     81(define qwiki-delete-handlers
    7682  (make-parameter (list)))
    7783
     
    274280              (when (or (not (file-exists? html-file))
    275281                        (file-newer? source-file html-file))
    276                 (update-file! path))
     282                (qwiki-update-file! path))
    277283             (send-static-file html-file)))
    278284        (redirect-to-qwiki-page req action: "edit"))))
     
    289295          (output-xml content (qwiki-transformation-steps content)))))))
    290296
    291 (define (update-file! path)
     297(define (qwiki-update-file! path)
    292298  (let* ((source-file (path->source-filename path))
    293299         (page (call-with-input-file source-file wiki-parse)))
    294300    (for-each (lambda (handler) (handler path page))
    295301              (cons regenerate-html-file! (qwiki-update-handlers)))))
     302
     303(define (delete-html-file! path)
     304  (delete-file* (make-pathname (root-path) (path->html-filename path))))
     305
     306(define (qwiki-delete-file! path)
     307  (for-each (lambda (handler) (handler path))
     308            (cons delete-html-file! (qwiki-delete-handlers))))
    296309
    297310;;; Request dispatching
Note: See TracChangeset for help on using the changeset viewer.