SVN-WEB客户端浏览程序及WP插件
By19.Published on2009-02-27.
全AJAX的SVN-WEB客户端浏览程序及WP插件
这个SVN的WEB客户端浏览程序是在网络找到的一套开源的PHP(原作者:Lukin <mylukin@gmail.com> )修改而来~主要是因为想要做一款可自由定制界面的SVN-AJAX WEB浏览器,浏览匿名用户有读取权限的SVN目录。提供两套:整站程序(演示地址:http://www.ll19.com/svn/),以及WP的插件(插件效果见下方),插件可以直接在文章中引入SVN的目录供浏览。这里浏览的是我在GOOGLE上的SVN:http://glll.googlecode.com/svn/trunk。
插件的用法,可以在文章中或者模板中引入SVN目录,比如:
1 2 3 4 | //激活插件后文章中 [wp_svn_add svn_server="http://glll.googlecode.com/svn/trunk" svn_path="/src/php/"] //模板中 <?php wp_svn_add("http://glll.googlecode.com/svn/trunk","/src/php/"); ?> |
插件引入两个参数,第一个是SVN的根路径,第二个是要显示SVN的路径。其中根目录不能以“/”结束。
PS:我个人的主张是不在自己的站点激活很多的插件,这个插件为了在文章中输出SVN的地址加了一个文章的filter函数,当然这并不会对性能造成太大的影响,如果你还是觉得为了几篇文章就加一个filter函数很不值得的话可以照我的做法:首先我也没有激活这个插件,我只是在测试环境启用后把生成的HTML复制进来而已(本地生成的话域名别忘记改成自己的),HTML包括svn_19_main的这个ID的DIV和下面的JS及SPAN标签。这样也可以达到SVN的文章AJAX浏览效果。比如这段HTML代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <div id="svn_19_main" name="svn_19_main_1"> <h2>Revision 197: /trunk/sql/</h2><ul> <li><a class="folder" href="#/trunk/">..</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/AddPermission.sql" target="_blank">AddPermission.sql</a></li> <li><a class="folder" href="#/trunk/sql/LK/">LK/</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/eisp_oracle_20061130.sql" target="_blank">eisp_oracle_20061130.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/eisp_sqlserver_20061130.txt" target="_blank">eisp_sqlserver_20061130.txt</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/lisw.sql" target="_blank">lisw.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/readme.txt" target="_blank">readme.txt</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/xiangts.sql" target="_blank">xiangts.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/yangg.sql" target="_blank">yangg.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/zw.sql" target="_blank">zw.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/%e6%95%b0%e6%8d%ae%e7%a7%bb%e6%a4%8d%e5%bb%ba%e8%a1%a8SQL.sql" target="_blank">数据移植建表SQL.sql</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/%e6%9c%89%e7%94%a8sql.txt" target="_blank">有用sql.txt</a></li> <li><a class="file" href="http://localhost/wwwroot/wp-content/plugins/wp_svn_browse/view.php?svn_server=http://localhost/svn/sdww/sdww&path=/trunk/sql/%e8%bd%a6%e8%be%86%e7%ae%a1%e7%90%86.sql" target="_blank">车辆管理.sql</a></li> </ul> </div> <script type="text/javascript"> jQuery("div[@name='svn_19_main_1'] ul li a").svn_ajax_19("svn_19_main_1","http://www.ll19.com/wwwroot/wp-content/plugins/wp_svn_browse/","http://localhost/svn/sdww/sdww"); </script> <span style="display:none" id="nowSvnFolder_svn_19_main_1">/trunk/sql/</span> |
当然如果你觉得这样做麻烦也可以直接激活插件,文章传入[wp_svn_add svn_server="http://glll.googlecode.com/svn/trunk" svn_path="/src/php/"]就OK了~
| 这里下载插件 | 这里下载单独的WEB Client程序 |
本篇日志相关文章:
- WP的TAGS墙~ (16)
- LRC-19Line~ (42)
- WP的重要留言插件 (11)
One Response to “ SVN-WEB客户端浏览程序及WP插件 ”
文章回复(Leave a reply): 点击这里取消回复。
-
YOU.This...Your comment...