2012-12-14 07:53:13 +00:00
< ? php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
// Copyright (C) 2009-2012 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2013-02-14 11:10:53 +00:00
class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
2014-12-08 13:49:26 +00:00
/**
* @ var string $extraheader extra html code inserted in the html header
* of the page
*
* @ access protected
*/
protected $extraheader ;
2012-12-14 07:53:13 +00:00
function __construct ( $params , $theme = 'bootstrap' ) {
2018-04-06 06:31:11 +00:00
parent :: __construct ( $params , $theme );
2015-09-18 05:53:20 +00:00
$this -> extraheader = array ( 'js' => '' , 'css' => '' );
2014-06-04 17:20:07 +00:00
$this -> footerjs = array ();
2012-12-14 07:53:13 +00:00
}
2014-06-04 17:20:07 +00:00
/**
* Add javascript to an internal array which is output at the
* end of the page within a document . ready () function .
*
* @ param string $script javascript to be added
*/
function addFooterJS ( $script ) { /* {{{ */
$this -> footerjs [] = $script ;
} /* }}} */
2017-10-19 11:47:25 +00:00
function htmlStartPage ( $title = " " , $bodyClass = " " , $base = " " , $httpheader = array ()) { /* {{{ */
2016-03-18 14:33:18 +00:00
if ( 1 || method_exists ( $this , 'js' )) {
2015-12-14 08:50:49 +00:00
/* We still need unsafe - eval , because printDocumentChooserHtml and
* printFolderChooserHtml will include a javascript file with ajax
2018-08-20 15:13:57 +00:00
* which is evaluated by jquery
2019-02-04 13:43:57 +00:00
* worker - src blob : is needed for cytoscape
2015-12-14 08:50:49 +00:00
* X - WebKit - CSP is deprecated , Chrome understands Content - Security - Policy
* since version 25 +
* X - Content - Security - Policy is deprecated , Firefox understands
* Content - Security - Policy since version 23 +
2018-11-16 10:36:48 +00:00
* 'worker-src blob:' is needed for cytoscape
2015-12-14 08:50:49 +00:00
*/
2020-03-13 18:43:47 +00:00
$csp_rules = " script-src 'self' 'unsafe-eval'; " ;
$csp_rules .= " worker-src blob:; " ;
//$csp_rules .= "style-src 'self';";
/* Do not allow to embed myself into frames on foreigns pages */
$csp_rules .= " frame-ancestors 'self'; " ;
2015-12-11 07:13:05 +00:00
foreach ( array ( " X-WebKit-CSP " , " X-Content-Security-Policy " , " Content-Security-Policy " ) as $csp ) {
header ( $csp . " : " . $csp_rules );
}
}
2020-03-13 18:43:47 +00:00
header ( 'X-Content-Type-Options: nosniff' );
header ( 'Strict-Transport-Security: max-age=15768000' );
2017-10-19 11:47:25 +00:00
if ( $httpheader ) {
foreach ( $httpheader as $name => $value ) {
header ( $name . " : " . $value );
}
}
2017-03-10 08:28:16 +00:00
$hookObjs = $this -> getHookObjects ( 'SeedDMS_View_Bootstrap' );
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'startPage' )) {
$hookObj -> startPage ( $this );
}
}
2012-12-14 07:53:13 +00:00
echo " <!DOCTYPE html> \n " ;
echo " <html lang= \" en \" > \n <head> \n " ;
echo " <meta http-equiv= \" Content-Type \" content= \" text/html; charset=utf-8 \" /> \n " ;
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . " \n " ;
2015-07-15 20:32:19 +00:00
if ( $base )
2018-04-06 06:31:11 +00:00
echo '<base href="' . $base . '">' . " \n " ;
elseif ( $this -> baseurl )
echo '<base href="' . $this -> baseurl . '">' . " \n " ;
2018-08-08 04:51:27 +00:00
$sitename = trim ( strip_tags ( $this -> params [ 'sitename' ]));
2018-07-13 13:25:33 +00:00
if ( $this -> params [ 'session' ])
echo '<link rel="search" type="application/opensearchdescription+xml" href="../out/out.OpensearchDesc.php" title="' . ( strlen ( $sitename ) > 0 ? $sitename : " SeedDMS " ) . '"/>' . " \n " ;
2012-12-14 07:53:13 +00:00
echo '<link href="../styles/' . $this -> theme . '/bootstrap/css/bootstrap.css" rel="stylesheet">' . " \n " ;
echo '<link href="../styles/' . $this -> theme . '/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">' . " \n " ;
2013-04-19 12:30:57 +00:00
echo '<link href="../styles/' . $this -> theme . '/font-awesome/css/font-awesome.css" rel="stylesheet">' . " \n " ;
2018-06-19 07:13:25 +00:00
// echo '<link href="../styles/'.$this->theme.'/datepicker/css/datepicker.css" rel="stylesheet">'."\n";
echo '<link href="../styles/' . $this -> theme . '/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">' . " \n " ;
2012-12-14 07:53:13 +00:00
echo '<link href="../styles/' . $this -> theme . '/chosen/css/chosen.css" rel="stylesheet">' . " \n " ;
2016-11-02 11:26:16 +00:00
echo '<link href="../styles/' . $this -> theme . '/select2/css/select2.min.css" rel="stylesheet">' . " \n " ;
echo '<link href="../styles/' . $this -> theme . '/select2/css/select2-bootstrap.css" rel="stylesheet">' . " \n " ;
2013-05-24 15:32:12 +00:00
echo '<link href="../styles/' . $this -> theme . '/jqtree/jqtree.css" rel="stylesheet">' . " \n " ;
2016-03-18 14:33:18 +00:00
echo '<link href="../styles/' . $this -> theme . '/application.css" rel="stylesheet">' . " \n " ;
2015-09-18 05:53:20 +00:00
if ( $this -> extraheader [ 'css' ])
echo $this -> extraheader [ 'css' ];
2017-04-11 08:10:04 +00:00
if ( method_exists ( $this , 'css' ))
2020-04-14 15:07:53 +00:00
echo '<link href="' . $this -> params [ 'absbaseprefix' ] . 'out/out.' . $this -> params [ 'class' ] . '.php?action=css' . ( ! empty ( $_SERVER [ 'QUERY_STRING' ]) ? '&' . $_SERVER [ 'QUERY_STRING' ] : '' ) . '" rel="stylesheet">' . " \n " ;
2014-07-03 10:04:11 +00:00
2014-04-01 19:04:55 +00:00
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/jquery/jquery.min.js"></script>' . " \n " ;
2015-09-18 05:53:20 +00:00
if ( $this -> extraheader [ 'js' ])
echo $this -> extraheader [ 'js' ];
2017-01-06 06:19:17 +00:00
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/passwordstrength/jquery.passwordstrength.js"></script>' . " \n " ;
2013-05-24 15:32:12 +00:00
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/noty/jquery.noty.js"></script>' . " \n " ;
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/noty/layouts/topRight.js"></script>' . " \n " ;
2016-08-31 13:23:12 +00:00
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/noty/layouts/topCenter.js"></script>' . " \n " ;
2013-05-24 15:32:12 +00:00
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/noty/themes/default.js"></script>' . " \n " ;
echo '<script type="text/javascript" src="../styles/' . $this -> theme . '/jqtree/tree.jquery.js"></script>' . " \n " ;
2015-07-15 20:32:19 +00:00
// echo '<script type="text/javascript" src="../styles/'.$this->theme.'/jquery-cookie/jquery.cookie.js"></script>'."\n";
2012-12-14 07:53:13 +00:00
echo '<link rel="shortcut icon" href="../styles/' . $this -> theme . '/favicon.ico" type="image/x-icon"/>' . " \n " ;
2013-05-23 14:42:51 +00:00
if ( $this -> params [ 'session' ] && $this -> params [ 'session' ] -> getSu ()) {
?>
< style type = " text/css " >
. navbar - inverse . navbar - inner {
background - image : - webkit - gradient ( linear , 0 0 , 0 100 % , from ( #882222), to(#111111));
background - image : webkit - linear - gradient ( top , #882222, #111111);
background - image : linear - gradient ( to bottom , #882222, #111111);;
}
</ style >
< ? php
}
2014-11-07 07:54:47 +00:00
echo " <title> " . ( strlen ( $sitename ) > 0 ? $sitename : " SeedDMS " ) . ( strlen ( $title ) > 0 ? " : " : " " ) . htmlspecialchars ( $title ) . " </title> \n " ;
2012-12-14 07:53:13 +00:00
echo " </head> \n " ;
echo " <body " . ( strlen ( $bodyClass ) > 0 ? " class= \" " . $bodyClass . " \" " : " " ) . " > \n " ;
2013-05-23 14:42:51 +00:00
if ( $this -> params [ 'session' ] && $flashmsg = $this -> params [ 'session' ] -> getSplashMsg ()) {
2013-05-21 06:36:11 +00:00
$this -> params [ 'session' ] -> clearSplashMsg ();
2018-03-21 12:40:34 +00:00
echo " <div class= \" splash \" data-type= \" " . $flashmsg [ 'type' ] . " \" " . ( ! empty ( $flashmsg [ 'timeout' ]) ? ' data-timeout="' . $flashmsg [ 'timeout' ] . '"' : '' ) . " > " . $flashmsg [ 'msg' ] . " </div> \n " ;
2013-05-18 20:29:45 +00:00
}
2019-07-12 14:43:34 +00:00
echo " <div class= \" statusbar-container \" ><h1> " . getMLText ( 'recent_uploads' ) . " </h1></div> \n " ;
2017-03-18 18:01:41 +00:00
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'startBody' )) {
$hookObj -> startBody ( $this );
}
}
2012-12-14 07:53:13 +00:00
} /* }}} */
2015-09-18 05:53:20 +00:00
function htmlAddHeader ( $head , $type = 'js' ) { /* {{{ */
$this -> extraheader [ $type ] .= $head ;
2013-01-24 09:35:56 +00:00
} /* }}} */
2015-12-11 19:29:52 +00:00
function htmlEndPage ( $nofooter = false ) { /* {{{ */
if ( ! $nofooter ) {
2019-05-13 06:13:30 +00:00
$hookObjs = $this -> getHookObjects ( 'SeedDMS_View_Bootstrap' );
$html = $this -> footNote ();
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'footNote' )) {
$html = $hookObj -> footNote ( $this , $html );
}
}
echo $html ;
2015-12-11 19:29:52 +00:00
if ( $this -> params [ 'showmissingtranslations' ]) {
2017-03-10 10:33:13 +00:00
$this -> missingLanguageKeys ();
2015-12-11 19:29:52 +00:00
}
2014-04-08 08:47:28 +00:00
}
2012-12-14 07:53:13 +00:00
echo '<script src="../styles/' . $this -> theme . '/bootstrap/js/bootstrap.min.js"></script>' . " \n " ;
echo '<script src="../styles/' . $this -> theme . '/datepicker/js/bootstrap-datepicker.js"></script>' . " \n " ;
2018-06-19 07:13:25 +00:00
foreach ( array ( 'de' , 'es' , 'ar' , 'el' , 'bg' , 'ru' , 'hr' , 'hu' , 'ko' , 'pl' , 'ro' , 'sk' , 'tr' , 'uk' , 'ca' , 'nl' , 'fi' , 'cs' , 'it' , 'fr' , 'sv' , 'sl' , 'pt-BR' , 'zh-CN' , 'zh-TW' ) as $lang )
echo '<script src="../styles/' . $this -> theme . '/datepicker/locales/bootstrap-datepicker.' . $lang . '.min.js"></script>' . " \n " ;
2012-12-14 07:53:13 +00:00
echo '<script src="../styles/' . $this -> theme . '/chosen/js/chosen.jquery.min.js"></script>' . " \n " ;
2016-11-02 11:26:16 +00:00
echo '<script src="../styles/' . $this -> theme . '/select2/js/select2.min.js"></script>' . " \n " ;
2017-06-09 10:30:23 +00:00
parse_str ( $_SERVER [ 'QUERY_STRING' ], $tmp );
$tmp [ 'action' ] = 'webrootjs' ;
echo '<script src="' . $this -> params [ 'absbaseprefix' ] . 'out/out.' . $this -> params [ 'class' ] . '.php?' . http_build_query ( $tmp ) . '"></script>' . " \n " ;
2012-12-14 07:53:13 +00:00
echo '<script src="../styles/' . $this -> theme . '/application.js"></script>' . " \n " ;
2018-03-26 08:05:14 +00:00
if ( $this -> params [ 'enablemenutasks' ] && isset ( $this -> params [ 'user' ]) && $this -> params [ 'user' ]) {
2017-05-12 16:09:53 +00:00
$this -> addFooterJS ( 'checkTasks();' );
2019-12-20 09:53:09 +00:00
}
if ( $this -> params [ 'enabledropfolderlist' ] && isset ( $this -> params [ 'user' ]) && $this -> params [ 'user' ]) {
2019-09-05 10:53:45 +00:00
$this -> addFooterJS ( 'updateDropFolder();' );
2017-05-12 16:09:53 +00:00
}
2014-06-04 17:20:07 +00:00
if ( $this -> footerjs ) {
2017-01-09 09:57:07 +00:00
$jscode = " $ (document).ready(function () { \n " ;
2014-06-04 17:20:07 +00:00
foreach ( $this -> footerjs as $script ) {
2017-01-09 09:57:07 +00:00
$jscode .= $script . " \n " ;
2014-06-04 17:20:07 +00:00
}
2017-01-09 09:57:07 +00:00
$jscode .= " }); \n " ;
$hashjs = md5 ( $jscode );
if ( ! is_dir ( $this -> params [ 'cachedir' ] . '/js' )) {
SeedDMS_Core_File :: makeDir ( $this -> params [ 'cachedir' ] . '/js' );
}
if ( is_dir ( $this -> params [ 'cachedir' ] . '/js' )) {
file_put_contents ( $this -> params [ 'cachedir' ] . '/js/' . $hashjs . '.js' , $jscode );
}
2017-01-20 13:58:39 +00:00
$tmp [ 'action' ] = 'footerjs' ;
$tmp [ 'hash' ] = $hashjs ;
2017-02-22 12:22:08 +00:00
echo '<script src="' . $this -> params [ 'absbaseprefix' ] . 'out/out.' . $this -> params [ 'class' ] . '.php?' . http_build_query ( $tmp ) . '"></script>' . " \n " ;
2014-06-04 17:20:07 +00:00
}
2016-02-29 07:36:10 +00:00
if ( method_exists ( $this , 'js' )) {
parse_str ( $_SERVER [ 'QUERY_STRING' ], $tmp );
$tmp [ 'action' ] = 'js' ;
2017-02-22 12:22:08 +00:00
echo '<script src="' . $this -> params [ 'absbaseprefix' ] . 'out/out.' . $this -> params [ 'class' ] . '.php?' . http_build_query ( $tmp ) . '"></script>' . " \n " ;
2016-02-29 07:36:10 +00:00
}
2012-12-14 07:53:13 +00:00
echo " </body> \n </html> \n " ;
} /* }}} */
2017-05-17 07:22:05 +00:00
function webrootjs () { /* {{{ */
header ( 'Content-Type: application/javascript' );
echo " var seeddms_absbaseprefix= \" " . $this -> params [ 'absbaseprefix' ] . " \" ; \n " ;
echo " var seeddms_webroot= \" " . $this -> params [ 'settings' ] -> _httpRoot . " \" ; \n " ;
2020-01-22 14:54:10 +00:00
/* Place the current folder id in a js variable , just in case some js code
* needs it , e . g . for reloading parts of the page via ajax .
*/
if ( ! empty ( $_REQUEST [ 'folderid' ]))
echo " var seeddms_folder= " . ( int ) $_REQUEST [ 'folderid' ] . " ; \n " ;
else
echo " var seeddms_folder=0; \n " ;
2017-05-17 07:22:05 +00:00
} /* }}} */
2017-01-09 09:57:07 +00:00
function footerjs () { /* {{{ */
header ( 'Content-Type: application/javascript' );
if ( file_exists ( $this -> params [ 'cachedir' ] . '/js/' . $_GET [ 'hash' ] . '.js' )) {
readfile ( $this -> params [ 'cachedir' ] . '/js/' . $_GET [ 'hash' ] . '.js' );
}
} /* }}} */
2017-03-10 10:33:13 +00:00
function missingLanguageKeys () { /* {{{ */
2014-04-08 08:47:28 +00:00
global $MISSING_LANG , $LANG ;
if ( $MISSING_LANG ) {
2016-05-24 05:46:34 +00:00
echo '<div class="container-fluid">' . " \n " ;
echo '<div class="row-fluid">' . " \n " ;
2014-04-08 08:47:28 +00:00
echo '<div class="alert alert-error">' . " \n " ;
echo " <p><strong>This page contains missing translations in the selected language. Please help to improve SeedDMS and provide the translation.</strong></p> " ;
echo " </div> " ;
echo " <table class= \" table table-condensed \" > " ;
echo " <tr><th>Key</th><th>engl. Text</th><th>Your translation</th></tr> \n " ;
foreach ( $MISSING_LANG as $key => $lang ) {
2016-05-24 05:50:43 +00:00
echo " <tr><td> " . $key . " </td><td> " . ( isset ( $LANG [ 'en_GB' ][ $key ]) ? $LANG [ 'en_GB' ][ $key ] : '' ) . " </td><td><div class= \" input-append send-missing-translation \" ><input name= \" missing-lang-key \" type= \" hidden \" value= \" " . $key . " \" /><input name= \" missing-lang-lang \" type= \" hidden \" value= \" " . $lang . " \" /><input type= \" text \" class= \" input-xxlarge \" name= \" missing-lang-translation \" placeholder= \" Your translation in ' " . $lang . " ' \" /><a class= \" btn \" >Submit</a></div></td></tr> " ;
2014-04-08 08:47:28 +00:00
}
echo " </table> " ;
2015-12-16 05:36:20 +00:00
echo " <div class= \" splash \" data-type= \" error \" data-timeout= \" 5500 \" ><b>There are missing translations on this page!</b><br />Please check the bottom of the page.</div> \n " ;
2016-05-24 05:46:34 +00:00
echo " </div> \n " ;
echo " </div> \n " ;
2014-04-08 08:47:28 +00:00
}
} /* }}} */
2012-12-14 07:53:13 +00:00
function footNote () { /* {{{ */
2019-05-13 06:13:30 +00:00
$html = " <div class= \" container-fluid \" > \n " ;
$html .= '<div class="row-fluid">' . " \n " ;
$html .= '<div class="span12">' . " \n " ;
$html .= '<div class="alert alert-info">' . " \n " ;
2012-12-14 07:53:13 +00:00
if ( $this -> params [ 'printdisclaimer' ]){
2019-05-13 06:13:30 +00:00
$html .= " <div class= \" disclaimer \" > " . getMLText ( " disclaimer " ) . " </div> " ;
2012-12-14 07:53:13 +00:00
}
if ( isset ( $this -> params [ 'footnote' ]) && strlen (( string ) $this -> params [ 'footnote' ]) > 0 ) {
2019-05-13 06:13:30 +00:00
$html .= " <div class= \" footNote \" > " . ( string ) $this -> params [ 'footnote' ] . " </div> " ;
2012-12-14 07:53:13 +00:00
}
2019-05-13 06:13:30 +00:00
$html .= " </div> \n " ;
$html .= " </div> \n " ;
$html .= " </div> \n " ;
$html .= " </div> \n " ;
2012-12-14 07:53:13 +00:00
2019-05-13 06:13:30 +00:00
return $html ;
2012-12-14 07:53:13 +00:00
} /* }}} */
function contentStart () { /* {{{ */
echo " <div class= \" container-fluid \" > \n " ;
echo " <div class= \" row-fluid \" > \n " ;
} /* }}} */
function contentEnd () { /* {{{ */
echo " </div> \n " ;
echo " </div> \n " ;
} /* }}} */
function globalBanner () { /* {{{ */
echo " <div class= \" navbar navbar-inverse navbar-fixed-top \" > \n " ;
echo " <div class= \" navbar-inner \" > \n " ;
2014-05-16 09:05:53 +00:00
echo " <div class= \" container-fluid \" > \n " ;
2013-02-14 11:10:53 +00:00
echo " <a class= \" brand \" href= \" ../out/out.ViewFolder.php?folderid= " . $this -> params [ 'rootfolderid' ] . " \" > " . ( strlen ( $this -> params [ 'sitename' ]) > 0 ? $this -> params [ 'sitename' ] : " SeedDMS " ) . " </a> \n " ;
2012-12-14 07:53:13 +00:00
echo " </div> \n " ;
echo " </div> \n " ;
echo " </div> \n " ;
} /* }}} */
function globalNavigation ( $folder = null ) { /* {{{ */
2014-12-08 13:49:26 +00:00
$dms = $this -> params [ 'dms' ];
2012-12-14 07:53:13 +00:00
echo " <div class= \" navbar navbar-inverse navbar-fixed-top \" > \n " ;
echo " <div class= \" navbar-inner \" > \n " ;
2014-05-16 09:05:53 +00:00
echo " <div class= \" container-fluid \" > \n " ;
2013-03-20 10:17:07 +00:00
echo " <a class= \" btn btn-navbar \" data-toggle= \" collapse \" data-target= \" .nav-col1 \" > \n " ;
2013-02-27 16:16:51 +00:00
echo " <span class= \" icon-bar \" ></span> \n " ;
echo " <span class= \" icon-bar \" ></span> \n " ;
echo " <span class= \" icon-bar \" ></span> \n " ;
echo " </a> \n " ;
2013-02-14 11:10:53 +00:00
echo " <a class= \" brand \" href= \" ../out/out.ViewFolder.php?folderid= " . $this -> params [ 'rootfolderid' ] . " \" > " . ( strlen ( $this -> params [ 'sitename' ]) > 0 ? $this -> params [ 'sitename' ] : " SeedDMS " ) . " </a> \n " ;
2013-02-07 17:02:23 +00:00
if ( isset ( $this -> params [ 'user' ]) && $this -> params [ 'user' ]) {
2013-09-09 18:46:33 +00:00
echo " <div class= \" nav-collapse nav-col1 \" > \n " ;
2015-07-15 20:32:19 +00:00
echo " <ul id= \" main-menu-admin \" class= \" nav pull-right \" > \n " ;
2013-04-19 07:00:34 +00:00
echo " <li class= \" dropdown \" > \n " ;
2013-04-19 12:30:57 +00:00
echo " <a href= \" # \" class= \" dropdown-toggle \" data-toggle= \" dropdown \" > " . ( $this -> params [ 'session' ] -> getSu () ? getMLText ( " switched_to " ) : getMLText ( " signed_in_as " )) . " ' " . htmlspecialchars ( $this -> params [ 'user' ] -> getFullName ()) . " ' <i class= \" icon-caret-down \" ></i></a> \n " ;
2013-01-28 10:18:19 +00:00
echo " <ul class= \" dropdown-menu \" role= \" menu \" > \n " ;
2013-04-19 07:00:34 +00:00
if ( ! $this -> params [ 'user' ] -> isGuest ()) {
2016-04-05 07:42:46 +00:00
$menuitems = array ();
$menuitems [ 'my_documents' ] = array ( 'link' => " ../out/out.MyDocuments.php?inProcess=1 " , 'label' => 'my_documents' );
$menuitems [ 'my_account' ] = array ( 'link' => " ../out/out.MyAccount.php " , 'label' => 'my_account' );
$hookObjs = $this -> getHookObjects ( 'SeedDMS_View_Bootstrap' );
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'userMenuItems' )) {
$menuitems = $hookObj -> userMenuItems ( $this , $menuitems );
}
}
2016-09-28 12:59:39 +00:00
if ( $menuitems ) {
foreach ( $menuitems as $menuitem ) {
echo " <li><a href= \" " . $menuitem [ 'link' ] . " \" > " . getMLText ( $menuitem [ 'label' ]) . " </a></li> " ;
}
echo " <li class= \" divider \" ></li> \n " ;
2016-04-05 07:42:46 +00:00
}
2013-04-19 07:00:34 +00:00
}
2014-04-01 04:49:29 +00:00
$showdivider = false ;
2013-04-19 07:00:34 +00:00
if ( $this -> params [ 'enablelanguageselector' ]) {
2014-04-01 04:49:29 +00:00
$showdivider = true ;
2013-04-19 07:00:34 +00:00
echo " <li class= \" dropdown-submenu \" > \n " ;
echo " <a href= \" # \" class= \" dropdown-toggle \" data-toggle= \" dropdown \" > " . getMLText ( " language " ) . " </a> \n " ;
echo " <ul class= \" dropdown-menu \" role= \" menu \" > \n " ;
$languages = getLanguages ();
foreach ( $languages as $currLang ) {
if ( $this -> params [ 'session' ] -> getLanguage () == $currLang )
echo " <li class= \" active \" > " ;
else
echo " <li> " ;
echo " <a href= \" ../op/op.SetLanguage.php?lang= " . $currLang . " &referer= " . $_SERVER [ " REQUEST_URI " ] . " \" > " ;
echo getMLText ( $currLang ) . " </a></li> \n " ;
}
echo " </ul> \n " ;
echo " </li> \n " ;
}
2014-04-01 04:49:29 +00:00
if ( $this -> params [ 'user' ] -> isAdmin ()) {
$showdivider = true ;
2013-09-30 09:08:05 +00:00
echo " <li><a href= \" ../out/out.SubstituteUser.php \" > " . getMLText ( " substitute_user " ) . " </a></li> \n " ;
2014-04-01 04:49:29 +00:00
}
if ( $showdivider )
echo " <li class= \" divider \" ></li> \n " ;
2013-04-19 07:00:34 +00:00
if ( $this -> params [ 'session' ] -> getSu ()) {
echo " <li><a href= \" ../op/op.ResetSu.php \" > " . getMLText ( " sign_out_user " ) . " </a></li> \n " ;
} else {
echo " <li><a href= \" ../op/op.Logout.php \" > " . getMLText ( " sign_out " ) . " </a></li> \n " ;
2013-01-28 10:18:19 +00:00
}
echo " </ul> \n " ;
echo " </li> \n " ;
2013-04-19 07:00:34 +00:00
echo " </ul> \n " ;
2012-12-14 07:53:13 +00:00
2019-11-20 16:50:26 +00:00
if ( $this -> params [ 'enablemenutasks' ] && ! $this -> params [ 'user' ] -> isGuest ()) {
2017-05-12 16:09:53 +00:00
echo " <div id= \" menu-tasks \" > " ;
2019-11-12 14:22:00 +00:00
echo " <div class= \" ajax \" data-no-spinner= \" true \" data-view= \" Tasks \" data-action= \" menuTasks \" ></div> " ;
// echo " <ul id=\"main-menu-tasks\" class=\"nav pull-right\">\n";
// echo " <li class=\"dropdown\">\n";
2017-05-12 16:09:53 +00:00
// echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array()));
2019-11-12 14:22:00 +00:00
// echo " </li>\n";
// echo " </ul>\n";
2017-05-12 16:09:53 +00:00
echo " </div> " ;
//$this->addFooterJS('checkTasks();');
}
2017-07-31 18:30:59 +00:00
if ( $this -> params [ 'dropfolderdir' ] && $this -> params [ 'enabledropfolderlist' ]) {
echo " <div id= \" menu-dropfolder \" > " ;
2017-08-01 05:58:05 +00:00
echo " <div class= \" ajax \" data-no-spinner= \" true \" data-view= \" DropFolderChooser \" data-action= \" menuList \" " ;
2019-08-08 07:32:42 +00:00
if ( $folder != null && is_object ( $folder ) && $folder -> isType ( 'folder' ))
2017-08-01 05:58:05 +00:00
echo " data-query= \" folderid= " . $folder -> getID () . " \" " ;
echo " ></div> " ;
2017-07-31 18:30:59 +00:00
echo " </div> " ;
}
2017-04-11 06:34:52 +00:00
if ( $this -> params [ 'enablesessionlist' ]) {
2017-03-24 14:55:43 +00:00
echo " <div id= \" menu-session \" > " ;
echo " <div class= \" ajax \" data-no-spinner= \" true \" data-view= \" Session \" data-action= \" menuSessions \" ></div> " ;
echo " </div> " ;
2017-03-24 14:56:33 +00:00
}
2015-02-24 16:47:58 +00:00
if ( $this -> params [ 'enableclipboard' ]) {
echo " <div id= \" menu-clipboard \" > " ;
2020-05-18 16:29:52 +00:00
echo " <div class= \" ajax \" data-no-spinner= \" true \" data-view= \" Clipboard \" data-action= \" menuClipboard \" data-query= \" folderid= " . ( $folder != null ? $folder -> getID () : 0 ) . " \" ></div> " ;
2015-02-24 16:47:58 +00:00
echo " </div> " ;
}
2013-06-13 21:16:46 +00:00
2013-04-19 07:00:34 +00:00
echo " <ul class= \" nav \" > \n " ;
2020-04-21 13:23:37 +00:00
$menuitems = array ();
if ( $this -> params [ 'enablecalendar' ]) $menuitems [ 'calendar' ] = array ( 'link' => '../out/out.Calendar.php?mode=' . $this -> params [ 'calendardefaultview' ], 'label' => " calendar " );
if ( $this -> params [ 'user' ] -> isAdmin ()) $menuitems [ 'admintools' ] = array ( 'link' => '../out/out.AdminTools.php' , 'label' => " admin_tools " );
2016-02-01 18:57:08 +00:00
if ( $this -> params [ 'enablehelp' ]) {
2020-04-21 13:23:37 +00:00
$tmp = explode ( '.' , basename ( $_SERVER [ 'SCRIPT_FILENAME' ]));
$menuitems [ 'help' ] = array ( 'link' => '../out/out.Help.php?context=' . $tmp [ 1 ], 'label' => " help " );
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
2020-04-21 13:38:18 +00:00
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'globalNavigationBar' )) {
$menuitems = $hookObj -> globalNavigationBar ( $this , $menuitems );
}
}
2020-04-21 13:23:37 +00:00
foreach ( $menuitems as $menuitem ) {
2020-04-21 13:51:40 +00:00
if ( ! empty ( $menuitem [ 'children' ])) {
echo " <li class= \" dropdown \" > \n " ;
echo " <a class= \" dropdown-toggle \" data-toggle= \" dropdown \" > " . getMLText ( $menuitem [ 'label' ]) . " <i class= \" icon-caret-down \" ></i></a> \n " ;
echo " <ul class= \" dropdown-menu \" role= \" menu \" > \n " ;
foreach ( $menuitem [ 'children' ] as $submenuitem ) {
echo " <li><a href= \" " . $submenuitem [ 'link' ] . " \" " . ( isset ( $submenuitem [ 'target' ]) ? ' target="' . $submenuitem [ 'target' ] . '"' : '' ) . " > " . getMLText ( $submenuitem [ 'label' ]) . " </a></li> \n " ;
}
echo " </ul> \n " ;
} else {
echo " <li><a href= \" " . $menuitem [ 'link' ] . " \" " . ( isset ( $menuitem [ 'target' ]) ? ' target="' . $menuitem [ 'target' ] . '"' : '' ) . " > " . getMLText ( $menuitem [ 'label' ]) . " </a></li> " ;
}
2016-02-01 18:57:08 +00:00
}
2013-04-19 07:00:34 +00:00
echo " </ul> \n " ;
2015-12-14 10:45:56 +00:00
echo " <form action= \" ../out/out.Search.php \" class= \" form-inline navbar-search pull-left \" autocomplete= \" off \" > " ;
2019-08-08 07:32:42 +00:00
if ( $folder != null && is_object ( $folder ) && $folder -> isType ( 'folder' )) {
2013-04-19 07:00:34 +00:00
echo " <input type= \" hidden \" name= \" folderid \" value= \" " . $folder -> getID () . " \" /> " ;
}
echo " <input type= \" hidden \" name= \" navBar \" value= \" 1 \" /> " ;
2018-07-13 13:25:33 +00:00
echo " <input name= \" query \" class= \" search-query \" " . ( $this -> params [ 'defaultsearchmethod' ] == 'fulltext' ? " " : " id= \" searchfield \" " ) . " data-provide= \" typeahead \" type= \" search \" style= \" width: 150px; \" placeholder= \" " . getMLText ( " search " ) . " \" /> " ;
2016-02-03 13:46:06 +00:00
if ( $this -> params [ 'defaultsearchmethod' ] == 'fulltext' )
echo " <input type= \" hidden \" name= \" fullsearch \" value= \" 1 \" /> " ;
2016-02-01 18:57:08 +00:00
// if($this->params['enablefullsearch']) {
// echo " <label class=\"checkbox\" style=\"color: #999999;\"><input type=\"checkbox\" name=\"fullsearch\" value=\"1\" title=\"".getMLText('fullsearch_hint')."\"/> ".getMLText('fullsearch')."</label>";
// }
2013-04-19 07:00:34 +00:00
// echo " <input type=\"submit\" value=\"".getMLText("search")."\" id=\"searchButton\" class=\"btn\"/>";
echo " </form> \n " ;
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
}
echo " </div> \n " ;
echo " </div> \n " ;
echo " </div> \n " ;
return ;
} /* }}} */
function getFolderPathHTML ( $folder , $tagAll = false , $document = null ) { /* {{{ */
$path = $folder -> getPath ();
$txtpath = " " ;
for ( $i = 0 ; $i < count ( $path ); $i ++ ) {
$txtpath .= " <li> " ;
if ( $i + 1 < count ( $path )) {
2019-07-12 14:43:34 +00:00
$txtpath .= " <a href= \" ../out/out.ViewFolder.php?folderid= " . $path [ $i ] -> getID () . " &showtree= " . showtree () . " \" data-droptarget= \" folder_ " . $path [ $i ] -> getID () . " \" rel= \" folder_ " . $path [ $i ] -> getID () . " \" class= \" table-row-folder droptarget \" data-uploadformtoken= \" " . createFormKey ( '' ) . " \" formtoken= \" " . createFormKey ( '' ) . " \" > " .
2012-12-14 07:53:13 +00:00
htmlspecialchars ( $path [ $i ] -> getName ()) . " </a> " ;
}
else {
$txtpath .= ( $tagAll ? " <a href= \" ../out/out.ViewFolder.php?folderid= " . $path [ $i ] -> getID () . " &showtree= " . showtree () . " \" > " .
htmlspecialchars ( $path [ $i ] -> getName ()) . " </a> " : htmlspecialchars ( $path [ $i ] -> getName ()));
}
$txtpath .= " <span class= \" divider \" >/</span></li> " ;
}
if ( $document )
$txtpath .= " <li><a href= \" ../out/out.ViewDocument.php?documentid= " . $document -> getId () . " \" > " . htmlspecialchars ( $document -> getName ()) . " </a></li> " ;
return '<ul class="breadcrumb">' . $txtpath . '</ul>' ;
} /* }}} */
function pageNavigation ( $pageTitle , $pageType = null , $extra = null ) { /* {{{ */
if ( $pageType != null && strcasecmp ( $pageType , " noNav " )) {
echo " <div class= \" navbar \" > \n " ;
echo " <div class= \" navbar-inner \" > \n " ;
2013-03-26 19:26:28 +00:00
echo " <div class= \" container \" > \n " ;
echo " <a class= \" btn btn-navbar \" data-toggle= \" collapse \" data-target= \" .col2 \" > \n " ;
echo " <span class= \" icon-bar \" ></span> \n " ;
echo " <span class= \" icon-bar \" ></span> \n " ;
2013-08-12 05:02:40 +00:00
echo " <span class= \" icon-bar \" ></span> \n " ;
echo " </a> \n " ;
2012-12-14 07:53:13 +00:00
switch ( $pageType ) {
case " view_folder " :
$this -> folderNavigationBar ( $extra );
break ;
case " view_document " :
2013-03-08 16:55:14 +00:00
$this -> documentNavigationBar ( $extra );
2012-12-14 07:53:13 +00:00
break ;
case " my_documents " :
$this -> myDocumentsNavigationBar ();
break ;
case " my_account " :
$this -> accountNavigationBar ();
break ;
case " admin_tools " :
$this -> adminToolsNavigationBar ();
break ;
2017-02-16 14:02:46 +00:00
case " calendarold " ;
$this -> calendarOldNavigationBar ( $extra );
break ;
2012-12-14 07:53:13 +00:00
case " calendar " ;
$this -> calendarNavigationBar ( $extra );
break ;
2019-10-01 12:06:46 +00:00
default :
if ( $this -> hasHook ( 'pageNavigationBar' )) {
$menubar = $this -> callHook ( 'pageNavigationBar' , $pageType , $extra );
if ( is_string ( $menubar ))
echo $menubar ;
}
2012-12-14 07:53:13 +00:00
}
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
echo " </div> \n " ;
echo " </div> \n " ;
2015-06-30 16:53:40 +00:00
if ( $pageType == " view_folder " || $pageType == " view_document " )
echo $pageTitle . " \n " ;
2012-12-14 07:53:13 +00:00
} else {
echo " <legend> " . $pageTitle . " </legend> \n " ;
}
return ;
} /* }}} */
2020-04-21 15:23:45 +00:00
protected function showNavigationBar ( $menuitems ) { /* {{{ */
2018-04-26 06:49:10 +00:00
foreach ( $menuitems as $menuitem ) {
if ( ! empty ( $menuitem [ 'children' ])) {
echo " <li class= \" dropdown \" > \n " ;
2019-12-04 18:31:02 +00:00
echo " <a class= \" dropdown-toggle \" data-toggle= \" dropdown \" > " . getMLText ( $menuitem [ 'label' ]) . " <i class= \" icon-caret-down \" ></i></a> \n " ;
2018-04-26 06:49:10 +00:00
echo " <ul class= \" dropdown-menu \" role= \" menu \" > \n " ;
foreach ( $menuitem [ 'children' ] as $submenuitem ) {
2019-12-04 18:31:02 +00:00
echo " <li><a href= \" " . $submenuitem [ 'link' ] . " \" " . ( isset ( $submenuitem [ 'target' ]) ? ' target="' . $submenuitem [ 'target' ] . '"' : '' ) . " > " . getMLText ( $submenuitem [ 'label' ]) . " </a></li> \n " ;
2018-04-26 06:49:10 +00:00
}
echo " </ul> \n " ;
} else {
2019-12-04 18:31:02 +00:00
echo " <li><a href= \" " . $menuitem [ 'link' ] . " \" " . ( isset ( $menuitem [ 'target' ]) ? ' target="' . $menuitem [ 'target' ] . '"' : '' ) . " > " . getMLText ( $menuitem [ 'label' ]) . " </a></li> " ;
2018-04-26 06:49:10 +00:00
}
}
} /* }}} */
2013-01-28 10:18:19 +00:00
private function folderNavigationBar ( $folder ) { /* {{{ */
2014-12-08 13:49:26 +00:00
$dms = $this -> params [ 'dms' ];
2019-08-08 07:32:42 +00:00
if ( ! is_object ( $folder ) || ! $folder -> isType ( 'folder' )) {
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
echo " </ul> \n " ;
return ;
}
2013-01-28 10:18:19 +00:00
$accessMode = $folder -> getAccessMode ( $this -> params [ 'user' ]);
2012-12-14 07:53:13 +00:00
$folderID = $folder -> getID ();
2013-03-26 19:26:28 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.ViewFolder.php?folderid= " . $folderID . " &showtree= " . showtree () . " \" class= \" brand \" > " . getMLText ( " folder " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
2015-07-15 20:08:59 +00:00
$menuitems = array ();
2013-03-26 19:26:28 +00:00
2013-01-28 10:18:19 +00:00
if ( $accessMode == M_READ && ! $this -> params [ 'user' ] -> isGuest ()) {
2015-11-27 14:45:01 +00:00
$menuitems [ 'edit_folder_notify' ] = array ( 'link' => " ../out/out.FolderNotify.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'edit_folder_notify' );
2012-12-14 07:53:13 +00:00
}
else if ( $accessMode >= M_READWRITE ) {
2015-07-15 20:08:59 +00:00
$menuitems [ 'add_subfolder' ] = array ( 'link' => " ../out/out.AddSubFolder.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'add_subfolder' );
$menuitems [ 'add_document' ] = array ( 'link' => " ../out/out.AddDocument.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'add_document' );
2017-01-31 16:22:57 +00:00
if ( 0 && $this -> params [ 'enablelargefileupload' ])
2015-07-15 20:08:59 +00:00
$menuitems [ 'add_multiple_documents' ] = array ( 'link' => " ../out/out.AddMultiDocument.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'add_multiple_documents' );
$menuitems [ 'edit_folder_props' ] = array ( 'link' => " ../out/out.EditFolder.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'edit_folder_props' );
2013-01-28 10:18:19 +00:00
if ( $folderID != $this -> params [ 'rootfolderid' ] && $folder -> getParent ())
2015-07-15 20:08:59 +00:00
$menuitems [ 'move_folder' ] = array ( 'link' => " ../out/out.MoveFolder.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'move_folder' );
2012-12-14 07:53:13 +00:00
if ( $accessMode == M_ALL ) {
2013-01-28 10:18:19 +00:00
if ( $folderID != $this -> params [ 'rootfolderid' ] && $folder -> getParent ())
2015-07-15 20:08:59 +00:00
$menuitems [ 'rm_folder' ] = array ( 'link' => " ../out/out.RemoveFolder.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'rm_folder' );
2012-12-14 07:53:13 +00:00
}
if ( $accessMode == M_ALL ) {
2015-07-15 20:08:59 +00:00
$menuitems [ 'edit_folder_access' ] = array ( 'link' => " ../out/out.FolderAccess.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'edit_folder_access' );
2012-12-14 07:53:13 +00:00
}
2015-07-15 20:08:59 +00:00
$menuitems [ 'edit_existing_notify' ] = array ( 'link' => " ../out/out.FolderNotify.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'edit_existing_notify' );
2012-12-14 07:53:13 +00:00
}
2015-06-15 13:28:25 +00:00
if ( $this -> params [ 'user' ] -> isAdmin () && $this -> params [ 'enablefullsearch' ]) {
2015-07-15 20:08:59 +00:00
$menuitems [ 'index_folder' ] = array ( 'link' => " ../out/out.Indexer.php?folderid= " . $folderID . " &showtree= " . showtree (), 'label' => 'index_folder' );
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'folderNavigationBar' ))
$menuitems = $this -> callHook ( 'folderNavigationBar' , $folder , $menuitems );
2018-04-26 06:49:10 +00:00
self :: showNavigationBar ( $menuitems );
2012-12-14 07:53:13 +00:00
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
2013-03-08 16:55:14 +00:00
private function documentNavigationBar ( $document ) { /* {{{ */
2013-01-28 10:18:19 +00:00
$accessMode = $document -> getAccessMode ( $this -> params [ 'user' ]);
2012-12-14 07:53:13 +00:00
$docid = " .php?documentid= " . $document -> getID ();
2013-03-26 19:26:28 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.ViewDocument " . $docid . " \" class= \" brand \" > " . getMLText ( " document " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
2015-07-15 05:24:32 +00:00
$menuitems = array ();
2013-03-26 19:26:28 +00:00
2012-12-14 07:53:13 +00:00
if ( $accessMode >= M_READWRITE ) {
if ( ! $document -> isLocked ()) {
2015-07-15 05:24:32 +00:00
$menuitems [ 'update_document' ] = array ( 'link' => " ../out/out.UpdateDocument " . $docid , 'label' => 'update_document' );
$menuitems [ 'lock_document' ] = array ( 'link' => " ../op/op.LockDocument " . $docid , 'label' => 'lock_document' );
$menuitems [ 'edit_document_props' ] = array ( 'link' => " ../out/out.EditDocument " . $docid , 'label' => 'edit_document_props' );
$menuitems [ 'move_document' ] = array ( 'link' => " ../out/out.MoveDocument " . $docid , 'label' => 'move_document' );
2012-12-14 07:53:13 +00:00
}
else {
$lockingUser = $document -> getLockingUser ();
2013-01-28 10:18:19 +00:00
if (( $lockingUser -> getID () == $this -> params [ 'user' ] -> getID ()) || ( $document -> getAccessMode ( $this -> params [ 'user' ]) == M_ALL )) {
2015-07-15 05:24:32 +00:00
$menuitems [ 'update_document' ] = array ( 'link' => " ../out/out.UpdateDocument " . $docid , 'label' => 'update_document' );
$menuitems [ 'unlock_document' ] = array ( 'link' => " ../op/op.UnlockDocument " . $docid , 'label' => 'unlock_document' );
$menuitems [ 'edit_document_props' ] = array ( 'link' => " ../out/out.EditDocument " . $docid , 'label' => 'edit_document_props' );
$menuitems [ 'move_document' ] = array ( 'link' => " ../out/out.MoveDocument " . $docid , 'label' => 'move_document' );
2012-12-14 07:53:13 +00:00
}
}
2014-06-03 15:51:44 +00:00
if ( $this -> params [ 'accessobject' ] -> maySetExpires ()) {
2015-07-15 05:24:32 +00:00
$menuitems [ 'expires' ] = array ( 'link' => " ../out/out.SetExpires " . $docid , 'label' => 'expires' );
2014-06-03 15:51:44 +00:00
}
2012-12-14 07:53:13 +00:00
}
if ( $accessMode == M_ALL ) {
2015-07-15 05:24:32 +00:00
$menuitems [ 'rm_document' ] = array ( 'link' => " ../out/out.RemoveDocument " . $docid , 'label' => 'rm_document' );
$menuitems [ 'edit_document_access' ] = array ( 'link' => " ../out/out.DocumentAccess " . $docid , 'label' => 'edit_document_access' );
2012-12-14 07:53:13 +00:00
}
2013-01-28 10:18:19 +00:00
if ( $accessMode >= M_READ && ! $this -> params [ 'user' ] -> isGuest ()) {
2015-07-15 05:24:32 +00:00
$menuitems [ 'edit_existing_notify' ] = array ( 'link' => " ../out/out.DocumentNotify " . $docid , 'label' => 'edit_existing_notify' );
}
2017-12-06 08:13:50 +00:00
if ( $this -> params [ 'user' ] -> isAdmin ()) {
$menuitems [ 'transfer_document' ] = array ( 'link' => " ../out/out.TransferDocument " . $docid , 'label' => 'transfer_document' );
}
2015-07-15 05:24:32 +00:00
2015-07-15 20:32:19 +00:00
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'documentNavigationBar' ))
$menuitems = $this -> callHook ( 'documentNavigationBar' , $document , $menuitems );
/* Do not use $this -> callHook () because $menuitems must be returned by the hook
* or left unchanged
*/
/*
$hookObjs = $this -> getHookObjects ();
foreach ( $hookObjs as $hookObj ) {
if ( method_exists ( $hookObj , 'documentNavigationBar' )) {
$menuitems = $hookObj -> documentNavigationBar ( $this , $document , $menuitems );
}
}
*/
2015-07-15 05:24:32 +00:00
2018-04-26 06:49:10 +00:00
self :: showNavigationBar ( $menuitems );
2012-12-14 07:53:13 +00:00
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
2013-01-28 10:18:19 +00:00
private function accountNavigationBar () { /* {{{ */
2013-03-26 19:26:28 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.MyAccount.php \" class= \" brand \" > " . getMLText ( " my_account " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
2013-03-26 19:26:28 +00:00
2018-04-26 06:49:10 +00:00
$menuitems = array ();
2014-05-22 04:44:20 +00:00
if ( $this -> params [ 'user' ] -> isAdmin () || ! $this -> params [ 'disableselfedit' ])
2018-04-26 06:49:10 +00:00
$menuitems [ 'edit_user_details' ] = array ( 'link' => " ../out/out.EditUserData.php " , 'label' => 'edit_user_details' );
2012-12-14 07:53:13 +00:00
2013-01-28 10:18:19 +00:00
if ( ! $this -> params [ 'user' ] -> isAdmin ())
2018-04-26 06:49:10 +00:00
$menuitems [ 'edit_default_keywords' ] = array ( 'link' => " ../out/out.UserDefaultKeywords.php " , 'label' => 'edit_default_keywords' );
2012-12-14 07:53:13 +00:00
2018-04-26 06:49:10 +00:00
$menuitems [ 'edit_notify' ] = array ( 'link' => " ../out/out.ManageNotify.php " , 'label' => 'edit_existing_notify' );
2012-12-14 07:53:13 +00:00
2013-01-28 10:18:19 +00:00
if ( $this -> params [ 'enableusersview' ]){
2018-04-26 06:49:10 +00:00
$menuitems [ 'users' ] = array ( 'link' => " ../out/out.UsrView.php " , 'label' => 'users' );
2019-02-04 13:43:57 +00:00
$menuitems [ 'groups' ] = array ( 'link' => " ../out/out.GroupView.php " , 'label' => 'groups' );
2012-12-14 07:53:13 +00:00
}
2018-04-26 06:49:10 +00:00
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'accountNavigationBar' ))
$menuitems = $this -> callHook ( 'accountNavigationBar' , $menuitems );
self :: showNavigationBar ( $menuitems );
2012-12-14 07:53:13 +00:00
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
2013-01-28 10:18:19 +00:00
private function myDocumentsNavigationBar () { /* {{{ */
2012-12-14 07:53:13 +00:00
2013-03-26 19:26:28 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.MyDocuments.php?inProcess=1 \" class= \" brand \" > " . getMLText ( " my_documents " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
2013-03-26 19:26:28 +00:00
2018-04-26 06:49:10 +00:00
$menuitems = array ();
$menuitems [ 'inprocess' ] = array ( 'link' => " ../out/out.MyDocuments.php?inProcess=1 " , 'label' => 'documents_in_process' );
$menuitems [ 'all_documents' ] = array ( 'link' => " ../out/out.MyDocuments.php " , 'label' => 'all_documents' );
2015-03-17 10:19:55 +00:00
if ( $this -> params [ 'workflowmode' ] == 'traditional' || $this -> params [ 'workflowmode' ] == 'traditional_only_approval' ) {
2018-04-26 06:49:10 +00:00
$menuitems [ 'review_summary' ] = array ( 'link' => " ../out/out.ReviewSummary.php " , 'label' => 'review_summary' );
$menuitems [ 'approval_summary' ] = array ( 'link' => " ../out/out.ApprovalSummary.php " , 'label' => 'approval_summary' );
2013-02-02 15:58:52 +00:00
} else {
2018-04-26 06:49:10 +00:00
$menuitems [ 'workflow_summary' ] = array ( 'link' => " ../out/out.WorkflowSummary.php " , 'label' => 'workflow_summary' );
2013-02-02 15:58:52 +00:00
}
2018-04-26 06:49:10 +00:00
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'mydocumentsNavigationBar' ))
$menuitems = $this -> callHook ( 'mydocumentsNavigationBar' , $menuitems );
self :: showNavigationBar ( $menuitems );
2012-12-14 07:53:13 +00:00
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
2013-01-28 10:18:19 +00:00
private function adminToolsNavigationBar () { /* {{{ */
2013-03-26 19:26:28 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.AdminTools.php \" class= \" brand \" > " . getMLText ( " admin_tools " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-17 08:44:28 +00:00
echo " <ul class= \" nav \" > \n " ;
2013-03-26 19:26:28 +00:00
2018-04-26 06:49:10 +00:00
$menuitems = array ();
$menuitems [ 'user_group_management' ] = array ( 'link' => " # " , 'label' => 'user_group_management' );
$menuitems [ 'user_group_management' ][ 'children' ][ 'user_management' ] = array ( 'link' => " ../out/out.UsrMgr.php " , 'label' => 'user_management' );
$menuitems [ 'user_group_management' ][ 'children' ][ 'group_management' ] = array ( 'link' => " ../out/out.GroupMgr.php " , 'label' => 'group_management' );
$menuitems [ 'user_group_management' ][ 'children' ][ 'user_list' ] = array ( 'link' => " ../out/out.UserList.php " , 'label' => 'user_list' );
$menuitems [ 'definitions' ] = array ( 'link' => " # " , 'label' => 'definitions' );
$menuitems [ 'definitions' ][ 'children' ][ 'default_keywords' ] = array ( 'link' => " ../out/out.DefaultKeywords.php " , 'label' => 'global_default_keywords' );
$menuitems [ 'definitions' ][ 'children' ][ 'document_categories' ] = array ( 'link' => " ../out/out.Categories.php " , 'label' => 'global_document_categories' );
$menuitems [ 'definitions' ][ 'children' ][ 'attribute_definitions' ] = array ( 'link' => " ../out/out.AttributeMgr.php " , 'label' => 'global_attributedefinitions' );
2015-03-17 10:19:55 +00:00
if ( $this -> params [ 'workflowmode' ] == 'advanced' ) {
2018-04-26 06:49:10 +00:00
$menuitems [ 'definitions' ][ 'children' ][ 'workflows' ] = array ( 'link' => " ../out/out.WorkflowMgr.php " , 'label' => 'global_workflows' );
$menuitems [ 'definitions' ][ 'children' ][ 'workflow_states' ] = array ( 'link' => " ../out/out.WorkflowStatesMgr.php " , 'label' => 'global_workflow_states' );
$menuitems [ 'definitions' ][ 'children' ][ 'workflow_actions' ] = array ( 'link' => " ../out/out.WorkflowActionsMgr.php " , 'label' => 'global_workflow_actions' );
2013-02-06 13:57:14 +00:00
}
2012-12-17 08:44:28 +00:00
2013-01-28 10:18:19 +00:00
if ( $this -> params [ 'enablefullsearch' ]) {
2018-04-26 06:49:10 +00:00
$menuitems [ 'fulltext' ] = array ( 'link' => " # " , 'label' => 'fullsearch' );
$menuitems [ 'fulltext' ][ 'children' ][ 'update_fulltext_index' ] = array ( 'link' => " ../out/out.Indexer.php " , 'label' => 'update_fulltext_index' );
$menuitems [ 'fulltext' ][ 'children' ][ 'create_fulltext_index' ] = array ( 'link' => " ../out/out.CreateIndex.php " , 'label' => 'create_fulltext_index' );
$menuitems [ 'fulltext' ][ 'children' ][ 'fulltext_info' ] = array ( 'link' => " ../out/out.IndexInfo.php " , 'label' => 'fulltext_info' );
2012-12-17 08:44:28 +00:00
}
2018-04-26 06:49:10 +00:00
$menuitems [ 'backup_log_management' ] = array ( 'link' => " # " , 'label' => 'backup_log_management' );
$menuitems [ 'backup_log_management' ][ 'children' ][] = array ( 'link' => " ../out/out.BackupTools.php " , 'label' => 'backup_tools' );
2013-01-28 10:18:19 +00:00
if ( $this -> params [ 'logfileenable' ])
2018-04-26 06:49:10 +00:00
$menuitems [ 'backup_log_management' ][ 'children' ][] = array ( 'link' => " ../out/out.LogManagement.php " , 'label' => 'log_management' );
$menuitems [ 'misc' ] = array ( 'link' => " # " , 'label' => 'misc' );
$menuitems [ 'misc' ][ 'children' ][ 'import_fs' ] = array ( 'link' => " ../out/out.ImportFS.php " , 'label' => 'import_fs' );
$menuitems [ 'misc' ][ 'children' ][ 'folders_and_documents_statistic' ] = array ( 'link' => " ../out/out.Statistic.php " , 'label' => 'folders_and_documents_statistic' );
$menuitems [ 'misc' ][ 'children' ][ 'charts' ] = array ( 'link' => " ../out/out.Charts.php " , 'label' => 'charts' );
$menuitems [ 'misc' ][ 'children' ][ 'timeline' ] = array ( 'link' => " ../out/out.Timeline.php " , 'label' => 'timeline' );
$menuitems [ 'misc' ][ 'children' ][ 'objectcheck' ] = array ( 'link' => " ../out/out.ObjectCheck.php " , 'label' => 'objectcheck' );
$menuitems [ 'misc' ][ 'children' ][ 'documents_expired' ] = array ( 'link' => " ../out/out.ExpiredDocuments.php " , 'label' => 'documents_expired' );
$menuitems [ 'misc' ][ 'children' ][ 'extension_manager' ] = array ( 'link' => " ../out/out.ExtensionMgr.php " , 'label' => 'extension_manager' );
$menuitems [ 'misc' ][ 'children' ][ 'clear_cache' ] = array ( 'link' => " ../out/out.ClearCache.php " , 'label' => 'clear_cache' );
$menuitems [ 'misc' ][ 'children' ][ 'version_info' ] = array ( 'link' => " ../out/out.Info.php " , 'label' => 'version_info' );
2012-12-17 08:44:28 +00:00
2018-04-26 06:49:10 +00:00
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'admintoolsNavigationBar' ))
$menuitems = $this -> callHook ( 'admintoolsNavigationBar' , $menuitems );
self :: showNavigationBar ( $menuitems );
2012-12-17 08:44:28 +00:00
2018-04-26 06:49:10 +00:00
echo " </ul> \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
2017-02-16 14:02:46 +00:00
private function calendarOldNavigationBar ( $d ){ /* {{{ */
2012-12-14 07:53:13 +00:00
$ds = " &day= " . $d [ 0 ] . " &month= " . $d [ 1 ] . " &year= " . $d [ 2 ];
2017-02-16 14:02:46 +00:00
echo " <id= \" first \" ><a href= \" ../out/out.CalendarOld.php?mode=y \" class= \" brand \" > " . getMLText ( " calendar " ) . " </a> \n " ;
echo " <div class= \" nav-collapse col2 \" > \n " ;
echo " <ul class= \" nav \" > \n " ;
echo " <li><a href= \" ../out/out.CalendarOld.php?mode=w " . $ds . " \" > " . getMLText ( " week_view " ) . " </a></li> \n " ;
echo " <li><a href= \" ../out/out.CalendarOld.php?mode=m " . $ds . " \" > " . getMLText ( " month_view " ) . " </a></li> \n " ;
echo " <li><a href= \" ../out/out.CalendarOld.php?mode=y " . $ds . " \" > " . getMLText ( " year_view " ) . " </a></li> \n " ;
if ( ! $this -> params [ 'user' ] -> isGuest ()) echo " <li><a href= \" ../out/out.AddEvent.php \" > " . getMLText ( " add_event " ) . " </a></li> \n " ;
echo " </ul> \n " ;
echo " </div> \n " ;
return ;
} /* }}} */
private function calendarNavigationBar ( $d ){ /* {{{ */
echo " <id= \" first \" ><a href= \" ../out/out.Calendar.php \" class= \" brand \" > " . getMLText ( " calendar " ) . " </a> \n " ;
2013-03-26 19:26:28 +00:00
echo " <div class= \" nav-collapse col2 \" > \n " ;
2012-12-14 07:53:13 +00:00
echo " <ul class= \" nav \" > \n " ;
2013-03-26 19:26:28 +00:00
2018-04-26 06:49:10 +00:00
$menuitems = array ();
if ( ! $this -> params [ 'user' ] -> isGuest ())
$menuitems [ 'addevent' ] = array ( 'link' => " ../out/out.AddEvent.php " , 'label' => 'add_event' );
/* Check if hook exists because otherwise callHook() will override $menuitems */
if ( $this -> hasHook ( 'calendarNavigationBar' ))
$menuitems = $this -> callHook ( 'calendarNavigationBar' , $menuitems );
self :: showNavigationBar ( $menuitems );
2012-12-14 07:53:13 +00:00
echo " </ul> \n " ;
2013-03-26 19:26:28 +00:00
echo " </div> \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
function pageList ( $pageNumber , $totalPages , $baseURI , $params ) { /* {{{ */
2014-04-01 07:20:58 +00:00
$maxpages = 25 ; // skip pages when more than this is shown
2014-04-01 05:39:16 +00:00
$range = 5 ; // pages left and right of current page
2012-12-14 07:53:13 +00:00
if ( ! is_numeric ( $pageNumber ) || ! is_numeric ( $totalPages ) || $totalPages < 2 ) {
return ;
}
// Construct the basic URI based on the $_GET array. One could use a
// regular expression to strip out the pg (page number) variable to
// achieve the same effect. This seems to be less haphazard though...
$resultsURI = $baseURI ;
$first = true ;
foreach ( $params as $key => $value ) {
// Don't include the page number in the basic URI. This is added in
// during the list display loop.
if ( ! strcasecmp ( $key , " pg " )) {
continue ;
}
if ( is_array ( $value )) {
2013-08-14 07:12:20 +00:00
foreach ( $value as $subkey => $subvalue ) {
2018-11-07 19:53:31 +00:00
$resultsURI .= ( $first ? " ? " : " & " ) . $key . " %5B " . $subkey . " %5D= " . urlencode ( $subvalue );
2012-12-14 07:53:13 +00:00
$first = false ;
}
}
else {
2018-11-07 19:53:31 +00:00
$resultsURI .= ( $first ? " ? " : " & " ) . $key . " = " . urlencode ( $value );
2012-12-14 07:53:13 +00:00
}
$first = false ;
}
echo " <div class= \" pagination pagination-small \" > " ;
echo " <ul> " ;
2014-04-01 05:39:16 +00:00
if ( $totalPages <= $maxpages ) {
for ( $i = 1 ; $i <= $totalPages ; $i ++ ) {
echo " <li " . ( $i == $pageNumber ? 'class="active"' : " " ) . " ><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg= " . $i . " \" > " . $i . " </a></li> " ;
}
} else {
if ( $pageNumber - $range > 1 )
$start = $pageNumber - $range ;
else
$start = 2 ;
if ( $pageNumber + $range < $totalPages )
$end = $pageNumber + $range ;
else
2014-04-01 07:20:58 +00:00
$end = $totalPages - 1 ;
/* Move start or end to always show 2*$range items */
$diff = $end - $start - 2 * $range ;
if ( $diff < 0 ) {
if ( $start > 2 )
$start += $diff ;
if ( $end < $totalPages - 1 )
$end -= $diff ;
}
if ( $pageNumber > 1 )
echo " <li><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg= " . ( $pageNumber - 1 ) . " \" >«</a></li> " ;
echo " <li " . ( 1 == $pageNumber ? 'class="active"' : " " ) . " ><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg=1 \" >1</a></li> " ;
2014-04-01 05:39:16 +00:00
if ( $start > 2 )
2014-04-01 08:42:51 +00:00
echo " <li><span>...</span></li> " ;
2014-04-01 05:39:16 +00:00
for ( $j = $start ; $j <= $end ; $j ++ )
echo " <li " . ( $j == $pageNumber ? 'class="active"' : " " ) . " ><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg= " . $j . " \" > " . $j . " </a></li> " ;
if ( $end < $totalPages - 1 )
2014-04-01 08:42:51 +00:00
echo " <li><span>...</span></li> " ;
2014-04-01 05:39:16 +00:00
if ( $end < $totalPages )
echo " <li " . ( $totalPages == $pageNumber ? 'class="active"' : " " ) . " ><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg= " . $totalPages . " \" > " . $totalPages . " </a></li> " ;
2014-04-01 07:20:58 +00:00
if ( $pageNumber < $totalPages )
echo " <li><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg= " . ( $pageNumber + 1 ) . " \" >»</a></li> " ;
2012-12-14 07:53:13 +00:00
}
if ( $totalPages > 1 ) {
echo " <li><a href= \" " . $resultsURI . ( $first ? " ? " : " & " ) . " pg=all \" > " . getMLText ( " all_pages " ) . " </a></li> " ;
}
echo " </ul> " ;
echo " </div> " ;
return ;
} /* }}} */
function contentContainer ( $content ) { /* {{{ */
echo " <div class= \" well \" > \n " ;
echo $content ;
echo " </div> \n " ;
return ;
} /* }}} */
2018-04-26 06:49:10 +00:00
function contentContainerStart ( $class = '' , $id = '' ) { /* {{{ */
echo " <div class= \" well " . ( $class ? " " . $class : " " ) . " \" " . ( $id ? " id= \" " . $id . " \" " : " " ) . " > \n " ;
2012-12-14 07:53:13 +00:00
return ;
} /* }}} */
function contentContainerEnd () { /* {{{ */
echo " </div> \n " ;
return ;
} /* }}} */
function contentHeading ( $heading , $noescape = false ) { /* {{{ */
if ( $noescape )
echo " <legend> " . $heading . " </legend> \n " ;
else
echo " <legend> " . htmlspecialchars ( $heading ) . " </legend> \n " ;
return ;
} /* }}} */
function contentSubHeading ( $heading , $first = false ) { /* {{{ */
// echo "<div class=\"contentSubHeading\"".($first ? " id=\"first\"" : "").">".htmlspecialchars($heading)."</div>\n";
echo " <h5> " . $heading . " </h5> " ;
return ;
} /* }}} */
2018-06-26 04:51:04 +00:00
function formField ( $title , $value , $params = array ()) { /* {{{ */
2018-06-18 15:28:36 +00:00
if ( $title !== null ) {
echo " <div class= \" control-group \" > " ;
echo " <label class= \" control-label \" > " . $title . " :</label> " ;
echo " <div class= \" controls \" > " ;
}
2018-06-26 04:51:04 +00:00
if ( isset ( $params [ 'field_wrap' ][ 0 ]))
echo $params [ 'field_wrap' ][ 0 ];
2018-05-29 16:19:48 +00:00
if ( is_string ( $value )) {
echo $value ;
} elseif ( is_array ( $value )) {
switch ( $value [ 'element' ]) {
2018-06-07 05:46:19 +00:00
case 'select' :
echo '<select' .
( ! empty ( $value [ 'id' ]) ? ' id="' . $value [ 'id' ] . '"' : '' ) .
( ! empty ( $value [ 'name' ]) ? ' name="' . $value [ 'name' ] . '"' : '' ) .
2018-06-18 15:28:36 +00:00
( ! empty ( $value [ 'class' ]) ? ' class="' . $value [ 'class' ] . '"' : '' ) .
2018-06-20 18:39:28 +00:00
( ! empty ( $value [ 'multiple' ]) ? ' multiple' : '' );
if ( ! empty ( $value [ 'attributes' ]) && is_array ( $value [ 'attributes' ]))
foreach ( $value [ 'attributes' ] as $a )
echo ' ' . $a [ 0 ] . '="' . $a [ 1 ] . '"' ;
echo " > " ;
2018-06-07 05:46:19 +00:00
if ( isset ( $value [ 'options' ]) && is_array ( $value [ 'options' ])) {
2018-06-18 15:28:36 +00:00
foreach ( $value [ 'options' ] as $val ) {
echo '<option value="' . $val [ 0 ] . '"' . ( ! empty ( $val [ 2 ]) ? ' selected' : '' );
if ( ! empty ( $val [ 3 ]) && is_array ( $val [ 3 ]))
foreach ( $val [ 3 ] as $a )
echo ' ' . $a [ 0 ] . '="' . $a [ 1 ] . '"' ;
echo '>' . $val [ 1 ] . '</option>' ;
}
2018-06-07 05:46:19 +00:00
}
echo '</select>' ;
break ;
case 'textarea' :
echo '<textarea' .
( ! empty ( $value [ 'id' ]) ? ' id="' . $value [ 'id' ] . '"' : '' ) .
( ! empty ( $value [ 'name' ]) ? ' name="' . $value [ 'name' ] . '"' : '' ) .
( ! empty ( $value [ 'rows' ]) ? ' rows="' . $value [ 'rows' ] . '"' : '' ) .
( ! empty ( $value [ 'cols' ]) ? ' rows="' . $value [ 'cols' ] . '"' : '' ) .
( ! empty ( $value [ 'required' ]) ? ' required' : '' ) . " > " . ( ! empty ( $value [ 'value' ]) ? $value [ 'value' ] : '' ) . " </textarea> " ;
break ;
2018-05-29 16:19:48 +00:00
case 'input' :
default :
2018-06-07 05:46:19 +00:00
echo '<input' .
( ! empty ( $value [ 'type' ]) ? ' type="' . $value [ 'type' ] . '"' : '' ) .
( ! empty ( $value [ 'id' ]) ? ' id="' . $value [ 'id' ] . '"' : '' ) .
( ! empty ( $value [ 'name' ]) ? ' name="' . $value [ 'name' ] . '"' : '' ) .
2019-11-26 16:07:47 +00:00
(( isset ( $value [ 'value' ]) && is_string ( $value [ 'value' ])) || ! empty ( $value [ 'value' ]) ? ' value="' . $value [ 'value' ] . '"' : '' ) .
2018-06-07 05:46:19 +00:00
( ! empty ( $value [ 'placeholder' ]) ? ' placeholder="' . $value [ 'placeholder' ] . '"' : '' ) .
( ! empty ( $value [ 'autocomplete' ]) ? ' autocomplete="' . $value [ 'autocomplete' ] . '"' : '' ) .
( ! empty ( $value [ 'checked' ]) ? ' checked' : '' ) .
2018-06-19 06:03:46 +00:00
( ! empty ( $value [ 'required' ]) ? ' required' : '' );
if ( ! empty ( $value [ 'attributes' ]) && is_array ( $value [ 'attributes' ]))
2018-06-20 18:39:28 +00:00
foreach ( $value [ 'attributes' ] as $a )
2018-06-19 06:03:46 +00:00
echo ' ' . $a [ 0 ] . '="' . $a [ 1 ] . '"' ;
echo " > " ;
2018-05-29 16:19:48 +00:00
break ;
}
}
2018-06-26 04:51:04 +00:00
if ( isset ( $params [ 'field_wrap' ][ 1 ]))
echo $params [ 'field_wrap' ][ 1 ];
2018-06-18 15:28:36 +00:00
if ( $title !== null ) {
echo " </div> " ;
echo " </div> " ;
}
2018-04-23 13:50:46 +00:00
return ;
} /* }}} */
function formSubmit ( $value , $name = '' ) { /* {{{ */
echo " <div class= \" controls \" > \n " ;
2020-04-14 18:00:53 +00:00
echo " <button type= \" submit \" class= \" btn btn-primary \" " . ( $name ? ' name="' . $name . '" id="' . $name . '"' : '' ) . " > " . $value . " </button> \n " ;
2018-04-23 13:50:46 +00:00
echo " </div> \n " ;
} /* }}} */
2012-12-14 07:53:13 +00:00
function getMimeIcon ( $fileType ) { /* {{{ */
// for extension use LOWER CASE only
$icons = array ();
2017-03-15 15:13:09 +00:00
$icons [ " txt " ] = " text-x-preview.svg " ;
$icons [ " text " ] = " text-x-preview.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " tex " ] = " text-x-preview.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " doc " ] = " office-document.svg " ;
$icons [ " dot " ] = " office-document.svg " ;
$icons [ " docx " ] = " office-document.svg " ;
$icons [ " dotx " ] = " office-document.svg " ;
$icons [ " rtf " ] = " office-document.svg " ;
$icons [ " xls " ] = " office-spreadsheet.svg " ;
$icons [ " xlt " ] = " office-spreadsheet.svg " ;
$icons [ " xlsx " ] = " office-spreadsheet.svg " ;
$icons [ " xltx " ] = " office-spreadsheet.svg " ;
$icons [ " ppt " ] = " office-presentation.svg " ;
$icons [ " pot " ] = " office-presentation.svg " ;
$icons [ " pptx " ] = " office-presentation.svg " ;
$icons [ " potx " ] = " office-presentation.svg " ;
$icons [ " exe " ] = " executable.svg " ;
$icons [ " html " ] = " web.svg " ;
$icons [ " htm " ] = " web.svg " ;
$icons [ " gif " ] = " image.svg " ;
$icons [ " jpg " ] = " image.svg " ;
$icons [ " jpeg " ] = " image.svg " ;
$icons [ " bmp " ] = " image.svg " ;
$icons [ " png " ] = " image.svg " ;
$icons [ " tif " ] = " image.svg " ;
$icons [ " tiff " ] = " image.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " log " ] = " text-x-preview.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " midi " ] = " audio.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " pdf " ] = " gnome-mime-application-pdf.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " wav " ] = " audio.svg " ;
$icons [ " mp3 " ] = " audio.svg " ;
2017-10-11 12:34:16 +00:00
$icons [ " opus " ] = " audio.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " c " ] = " text-x-preview.svg " ;
$icons [ " cpp " ] = " text-x-preview.svg " ;
$icons [ " h " ] = " text-x-preview.svg " ;
$icons [ " java " ] = " text-x-preview.svg " ;
$icons [ " py " ] = " text-x-preview.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " tar " ] = " package.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " gz " ] = " package.svg " ;
$icons [ " 7z " ] = " package.svg " ;
$icons [ " bz " ] = " package.svg " ;
$icons [ " bz2 " ] = " package.svg " ;
$icons [ " tgz " ] = " package.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " zip " ] = " package.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " rar " ] = " package.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " mpg " ] = " video.svg " ;
$icons [ " avi " ] = " video.svg " ;
2019-12-06 14:23:38 +00:00
$icons [ " webm " ] = " video.svg " ;
2019-12-10 05:20:11 +00:00
$icons [ " mkv " ] = " video.svg " ;
2017-03-15 15:13:09 +00:00
$icons [ " ods " ] = " office-spreadsheet.svg " ;
$icons [ " ots " ] = " office-spreadsheet.svg " ;
$icons [ " sxc " ] = " office-spreadsheet.svg " ;
$icons [ " stc " ] = " office-spreadsheet.svg " ;
$icons [ " odt " ] = " office-document.svg " ;
$icons [ " ott " ] = " office-document.svg " ;
$icons [ " sxw " ] = " office-document.svg " ;
$icons [ " stw " ] = " office-document.svg " ;
$icons [ " odp " ] = " office-presentation.svg " ;
$icons [ " otp " ] = " office-presentation.svg " ;
$icons [ " sxi " ] = " office-presentation.svg " ;
$icons [ " sti " ] = " office-presentation.svg " ;
2017-08-02 12:01:00 +00:00
$icons [ " odg " ] = " office-drawing.svg " ;
$icons [ " otg " ] = " office-drawing.svg " ;
$icons [ " sxd " ] = " office-drawing.svg " ;
$icons [ " std " ] = " office-drawing.svg " ;
2012-12-14 07:53:13 +00:00
$icons [ " odf " ] = " ooo_formula.png " ;
$icons [ " sxm " ] = " ooo_formula.png " ;
$icons [ " smf " ] = " ooo_formula.png " ;
$icons [ " mml " ] = " ooo_formula.png " ;
2019-07-04 12:33:24 +00:00
$icons [ " folder " ] = " folder.svg " ;
2012-12-14 07:53:13 +00:00
2017-03-15 15:13:09 +00:00
$icons [ " default " ] = " text-x-preview.svg " ; //"default.png";
2012-12-14 07:53:13 +00:00
$ext = strtolower ( substr ( $fileType , 1 ));
if ( isset ( $icons [ $ext ])) {
return $this -> imgpath . $icons [ $ext ];
}
else {
return $this -> imgpath . $icons [ " default " ];
}
} /* }}} */
2018-09-05 11:34:30 +00:00
function printFileChooserJs () { /* {{{ */
?>
$ ( document ) . ready ( function () {
$ ( document ) . on ( 'change' , '.btn-file :file' , function () {
var input = $ ( this ),
numFiles = input . get ( 0 ) . files ? input . get ( 0 ) . files . length : 1 ,
label = input . val () . replace ( / \\ / g , '/' ) . replace ( /.* \ //, '');
input . trigger ( 'fileselect' , [ numFiles , label ]);
});
$ ( document ) . on ( 'fileselect' , '.upload-file .btn-file :file' , function ( event , numFiles , label ) {
var input = $ ( this ) . parents ( '.input-append' ) . find ( ':text' ),
log = numFiles > 1 ? numFiles + ' files selected' : label ;
if ( input . length ) {
input . val ( log );
} else {
// if( log ) alert(log);
}
});
});
< ? php
} /* }}} */
function getFileChooserHtml ( $varname = 'userfile' , $multiple = false , $accept = '' ) { /* {{{ */
2017-04-27 15:21:52 +00:00
$id = preg_replace ( '/[^A-Za-z]/' , '' , $varname );
$html = '
< div id = " '. $id .'-upload-files " >
< div id = " '. $id .'-upload-file " class = " upload-file " >
< div class = " input-append " >
< input type = " text " class = " form-control " readonly >
< span class = " btn btn-default btn-file " >
2019-07-30 04:33:18 +00:00
'.getMLText("browse").' & hellip ; < input id = " '. $id .' " type = " file " name = " '. $varname .' " '.($multiple ? " multiple" : "").($accept ? ' accept = " '. $accept .' " ' : "").' >
2017-04-27 15:21:52 +00:00
</ span >
</ div >
</ div >
</ div >
' ;
return $html ;
} /* }}} */
2014-05-16 07:17:43 +00:00
function printFileChooser ( $varname = 'userfile' , $multiple = false , $accept = '' ) { /* {{{ */
2018-09-05 11:34:30 +00:00
echo self :: getFileChooserHtml ( $varname , $multiple , $accept );
2014-05-16 07:17:43 +00:00
} /* }}} */
2019-10-01 12:06:46 +00:00
function printDateChooser ( $defDate = '' , $varName , $lang = '' , $dateformat = 'yyyy-mm-dd' ) { /* {{{ */
echo self :: getDateChooser ( $defDate , $varName , $lang , $dateformat );
2018-04-23 13:50:46 +00:00
} /* }}} */
2019-10-01 12:06:46 +00:00
function getDateChooser ( $defDate = '' , $varName , $lang = '' , $dateformat = 'yyyy-mm-dd' ) { /* {{{ */
2018-04-23 13:50:46 +00:00
$content = '
2019-10-01 12:06:46 +00:00
< span class = " input-append date span12 datepicker " id = " '. $varName .'date " data - date = " '. $defDate .' " data - selectmenu = " presetexpdate " data - date - format = " '. $dateformat .' " '.($lang ? ' data - date - language = " '.str_replace('_', '-', $lang ).' " ' : ' ').' >
< input class = " span6 " size = " 16 " name = " '. $varName .' " id = " '. $varName .' " type = " text " value = " '. $defDate .' " autocomplete = " off " >
2018-04-23 13:50:46 +00:00
< span class = " add-on " >< i class = " icon-calendar " ></ i ></ span >
</ span > ' ;
return $content ;
} /* }}} */
function __printDateChooser ( $defDate = - 1 , $varName ) { /* {{{ */
2012-12-14 07:53:13 +00:00
if ( $defDate == - 1 )
$defDate = mktime ();
$day = date ( " d " , $defDate );
$month = date ( " m " , $defDate );
$year = date ( " Y " , $defDate );
print " <select name= \" " . $varName . " day \" > \n " ;
for ( $i = 1 ; $i <= 31 ; $i ++ )
{
print " <option value= \" " . $i . " \" " ;
if ( intval ( $day ) == $i )
print " selected " ;
print " > " . $i . " </option> \n " ;
}
print " </select> \n " ;
print " <select name= \" " . $varName . " month \" > \n " ;
for ( $i = 1 ; $i <= 12 ; $i ++ )
{
print " <option value= \" " . $i . " \" " ;
if ( intval ( $month ) == $i )
print " selected " ;
print " > " . $i . " </option> \n " ;
}
print " </select> \n " ;
print " <select name= \" " . $varName . " year \" > \n " ;
for ( $i = $year - 5 ; $i <= $year + 5 ; $i ++ )
{
print " <option value= \" " . $i . " \" " ;
if ( intval ( $year ) == $i )
print " selected " ;
print " > " . $i . " </option> \n " ;
}
print " </select> " ;
} /* }}} */
function printSequenceChooser ( $objArr , $keepID = - 1 ) { /* {{{ */
2018-04-23 13:50:46 +00:00
echo $this -> getSequenceChooser ( $objArr , $keepID );
} /* }}} */
function getSequenceChooser ( $objArr , $keepID = - 1 ) { /* {{{ */
2012-12-14 07:53:13 +00:00
if ( count ( $objArr ) > 0 ) {
$max = $objArr [ count ( $objArr ) - 1 ] -> getSequence () + 1 ;
$min = $objArr [ 0 ] -> getSequence () - 1 ;
}
else {
$max = 1.0 ;
}
2018-04-23 13:50:46 +00:00
$content = " <select name= \" sequence \" > \n " ;
2012-12-14 07:53:13 +00:00
if ( $keepID != - 1 ) {
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" keep \" > " . getMLText ( " seq_keep " );
2012-12-14 07:53:13 +00:00
}
2018-02-07 07:43:46 +00:00
if ( $this -> params [ 'defaultposition' ] != 'start' )
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" " . $max . " \" > " . getMLText ( " seq_end " );
2012-12-14 07:53:13 +00:00
if ( count ( $objArr ) > 0 ) {
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" " . $min . " \" > " . getMLText ( " seq_start " );
2012-12-14 07:53:13 +00:00
}
2018-02-07 07:43:46 +00:00
if ( $this -> params [ 'defaultposition' ] == 'start' )
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" " . $max . " \" > " . getMLText ( " seq_end " );
2012-12-14 07:53:13 +00:00
for ( $i = 0 ; $i < count ( $objArr ) - 1 ; $i ++ ) {
if (( $objArr [ $i ] -> getID () == $keepID ) || (( $i + 1 < count ( $objArr )) && ( $objArr [ $i + 1 ] -> getID () == $keepID ))) {
continue ;
}
$index = ( $objArr [ $i ] -> getSequence () + $objArr [ $i + 1 ] -> getSequence ()) / 2 ;
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" " . $index . " \" > " . getMLText ( " seq_after " , array ( " prevname " => htmlspecialchars ( $objArr [ $i ] -> getName ())));
2012-12-14 07:53:13 +00:00
}
2018-04-23 13:50:46 +00:00
$content .= " </select> " ;
return $content ;
2012-12-14 07:53:13 +00:00
} /* }}} */
2015-12-11 19:29:52 +00:00
2018-06-21 09:56:05 +00:00
function getDocumentChooserHtml ( $formName ) { /* {{{ */
$content = '' ;
$content .= " <input type= \" hidden \" id= \" docid " . $formName . " \" name= \" docid \" value= \" \" > " ;
$content .= " <div class= \" input-append \" > \n " ;
$content .= " <input type= \" text \" id= \" choosedocsearch " . $formName . " \" data-target= \" docid " . $formName . " \" data-provide= \" typeahead \" name= \" docname " . $formName . " \" placeholder= \" " . getMLText ( 'type_to_search' ) . " \" autocomplete= \" off \" /> " ;
$content .= " <a data-target= \" #docChooser " . $formName . " \" href= \" ../out/out.DocumentChooser.php?form= " . $formName . " &folderid= " . $this -> params [ 'rootfolderid' ] . " \" role= \" button \" class= \" btn \" data-toggle= \" modal \" > " . getMLText ( " document " ) . " …</a> \n " ;
$content .= " </div> \n " ;
$content .= '
< div class = " modal hide " id = " docChooser'. $formName .' " tabindex = " -1 " role = " dialog " aria - labelledby = " docChooserLabel " aria - hidden = " true " >
2012-12-14 07:53:13 +00:00
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " > × </ button >
2018-06-21 09:56:05 +00:00
< h3 id = " docChooserLabel " > '.getMLText("choose_target_document").' </ h3 >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-body " >
2018-06-21 09:56:05 +00:00
< p > '.getMLText(' tree_loading ').' </ p >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-footer " >
2018-06-21 09:56:05 +00:00
< button class = " btn btn-primary " data - dismiss = " modal " aria - hidden = " true " > '.getMLText("close").' </ button >
2012-12-14 07:53:13 +00:00
</ div >
</ div >
2018-06-21 09:56:05 +00:00
' ;
return $content ;
} /* }}} */
function printDocumentChooserHtml ( $formName ) { /* {{{ */
echo self :: getDocumentChooserHtml ( $formName );
2015-12-11 19:29:52 +00:00
} /* }}} */
function printDocumentChooserJs ( $formName ) { /* {{{ */
?>
2014-01-08 05:36:40 +00:00
function documentSelected < ? php echo $formName ?> (id, name) {
$ ( '#docid<?php echo $formName ?>' ) . val ( id );
2017-01-10 06:04:07 +00:00
$ ( '#choosedocsearch<?php echo $formName ?>' ) . val ( name );
2016-02-17 10:38:32 +00:00
$ ( '#docChooser<?php echo $formName ?>' ) . modal ( 'hide' );
2014-03-21 07:05:08 +00:00
}
function folderSelected < ? php echo $formName ?> (id, name) {
2013-05-24 15:32:12 +00:00
}
2015-12-11 19:29:52 +00:00
< ? php
} /* }}} */
function printDocumentChooser ( $formName ) { /* {{{ */
$this -> printDocumentChooserHtml ( $formName );
?>
< script language = " JavaScript " >
< ? php
$this -> printDocumentChooserJs ( $formName );
?>
2013-05-24 15:32:12 +00:00
</ script >
2012-12-14 07:53:13 +00:00
< ? php
} /* }}} */
2018-06-21 09:30:58 +00:00
function getFolderChooserHtml ( $form , $accessMode , $exclude = - 1 , $default = false , $formname = '' ) { /* {{{ */
2014-03-26 07:17:55 +00:00
$formid = " targetid " . $form ;
if ( ! $formname )
2014-07-08 06:49:14 +00:00
$formname = " targetid " ;
2018-06-21 09:30:58 +00:00
$content = '' ;
$content .= " <input type= \" hidden \" id= \" " . $formid . " \" name= \" " . $formname . " \" value= \" " . (( $default ) ? $default -> getID () : " " ) . " \" > " ;
$content .= " <div class= \" input-append \" > \n " ;
$content .= " <input type= \" text \" id= \" choosefoldersearch " . $form . " \" data-target= \" " . $formid . " \" data-provide= \" typeahead \" name= \" targetname " . $form . " \" value= \" " . (( $default ) ? htmlspecialchars ( $default -> getName ()) : " " ) . " \" placeholder= \" " . getMLText ( 'type_to_search' ) . " \" autocomplete= \" off \" target= \" " . $formid . " \" /> " ;
$content .= " <button type= \" button \" class= \" btn \" id= \" clearfolder " . $form . " \" ><i class= \" icon-remove \" ></i></button> " ;
$content .= " <a data-target= \" #folderChooser " . $form . " \" href= \" ../out/out.FolderChooser.php?form= " . $form . " &mode= " . $accessMode . " &exclude= " . $exclude . " \" role= \" button \" class= \" btn \" data-toggle= \" modal \" > " . getMLText ( " folder " ) . " …</a> \n " ;
$content .= " </div> \n " ;
$content .= '
< div class = " modal hide " id = " folderChooser'. $form .' " tabindex = " -1 " role = " dialog " aria - labelledby = " folderChooser'. $form .'Label " aria - hidden = " true " >
2012-12-14 07:53:13 +00:00
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " > × </ button >
2018-06-21 09:30:58 +00:00
< h3 id = " folderChooser'. $form .'Label " > '.getMLText("choose_target_folder").' </ h3 >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-body " >
2018-06-21 09:30:58 +00:00
< p > '.getMLText(' tree_loading ').' </ p >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-footer " >
2018-06-21 09:30:58 +00:00
< button class = " btn btn-primary " data - dismiss = " modal " aria - hidden = " true " > '.getMLText("close").' </ button >
2012-12-14 07:53:13 +00:00
</ div >
</ div >
2018-06-21 09:30:58 +00:00
' ;
return $content ;
} /* }}} */
function printFolderChooserHtml ( $form , $accessMode , $exclude = - 1 , $default = false , $formname = '' ) { /* {{{ */
echo self :: getFolderChooserHtml ( $form , $accessMode , $exclude , $default , $formname );
2015-12-14 08:50:49 +00:00
} /* }}} */
2016-08-22 15:14:20 +00:00
function printFolderChooserJs ( $form ) { /* {{{ */
2015-12-14 08:50:49 +00:00
?>
2016-08-22 15:14:20 +00:00
function folderSelected < ? php echo $form ?> (id, name) {
$ ( '#targetid<?php echo $form ?>' ) . val ( id );
$ ( '#choosefoldersearch<?php echo $form ?>' ) . val ( name );
$ ( '#folderChooser<?php echo $form ?>' ) . modal ( 'hide' );
2013-05-17 06:47:04 +00:00
}
2017-01-10 08:11:11 +00:00
$ ( document ) . ready ( function () {
2017-01-10 08:13:11 +00:00
$ ( '#clearfolder<?php print $form ?>' ) . click ( function ( ev ) {
$ ( '#choosefoldersearch<?php echo $form ?>' ) . val ( '' );
$ ( '#targetid<?php echo $form ?>' ) . val ( '' );
2017-01-10 08:11:11 +00:00
});
});
2015-12-14 08:50:49 +00:00
< ? php
} /* }}} */
2016-08-22 15:14:20 +00:00
function printFolderChooser ( $form , $accessMode , $exclude = - 1 , $default = false , $formname = '' ) { /* {{{ */
$this -> printFolderChooserHtml ( $form , $accessMode , $exclude , $default , $formname );
2015-12-14 08:50:49 +00:00
?>
< script language = " JavaScript " >
< ? php
2016-08-22 15:14:20 +00:00
$this -> printFolderChooserJs ( $form );
2015-12-14 08:50:49 +00:00
?>
</ script >
2012-12-14 07:53:13 +00:00
< ? php
} /* }}} */
2016-03-29 06:32:32 +00:00
/**
* Do not use anymore . Was previously used to show the category
* chooser . It has been replaced by a select box
*/
2012-12-14 07:53:13 +00:00
function printCategoryChooser ( $formName , $categories = array ()) { /* {{{ */
?>
< script language = " JavaScript " >
function clearCategory < ? php print $formName ?> () {
document .< ? php echo $formName ?> .categoryid<?php echo $formName ?>.value = '';
document .< ? php echo $formName ?> .categoryname<?php echo $formName ?>.value = '';
}
function acceptCategories () {
var targetName = document .< ? php echo $formName ?> .categoryname<?php print $formName ?>;
var targetID = document .< ? php echo $formName ?> .categoryid<?php print $formName ?>;
var value = '' ;
$ ( '#keywordta option:selected' ) . each ( function (){
value += ' ' + $ ( this ) . text ();
});
targetName . value = value ;
targetID . value = $ ( '#keywordta' ) . val ();
return true ;
}
</ script >
< ? php
$ids = $names = array ();
if ( $categories ) {
foreach ( $categories as $cat ) {
$ids [] = $cat -> getId ();
$names [] = htmlspecialchars ( $cat -> getName ());
}
}
print " <input type= \" hidden \" name= \" categoryid " . $formName . " \" value= \" " . implode ( ',' , $ids ) . " \" > " ;
print " <div class= \" input-append \" > \n " ;
print " <input type= \" text \" disabled name= \" categoryname " . $formName . " \" value= \" " . implode ( ' ' , $names ) . " \" > " ;
print " <button type= \" button \" class= \" btn \" onclick= \" javascript:clearCategory " . $formName . " (); \" ><i class= \" icon-remove \" ></i></button> " ;
2017-07-11 09:12:54 +00:00
print " <a data-target= \" #categoryChooser \" href= \" ../out/out.CategoryChooser.php?form=form1&cats= " . implode ( ',' , $ids ) . " \" role= \" button \" class= \" btn \" data-toggle= \" modal \" > " . getMLText ( " category " ) . " …</a> \n " ;
2012-12-14 07:53:13 +00:00
print " </div> \n " ;
?>
< div class = " modal hide " id = " categoryChooser " tabindex = " -1 " role = " dialog " aria - labelledby = " categoryChooserLabel " aria - hidden = " true " >
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " > × </ button >
< h3 id = " categoryChooserLabel " >< ? php printMLText ( " choose_target_category " ) ?> </h3>
</ div >
< div class = " modal-body " >
2015-09-03 13:15:12 +00:00
< p >< ? php printMLText ( 'categories_loading' ) ?> </p>
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-footer " >
2013-02-20 09:47:20 +00:00
< button class = " btn btn-primary " data - dismiss = " modal " aria - hidden = " true " >< ? php printMLText ( " close " ) ?> </button>
2013-04-19 13:22:25 +00:00
< button class = " btn " data - dismiss = " modal " aria - hidden = " true " onClick = " acceptCategories(); " >< i class = " icon-save " ></ i > < ? php printMLText ( " save " ) ?> </button>
2012-12-14 07:53:13 +00:00
</ div >
</ div >
< ? php
} /* }}} */
2015-12-14 14:16:32 +00:00
function printKeywordChooserHtml ( $formName , $keywords = '' , $fieldname = 'keywords' ) { /* {{{ */
2018-06-20 18:39:28 +00:00
echo self :: getKeywordChooserHtml ( $formName , $keywords , $fieldname );
} /* }}} */
function getKeywordChooserHtml ( $formName , $keywords = '' , $fieldname = 'keywords' ) { /* {{{ */
2016-08-29 07:44:49 +00:00
$strictformcheck = $this -> params [ 'strictformcheck' ];
2018-06-20 18:39:28 +00:00
$content = '' ;
$content .= '
2012-12-14 07:53:13 +00:00
< div class = " input-append " >
2018-06-20 18:39:28 +00:00
< input type = " text " name = " '. $fieldname .' " id = " '. $fieldname .' " value = " '.htmlspecialchars( $keywords ).' " '.($strictformcheck ? ' required ' : ' ').' />
< a data - target = " #keywordChooser " role = " button " class = " btn " data - toggle = " modal " href = " ../out/out.KeywordChooser.php?target='. $formName .' " > '.getMLText("keywords").' … </ a >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal hide " id = " keywordChooser " tabindex = " -1 " role = " dialog " aria - labelledby = " keywordChooserLabel " aria - hidden = " true " >
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " > × </ button >
2018-06-20 18:39:28 +00:00
< h3 id = " keywordChooserLabel " > '.getMLText("use_default_keywords").' </ h3 >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-body " >
2018-06-20 18:39:28 +00:00
< p > '.getMLText(' keywords_loading ').' </ p >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-footer " >
2018-06-20 18:39:28 +00:00
< button class = " btn btn-primary " data - dismiss = " modal " aria - hidden = " true " > '. getMLText("close").' </ button >
< button class = " btn " data - dismiss = " modal " aria - hidden = " true " id = " acceptkeywords " >< i class = " icon-save " ></ i > '.getMLText("save").' </ button >
2012-12-14 07:53:13 +00:00
</ div >
2018-06-20 18:39:28 +00:00
</ div > ' ;
return $content ;
2012-12-14 07:53:13 +00:00
} /* }}} */
2015-12-14 14:16:32 +00:00
function printKeywordChooserJs ( $formName ) { /* {{{ */
?>
2017-01-10 06:37:45 +00:00
$ ( document ) . ready ( function () {
$ ( '#acceptkeywords' ) . click ( function ( ev ) {
acceptKeywords ();
});
2015-12-14 14:16:32 +00:00
});
< ? php
} /* }}} */
function printKeywordChooser ( $formName , $keywords = '' , $fieldname = 'keywords' ) { /* {{{ */
$this -> printKeywordChooserHtml ( $formName , $keywords , $fieldname );
?>
< script language = " JavaScript " >
< ? php
$this -> printKeywordChooserJs ( $formName );
?>
</ script >
< ? php
} /* }}} */
2016-10-04 18:48:51 +00:00
function printAttributeEditField ( $attrdef , $attribute , $fieldname = 'attributes' , $norequire = false ) { /* {{{ */
2018-04-23 13:50:46 +00:00
echo self :: getAttributeEditField ( $attrdef , $attribute , $fieldname , $norequire );
} /* }}} */
function getAttributeEditField ( $attrdef , $attribute , $fieldname = 'attributes' , $norequire = false ) { /* {{{ */
$content = '' ;
2015-10-30 07:02:21 +00:00
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_boolean :
2018-04-23 13:50:46 +00:00
$content .= " <input type= \" hidden \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" \" /> " ;
$content .= " <input type= \" checkbox \" id= \" " . $fieldname . " _ " . $attrdef -> getId () . " \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" 1 \" " . (( $attribute && $attribute -> getValue ()) ? 'checked' : '' ) . " /> " ;
2015-10-30 07:02:21 +00:00
break ;
case SeedDMS_Core_AttributeDefinition :: type_date :
2016-02-25 09:49:18 +00:00
$objvalue = $attribute ? ( is_object ( $attribute ) ? $attribute -> getValue () : $attribute ) : '' ;
2018-04-23 13:50:46 +00:00
$content .= '<span class="input-append date datepicker" data-date="' . date ( 'Y-m-d' ) . '" data-date-format="yyyy-mm-dd" data-date-language="' . str_replace ( '_' , '-' , $this -> params [ 'session' ] -> getLanguage ()) . ' " >
< input id = " '. $fieldname .'_'. $attrdef->getId ().' " class = " span9 " size = " 16 " name = " '. $fieldname .'['. $attrdef->getId ().'] " type = " text " value = " '.( $objvalue ? $objvalue : '').' " >
2015-10-30 07:02:21 +00:00
< span class = " add-on " >< i class = " icon-calendar " ></ i ></ span >
2018-04-23 13:50:46 +00:00
</ span > ' ;
2015-10-30 07:02:21 +00:00
break ;
2016-10-25 05:58:28 +00:00
case SeedDMS_Core_AttributeDefinition :: type_email :
2016-10-25 06:03:18 +00:00
$objvalue = $attribute ? ( is_object ( $attribute ) ? $attribute -> getValue () : $attribute ) : '' ;
2018-04-23 13:50:46 +00:00
$content .= " <input type= \" text \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" " . htmlspecialchars ( $objvalue ) . " \" " . (( ! $norequire && $attrdef -> getMinValues () > 0 ) ? ' required' : '' ) . ' data-rule-email="true"' . " /> " ;
2016-10-25 05:58:28 +00:00
break ;
2018-11-10 17:05:45 +00:00
case SeedDMS_Core_AttributeDefinition :: type_float :
$objvalue = $attribute ? ( is_object ( $attribute ) ? $attribute -> getValue () : $attribute ) : '' ;
$content .= " <input type= \" text \" id= \" " . $fieldname . " _ " . $attrdef -> getId () . " \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" " . htmlspecialchars ( $objvalue ) . " \" " . (( ! $norequire && $attrdef -> getMinValues () > 0 ) ? ' required' : '' ) . " data-rule-number= \" true \" /> " ;
break ;
2015-10-30 07:02:21 +00:00
default :
if ( $valueset = $attrdef -> getValueSetAsArray ()) {
2018-04-23 13:50:46 +00:00
$content .= " <input type= \" hidden \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" \" /> " ;
$content .= " <select id= \" " . $fieldname . " _ " . $attrdef -> getId () . " \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] " ;
2015-10-30 07:02:21 +00:00
if ( $attrdef -> getMultipleValues ()) {
2018-04-23 13:50:46 +00:00
$content .= " [] \" multiple " ;
2015-10-30 07:02:21 +00:00
} else {
2020-04-01 12:05:33 +00:00
$content .= " \" data-allow-clear= \" true \" " ;
2014-04-15 13:33:05 +00:00
}
2019-02-27 10:44:27 +00:00
$content .= " " . (( ! $norequire && $attrdef -> getMinValues () > 0 ) ? ' required' : '' ) . " class= \" chzn-select \" data-placeholder= \" " . getMLText ( " select_value " ) . " \" > " ;
2015-10-30 07:02:21 +00:00
if ( ! $attrdef -> getMultipleValues ()) {
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" \" ></option> " ;
2015-10-30 07:02:21 +00:00
}
2015-10-30 07:41:40 +00:00
$objvalue = $attribute ? ( is_object ( $attribute ) ? $attribute -> getValueAsArray () : $attribute ) : array ();
2015-10-30 07:02:21 +00:00
foreach ( $valueset as $value ) {
if ( $value ) {
2018-04-23 13:50:46 +00:00
$content .= " <option value= \" " . htmlspecialchars ( $value ) . " \" " ;
2015-10-30 07:02:21 +00:00
if ( is_array ( $objvalue ) && in_array ( $value , $objvalue ))
2018-04-23 13:50:46 +00:00
$content .= " selected " ;
2015-10-30 07:02:21 +00:00
elseif ( $value == $objvalue )
2018-04-23 13:50:46 +00:00
$content .= " selected " ;
$content .= " > " . htmlspecialchars ( $value ) . " </option> " ;
2015-10-30 07:02:21 +00:00
}
}
2018-04-23 13:50:46 +00:00
$content .= " </select> " ;
2014-02-20 20:05:22 +00:00
} else {
2015-10-30 07:41:40 +00:00
$objvalue = $attribute ? ( is_object ( $attribute ) ? $attribute -> getValue () : $attribute ) : '' ;
if ( strlen ( $objvalue ) > 80 ) {
2018-04-23 13:50:46 +00:00
$content .= " <textarea id= \" " . $fieldname . " _ " . $attrdef -> getId () . " \" class= \" input-xxlarge \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" " . (( ! $norequire && $attrdef -> getMinValues () > 0 ) ? ' required' : '' ) . " > " . htmlspecialchars ( $objvalue ) . " </textarea> " ;
2015-10-30 07:02:21 +00:00
} else {
2018-04-23 13:50:46 +00:00
$content .= " <input type= \" text \" id= \" " . $fieldname . " _ " . $attrdef -> getId () . " \" name= \" " . $fieldname . " [ " . $attrdef -> getId () . " ] \" value= \" " . htmlspecialchars ( $objvalue ) . " \" " . (( ! $norequire && $attrdef -> getMinValues () > 0 ) ? ' required' : '' ) . ( $attrdef -> getType () == SeedDMS_Core_AttributeDefinition :: type_int ? ' data-rule-digits="true"' : '' ) . " /> " ;
2014-04-15 13:33:05 +00:00
}
2012-12-14 07:53:13 +00:00
}
2015-10-30 07:02:21 +00:00
break ;
2012-12-14 07:53:13 +00:00
}
2018-04-23 13:50:46 +00:00
return $content ;
2012-12-14 07:53:13 +00:00
} /* }}} */
2016-03-08 17:33:54 +00:00
function printDropFolderChooserHtml ( $formName , $dropfolderfile = " " , $showfolders = 0 ) { /* {{{ */
2018-06-21 07:29:02 +00:00
echo self :: getDropFolderChooserHtml ( $formName , $dropfolderfile , $showfolders );
} /* }}} */
function getDropFolderChooserHtml ( $formName , $dropfolderfile = " " , $showfolders = 0 ) { /* {{{ */
$content = " <div class= \" input-append \" > \n " ;
$content .= " <input readonly type= \" text \" id= \" dropfolderfile " . $formName . " \" name= \" dropfolderfile " . $formName . " \" value= \" " . $dropfolderfile . " \" > " ;
$content .= " <button type= \" button \" class= \" btn \" id= \" clearfilename " . $formName . " \" ><i class= \" icon-remove \" ></i></button> " ;
2019-07-30 04:33:18 +00:00
$content .= " <a data-target= \" #dropfolderChooser \" href= \" ../out/out.DropFolderChooser.php?form= " . $formName . " &dropfolderfile= " . urlencode ( $dropfolderfile ) . " &showfolders= " . $showfolders . " \" role= \" button \" class= \" btn \" data-toggle= \" modal \" > " . ( $showfolders ? getMLText ( " choose_target_folder " ) : getMLText ( " choose_target_file " )) . " …</a> \n " ;
2018-06-21 07:29:02 +00:00
$content .= " </div> \n " ;
$content .= '
2012-12-14 07:53:13 +00:00
< div class = " modal hide " id = " dropfolderChooser " tabindex = " -1 " role = " dialog " aria - labelledby = " dropfolderChooserLabel " aria - hidden = " true " >
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " > × </ button >
2018-06-21 07:29:02 +00:00
< h3 id = " dropfolderChooserLabel " > '.($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file")).' </ h3 >
2012-12-14 07:53:13 +00:00
</ div >
< div class = " modal-body " >
2018-06-21 07:29:02 +00:00
< p > '.getMLText(' files_loading ').' </ p >
</ div >
2012-12-14 07:53:13 +00:00
< div class = " modal-footer " >
2018-06-21 07:29:02 +00:00
< button class = " btn btn-primary " data - dismiss = " modal " aria - hidden = " true " > '.getMLText("close").' </ button >
2012-12-14 07:53:13 +00:00
</ div >
</ div >
2018-06-21 07:29:02 +00:00
' ;
return $content ;
2015-12-14 14:16:32 +00:00
} /* }}} */
2016-03-08 17:33:54 +00:00
function printDropFolderChooserJs ( $formName , $showfolders = 0 ) { /* {{{ */
2015-12-14 14:16:32 +00:00
?>
2013-05-29 16:21:46 +00:00
/* Set up a callback which is called when a folder in the tree is selected */
modalDropfolderChooser = $ ( '#dropfolderChooser' );
2019-07-30 04:33:18 +00:00
function fileSelected ( name , form ) {
// $('#dropfolderfile<?php echo $formName ?>').val(name);
$ ( '#dropfolderfile' + form ) . val ( name );
2013-05-29 16:21:46 +00:00
modalDropfolderChooser . modal ( 'hide' );
}
2016-03-08 17:33:54 +00:00
< ? php if ( $showfolders ) { ?>
2019-07-30 04:33:18 +00:00
function folderSelected ( name , form ) {
// $('#dropfolderfile<?php echo $formName ?>').val(name);
$ ( '#dropfolderfile' + form ) . val ( name );
2016-03-08 17:33:54 +00:00
modalDropfolderChooser . modal ( 'hide' );
}
< ? php } ?>
2017-01-10 06:37:45 +00:00
$ ( document ) . ready ( function () {
$ ( '#clearfilename<?php print $formName ?>' ) . click ( function ( ev ) {
$ ( '#dropfolderfile<?php echo $formName ?>' ) . val ( '' );
});
2015-12-14 14:16:32 +00:00
});
< ? php
} /* }}} */
2016-03-08 17:33:54 +00:00
function printDropFolderChooser ( $formName , $dropfolderfile = " " , $showfolders = 0 ) { /* {{{ */
$this -> printDropFolderChooserHtml ( $formName , $dropfolderfile , $showfolders );
2015-12-14 14:16:32 +00:00
?>
< script language = " JavaScript " >
< ? php
2016-03-08 17:33:54 +00:00
$this -> printDropFolderChooserJs ( $formName , $showfolders );
2015-12-14 14:16:32 +00:00
?>
</ script >
2012-12-14 07:53:13 +00:00
< ? php
} /* }}} */
function getImgPath ( $img ) { /* {{{ */
2018-10-11 07:39:02 +00:00
// if ( is_file($this->imgpath.$img) ) {
2012-12-14 07:53:13 +00:00
return $this -> imgpath . $img ;
2018-10-11 07:39:02 +00:00
// }
2018-10-11 08:51:04 +00:00
return " " ;
2012-12-14 07:53:13 +00:00
} /* }}} */
2014-12-08 13:49:26 +00:00
function getCountryFlag ( $lang ) { /* {{{ */
switch ( $lang ) {
case " en_GB " :
return 'flags/gb.png' ;
break ;
default :
return 'flags/' . substr ( $lang , 0 , 2 ) . '.png' ;
}
} /* }}} */
2012-12-14 07:53:13 +00:00
function printImgPath ( $img ) { /* {{{ */
print $this -> getImgPath ( $img );
} /* }}} */
2013-01-24 09:35:56 +00:00
function infoMsg ( $msg ) { /* {{{ */
echo " <div class= \" alert alert-info \" > \n " ;
echo $msg ;
echo " </div> \n " ;
} /* }}} */
2012-12-19 10:17:38 +00:00
function warningMsg ( $msg ) { /* {{{ */
echo " <div class= \" alert alert-warning \" > \n " ;
echo $msg ;
echo " </div> \n " ;
} /* }}} */
2013-02-05 10:08:26 +00:00
function errorMsg ( $msg ) { /* {{{ */
echo " <div class= \" alert alert-error \" > \n " ;
echo $msg ;
echo " </div> \n " ;
} /* }}} */
2019-10-18 10:21:40 +00:00
function successMsg ( $msg ) { /* {{{ */
echo " <div class= \" alert alert-success \" > \n " ;
echo $msg ;
echo " </div> \n " ;
} /* }}} */
2018-04-06 14:34:01 +00:00
function ___exitError ( $pagetitle , $error , $noexit = false , $plain = false ) { /* {{{ */
2018-04-06 07:27:58 +00:00
/* This is just a hack to prevent creation of js files in an error
* case , because they will contain this error page again . It would be much
* better , if there was extra error () function similar to show () and calling
* $view () after setting the action to 'error' . This would also allow to
* set separate error pages for each view .
*/
2018-04-06 07:45:08 +00:00
if ( ! $noexit && isset ( $_REQUEST [ 'action' ])) {
2018-04-06 07:27:58 +00:00
if ( in_array ( $_REQUEST [ 'action' ], array ( 'js' , 'footerjs' ))) {
exit ;
}
if ( $_REQUEST [ 'action' ] == 'webrootjs' ) {
$this -> webrootjs ();
exit ;
}
}
if ( ! $plain ) {
$this -> htmlStartPage ( $pagetitle );
$this -> globalNavigation ();
$this -> contentStart ();
}
2012-12-14 07:53:13 +00:00
print " <div class= \" alert alert-error \" > " ;
2013-09-05 20:51:01 +00:00
print " <h4> " . getMLText ( 'error' ) . " !</h4> " ;
2012-12-14 07:53:13 +00:00
print htmlspecialchars ( $error );
print " </div> " ;
2016-03-29 05:59:20 +00:00
print " <div><button class= \" btn history-back \" > " . getMLText ( 'back' ) . " </button></div> " ;
2012-12-14 07:53:13 +00:00
2016-03-15 07:28:23 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
2013-10-06 10:27:06 +00:00
add_log_line ( " UI::exitError error= " . $error . " pagetitle= " . $pagetitle , PEAR_LOG_ERR );
2014-03-04 07:30:32 +00:00
if ( $noexit )
return ;
2012-12-14 07:53:13 +00:00
exit ;
} /* }}} */
2015-12-11 19:29:52 +00:00
function printNewTreeNavigation ( $folderid = 0 , $accessmode = M_READ , $showdocs = 0 , $formid = 'form1' , $expandtree = 0 , $orderby = '' ) { /* {{{ */
$this -> printNewTreeNavigationHtml ( $folderid , $accessmode , $showdocs , $formid , $expandtree , $orderby );
?>
< script language = " JavaScript " >
< ? php
$this -> printNewTreeNavigationJs ( $folderid , $accessmode , $showdocs , $formid , $expandtree , $orderby );
?>
</ script >
< ? php
} /* }}} */
function printNewTreeNavigationHtml ( $folderid = 0 , $accessmode = M_READ , $showdocs = 0 , $formid = 'form1' , $expandtree = 0 , $orderby = '' ) { /* {{{ */
2019-08-08 07:32:42 +00:00
//echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."&orderby=".$orderby."\"></div>\n";
echo " <div id= \" jqtree " . $formid . " \" style= \" margin-left: 10px; \" data-url= \" " . $_SERVER [ 'SCRIPT_NAME' ] . " ?action=subtree \" ></div> \n " ;
2015-12-11 19:29:52 +00:00
} /* }}} */
2013-05-26 16:55:57 +00:00
/**
* Create a tree of folders using jqtree .
*
* The tree can contain folders only or include documents .
*
2014-03-26 06:27:01 +00:00
* @ param integer $folderid current folderid . If set the tree will be
2013-05-26 16:55:57 +00:00
* folded out and the all folders in the path will be visible
2014-03-26 06:27:01 +00:00
* @ param integer $accessmode use this access mode when retrieving folders
2013-05-26 16:55:57 +00:00
* and documents shown in the tree
2014-03-26 06:27:01 +00:00
* @ param boolean $showdocs set to true if tree shall contain documents
2013-05-26 16:55:57 +00:00
* as well .
2019-01-11 12:16:08 +00:00
* @ param integer $expandtree level to which the tree shall be opened
2019-09-06 13:19:47 +00:00
* @ param boolean $partialtree set to true if the given folder is the start folder
2013-05-26 16:55:57 +00:00
*/
2019-09-06 13:19:47 +00:00
function printNewTreeNavigationJs ( $folderid = 0 , $accessmode = M_READ , $showdocs = 0 , $formid = 'form1' , $expandtree = 0 , $orderby = '' , $partialtree = false ) { /* {{{ */
2020-06-03 08:53:49 +00:00
function jqtree ( $path , $folder , $user , $accessmode , $showdocs = 1 , $expandtree = 0 , $orderby = '' , $level = 0 ) { /* {{{ */
2019-06-24 09:54:08 +00:00
$orderdir = ( isset ( $orderby [ 1 ]) ? ( $orderby [ 1 ] == 'd' ? 'desc' : 'asc' ) : 'asc' );
2019-09-11 15:43:50 +00:00
if ( $path /* || $expandtree>=$level*/ ) {
2013-09-06 13:24:51 +00:00
if ( $path )
$pathfolder = array_shift ( $path );
2019-08-27 12:35:22 +00:00
$children = array ();
2019-09-11 15:43:50 +00:00
if ( $expandtree ) {
$subfolders = $folder -> getSubFolders ( isset ( $orderby [ 0 ]) ? $orderby [ 0 ] : '' , $orderdir );
$subfolders = SeedDMS_Core_DMS :: filterAccess ( $subfolders , $user , $accessmode );
} else {
$subfolders = array ( $pathfolder );
}
2013-05-24 15:32:12 +00:00
foreach ( $subfolders as $subfolder ) {
2020-06-03 08:53:49 +00:00
$node = array ( 'label' => $subfolder -> getName (), 'id' => $subfolder -> getID (), 'load_on_demand' => ( 1 && ( $subfolder -> hasSubFolders () || ( $subfolder -> hasDocuments () && $showdocs ))) ? true : false , 'is_folder' => true );
2019-09-11 15:43:50 +00:00
if ( /*$expandtree>=$level ||*/ $pathfolder -> getID () == $subfolder -> getID ()) {
2019-02-04 13:24:30 +00:00
$node [ 'children' ] = jqtree ( $path , $subfolder , $user , $accessmode , $showdocs , $expandtree , $orderby , $level + 1 );
2013-05-24 15:32:12 +00:00
if ( $showdocs ) {
2019-07-11 15:18:03 +00:00
$documents = $subfolder -> getDocuments ( isset ( $orderby [ 0 ]) ? $orderby [ 0 ] : '' , $orderdir );
2013-05-26 16:55:57 +00:00
$documents = SeedDMS_Core_DMS :: filterAccess ( $documents , $user , $accessmode );
2013-05-24 15:32:12 +00:00
foreach ( $documents as $document ) {
$node2 = array ( 'label' => $document -> getName (), 'id' => $document -> getID (), 'load_on_demand' => false , 'is_folder' => false );
2019-02-04 13:24:30 +00:00
$node [ 'children' ][] = $node2 ;
2013-05-24 15:32:12 +00:00
}
}
}
$children [] = $node ;
}
return $children ;
2013-05-31 14:13:15 +00:00
} else {
2019-07-11 15:18:03 +00:00
$subfolders = $folder -> getSubFolders ( isset ( $orderby [ 0 ]) ? $orderby [ 0 ] : '' , $orderdir );
2013-05-31 14:13:15 +00:00
$subfolders = SeedDMS_Core_DMS :: filterAccess ( $subfolders , $user , $accessmode );
$children = array ();
foreach ( $subfolders as $subfolder ) {
2019-09-05 10:53:45 +00:00
$node = array ( 'label' => $subfolder -> getName (), 'id' => $subfolder -> getID (), 'load_on_demand' => ( $subfolder -> hasSubFolders () || ( $subfolder -> hasDocuments () && $showdocs )) ? true : false , 'is_folder' => true );
2013-05-31 14:13:15 +00:00
$children [] = $node ;
}
return $children ;
}
return array ();
2020-06-03 08:53:49 +00:00
} /* }}} */
2012-12-14 07:53:13 +00:00
2019-06-24 09:54:08 +00:00
$orderdir = ( isset ( $orderby [ 1 ]) ? ( $orderby [ 1 ] == 'd' ? 'desc' : 'asc' ) : 'asc' );
2013-05-24 15:32:12 +00:00
if ( $folderid ) {
$folder = $this -> params [ 'dms' ] -> getFolder ( $folderid );
2019-09-06 13:19:47 +00:00
if ( ! $partialtree ) {
$path = $folder -> getPath ();
}
2019-01-11 12:16:08 +00:00
/* Get the first folder (root folder) of path */
2013-05-24 15:32:12 +00:00
$folder = array_shift ( $path );
2019-01-11 12:16:08 +00:00
$node = array ( 'label' => $folder -> getName (), 'id' => $folder -> getID (), 'load_on_demand' => false , 'is_folder' => true );
2013-05-24 15:32:12 +00:00
if ( ! $folder -> hasSubFolders ()) {
2019-09-05 10:53:45 +00:00
$node [ 'load_on_demand' ] = true ;
2013-05-24 15:32:12 +00:00
$node [ 'children' ] = array ();
} else {
2019-12-20 13:17:48 +00:00
$node [ 'children' ] = jqtree ( $path , $folder , $this -> params [ 'user' ], $accessmode , $showdocs , 1 /*$expandtree*/ , $orderby , 0 );
2015-06-11 09:25:14 +00:00
if ( $showdocs ) {
2019-07-11 15:18:03 +00:00
$documents = $folder -> getDocuments ( isset ( $orderby [ 0 ]) ? $orderby [ 0 ] : '' , $orderdir );
2015-06-11 09:25:14 +00:00
$documents = SeedDMS_Core_DMS :: filterAccess ( $documents , $this -> params [ 'user' ], $accessmode );
foreach ( $documents as $document ) {
$node2 = array ( 'label' => $document -> getName (), 'id' => $document -> getID (), 'load_on_demand' => false , 'is_folder' => false );
$node [ 'children' ][] = $node2 ;
}
}
2013-05-24 15:32:12 +00:00
}
2013-09-17 04:22:34 +00:00
/* Nasty hack to remove the highest folder */
if ( isset ( $this -> params [ 'remove_root_from_tree' ]) && $this -> params [ 'remove_root_from_tree' ]) {
foreach ( $node [ 'children' ] as $n )
$tree [] = $n ;
} else {
$tree [] = $node ;
}
2013-05-24 15:32:12 +00:00
} else {
$root = $this -> params [ 'dms' ] -> getFolder ( $this -> params [ 'rootfolderid' ]);
2019-08-27 12:35:22 +00:00
$tree = array ( array ( 'label' => $root -> getName (), 'id' => $root -> getID (), 'load_on_demand' => false , 'is_folder' => true ));
2012-12-14 07:53:13 +00:00
}
2013-05-24 15:32:12 +00:00
?>
var data = < ? php echo json_encode ( $tree ); ?> ;
$ ( function () {
2019-09-05 10:53:45 +00:00
const $tree = $ ( '#jqtree<?php echo $formid ?>' );
$tree . tree ({
2020-06-03 08:53:49 +00:00
// saveState: false,
2019-09-11 15:43:50 +00:00
selectable : true ,
2013-05-24 15:32:12 +00:00
data : data ,
2016-11-15 17:10:22 +00:00
saveState : 'jqtree<?php echo $formid; ?>' ,
2019-01-11 12:16:08 +00:00
openedIcon : $ ( '<i class="icon-minus-sign"></i>' ),
closedIcon : $ ( '<i class="icon-plus-sign"></i>' ),
2013-10-08 19:09:06 +00:00
_onCanSelectNode : function ( node ) {
if ( node . is_folder ) {
2016-11-15 17:10:22 +00:00
folderSelected < ? php echo $formid ?> (node.id, node.name);
2013-10-08 19:09:06 +00:00
} else
2016-11-15 17:10:22 +00:00
documentSelected < ? php echo $formid ?> (node.id, node.name);
2013-05-24 15:32:12 +00:00
},
2019-09-11 15:43:50 +00:00
autoOpen : false ,
2013-05-24 15:32:12 +00:00
drapAndDrop : true ,
onCreateLi : function ( node , $li ) {
// Add 'icon' span before title
if ( node . is_folder )
2019-07-12 14:43:34 +00:00
$li . find ( '.jqtree-title' ) . before ( '<i class="icon-folder-close-alt table-row-folder droptarget" data-droptarget="folder_' + node . id + '" rel="folder_' + node . id + '"></i> ' ) . attr ( 'rel' , 'folder_' + node . id ) . attr ( 'formtoken' , '<?php echo createFormKey(' '); ?>' ) . attr ( 'data-uploadformtoken' , '<?php echo createFormKey(' '); ?>' );
2013-05-24 15:32:12 +00:00
else
$li . find ( '.jqtree-title' ) . before ( '<i class="icon-file"></i> ' );
}
2016-02-02 08:41:31 +00:00
});
2019-01-11 12:16:08 +00:00
// Unfold node for currently selected folder
2020-06-03 08:53:49 +00:00
$ ( '#jqtree<?php echo $formid ?>' ) . tree ( 'selectNode' , $ ( '#jqtree<?php echo $formid ?>' ) . tree ( 'getNodeById' , < ? php echo $folderid ?> ), false, true);
2019-01-11 12:16:08 +00:00
$ ( '#jqtree<?php echo $formid ?>' ) . on (
2019-08-27 12:35:22 +00:00
'tree.click' ,
2013-10-08 19:09:06 +00:00
function ( event ) {
var node = event . node ;
2019-08-27 12:35:22 +00:00
if ( ! node )
return ;
2016-11-15 17:10:22 +00:00
$ ( '#jqtree<?php echo $formid ?>' ) . tree ( 'openNode' , node );
2013-10-08 19:09:06 +00:00
// event.preventDefault();
if ( node . is_folder ) {
2019-02-27 10:44:27 +00:00
if ( typeof node . fetched == 'undefined' ) {
node . fetched = true ;
$ ( this ) . tree ( 'loadDataFromUrl' , node , function () {
2019-08-27 12:35:22 +00:00
$ ( this ) . tree ( 'openNode' , node );
});
2019-02-27 10:44:27 +00:00
}
2016-11-15 17:10:22 +00:00
folderSelected < ? php echo $formid ?> (node.id, node.name);
2013-10-08 19:09:06 +00:00
} else
2016-11-15 17:10:22 +00:00
documentSelected < ? php echo $formid ?> (node.id, node.name);
2013-10-08 19:09:06 +00:00
}
);
2019-01-11 12:16:08 +00:00
$ ( '#jqtree<?php echo $formid ?>' ) . on (
'tree.contextmenu' ,
function ( event ) {
// The clicked node is 'event.node'
var node = event . node ;
if ( typeof node . fetched == 'undefined' ) {
node . fetched = true ;
$ ( this ) . tree ( 'loadDataFromUrl' , node );
}
$ ( this ) . tree ( 'openNode' , node );
}
);
$ ( " #jqtree " ) . on ( 'dragenter' , function ( e ) {
attr_rel = $ ( e . srcElement ) . attr ( 'rel' );
if ( typeof attr_rel == 'undefined' )
return ;
target_type = attr_rel . split ( " _ " )[ 0 ];
target_id = attr_rel . split ( " _ " )[ 1 ];
var node = $ ( this ) . tree ( 'getNodeById' , parseInt ( target_id ));
if ( typeof node . fetched == 'undefined' ) {
node . fetched = true ;
$ ( this ) . tree ( 'loadDataFromUrl' , node , function () { $ ( this ) . tree ( 'openNode' , node );});
}
});
2013-05-24 15:32:12 +00:00
});
2012-12-14 07:53:13 +00:00
< ? php
2013-05-24 15:32:12 +00:00
} /* }}} */
2012-12-14 07:53:13 +00:00
2019-08-08 07:32:42 +00:00
/**
* Return json data for sub tree of navigation tree
*/
function printNewTreeNavigationSubtree ( $folderid , $showdocs = 0 , $orderby = '' ) { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$folder = $dms -> getFolder ( $folderid );
if ( ! is_object ( $folder )) return '' ;
$subfolders = $folder -> getSubFolders ( $orderby );
$subfolders = SeedDMS_Core_DMS :: filterAccess ( $subfolders , $user , M_READ );
$tree = array ();
foreach ( $subfolders as $subfolder ) {
$loadondemand = $subfolder -> hasSubFolders () || ( $subfolder -> hasDocuments () && $showdocs );
$level = array ( 'label' => $subfolder -> getName (), 'id' => $subfolder -> getID (), 'load_on_demand' => $loadondemand , 'is_folder' => true );
if ( ! $subfolder -> hasSubFolders ())
$level [ 'children' ] = array ();
$tree [] = $level ;
}
if ( $showdocs ) {
$documents = $folder -> getDocuments ( $orderby );
$documents = SeedDMS_Core_DMS :: filterAccess ( $documents , $user , M_READ );
foreach ( $documents as $document ) {
$level = array ( 'label' => $document -> getName (), 'id' => $document -> getID (), 'load_on_demand' => false , 'is_folder' => false );
$tree [] = $level ;
}
}
header ( 'Content-Type: application/json' );
echo json_encode ( $tree );
} /* }}} */
2013-05-24 15:32:12 +00:00
function printTreeNavigation ( $folderid , $showtree ){ /* {{{ */
if ( $showtree == 1 ){
2013-01-30 20:00:43 +00:00
$this -> contentHeading ( " <a href= \" ../out/out.ViewFolder.php?folderid= " . $folderid . " &showtree=0 \" ><i class= \" icon-minus-sign \" ></i></a> " , true );
2012-12-14 07:53:13 +00:00
$this -> contentContainerStart ();
2013-05-24 15:32:12 +00:00
?>
< script language = " JavaScript " >
function folderSelected ( id , name ) {
window . location = '../out/out.ViewFolder.php?folderid=' + id ;
}
</ script >
< ? php
2013-06-03 05:55:39 +00:00
$this -> printNewTreeNavigation ( $folderid , M_READ , 0 , '' );
2012-12-14 07:53:13 +00:00
$this -> contentContainerEnd ();
2013-05-24 15:32:12 +00:00
} else {
2013-01-30 20:00:43 +00:00
$this -> contentHeading ( " <a href= \" ../out/out.ViewFolder.php?folderid= " . $folderid . " &showtree=1 \" ><i class= \" icon-plus-sign \" ></i></a> " , true );
2012-12-14 07:53:13 +00:00
}
} /* }}} */
2014-06-05 13:02:19 +00:00
/**
* Print clipboard in div container
*
* @ param array clipboard
*/
2015-07-15 05:24:32 +00:00
function printClipboard ( $clipboard , $previewer ){ /* {{{ */
2020-05-13 11:28:32 +00:00
echo " <div id= \" clipboard-container \" class= \" _clipboard-container \" > \n " ;
$this -> contentHeading ( getMLText ( " clipboard " ) . '<span id="clipboard-float"><i class="icon-sort"></i></span>' , true );
2016-03-08 05:56:58 +00:00
echo " <div id= \" main-clipboard \" > \n " ;
2017-03-10 19:09:08 +00:00
?>
< div class = " ajax " data - view = " Clipboard " data - action = " mainClipboard " ></ div >
< ? php
2013-01-30 20:00:43 +00:00
echo " </div> \n " ;
2020-05-13 11:28:32 +00:00
echo " </div> \n " ;
2013-01-30 20:00:43 +00:00
} /* }}} */
2014-06-05 07:50:21 +00:00
/**
* Print button with link for deleting a document
*
* This button is used in document listings ( e . g . on the ViewFolder page )
* for deleting a document . In seeddms version < 4.3 . 9 this was just a
* link to the out / out . RemoveDocument . php page which asks for confirmation
* an than calls op / op . RemoveDocument . php . Starting with version 4.3 . 9
* the button just opens a small popup asking for confirmation and than
* calls the ajax command 'deletedocument' . The ajax call is called
* in the click function of 'button.removedocument' . That button needs
* to have two attributes : 'rel' for the id of the document , and 'msg'
* for the message shown by notify if the document could be deleted .
*
* @ param object $document document to be deleted
* @ param string $msg message shown in case of successful deletion
2014-06-06 12:00:28 +00:00
* @ param boolean $return return html instead of printing it
* @ return string html content if $return is true , otherwise an empty string
2014-06-05 07:50:21 +00:00
*/
2014-06-06 12:00:28 +00:00
function printDeleteDocumentButton ( $document , $msg , $return = false ){ /* {{{ */
2014-06-04 17:20:07 +00:00
$docid = $document -> getID ();
2014-06-06 12:00:28 +00:00
$content = '' ;
2017-05-12 16:09:53 +00:00
$content .= '<a class="delete-document-btn" rel="' . $docid . '" msg="' . getMLText ( $msg ) . '" confirmmsg="' . htmlspecialchars ( getMLText ( " confirm_rm_document " , array ( " documentname " => $document -> getName ())), ENT_QUOTES ) . '"><i class="icon-remove"></i></a>' ;
2014-06-06 12:00:28 +00:00
if ( $return )
return $content ;
else
echo $content ;
return '' ;
2014-06-05 07:50:21 +00:00
} /* }}} */
2015-12-11 19:29:52 +00:00
function printDeleteDocumentButtonJs (){ /* {{{ */
echo "
$ ( document ) . ready ( function () {
2016-02-09 11:35:30 +00:00
// $('.delete-document-btn').click(function(ev) {
$ ( 'body' ) . on ( 'click' , 'a.delete-document-btn' , function ( ev ){
2019-10-16 15:57:56 +00:00
ev . stopPropagation ();
2015-12-11 19:29:52 +00:00
id = $ ( ev . currentTarget ) . attr ( 'rel' );
confirmmsg = $ ( ev . currentTarget ) . attr ( 'confirmmsg' );
msg = $ ( ev . currentTarget ) . attr ( 'msg' );
formtoken = '".createFormKey(' removedocument ')."' ;
bootbox . dialog ( confirmmsg , [{
\ " label \" : \" <i class='icon-remove'></i> " . getMLText ( " rm_document " ) . " \" ,
\ " class \" : \" btn-danger \" ,
\ " callback \" : function() {
$ . get ( '../op/op.Ajax.php' ,
{ command : 'deletedocument' , id : id , formtoken : formtoken },
function ( data ) {
if ( data . success ) {
$ ( '#table-row-document-' + id ) . hide ( 'slow' );
noty ({
text : msg ,
type : 'success' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 1500 ,
});
} else {
noty ({
text : data . message ,
type : 'error' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 3500 ,
});
}
},
'json'
);
}
}, {
\ " label \" : \" " . getMLText ( " cancel " ) . " \" ,
\ " class \" : \" btn-cancel \" ,
\ " callback \" : function() {
}
}]);
});
});
" ;
} /* }}} */
2014-06-05 07:50:21 +00:00
/**
* Print button with link for deleting a folder
*
* This button works like document delete button
* { @ link SeedDMS_Bootstrap_Style :: printDeleteDocumentButton ()}
*
* @ param object $folder folder to be deleted
* @ param string $msg message shown in case of successful deletion
2014-06-06 12:00:28 +00:00
* @ param boolean $return return html instead of printing it
* @ return string html content if $return is true , otherwise an empty string
2014-06-05 07:50:21 +00:00
*/
2014-06-06 12:00:28 +00:00
function printDeleteFolderButton ( $folder , $msg , $return = false ){ /* {{{ */
2014-06-05 07:50:21 +00:00
$folderid = $folder -> getID ();
2014-06-06 12:00:28 +00:00
$content = '' ;
2015-12-11 19:29:52 +00:00
$content .= '<a class="delete-folder-btn" rel="' . $folderid . '" msg="' . getMLText ( $msg ) . '" confirmmsg="' . htmlspecialchars ( getMLText ( " confirm_rm_folder " , array ( " foldername " => $folder -> getName ())), ENT_QUOTES ) . '"><i class="icon-remove"></i></a>' ;
2014-06-06 12:00:28 +00:00
if ( $return )
return $content ;
else
echo $content ;
return '' ;
} /* }}} */
2015-12-11 19:29:52 +00:00
function printDeleteFolderButtonJs (){ /* {{{ */
echo "
$ ( document ) . ready ( function () {
2016-02-09 11:35:30 +00:00
// $('.delete-folder-btn').click(function(ev) {
$ ( 'body' ) . on ( 'click' , 'a.delete-folder-btn' , function ( ev ){
2019-10-16 15:57:56 +00:00
ev . stopPropagation ();
2015-12-11 19:29:52 +00:00
id = $ ( ev . currentTarget ) . attr ( 'rel' );
confirmmsg = $ ( ev . currentTarget ) . attr ( 'confirmmsg' );
msg = $ ( ev . currentTarget ) . attr ( 'msg' );
formtoken = '".createFormKey(' removefolder ')."' ;
bootbox . dialog ( confirmmsg , [{
\ " label \" : \" <i class='icon-remove'></i> " . getMLText ( " rm_folder " ) . " \" ,
\ " class \" : \" btn-danger \" ,
\ " callback \" : function() {
$ . get ( '../op/op.Ajax.php' ,
{ command : 'deletefolder' , id : id , formtoken : formtoken },
function ( data ) {
if ( data . success ) {
$ ( '#table-row-folder-' + id ) . hide ( 'slow' );
noty ({
text : msg ,
type : 'success' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 1500 ,
});
} else {
noty ({
text : data . message ,
type : 'error' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 3500 ,
});
}
},
'json'
);
}
}, {
\ " label \" : \" " . getMLText ( " cancel " ) . " \" ,
\ " class \" : \" btn-cancel \" ,
\ " callback \" : function() {
}
}]);
});
});
" ;
} /* }}} */
2014-06-06 12:00:28 +00:00
function printLockButton ( $document , $msglock , $msgunlock , $return = false ) { /* {{{ */
$docid = $document -> getID ();
if ( $document -> isLocked ()) {
$icon = 'unlock' ;
$msg = $msgunlock ;
$title = 'unlock_document' ;
} else {
$icon = 'lock' ;
$msg = $msglock ;
$title = 'lock_document' ;
}
$content = '' ;
$content .= '<a class="lock-document-btn" rel="' . $docid . '" msg="' . getMLText ( $msg ) . '" title="' . getMLText ( $title ) . '"><i class="icon-' . $icon . '"></i></a>' ;
if ( $return )
return $content ;
else
echo $content ;
return '' ;
} /* }}} */
2018-06-26 04:51:04 +00:00
/**
* Output left - arrow with link which takes over a number of ids into
* a select box .
*
* Clicking in the button will preset the comma seperated list of ids
* in data - ref as options in the select box with name $name
*
* @ param string $name id of select box
* @ param array $ids list of option values
*/
function getSelectPresetButtonHtml ( $name , $ids ) { /* {{{ */
return '<span id="' . $name . '_btn" class="selectpreset_btn" style="cursor: pointer;" title="' . getMLText ( " takeOver " . $name ) . '" data-ref="' . $name . '" data-ids="' . implode ( " , " , $ids ) . '"><i class="icon-arrow-left"></i></span>' ;
} /* }}} */
2016-03-21 06:40:17 +00:00
/**
* Output left - arrow with link which takes over a number of ids into
* a select box .
*
* Clicking in the button will preset the comma seperated list of ids
* in data - ref as options in the select box with name $name
*
* @ param string $name id of select box
* @ param array $ids list of option values
*/
function printSelectPresetButtonHtml ( $name , $ids ) { /* {{{ */
2018-06-26 04:51:04 +00:00
echo self :: getSelectPresetButtonHtml ( $name , $ids );
2016-03-21 06:40:17 +00:00
} /* }}} */
/**
* Javascript code for select preset button
*/
function printSelectPresetButtonJs () { /* {{{ */
?>
$ ( document ) . ready ( function () {
$ ( '.selectpreset_btn' ) . click ( function ( ev ){
ev . preventDefault ();
if ( typeof $ ( ev . currentTarget ) . data ( 'ids' ) != 'undefined' ) {
target = $ ( ev . currentTarget ) . data ( 'ref' );
// Use attr() instead of data() because data() converts to int which cannot be split
items = $ ( ev . currentTarget ) . attr ( 'data-ids' );
arr = items . split ( " , " );
for ( var i in arr ) {
$ ( " # " + target + " option[value=' " + arr [ i ] + " '] " ) . attr ( " selected " , " selected " );
}
2016-12-01 07:23:52 +00:00
// $("#"+target).trigger("chosen:updated");
$ ( " # " + target ) . trigger ( " change " );
2016-03-21 06:40:17 +00:00
}
});
});
< ? php
} /* }}} */
2018-06-26 04:51:04 +00:00
/**
* Get HTML for left - arrow with link which takes over a string into
* a input field .
*
* Clicking on the button will preset the string
* in data - ref the value of the input field with name $name
*
* @ param string $name id of select box
* @ param string $text text
*/
function getInputPresetButtonHtml ( $name , $text , $sep = '' ) { /* {{{ */
return '<span id="' . $name . '_btn" class="inputpreset_btn" style="cursor: pointer;" title="' . getMLText ( " takeOverAttributeValue " ) . '" data-ref="' . $name . '" data-text="' . ( is_array ( $text ) ? implode ( $sep , $text ) : htmlspecialchars ( $text )) . '"' . ( $sep ? " data-sep= \" " . $sep . " \" " : " " ) . '><i class="icon-arrow-left"></i></span>' ;
} /* }}} */
2016-10-20 16:27:43 +00:00
/**
* Output left - arrow with link which takes over a string into
* a input field .
*
* Clicking on the button will preset the string
* in data - ref the value of the input field with name $name
*
* @ param string $name id of select box
* @ param string $text text
*/
function printInputPresetButtonHtml ( $name , $text , $sep = '' ) { /* {{{ */
2018-06-26 04:51:04 +00:00
echo self :: getInputPresetButtonHtml ( $name , $text , $sep );
2016-10-20 16:27:43 +00:00
} /* }}} */
/**
* Javascript code for input preset button
* This code workѕ for input fields and single select fields
*/
function printInputPresetButtonJs () { /* {{{ */
?>
$ ( document ) . ready ( function () {
$ ( '.inputpreset_btn' ) . click ( function ( ev ){
ev . preventDefault ();
if ( typeof $ ( ev . currentTarget ) . data ( 'text' ) != 'undefined' ) {
target = $ ( ev . currentTarget ) . data ( 'ref' );
value = $ ( ev . currentTarget ) . data ( 'text' );
sep = $ ( ev . currentTarget ) . data ( 'sep' );
if ( sep ) {
// Use attr() instead of data() because data() converts to int which cannot be split
arr = value . split ( sep );
for ( var i in arr ) {
$ ( " # " + target + " option[value=' " + arr [ i ] + " '] " ) . attr ( " selected " , " selected " );
}
} else {
$ ( " # " + target ) . val ( value );
}
}
});
});
< ? php
} /* }}} */
/**
2018-06-26 04:51:04 +00:00
* Get HTML for left - arrow with link which takes over a boolean value
2016-10-20 16:27:43 +00:00
* into a checkbox field .
*
* Clicking on the button will preset the checkbox
* in data - ref the value of the input field with name $name
*
* @ param string $name id of select box
* @ param string $text text
*/
2018-06-26 04:51:04 +00:00
function getCheckboxPresetButtonHtml ( $name , $text ) { /* {{{ */
2016-10-20 16:27:43 +00:00
?>
2018-06-26 04:51:04 +00:00
return '<span id="' . $name . '_btn" class="checkboxpreset_btn" style="cursor: pointer;" title="' . getMLText ( " takeOverAttributeValue " ) . '" data-ref="' . $name . '" data-text="' . ( is_array ( $text ) ? implode ( $sep , $text ) : htmlspecialchars ( $text )) . '"' . ( $sep ? " data-sep= \" " . $sep . " \" " : " " ) . '><i class="icon-arrow-left"></i></span>' ;
2016-10-20 16:27:43 +00:00
< ? php
} /* }}} */
2018-06-26 04:51:04 +00:00
/**
* Output left - arrow with link which takes over a boolean value
* into a checkbox field .
*
* Clicking on the button will preset the checkbox
* in data - ref the value of the input field with name $name
*
* @ param string $name id of select box
* @ param string $text text
*/
function printCheckboxPresetButtonHtml ( $name , $text ) { /* {{{ */
self :: getCheckboxPresetButtonHtml ( $name , $text );
} /* }}} */
2016-10-20 16:27:43 +00:00
/**
* Javascript code for checkboxt preset button
* This code workѕ for checkboxes
*/
function printCheckboxPresetButtonJs () { /* {{{ */
?>
$ ( document ) . ready ( function () {
$ ( '.checkboxpreset_btn' ) . click ( function ( ev ){
ev . preventDefault ();
if ( typeof $ ( ev . currentTarget ) . data ( 'text' ) != 'undefined' ) {
target = $ ( ev . currentTarget ) . data ( 'ref' );
value = $ ( ev . currentTarget ) . data ( 'text' );
if ( value ) {
$ ( " # " + target ) . attr ( 'checked' , '' );
} else {
$ ( " # " + target ) . removeAttribute ( 'checked' );
}
}
});
});
< ? php
} /* }}} */
2018-02-22 18:12:36 +00:00
/**
* Print button with link for deleting an attribute value
*
* This button is used in document listings ( e . g . on the ViewFolder page )
* for deleting a document . In seeddms version < 4.3 . 9 this was just a
* link to the out / out . RemoveDocument . php page which asks for confirmation
* an than calls op / op . RemoveDocument . php . Starting with version 4.3 . 9
* the button just opens a small popup asking for confirmation and than
* calls the ajax command 'deletedocument' . The ajax call is called
* in the click function of 'button.removedocument' . That button needs
* to have two attributes : 'rel' for the id of the document , and 'msg'
* for the message shown by notify if the document could be deleted .
*
* @ param object $document document to be deleted
* @ param string $msg message shown in case of successful deletion
* @ param boolean $return return html instead of printing it
* @ return string html content if $return is true , otherwise an empty string
*/
function printDeleteAttributeValueButton ( $attrdef , $value , $msg , $return = false ){ /* {{{ */
$content = '' ;
$content .= '<a class="delete-attribute-value-btn" rel="' . $attrdef -> getID () . '" msg="' . getMLText ( $msg ) . '" attrvalue="' . htmlspecialchars ( $value , ENT_QUOTES ) . '" confirmmsg="' . htmlspecialchars ( getMLText ( " confirm_rm_attr_value " , array ( " attrdefname " => $attrdef -> getName ())), ENT_QUOTES ) . '"><i class="icon-remove"></i></a>' ;
if ( $return )
return $content ;
else
echo $content ;
return '' ;
} /* }}} */
function printDeleteAttributeValueButtonJs (){ /* {{{ */
echo "
$ ( document ) . ready ( function () {
// $('.delete-attribute-value-btn').click(function(ev) {
$ ( 'body' ) . on ( 'click' , 'a.delete-attribute-value-btn' , function ( ev ){
id = $ ( ev . currentTarget ) . attr ( 'rel' );
confirmmsg = $ ( ev . currentTarget ) . attr ( 'confirmmsg' );
attrvalue = $ ( ev . currentTarget ) . attr ( 'attrvalue' );
msg = $ ( ev . currentTarget ) . attr ( 'msg' );
formtoken = '".createFormKey(' removeattrvalue ')."' ;
bootbox . dialog ( confirmmsg , [{
\ " label \" : \" <i class='icon-remove'></i> " . getMLText ( " rm_attr_value " ) . " \" ,
\ " class \" : \" btn-danger \" ,
\ " callback \" : function() {
$ . post ( '../op/op.AttributeMgr.php' ,
{ action : 'removeattrvalue' , attrdefid : id , attrvalue : attrvalue , formtoken : formtoken },
function ( data ) {
if ( data . success ) {
$ ( '#table-row-attrvalue-' + id ) . hide ( 'slow' );
noty ({
text : msg ,
type : 'success' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 1500 ,
});
} else {
noty ({
text : data . message ,
type : 'error' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 3500 ,
});
}
},
'json'
);
}
}, {
\ " label \" : \" " . getMLText ( " cancel " ) . " \" ,
\ " class \" : \" btn-cancel \" ,
\ " callback \" : function() {
}
}]);
});
});
" ;
} /* }}} */
2019-11-25 08:50:52 +00:00
function printClickDocumentJs () { /* {{{ */
$onepage = $this -> params [ 'onepage' ];
if ( $onepage ) {
?>
/* catch click on a document row in the list folders and documents */
$ ( 'body' ) . on ( 'click' , '[id^=\"table-row-document\"] td:nth-child(2)' , function ( ev ) {
attr_id = $ ( ev . currentTarget ) . parent () . attr ( 'id' ) . split ( '-' )[ 3 ];
window . location = '../out/out.ViewDocument.php?documentid=' + attr_id ;
});
< ? php
}
} /* }}} */
2020-02-28 08:47:58 +00:00
/**
* Print js code which catches clicks on folder rows
*
* This method will catch a click on a folder row and changes the
* window . location to the out . ViewFolder . php page
* This code is not needed on the out . ViewFolder . php page itself , because
* a click will just reload the list of folders and documents .
*/
function printClickFolderJs () { /* {{{ */
$onepage = $this -> params [ 'onepage' ];
if ( $onepage ) {
?>
/* catch click on a document row in the list folders and documents */
$ ( 'body' ) . on ( 'click' , '[id^=\"table-row-folder\"] td:nth-child(2)' , function ( ev ) {
2020-04-10 05:52:35 +00:00
attr_id = $ ( ev . currentTarget ) . parent () . data ( 'target-id' );
if ( typeof attr_id == 'undefined' )
attr_id = $ ( ev . currentTarget ) . parent () . attr ( 'id' ) . split ( '-' )[ 3 ];
2020-02-28 08:47:58 +00:00
window . location = '../out/out.ViewFolder.php?folderid=' + attr_id ;
});
< ? php
}
} /* }}} */
2019-07-12 14:43:34 +00:00
/**
* Start the row for a folder in list of documents and folders
*
* For a detailed description see
* { @ link SeedDMS_Bootstrap_Style :: folderListRowStart ()}
*/
function documentListRowStart ( $document , $class = '' ) { /* {{{ */
2019-07-11 15:18:03 +00:00
$docID = $document -> getID ();
2020-04-10 05:52:35 +00:00
return " <tr id= \" table-row-document- " . $docID . " \" data-target-id= \" " . $docID . " \" class= \" table-row-document droptarget " . ( $class ? ' ' . $class : '' ) . " \" data-droptarget= \" document_ " . $docID . " \" rel= \" document_ " . $docID . " \" formtoken= \" " . createFormKey ( '' ) . " \" draggable= \" true \" data-name= \" " . htmlspecialchars ( $document -> getName (), ENT_QUOTES ) . " \" > " ;
2019-07-11 15:18:03 +00:00
} /* }}} */
function documentListRowEnd ( $document ) { /* {{{ */
return " </tr> \n " ;
} /* }}} */
2014-06-06 12:00:28 +00:00
/**
* Return HTML of a single row in the document list table
*
* @ param object $document
* @ param object $previewer
* @ param boolean $skipcont set to true if embrasing tr shall be skipped
*/
2019-04-11 04:19:56 +00:00
function documentListRow ( $document , $previewer , $skipcont = false , $version = 0 , $extracontent = array ()) { /* {{{ */
2014-06-06 12:00:28 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
2016-10-05 08:22:35 +00:00
$showtree = $this -> params [ 'showtree' ];
2014-06-06 12:00:28 +00:00
$workflowmode = $this -> params [ 'workflowmode' ];
$previewwidth = $this -> params [ 'previewWidthList' ];
2015-03-13 08:31:48 +00:00
$enableClipboard = $this -> params [ 'enableclipboard' ];
2019-10-16 07:50:54 +00:00
$onepage = $this -> params [ 'onepage' ];
2014-06-06 12:00:28 +00:00
$content = '' ;
$owner = $document -> getOwner ();
$comment = $document -> getComment ();
if ( strlen ( $comment ) > 150 ) $comment = substr ( $comment , 0 , 147 ) . " ... " ;
$docID = $document -> getID ();
if ( ! $skipcont )
2019-07-11 15:18:03 +00:00
$content .= $this -> documentListRowStart ( $document );
2014-06-06 12:00:28 +00:00
2019-02-06 12:11:49 +00:00
if ( $version ) {
$latestContent = $this -> callHook ( 'documentContent' , $document , $version );
if ( $latestContent === null )
$latestContent = $document -> getContentByVersion ( $version );
} else {
$latestContent = $this -> callHook ( 'documentLatestContent' , $document );
if ( $latestContent === null )
$latestContent = $document -> getLatestContent ();
}
2015-07-15 05:24:32 +00:00
if ( $latestContent ) {
2014-06-06 12:00:28 +00:00
$previewer -> createPreview ( $latestContent );
$version = $latestContent -> getVersion ();
$status = $latestContent -> getStatus ();
$needwkflaction = false ;
if ( $workflowmode == 'advanced' ) {
$workflow = $latestContent -> getWorkflow ();
if ( $workflow ) {
$needwkflaction = $latestContent -> needsWorkflowAction ( $user );
}
}
/* Retrieve attacheѕ files */
2016-11-24 10:42:53 +00:00
$files = $document -> getDocumentFiles ( $latestContent -> getVersion ());
$files = SeedDMS_Core_DMS :: filterDocumentFiles ( $user , $files );
2014-06-06 12:00:28 +00:00
/* Retrieve linked documents */
$links = $document -> getDocumentLinks ();
$links = SeedDMS_Core_DMS :: filterDocumentLinks ( $user , $links );
2017-12-05 09:12:37 +00:00
/* Retrieve reverse linked documents */
$revlinks = $document -> getReverseDocumentLinks ();
$revlinks = SeedDMS_Core_DMS :: filterDocumentLinks ( $user , $revlinks );
2015-07-15 05:24:32 +00:00
$content .= " <td> " ;
2014-06-06 12:00:28 +00:00
if ( file_exists ( $dms -> contentDir . $latestContent -> getPath ())) {
2016-03-08 05:59:18 +00:00
$content .= " <a draggable= \" false \" href= \" ../op/op.Download.php?documentid= " . $docID . " &version= " . $version . " \" > " ;
2014-06-06 12:00:28 +00:00
if ( $previewer -> hasPreview ( $latestContent )) {
2017-03-15 15:41:32 +00:00
$content .= " <img draggable= \" false \" class= \" mimeicon \" width= \" " . $previewwidth . " \" src= \" ../op/op.Preview.php?documentid= " . $document -> getID () . " &version= " . $latestContent -> getVersion () . " &width= " . $previewwidth . " \" title= \" " . htmlspecialchars ( $latestContent -> getMimeType ()) . " \" > " ;
2014-06-06 12:00:28 +00:00
} else {
2017-03-15 15:41:32 +00:00
$content .= " <img draggable= \" false \" class= \" mimeicon \" width= \" " . $previewwidth . " \" src= \" " . $this -> getMimeIcon ( $latestContent -> getFileType ()) . " \" " . ( $previewwidth ? " width= \" " . $previewwidth . " \" " : " " ) . " \" title= \" " . htmlspecialchars ( $latestContent -> getMimeType ()) . " \" > " ;
2014-06-06 12:00:28 +00:00
}
2015-07-15 05:24:32 +00:00
$content .= " </a> " ;
2014-06-06 12:00:28 +00:00
} else
2017-03-15 15:45:02 +00:00
$content .= " <img draggable= \" false \" class= \" mimeicon \" width= \" " . $previewwidth . " \" src= \" " . $this -> getMimeIcon ( $latestContent -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $latestContent -> getMimeType ()) . " \" > " ;
2015-07-15 05:24:32 +00:00
$content .= " </td> " ;
2020-03-04 21:25:10 +00:00
$content .= " <td " . ( $onepage ? ' style="cursor: pointer;"' : '' ) . " > " ;
2019-10-16 07:50:54 +00:00
if ( $onepage )
2020-03-04 21:25:10 +00:00
$content .= " <b " . ( $onepage ? ' title="Id:' . $document -> getId () . '"' : '' ) . " > " . htmlspecialchars ( $document -> getName ()) . " </b> " ;
2019-10-16 07:50:54 +00:00
else
$content .= " <a draggable= \" false \" href= \" ../out/out.ViewDocument.php?documentid= " . $docID . " &showtree= " . $showtree . " \" > " . htmlspecialchars ( $document -> getName ()) . " </a> " ;
2019-04-11 04:19:56 +00:00
if ( isset ( $extracontent [ 'below_title' ]))
$content .= $extracontent [ 'below_title' ];
2016-07-27 19:08:15 +00:00
$content .= " <br /><span style= \" font-size: 85%; font-style: italic; color: #666; \" > " . getMLText ( 'owner' ) . " : <b> " . htmlspecialchars ( $owner -> getFullName ()) . " </b>, " . getMLText ( 'creation_date' ) . " : <b> " . date ( 'Y-m-d' , $document -> getDate ()) . " </b>, " . getMLText ( 'version' ) . " <b> " . $version . " </b> - <b> " . date ( 'Y-m-d' , $latestContent -> getDate ()) . " </b> " . ( $document -> expires () ? " , " . getMLText ( 'expires' ) . " : <b> " . getReadableDate ( $document -> getExpires ()) . " </b> " : " " ) . " </span> " ;
2014-06-06 12:00:28 +00:00
if ( $comment ) {
$content .= " <br /><span style= \" font-size: 85%; \" > " . htmlspecialchars ( $comment ) . " </span> " ;
}
2019-04-11 04:19:56 +00:00
if ( ! empty ( $extracontent [ 'bottom_title' ]))
$content .= $extracontent [ 'bottom_title' ];
2014-06-06 12:00:28 +00:00
$content .= " </td> \n " ;
2015-07-15 05:24:32 +00:00
2014-06-06 12:00:28 +00:00
$content .= " <td nowrap> " ;
$attentionstr = '' ;
if ( $document -> isLocked () ) {
$attentionstr .= " <img src= \" " . $this -> getImgPath ( " lock.png " ) . " \" title= \" " . getMLText ( " locked_by " ) . " : " . htmlspecialchars ( $document -> getLockingUser () -> getFullName ()) . " \" > " ;
}
if ( $needwkflaction ) {
2016-08-30 09:45:07 +00:00
$attentionstr .= " <img src= \" " . $this -> getImgPath ( " attention.gif " ) . " \" title= \" " . getMLText ( " workflow " ) . " : " . htmlspecialchars ( $workflow -> getName ()) . " \" > " ;
2014-06-06 12:00:28 +00:00
}
if ( $attentionstr )
$content .= $attentionstr . " <br /> " ;
$content .= " <small> " ;
if ( count ( $files ))
$content .= count ( $files ) . " " . getMLText ( " linked_files " ) . " <br /> " ;
2017-12-05 09:12:37 +00:00
if ( count ( $links ) || count ( $revlinks ))
$content .= count ( $links ) . " / " . count ( $revlinks ) . " " . getMLText ( " linked_documents " ) . " <br /> " ;
2016-12-07 14:30:59 +00:00
if ( $status [ " status " ] == S_IN_WORKFLOW && $workflowmode == 'advanced' ) {
$workflowstate = $latestContent -> getWorkflowState ();
2020-03-26 06:54:27 +00:00
$content .= '<span title="' . getOverallStatusText ( $status [ " status " ]) . ': ' . htmlspecialchars ( $workflow -> getName ()) . '">' . htmlspecialchars ( $workflowstate -> getName ()) . '</span>' ;
2016-12-07 14:30:59 +00:00
} else {
$content .= getOverallStatusText ( $status [ " status " ]);
}
$content .= " </small></td> " ;
2014-06-06 12:00:28 +00:00
// $content .= "<td>".$version."</td>";
$content .= " <td> " ;
$content .= " <div class= \" list-action \" > " ;
if ( $document -> getAccessMode ( $user ) >= M_ALL ) {
$content .= $this -> printDeleteDocumentButton ( $document , 'splash_rm_document' , true );
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>' ;
}
if ( $document -> getAccessMode ( $user ) >= M_READWRITE ) {
2014-06-11 09:02:25 +00:00
$content .= '<a href="../out/out.EditDocument.php?documentid=' . $docID . '" title="' . getMLText ( " edit_document_props " ) . '"><i class="icon-edit"></i></a>' ;
2014-06-06 12:00:28 +00:00
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span>' ;
}
if ( $document -> getAccessMode ( $user ) >= M_READWRITE ) {
$content .= $this -> printLockButton ( $document , 'splash_document_locked' , 'splash_document_unlocked' , true );
}
2015-02-24 16:47:58 +00:00
if ( $enableClipboard ) {
$content .= '<a class="addtoclipboard" rel="D' . $docID . '" msg="' . getMLText ( 'splash_added_to_clipboard' ) . '" title="' . getMLText ( " add_to_clipboard " ) . '"><i class="icon-copy"></i></a>' ;
}
2014-06-06 12:00:28 +00:00
$content .= " </div> " ;
$content .= " </td> " ;
}
if ( ! $skipcont )
2019-07-11 15:18:03 +00:00
$content .= $this -> documentListRowEnd ( $document );
2014-06-06 12:00:28 +00:00
return $content ;
} /* }}} */
2019-07-12 14:43:34 +00:00
/**
* Start the row for a folder in list of documents and folders
*
* This method creates the starting tr tag for a new table row containing
* a folder list entry . The tr tag contains various attributes which are
* used for removing the table line and to make drap & drop work .
*
* id = table - row - folder -< id > : used for identifying the row when removing the table
* row after deletion of the folder by clicking on the delete button in that table
* row .
* data - droptarget = folder_ < id > : identifies the folder represented by this row
* when it used as a target of the drag & drop operation .
* If an element ( either a file or a dragged item ) is dropped on this row , the
* data - droptarget will be evaluated to identify the underlying dms object .
* Dropping a file on a folder will upload that file into the folder . Droping
* an item ( which is currently either a document or a folder ) from the page will
* move that item into the folder .
* rel = folder_ < id > : This data is put into drag data when a drag starts . When the
* item is dropped on some other item this data will identify the source object .
* The attributes data - droptarget and rel are usually equal . At least there is
* currently no scenario where they are different .
* formtoken =< token > : token made of key 'movefolder'
* formtoken is also placed in the drag data just like the value of attibute 'rel' .
* This is always set to a value made of 'movefolder' .
* data - uploadformtoken =< token > : token made of key 'adddocument'
* class = table - row - folder : The class must have a class named 'table-row-folder' in
* order to be draggable and to extract the drag data from the attributes 'rel' and
* 'formtoken'
*
* @ param object $folder
* @ return string starting tr tag for a table
*/
function folderListRowStart ( $folder , $class = '' ) { /* {{{ */
2019-11-07 18:54:42 +00:00
return " <tr id= \" table-row-folder- " . $folder -> getID () . " \" draggable= \" true \" data-droptarget= \" folder_ " . $folder -> getID () . " \" rel= \" folder_ " . $folder -> getID () . " \" class= \" folder table-row-folder droptarget " . ( $class ? ' ' . $class : '' ) . " \" data-uploadformtoken= \" " . createFormKey ( '' ) . " \" formtoken= \" " . createFormKey ( '' ) . " \" data-name= \" " . htmlspecialchars ( $folder -> getName (), ENT_QUOTES ) . " \" > " ;
2019-07-11 15:18:03 +00:00
} /* }}} */
function folderListRowEnd ( $folder ) { /* {{{ */
return " </tr> \n " ;
} /* }}} */
2020-03-05 08:11:45 +00:00
function folderListRow ( $subFolder , $skipcont = false , $extracontent = array ()) { /* {{{ */
2014-06-06 12:00:28 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
2016-02-04 18:03:48 +00:00
// $folder = $this->params['folder'];
2014-06-06 12:00:28 +00:00
$showtree = $this -> params [ 'showtree' ];
$enableRecursiveCount = $this -> params [ 'enableRecursiveCount' ];
$maxRecursiveCount = $this -> params [ 'maxRecursiveCount' ];
2015-03-13 08:31:48 +00:00
$enableClipboard = $this -> params [ 'enableclipboard' ];
2019-10-16 07:50:54 +00:00
$onepage = $this -> params [ 'onepage' ];
2014-06-06 12:00:28 +00:00
$owner = $subFolder -> getOwner ();
$comment = $subFolder -> getComment ();
if ( strlen ( $comment ) > 150 ) $comment = substr ( $comment , 0 , 147 ) . " ... " ;
$content = '' ;
2020-03-05 08:11:45 +00:00
if ( ! $skipcont )
$content .= $this -> folderListRowStart ( $subFolder );
2019-07-11 15:18:03 +00:00
$content .= " <td><a draggable= \" false \" href= \" ../out/out.ViewFolder.php?folderid= " . $subFolder -> getID () . " &showtree= " . $showtree . " \" ><img draggable= \" false \" src= \" " . $this -> getMimeIcon ( " .folder " ) . " \" width= \" 24 \" height= \" 24 \" border=0></a></td> \n " ;
2019-10-16 07:50:54 +00:00
if ( $onepage )
2020-03-04 21:30:42 +00:00
$content .= " <td style= \" cursor: pointer; \" > " . " <b title= \" Id: " . $subFolder -> getId () . " \" > " . htmlspecialchars ( $subFolder -> getName ()) . " </b> " ;
2019-10-16 07:50:54 +00:00
else
$content .= " <td><a draggable= \" false \" href= \" ../out/out.ViewFolder.php?folderid= " . $subFolder -> getID () . " &showtree= " . $showtree . " \" > " . htmlspecialchars ( $subFolder -> getName ()) . " </a> " ;
2014-06-06 12:00:28 +00:00
$content .= " <br /><span style= \" font-size: 85%; font-style: italic; color: #666; \" > " . getMLText ( 'owner' ) . " : <b> " . htmlspecialchars ( $owner -> getFullName ()) . " </b>, " . getMLText ( 'creation_date' ) . " : <b> " . date ( 'Y-m-d' , $subFolder -> getDate ()) . " </b></span> " ;
if ( $comment ) {
$content .= " <br /><span style= \" font-size: 85%; \" > " . htmlspecialchars ( $comment ) . " </span> " ;
}
2019-04-11 04:19:56 +00:00
if ( isset ( $extracontent [ 'bottom_title' ]))
$content .= $extracontent [ 'bottom_title' ];
2014-06-06 12:00:28 +00:00
$content .= " </td> \n " ;
// $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>";
$content .= " <td colspan= \" 1 \" nowrap><small> " ;
if ( $enableRecursiveCount ) {
if ( $user -> isAdmin ()) {
/* No need to check for access rights in countChildren () for
* admin . So pass 0 as the limit .
*/
$cc = $subFolder -> countChildren ( $user , 0 );
$content .= $cc [ 'folder_count' ] . " " . getMLText ( " folders " ) . " <br /> " . $cc [ 'document_count' ] . " " . getMLText ( " documents " );
} else {
$cc = $subFolder -> countChildren ( $user , $maxRecursiveCount );
if ( $maxRecursiveCount > 5000 )
$rr = 100.0 ;
else
$rr = 10.0 ;
$content .= ( ! $cc [ 'folder_precise' ] ? '~' . ( round ( $cc [ 'folder_count' ] / $rr ) * $rr ) : $cc [ 'folder_count' ]) . " " . getMLText ( " folders " ) . " <br /> " . ( ! $cc [ 'document_precise' ] ? '~' . ( round ( $cc [ 'document_count' ] / $rr ) * $rr ) : $cc [ 'document_count' ]) . " " . getMLText ( " documents " );
}
} else {
2016-08-03 10:32:12 +00:00
/* FIXME : the following is very inefficient for just getting the number of
* subfolders and documents . Making it more efficient is difficult , because
* the access rights need to be checked .
*/
$subsub = $subFolder -> getSubFolders ();
$subsub = SeedDMS_Core_DMS :: filterAccess ( $subsub , $user , M_READ );
$subdoc = $subFolder -> getDocuments ();
$subdoc = SeedDMS_Core_DMS :: filterAccess ( $subdoc , $user , M_READ );
2014-06-06 12:00:28 +00:00
$content .= count ( $subsub ) . " " . getMLText ( " folders " ) . " <br /> " . count ( $subdoc ) . " " . getMLText ( " documents " );
}
$content .= " </small></td> " ;
// $content .= "<td></td>";
$content .= " <td> " ;
$content .= " <div class= \" list-action \" > " ;
2019-12-13 09:27:02 +00:00
$subFolderAccessMode = $subFolder -> getAccessMode ( $user );
if ( $subFolderAccessMode >= M_ALL ) {
2014-06-06 12:00:28 +00:00
$content .= $this -> printDeleteFolderButton ( $subFolder , 'splash_rm_folder' , true );
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>' ;
}
2019-12-13 09:27:02 +00:00
if ( $subFolderAccessMode >= M_READWRITE ) {
2014-06-11 09:02:25 +00:00
$content .= '<a class_="btn btn-mini" href="../out/out.EditFolder.php?folderid=' . $subFolder -> getID () . '" title="' . getMLText ( " edit_folder_props " ) . '"><i class="icon-edit"></i></a>' ;
2014-06-06 12:00:28 +00:00
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span>' ;
}
2015-02-24 16:47:58 +00:00
if ( $enableClipboard ) {
$content .= '<a class="addtoclipboard" rel="F' . $subFolder -> getID () . '" msg="' . getMLText ( 'splash_added_to_clipboard' ) . '" title="' . getMLText ( " add_to_clipboard " ) . '"><i class="icon-copy"></i></a>' ;
}
2014-06-06 12:00:28 +00:00
$content .= " </div> " ;
$content .= " </td> " ;
2020-03-05 08:11:45 +00:00
if ( ! $skipcont )
$content .= $this -> folderListRowEnd ( $subFolder );
2014-06-06 12:00:28 +00:00
return $content ;
2014-06-04 17:20:07 +00:00
} /* }}} */
2013-05-02 10:14:10 +00:00
function show (){ /* {{{ */
parent :: show ();
} /* }}} */
2015-06-23 07:49:34 +00:00
2018-04-06 14:34:01 +00:00
function error (){ /* {{{ */
parent :: error ();
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$pagetitle = $this -> params [ 'pagetitle' ];
$errormsg = $this -> params [ 'errormsg' ];
$plain = $this -> params [ 'plain' ];
$noexit = $this -> params [ 'noexit' ];
if ( ! $plain ) {
$this -> htmlStartPage ( $pagetitle );
$this -> globalNavigation ();
$this -> contentStart ();
}
print " <div class= \" alert alert-error \" > " ;
print " <h4> " . getMLText ( 'error' ) . " !</h4> " ;
print htmlspecialchars ( $errormsg );
print " </div> " ;
print " <div><button class= \" btn history-back \" > " . getMLText ( 'back' ) . " </button></div> " ;
$this -> contentEnd ();
$this -> htmlEndPage ();
add_log_line ( " UI::exitError error= " . $errormsg . " pagetitle= " . $pagetitle , PEAR_LOG_ERR );
if ( $noexit )
return ;
exit ;
} /* }}} */
2017-03-15 15:13:09 +00:00
/**
* Return HTML Template for jumploader
*
* @ param string $uploadurl URL where post data is send
* @ param integer $folderid id of folder where document is saved
* @ param integer $maxfiles maximum number of files allowed to upload
* @ param array $fields list of post fields
*/
function getFineUploaderTemplate () { /* {{{ */
return '
< script type = " text/template " id = " qq-template " >
< div class = " qq-uploader-selector qq-uploader " qq - drop - area - text = " '.getMLText('drop_files_here').' " >
< div class = " qq-total-progress-bar-container-selector qq-total-progress-bar-container " >
< div role = " progressbar " aria - valuenow = " 0 " aria - valuemin = " 0 " aria - valuemax = " 100 " class = " qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar " ></ div >
</ div >
< div class = " input-append " >
< div class = " qq-upload-drop-area-selector qq-upload-drop-area " _qq - hide - dropzone >
< span class = " qq-upload-drop-area-text-selector " ></ span >
</ div >
2017-08-29 04:13:16 +00:00
< span class = " btn qq-upload-button-selector qq-upload-button " > '.getMLText(' browse ').' & hellip ; </ span >
2017-03-15 15:13:09 +00:00
</ div >
< span class = " qq-drop-processing-selector qq-drop-processing " >
< span class = " qq-drop-processing-spinner-selector qq-drop-processing-spinner " ></ span >
</ span >
< ul class = " qq-upload-list-selector qq-upload-list unstyled " aria - live = " polite " aria - relevant = " additions removals " >
< li >
< div class = " progress qq-progress-bar-container-selector " >
< div class = " bar qq-progress-bar-selector qq-progress-bar " role = " progressbar " aria - valuenow = " 0 " aria - valuemin = " 0 " aria - valuemax = " 100 " ></ div >
</ div >
< span class = " qq-upload-spinner-selector qq-upload-spinner " ></ span >
< img class = " qq-thumbnail-selector " qq - max - size = " 100 " qq - server - scale >
< span class = " qq-upload-file-selector qq-upload-file " ></ span >
< span class = " qq-upload-size-selector qq-upload-size " ></ span >
< button class = " btn btn-mini qq-btn qq-upload-cancel-selector qq-upload-cancel " > Cancel </ button >
< span role = " status " class = " qq-upload-status-text-selector qq-upload-status-text " ></ span >
</ li >
</ ul >
< dialog class = " qq-alert-dialog-selector " >
< div class = " qq-dialog-message-selector " ></ div >
< div class = " qq-dialog-buttons " >
< button class = " btn qq-cancel-button-selector " > Cancel </ button >
</ div >
</ dialog >
< dialog class = " qq-confirm-dialog-selector " >
< div class = " qq-dialog-message-selector " ></ div >
< div class = " qq-dialog-buttons " >
< button class = " btn qq-cancel-button-selector " > Cancel </ button >
< button class = " btn qq-ok-button-selector " > Ok </ button >
</ div >
</ dialog >
< dialog class = " qq-prompt-dialog-selector " >
< div class = " qq-dialog-message-selector " ></ div >
< input type = " text " >
< div class = " qq-dialog-buttons " >
< button class = " btn qq-cancel-button-selector " > Cancel </ button >
< button class = " btn qq-ok-button-selector " > Ok </ button >
</ div >
</ dialog >
</ div >
</ script >
' ;
} /* }}} */
2017-01-30 12:17:58 +00:00
/**
2018-04-23 13:50:46 +00:00
* Output HTML Code for Fine Uploader
2017-01-30 12:17:58 +00:00
*
* @ param string $uploadurl URL where post data is send
* @ param integer $folderid id of folder where document is saved
* @ param integer $maxfiles maximum number of files allowed to upload
* @ param array $fields list of post fields
*/
2017-04-27 04:52:50 +00:00
function printFineUploaderHtml ( $prefix = 'userfile' ) { /* {{{ */
2018-04-23 13:50:46 +00:00
echo self :: getFineUploaderHtml ( $prefix );
} /* }}} */
/**
* Get HTML Code for Fine Uploader
*
* @ param string $uploadurl URL where post data is send
* @ param integer $folderid id of folder where document is saved
* @ param integer $maxfiles maximum number of files allowed to upload
* @ param array $fields list of post fields
*/
function getFineUploaderHtml ( $prefix = 'userfile' ) { /* {{{ */
$html = '<div id="' . $prefix . ' - fine - uploader " ></div>
< input type = " hidden " '.($prefix==' userfile ' ? ' class = " do_validate " ' : ' ').' id = " '. $prefix .'-fine-uploader-uuids " name = " '. $prefix .'-fine-uploader-uuids " value = " " />
< input type = " hidden " id = " '. $prefix .'-fine-uploader-names " name = " '. $prefix .'-fine-uploader-names " value = " " /> ' ;
return $html ;
2017-01-30 12:17:58 +00:00
} /* }}} */
/**
* Output Javascript Code for fine uploader
*
* @ param string $uploadurl URL where post data is send
* @ param integer $folderid id of folder where document is saved
* @ param integer $maxfiles maximum number of files allowed to upload
* @ param array $fields list of post fields
*/
2020-05-07 04:49:38 +00:00
function printFineUploaderJs ( $uploadurl , $partsize = 0 , $maxuploadsize = 0 , $multiple = true , $prefix = 'userfile' , $formname = 'form1' ) { /* {{{ */
2017-01-30 12:17:58 +00:00
?>
$ ( document ) . ready ( function () {
2017-04-27 04:52:50 +00:00
< ? php echo $prefix ; ?> uploader = new qq.FineUploader({
2017-03-15 15:13:09 +00:00
debug : false ,
2017-01-30 12:17:58 +00:00
autoUpload : false ,
2017-01-31 16:22:57 +00:00
multiple : < ? php echo ( $multiple ? 'true' : 'false' ); ?> ,
2017-04-27 04:52:50 +00:00
element : $ ( '#<?php echo $prefix; ?>-fine-uploader' )[ 0 ],
2017-03-15 15:13:09 +00:00
template : 'qq-template' ,
2017-01-30 12:17:58 +00:00
request : {
endpoint : '<?php echo $uploadurl; ?>'
},
2017-03-15 15:13:09 +00:00
< ? php echo ( $maxuploadsize > 0 ? '
validation : {
sizeLimit : '.$maxuploadsize.'
},
' : ' ' ); ?>
2017-01-30 12:17:58 +00:00
chunking : {
enabled : true ,
< ? php echo $partsize ? 'partSize: ' . ( int ) $partsize . " , \n " : '' ; ?>
mandatory : true
},
2017-03-15 15:13:09 +00:00
messages : {
sizeError : '{file} is too large, maximum file size is {sizeLimit}.'
},
2017-01-30 12:17:58 +00:00
callbacks : {
onComplete : function ( id , name , json , xhr ) {
},
onAllComplete : function ( succeeded , failed ) {
var uuids = Array ();
var names = Array ();
for ( var i = 0 ; i < succeeded . length ; i ++ ) {
uuids . push ( this . getUuid ( succeeded [ i ]))
names . push ( this . getName ( succeeded [ i ]))
}
2017-04-27 04:52:50 +00:00
$ ( '#<?php echo $prefix; ?>-fine-uploader-uuids' ) . val ( uuids . join ( ';' ));
$ ( '#<?php echo $prefix; ?>-fine-uploader-names' ) . val ( names . join ( ';' ));
2017-01-30 12:17:58 +00:00
/* Run upload only if all files could be uploaded */
if ( succeeded . length > 0 && failed . length == 0 )
2020-05-07 04:49:38 +00:00
document . getElementById ( '<?= $formname ?>' ) . submit ();
2017-01-30 12:17:58 +00:00
},
onError : function ( id , name , reason , xhr ) {
noty ({
text : reason ,
type : 'error' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 3500 ,
});
}
}
});
});
< ? php
} /* }}} */
2015-06-23 07:49:34 +00:00
/**
* Output a protocol
*
* @ param object $attribute attribute
*/
protected function printProtocol ( $latestContent , $type = " " ) { /* {{{ */
$dms = $this -> params [ 'dms' ];
2015-08-07 12:29:32 +00:00
$document = $latestContent -> getDocument ();
2015-06-23 07:49:34 +00:00
?>
< legend >< ? php printMLText ( $type . '_log' ); ?> </legend>
< table class = " table condensed " >
< tr >< th >< ? php printMLText ( 'name' ); ?> </th><th><?php printMLText('last_update'); ?>, <?php printMLText('comment'); ?></th><th><?php printMLText('status'); ?></th></tr>
< ? php
switch ( $type ) {
case " review " :
$statusList = $latestContent -> getReviewStatus ( 10 );
break ;
case " approval " :
$statusList = $latestContent -> getApprovalStatus ( 10 );
break ;
default :
$statusList = array ();
}
foreach ( $statusList as $rec ) {
echo " <tr> " ;
echo " <td> " ;
switch ( $rec [ " type " ]) {
case 0 : // individual.
$required = $dms -> getUser ( $rec [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_user " ) . " ' " . $rec [ " required " ] . " ' " ;
} else {
$reqName = htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
}
break ;
case 1 : // Approver is a group.
$required = $dms -> getGroup ( $rec [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_group " ) . " ' " . $rec [ " required " ] . " ' " ;
}
else {
$reqName = " <i> " . htmlspecialchars ( $required -> getName ()) . " </i> " ;
}
break ;
}
echo $reqName ;
echo " </td> " ;
echo " <td> " ;
echo " <i style= \" font-size: 80%; \" > " . $rec [ 'date' ] . " - " ;
$updateuser = $dms -> getUser ( $rec [ " userID " ]);
2019-02-04 13:43:57 +00:00
if ( ! is_object ( $updateuser ))
2015-06-23 07:49:34 +00:00
echo getMLText ( " unknown_user " );
else
echo htmlspecialchars ( $updateuser -> getFullName () . " ( " . $updateuser -> getLogin () . " ) " );
echo " </i> " ;
if ( $rec [ 'comment' ])
echo " <br /> " . htmlspecialchars ( $rec [ 'comment' ]);
switch ( $type ) {
case " review " :
if ( $rec [ 'file' ]) {
echo " <br /> " ;
2015-08-07 12:29:32 +00:00
echo " <a href= \" ../op/op.Download.php?documentid= " . $document -> getID () . " &reviewlogid= " . $rec [ 'reviewLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" icon-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
2015-06-23 07:49:34 +00:00
}
break ;
case " approval " :
if ( $rec [ 'file' ]) {
echo " <br /> " ;
2015-08-07 12:29:32 +00:00
echo " <a href= \" ../op/op.Download.php?documentid= " . $document -> getID () . " &approvelogid= " . $rec [ 'approveLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" icon-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
2015-06-23 07:49:34 +00:00
}
break ;
}
echo " </td> " ;
echo " <td> " ;
switch ( $type ) {
case " review " :
echo getReviewStatusText ( $rec [ " status " ]);
break ;
case " approval " :
echo getApprovalStatusText ( $rec [ " status " ]);
break ;
default :
}
echo " </td> " ;
echo " </tr> " ;
}
?>
</ table >
< ? php
} /* }}} */
2015-08-20 13:52:46 +00:00
/**
* Show progressbar
*
* @ param double $value value
* @ param double $max 100 % value
*/
protected function getProgressBar ( $value , $max = 100.0 ) { /* {{{ */
if ( $max > $value ) {
$used = ( int ) ( $value / $max * 100.0 + 0.5 );
$free = 100 - $used ;
} else {
$free = 0 ;
$used = 100 ;
}
2015-08-20 14:22:05 +00:00
$html = '
2015-08-20 13:52:46 +00:00
< div class = " progress " >
< div class = " bar bar-danger " style = " width: '. $used .'%; " ></ div >
< div class = " bar bar-success " style = " width: '. $free .'%; " ></ div >
</ div > ' ;
return $html ;
} /* }}} */
2015-09-16 19:19:46 +00:00
/**
* Output a timeline for a document
*
* @ param object $document document
*/
2015-12-11 19:29:52 +00:00
protected function printTimelineJs ( $timelineurl , $height = 300 , $start = '' , $end = '' , $skip = array ()) { /* {{{ */
2015-10-19 11:15:52 +00:00
if ( ! $timelineurl )
2015-09-22 08:32:33 +00:00
return ;
2015-09-16 19:19:46 +00:00
?>
var timeline ;
var data ;
// specify options
var options = {
'width' : '100%' ,
2015-09-22 08:16:26 +00:00
'height' : '100%' ,
< ? php
if ( $start ) {
$tmp = explode ( '-' , $start );
2015-09-22 08:55:52 +00:00
echo " \t \t \t 'min': new Date( " . $tmp [ 0 ] . " , " . ( $tmp [ 1 ] - 1 ) . " , " . $tmp [ 2 ] . " ), \n " ;
2015-09-22 08:16:26 +00:00
}
if ( $end ) {
$tmp = explode ( '-' , $end );
2015-09-22 08:55:52 +00:00
echo " ' \t \t \t max': new Date( " . $tmp [ 0 ] . " , " . ( $tmp [ 1 ] - 1 ) . " , " . $tmp [ 2 ] . " ), \n " ;
2015-09-22 08:16:26 +00:00
}
?>
2015-10-19 11:15:52 +00:00
'editable' : false ,
'selectable' : true ,
2015-09-16 19:19:46 +00:00
'style' : 'box' ,
2016-03-30 12:16:23 +00:00
'locale' : '<?php echo $this->params[' session ']->getLanguage() ?>'
2015-09-16 19:19:46 +00:00
};
2015-10-19 11:15:52 +00:00
function onselect () {
var sel = timeline . getSelection ();
if ( sel . length ) {
if ( sel [ 0 ] . row != undefined ) {
var row = sel [ 0 ] . row ;
console . log ( timeline . getItem ( sel [ 0 ] . row ));
item = timeline . getItem ( sel [ 0 ] . row );
$ ( 'div.ajax' ) . trigger ( 'update' , { documentid : item . docid , version : item . version , statusid : item . statusid , statuslogid : item . statuslogid , fileid : item . fileid });
}
}
}
2015-09-16 19:19:46 +00:00
$ ( document ) . ready ( function () {
// Instantiate our timeline object.
timeline = new links . Timeline ( document . getElementById ( 'timeline' ), options );
2015-10-19 11:15:52 +00:00
links . events . addListener ( timeline , 'select' , onselect );
$ . getJSON (
2016-03-30 12:16:23 +00:00
'<?php echo $timelineurl ?>' ,
2015-10-19 11:15:52 +00:00
function ( data ) {
$ . each ( data , function ( key , val ) {
val . start = new Date ( val . start );
});
timeline . draw ( data );
}
);
2015-09-16 19:19:46 +00:00
});
2015-12-11 19:29:52 +00:00
< ? php
} /* }}} */
2015-09-16 19:19:46 +00:00
2015-12-11 19:29:52 +00:00
protected function printTimelineHtml ( $height ) { /* {{{ */
?>
2016-03-30 12:16:23 +00:00
< div id = " timeline " style = " height: <?php echo $height ?>px; " ></ div >
2015-09-16 19:19:46 +00:00
< ? php
} /* }}} */
2015-12-11 19:29:52 +00:00
protected function printTimeline ( $timelineurl , $height = 300 , $start = '' , $end = '' , $skip = array ()) { /* {{{ */
echo " <script type= \" text/javascript \" > \n " ;
$this -> printTimelineJs ( $timelineurl , $height , $start , $end , $skip );
echo " </script> " ;
$this -> printTimelineHtml ( $height );
} /* }}} */
2017-01-12 16:25:38 +00:00
2020-03-05 21:26:53 +00:00
public function printPopupBox ( $title , $content , $ret = false ) { /* {{{ */
2017-01-18 07:10:21 +00:00
$id = md5 ( uniqid ());
/*
$this -> addFooterJS ( '
$ ( " body " ) . on ( " click " , " span.openpopupbox " , function ( e ) {
$ ( " " + $ ( e . target ) . data ( " href " )) . toggle ();
// $("div.popupbox").toggle();
});
' );
*/
2017-01-17 17:35:30 +00:00
$html = '
2017-01-18 07:10:21 +00:00
< span class = " openpopupbox " data - href = " #'. $id .' " > '.$title.' </ span >
< div id = " '. $id .' " class = " popupbox " style = " display: none; " >
'.$content.'
< span class = " closepopupbox " >< i class = " icon-remove " ></ i ></ span >
2017-01-17 17:35:30 +00:00
</ div > ' ;
if ( $ret )
return $html ;
else
echo $html ;
2017-01-12 16:25:38 +00:00
} /* }}} */
protected function printAccordion ( $title , $content ) { /* {{{ */
$id = substr ( md5 ( uniqid ()), 0 , 4 );
?>
< div class = " accordion " id = " accordion<?php echo $id ; ?> " >
< div class = " accordion-group " >
< div class = " accordion-heading " >
< a class = " accordion-toggle " data - toggle = " collapse " data - parent = " #accordion<?php echo $id ; ?> " href = " #collapse<?php echo $id ; ?> " >
< ? php echo $title ; ?>
</ a >
</ div >
< div id = " collapse<?php echo $id ; ?> " class = " accordion-body collapse " style = " height: 0px; " >
< div class = " accordion-inner " >
< ? php
echo $content ;
?>
</ div >
</ div >
</ div >
</ div >
< ? php
} /* }}} */
2012-12-14 07:53:13 +00:00
}