[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Allow ToolbarLinkFile to work in specified sections and improve tooltip
"Merci Jacob \(@mercihabam\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <690c74349a77e_2ce2694215c2@gitlab-sidekiq-low-urgency-cpu-bound-v2-67b7b754dd-kb27z.mail> |
Merci Jacob pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
a6d43df3 by ushindi bienvenu at 2025-11-06T10:02:58+00:00
[FIX] Allow ToolbarLinkFile to work in specified sections and improve tooltip
---
* [FIX] Disable ToolbarLinkFile in global section and improve tooltip
See merge request tikiwiki/tiki!8848
- - - - -
6 changed files:
- lib/core/Services/Tracker/Controller.php
- lib/core/Toolbar/ToolbarItem.php
- lib/core/Toolbar/ToolbarLinkFile.php
- lib/setup/prefs.php
- lib/smarty_tiki/BlockHandler/TextArea.php
- tiki-admin_toolbars.php
Changes:
=====================================
lib/core/Services/Tracker/Controller.php
=====================================
@@ -3160,7 +3160,7 @@ class Services_Tracker_Controller
$item = Tracker_Item::fromId($itemId);
if (! $item) {
- throw new Services_Exception_NotFound();
+ throw new Services_Exception_NotFound(tr('Tracker item not found'));
}
$definition = $item->getDefinition();
=====================================
lib/core/Toolbar/ToolbarItem.php
=====================================
@@ -391,6 +391,7 @@ abstract class ToolbarItem
return $tag;
}
+
public function getWikiHtml(): string
{
$onClick = $this->getOnClick();
=====================================
lib/core/Toolbar/ToolbarLinkFile.php
=====================================
@@ -11,7 +11,7 @@ class ToolbarLinkFile extends ToolbarUtilityItem
public function __construct($trackerItemId)
{
$this->trackerItemId = $trackerItemId;
- $this->setLabel(tra('Link File'))
+ $this->setLabel(tra('Link file from tracker item'))
->setIcon('img/icons/file-manager.png')
->setIconName('file')
->setType('LinkFile')
=====================================
lib/setup/prefs.php
=====================================
@@ -176,7 +176,7 @@ function get_default_prefs()
'toolbar_global_comments' => '
bold, italic, underline, strike , - , link, smiley | help
',
- 'toolbar_trackeritem_comments' => '
+ 'toolbar_trackers_comments' => '
bold, italic, underline, strike , - , link, smiley, linkfile | help
',
'toolbar_sheet' => 'addrow, addrowbefore, addrowmulti, deleterow,-, addcolumn, addcolumnbefore, addcolumnmulti, deletecolumn,-,
=====================================
lib/smarty_tiki/BlockHandler/TextArea.php
=====================================
@@ -103,7 +103,9 @@ class TextArea extends Base
if (empty($params['section'])) {
global $section;
- $params['section'] = $section ? $section : 'wiki page';
+ $params['section'] = $section ?: 'wiki page';
+ } elseif ($params['section'] === 'trackeritem') {
+ $params['section'] = 'trackers';
}
$html = '';
$html .= '<input type="hidden" name="mode_wysiwyg" value="" /><input type="hidden" name="mode_normal" value="" />';
=====================================
tiki-admin_toolbars.php
=====================================
@@ -89,11 +89,11 @@ if (isset($_REQUEST['comments']) && $_REQUEST['comments'] == 'on') {
} else {
$show_comments = false;
}
-
+$comments_suffix = $show_comments ? '_comments' : '';
foreach ($sections as $skey => $sval) {
if (
- isset($prefs['toolbar_' . $skey . ($show_comments ? '_comments' : '') . 'modified'])
- && $prefs['toolbar_' . $skey . ($show_comments ? '_comments' : '') . 'modified'] == 'y'
+ isset($prefs['toolbar_' . $skey . $comments_suffix . 'modified'])
+ && $prefs['toolbar_' . $skey . $comments_suffix . 'modified'] == 'y'
) {
$sections[$skey] = $sval . ' *';
}
@@ -112,13 +112,13 @@ if (! empty($_REQUEST['reset_all_custom_tools']) && $access->checkCsrf()) {
}
if (isset($_REQUEST['save'], $_REQUEST['pref'])) {
- $prefName = 'toolbar_' . $section . ($show_comments ? '_comments' : '');
+ $prefName = 'toolbar_' . $section . $comments_suffix;
$tikilib->set_preference($prefName, $_REQUEST['pref']);
$tikilib->set_preference($prefName . 'modified', 'y');
}
if ((isset($_REQUEST['reset']) && $section != 'global') || (isset($_REQUEST['reset_global']) && $section == 'global')) {
- $prefName = 'toolbar_' . $section . ($show_comments ? '_comments' : '');
+ $prefName = 'toolbar_' . $section . $comments_suffix;
$tikilib->delete_preference($prefName);
$tikilib->set_preference($prefName . 'modified', 'n');
header('location: ?' . smarty_function_query(['_urlencode' => 'n'], $smarty->getEmptyInternalTemplate()));
@@ -138,9 +138,9 @@ if (! empty($_REQUEST['save_tool']) && ! empty($_REQUEST['tool_name'])) { // i
header('location: ?' . smarty_function_query(['_urlencode' => 'n'], $smarty->getEmptyInternalTemplate()));
}
-$current = $tikilib->get_preference('toolbar_' . $section . ($show_comments ? '_comments' : ''));
+$current = $tikilib->get_preference('toolbar_' . $section . $comments_suffix);
if (empty($current)) {
- $current = $tikilib->get_preference('toolbar_global' . ($show_comments ? '_comments' : ''));
+ $current = $tikilib->get_preference('toolbar_global' . $comments_suffix);
$smarty->assign('not_global', false);
} else {
$smarty->assign('not_global', true);
@@ -149,7 +149,7 @@ $smarty->assign('not_default', false);
if ($section == 'global') {
$cachelib = TikiLib::lib('cache');
if ($defprefs = $cachelib->getSerialized("tiki_default_preferences_cache")) {
- if ($defprefs['toolbar_global' . ($show_comments ? '_comments' : '')] != $current) {
+ if ($defprefs['toolbar_global' . $comments_suffix] != $current) {
$smarty->assign('not_default', true);
}
}
@@ -160,7 +160,7 @@ if (! empty($_REQUEST['delete_tool']) && ! empty($_REQUEST['tool_name'])) { // i
if (str_contains($_REQUEST['tool_name'], $current)) {
$current = str_replace($_REQUEST['tool_name'], '', $current);
$current = str_replace(',,', ',', $current);
- $prefName = 'toolbar_' . $section . ($show_comments ? '_comments' : '');
+ $prefName = 'toolbar_' . $section . $comments_suffix;
$tikilib->set_preference($prefName, $current);
}
}
@@ -298,6 +298,7 @@ foreach ($parserlib->plugin_get_list() as $name) {
$smarty->assign('plugins', $plugins);
$smarty->assign('show_comments', $show_comments);
+$smarty->assign('comments', $show_comments ? 'on' : 'no');
$smarty->assign('loaded', $section);
$smarty->assign('rows', range(0, $rowCount - 1));
$smarty->assign('rowCount', $rowCount);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a6d43df3cbb7b7d12b8af80d2cbbc62eb869b503
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a6d43df3cbb7b7d12b8af80d2cbbc62eb869b503
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs