Built motion from commit 67e5df37.|2.0.66
[motion2.git] / public / assets / plugins / ckeditor / plugins / googledocs / dialogs / googledocs.js
1 CKEDITOR.dialog.add("googledocs", function(a) {
2     return {
3         title: a.lang.googledocs.title,
4         width: 400,
5         height: 350,
6         onLoad: function() {
7             getDocuments()
8         },
9         contents: [{
10             id: "settingsTab",
11             label: a.lang.googledocs.settingsTab,
12             elements: [{
13                 type: "select",
14                 id: "documents",
15                 className: "googledocs",
16                 label: a.lang.googledocs.selectDocument,
17                 items: [],
18                 "default": "",
19                 size: 4,
20                 onChange: function() {
21                     CKEDITOR.dialog.getCurrent().getContentElement("settingsTab", "txtUrl").setValue(this.getValue())
22                 }
23             }, {
24                 type: "text",
25                 id: "txtUrl",
26                 label: a.lang.googledocs.url,
27                 required: !0,
28                 validate: CKEDITOR.dialog.validate.notEmpty(a.lang.googledocs.alertUrl)
29             }, {
30                 type: "hbox",
31                 widths: ["60px", "330px"],
32                 className: "googledocs",
33                 children: [{
34                     type: "text",
35                     width: "45px",
36                     id: "txtWidth",
37                     label: a.lang.common.width,
38                     "default": 710,
39                     required: !0,
40                     validate: CKEDITOR.dialog.validate.integer(a.lang.googledocs.alertWidth)
41                 }, {
42                     type: "text",
43                     id: "txtHeight",
44                     width: "45px",
45                     label: a.lang.common.height,
46                     "default": 920,
47                     required: !0,
48                     validate: CKEDITOR.dialog.validate.integer(a.lang.googledocs.alertHeight)
49                 }]
50             }]
51         }, {
52             id: "uploadTab",
53             label: a.lang.googledocs.uploadTab,
54             filebrowser: "uploadButton",
55             elements: [{
56                 type: "file",
57                 id: "upload"
58             }, {
59                 type: "fileButton",
60                 id: "uploadButton",
61                 label: a.lang.googledocs.btnUpload,
62                 filebrowser: {
63                     action: "QuickUpload",
64                     onSelect: function(a) {
65                         getDocuments(a)
66                     }
67                 },
68                 "for": ["uploadTab", "upload"]
69             }]
70         }],
71         onOk: function() {
72             var b = a.document.createElement("iframe"),
73                 c = encodeURIComponent(this.getValueOf("settingsTab", "txtUrl"));
74             b.setAttribute("src", "http://docs.google.com/viewer?url=" + c + "&embedded=true");
75             b.setAttribute("width", this.getValueOf("settingsTab",
76                 "txtWidth"));
77             b.setAttribute("height", this.getValueOf("settingsTab", "txtHeight"));
78             b.setAttribute("style", "border: none;");
79             a.insertElement(b)
80         },
81         onShow: function() {
82             getDocuments()
83         }
84     }
85 });
86 var getDocuments = function(a) {
87     CKEDITOR.env.ie7Compat && fixIE7display();
88     $.get(CKEDITOR.currentInstance.config.filebrowserGoogledocsBrowseUrl, function(b) {
89         var c = CKEDITOR.dialog.getCurrent().getContentElement("settingsTab", "documents");
90         c.clear();
91         $.each(b, function(a, b) {
92             c.add(b.name, b.url)
93         });
94         c.setValue(a);
95         console.log(a);
96         a && c.focus()
97     }, "json")
98 };