Code Monkey home page Code Monkey logo

luminateextend's People

Contributors

billthompson avatar blackbaud-noahcooper avatar noahcooper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luminateextend's Issues

Support splitting up data between query string and post data

Convio's "donate" call in their CRDonationAPI requires the form data to be passed as a query string EXCEPT for the credit card information.

Using luminateExtend's api call for donate does a POST with all the data as post data, which will return "required parameter 'method' not found" because the CRDonationAPI is looking for much of its arguments (well, at least "method") in the query string.

Currently I have to do a manual splitting of the parameters between the query string and post data via jQuery.post, but I end up missing out on luminateExtend's robust CORS-with-fallback for cross domain requests.

luminateExtend.global.sessionCookie is not always set correctly

For organizations whose Luminate Online site is using Tomcat rather than JServ, luminateExtend.global.sessionCookie is not set correctly, breaking requests which require cookies/authentication.

From luminateExtend_server:

[[E130:"[[T7:PixelServer]]" dup dup "?" indexof 1 + swap length substring]]

With the move to Tomcat, the cookie is no longer part of the query string, rather, it is separated from the servlet name with a semicolon.

Add examples

Provide developers with a few easy-to-understand functional examples that use the library.

Add tags for Action Alerts

This will build on work done in v1.2 to allow for parsing tags to display constituent information.

One should be able to display an action alert on an external website using something like this:

<luminate:actionAlert id="1234"></luminate:actionAlert>

API URL for Events is incorrect when using shorthand servlet name

When attempting to make a request to one of the API methods for Events using the shorthand "event" or "orgevent", the servlet name in the request is CROrgeventAPI rather than CROrgEventAPI. This causes the request to fail due to a 404.

luminateExtend.api({
  api: 'event', 
  data: myData, 
  callback: function(data) {

  }
})

postMessage transport does not validate origin, causing conflict with other plugins

When the postMessage transport is used in IE8/9, if the page includes another plugin that uses postMessage (such as Facebook social plugins, i.e. the Like Box), luminateExtend does not validate the origin when a message is received. This causes messages sent by the other plugin to throw errors, because luminateExtend has bound an event to the message/onmessage events.

When using responseFilter with luminateExtend.api.request, do not update response object if array is not found

Currently if a responseFilter is provided with an array that is not found, the response object is updated to include the object.

For example, using the example JavaScript:

luminateExtend.api({
  api: 'teamraiser', 
  data: 'method=getParticipants&fr_id=1234&first_name=John', 
  responseFilter: {
    array: 'getParticipantsResponse.participant', 
    filter: 'personalPagePrivate == false' // or 'personalPagePrivate != true'
  }, 
  callback: function(response) {
    console.log(response);
  }
});

If fr_id 1234 does not exist and thus an error is returned, the response object is updated to include getParticipantsResponse.

luminateExtend.api.request() makes unnecessary HTTP request when using postMessage transport

When luminateExtend.api.request is called with requiresAuth set to true, and no auth token has been defined, the method uses luminateExtend.api.getAuth to get a token before proceeding with the request. When the request uses the postMessage transport, this isn't necessary -- luminateExtend_server can itself get an auth token. Doing so will eliminate an HTTP request and improve performance.

Use CORS with Zepto

Once madrobby/zepto#842 is fixed, luminateExtend.api.request should be updated to use CORS in browsers that support it regardless of whether jQuery or Zepto is used.

Remove luminateExtend.api.request hash transport

Currently luminateExtend.api.request() uses feature detection to determine whether the browser supports CORS, if not falls back to using the postMessage API, and then finally if postMessage is not supported, falls back to a hash transport. At this point, the only browser with even a modicum of market share that requires this final fallback is IE7.

Investigate using luminateExtend.js with Zepto in lieu of jQuery

Still need to determine if the library in its current form can work with Zepto, or if the code would need to be forked.

One immediate issue is that Zepto.ajax() does not seem to include support for setting the withCredentials property to allow for cross-domain requests with cookies.

Allow for client-side response filtering in luminateExtend.api.request()

The common parameters list_filter_column and list_filter_text can be used with many API methods to filter by a specified database column. However, there are some cases where client-side filtering is needed on top of this server-side filtering. The request method should provide something like the following to allow for filtering on a particular object's value within an array:

luminateExtend.api.request({
  api: 'teamraiser', 
  callback: getParticipantsCallback, 
  data: 'method=getParticipants&fr_id=1234&first_name=John', 
  responseFilter: {
    array: 'getParticipantsResponse.participant', 
    filter: 'personalPagePrivate == false'
  }
});

The result should be that the response data object passed to getParticipantsCallback should not contain any participants whose personal page is private.

The filter should allow for positive or negative statements. For example, the following should work as well:

luminateExtend.api.request({
  api: 'teamraiser', 
  callback: getParticipantsCallback, 
  data: 'method=getParticipants&fr_id=1234&first_name=John', 
  responseFilter: {
    array: 'getParticipantsResponse.participant', 
    filter: 'personalPagePrivate != true'
  }
});

Error with auth token loading function

Using a modern (supports CORS) browser (and a Tomcat server) with your new "sign up" example, it appears there is a flaw with the auth token request function.

At present, it doesn't properly append the 'CRConsAPI' string if the settings specify HTTPS.

Changing the line (276) as entered below fixes the issue:
url: settings.useHTTPS ? luminateExtend.global.path.secure + 'CRConsAPI' : luminateExtend.global.path.nonsecure + 'CRConsAPI',

Support for multi-locale

Allow for setting locale using luminateExtend.init/luminateExtend.global.update. Supported locales include:

en_US
es_US
en_CA
fr_CA
en_GB
en_AU

