I am creating a new confluence page via a content/post api call. So far so good.
Unfortunately confluence api doesn't support creating a new page out of an existing template.
I managed to create headers and a table, and know how to inject html content.
The problem is:
I didn't find any solution online to create more complex content. Specically: a date field (I want it to be presented the same way a date field is presented when you manually create it by '//' - it is presented as a formatted date, and if you edit the document - you can edit it through a "date picker" (choosing from a calendar).
Also I want to add "instructional text" (this is the name when creating a template manually) - text that appears only on edit mode (some descriptions for each section, that don't appear on the doc it self, but do appear on edit - like a placeholder), and don't know how I can do it through the api.
My current json body (Which works fine for these simple types) is:
{
body: {
wiki: {
representation: "wiki",
value: "h1. some title name h1. another title ||tableCol||anothertablecol||.... {html}<somehtmltag />{html}"
}
}
}
How can I add a date field (date picker) and an instructional text?
Didn't find any relevant real documentation for the wiki representation syntax.
Thanks in advance
Related
I added a WebPartZone in the master page at the top pf the master page, this web part zone is a message bar that will display on all the pages but could be different on each page. Is it possible to have a web part zone in the template that is editable on each page? Or is a different way to do it?
Thanks
The short answer no. From the template engine prospective whatever editable in the master - is not editable in its children. All editable web parts/widgets editable on the master, are not editable in its children.
If you really want to have an editable text in the master and all its children, you probably need to clone and customize web part and form control it is based on. Or create you own web part.
P.S. You can have editable text in your page template so all page that use this template will have this editable text working.
If you can give more details on what kind thing you want to edit would be easier to provide an answer
P.P.S. You can have a work around but it will not be with editable text. You will have to edit message text at the form tab. Would that suits you?
You can add the webpart on your master, and use a macro to get the content, like {%CurrentDocument.GetValue("Message")%}, but you have to add a field to each page to store the message in.
Just throwing out one more option, if what you want to display changes from page type to page type, you can put a repeater on the master page, put a path of a period (current document), then use macros to set the page type to the current document class name and the transformation to currentdocument.classname+".mastermessage"
Using a macro, then add a transformation "mastermessage" to each page type it will encounter, then you can change the fields and format for each page type.
I am trying to implement a Chart Block in Wagtail where a user can upload a spreadsheet via the DocumentChooserPanel and then a chart is generated based on the data in that spreadsheet.
I currently have it functioning, but the user must explicitly specify the variable they want the chart to be based off of:
class ChartBlock(blocks.StructBlock):
data_file = DocumentChooserBlock()
primary_variable = blocks.CharBlock(required=True,max_length=255)
class Meta:
template = 'dataviz/blocks/Chart.html'
icon = 'cogs'
label = 'Chart'
I was wondering if there is any way to have the primary_variable field dynamically populated with the column headers from the spreadsheet uploaded and stored in Documents - so that the user would be able to choose from a list of available variables instead of having to remember what a variable was called.
Thank you so much!
This wouldn't be easy to achieve with a vanilla implementation of Wagtail.
The page edit form is generated on page load, including the population of choice lists. I'm pretty sure that the same is true of choice lists in StreamField blocks, that they are populated as the block is added.
The code for this hangs between wagtailadmin.edit_handlers, wagtailadmin.views.pages and wagtailcore.blocks. It would be a pretty complex customisation.
Another possible route for investigation would be using the insert_editor_js hook to update the primary_variable field once a document was uploaded. However, I'm not sure you'll find a dependable ID to hang an event listener off of.
However, you will soon be able to custom validate the submitted page. A PR has just been submitted to allow this custom validation. That should reduce the amount of user error when adding the primary_variable.
This feature should be available in Wagtail 1.4, which I believe is due for release pretty soon.
I hope that helps.
I'm using sharepoint 2013 and i want to utilize the client side rendering feature using JSLink, when editing the web part for the calendar new event, in the "miscellaneous" there is no field for JSLink, how to modify the render for new event using JSLink ?.
It is not possible. See this discussion.
After about an hour's worth of research I found the problem. Microsoft specifically targets the Invalid, Event, and Survey list types to ignore client rendering. Unless you create your own webpart you will not ever be able to use any of the JSLink properties for these list types. Maybe somebody at Microsoft can explain themselves here as to why they would have crippled us like that or what a proper approach for this common problem would be. Yet another reason the Calendar is a piece of garbage in SharePoint 2013!
Also this answer:
There is no OOTB way to attach Javascript with calendar view (no property exposed for that listview). For a workaround you can create your own JQUERY or JAVASCRIPT and add on calendar view page by adding the reference in Content Editor Webpart on that page.,
However I have a quick but dirty solution. Add a SriptEditor to yout page, below the calendar and insert:
var oldEditLink = EditLink2;
EditLink2 = function(a,b,c){
if (isNaN(b) && b.substring(0,3) == "WPQ"){
var itemId = a.getAttribute("href").split("=")[1];
// do what you want to do
return false;
}
oldEditLink(a,b,c);
}
So I am rather new to sitecore, and it's a topic that wasn't covered during my training. My questions is just to help point me to the correct term, or documentation on a method to do the following.
I have a definition item, with a ton of field groups, what I want to do is something like:
if Value of Field X is "yes" then collapse/hide Field X or Field Group X.
Does that make sense? Is it a validation rule? or some other kind of rules, is it a workflow I need to attach? Do you place it on just the field I want to hide, or the field that triggers the action?
I appreciate any guidance.
There is nothing out-of-the-box in Sitecore to achieve what you want but there is no reason you cannot create a composite custom field type to do this. The following articles will help you achieve this:
Creating a custom Sitecore Field
Getting to Know Sitecore: Custom Fields, Part 1
Create a new control, inheriting either from Droplist (if the comparison of the value is to be text based) or Droplink (for comparison of ID). You could add a parameter in the Source field of the control to specify what the values that trigger the hide should be.
The underlying control in the Content Editor is just a standard HTML select element. Add onchange events to the control and add your Javascript handler to hide the other controls. Since I could not find a way of adding additional custom css classes to the Sitecore controls, it would be best/easiest to hide all other controls in the same collapsible group after you control. This would mean you would need to group your controls better (or logically at least).
The Javascript will be something like this (the Content Editor uses the Prototype JS framework):
if ($(this).getValue() == 'no') {
// find the parent container of this control and then hide all the next siblings in the same group
$(this).up('.scEditorFieldMarker').nextSiblings('.scEditorFieldMarker').invoke('hide');
}
You can test this by running the above in the console, change out the keyword this with the id of your field, e.g. $('FIELD2292054').
What I am not sure about is how to trigger the hide on initial load, i.e. when someone returns to an existing item, it may be possible by adding to one of the pipelines, but would be better using a JS solution if possible. I'll have a think about this and get a proper code sample up over the next few days.
EDIT: You can add an event handler to sc:contenteditorupdated to handle the content editor being rel-oaded.
document.observe("sc:contenteditorupdated", myFunction);
I wrote up a blog post and put the code on GitHub if you are interested.
Not sure if you have come across Andy Uzick's this blog post.
He wisely talks about hiding fields in the Content Editor and has also created a Sitecore Module called Hide Field Template Extension which is hosted on the Sitecore Marketplace with the full source code to extend.
After reading through and trying the extension, I do feel that it will not completely resolve your issue (how you have described it in the question).
But it will give you:
A mid-term solution to hide a few unnecessary field that some content editors would not like to view.
Fields that are only required by administrators for admin purpose - to de-clutter these fields could be hidden.
Just one thing to bear in mind that it mentions in the requirements Sitecore 6.5 & 6.6. I have not tested it in Sitecore 7. If you are using Sitecore 7, which I think you are, one could modify the source code and make it work for Sitecore 7.
Have a look and share your findings.
Happy Sitecoring!
When editing a Sitecore item that contains HTML in the Display Name (e.g. Title), the HTML is encoded immediately. Editing Display Name a second time shows that <em>Title</em> has been converted to <em>Title</em>.
We don't have any custom code that would do this; is there a configuration parameter or something that would control how display name is encoded?
[EDIT]
To clarify, if I edit an item's Display Name to add HTML, and then edit it a second time, the HTML contained in the Display Name has been encoded. There are several older items that contain HTML in the Display Name field and it is rendered correctly.
For example, first I edit an item's Display Name to add emphasis tags...
...you can see how the Display Name is updated in the content tree.
However, if I edit the item again, Sitecore encodes the HTML as show below...
Oddly, there are other (older) items in the content tree that already have HTML in their Display Name, and the HTML is correctly rendered (see below item with tag in the display name).
My question is: what could cause the HTML to be encoded?
To answer the question "Why would you want to do this in the first place?", I would respond with the answer that this is legacy code that used to be working and is now suddenly not. I'm not building a new system; this is an existing web site that I'm troubleshooting.
Your question is a little bit confusing. What exactly are you expecting to see vs. what you are actually seeing? Display Name is a simple text field, it's not rich text... I don't believe Sitecore is doing any encoding here.
Now you can make Sitecore skip the decoding step for single-line text fields by removing the Sitecore.Pipelines.RenderField.GetTextFieldValue from the renderField pipeline. Then you'll get exactly whatever is in that field rather than <em>Title</em>
OK, I think I get why your question is confusing me now. The input from you question was decoded?
EDIT: BTW, this pipeline entry GetTextFieldValue was a recent addition... some time between 6.3 and 6.6.