The preview of FB.ui feed method is not same when posted to the wall - facebook-javascript-sdk

I have created a simple APP and when I post the result to the wall by using 'FB.ui()' 'feed' method the resultant post on the is not same as the preview shown. The post on the wall truncated some lines from the preview. Again the see more link also is not there.Now my Question is Why this mismatch ??
The code for post to wall fb.ui method
method: 'feed',
link: 'https://apps.facebook.com/justflop/',
actions: [ { name: 'Flop of the Week', link: 'https://apps.facebook.com/justflop/'}],
properties: [
{ text: 'FLOP Friend :'+fr, href: 'https://www.facebook.com/<?php echo $friends[0]["uid"]; ?>'},
{ text: 'FLOP Lover :'+lo, href: 'https://www.facebook.com/<?php echo $lover[0]["uid"]; ?>'},
{ text: 'FLOP Enemy :'+en, href: 'https://www.facebook.com/<?php echo $enemy[0]["uid"]; ?>'}
],
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}

Don't use 3 "{text: ...}" params.
Use Name, Caption, and Description: https://developers.facebook.com/docs/reference/dialogs/feed/
When you use unsupported params or multiple params with the same key, you cannot expect the story to render predictably.

Related

Datatables AJAX.reload Callback data

When using Datatables (Ver: 1.10.16), I noticed that the data in the API is not updated immediately via ajax.reload in the callback even though the site says the callback is not called until the new data has arrived and been redrawn.
Notes up front:
All the data is formatted correctly and displays in the table before and after the ajax.reload, including the new data from the reload.
If I click reload twice, the api sees the new data properly and ApplyHeaderFilters works properly.
When I say the API seeing the data properly I mean like so:
$('#dtTbl').DataTable().column('1:visible').data().unique()
The ApplyHeaderFilters is the callback on ajax.reload and uses the above JS command to get unique values from the column. The data returned from the JS command are not reflecting the new data that is returned from the reload.
This is in the Document Ready:
batchDT = $('#dtTbl').DataTable( {
deferLoading: true,
pageLength: 25,
pagingType: 'simple_numbers',
scrollx: true,
initComplete: function () {
ApplyHeaderFilters($(this).attr('id'), this.api());
},
ajax: {
url: "mysite.cfm?method=gettabledata",
type: 'POST'
},
columns: [
{ title: "Description", name: "description", data: "description"},
{ title: "Is Active", name: "isactive", data: "isactive"},
{ title: "List Item ID", name: "listitemid", data: "listitemid"},
{ title: "Name", name: "name", data: "name"},
{ title: "Table Ref ID", name: "tablerefid", data: "tablerefid", orderable: false}
]
} );
$("#reload").on('click',function(){
batchDT.ajax.reload(ApplyHeaderFilters('dtTbl', $('#dtTbl').DataTable()));
});
For some reason the callback was being called before the reload was completed. I fixed this by wrapping my callback function in reload in an anon function. If anyone has ideas why this would be this way comment please. I have a feeling it has something to do with closures and how they are handling the callback in the datatables library.
$("#reload").on('click',function(){
batchDT.ajax.reload(function(){
ApplyHeaderFilters('dtTbl', $('#dtTbl').DataTable());
});
});

How to generate Items list with vue-paypal-checkout?

