add method getModalBoxLinkAttributes()

This commit is contained in:
Uwe Steinmann 2021-05-06 11:01:50 +02:00
parent 36240ed21e
commit 80689dc9c1
2 changed files with 52 additions and 2 deletions

View File

@ -1256,6 +1256,25 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* @return string
*/
function getModalBoxLinkAttributes($config) { /* {{{ */
$attrs = array();
$attrs[] = array('data-target', '#'.$config['target']);
if(isset($config['remote']))
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */
/**
* Get html for button opening a modal box
*
@ -1268,6 +1287,12 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
foreach($attrs as $attr)
$content .= ' '.$attr[0].'="'.$attr[1].'"';
}
if(!empty($config['attributes'])) {
foreach($config['attributes'] as $attrname=>$attrval)
$content .= ' '.$attrname.'="'.$attrval.'"';

View File

@ -305,9 +305,9 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark border-bottom fixed-top\">\n";
echo " <a class=\"navbar-brand\" href=\"../out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\"><img src=\"../views/bootstrap/images/seeddms-logo.svg\"> <span class=\"d-none d-md-inline-block\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
echo " <a class=\"navbar-brand\" href=\"../out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\"><img src=\"../views/bootstrap/images/seeddms-logo.svg\"> <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
/* search form {{{ */
echo " <form action=\"../out/out.Search.php\" class=\"form-inline mr-auto\" autocomplete=\"off\">";
echo " <form action=\"../out/out.Search.php\" class=\"form-inline ml-4 mr-auto\" autocomplete=\"off\">";
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), $dms->getClassname('folder'))) {
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
}
@ -1258,6 +1258,25 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* @return string
*/
function getModalBoxLinkAttributes($config) { /* {{{ */
$attrs = array();
$attrs[] = array('data-target', '#'.$config['target']);
if(isset($config['remote']))
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */
/**
* Get html for button opening a modal box
*
@ -1270,6 +1289,12 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn btn-secondary")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
foreach($attrs as $attr)
$content .= ' '.$attr[0].'="'.$attr[1].'"';
}
if(!empty($config['attributes'])) {
foreach($config['attributes'] as $attrname=>$attrval)
$content .= ' '.$attrname.'="'.$attrval.'"';