In Confluence, how to make a template with predefined values such as document owner or current date? - confluence

By looking in the default meeting notes template, I see variables such as $currentDateLozenge or $documentOwner. And it creates pages with the current date and my name as expected. But when I copy/paste this template in a custom template, these variables react like any other variable by prompting for values.
What do I miss?

Related

Adding current user and current date in the template in Blueprint development

I finished simple, intermediate and advanced blueprint tutorials of the Atlassian https://developer.atlassian.com/server/confluence/tutorials-and-guides/.
Currently, I have a soy file and a js file for Blueprint wizard page; a Java file as context provider and an xml file for template.
I added the current date to the title easily. I also want to insert current date and the current user (page creator) to the page before sending user to edit. (For example; default meeting notes blueprint). However I couldn't find how to set these values in template.
In xml template, the current date should be as following format:
<time datetime="2021-02-17"/>
So, I cannot add something like "<at:var>" for datetime value. So, I cannot change it from the context provider class.
Also, I tried to set this value through Javascript and JQuery, however I just can change things about the wizard page. I failed on manipulating the actual template page.
Nearly same issue with the page creator. I should add the user as following format:
<ri:user ri:userkey="2c9680f7405147ee0140514c26120003"/>
However, I couldn't set the userkey through Java and also I couldn't get the page creator value.
Thus;
How can I add the current date to the template page?
How can I add the user mention to the template page?
How can I get the creator of the page?
Thanks already for all your interests.
Have a nice day!
The answer is coming from me, too.
In template's xml, we are adding two variables for the date and the user with enabled XHTML support:
<at:var at:name="currentDate" rawxhtml=true />
<at:var at:name="currentUser" rawxhtml=true />
In the context provider class, we will set these variables with html tags:
context.put("currentDate", "<time datetime=\" + sdf.format(new Date()) + "\"/>");
context.put("currentDate", "<ri:user ri:userkey=\" + AuthenticatedUserThreadLocal.get().getKey() + "\"/>");
where the context is the context map for blueprint and sdf is the instance of SimpleDateFormat class with a pre-defined date (not date-time) format.

Project Level DrawnBy Parameter in Altium

I have a Schematic template that refers to the DrawnBy parameter and others to fill in the title block. This works fine if I edit each sheet's document parameters to display the correct information. However, I want to use the project parameters to fill in the relevant information.
The schematic documents have default parameters such as, DrawnBy, Revision, etc, that override the project parameters so each sheet needs to be manually edited for author, dates, and revisions.
How do you override the default document parameters with project parameters?
This would be a better fit for the electronics.stackexchange.com site.
On the schematic document or template (sheet), each field is represented by using the custom text =ParameterName. Once you have the document open in the context of a project, you can add project-level parameters via the menu Project > Project Options, Parameters tab. Add the parameter using the same name that was used on the document. All documents sharing the parameter name will inherit the value entered here.
Don't add any parameter to this list that should be unique to each sheet.
For more information:
Altium Designer: Project Options - Parameters
Electronics StackExchange: Project parameters as variable in Altium

How to access variable, passed through URL in grafana?

I am trying to make a detailed dashboard in grafana that opens on click. I do it by passing a variable to the dashboard debending on the clicked facility. When the dashboard opens it needs to display value using the passed url variable inst. I just cannot seem to get it working. Here is an example of my dashboard link.
How can i use the variable inst?
I will add gogibogi4's correct answer. The Grafana documentation is lacking on this.
In your drill-down dashboard, add a constant variable. To be retrieved in Grafana, you need the prefix var- then the name of the variable in the query string. Let's assume the variable is "region." The URL coming into the drilldown dashboard should look similar to the following:
/drilldowndashboard/?var-region=NorthWest
Drilldown Dashboard Settings:
In the drilldown dashboard settings, create a variable. The Name in this example is "region" Make the type Constant. Under Hide, you can just leave that unselected. Under Constant options, you can write the word "blank" The preview of values will just show the word "blank" but go ahead and save it as it will be replaced in the query.
Query:
You can refer to the variable using [[region]] in your data query.
Parent Dashboard:
The parent dashboard merely needs to refer to the drilldown dashboard with var-region as a query parameter.
I figured out the solution on my own. The variable that i wanted to pass was var-inst, the trick to use it is to create a custom template variable named inst and give it a dummy value. After that is done i can use the passed value by using $inst. Note that in order for the variable to be passed i had to go back to my primary dashboard and then i had to click my link again. After that the value got passed and is working perfectly.
just referred above answer by gogibogi4 and it worked for me but when I tried to see variable information then I saw I have selected constant as a type but automatically it got converted into datasource and type is selected grafana. when I try to select them manually it didn't worked. this is some kind of bug of grafana I guess.

