Panes/Widget interaction - javascript

Good morning,
I am about to build a dashboard and I am evaluation the Freeboard product that from a first look really amaze me!
I have a couple of questions to which I could not find answers in the docs:
Is it foreseen any kind of cross-panes/widgets communication? e.g. in case i need to refresh a pane if the user interact with another. I found the freeboard.on() method but from the events' catalog I only see two events, relative to the Freeboard's instance. I couldn't find freeboard.trigger() or similar function to trigger custom event.
Is it AMD supported (RequireJS)?
Thank you very much for your time and your support.
Daniele
Git issue track

Cross widgets/panes communication is not available "out of the box" in freeboard.
There is a way to see the most current data for all datasources within any of the widgets by using the .JS Editor when connecting a widget to a datasource.
As per the help message in the editor: you can assume this .JS Editor is enclosed in a function of the form function(datasources) where datasources is a collection of objects (keyed by name) corresponding to the most current data for each datasource.
I hope this helps.

Related

How to search in rad file explorer for current folder including sub folders

I want to use filter in rad file explorer which needs to search current directory including sub folders items.Currently i can search in only main folder but not sub folders items using built in filter box.Some body help me please
That is not available OOB because it is likely to cause performance issues. Nevertheless, you can create such functionality yourself:
Implement a custom FileSystemContentProvider, overriding the ResolveDirectoryAsTree() and ResolveDirectory() methods in the way, described in this help article: http://www.telerik.com/help/aspnet-ajax/fileexplorer-custom-filebrowsercontentprovider.html
Call recursively the ResolveDirectoryAsTree() and ResolveDirectory() methods from your content provider in order to take references to all listed files and folders (e.g. base.ResolveDirectoryAsTree()). Once you gather all the needed data to one place you can make a search through the items in it. Despite of the accuracy of such an implementation, note that this information-gathering would be a slow process, and you might meet performance issues.
You can find more detailed information regarding the custom commands in the following help article: http://www.telerik.com/help/aspnet-ajax/fileexplorer-add-custom-button-context-menu-item.html
There may be other ways to get this done, but I do not know them.

Find and Pull data from API (elgg)

Okay so I'm trying to make a custom elgg website.
One of the main features I need is for users to be able to create events, and for those events to be displayed in a sortable table.
For events, I use a plugin for elgg called Event Manager. I originally thought that the data for the events was stored in mysql, but apparently it's stored in the elgg API instead.
'
Can anyone give me any tips on where to find the event data, and how to pull it from the api and put it into a javascript/html table?
Gracias,
Pablo Escobar
Regarding details of writing plugins, refer to documentation: http://docs.elgg.org/wiki/Main_Page and make sure to read through: http://docs.elgg.org/wiki/Engine/DataModel
To get event_calendar events, you'll need to use one of the functions from elgg_get_entities family. You'll most likely need to filter by type (object) and subtype (event_calendar), apply some filtering (metadata_name_value_pairs parameter to elgg_get_entities_from_metadata) and sorting (order_by_metadata)
For additional support you'll be more successful at community.elgg.org page.

Sharepoint - How to: dynamic Url for Note on Noteboard

I'm quite new to SharePoint (about 1 week into it actually) and I'm attempting to mirror certain functionality that my company has with other products. Currently I'm working on how to duplicate the tasking environment in Box.com. Essentially it's just an email link that goes to a webpage where users can view an image and comments related to that image side by side.
I can dynamically load the image based on url parameters using just Javascript so that part is not a problem. As far as the comments part goes I've been trying to use a Noteboard WebPart, and then my desire is to have the "Url for Note" property to change dependent on the same URL parameter. I've looked over the Javascript Object Model and Class Library on MSDN but the hierarchy seems to stop at WebPart so I'm not finding anything that will allow me to update the Url for Note property.
I've read comments saying that there's a lot of exploration involved with this so I've tried the following:
-loading the javascript files into VisualStudio to use intellisense for looking up functions and properties in the SP.js files.
-console.log() on: WebPartDefinitionCollection, WebPartDefinition, WebPart, and methods .get_objectData(), get_properties() on all the previous
-embedding script in the "Builder" on the Url for Note property (where it says "click to use Builder" - I'm still not sure what more this offers than just a bigger textbox to put in the URL path)
I'm certain I've missed something obvious here but am gaining information very slowly now that I've exhausted the usual suspects. I very much appreciate any more resources or information anyone has and am willing to accept that I may be approaching this incorrectly if someone has accomplished this before.
Normally I'd keep going through whatever info I could find but I'm currently on a trial period and start school back up again soon so I won't have as much time with it. Apologies if this seems impatient, I'm just not sure where else to look at the moment.
Did you check out the API libraries like SPServices or SharepointPlus? They could help you doing what you want...
For example with SharepointPlus you could:
Create a Sharepoint List with a "Note" column and whatever you need to record
When the user goes to the page with the image you just show a TEXTAREA input with a SAVE button
When the user hits the SAVE button it will save the Note to the related list using $SP().list("Your list").add()
And you can easily retrieve the information (to show them to the user if he goes back to the page) with $SP().list("Your list").get()
If I understood your problem, that way it may be easier for you to deal with a customized page :-)

