From efc14ee2dc9c61a86e5aeb297e5b46ff1b85ded4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 9 Dec 2014 12:08:00 +0000 Subject: [PATCH] fixed session creation for Pixelegg or Stylite template and added extra css for a simplified sharing GUI --- filemanager/inc/class.filemanager_ui.inc.php | 6 ++- filemanager/templates/default/index.xet | 6 --- filemanager/templates/default/sharing.css | 47 ++++++++++++++++++++ phpgwapi/inc/class.egw.inc.php | 7 ++- phpgwapi/inc/class.egw_sharing.inc.php | 5 ++- 5 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 filemanager/templates/default/sharing.css diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index cf8f6c5c1e..dd604a2a44 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -477,7 +477,11 @@ class filemanager_ui '5' => 'Files from links', '0' => 'Files from subdirectories', ); - + // sharing has no divAppbox, we need to set popupMainDiv instead, to be able to drop files everywhere + if (substr($_SERVER['SCRIPT_FILENAME'], -10) == '/share.php') + { + $tpl->setElementAttribute('nm[buttons][upload]', 'drop_target', 'popupMainDiv'); + } $tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm'])); } diff --git a/filemanager/templates/default/index.xet b/filemanager/templates/default/index.xet index 863f225d9d..b383990f78 100644 --- a/filemanager/templates/default/index.xet +++ b/filemanager/templates/default/index.xet @@ -63,12 +63,6 @@ \ No newline at end of file diff --git a/filemanager/templates/default/sharing.css b/filemanager/templates/default/sharing.css new file mode 100644 index 0000000000..29a5af3f0a --- /dev/null +++ b/filemanager/templates/default/sharing.css @@ -0,0 +1,47 @@ +/** + * EGroupware - CSS Styles used by sharing GUI + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @link http://www.egroupware.org + * @author Ralf Becker + * @copyright (c) 2014 by Ralf Becker + * @version $Id$ + */ + +div#popupMainDiv { + height: 100% !important; + padding: 0 !important; + background-image: none; +} + +/** + * simplify NM UI for sharing + */ +div#filemanager-index_buttons img, div#filemanager-index_favorite_wrapper, +div.header_row_right, span.header_count, select#filemanager-index_filter, span.selectcols { + display: none !important; +} + +div.filemanager_navigation label { + /*right: 265px !important;*/ +} + +div.search { + position: absolute; + top: 8px; + right: 215px; +} + +div#filemanager-index_buttons div.et2_file { + margin-top: 6px; +} + +div.et2_nextmatch div.nextmatch_header_row { + padding-bottom: 0px; +} + +div.nextmatch_header { + padding-bottom: 0 !important; + padding-top: 10px !important; +} diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index 91ec2000f2..235ce1d0dd 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -362,7 +362,12 @@ class egw extends egw_minimal // present a login page, if anon user has no right for an application if ($this->session->session_flags == 'A') { - throw new egw_exception_redirect('/logout.php'); + // need to destroy a basic auth session here, because it will only be available on current url + if (($sessionid = egw_session::get_sessionid(true))) + { + $GLOBALS['egw']->session->destroy($sessionid); + } + throw new egw_exception_redirect(egw::link('/logout.php')); } if ($currentapp == 'admin' || $GLOBALS['egw_info']['flags']['admin_only']) { diff --git a/phpgwapi/inc/class.egw_sharing.inc.php b/phpgwapi/inc/class.egw_sharing.inc.php index db51e3773e..c7370bc44f 100644 --- a/phpgwapi/inc/class.egw_sharing.inc.php +++ b/phpgwapi/inc/class.egw_sharing.inc.php @@ -108,7 +108,7 @@ class egw_sharing $path_info = $matches[1]; } $path_info = substr($path_info, strlen($_SERVER['SCRIPT_NAME'])); - list(, $token/*, $path*/) = explode('/', $path_info, 3); + list(, $token/*, $path*/) = preg_split('|[/?]|', $path_info, 3); $_SERVER['PHP_AUTH_USER'] = $token; if (!isset($_SERVER['PHP_AUTH_PW'])) $_SERVER['PHP_AUTH_PW'] = ''; @@ -249,6 +249,9 @@ class egw_sharing } // run full eTemplate2 UI for directories $_GET['path'] = '/'; + $_GET['cd'] = 'no'; + $GLOBALS['egw_info']['flags']['js_link_registry'] = true; + egw_framework::includeCSS('/filemanager/templates/default/sharing.css'); $ui = new egw_sharing_filemanager(); $ui->index(); }