what format blueimp-gallery.add expects for list parameter - gallery

I tried to load additional slides to my blueimp-gallery instance collected by infinityscroll using a callback and the galler.add()-method. In the blueimp-gallery readme there is a just a list parameter listed to the .add(list) method but I can't figure out what kind of list it expects.
Could be a list of a-tags or list list of javascript-objects, I couldn't get it work.

ok found it out, it's a array of html-nodes like or jquery selector

Related

How to loop a "Multiple String" from a ProductBO object in an ISML-Template?

How can I loop a Multiple String from a ProductBO object? What is the best way to do this?
As long as you know the name of the attribute you may use the following method on ProductBO from within an ISML:
public AttributeValue getAttributeValue(String aName);
The storefront app comes with a convenient albeit not extremely flexible module that is able to display AV-s. It works for multiple attributes too. The name of the module is ISCustomAttribute.
Sample usage:
<isCustomAttribute
attributelabel="#AttributeDescriptor:DisplayName#"
attributevalue="#ProductBO:AttributeValue(AttributeDescriptor:ID)#"
attributeseparator=", ">
The best would be if you use this module. You may see it in action. Custom ProductBO attributes are printed on the product details page in the storefront as the next image shows (#see DetailsTab.isml):
If this does not fit, you will have to retrieve the attribs as something iterable. The way I think fits best is to use the BO extension BusinessObjectAttributes. You will be able retrieve a BusinessObjectAttribute by name from it and loop through its value.
<isloop iterator="BusinessObjectAttribute:Value" alias="AValue" counter="counter">
<!--- Do something gorgeous here --->
</isloop>

Adding fields dynamically to Share form

I want to add a text field for each file that is added to the attached package items in alfresco to write notes regarding each file, is it possible to do?
I have implemented something that could be reused for your use case.
You can define a property with multiple values that will contain the list of notes associated with each attachment.
There is a simple trick to post a property with multiple values: add "[]" to the name of the property. For example:
<input id="template_x002e_edit-metadata_x002e_edit-metadata_x0023_default_prop_someco_notes_0"
name="prop_someco_notes[]"
tabindex="0"
type="text"
value="Meeting minutes"
title="Notes"
noderef="workflow://...."
>
<input id="template_x002e_edit-metadata_x002e_edit-metadata_x0023_default_prop_someco_notes_1"
name="prop_someco_notes[]"
tabindex="1"
type="text"
value="Meeting minutes"
title="Notes"
noderef="workflow://...."
>
As you can see, the name of the input ends with []. Both input textfields have the same name.
The Alfresco Form Engine will consider these two inputs as the value for the property with multiple values: "someco:notes".
The bigger problem is that you need to generate this html with some smart javascript and free marker template.
You can write a custom free marker template to render the initial html: if a user opens a task on which documents have been already attached, you will need to generate the list of inputs using a custom control (you can of course start from textfield.ftl).
It won't be easy to generate the initial list because unfortunately Alfresco returns the list of values as a single comma separated value.
You can customise the webscript that injects the model in the free marker template "org.alfresco.web.scripts.forms.FormUIGet" to pass an array instead of a csv.
A quicker and dirtier solution is to split the csv value. In share-config-custom.xml, you can specify what textfield.ftl show use as a separator instead of the comma.
When a user adds/remove elements from the package, you can intercept the update and add/remove the correspondent note. Notice that I have added the filed "noderef" to each input so it is possible to know the relation between the notes and the nodes in the package.
UPDATE:
For the associations (used for example to define the package in a workflow task), Share uses a javascript library called "object finder" (or "object picker"). This library fires an event called "formValueChanged" that you can intercept:
YAHOO.Bubbling.fire("formValueChanged",
{
eventGroup: this,
addedItems: addedItems,
removedItems: removedItems,
selectedItems: selectedItems,
selectedItemsMetaData: Alfresco.util.deepCopy(this.selectedItems)
});

Yahoo Pipes - Build an RSS-URL using specific parameters pulled from another RSS feed's content

The main Data Type used by Yahoo Pipes is the [Item], which is RSS feed content. I want to take an RSS's content or sub-element, make it into [Text] (or a number might work), and then use it as an INPUT into a [Module] to build a RSS-URL with specific parameters. I will then use the new RSS-URL to pull more content.
Could possibly use the [URL Builder Module] or some work-around.
The key here is using "dynamic" data from an RSS feed (not user input, or a static data), and getting that data into a Data Type that is compatible (and/or accessible) as an INPUT into a module.
It seems like a vital functionality, but I cannot figure it out. I have tried many, many work-around attempts, with no success.
The Specific API and Methods (if you are interested)
Using the LastFM API.
1st Method: user.getWeeklyChartList. Then pick the "from" (start) and "to" (end) Unix timestamps from 1 year-ago-today.
2nd Method: user.getWeeklyAlbumChart using those specific (and "dynamic") timestamps to pull my top albums for that week.
tl;dr. Build an RSS-URL using specific parameters from another RSS feed's content.
I think I may have figured it out. I doubt it is the best way, but it works. The problem was the module I needed to use didn't have and input node. But the Loop module has an input node, so if I embed the URL builder into the Loop module I can then access sub-element content from the 1st feed to use as parameters to build the URL for the 2nd feed! Then I can just scrap all the extra stuff generated by the Loop, by using Truncate.

How can I ask the state for a content object?

At the end of this tutorial several object attributes are listed. But I need access to the state (published, private,...). I also search that attribute using dir() but I don't see an attribute named as state or something similar. i.e, I need something like this:
>>> app.Plone.foo.bar.state
"published"
Or to keep your code more readable and not having to remember strange method names, you can use plone.api to do this:
from plone import api
api.content.get_state(obj=your_object)
Of course, you need to add plone.api to your eggs first, and re-run buildout.
You can always use the plone_workflow to determine current status:
workflowTool = getToolByName(self.portal, "portal_workflow")
status = workflowTool.getStatusOf("plone_workflow", object)
# where "object" is your content object
print (status)
Unfortunately there is no "state" attribute. Instead, check review_state using the workflow tool e.g.:
>>> app.Plone.portal_workflow.getInfoFor(app.Plone.foo.bar, "review_state")

filter functions problem

I'm working on a search component for an app I'm working on and I needed to add some filters to it. I've found an example and got the first filter working fine.
Now I'm trying to add a second filter I'm running into problems... In the example I found they use filterFunctions, but I only get an option for filterFunction, why is that?
Here's the example code
productsCollection.filterFunctions =
[
filterByPrice, filterByType,
filterByCondition, filterByVendor
]
And this is what I'm trying
acData.filterFunction = [filterByStatus, filterByDate]
but with this code I get the following error message - 1067: Implicit coercion of a value of type Array to an unrelated type Function.
Why am I getting this error and how would I go about add multiple filters to my Array Collection?
Thanks!
filterFunction must be set to a single function, not an Array or any other datatype. To combine multiple functions create one that combines them, like this:
acData.filterFunction = function(item:Object)
{
return
filterByPrice(item) &&
filterByType(item) &&
filterByCondition(item) &&
filterByVendor(item);
};
If you saw a sample that used filterFunctions plural that accepted an array, post a link. That's not anywhere in the standard Flex framework or in the new 4.0 beta afaik.
It looks like you are going to have to extend an arraycollection to make it work. this link should spell it out for you: http://blog.rotundu.eu/flex/arraycollection-with-multiple-filter-functions/

Resources