When a locale is provided:

  1. The locale session variable should be set.
  2. The locale session variable should be appended to each request made using luminateExtend.api.request.
  3. luminateExtend.utils.simpleDateFormat should use the appropriate default format for the locale.

SimpleDateFormat: Locale setting should be used when provided a null pattern

Test is failing when setting luminateExtend.global.locale to a locale that uses a non-standard (M/d/yy) date format.

it("given null pattern, should honor locale setting", function() {
  luminateExtend.global.update('locale', 'en_GB'); 

  expect( sdf(dateObj.unformatted, null) ).toBe( '31/1/70' );
});
console.log("expect( '%s' ).toBe( '31/1/70' )", sdf(dateObj.unformatted)); 
// logs: expect( '1/31/70' ).toBe( '31/1/70' ) 

luminateExtend.api.request() makes unnecessary HTTP request when using hash transport

When luminateExtend.api.request is called with requiresAuth set to true, and no auth token has been defined, the method uses luminateExtend.api.getAuth to get a token before proceeding with the request. When the request uses the hash transport, this isn't necessary -- luminateExtend_server can itself get an auth token. Doing so will eliminate an HTTP request and improve performance.

Use AJAX and withCredentials: true in modern browsers

As of the Luminate Online Q1 2013 release, the API will now return the Access-Control-Allow-Credentials response header on pre-flight requests, allowing for sending cookies when making a request.

With this change, modern browsers should use AJAX with the withCredentials property set to true on the XHR object, in lieu of the current postMessage polyfill.

Add tags for Surveys

This will build on work done in v1.2 to allow for parsing tags to display constituent information.

One should be able to display a Survey on an external website using something like this:

<luminate:survey id="1234"></luminate:survey>

Decrease required version of jQuery to 1.4.4

Drupal ships out-of-the-box with jQuery 1.4.4, but luminateExtend currently requires jQuery 1.6.4+. While there are options for upgrading the version of jQuery used in Drupal, none of them are terribly simple. This issue will be used to track the changes to luminateExtend required to allow for backwards compatibility with jQuery 1.4.4.

  • luminateExtend.api.request() does not currently work with jQuery 1.4.4 when making a cross-domain request where requiresAuth is true. This is because the request method uses the xhrFields object available in jQuery.ajax as of jQuery 1.5 to set the withCredentials property to true. The request method will need to be enhanced to include the sessionCookie as part of the request URL when the version of jQuery is < 1.5.1.
  • The JavaScript included with the example AHS site currently uses jQuery.on for event handling. It should be updated to use jQuery.submit, jQuery.click, etc.

SimpleDateFormat: Shouldn't manually set March and May's capitalization

The capitalization of the months March and May as defined in formattedMonthNames are being override by the regular expression replace:

formattedPart = formattedPart.replace(/MMMM/g, formattedMonthNames[Number(dateParts.month) - 1])
                                     .replace(/MMM/g, formattedMonthNames[Number(dateParts.month) - 1]
                                                      .substring(0, 3))
                                     .replace(/MM/g, dateParts.month)
                                     .replace(/M/g, oneDigitNumber(dateParts.month))
                                     .replace(/march/g, 'March')
                                     .replace(/may/g, 'May');

This problem was noticed while running the tests for the es_US locale and prevents the test from completed successfully since expect( 'Mayo' ).toBe( 'mayo') is false.

@noahcooper Do you remember why this is this way?

Example callbacks

Noah,

I have some questions regarding interacting with the library after a submission is pushed to the API. I can see the JSON returned from Convio's Donation API, so I know the form (using the .bind method) is succeeding/failing correctly but I'm unclear on how I need to structure a callback to interact with that data.

Thanks!

Add tests for luminateExtend.utils.simpleDateFormat

Need to add test coverage for luminateExtend.utils.simpleDateFormat.

Some examples of patterns we should test:

No pattern (should result in default of 'M/d/yy')
'M/d/yy'
'MMMM d, yyyy'
'EEEE, MMMM d, yyyy'
'EEEE, MMMM d, yyyy, h:mma'
'h \'o\'\'clock\''
'h+3:mm'

Introduce custom event subscription

There are several common use cases where custom event subscription could prove useful when working with the API.

In v2.0, initial support will be added for a set of events including login and logout. For example, something like the following could be used to display an "Edit profile" link whenever a user logs in, and hide it when they log out.

$(document).on('luminateExtend.login', function() {
  $('#editProfile').show();
});

$(document).on('luminateExtend.logout', function() {
  $('#editProfile').hide();
});

Provide method for parsing "tags"

In order to simplify the process of adding components to external sites, the library should provide a method for parsing "tags" using the API.

In v1.2, the first tags will be added for displaying constituent info. Under the hood, this will use the getUser method to retrieve the logged in user's data.

For example, something like the following should show the logged in user's first name:

<luminate:cons field="name.first"></luminate:cons>

Future versions of the library will include comparable tags for things like embedding Surveys and Action Alerts.

init method throws "Object expected" error in IE if XMLHttpRequest is not enabled

In IE, under Tools -> Internet Options -> Advanced, there is an option "Enable native XMLHTTP support" which is checked by default. If a user has unchecked this option, then window.XMLHttpRequest is undefined. In v1.4, the init method was updated to use an instance of XHR to test for CORS support. This needs to be wrapped in a test to first confirm that window.XMLHttpRequest is defined.

Support jQuery v1.6.4

The library currently requires jQuery 1.7 due to its use of jQuery.on() in several places. The version of jQuery automatically included in Luminate Online, however, is 1.6.4, which pre-dates jQuery.on(). The library should be updated to fallback to using jQuery.bind() if jQuery.on() is unavailable, thus allowing the use of earlier versions of jQuery.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.