Setting Date as a prop in Adobe DTM

I'm trying to use Adobe DTM to pass the date to a prop variable but haven't had much success. The final output should be a prop report in Adobe that'll provide me traffic data for specific dates (5/11/16, 6/15/15 etc). The ultimate goal for setting the dates as a prop is to be able to classify a range of dates based on various business needs.
Could anyone point me in the right direction for getting this done? I am assuming I'll have to add a line of code in the s.code file that'll define s.prop5 = ...
Thanks
Based on your comments, it sounds like you are just looking to pop something with the current date stamp with "MM-DD-YYYY" format.
As Gigazelle mentioned, you can create a Data Element to return the value, and then reference it for setting your prop. However, throwing a data layer into the mix may be overkill for you, depending on your needs/limitations.
Data layers are meant for exposing data that DTM can't feasibly/reliably automate on its own via built-in features or hosting an autonomous js snippet.
The only reason you might want to consider having your site push it to a data layer, is if you want to generate the date via server-side coding to ensure the date is generated within the same timezone setting for all visitors. If you generate it client-side, it will be generated according to the visitor's browser/system settings. Since visitors are from all over the world in different timezones, the data may not be as consistent (even if you add additional code to change the timezone offset, it still may not be 100% based on browser version/security settings, or visitors who alter their browser/system date/timezone settings).
So, if you want to ensure the best accuracy, then I suggest you output the value via server-side code, and put into a data layer. How you do that depends on your server and what language you have at your disposal for your web pages being served up. Here is a very basic example using PHP:
<script>
var dataLayer = {
currentDate : '<?php echo date('m-d-Y'); ?>'
}
</script>
This will have the server generate the date stamp and output a js object called dataLayer with a property currentDate you can reference. You can create a Data Element as Type "JS Object" and for Path, put dataLayer.currentDate, and then reference your Data Element elsewhere (see below).
If that's too much trouble for you or if you want to keep it pure client-side/DTM and are okay with the potentially lower consistency...
Within DTM, go to Rules > Data Elements, and click Create New Data Element.
Name it "currentDate" (no quotes).
For Type, choose "Custom Script", and click Open Editor, and add the following:
var t=new Date(),d,m,y;
d=t.getDate();
d=d<10?'0'+d:d;
m=t.getMonth()+1;
m=m<10?'0'+m:m;
y=t.getFullYear();
return m+'-'+d+'-'+y;
Click Save and Close and Save Data Element.
Now you can reference the data element to pop prop5. How you do it depends on how you've setup Adobe Analytics within DTM. For example, if you set it up as a tool and only want it to pop on initial page view, you can open your AA tool config, go to the Global Variables dropdown, and set prop5 there. You reference it as %currentDate%
You can do the same %currentDate% syntax in a Page Load Rule or other rule or any other place that uses DTM's built-in fields.
Alternatively, if you need to reference it within javascript code (e.g. if you are setting prop5 within s.doPlugins or some other Custom Script box, you can reference the data element like this:
s.prop5 = _satellite.getVar('currentDate');
Set a JS variable on your site (such as within a data layer) that outputs the date in the format you wish to collect it in. Something like var d = Date();
In DTM, go to Rules > Data Elements and create a data element that maps to the JS variable you created on your site
If you want prop5 to be defined on every page, click the gear icon and map prop5 to your data element name by using %DataElementName% (whatever you named your data element in step 2, wrapped in percent signs). If you don't want it defined on every page, go to Rules and create a page load rule, event based rule or direct call rule depending on when you want the variable to trigger. Under the Adobe Analytics section of the rule, map prop5 to %DataElementName% .
This will allow you to collect dates as values, which can then be used in classifications.

Ordering Meetings Fields For SuiteCRM Calendar

In the SuiteCRM calendar the default for Meetings is to show the SUBJECT of the Meeting followed by the MEETING OBJECTIVES.
I want to modify it so that on the first line it shows the MEETING OBJECTIVES and the second line is the SUBJECT of the Meeting.
I've looked in modules/Calendar and modules/Meetings and I'm still a bit lost. Any idea on which file I need to modify to be able to change the order of these two fields?
Calendar module files are placed inside "modules/Calendar" folder. It contain tpl,js and php classes and functions for calendar module. "get_activities" function inside "modules/Calendar/CalendarActivity.php" actually load activities. You can change text here before it assigned to tpl/js file.
Further more you can also do changes inside this file: "modules/Calendar/Calendar.php" , see function "load_activities"
I think changing in JS should be last option because that is to complex and changes there need more time then doing it in alternative way in PHP file.