I'm trying to create a site where, like Digg, a user can submit a link and using ajax it attempts to pull the metadata from the page into a title and description field. The user can change either of these fields then submit the content.
Ideally a module already exists. I tried playing around with Feeds, but I'm not sure if I'm looking in the right place.
I probably have to create my own custom module.
Any suggestions? Can I tap into the Feeds API just to parse the url then take the results and do all the mapping myself? Assuming I want to create my own form and bring in my own ajax.
You could probably do that with Feeds, but I think it might be overkill and could be difficult to configure.
You could do what you're looking for in a relatively small custom module using hook_form_alter to customize the submission form, arg() to determine the URL being submitted, drupal_http_request to retrieve the page, then the Form API's #default_value setting to pre-populate the field(s).
The Prepopulate module does a lot of what you're looking for. If it provides hooks (I'm not sure if it does) all you would need to do is add the drupal_http_request, to handle fetching the metadata.
In Drupal it's called Drigg ;). It is supposed to a nice Drupal module to get the functionality of Digg. It will be worth a try I suppose.
Related
I have 2 scripts - one to fire on open trigger, and one to fire on save, I'm not sure which one would work best with function scope etc...
But basically, users are sent to the survey form using a public link, and additional info is added to that link in the form of parameters/queries, such as:
booking=123456
start-at=1429952400
item=1702
I'm trying to have the script save these parameters, or even the entire URL that was used to open the form, preferably on the same row as the survey response, but even if the user doesn't submit the form, I would still like to save the URL as a non-completed survey (hence the on-open and on-save triggers).
I looked into:
function doGet(e) {},
function URL(text) {},
function doPost(e) {},
even console.log(params); and console.log(e);
as well as others and I cannot seem to get access to the URL.
What gives? Should I just code this on my own server and run my own form? I would really like to figure out google scripting but it seems just too cumbersome at this point. Any help or solution would be highly appreciated.
To be clear, I don't think I can use a pre-filled url, because I don't know that parameter values ahead of time, and I don't think you can use hidden fields for pre-filled anyway.
From the question
What gives? Should I just code this on my own server and run my own form? I would really like to figure out google scripting but it seems just too cumbersome at this point. Any help or solution would be highly appreciated.
To be clear, I don't think I can use a pre-filled url, because I don't know that parameter values ahead of time, and I don't think you can use hidden fields for pre-filled anyway.
A prefilled-url could be used to set the answers to all the questions in a Google Form.
Please bear in mind that Google Forms doesn't support hidden questions in the sense of an HTML form does, the way that you could do this is by putting the question on a section that the form response flow never show it but on the prefill view all the sections are displayed.
Regarding using Google Apps Script to handle Google Forms a custom URL query string that is not supported, so if that is a deal-breaker, then you should use other options.
If you like so much Google Apps Script you could use it to create a web application as doGet pass the URL query string / parameters to the server side code and also you could grab them from the client-side code by using the HTML Service.
When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.
We're looking to create a tool to help with time management in Redmine. The issue we are currently having is that we want to get a list of issues that are watched by a particular user but can't find an API for it. Does anyone know if this is possible or are we just going to have to try and modify Redmine directly?
SOLUTION: Similar to the solution provided below by dmf85, I found a solution to this problem that worked for me. The Issues API takes a query_id as one of its parameters. What I ended up doing was filtering my issues by Watcher (like dmf85 said) then saving the query. I then used the query_id from that saved custom query in my API call.
At least in Redmine 3.1, there’s an undocumented parameter for the Issues API that allows you to specify a watcher directly: watcher_id. It works just like assigned_to_id, you can pass either a user ID (i.e. watcher_id=23) or the special string me (i.e. watcher_id=me).
An example of URL could be like the following: https://example.com/redmine/issues.json?watcher_id=me&key=redmine_api_key
Under your issues tab in the interface, click:
add filter
watcher
select a watcher in the box
Then, click the atom, csv, or pdf link at the bottom for a link that you can write a program to consume at your discretion.
Does this help?
For an event in a couple of weeks I'd like to make an web page/app which display tweets from a specific user, a specific hashtag and all #reply's at the first user in 3 boxes on the screen.
However I've never tried this. I want to use either .NET (C#) or HTML/CSS/JS since I'm proficient in those. Are there any libraries/API's I can use? Or is there an readily available freeware/open-source app I can use?
Have you seen TweetSharp?
Use Twitter's profile and search widgets. Profile for the first box, a search of the hash tag for the second box, and a search of to:username for the third box.
I actually just posted this as an answer to another question:
I just updated a plugin to work with the Twitter 1.1 API. Unfortunately, per Twitter's urging, you will have to perform the actual request from server-side code. However, you can pass the response to the plugin and it will take care of the rest. I don't know what framework you are running, but I have already added sample code for making the request in C#, and will be adding sample code for PHP, shortly.
The plugin makes a call to statuses/user_timeline, but you will likely want to look at statuses/filter or statuses/search, instead. All you will have to do is add your desired parameters (hashtag, replies, etc.) to the server-side code and it should work (with the addition of your security keys and tokens, of course).
Good luck! :)
I'm trying to create an ajax-driven gallery where each photo in a sequence is loaded with an Ajax.Actionlink.
The user can get to any given photo by passing a parameter to the action method, eg: Gallery/Index?photo=100
The problem is that when the user is cycling through photos with the Ajax.Actionlink's the URL is no longer being updated (the way it would be during normal post-backs) so they can't copy paste from the address bar to get back to a photo.
My question is: what is the best way to solve this issue in ASP.NET MVC? One thing I was thinking of was updating the address bar with hashtags, but frankly I don't know if this is a good approach.
I could use some best-practice advice on how to solve this problem. Any suggestions would be much appreciated, thank you.
If you really want to update the address bar with each ajax update there are a couple of jquery / javascript libraries you can use as described in this blog post: http://stephenwalther.com/archive/2010/04/08/jquery-asp-net-and-browser-history
However, the best practice solution is usually not to try and fake something like this (its only going to go wrong). If you want to give your users the ability to share or link to a photo is to provide a field with the appropriate url or permalink to the url that they can copy from. Google maps has a good example of this - if you wanted to share a map with someone else.
I would look into rewriting your routes to include the photo ID in the path.
E.g., /Gallery/Index/100 instead of ?photo=100. This would be why your ActionLink methods aren't working how they should, as the querystring isn't part of the route.