How to synchronize Google Calendar & Spreadsheet with Script

I am trying to create a Google Apps Script that keeps a Google Calendar and a "master spreadsheet" on Drive synchronized -- is this possible? I found these two posts:
http://blog.ouseful.info/2010/03/04/maintaining-google-calendars-from-a-google-spreadsheet/
http://blog.ouseful.info/2010/03/05/grabbing-google-calendar-event-details-into-a-spreadsheet/
I'm quite sure this could be done using a lot of if statements and logic, but maybe there's a simpler way?
I ended up just providing the following simple script. All that was really necessary was adding events based on two columns, and this would've taken too long to develop.
function onOpen() {
//spawns a menu with a button that triggers AddToCal
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Add event to calendar",
functionName : "AddToCal"
}];
sheet.addMenu("Data To Calendar Plugin", entries);
};
function AddToCal(){
//get the current row
var ss = SpreadsheetApp.getActiveSpreadsheet();
var cell = ss.getActiveCell();
var R = cell.getRow();
//grab values for current row to pass to calendar event
var date_of_event = ss.getRange('G'+R).getValue();
var date = new Date(date_of_event);
var event_title = ss.getRange('A'+R).getValue();
//access the calendar
var cal = CalendarApp.getCalendarById('[IDREMOVED]');
cal.createAllDayEvent(event_title,date);
ss.toast("Event added to " + cal.getName());
}
Yes, it's possible to write a two-way event synchronization script, but it isn't going to be simple. Those two posts you refer have parts that could be reused, but they are quite elementary compared to the challenges you'll face with actual synchronization. You may want to read over Using Google Apps Script for a event booking system which does create calendar entries based on a spreadsheet (but doesn't do on-going synchronization). I've done some debugging of that script in past.
Synchronization would need to support:
Creation of events in either location
Modification of event details in either location (although you could opt to consider only a subset of event details for simplification)
Deletion of events in either location
Recurrence, e.g. CalendarEvent.getEventSeries() handling (or choose to avoid)
This is pseudo-code that you could start with:
Open Calendar, Read Calendar events into calArray (will all attributes you care for)
Open Spreadsheet, Read Spreadsheet events into sheetArray
For each event in calArray:
Search for calEvent in sheetArray.
If found, compare lastUpdated values.
If equal, do nothing
Otherwise copy most recently updated to least recently updated
Continue with next event
If not found then copy calEvent to new sheetEvent, including lastUpdated value.
Continue with next event
For each event in the sheetArray (...that hasn't been handled yet)
Similar logic above.
Write updated sheetArray to spreadsheet.
Write updated calEvents to calendar API (see note 1 below)
Notes:
All updates to calEvents could be made to array and written to calendar API immediately, as an alternative to a bulk update. This would eliminate the need to track the changes locally, although it would be a good idea to touch the lastUpdated value.
You will want to use CalendarEvent.getLastUpdated() when reading calEvents, and store a similar value in your spreadsheet (tied to an onEdit trigger) to facilitate comparisons.
It would simplify comparisons to record CalendarEvent.getId() against events in the spreadsheet. You also have CalendarEvent.setTag(key,value) that could be used to record custom metadata into the calendar, for instance to indicate events that originated or have been synchronized with your spreadsheet. (These tags are not accessible through the GCal UI, so would only be accessible via script.)
You should think about the range of dates or number of events you want to deal with, and limit the scope of the script. If you don't, you are sure to run into execution time limits in real operation.
Some Calendar Event characteristics don't lend themselves to easy expression in a spreadsheet, for instance:
Guest list
Reminder list
As mentioned (thanks Henrique) in the other post I've spent some time - it was actually what brought me to GAS originally - on data exchange between spreadsheets and calendars mainly because people I worked with where used to organize their time schedule (for a highschool) in spreadsheets and I had to take care of the transition to Google Calendars.
After some time though it appeared that the online Calendar interface is far more effective to create events so they don't use the sheet to Calendar scripts anymore !!
On the other hand, the printing and presentation options in GCal are very limited so the other direction is still very useful and we use it all the time !
I know this will seem to be out of subject regarding the original question and maybe too anecdotic but I just wanted to point out that you should thoroughly think about what you really need before reinventing the wheel... As Mogsdad mentioned, some events parameter are not easily described in spreadsheet logic and finally it could become a lot more complicated to use than the original tool.
The only really useful tool I developed using bidirectional data transfer is a 'batch modification tool" when I need to delete or edit a big number of similar events.
For example if we need to change a teacher's name for some reason all along the year I import all the events for a number of class, replace the name in the spreadsheet and update back the class calendar... it takes me 5 minutes and is very easy but these are very specific use cases and I'm not sure it is very common.
Anyway I wouldn't call that "synchronization" since it only takes some events some time and changes them... I've never attempted to keep a spreadsheet up to date with a calendar, from my experience calendars are pretty reliable and I consider them as the original data source. As I already said, we import data in spreadsheets every week just for printing and local archiving.
Sorry for this long and a bit vague comment (that was way too long to fit in a normal 500 chrs comment ;-)
No there isn't. And although a lot of issues regarding Apps Script Calendar Service has been solved (timezones, all day events, queries and so on), it's still a fairly complex task.
I know Serge, the top contributor here in SO on #google-apps-script tag, has developed quite some scripts involving the Calendar Service.
But I don't know of anyway that made a two-way update between a calendar and a spreadsheet. It should be a hard one. If you ever do, please be kind to share :)
I wrote a script that synchronizes between GCalendar and a GSheet. You may be able to use it as is, or can certainly borrow ideas from it. There are separate commands for copying events each way: https://github.com/Davepar/gcalendarsync

Updating field in CRM 2011 through javascript from ribbon button on homegrid view

I am trying to create a button on the initial list or homegrid view of leads that will set the value of a specific field to the same value every time for the lead that is selected. Anyone know how i can do this through javascript?
Thanks!
To build on James's answer, you can use the CrmParameter SelectedControlSelectedItemIds to get a list of all the leads selected in a homepage grid. There is an answer on the MSDN forums that explains how to do this, copied below. You can do this in the Xml source or in the two CRM ribbon editors I know of.
After that, you would then need to use the Update method of one of the CRM webservices to loop through the Guid array and update each entity/database row accordingly. I've mentioned Avanade's excellent web resource before, and MSDN has some additional documention on this as well.
Walkthrough: Use the SOAP Endpoint for Web Resources with JScript
Sample: Create, Retrieve, Update and Delete Using the REST Endpoint with JavaScript
<CommandDefinition Id="Account.Form.CustomGroup.Button.A.Command">
<Actions>
<JavaScriptFunction Library="$webresource:AccountFormLibrar"
FunctionName="CreateNewAccount">
<CrmParameter Value="SelectedControlSelectedItemIds"/>
</JavaScriptFunction>
</Actions>
</CommandDefinition>
function CreateNewAccount (prmRecordGUID) {
//prmRecordGUID will recieve all GUIDS in comma seperated i.e. GUID1,GUID2,GUID3
}
Yeah this should be pretty straightforward - I dont think what you have said in your comment will work - that function you are trying to use only works if the form of the record is open, e.g. it wont work from a grid view.
You will have to use a webservice call as described in the MSDN here: http://msdn.microsoft.com/en-us/library/hh771584#BKMK_DataAccessUsingJavaScript
Also if you are customising the ribbon (adding buttons) you would find it a lot easier with this tool: http://www.develop1.net/public/page/Ribbon-Workbench-for-Dynamics-CRM-2011.aspx

Categories

Resources