How do I reset MS Word toolbar button state on new document - templates

I have a request from a User Group to implement the following:
Introduce a set of templates that
have some Hidden Text on the page as
instructions
Display the Hidden
Text the first time a document is
created using the templates
Introduce a custom button to toggle
the Hidden Text display
1) The templates are now created. Manual toggle of Hidden Text works.
2) should be dealt with using Auto_New to set the state of Hidden Text
3) is causing me grief. I have the code that toggles the Hidden Text and the State of the custom button when I am in the templates and the Auto New code is fine when I am in the templates covered in 1), however the state of the button also needs to be reset when I am in other templates.
What I need is something to set the status of the button depending on the Hidden Text setting whenever any document is created.
Any ideas?

I've created a macro under Normal that sets the button according to the status of HiddenText.
Not exactly what I want, in that the button may be in the wrong position when changing window views, but it's good enough...

Related

Sitecore 8, MVC, Experience Editor: How to make a rendering refresh after a Field Editor Button has been used

We have a rendering listing the selected items in a TreeSelect in the current item. In our case we call them "Tags" (1)
We have added a Field Editor Button to the component to let the editor change selected items. (2) (As described on for example Adding a custom component)
When an editor clicks (2) the editor window (3) it is opened in a dialog. The editor may select different items(called tags in our case) using the TreeSelect.
When the editor presses the ok-button (4) the values are set.
Now to the problem:
The values are actually set as they get stored when the editor presses the Save button but we want our list on the page (1) to immediately reflect the set items when the editor presses the ok-button (4), i.e. before having to actually save the whole item.
How do we achieve that?
(I am in contacts with Sitecore support but so far I have not gotten any answers...)
Update
After a lot of conversation with the support we still have no useful solution.
We tried turning it into a field renderer displaying the links.
What worked was:
The field do get updated when you have edited it in the popup field editor. (but...)
It looks good the first time when page is loaded.
You can make a WebEdit button with commands to edit the field and add it as Custom button to the field (register <command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/> and set Click on the button to webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField where the guid points to itelf and an "Icon" is set on it.)
What didn't work was:
The field get updated by the raw value, not what I want to display. Server code is involved, but not in the rendering of html-code.
When I want to edit the value in the field editor, the value sent to the field editor is not the raw value but what actually is displayed on the page. (I guess this can be solved somehow)
The issue to the support turned into a feature request to let the server be involved in rendering the field, not just sending a new value to the JavaScript updating it. The server does the first rendering so when it already is involved in updating, it should be allowed to do the rendering the following times too.
We have decided to not spend more time on this right now (we have other things to do too.) and have a bad editor experience as the field not get updated until the editor actually saves the item.
Still we have no suitable solution for this issue. If you want to keep working on it and want a reference to my issue it is 439059.
This may not be useful here. I've done this in normal sites, but not in Sitecore. But, here's one possibility....
This is a situation where you would pass a callback function to the child popup window. This callback will cause the caller / parent window to re-read/re-load the information that was just updated by the child.
Example:
User presses (2) to open Editor Window(3) (Editor window is opened and the Callback function is passed as a parameter)
User presses "OK" button (4). The "OK" button event handler updates the changes, then calls the Callback function which re-loads the now updated information, and closes the popup window.
Once the popup closes, the parent window now displays the information that the popup/editor just updated.
This takes some client side javascript (jquery) development but it is quite do-able normally.

Crash/Assertion after calling ForceRecalcLayout

