|
@@ -1,7 +1,9 @@
|
|
package actions
|
|
package actions
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
"net/http"
|
|
"net/http"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
type hRun func(e *Action)
|
|
type hRun func(e *Action)
|
|
@@ -23,6 +25,21 @@ func (e *Action) write(data string) {
|
|
(*e.W).Write([]byte(data))
|
|
(*e.W).Write([]byte(data))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (e *Action) msg_show(title string, msg string) {
|
|
|
|
+ e.write(fmt.Sprintf(
|
|
|
|
+ `ModalShowMsg('%s', '%s');`,
|
|
|
|
+ strings.Replace(strings.Replace(title, `'`, `’`, -1), `"`, `”`, -1),
|
|
|
|
+ strings.Replace(strings.Replace(msg, `'`, `’`, -1), `"`, `”`, -1)))
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (e *Action) msg_success(msg string) {
|
|
|
|
+ e.msg_show("Success", msg)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (e *Action) msg_error(msg string) {
|
|
|
|
+ e.msg_show("Error", msg)
|
|
|
|
+}
|
|
|
|
+
|
|
func New(w *http.ResponseWriter, r *http.Request, vhost string, vhosthome string, remoteip string) *Action {
|
|
func New(w *http.ResponseWriter, r *http.Request, vhost string, vhosthome string, remoteip string) *Action {
|
|
act := Action{w, r, vhost, vhosthome, remoteip, make(map[string]hRun)}
|
|
act := Action{w, r, vhost, vhosthome, remoteip, make(map[string]hRun)}
|
|
|
|
|