Example #1
0
    def execute(self):
        web = WebContainer.get_web()
        if web.get_form_value("Add Annotation") == "":
            return

        annotate_msg = web.get_form_value("annotate_msg")
        if annotate_msg == "":
            return

        xpos = web.get_form_value("mouse_xpos")
        ypos = web.get_form_value("mouse_ypos")
        file_code = web.get_form_value("file_code")

        user = web.get_user_name()

        annotate = SObject("sthpw/annotation")
        annotate.set_value("message", annotate_msg)
        annotate.set_value("xpos", xpos)
        annotate.set_value("ypos", ypos)
        annotate.set_value("login", user)
        annotate.set_value("file_code", file_code)
        annotate.commit()

        self.description = "Added annotation '%s'" % annotate_msg