forked from hooray/hoorayos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.php
More file actions
200 lines (198 loc) · 8.16 KB
/
app.php
File metadata and controls
200 lines (198 loc) · 8.16 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
<?php
require('../../global.php');
//验证是否登入
if(!checkLogin()){
redirect('../error.php?code='.$errorcode['noLogin']);
}
if(isset($_GET['id'])){
$app = $db->get('tb_member_app', '*', array(
'tbid' => $_GET['id']
));
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>编辑应用</title>
<?php include('sysapp/global_css.php'); ?>
</head>
<body>
<form action="app.ajax.php" method="post" name="form" id="form" class="form-horizontal">
<div class="creatbox" style="top:0;">
<div class="panel panel-default">
<div class="panel-body">
<input type="hidden" name="ac" value="edit">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
<div class="form-group">
<label for="inputIcon" class="col-sm-2 control-label">应用图片:</label>
<div class="col-sm-10">
<div class="shortcutview">
<?php if($app['icon'] != ''){ ?>
<img src="../../<?php echo $app['icon']; ?>">
<?php } ?>
</div>
<a href="javascript:;" id="upload" class="btn btn-default" style="position:relative">选择图片</a>
<div class="panel panel-default" style="margin-top:10px;margin-bottom:0;">
<div class="panel-heading">系统推荐的图标:</div>
<div class="panel-body shortcut-selicon">
<?php for($i = 1; $i <= 40; $i++){ ?>
<a href="javascript:;"><img src="../../static/img/icon/system/<?php echo $i; ?>.png" valsrc="static/img/icon/system/<?php echo $i; ?>.png"></a>
<?php } ?>
</div>
</div>
<input type="hidden" name="val_icon" id="inputIcon" value="<?php echo $app['icon']; ?>" datatype="*" nullmsg="请选择或上传应用图片">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label for="inputName" class="col-sm-2 control-label">应用名称:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="val_name" id="inputName" value="<?php echo $app['name']; ?>" datatype="*" nullmsg="请输入应用名称">
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">窗口大小:</label>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon">宽</span>
<input type="text" class="form-control" name="val_width" id="inputWidth" value="<?php echo $app['width']; ?>" datatype="n" nullmsg="请输入应用宽高" errormsg="宽高数值不规范">
<span class="input-group-addon">px</span>
</div>
</div>
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon">高</span>
<input type="text" class="form-control" name="val_height" id="inputHeight" value="<?php echo $app['height']; ?>" datatype="n" nullmsg="请输入应用宽高" errormsg="宽高数值不规范">
<span class="input-group-addon">px</span>
</div>
</div>
</div>
<span class="help-block"></span>
</div>
</div>
<div class="form-group form-group-isresize <?php if($app['type'] == 'widget'){echo 'hide';} ?>">
<label class="col-sm-2 control-label">窗口是否拉伸:</label>
<div class="col-sm-10">
<input type="checkbox" name="val_isresize" <?php if($app['isresize'] == 1){echo 'checked';} ?> data-plugin="bootstrapSwitch" data-on-color="info" data-size="small" data-on-text="是" data-off-text="否">
</div>
</div>
<div class="form-group form-group-isopenmax <?php if($app['type'] == 'widget' || $app['isresize'] == 0){echo 'hide';} ?>">
<label class="col-sm-2 control-label">打开默认最大化:</label>
<div class="col-sm-10">
<input type="checkbox" name="val_isopenmax" <?php if($app['isopenmax'] == 1){echo 'checked';} ?> data-plugin="bootstrapSwitch" data-on-color="info" data-size="small" data-on-text="是" data-off-text="否">
</div>
</div>
<div class="form-group form-group-isflash <?php if($app['type'] == 'widget'){echo 'hide';} ?>">
<label class="col-sm-2 control-label">是否为Flash:</label>
<div class="col-sm-10">
<input type="checkbox" name="val_isflash" <?php if($app['isflash'] == 1){echo 'checked';} ?> data-plugin="bootstrapSwitch" data-on-color="info" data-size="small" data-on-text="是" data-off-text="否">
<span class="help-block">如果设置为Flash应用,当窗口处于非当前窗口时,会显示遮罩层</span>
</div>
</div>
</div>
</div>
</div>
<div class="bottom-bar">
<a class="btn btn-primary pull-right" id="btn-submit" href="javascript:;"><i class="glyphicon glyphicon-ok"></i> 确定</a>
<a class="btn btn-default pull-right" href="javascript:window.parent.dialog.get('editdialog').close().remove();" style="margin-right:10px"><i class="glyphicon glyphicon-remove"></i> 关闭</a>
</div>
</form>
<?php include('sysapp/global_js.php'); ?>
<script src="../../static/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script>
$(function(){
var uploader = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '../../static/plugins/webuploader-0.1.5/Uploader.swf',
// 文件接收服务端。
server: 'app.ajax.php?ac=uploadImg',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: {
id: '#upload',
multiple: false
},
// 只允许选择图片文件。
accept: {
title: 'Images',
extensions: 'gif,jpg,jpeg,bmp,png',
mimeTypes: 'image/*'
}
});
uploader.on('beforeFileQueued', function(file){
if(file.size > 300 * 1024){
alert('文件大于300Kb,请压缩后再上传');
return false;
}else{
$('.shortcutview img').remove();
$('#inputIcon').val('');
}
});
uploader.on('fileQueued', function(file){
var $img = $('<img>');
$('.shortcutview').append($img);
// 创建缩略图
uploader.makeThumb(file, function(error, src){
if(error){
$img.replaceWith('');
return;
}
$img.attr('src', src);
}, 48, 48);
});
uploader.on('uploadSuccess', function(file, cb){
$('.shortcutview img').attr('src', '../../' + cb.url);
$('#inputIcon').val(cb.url);
uploader.removeFile(file);
});
$('#form').Validform({
btnSubmit: '#btn-submit',
postonce: false,
showAllError: true,
//msg:提示信息;
//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素(或表单对象),type指示提示的状态,值为1、2、3、4, 1:正在检测/提交数据,2:通过验证,3:验证失败,4:提示ignore状态, curform为当前form对象;
//cssctl:内置的提示信息样式控制函数,该函数需传入两个参数:显示提示信息的对象 和 当前提示的状态(既形参o中的type);
tiptype: function(msg, o){
if(!o.obj.is('form')){//验证表单元素时o.obj为该表单元素,全部验证通过提交表单时o.obj为该表单对象;
var B = o.obj.parents('.form-group');
var T = B.find('.help-block');
if(o.type == 2){
B.removeClass('has-error');
T.text('');
}else{
B.addClass('has-error');
T.text(msg);
}
}
},
ajaxPost: true,
callback: function(data){
if(data.status == 'y'){
window.parent.HROS.app.get();
window.parent.dialog.get('editdialog').close().remove();
}
}
});
$('input[name="val_isresize"]').on('switchChange.bootstrapSwitch', function(){
if($(this).bootstrapSwitch('state')){
$('.form-group-isopenmax').removeClass('hide');
}else{
$('.form-group-isopenmax').addClass('hide');
}
});
//选择应用图片
$('.shortcut-selicon a').click(function(){
$('.shortcutview img').remove();
$('.shortcutview').append($(this).html());
$('#inputIcon').val($(this).children('img').attr('valsrc')).focusout();
});
});
</script>
</body>
</html>