from MaKaC.webinterface.pages import admins
import MaKaC.webinterface.urlHandlers as urlHandlers
import MaKaC.webinterface.wcomponents as wcomponents
from MaKaC.common.Announcement import getAnnoucementMgrInstance
from cgi import escape

class WPAnnouncementModif(admins.WPAdminsBase):
    
    def _getBody( self, params ):
        wc = WAnnouncementModif()
        pars = {"saveURL": urlHandlers.UHAnnouncementSave.getURL() }    
        return wc.getHTML( pars )   


class WAnnouncementModif(wcomponents.WTemplated):
    
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        an = getAnnoucementMgrInstance()
        vars["announcement"] = escape(an.getText()).replace("\"", "&#34;")
        vars["speed"] = an.getSpeed()
        return vars
    
