Commit e2197e56 authored by David Byers's avatar David Byers
Browse files

> Fix bug 919:

> 	* faqs.el (lyskom-change-faq-3): Handle creating FAQs.
> 	(lyskom-change-faq-2): Ditto.
> 	(lyskom-change-faq): When there is no FAQ, create a new FAQ.
>
parent ee0a343f
2002-12-16 David Byers <david.byers@swipnet.se>
Fix bug 919:
* faqs.el (lyskom-change-faq-3): Handle creating FAQs.
(lyskom-change-faq-2): Ditto.
(lyskom-change-faq): When there is no FAQ, create a new FAQ.
Fix bug 305:
* lyskom-buttons.el (lyskom-button-transform-text): Added support
for bugzilla links.
......
......@@ -1457,6 +1457,8 @@ On since %#8s%#9s")
(conf-has-no-faq . "%#1?b%[%#1M%]%[The server%] has no FAQ\n")
(view-which-faq . "View FAQ for which conference? ")
(review-faq-for-r . "View FAQ for %#1?b%[%#1M%]%[the server%].\n")
(set-faq-for-conf-done . "FAQ for %#1?b%[%#1M%]%[the server%] set to text %#3n.\n")
(set-faq-for-conf-failed . "Unable to set the FAQ for %#1?b%[%#1M%]%[the server%] to text %#3n.\n")
(changed-faq-for-conf-done . "FAQ in text %#2n for %#1?b%[%#1M%]%[the server%] changed to text %#3n.\n")
(changed-faq-for-conf-failed . "Unable to change FAQ for %#1?b%[%#1M%]%[the server%] to text %#3n.
%#2?b%[Text %#2n is still the FAQ.
......
......@@ -251,51 +251,54 @@ The text to add is passed in TEXT-NO"
(defun lyskom-change-faq (conf-stat aux-list)
"Change a FAQ for a conference."
(if (null aux-list)
(lyskom-format-insert 'conf-has-no-faq conf-stat)
;; Get a list of FAQ texts and corresponding aux-item-numbers
;; Get the FAQ to change
(let* ((faq-list (mapcar (lambda (x)
;; Get a list of FAQ texts and corresponding aux-item-numbers
;; Get the FAQ to change
(let* ((faq-list (mapcar (lambda (x)
(cons (aux-item->data x)
(aux-item->aux-no x)))
aux-list))
(text-no-aux (cond ((= (length faq-list) 1) (car faq-list))
(t (lyskom-string-assoc
(lyskom-completing-read
(lyskom-get-string 'text-to-change-as-faq)
(lyskom-maybe-frob-completion-table
faq-list)
nil t)
faq-list))))
(text-no (string-to-int (car text-no-aux)))
(aux-no (cdr text-no-aux)))
(cond
;; If conf-stat is null we are changing the FAQ for the server.
;; Don't do this unless we are running enabled and have the right
;; privileges.
((and (null conf-stat)
(or (not lyskom-is-administrator)
(not (privs->admin (pers-stat->privileges
(blocking-do 'get-pers-stat
lyskom-pers-no))))))
(lyskom-format-insert 'not-supervisor-for-server))
;; If we have a conf-stat and are not administrator and not
;; supervisor for the conf, then we are not allowed to change
;; the FAQ.
((and conf-stat
(not lyskom-is-administrator)
(not (lyskom-is-supervisor (conf-stat->conf-no conf-stat)
lyskom-pers-no)))
(lyskom-format-insert 'not-supervisor-for conf-stat))
;; OK, it looks like we are allowed to change the FAQ.
(t
(blocking-do-multiple ((text-stat (get-text-stat text-no))
(text-mass (get-text text-no)))
(text-no-aux (cond ((= (length faq-list) 1) (car faq-list))
((null faq-list) nil)
(t (lyskom-string-assoc
(lyskom-completing-read
(lyskom-get-string 'text-to-change-as-faq)
(lyskom-maybe-frob-completion-table
faq-list)
nil t)
faq-list))))
(text-no (and text-no-aux (string-to-int (car text-no-aux))))
(aux-no (and text-no-aux (cdr text-no-aux))))
(cond
;; If conf-stat is null we are changing the FAQ for the server.
;; Don't do this unless we are running enabled and have the right
;; privileges.
((and (null conf-stat)
(or (not lyskom-is-administrator)
(not (privs->admin (pers-stat->privileges
(blocking-do 'get-pers-stat
lyskom-pers-no))))))
(lyskom-format-insert 'not-supervisor-for-server))
;; If we have a conf-stat and are not administrator and not
;; supervisor for the conf, then we are not allowed to change
;; the FAQ.
((and conf-stat
(not lyskom-is-administrator)
(not (lyskom-is-supervisor (conf-stat->conf-no conf-stat)
lyskom-pers-no)))
(lyskom-format-insert 'not-supervisor-for conf-stat))
;; OK, it looks like we are allowed to change the FAQ.
(t (let ((text-stat nil)
(text-mass nil))
;; Get the old text (if there is one)
(blocking-do-multiple ((ts (get-text-stat text-no))
(tm (get-text text-no)))
(setq text-stat ts text-mass tm))
(let* ((str (and text-mass (text->decoded-text-mass text-mass
text-stat)))
(subject (if (and str (string-match "\n" str))
......@@ -317,8 +320,8 @@ The text to add is passed in TEXT-NO"
body
'lyskom-change-faq-2
conf-stat
(text-stat->text-no text-stat)
aux-no))))))))
(and text-stat (text-stat->text-no text-stat))
aux-no)))))))
(defun lyskom-change-faq-2 (text-no conf-stat old-text-no old-aux-no)
......@@ -348,13 +351,18 @@ The text to add is passed in TEXT-NO"
text-no))))
(defun lyskom-change-faq-3 (retval conf-stat old-text-no text-no)
(cache-del-text-stat text-no)
(if retval
(lyskom-format-insert-before-prompt 'changed-faq-for-conf-done conf-stat
old-text-no
text-no)
(lyskom-format-insert-before-prompt 'changed-faq-for-conf-failed conf-stat
old-text-no text-no
(lyskom-current-error))))
(lyskom-format-insert-before-prompt
(if old-text-no 'changed-faq-for-conf-done 'set-faq-for-conf-done)
conf-stat
old-text-no
text-no)
(lyskom-format-insert-before-prompt
(if old-text-no 'changed-faq-for-conf-failed 'set-faq-for-conf-failed)
conf-stat
old-text-no text-no
(lyskom-current-error))))
......
......@@ -1472,6 +1472,8 @@ Uppkopplad sedan %#8s%#9s")
(conf-has-no-faq . "%#1?b%[%#1M%]%[Servern%] har ingen FAQ\n")
(view-which-faq . "terse FAQ fr vilket mte? ")
(review-faq-for-r . "terse FAQ fr %#1?b%[%#1M%]%[servern%].\n")
(set-faq-for-conf-done . "Text %#3n r nu FAQ fr %#1?b%[%#1M%]%[servern%].\n")
(set-faq-for-conf-failed . "Kunde inte stta FAQ fr %#1?b%[%#1M%]%[servern%] till text %#3n.\n")
(changed-faq-for-conf-done . "FAQ i text %#2n fr %#1?b%[%#1M%]%[servern%] ndrad till text %#3n.\n")
(changed-faq-for-conf-failed . "Kunde inte ndra FAQ fr %#1?b%[%#1M%]%[servern%] till text %#3n.
%#2?b%[Text %#2n r fortfarande FAQ.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment