source: trunk/plugins/InsertSnippet/popups/insertsnippet.html @ 1269

Last change on this file since 1269 was 858, checked in by ray, 12 years ago
  • fixed some HTML errors in various files
  • add setValues() to Xinha.PanelDialog?.prototype.show()
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 3.9 KB
Line 
1<!DOCTYPE html
2                 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6<head>
7<title>Insert Snippet</title>
8<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
9<link rel="stylesheet" type="text/css" href="../InsertSnippet.css" />
10<script type="text/javascript" src="../../../popups/popup.js"></script>
11<script type="text/javascript">
12
13var InsertSnippet = window.opener.InsertSnippet;
14var editor = null;
15
16
17function Init() {
18        __dlg_translate("InsertSnippet");
19        __dlg_init(null, {width:800,height:600});
20
21        var config = window.dialogArguments;
22 
23        var snippets = config.snippets;
24       
25        if ( config.pageStyle && !Xinha.is_ie)
26    {
27                var style = document.createElement("style");
28                style.type = "text/css";
29                style.innerHTML = config.pageStyle;
30                document.getElementsByTagName("HEAD")[0].appendChild(style);
31    }
32   
33        if ( typeof config.pageStyleSheets !== 'undefined' )
34        {
35                for ( var i = 0; i < config.pageStyleSheets.length; i++ )
36                {
37                        var style = document.createElement("link");
38                        style.type = "text/css";
39                        style.rel = 'stylesheet';
40                        style.href =    config.pageStyleSheets[i];
41                        document.getElementsByTagName("HEAD")[0].appendChild(style);
42                }
43        }
44               
45        var tbody = document.getElementById("snippettable");
46        var snippet_html;
47        var snippet_name;
48        var trow;
49        for(var i = 0; i < snippets.length; i++)
50        {
51                trow = tbody.insertRow(i);
52                snippet_html = snippets[i]['HTML'];
53                snippet_name = snippets[i]['id'];
54         
55                var insertAsVariable = '';
56                if (config.InsertSnippet.showInsertVariable)
57                {
58                        insertAsVariable = ' | <a href="javascript:onOK('+i+','+'\'variable\''+')">'+Xinha._lc("Variable","InsertSnippet")+'</a>';
59                }
60                var new_cell = trow.insertCell(0);
61                new_cell.innerHTML = snippet_name +': '+Xinha._lc("Insert as","InsertSnippet")+' <a href="javascript:onOK('+i+','+'\'html\''+')">HTML</a>'+insertAsVariable + ' (<a id="show_preview'+i+'" href="javascript:preview(\'show\','+i+')">'+Xinha._lc("Show preview","InsertSnippet")+'</a>)<div id="preview'+i+'" style="display:none">'+snippets[i]['HTML']+'</div>';
62                new_cell.id = 'cell' + i;
63                       
64        }
65
66        document.body.onkeypress = __dlg_key_press;
67}
68
69function preview(action,i) {
70        var show_preview_link = document.getElementById('show_preview'+i);
71        switch(action)
72        {
73                case 'show':
74                        document.getElementById('preview'+i).style.display = 'block';
75                        show_preview_link.innerHTML = Xinha._lc("Hide preview","InsertSnippet");
76                        show_preview_link.href = "javascript:preview('hide','"+i+"');";
77                       
78                break;
79                case 'hide':
80                        document.getElementById('preview'+i).style.display = 'none';
81                        show_preview_link.innerHTML = Xinha._lc("Show preview","InsertSnippet");
82                        show_preview_link.href = "javascript:preview('show','"+i+"');";
83                break;
84        }
85}
86function onCancel() {
87        __dlg_close(null);
88        return false;
89}
90
91function onOK(snippetnum,how) {
92        var params = new Object();
93        params["snippetnum"] = snippetnum;
94        params["how"] = how;
95        __dlg_close(params);
96        return false;
97}
98
99function __dlg_key_press(ev) {
100        ev || (ev = window.event);
101        switch(ev.keyCode) {
102                case 13:
103                document.getElementById('bt_ok').click();
104                        break;
105                case 27:
106                __dlg_close();
107                return false;
108        }
109return true;
110}
111</script>
112
113<style type="text/css">
114body {margin:0 !IMPORTANT;padding:0 !IMPORTANT;}
115.buttons {border-top: 1px solid #999; padding: 5px; text-align: right; height: 20px; }
116td {background:white;padding:5px;border:1px solid;border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;}
117.preview {}
118</style>
119</head>
120<body class="dialog" onload="Init()">
121<form action="" method="get">
122  <div class="title" >Insert Snippet</div>
123  <div style="height:470px;overflow:auto;">
124  <table style="border: 0; width: 100%;" id="snippettable">
125  </table>
126  </div>
127<div class="space"></div>
128<div class="buttons">
129<button type="button" onclick="return onCancel();">Cancel</button>
130</div>
131</form>
132</body>
133</html>
Note: See TracBrowser for help on using the repository browser.