本帖最后由 myp4p 于 2009-7-28 13:21 编辑
给UCH增加一个快捷发布框,可以让会员更快捷的发布记录、日志等,看下面图片演示
下面是修改方法,代码的质量怎么样,实现方式怎么样,都请大家不要评论,如果觉得可以用,大家就用,如果觉得没水平,大可以不用。而且,由于匆忙,代码还有一些细节没有来得及完善,不过,已经能用了,只是一些美工上的小细节而已
如果在FF下错位,请参考附件里面那个TXT文件里面的东西
文件位置:template\default\space_feed.htm
==============代码开始=================
<script type="text/javascript">
function validate(obj) {
var subject = $('subject');
if (subject) {
var slen = strlen(subject.value);
if (slen < 1 || slen > 80) {
alert("标题长度(1~80字符)不符合要求");
subject.focus();
return false;
}
}
}
function edit_show(id) {
if(id == '1') {
$('qtminiblog').style.display = '';
$('qtphoto').style.display = 'none';
$('qtblog').style.display = 'none';
$('qtshare').style.display = 'none';
$('kj1').className= "current";
$('kj2').className= "";
$('kj3').className= "";
$('kj4').className= "";
}
if(id == '2') {
$('qtminiblog').style.display = 'none';
$('qtphoto').style.display = '';
$('qtblog').style.display = 'none';
$('qtshare').style.display = 'none';
$('kj1').className= "";
$('kj2').className= "current";
$('kj3').className= "";
$('kj4').className= "";
}
if(id == '3') {
$('qtminiblog').style.display = 'none';
$('qtphoto').style.display = 'none';
$('qtblog').style.display = '';
$('qtshare').style.display = 'none';
$('kj1').className= "";
$('kj2').className= "";
$('kj3').className= "current";
$('kj4').className= "";
}
if(id == '4') {
$('qtminiblog').style.display = 'none';
$('qtphoto').style.display = 'none';
$('qtblog').style.display = 'none';
$('qtshare').style.display = '';
$('kj1').className= "";
$('kj2').className= "";
$('kj3').className= "";
$('kj4').className= "current";
}
}
</script>
上面代码最好放在space_feed.htm的<!--{template header}-->之后,下面这一部分关于space_feed.htm的代码,建议放在头像那部分之后,或者直接替换调头像
<div id="home-quick-tab">
<ul class="list" id="home-quick-tabc">
<li class="current" id="kj1"><span><b><a class="q-miniblog" onmouseover="edit_show('1')">写记录</a></b></span></li>
<li id="kj2"><span><b><a class="q-photo" onmouseover="edit_show('2')">传照片</a></b></span></li>
<li id="kj3"><span><b><a class="q-blog" onmouseover="edit_show('3')">写日志</a></b></span></li>
<li id="kj4"><span><b><a class="q-share">分享</a></b></span></li>
</ul>
<div id="feed_box" class="ye_r_t"><div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b">
<div class="area" id="qtminiblog">
<form method="post" action="cp.php?ac=doing&view=$_GET[view]" class="post_doing">
<ul style="margin-bottom: 1em;">
<li>
<p>
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td><a href="###" id="face"><img src="image/facelist.gif" align="absmiddle" /></a></td>
<!--{if checkperm('seccode')}-->
<td>
<!--{if $_SCONFIG['questionmode']}-->
请先回答提问:<!--{eval question();}-->
<!--{else}-->
请先输入验证码:<script>seccode();</script>
<!--{/if}-->
<input type="text" id="seccode" name="seccode" value="" size="10" class="t_input">
</td>
<!--{/if}-->
<td align="right">还可输入 <strong id="maxlimit">200</strong> 个字符</td>
</tr>
</table>
<textarea id="message" name="message" rows="4" style="width:438px; height: 24px;"></textarea>
<input type="hidden" name="addsubmit" value="true" />
<button type="submit" id="add" name="add" class="post_button1">发布</button>
</p>
</li>
</ul>
<input type="hidden" name="refer" value="$theurl" />
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
</div>
<div class="area" id="qtphoto" style="display:none;">
<div class="c_form">
<p><a href="cp.php?ac=credit&op=addsize"><!--{if $maxattachsize}-->空间容量 $maxattachsize, <!--{/if}-->已用空间 $space[attachsize]</a></p>
<table cellspacing="0" cellpadding="0" class="formtable">
<caption>
<h2>选择图片</h2>
<p>从电脑中选择你要上传的图片,可以选择多个图片后进行批量上传</p>
</caption>
<tbody id="attachbodyhidden" style="display:none">
<tr>
<td>
<form method="post" id="upload" action="cp.php?ac=upload" enctype="multipart/form-data" target="uploadframe">
<input type="file" name="attach" size="25" style="border: 1px solid #CCC;" />
<span id="localfile"></span>
<input type="hidden" name="uploadsubmit" id="uploadsubmit" value="true" />
<input type="hidden" name="albumid" id="albumid" value="0" />
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
</td>
</tr>
</tbody>
<tbody id="attachbody"></tbody>
</table>
</div>
<script>
no_insert = 1;
function a_addOption() {
var obj = $('uploadalbum');
obj.value = 'addoption';
addOption(obj);
}
function passwordShow(value) {
if(value==4) {
$('span_password').style.display = '';
$('tb_selectgroup').style.display = 'none';
} else if(value==2) {
$('span_password').style.display = 'none';
$('tb_selectgroup').style.display = '';
} else {
$('span_password').style.display = 'none';
$('tb_selectgroup').style.display = 'none';
}
}
function getgroup(gid) {
if(gid) {
var x = new Ajax();
x.get('cp.php?ac=privacy&op=getgroup&gid='+gid, function(s){
$('target_names').innerHTML += s;
});
}
}
function album_op(id) {
$('selectalbum').style.display = 'none';
$('creatalbum').style.display = 'none';
$(id).style.display = '';
}
</script>
<script src="source/script_upload.js" type="text/javascript"></script>
<iframe id="uploadframe" name="uploadframe" width="0" height="0" marginwidth="0" frameborder="0" src="about:blank"></iframe>
<form method="post" id="albumform" action="cp.php?ac=upload" class="c_form" target="uploadframe">
<table cellspacing="0" cellpadding="0" class="formtable">
<!--{if $albums}-->
<caption>
<h2>
<input type="radio" id="albumop_selectalbum" name="albumop" value="selectalbum" checked> <label for="albumop_selectalbum">添加到现有相册</label>
<input type="radio" id="albumop_creatalbum" name="albumop" value="creatalbum"> <label for="albumop_creatalbum">新建一个相册</label>
</h2>
</caption>
<tbody id="selectalbum">
<tr><td>
<table width="100%" class="infotable">
<tr>
<th width="60">选择相册</th>
<td>
<select name="albumid" id="uploadalbumid">
<!--{loop $albums $value}-->
<!--{if $value['albumid'] == $_GET['albumid']}-->
<option value="$value[albumid]" selected>$value[albumname]</option>
<!--{else}-->
<option value="$value[albumid]">$value[albumname]</option>
<!--{/if}-->
<!--{/loop}-->
</select>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
<tbody id="creatalbum" style="display:none;">
<!--{else}-->
<caption>
<h2>新建一个相册</h2>
<input type="hidden" name="albumop" value="creatalbum">
</caption>
<tbody id="creatalbum">
<!--{/if}-->
<tr><td>
<table width="100%" class="infotable">
<tr>
<th width="60">相册名</th>
<td><input type="text" class="t_input" size="20" id="uploadalbumname" name="albumname" value=""></td>
</tr>
<tr>
<th>隐私设置</th>
<td>
<select name="friend" id="uploadfriend">
<option value="0">全站用户可见</option>
<option value="1">全好友可见</option>
<option value="2">仅指定的好友可见</option>
<option value="3">仅自己可见</option>
<option value="4">凭密码查看</option>
</select>
<span id="span_password" style="display:none;">密码:<input type="text" id="uploadpassword" name="password" value="" size="10"></span>
</td>
</tr>
<tbody id="tb_selectgroup" style="display:none;">
<tr>
<th>指定好友</th>
<td><select name="selectgroup">
<option value="">从好友组选择好友</option>
<!--{loop $groups $key $value}-->
<option value="$key">$value</option>
<!--{/loop}-->
</select> 多次选择会累加到下面的好友名单</td>
</tr>
<tr>
<th> </th>
<td>
<textarea name="target_names" id="target_names" style="width:85%;" rows="3"></textarea>
<br>(可以填写多个好友名,请用空格进行分割)</td>
</tr>
</table>
</td></tr>
</tbody>
<tr>
<td>
<br>
<input type="hidden" name="albumsubmit" id="albumsubmit" value="true" />
<input type="submit" name="uploadsubmit" id="btnupload" value="开始上传" class="submit" />
</td>
</tr>
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
<form method="post" id="albumresultform" action="cp.php?ac=upload" class="c_form">
<input type="hidden" name="opalbumid" id="opalbumid" value="0" />
<input type="hidden" name="viewAlbumid" id="viewAlbumid" value="true" />
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
</div>
<div class="area" id="qtblog" style="display:none;">
<form method="post" action="cp.php?ac=blog" enctype="multipart/form-data">
<table cellspacing="4" cellpadding="4" width="100%" class="infotable">
<tr>
<td>
<select name="classid" id="classid">
<option value="0">选择分类</option>
<!--{loop $classarr $value}-->
<!--{if $value['classid'] == $blog['classid']}-->
<option value="$value[classid]" selected>$value[classname]</option>
<!--{else}-->
<option value="$value[classid]">$value[classname]</option>
<!--{/if}-->
<!--{/loop}-->
<!--{if !$blog['uid'] || $blog['uid']==$_SGLOBAL['supe_uid']}--><option value="addoption" style="color:red;">+新建分类</option><!--{/if}-->
</select>
<input type="text" class="t_input" id="subject" name="subject" value="$blog[subject]" size="55" />
</td>
</tr>
<tr>
<td>
<textarea class="userData" name="message" id="uchome-ttHtmlEditor" style="height:200px;width:100%;border:1px"></textarea>
</td>
</tr>
</table>
<input type="hidden" name="blogsubmit" value="true" />
<input type="submit" id="blogbutton" name="blogbutton" value="提交发布" />
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
</div>
<div class="area" id="qtshare" style="display:none;">
<form id="shareform" name="shareform" action="cp.php?ac=share&type=link" method="post">
<table cellspacing="2" cellpadding="2" width="100%">
<tr><td><strong>分享网址、视频、音乐、Flash:</strong></td></tr>
<tr><td><input type="text" class="t_input" name="link" id="share_link" style="width:98%;" value="http://" /></td></tr>
<tr><td><strong>描述:</strong></td></tr>
<tr>
<td>
<textarea id="share_general" name="general" style="width:98%;" rows="3"></textarea>
</td>
</tr>
<!--{if checkperm('seccode')}-->
<tr>
<td>
<!--{if $_SCONFIG['questionmode']}-->
<p>请正确回答下面问题后再提交</p>
<p><!--{eval question();}--></p>
<p><input type="text" id="seccode" name="seccode" value="" size="15" class="t_input"></p>
<!--{else}-->
<p><script>seccode();</script></p>
<p>请输入上面的4位字母或数字,看不清可<a href="javascript:updateseccode()">更换一张</a></p>
<p><input type="text" id="seccode" name="seccode" value="" size="15" class="t_input"></p>
<!--{/if}-->
</td>
</tr>
<!--{/if}-->
<tr><td>
<input type="hidden" name="refer" value="space.php?uid=$space[uid]&do=share&view=me" />
<input type="hidden" name="sharesubmit" value="true" />
<input type="hidden" name="onkjsubmit" value="true" />
<input type="button" id="sharesubmit_btn" name="sharesubmit_btn" value="分享" class="submit" />
</td></tr>
<tr><td id="sharestatus"></td></tr>
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
</div>
</div></div></div></div>
</div>
============代码结束===========================================
============CSS===============================
.post_doing button.post_button1 { margin: 5px 0 0; width: 50px; height: 30px; border: none;}
#home-quick-tab{position:relative;z-index:2;margin-bottom:20px;*zoom:1;}
#home-quick-tab .list{float:left;_display:inline;margin:3px 0;}
#home-quick-tab .list li{float:left;_display:inline;height:30px;margin-right:5px;}
#home-quick-tab .list span{float:left;height:30px;}
#home-quick-tab .list b{float:left;height:30px;}
#home-quick-tab .list a{float:left;padding:2px 0 2px 28px;*padding-top:4px;font-size:12px;}
#home-quick-tab .list .current{background:url(image/quick-tab-current.gif) no-repeat center top;}
#home-quick-tab .list .current span{background:url(image/quick-tab-current-l.gif) no-repeat 0 0;}
#home-quick-tab .list .current b{background:url(image/quick-tab-current-r.gif) no-repeat 100% 0;}
#home-quick-tab .list .current a{color:#333;}
#home-quick-tab .q-miniblog{width:72px;background:url(image/doing1.gif) no-repeat 8px 5px;}
#home-quick-tab .q-photo{width:46px;background:url(image/album1.gif) no-repeat 8px 3px;}
#home-quick-tab .q-blog{width:46px;background:url(image/blog1.gif) no-repeat 8px 3px;}
#home-quick-tab .q-share{width:33px;background:url(image/share1.gif) no-repeat 8px 3px;}
#home-quick-tab .postbox{clear:both;width:540px;}
#home-quick-tab .top{height:5px;overflow:hidden;background:url(image/quick-tab-box.gif) no-repeat 0 0;}
#home-quick-tab .bottom{height:5px;_font-size:5px;_line-height:5px;background:url(image/quick-tab-box.gif) no-repeat 0 -5px;}
#home-quick-tab .area{position:relative;padding:4px 6px;_padding:2px 6px 1px;background:#f7f7f7;}
#home-quick-tab #qtminiblog{_height:48px;}#home-quick-tab #qtminiblog .f-text{width:450px;*width:460px;height:38px;}
#home-quick-tab #qtphoto{_height:40px;}
#home-quick-tab #qtblog{_height:40px;}
#home-quick-tab .qtphoto-tab{position:absolute;top:-5px;left:106px;width:200px;}
#home-quick-tab .qtphoto-c{float:left;}
#home-quick-tab .qtphoto-c li{float:left;width:70px;height:32px;}
#home-quick-tab .qtphoto-c li a{display:block;height:100%;padding-top:4px;text-align:center;}
#home-quick-tab .qtphoto-c li.current{background:url(image/quick-tab-box.gif) no-repeat 0 -10px;}
#home-quick-tab .qtphoto-c li.current a{background:url(image/quick-tab-box.gif) no-repeat -130px -42px;color:#333;cursor:default;}
#home-quick-tab .qtphoto-c li.current a:hover{text-decoration:none;}
#home-quick-tab .nf p{_zoom:1;}
#home-quick-tab .qtphoto-form .nf{margin:30px 20px 10px;}
#home-quick-tab .qtblog-form .nf{margin:10px 10px 10px 20px;}
#home-quick-tab .qtphoto-form{clear:left;}
#home-quick-tab .qtphoto-form .f-label,#home-quick-tab .qtblog-form .f-label{width:50px;_margin-right:7px;}
#home-quick-tab .qtphoto-form .f-text,#home-quick-tab .qtphoto-form textarea,#home-quick-tab .qtphoto-form .albumselect{width:420px;}
#home-quick-tab .qtphoto-form textarea{height:3.6em;}
#home-quick-tab .qtblog-form .f-text,#home-quick-tab .qtblog-form textarea{width:450px;}
#home-quick-tab .qtblog-form textarea{height:92px;}
#home-quick-tab .qtblog-form #qtblog-switchmode{float:right;}
#home-quick-tab .qtphoto-form .act{margin-left:60px;_zoom:0;}
#home-quick-tab .qtblog-form .act{margin-left:60px;}
#home-quick-tab .qtphoto-form .noalbum{margin-top:15px;padding:10px 0;text-align:center;}
#home-quick-tab #qtshare{_height:23px;}
#home-quick-tab #qtshare .f-text{width:480px;*width:485px;}
#home-quick-tab #qtminiblog .f-button,#home-quick-tab #qtshare .f-button{position:absolute;right:7px;bottom:4px;width:54px;*width:50px;}
#home-quick-tab #qpmsg{background:#FFFBCC;padding:2px 3px;}
============CSS结束===========================
============分享的跳转========
文件位置:source\cp_share.php
查找:if($note_uid && $note_uid != $_SGLOBAL['supe_uid']) {
notification_add($note_uid, 'sharenotice', $note_message);
}
在后面加上
if(submitcheck('onkjsubmit')) {Header("Location:space.php?do=share&view=me"); }
============分享的跳转结束========
附件是里面涉及的图片
|