text.html
7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文本框</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
<meta name="generator" content="www.leipi.org" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
<![endif]-->
<!--[if lte IE 7]>
<link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
<![endif]-->
<link rel="stylesheet" href="leipi.style.css">
<script type="text/javascript" src="../dialogs/internal.js"></script>
<script type="text/javascript">
/* Thank you by
http://www.alt-tag.com/blog/2006/02/ie-dom-bugs/ */
function createElement(type, name)
{
var element = null;
try {
element = document.createElement('<'+type+' name="'+name+'">');
} catch (e) {}
if(element==null) {
element = document.createElement(type);
element.name = name;
}
return element;
}
</script>
</head>
<body>
<div class="content">
<table class="table table-bordered table-striped table-hover">
<tr>
<th><span>控件名称</span><span class="label label-important">*</span></th>
<th><span>默认值</span> </th>
</tr>
<tr>
<td><input type="text" id="orgname" placeholder="必填项"></td>
<td><input type="text" id="orgvalue" placeholder="无则不填"></td>
</tr>
<tr>
<th><span>数据类型</span> </th>
<th><span>对齐方式</span> </th>
</tr>
<tr>
<td>
<select id="orgtype">
<option value="text">普通文本</option>
<option value="email">邮箱地址</option>
<option value="int">整数</option>
<option value="float">小数</option>
<option value="idcard">身份证号码</option>
</select>
</td>
<td>
<select id="orgalign">
<option value="left" >左对齐</option>
<option value="center">居中对齐</option>
<option value="right">右对齐</option>
</select>
</td>
</tr>
<tr>
<th><span> 长 X 宽 & 字体大小</span> </th>
<th><span>可见性</span> </th>
</tr>
<tr>
<td>
<input id="orgwidth" type="text" value="150" class="input-small span1" placeholder="auto"/>
X
<input id="orgheight" type="text" value="" class="input-small span1" placeholder="auto"/>
&
<input id="orgfontsize" type="text" value="" class="input-small span1" placeholder="auto"/> px
</td>
<td>
<label class="checkbox inline"><input id="orghide" type="checkbox"/> 隐藏 </label>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var oNode = null,thePlugins = 'text';
window.onload = function() {
if( UE.plugins[thePlugins].editdom ){
oNode = UE.plugins[thePlugins].editdom;
var gValue = '';
if(oNode.getAttribute('value'))
gValue = oNode.getAttribute('value').replace(/"/g,"\"");
var gTitle=oNode.getAttribute('title').replace(/"/g,"\""),gHidden=oNode.getAttribute('orghide'),gFontSize=oNode.getAttribute('orgfontsize'),gAlign=oNode.getAttribute('orgalign'),gWidth=oNode.getAttribute('orgwidth'),gHeight=oNode.getAttribute('orgheight'),gType=oNode.getAttribute('orgtype');
gValue = gValue==null ? '' : gValue;
gTitle = gTitle==null ? '' : gTitle;
$G('orgvalue').value = gValue;
$G('orgname').value = gTitle;
if (gHidden == '1')
{
$G('orghide').checked = true;
}
$G('orgfontsize').value = gFontSize;
$G('orgwidth').value = gWidth;
$G('orgheight').value = gHeight;
$G('orgalign').value = gAlign;
$G('orgtype').value = gType;
}
}
dialog.oncancel = function () {
if( UE.plugins[thePlugins].editdom ) {
delete UE.plugins[thePlugins].editdom;
}
};
dialog.onok = function (){
if($G('orgname').value==''){
alert('请输入控件名称');
return false;
}
var gValue=$G('orgvalue').value.replace(/\"/g,"""),gTitle=$G('orgname').value.replace(/\"/g,"""),gFontSize=$G('orgfontsize').value,gAlign=$G('orgalign').value,gWidth=$G('orgwidth').value,gHeight=$G('orgheight').value,gType=$G('orgtype').value;
if( !oNode ) {
try {
oNode = createElement('input','leipiNewField');
oNode.setAttribute('type','text');
oNode.setAttribute('title',gTitle);
oNode.setAttribute('value',gValue);
oNode.setAttribute('name','leipiNewField');
oNode.setAttribute('leipiPlugins',thePlugins);
if ( $G('orghide').checked ) {
oNode.setAttribute('orghide',1);
} else {
oNode.setAttribute('orghide',0);
}
if( gFontSize != '' ) {
oNode.style.fontSize = gFontSize + 'px';
//style += 'font-size:' + gFontSize + 'px;';
oNode.setAttribute('orgfontsize',gFontSize );
}
if( gAlign != '' ) {
//style += 'text-align:' + gAlign + ';';
oNode.style.textAlign = gAlign;
oNode.setAttribute('orgalign',gAlign );
}
if( gWidth != '' ) {
oNode.style.width = gWidth+ 'px';
//style += 'width:' + gWidth + 'px;';
oNode.setAttribute('orgwidth',gWidth );
}
if( gHeight != '' ) {
oNode.style.height = gHeight+ 'px';
//style += 'height:' + gHeight + 'px;';
oNode.setAttribute('orgheight',gHeight );
}
if( gType != '' ) {
oNode.setAttribute('orgtype',gType );
}
//oNode.setAttribute('style',style );
//oNode.style.cssText=style;//ie7
editor.execCommand('insertHtml',oNode.outerHTML);
} catch (e) {
try {
editor.execCommand('error');
} catch ( e ) {
alert('控件异常,请到 [雷劈网] 反馈或寻求帮助!');
}
return false;
}
} else {
oNode.setAttribute('title', gTitle);
oNode.setAttribute('value', $G('orgvalue').value);
if( $G('orghide').checked ) {
oNode.setAttribute('orghide', 1);
} else {
oNode.setAttribute('orghide', 0);
}
if( gFontSize != '' ) {
oNode.style.fontSize = gFontSize+ 'px';
oNode.setAttribute('orgfontsize',gFontSize );
}else{
oNode.style.fontSize = '';
oNode.setAttribute('orgfontsize', '');
}
if( gAlign != '' ) {
oNode.style.textAlign = gAlign;
oNode.setAttribute('orgalign',gAlign );
}else{
oNode.setAttribute('orgalign', '');
}
if( gWidth != '' ) {
oNode.style.width = gWidth+ 'px';
oNode.setAttribute('orgwidth',gWidth );
}else{
oNode.style.width = '';
oNode.setAttribute('orgwidth', '');
}
if( gHeight != '' ) {
oNode.style.height = gHeight+ 'px';
oNode.setAttribute('orgheight',gHeight );
}else{
oNode.style.height = '';
oNode.setAttribute('orgheight', '');
}
if( gType != '' ) {
oNode.setAttribute('orgtype',gType );
}else{
oNode.setAttribute('orgtype', '');
}
delete UE.plugins[thePlugins].editdom;
}
};
</script>
</body>
</html>