file icon
This commit is contained in:
parent
5cb9633517
commit
c43d23bd70
|
@ -23,7 +23,7 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
username := session.Values["username"].(string)
|
username := session.Values["username"].(string)
|
||||||
userSrc := conf.Wide.GetUserWorkspace(username) + string(os.PathSeparator) + "src"
|
userSrc := conf.Wide.GetUserWorkspace(username) + string(os.PathSeparator) + "src"
|
||||||
|
|
||||||
root := FileNode{Name: "projects", Path: userSrc, IconSkin: ".ico-ztree-dir", Type: "d", FileNodes: []*FileNode{}}
|
root := FileNode{Name: "projects", Path: userSrc, IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
|
||||||
fileInfo, _ := os.Lstat(userSrc)
|
fileInfo, _ := os.Lstat(userSrc)
|
||||||
|
|
||||||
walk(userSrc, fileInfo, &root)
|
walk(userSrc, fileInfo, &root)
|
||||||
|
@ -195,7 +195,7 @@ func walk(path string, info os.FileInfo, node *FileNode) {
|
||||||
|
|
||||||
if fio.IsDir() {
|
if fio.IsDir() {
|
||||||
child.Type = "d"
|
child.Type = "d"
|
||||||
child.IconSkin = "ico-ztree-dir"
|
child.IconSkin = "ico-ztree-dir "
|
||||||
|
|
||||||
walk(fpath, fio, &child)
|
walk(fpath, fio, &child)
|
||||||
} else {
|
} else {
|
||||||
|
@ -246,23 +246,27 @@ func listFiles(dirname string) []string {
|
||||||
|
|
||||||
func getIconSkin(filenameExtension string) string {
|
func getIconSkin(filenameExtension string) string {
|
||||||
if "" == filenameExtension {
|
if "" == filenameExtension {
|
||||||
return ".ico-ztree-other"
|
return "ico-ztree-other "
|
||||||
}
|
}
|
||||||
|
|
||||||
switch filenameExtension {
|
switch filenameExtension {
|
||||||
case ".json":
|
case ".json":
|
||||||
return "ico-ztree-js"
|
return "ico-ztree-js "
|
||||||
case ".txt":
|
case ".txt":
|
||||||
return "ico-ztree-text"
|
return "ico-ztree-text "
|
||||||
case ".properties":
|
case ".properties":
|
||||||
return "ico-ztree-pro"
|
return "ico-ztree-pro "
|
||||||
|
case ".html":
|
||||||
|
case ".htm":
|
||||||
|
return "ico-ztree-html "
|
||||||
default:
|
default:
|
||||||
if isImg(filenameExtension) {
|
if isImg(filenameExtension) {
|
||||||
return ".ico-ztree-img"
|
return "ico-ztree-img "
|
||||||
}
|
}
|
||||||
|
|
||||||
return ".ico-ztree-" + filenameExtension[1:]
|
return "ico-ztree-" + filenameExtension[1:] + " "
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEditorMode(filenameExtension string) string {
|
func getEditorMode(filenameExtension string) string {
|
||||||
|
|
|
@ -38,6 +38,27 @@ ul {
|
||||||
}
|
}
|
||||||
/* end reset & function */
|
/* end reset & function */
|
||||||
|
|
||||||
|
/* start frame */
|
||||||
|
.frame {
|
||||||
|
position: absolute;
|
||||||
|
border: 1px solid #5F5F5F;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
width: 340px;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame li {
|
||||||
|
padding: 0 5px;
|
||||||
|
line-height: 25px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame li:hover {
|
||||||
|
background-color: #3875D7;
|
||||||
|
color: #FFF;
|
||||||
|
}
|
||||||
|
/* end frame */
|
||||||
|
|
||||||
/* start tabs */
|
/* start tabs */
|
||||||
.tabs {
|
.tabs {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
@ -99,28 +120,6 @@ ul {
|
||||||
}
|
}
|
||||||
/* end framework */
|
/* end framework */
|
||||||
|
|
||||||
|
|
||||||
/* start side */
|
|
||||||
.menu-r {
|
|
||||||
position: absolute;
|
|
||||||
border: 1px solid #5F5F5F;
|
|
||||||
background-color: #F8F8F8;
|
|
||||||
width: 340px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-r li {
|
|
||||||
padding: 0 5px;
|
|
||||||
line-height: 25px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-r li:hover {
|
|
||||||
background-color: #3875D7;
|
|
||||||
color: #FFF;
|
|
||||||
}
|
|
||||||
/* end side */
|
|
||||||
|
|
||||||
/* start editor */
|
/* start editor */
|
||||||
.edit-panel {
|
.edit-panel {
|
||||||
background-color: #D7D7D7;
|
background-color: #D7D7D7;
|
||||||
|
@ -151,4 +150,4 @@ ul {
|
||||||
height: 130px;
|
height: 130px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
/* end output */
|
/* end output */
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* start tree */
|
||||||
|
.ztree li a.curSelectedNode {
|
||||||
|
background-color: #3875D7;
|
||||||
|
border-color: #3875D7;
|
||||||
|
color: #FFF;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ztree li a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ztree li > a > span.button {
|
||||||
|
background-image: url("../images/ico-file.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-dir {
|
||||||
|
background-position: -2px -23px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-html {
|
||||||
|
background-position: -3px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-go {
|
||||||
|
background-position: -22px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-css {
|
||||||
|
background-position: -42px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-img {
|
||||||
|
background-position: -62px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-other {
|
||||||
|
background-position: -82px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-text {
|
||||||
|
background-position: -102px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-sql {
|
||||||
|
background-position: -123px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-pro {
|
||||||
|
background-position: -142px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-md {
|
||||||
|
background-position: -161px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-js {
|
||||||
|
background-position: -182px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ico-ztree-xml {
|
||||||
|
background-position: -202px -2px;
|
||||||
|
}
|
||||||
|
/* end tree */
|
|
@ -11,6 +11,7 @@
|
||||||
<link rel="stylesheet" href="{{.Wide.StaticServer}}/static/js/lib/ztree/zTreeStyle.css">
|
<link rel="stylesheet" href="{{.Wide.StaticServer}}/static/js/lib/ztree/zTreeStyle.css">
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{.Wide.StaticServer}}/static/css/base.css?{{.Wide.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.Wide.StaticServer}}/static/css/base.css?{{.Wide.StaticResourceVersion}}">
|
||||||
|
<link rel="stylesheet" href="{{.Wide.StaticServer}}/static/css/side.css?{{.Wide.StaticResourceVersion}}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="menu fn-clear">
|
<div class="menu fn-clear">
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
<ul id="files" class="ztree"></ul>
|
<ul id="files" class="ztree"></ul>
|
||||||
|
|
||||||
<!-- 目录右键菜单 -->
|
<!-- 目录右键菜单 -->
|
||||||
<div id="dirRMenu" class="menu-r fn-none">
|
<div id="dirRMenu" class="frame fn-none">
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="tree.newFile();">{{.i18n.create_file}}</li>
|
<li onclick="tree.newFile();">{{.i18n.create_file}}</li>
|
||||||
<li onclick="tree.newDir();">{{.i18n.create_dir}}</li>
|
<li onclick="tree.newDir();">{{.i18n.create_dir}}</li>
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 文件右键菜单 -->
|
<!-- 文件右键菜单 -->
|
||||||
<div id="fileRMenu" class="menu-r fn-none">
|
<div id="fileRMenu" class="frame fn-none">
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
|
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue