I don't think I have much access to Confluence other than editing pages. I have a table that has a bunch of dates listed in it. The dates represent when our SSL certficates, for various websites, expire. I would like to have something that highlights dates (in the table) that are close to the current date.
Would this need to be a macro or something else? If it's a macro then how do I go about adding a custom macro and what kind of access do I need in order to do this?
Hello,
Am I able to export a custom macro to another Confluence Environment or do I have to recreate it in the same one?
Thanks,
V
There's no macro export/import beyond a simple "copy and paste" of the main text, and manually copying the rest of the settings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Zavery,
You would probably need to be a Confluence administrator to create any sort of customizations as far as that is concerned (unless your administrator has activated the HTML macro). Here's some options:
Here is some sample Javascript code that probably would do what you want. This code highlights dates that are within 3 days of today in yellow and days that are past the current date in red (you can change the number of days by changing the number 3 below):
<script>
var limitDate = new Date();
limitDate.setDate(limitDate.getDate() + 3);
jQuery("time.date-upcoming").each(function() {
var timedate = new Date(jQuery(this).attr("datetime"));
if (timedate < limitDate) {
jQuery(this).attr("style", "border:1px solid #ffab00;");
}
});
jQuery("time.date-past").attr("style", "border:1px solid #ff5630;");
</script>
If you're going to insert it as a user macro, then you'll need to include the following line at the top:
## @noparams
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the info Stephen. I guess I'll probably need to go with Javascript.
I'm thinking we need to just do this for a single page. In this case, would an administrator be able to activate Javascript for a single page? If so, then how would they do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Zavery,
for one single page, probably the best option is to use the User Macro (unless your administrator has enabled the HTML macro, in which case that is the easiest). For a user macro, they'll need to choose a name, choose whether it is viewable by all users or only the administrator (in which case they would have to add the macro to your page), and then in the template box they should insert
## @noparams
on the first line and then the rest should be the code above. Once the user macro is inserted into the page (just like any other macro), then the changes should take effect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would enabling a user macro cause a security vulnerability? If so, then I may not want to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It could, if malicious code was added into it, or it enabled a user to embed malicious content in the body of the macro.
Only admins can add user macros, so you have to trust your admins not to write macros that do those things.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Indeed, as Nic said, enabling the HTML macro could be a security vulnerability, but a user macro will only run the code that an admin has entered into it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, the risk with the html macro is wider - anyone with "edit" could inject malicious code, not just your admins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.