Single image picker for Umbraco 7 - media

Im not sure if Im missing something here.. but when I create a new data-type called Single Media Picker in umbraco 7 and uses the new Media Picker-property editor and keep the "multiple selections option" unchecked.. I am still able to select multiple images in the media picker-dialog..and once selected.. they all show up in my property-filed as well.. any ideas of why?.. guess its a bug in Umbraco.. and if thats the case.. anyone have a clue of how to limit the media-picker to a single selection for my own custom property editor?
Thanks in advance!

It depends a bit on how you use the media picker in your custom property editor. We're using the media picker in a completely separate tree for which we generate the JSON that yields the editor ourselves.
The property data that generates a single item picker looks a bit like this:
{
"label" : "Some Image",
"description" : "423 x 258px",
"view" : "mediapicker",
"config" : {
"multiPicker" : "0"
},
"hideLabel" : false,
"id" : 4,
"value" : "1092",
"alias" : "imageIdProperty"
}
Notice the config section. You could try to inspect the data that goes to the client and see what JSON is used to generate your picker.

Related

Wix Code filter not working

Im new to wix code. I created a simple database with a title field and some other fields as a test.
I created a text edit box so i can type in a search text, and a grid object so i can see the results.
I connect the grid to the data base and all the fields such as image, description etc.
Then i run the preview mode without typing anything, the grid shows all the table elements.
When i type into the search, even if i type something that is in the table, the grid is blank, seems the filter doesnt work??
Anybody knows why???
here is my code attached to the page
import wixData from "wix-data"
$w.onReady(function () {
});
export function iAddress_keyPress(event, $w) {
filter($w('#iAddress').value); // iAddress is the name of the input text box
}
function filter(title) {
$w('#dataset1').setFilter(wixData.filter().contains('Title',title));
}
Simple. This is problem:
contains('Title',title)
Title - it's "name" of the column. You should use "field name" from collection, it's displayed when you press "manage properties" on some column - it's actually id.
In your case, "title" is correct field name (as it's default)
Your example will work with this:
contains('title',title)

Redefine data packet in Kendo UI grid edit popup

I think this is an advance topic in Kendo UI.
I have a Kendo UI grid and I added a custom edit popup to update the data in the grid.
My data packet like this :
{
fieldOne : "valueOne";
fieldTwo : "valueTwo";
fieldThree : [{a : "someValue", b : "someValue"}]
}
In edit popup I will edit this data.
But I have a new requirement that add a new value to fieldThree.
My new Data packet will look like this...
{
fieldOne : "valueOne";
fieldTwo : "valueTwo";
fieldThree : [{a : "someValue", b : "someValue"},{a : "someValue", b : "someValue"}]
}
What I have done is I made a custom popup and custom fields for that.
But my question is how I redefine the data packet to above one ??
In Kendo UI it will only update existing values...
The edit event gets fired when you click the button to open the popup and has access to the model.
You may be able to do something like this:
edit: function(e)
{
e.model.fieldThree.push({
a: "someValue",
b: "someValue"
});
}
That kind of what you are trying to do?

No config.adapter.idAttribute specified for table "books" in Titanium Appcelerator

I am new very new to appcelerator. And while following quick start guide, I cannot produce the build on iOS simulator, even after exactly copy pasting the code in the required models and controllers.
Console gives me following info:
No config.adapter.idAttribute specified for table "books"
Adding "alloy_id" to uniquely identify rows
Simulator stops at the default splash screen and nothing happens after that.
Can gurus walk me through this?
When you edited controllers/index.js you probably erased everything that was there and not only the doClick() function.
You need to leave $.index.open(); at the end of the file, or you will get
No config.adapter.idAttribute specified for table "books" error
Your code should look like this:
var myBooks = Alloy.Collections.books;
var book = Alloy.createModel('books', {
title : 'Great Expectations',
author: 'Charles Dickens'
});
myBooks.add(book);
book.save();
$.index.open();
Hope this helps
Are you stuck at the first build stage? If so check out my answer here:
Appcelerator Dev Questions - favebooks tutorial
It's because nothing is being called to launch the app when it initially loads so it hangs at the splash screen, the model is fine, it's the index.js and index.xml you need to look at.
Do you have add idAttribute in your model like this ?
Model exemple :
exports.definition = {
config: {
columns: {
"id":"integer",
"version": "integer"
},
adapter: {
type: "sql",
collection_name: "version",
idAttribute:'id'
}
},

Photo_reference from Google Places Api

I saw that the json response from google places returns a field photo_reference. Does anyone know how to get the image associated?
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "320d77fa60610f618058bd58b8ba46e340c615b8",
"name" : "The Meat & Wine Co",
"opening_hours" : {
"open_now" : true
},
"photos" : [
{
"height" : 968,
"html_attributions" : [],
"photo_reference" : "CoQBeQAAAAgOdveT3dRtzoJ42BTBZfCdZptWsqLN3bROkP4FVHNNX-qjxBiw0vdGpDaX_lVb3rcaQf5hBVvrEdMUMDKB2gcsIOaVNII_zLvY-5Kf4rOuTXElOgSHb5vxJoB-o70Oh0Bs-zxxUpHM0Ji_BPk2RpXoKdf8jG_QLPaulXWoC7TcEhDSLjj-4_l3hJpD0W_qBtoMGhT1MK1GRVFH1dnJolimMP7Z8a2tZA",
"width" : 1296
}
],
"rating" : 3.90,
google also providing place photo api to retrieve photo from google map using photo_reference
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=photo_reference&key=AddYourOwnKeyHere
key :- pass your application api key here.
maxwidth & maxheight :- the maximum desired height or width when it will returned by api
photoreference :- pass your photo reference here.
send request to this api. and it will return you image.
image type will be depend upon the type of the originally submitted photo.
for more info goto :- https://developers.google.com/places/documentation/photos
I've been wondering the same thing. I read about the Picasa API, that seems like a logical storage place for these images.
UPDATED 03-13-2013
This feature has been released as part of the Places API. See the link for documentation. https://developers.google.com/places/documentation/photos
Interpolate the photo_reference value in a HTML img tag
var photo_reference_goes_here = ['icon']['photos'][0]['photo_reference']
<img class="rig-img" src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=photo_reference_goes_here&key=GOOGLE_KEY" alt="Pic From Google">

Passing url dynamically to the filebrowser button in ckeditor

I am customizing the functionality of ckeditor image upload. The user sees a dropdown with different options. Depending upon the option selected from the dropdown the "Browse Server" button should take the user to corresponding url.
So basically I need to dynamically pass the browse server url (which has chosen from a drop down list) to the filebrowser of Image Upload functionality of CK Editor 3.4.1 gem.
Example:
I am having a select box in the Image Info Tab for that I have added the following code.
{
type : 'select',
id : 'url_path',
items :
[
[ 'Add photos from My Computer', '' ],
[ 'Add photos from My Album', 'http://localhost:3000/pages/'],
],
onChange:function(){
L=this.getValue();
}
Browse Button code looks like this
{
type:'button',
id:'browse',
style:'display:inline-block;',
align:'center',
label:b.lang.common.browseServer,
hidden:true,
filebrowser :
{
action : 'Browse',
url : '',
target : 'info:txtUrl'
}
}
Here the url value has to set according to the value of select box. How can I configure that ?
Regards,
Pankaj

Resources