I have added Ribbon to an existing MFC application.
The ribbon is created using the Editor.
In one of the panel I have a Custom CMFCRibbonGallery (derived from) whose contents (icon) I change dynamically. (It is much like the Styles Gallery in Excel.
After every time I change the contents I call ForceRecalcLayout which most of the time results in an Assert usually on m_pHighlighted or m_pPressed. Please see the attached snaphot1.jpeg, this Assert happened while I was moving the mouse over the Ribbon Gallery elements (Expanded mode popup) while ForceRecalcLayout was called.
On a different use case if I add the Sub Item (like we have "New Cell Style" in Styles Gallery of Excel) to the QAT using the context menu and then try to create a New cell style I get an Assert on the CMFCRibbonButton. Refer snapshot2.jpg
When just the icon changes it is sufficient to invalidate the ribbon.
Only if the size of the individual items are changed you Need to call RecalcLayout.
I see no reason to call ForceRecalsLayout.

What is the ember way to add popovers to views?

I'm working on a events board app. Events are displayed in columns at the height matching the start time and pack into the space if there is more then one overlapping. Each event is a view and I want to have a div next to the view that shows and hides on hover.
I know how to bind to mouseEnter and mouseLeave to show and hide part of the template but I want to show something adjacent to my view/template not within it.
I've already got some computed properties on the view to place the event with the correct height and width so I don't want to add the popover inside the view.
Here is something to mess with http://jsbin.com/osoner/1/edit
Seems like something simple but I want to make sure I'm doing things the Ember way.
After messing a little with your provided jsbin, here the results.
Basically what I've done was adding a new popup css declaration wich do position the popup so that it appears outside the parent view, and also moved the {{#if...}} helper into the originating view.
If you want to go more fancy, checkout this jsfiddle wich uses the twitter boostrap popover.
Hope it helps.

Ember.js adding and removing views from the DOM?

I am looking into ember.js, after working with SproutCore 1 previously. I am looking for some examples on how to add and remove views from the DOM as the user navigates the application.
For instance, I have an application that contains a set of cases and each case has a workflow. There are also administration pages, etc.
When the user starts up the app, a dashboard-like user interface is shown. From here the user is able to search or click on a case in order to bring up that case. At this point I want to do the following:
I want to remove the GUI for the Dashboard, and i want to show the GUI for the case - which is a complex GUI in itself with its own set of navigation rules etc.
Also, within the case I want to add and remove portions of the GUI as the user navigates and manipulates the case.
When the user clicks on the "Dashboard" link, I want the current GUI to be removed, and the dashboard to be added again.
As this will be a somewhat large application I am not sure if toggling the isVisible parameter is sufficient, or if other measures needs to be taken in order to not overload the user's browser.
Is there a guide, or an example that shows how to do this ?
WARNING: OUTDATED ANSWER
A view inherits from Ember.View which means it gets some key methods. append(), which appends to body, appendTo(arg) which takes an argument and remove().
The argument is a jQuery style selector of where to insert the element in the DOM.
// my view
App.PartsView = Ember.View.extend({
...
});
// create/insert my view
App.partsView = App.PartsView.create();
App.partsView.appendTo('#partcontainer');
In my code I have a <div id="partcontainer"></div>.
// remove from DOM
App.partsView.remove();
The documentation has a good part on Building a View Hierarchy and later a section on Ember.ContainerView depending on whether you want to do it all programatically or not.

Word 2003 Template - document saving

We have a word 2003 template we use as the basis for a configuration sheet for a system. The whole thing is based around form fields and the template is then locked. To write a new document we double click on the template, fill in the form fields, save and off we go.
The problem Ive got is that when finished writing in the "doc" file and closing or saving I always get a dialog asking if I want to save changes to the template as well. Even if I just double click the template "dot" file so that a blank "doc" file based on this is opened and then close that document straightaway I still get the save template query.
Is there anyway I can get rid of it as its damned annoying to everyone who uses the template.
Many thanks
Further note:
I've just had Word 2003 opened with no documents or templates opened. I use file open and open the template. Once it is open I then close it again. No "do you want to save" messages. I then use windows explorer and double click on the same template to create a document. I wait til the document is sitting in word ready to use. I then click close again without typing or changing anything - After the do you want to save changes to "Document 2" which I say no to, I then get the "do you want to save the template" message.
Further further note:
I have now tracked this to some code I have that adds a toolbar and buttons. within this code is a line customizationcontext = Thisdocument and then the toolbar and buttons are created. If I change the line to CustomizationContext = ActiveDocument I then do not get the prompt for saving when I close a document created from the template. I do however now get the prompt if I open the template and close it without changing anything(also the buttons I added do not appear correctly (but they do appear in the document))! I can live with this though as it is preferable than the other way round.
The most common reason for this to happen, is that one of your formats (paragraph or other) is marked to update the source template if changed.
Check all the used formats in your template if the option to save back changes is activated and de-activate this option - the same applies to any .doc already created from this template since it will carry over this option.
To check your formats (in Word 2003), open the sidebar for styles and formatting, change the filter at the bottom to "Used formats". Move your pointer over the format you like to inspect and select the action "Modify..." from the pull down menu at the right.
On the bottom right - just above the OK-button - you'll find the checkbox labeled "Automatically update".
See also Automatically update a paragraph style.