[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sitemgr modules/class.module_filebrowser.inc.ph... [s
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] sitemgr modules/class.module_filebrowser.inc.ph... [skwashd-16-compat] |
Date: |
Thu, 17 Aug 2006 14:59:23 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: sitemgr
Branch: skwashd-16-compat
Changes by: Dave Hall <skwashd> 06/08/17 14:59:23
Added files:
modules : class.module_filebrowser.inc.php
sitemgr-site/templates/default/modules/filebrowser: fb.tpl
sitemgr-site/templates/default/modules/filebrowser/images:
folder-open.png
folder.png
library.png
package.png
treeCollapsed.png
treeExpanded.png
unknown.png
sitemgr-site/templates/default/modules/filebrowser/styles:
styles.css
Log message:
new filebrowser module
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/sitemgr/modules/class.module_filebrowser.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/fb.tpl?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/folder-open.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/folder.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/library.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/package.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/treeCollapsed.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/treeExpanded.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/images/unknown.png?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/filebrowser/styles/styles.css?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
Patches:
Index: modules/class.module_filebrowser.inc.php
===================================================================
RCS file: modules/class.module_filebrowser.inc.php
diff -N modules/class.module_filebrowser.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/class.module_filebrowser.inc.php 17 Aug 2006 14:59:23 -0000
1.1.2.1
@@ -0,0 +1,105 @@
+<?php
+/**
+* phpGroupWare sitemgr vfs browser module
+*
+* @author Dave Hall skwashd at phpgroupware.org
+* @copyright Copyright (c) 2006 Free Software Foundation Inc http://fsf.org/
+* @package sitemgr
+* @subpackage content
+*/
+class module_filebrowser extends Module
+{
+ /**
+ * @constructor
+ */
+ function module_filebrowser()
+ {
+ $this->arguments = array
+ (
+ 'path' => array
+ (
+ 'type' => 'textfield',
+ 'label' => lang('The path to be used as the
root (relative to top of vfs)')
+ )
+ );
+ $this->post = array('name' => array('type' => 'textfield'));
+ $this->session = array('name');
+ $this->title = lang('File download');
+ $this->description = lang('This module is a simple VFS file
browser');
+ }
+
+ function get_content(&$arguments,$properties)
+ {
+ $topdir =& $arguments['path'];
+
+ $GLOBALS['phpgw']->vfs = createObject('phpgwapi.vfs');
+ $files_list = $GLOBALS['phpgw']->vfs->ls(array
+ (
+ 'string' => $topdir,
+ 'relatives' => array(RELATIVE_NONE),
+ 'checksubdirs' => true,
+ 'mime_type' => 'Directory'
+ ));
+
+ $paths = array();
+ foreach ( $files_list as $file_entry )
+ {
+ if ( $file_entry['mime_type'] != 'Directory' ) //this
shouldn't happen, but you never know :)
+ {
+ continue;
+ }
+
+ $paths[] =
"{$file_entry['directory']}/{$file_entry['name']}";
+ }
+ unset($files_list);
+ asort($paths, SORT_LOCALE_STRING);
+
+ $i = 0;
+ $level = count(explode('/', $topdir)) + 1;
+ foreach ( $paths as $path )
+ {
+ $pparts = explode('/', $path);
+ $prefix = str_repeat("\t", $level + 1);
+ //echo "level == $level, path == $path, parts count ==
" . count($pparts) . ' parts == <pre>' . print_r($pparts, true) . '</pre>';
+ if ( $level != ($cpparts = count($pparts) ) )
+ {
+ while ( $cpparts > $level )
+ {
+ $path_list .= "{$prefix}<ul>\n";
+ ++$level;
+ $prefix = str_repeat("\t", $level + 1);
+ }
+ while ( $cpparts < $level )
+ {
+ $path_list .= "{$prefix}</li>\n";
+
+ --$level;
+ $prefix = str_repeat("\t", $level + 1);
+
+ $path_list .= "{$prefix}</ul>\n";
+ }
+ $i = 0;
+ }
+ if ( $i )
+ {
+ $path_list .= str_repeat("\t", $level + 1) .
"</li>\n";
+ };
+ $dir_name = array_pop($pparts);
+ $path_list .= str_repeat("\t", $level + 1) . "<li><a
href=\"#\" class=\"folder_name\" onclick=\"getFolder('{$path}');\">{$dir_name}
{$level}</a>\n";
+ ++$i;
+ }
+
+ $this->template = createobject('phpgwapi.Template');
+ $this->template->set_root($this->find_template_dir());
+ $this->template->set_file('fb', 'fb.tpl');
+ $this->template->set_var( array
+ (
+ 'mime_img_dir' => PHPGW_IMAGES_DIR,
+ 'paths' => $path_list,
+ 'phpgwlink_url' => $GLOBALS['phpgw']->link('/'),
+ 'phpgw_base' =>
$GLOBALS['phpgw_info']['server']['webserver_url'],
+ 'topdir' => $topdir,
+ ));
+ return $this->template->parse('out', 'fb');
+ }
+}
Index: sitemgr-site/templates/default/modules/filebrowser/fb.tpl
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/fb.tpl
diff -N sitemgr-site/templates/default/modules/filebrowser/fb.tpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sitemgr-site/templates/default/modules/filebrowser/fb.tpl 17 Aug 2006
14:59:23 -0000 1.1.2.1
@@ -0,0 +1,109 @@
+ <style type="text/css">
+ @import
url("templates/default/modules/filebrowser/styles/styles.css");
+ </style>
+ <div id="sitemgr_site_nnv">
+ <div id="sitemgr_site_nnv_folder_list">
+ <ul class="folder_list expandable">
+ <li><a
href="javascript:getFolder('{topdir}');" class="folder_name">{topdir}</a>
+ <ul>
+ {paths}
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ <div id="sitemgr_site_nnv_file_list">
+ </div>
+ </div>
+ <script type="text/javascript">
+ var strBaseURL = '{phpgwlink_url}';
+ </script>
+ <script type="text/javascript"
src="{phpgw_base}/phpgwapi/js/core/base.js"></script>
+ <script type="text/javascript"
src="{phpgw_base}/phpgwapi/js/sarissa/sarissa.js"></script>
+ <script type="text/javascript"
src="{phpgw_base}/phpgwapi/js/expandable/expandable.js"></script>
+ <script type="text/javascript">
+ //<![CDATA[
+ var strCurPath = '';
+
+ function getFile(strFilename)
+ {
+ window.location = phpGWLink('/index.php' ,
{menuaction: 'filemanager.bofilemanager.f_download', path :
encodeURI(strCurPath), file: strFilename});
+ }
+
+ function getFolder(strPath)
+ {
+ if ( strCurPath == strPath )
+ {
+ return;//no need to do anything
+ }
+
+ strCurPath = strPath;
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', phpGWLink('/index.php' ,
{menuaction: 'filemanager.bofilemanager.load_files', path : encodeURI(strPath),
sortby: 'name'}, true) );
+ xhr.onreadystatechange = function()
+ {
+ if ( xhr.readyState == 4 )
+ {
+ var elmParent =
document.getElementById('sitemgr_site_nnv_file_list');
+ while (
elmParent.childNodes.length )
+ {
+
elmParent.removeChild(elmParent.firstChild); //
+ }
+
+ if (xhr.status == 200)
+ {
+ var elmIMG, elmA,
elmDIV;
+ var elmTarget =
document.createElement('ul');
+
+ var iFound = 0;
+
+ var arFiles =
eval(xhr.responseText);
+ var iCount =
arFiles.length;
+ for ( var i = 0; i <
iCount; ++i )
+ {
+ if (
arFiles[i]['mime_type'] == 'Directory' )
+ {
+
continue;
+ }
+ ++iFound;
+ elmIMG =
document.createElement('img');
+ elmIMG.src =
'{mime_img_dir}' + arFiles[i]['mime_type'].replace('\/', '-') + '.png';
+ elmIMG.alt =
arFiles[i]['name'];
+
+ elmA =
document.createElement('a');
+ elmA.href =
'javascript:getFile("' + arFiles[i]['name'] + '")';
+
+
elmA.appendChild(elmIMG);
+
elmA.appendChild(document.createElement('br'));
+
elmA.appendChild(document.createTextNode(arFiles[i]['name']));
+
+ elmLI =
document.createElement('li');
+ elmLI.className
= 'file';
+
elmLI.appendChild(elmA);
+
+
elmTarget.appendChild(elmLI);
+ }
+
+ if ( iFound )
+ {
+
elmParent.appendChild(elmTarget); //
+ }
+ else
+ {
+
elmParent.appendChild(document.createTextNode('Directory Empty'));
+ }
+ }
+ else if ( xhr.status == 403 )
+ {
+ alert('ERROR: access
denied!');
+ }
+ else
+ {
+ alert('ERROR:
unknown!');
+ }
+ }
+ }
+ xhr.send(null);
+ }
+ //]]>
+ </script>
Index: sitemgr-site/templates/default/modules/filebrowser/images/folder-open.png
===================================================================
RCS file:
sitemgr-site/templates/default/modules/filebrowser/images/folder-open.png
diff -N
sitemgr-site/templates/default/modules/filebrowser/images/folder-open.png
Binary files /dev/null and /tmp/cvsU4Z9Bz differ
Index: sitemgr-site/templates/default/modules/filebrowser/images/folder.png
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/images/folder.png
diff -N sitemgr-site/templates/default/modules/filebrowser/images/folder.png
Binary files /dev/null and /tmp/cvsRmtY2z differ
Index: sitemgr-site/templates/default/modules/filebrowser/images/library.png
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/images/library.png
diff -N sitemgr-site/templates/default/modules/filebrowser/images/library.png
Binary files /dev/null and /tmp/cvsiG4rjy differ
Index: sitemgr-site/templates/default/modules/filebrowser/images/package.png
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/images/package.png
diff -N sitemgr-site/templates/default/modules/filebrowser/images/package.png
Binary files /dev/null and /tmp/cvslrgUqB differ
Index:
sitemgr-site/templates/default/modules/filebrowser/images/treeCollapsed.png
===================================================================
RCS file:
sitemgr-site/templates/default/modules/filebrowser/images/treeCollapsed.png
diff -N
sitemgr-site/templates/default/modules/filebrowser/images/treeCollapsed.png
Binary files /dev/null and /tmp/cvs28se7B differ
Index:
sitemgr-site/templates/default/modules/filebrowser/images/treeExpanded.png
===================================================================
RCS file:
sitemgr-site/templates/default/modules/filebrowser/images/treeExpanded.png
diff -N
sitemgr-site/templates/default/modules/filebrowser/images/treeExpanded.png
Binary files /dev/null and /tmp/cvsXtfznA differ
Index: sitemgr-site/templates/default/modules/filebrowser/images/unknown.png
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/images/unknown.png
diff -N sitemgr-site/templates/default/modules/filebrowser/images/unknown.png
Binary files /dev/null and /tmp/cvsuSrzZA differ
Index: sitemgr-site/templates/default/modules/filebrowser/styles/styles.css
===================================================================
RCS file: sitemgr-site/templates/default/modules/filebrowser/styles/styles.css
diff -N sitemgr-site/templates/default/modules/filebrowser/styles/styles.css
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sitemgr-site/templates/default/modules/filebrowser/styles/styles.css
17 Aug 2006 14:59:23 -0000 1.1.2.1
@@ -0,0 +1,119 @@
+#sitemgr_site_nnv
+{
+ background-color: #ccc;
+ height: 505px;
+ margin: 10px auto;
+ padding: 5px;
+ width: 600px;
+}
+
+#sitemgr_site_nnv_folder_list
+{
+ background-color: #fff;
+ border: 1px solid #000;
+ float: left;
+ height: 490px;
+ overflow: auto;
+ padding: 5px 20px;
+ width: 200px;
+}
+
+ul.folder_list
+{
+ font-size: 13px;
+ padding: 0;
+}
+
+ul.folder_list ul
+{
+ border: 0px;
+ display: none;
+ list-style: none;
+ margin: 0px 0px 0px 20px;
+ padding: 0px;
+}
+
+ul.folder_list li
+{
+ list-style-type: none;
+ position: relative;
+}
+
+ul.folder_list a.switch-on, ul.folder_list a.switch-off
+{
+ background-repeat: no-repeat;
+ color: #fff;
+ font-size: 1px;
+ left: -20px;
+ position: absolute;
+ width: 20px;
+}
+
+ul.folder_list a.switch-on
+{
+ background-image: url('../images/treeExpanded.png');
+}
+
+ul.folder_list a.switch-off
+{
+ background-image: url('../images/treeCollapsed.png');
+}
+
+ul.folder_list a
+{
+ text-decoration: none;
+}
+
+ul.folder_list a.folder_name
+{
+ background-image: url('../images/folder.png');
+ background-repeat: no-repeat;
+ color: #000;
+ display: block;
+ height: 15px;
+ margin-bottom: 5px;
+ padding-left: 20px;
+}
+
+#sitemgr_site_nnv_file_list
+{
+ background-color: #fff;
+ border: 1px solid #000;
+ float: left;
+ height: 490px;
+ margin: 0px 0px 0px 5px;
+ overflow: auto;
+ padding: 5px;
+ width: 340px;
+}
+
+#sitemgr_site_nnv_file_list ul
+{
+ list-style: none;
+ margin: 0px;
+ padding: 0px;
+}
+
+#sitemgr_site_nnv_file_list li
+{
+ display: block;
+ float: left;
+ margin: 3px;
+ padding: 0px;
+ text-align: center;
+}
+
+#sitemgr_site_nnv_file_list a
+{
+ color: #000;
+ font-size: 12px;
+ text-decoration: none;
+}
+
+#sitemgr_site_nnv_file_list img
+{
+ height: 52px;
+ border: 0px;
+ width: 48px;
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sitemgr modules/class.module_filebrowser.inc.ph... [skwashd-16-compat],
Dave Hall <=