IvoryGoogleMap - can't display infoWindow - symfony

i'm trying to use IvoryGoogleMap to display a simple map with markers and infoWindows using this code:
$marker ->setPosition($place->getLat(), $place->getLng());
$infoWindow ->setContent('<p>Default content</p>');
$marker ->setInfoWindow($infoWindow);
$map ->addMarker($marker);
and all i'm getting is a map with marker(s) but when i click on one of them, nothing happens. Have you any idea what am i doing wrong ?

Ok, problem solved. Here is the solution from bundle's author egeloen (on github):
======================================================================
This functionality doesn't exist natively. If you want to open an info window with a click event on a marker, you need to use the ivory_google_map.event service. This service allow you to generate all events you want.
In your case, the event is :
$clickEvent = $this->get('ivory_google_map.event');
$clickEvent->setInstance($marker->getJavascriptVariable());
$clickEvent->setEventName('click');
$clickEvent->setHandle(sprintf('function(){%s.open(%s, %s);}',
$infoWindow->getJavascriptVariable(),
$map->getJavascriptVariable(),
$marker->getJavascriptVariable()
);
$map->getEventManager()->addEvent($clickEvent);

Related

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

Component will not delete

I'm doing a bit tidy of the Content Manager and have a component that won't delete (not the same as my other question).
When I try to delete the component in question I get the following error
(8004032D) This item is in use.
Unable to delete Component (tcm:4-65020).
UtilitiesBL.AssertItemCanBeDeleted
UtilitiesBL.AssertItemCanBeDeleted
ComponentBL.Delete
Component.Delete
Request.Delete
When I use the Where Used tool on the component I get no results in the "Used In" tab, one result in the "Uses" tab, the "Blueprint Hierachy" shows it is not localized in any of my three child publications and no results in the "Published To" tab.
I have had a look in the Content Manager database to see if I can spot what is going wrong but not really found anything.
Any ideas?
Thanks in advance.
It looks like the Where Used tool in R5.3 isn't working correctly. The component in question is used in 15000 other components. I found this by using the TOM API directly.
var componentID = "tcm:4-65020";
TDS.TDSE tdse = new TDS.TDSE();
var component = (TDS.Component)tdse.GetObject(componentID, TDSDefines.EnumOpenMode.OpenModeView);
var whereUsedString = component .Info.GetListUsingItems();
Now comes the task of deleting all these links...

How can you extend the default behavior of Tridion.Cme.Commands.Open.prototype._execute()?

I have written a GUI extension which adds an additional tab to many of the Item views in the SDL Tridion CME (e.g. Component, Page and Schema etc.). I have also written some JavaScript which loads that tab directly if when the view is loaded with a tab name is specified in the URL.
The result is that if a page is loaded with the tab name added as follows:
http://localhost/WebUI/item.aspx?tcm=64#id=tcm:1-48-64&tab=InfoTab
Rather than the default of
http://localhost/WebUI/item.aspx?tcm=64#id=tcm:1-48-64
The Info Tab will be loaded on top, instead of the General Tab. This is performed with the following code snippet and works very well:
$evt.addEventHandler($display, "start", onDisplayStarted);
// This callback is called when any view has finished loading
function onDisplayStarted() {
$evt.removeEventHandler($display, "start", onDisplayStarted);
var tabname = $url.getHashParam("tab");
if (tabname != '') {
var tabControl = $controls.getControl($("#MasterTabControl"), "Tridion.Controls.TabControl");
tabControl.selectItem(tabname);
}
}
Now I would like to make a context menu item to open items and link to the tabs using my new functionality. My first thought was to construct the Item URL myself and simply open a new window in my execute method. So I looked at the default functionality in the standard Open.prototype_execute() functionality of the GUI. This is stored in the navigation.js file of the CME, and is performed by the Tridion.Cme.Commands.Open.prototype._execute method. The code is a lot more complicated than I had anticipated as it deals with shared items, and permissions etc.
Rather than just copying all of this code to my own function, I was wondering if there is a way to elegantly extend the existing Open.prototype_execute() function and append my “&tab=MyTab” to the $cme.Popups.OPEN_ITEM_OPTIONS.URL constant for my own functions.
Any advice would be greatly appreciated.
At the end the Open command uses $config.getEditorUrl(item_type) to get the url for the item view (item_type - $const.ItemType.COMPONENT, etc). There are no extension points for this part of the functionality, but you could always try to overwrite it on your own risk.

Double clicking a google earth treeview node does not 'flyto' the placemark

I am using the plugin in a desktop application (Visual Studio C#). I am creating a placemark using the following code:
// Create a new coordinate object based on the lat/lon of the device
// TODO :: add lat/lon once data is available
FC.GEPluginCtrls.Geo.Coordinate Coord =
new FC.GEPluginCtrls.Geo.Coordinate(0, 0, 0, AltitudeMode.RelativeToGround);
// Create a placemark and put it in the tree.
kmlTreeView.ParseKmlObject(KmlHelpers.CreatePlacemark(
ge,
Coord,
((Device)DeviceList[i]).sSerialNum, // ID
((Device)DeviceList[i]).sNickname, // Name - shown in tree
((Device)DeviceList[i]).sName)); // Description - shown in bubble
In the TreeView the new nodes show up and when I double-click on them the bubble pops up with information in it but the view does not change. I attempted to verify the property "public bool FlyToOnDoubleClickNode" as shown in the documentation but that property apparently does not exist in the version I am using (1.010).
When I was loading a KML file the double click worked as expected but ever since I've been manually adding the placemarks it does not work.
Any thoughts?
Thanks!
Have you tried manually assigning a <LookAt> or <Camera> ?
That should work
Edit: Well the FlyToOnDoubleClickNode is turned on by default, so your problems lie elsewhere
I do not know why you are having troubles with setting multiple LookAts. Have you tried assigning 'ids' to your LookAt ? Depending on what you are actually doing, that might help.
Otherwise, have you seen setFlyToView()
I am not sure that will help you though, since it relates to KMLs loaded via NetworkLinks
Thats about me for ideas - good luck!
It appears that the coordinates 0,0 are somehow significant. If the coordinates are changed to something else the "FlyTo" works (0.1 and 0.1 work).

Anguilla - Get the version and user information

I have created a command button on the Ribbon Toolbar. When I select an component an click on "Display Info" button, an popup should open telling me about the latest version of the Component, Modified date, and the User who last modified it.
I do get the component with the following code:
var item = $models.getItem(selection.getItem(0));
How can I get the other information from here.
Part 2:
When I try to see the JS code in Firebug, I see them in one single line. I am unable to put an break point on the execute function within my code.
Any suggestions on the above points. ?
To deminify the JS, to allow you to add breakpoints, and also to allow you to use a JS console to inspect objects that are available, you can follow the instructions at http://code.google.com/p/tridion-2011-power-tools/wiki/DeactivateJSMinifier.
User information can be retrieved using the information at How to get the user Id of the currently logged user in Tridion?
I find that the only way to find anything with Anguilla is to use a JS Console like Chrome's.
Once you get the current item - like you do now - you can do stuff like:
var version = item.getVersion();
var lastModifiedDate = item.getLastModifiedDate();
var lastEditorId = item.getStaticRevisorId();
getStaticRevisorId() gives you the Tridion URI of the last user to change the item, and you can then load this to retrieve further information from it.

Resources