I am trying to generate an items list response from paypal checkout requests. I am trying to do it dynamically, using my data objects and some computed properties in a for in loop. As far as I have understood, my items_list will always need to be a data variable, never a hard-coded array.
Here is my template element:
<div v-bind:key="plan.key" v-for="plan in plans" >
<PayPal
:amount="plan.price" // all good
currency="GBP" // all good
:client="credentials" // all good
env="sandbox" // all good
:items="[plan]" // this is NOT working
#payment-authorized="payment_authorized_cb" // all good
#payment-completed="payment_completed_cb" // all good
#payment-cancelled="payment_cancelled_cb" // all good
>
</PayPal>
</div>
Here are my data objects on my script:
plans: {
smallPlan: {
name: 'Small Venue',
price: '6',
},
mediumPlan: {
name: 'Medium Department',
price: '22',
},
}
payment_completed: {
payment_completed_cb() {
}
},
payment_authorized: {
payment_authorized_cb() {
}
},
payment_cancelled: {
payment_cancelled_cb() {
}
},
Here are my methods:
methods: {
payment_completed_cb(res, planName){
toastr.success("Thank you! We'll send you a confirmation email soon with your invoice. ");
console.log(res);
},
payment_authorized_cb(res){
console.log(res);
},
payment_cancelled_cb(res){
toastr.error("The payment process has been canceled. No money was taken from your account.");
console.log(res);
},
The documentation of Vue-paypal-checkout is available here https://www.npmjs.com/package/vue-paypal-checkout
If I don't add the items list :items everything works perfectly:
{"id":"PAY-02N9173803167370DLPMKKZY","intent":"sale","state":"approved","cart":"90B34422XX075534E","create_time":"2018-10-30T18:39:51Z","payer":{"payment_method":"paypal","status":"VERIFIED","payer_info":{"email":"joaoalvesmarrucho-buyer#gmail.com","first_name":"test","middle_name":"test","last_name":"buyer","payer_id":"JCZUFUEQV33WU","country_code":"US","shipping_address":{"recipient_name":"test buyer","line1":"1 Main St","city":"San Jose","state":"CA","postal_code":"95131","country_code":"US"}}},"transactions":[{"amount":{"total":"245.00","currency":"GBP","details":{}},"item_list":{},"related_resources":[{"sale":{"id":"2RA79134UX2301839","state":"pending","payment_mode":"INSTANT_TRANSFER","protection_eligibility":"ELIGIBLE","parent_payment":"PAY-02N9173803167370DLPMKKZY","create_time":"2018-10-30T18:39:50Z","update_time":"2018-10-30T18:39:50Z","reason_code":"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION","amount":{"total":"245.00","currency":"GBP","details":{"subtotal":"245.00"}}}}]}]}
But if I add :items="[plan]" i get this error message:
Uncaught Error: Error: Request to post https://www.sandbox.paypal.com/v1/payments/payment failed with 400 error. Correlation id: 19238526650f5, 19238526650f5
{
"name": "VALIDATION_ERROR",
"details": [
{
"field": "transactions.item_list.items.item_key",
"issue": "This field name is not defined for this resource type"
}
],
"message": "Invalid request - see details",
"information_link": "https://developer.paypal.com/docs/api/payments/#errors",
"debug_id": "19238526650f5"
Any thoughts?
Also if you happen to know, is there a way to sell/implement a subscription instead of a one-off transaction using Vue-paypal-checkout?
Many thanks

Rally text field access issue

Developing custom HTML app using Rally:
I want to present a text box and pull value from the enterd data in it. How do i access the text in a rallytextfield while creating a custom html app using App SDK ?
Make sure you use the API docs provided - you can find information about a rallytextbox here.
Specifically, there is a method called:
getValue()
That you will find in the documentation - I think that is what you are looking for.
Here is a piece of code which is causing problems on this:
How do i access the value of the datepicker, i tried the .getValue. It is not able to get the value.Please help
Ext.define('CustomApp', {
extend: 'Rally.app.App', componentCls: 'app', id: 'appid', launch: function () {
var datepickerfrom = Ext.create('Ext.Container', {
id: 'datepickerfrom',
items: [{
xtype: 'rallytextfield',
fieldLabel: 'Enter text: ',
labelWidth: 10
}],
renderTo: Ext.getBody().dom
});
this.add(datepickerfrom);
button = {
xtype: 'rallybutton',
text: 'Generate Report',
handler: function () {
console.clear();
console.log(datepickerfrom.getRawValue());
},
};
});

Mongoose Post with Mixed/Geospatial Schemas

Hello i'm using Mongoose and Express to submit geospatial data for a map (GEOJSON).
I have a form which gets the longitude and latitude for a point and the user can then submit to save this point.
My form works if I hard code the values in the 'coordinates' part of my post route, but if I try to do req.body.longitude and req.body.latitude it doesnt post to the array and gets me a 'req not defined' error.
I picked up the basics of mongoose geojson here:
https://gist.github.com/aheckmann/5241574
How can I make this form save from req.body values in a mixed schema? Thanks.
My Schema
var schema = new Schema({
type: {type: String},
properties: {
popupContent: {type: String}
},
geometry: {
type: { type: String }
, coordinates: {}
}
});
schema.index({ geometry: '2dsphere' });
var A = mongoose.model('A', schema);
My Post Route
app.post('/api/map', function( request, response ) {
console.log("Posting a Marker");
var sticker = new A({
type: 'Feature',
properties: {
popupContent: 'compa'
},
geometry: {
type: 'Point',
coordinates: [req.body.longitude, req.body.latitude]
}
});
sticker.save();
return response.send( sticker );
res.redirect('/map')
});
My Clientside Form
form(method='post', action='/api/map')
input#popup(type="text", value="click a button", name="popup")
input#lng(type="text", value="click a button", name="longtude")
input#lat(type="text", value="click a button", name="latitude")
input(type="submit")
Your function signature states that there is no req parameter.
app.post('/api/map', function( request, response )
You should either rename your parameters in your signature or in the body.
app.post('/api/map', function(request, response) {
console.log("Posting a Marker");
var sticker = new A({
type: 'Feature',
properties: {
popupContent: 'compa'
},
geometry: {
type: 'Point',
coordinates: [request.body.longitude, request.body.latitude]
}
});
sticker.save();
return response.send(sticker);
});
Uh, just seen this thread is dusty. Well…

Sencha Touch 2: Call controller function from within Ext.Msg.confirm

I'm just getting started with Sencha Touch 2 and I have never worked with Sencha Touch 1.x before. I've just finished this tutorial (which is the best starter tutorial I have found so far) http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-1/ and now I want to go ahead and extend this Notes App.
I have a controller and 2 views, a list view and an edit view. In the edit view I want to be able to delete the current record. The delete function is in the controller. After tapping the delete button, I want to show a confirmation dialog ("Are you sure you want to delete...?"). After the user presses yes, the delete function should be called.
Now my problem is: How do I call the controllers delete function from within Ext.Msg.confirm?
Here are the relevant snippets of my code. Please let me know if something important is missing.
Please see the "onDeleteNoteCommand" function. "this.someFunction" obviously doesn't work since "this" is a DOMWindow.
Ext.define('TestApp2.controller.Main', {
extend: 'Ext.app.Controller',
config: {
refs: {
noteEditorView: 'noteeditorview'
},
control: {
noteEditorView: {
deleteNoteCommand: 'onDeleteNoteCommand',
}
}
},
onDeleteNoteCommand: function() {
console.log('onDeleteNoteCommand');
var noteEditor = this.getNoteEditorView();
var currentNote = noteEditor.getRecord();
Ext.Msg.confirm(
"Delete note?",
"Do you reall want to delete the note <i>"+currentNote.data.title+"</i>?",
function(buttonId) {
if(buttonId === 'yes') {
//controller functions!! how to call them?
this.deleteNote(currentNote);
this.activateNotesList();
}
}
);
},
deleteNote: function(record) {
var notesStore = Ext.getStore('Notes');
notesStore.remove(record);
notesStore.sync();
},
activateNotesList: function() {
Ext.Viewport.animateActiveItem(this.getNotesListView(), this.slideRightTransition);
},
slideLeftTransition: { type: 'slide', direction: 'left' },
slideRightTransition: { type: 'slide', direction: 'right' },
launch: function() {
this.callParent();
Ext.getStore('Notes').load();
console.log('launch main controller');
},
init: function() {
this.callParent();
console.log('init main controller');
}
});
When you enter callback function of Ext.Msg the scope changes from controller scope to global scope (window), so you must set up it as parameter of confirm method:
Ext.Msg.confirm(
"Delete note?",
"Do you reall want to delete the note <i>"+currentNote.data.title+"</i>?",
function(buttonId) {
if(buttonId === 'yes') {
this.deleteNote(currentNote);
this.activateNotesList();
}
},
this // scope of the controller
);
For more info please check sencha docs: http://docs.sencha.com/touch/2-0/#!/api/Ext.MessageBox-method-confirm