Adding properties to uploaded content in Alfresco - metadata

I am using Alfresco Web Quick Start to create a basic CMS website. I was wondering if someone could explain how to add properties/metadata to content which I have uploaded. For example if I have a gallery of images (with the default metadata of Author, Published, Size and Mime Type) and wanted to have a data taken property etc, how would I implement this?
I have done some research but am yet to find a concrete solution, any help on this matter would be greatly appreciated! Thanks!

The available metadata for a given node in Alfresco are dictated by its type and aspects.
Alfresco already ships with an EXIF aspect (look here for "exif:exif") you might want to use for your use case, which unfortunately the WCM QS hides. You should create a share-config-custom.xml file (sample here, official docs) which should list all the fields from the exif:exif aspect you want to expose.
Something like the following should work:
<config evaluator="model-type" condition="exif:exif">
<forms>
<form>
<field-visibility>
<show id="exif:dateTimeOriginal"/>
</field-visibility>
</form>
</forms>
</config>

It is a royal pain in the ass.
First you need to create a Model. Inside that model you need to create an Aspect. All this goes in XML file #1.
Then you need a context file to register the aspect. This is XML file #2.
And a properties files to give the aspect a friendly name.
And a web-site-custom-config to list all of the properties that were listed in XML file 1. This is XML file #3
And you need a share-custom-config. This has a different format from XML file #3, but serves the same purpose.
And finally you need to create a rule that automatically applies the aspect to each item in a folder.
Reference: http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/
share-custom-config.xml
<alfresco-config>
<!-- Repository Library config section -->
<config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
<!--
Whether the link to the Repository Library appears in the header component or not.
-->
<visible>true</visible>
</config>
<config evaluator="string-compare" condition="DocumentLibrary">
<!--
Used by the "Manage Aspects" action
For custom aspects, remember to also add the relevant i18n string(s)
cm_myaspect=My Aspect
-->
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="my:sampleProps" />
<aspect name="ac:androidContentProps" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
</config>
<config evaluator="node-type" condition="cm:content">
<forms>
<form>
<field-visibility>
<!-- fields from my example aspect -->
<show id="my:propOne" />
<show id="my:propTwo" />
<show id="my:propInt" />
<show id="my:propFloat" />
<show id="my:propDateTime" />
<show id="my:propDate" />
<show id="my:propBoolean" />
<show id="my:propQName" />
<show id="my:propCategory" />
<show id="my:propNodeRef" />
<show id="my:propPath" />
<!-- fields for android content -->
<show id="ac:propNotify" />
<show id="ac:propNotificationSummary" />
<show id="ac:propArchiveDate" />
<show id="ac:propPublishDate" />
<show id="ac:propPriority" />
<show id="ac:propRegion" />
<show id="ac:propMarket" />
<show id="ac:propDistrict" />
<show id="ac:propStore" />
</field-visibility>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="Remote">
<remote>
<endpoint>
<id>alfresco-noauth</id>
<name>Alfresco - unauthenticated access</name>
<description>Access to Alfresco Repository WebScripts that do not require authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>none</identity>
</endpoint>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-feed</id>
<name>Alfresco Feed</name>
<description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
<connector-id>http</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<basic-auth>true</basic-auth>
<identity>user</identity>
</endpoint>
<endpoint>
<id>activiti-admin</id>
<name>Activiti Admin UI - user access</name>
<description>Access to Activiti Admin UI, that requires user authentication</description>
<connector-id>activiti-admin-connector</connector-id>
<endpoint-url>http://localhost:8080/alfresco/activiti-admin</endpoint-url>
<identity>user</identity>
</endpoint>
</remote>
</config>
</alfresco-config>

Related

Ionic 3 Deep link opening any link issue

I have an Ionic 3 app, I installed the ionic-plugin-deeplinks plugin and it works for what I want. When I press on a certain link in an email, it opens my app and redirects it to the necessary page. However, I have some URL on the web version of the app that has target="_blank" on them. Whenever I click on those, it opens the app instead of a new tab. I don't want it to open the app or ask me to open the app in those situations because it has nothing to do with the app. Just open the link in a new tab. I've tried a million things but I can't find any solution sadly...
Here's my code in config.xml.
<plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
<variable name="URL_SCHEME" value="myapp123" />
<variable name="DEEPLINK_SCHEME" value="https" />
<variable name="DEEPLINK_HOST" value="app.myapp123.com" />
<variable name="ANDROID_PATH_PREFIX" value="/" />
<variable name="ANDROID_2_PATH_PREFIX" value="/" />
<variable name="ANDROID_3_PATH_PREFIX" value="/" />
<variable name="ANDROID_4_PATH_PREFIX" value="/" />
<variable name="ANDROID_5_PATH_PREFIX" value="/" />
<variable name="DEEPLINK_2_SCHEME" value=" " />
<variable name="DEEPLINK_2_HOST" value=" " />
<variable name="DEEPLINK_3_SCHEME" value=" " />
<variable name="DEEPLINK_3_HOST" value=" " />
<variable name="DEEPLINK_4_SCHEME" value=" " />
<variable name="DEEPLINK_4_HOST" value=" " />
<variable name="DEEPLINK_5_SCHEME" value=" " />
<variable name="DEEPLINK_5_HOST" value=" " />
</plugin>
I want this link to act normally
Random URL
but this link to ask or open the Ionic app
Random URL
Is there a way to set this up?
I use another plugin to achieve the same:
<plugin name="cordova-plugin-customurlscheme" spec="^4.3.0">
<variable name="URL_SCHEME" value="myapp123" />
</plugin>
After that you can create links like "myapp123://path-to-page".
So the protocol is "myapp123" instead of https.
In that way URL's like https://app.myapp123.com/ won't be caught anymore by your app.
More info on installation can be found here:
https://github.com/EddyVerbruggen/Custom-URL-scheme
One warning though: ionic 3 deeplinking for reset password : there seems to be an issue when using this technique in combination with gmail.

Cordova - internal hyperlinks always open in Safari

I'm very new to Cordova, so it may be that I don't fully understand its purpose. Let me start with what I'm trying to achieve overall.
We have an asp.net website that has mobile support, that I'm basically just trying to wrap with an iPhone app. The site of course runs on an IIS server, so I just want a thin wrapper to launch the site, and remove the address bar, navigation, etc. It's my understanding that you can achieve that with the Cordova hybrid approach.
I followed the tutorial, and got the site to launch within an xCode iPhone Simulator, and it came up just like I wanted to.
The problem I'm having is that hyperlinks within the site launch the target page in a Safari browser. And from all of my googling, it seems like this is the opposite problem most people have. It seems like most people struggle with external sites opening within the app, which basically locks them out of their app. I'm just trying to go from Page1 to Page2 on my own site within the app.
I was able to reproduce this problem with the simplest of sites, so I'll post the relevant bits. In this example, clicking on "Page 2" will open up in Safari.
Asp.net site:
Page1.html
<html>
Page 2
</html>
Page2.html
<html>
Page 2
</html>
Cordova:
Index.html
<!DOCTYPE html>
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
</head>
<body>
Cordova site
</body>
<script>
window.location = "http://192.168.1.157:8081/Page1.html";
</script>
</html>
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="vsisolutions.testsite" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Test Site</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="http://192.168.1.157:8081/*" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="~4.1.1" />
<plugin name="com.msopentech.authdialog" spec="~0.1.6" />
</widget>
Thanks for the help!
This was a bug
It was fixed on latest released version of cordova-ios 4.2.0
So you don't have to do any hack to make it work anymore, just have to use the allow-navigation tag to set the urls you want to allow to navigate inside the app, and the rest of them will open in safari as you have allow-intent set for all http and https urls.
I found that in Cordova the WKWebView plugin (it could be occurring in the UIWebView as well) asks around for any other plugins to see if they can use URL on the link. This was being picked up by the CDVIntentAndNavigationFilter and running through the logic as in:
- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType: (UIWebViewNavigationType)navigationType
{
NSURL* url = [request URL];
switch (navigationType) {
case UIWebViewNavigationTypeLinkClicked:
// Note that the rejection strings will *only* print if
// it's a link click (and url is not whitelisted by <allow-*>)
if ([self.allowIntentsWhitelist URLIsAllowed:url]) {
// the url *is* in a <allow-intent> tag, push to the system
[[UIApplication sharedApplication] openURL:url];
return NO;
}
// fall through, to check whether you can load this in the webview
default:
// check whether we can internally navigate to this url
return ([self.allowNavigationsWhitelist URLIsAllowed:url]);
}
}
Because the navigationType == UIWebViewNavigationTypeLinkClicked it was passing it off to the browser via [[UIApplication sharedApplication] openURL:url];
Currently I have only found a hack around this and that is to override this logic by treating links in the same way i.e. like so:
switch (navigationType) {
case UIWebViewNavigationTypeLinkClicked:
// Note that the rejection strings will *only* print if
// it's a link click (and url is not whitelisted by <allow-*>)
if ([self.allowIntentsWhitelist URLIsAllowed:url]) {
// the url *is* in a <allow-intent> tag, push to the system
// [[UIApplication sharedApplication] openURL:url];
return YES;
}
// fall through, to check whether you can load this in the webview
default:
// check whether we can internally navigate to this url
return ([self.allowNavigationsWhitelist URLIsAllowed:url]);
}
}
This is obviously not ideal and I'll ask around on the Cordova forum for a better solution which I'll post here once I find it.
Page 2
This should work.
Just changing allow-navigation to append with * worked:
<allow-navigation href="http://yourwebsite/*" />

Making Phone Call Ionic App

I'm using this code in the view:
<a href="tel:{{doc.emergency}}" class="button phone button-full" >Phone Call</a>
And I can't make the call.
This is my config.xml
<access origin="tel:*" launch-external="yes" />
<allow-intent href="tel:*" />
For me the following works:
<access origin="tel:*" launch-external="yes"/>
<allow-intent href="tel:*" />
<allow-navigation href="tel:*" />
A similar question was asked here.
Try using the native plugin:
https://ionicframework.com/docs/native/call-number/
You can create a function that receive the phone number as a parameter.

How to add facebook og:meta tags in LAYOUT.xml in magento?

I want to insert Facebook og:meta tags to use for facebook sharer ,in a head of a particular page and this page is not a CMS page.I am thinking of adding these tags through that extension layout file.
I know normal titles and description are added like this ->
<reference name="head">
<action method="setTitle"><title>My Module Page</title></action>
</reference>
Does magento provides something like this for Facbook og:meta tags?If not ,what is/are the other method to put og:meta tags in the head of a page so that it work with facebook sharer.
<reference name="head">
<block type="core/text" name="blockname">
<action method="setText">
<text>
<![CDATA[<meta property="og:image" content="http://example.com/image.jpg"/>]]>
</text>
</action>
</block>
</reference>
Magento doesn't include an action to include these meta tags. Instead, you could create a template file (/app/design/frontend/mypackage/mytheme/page/html/facebookmeta.phtml) with your meta tags in it.
Then, add the following to your head reference:
<block type="core/template" name="facebookmeta" template="page/html/facebookmeta.phtml" />
Clear your caches and you should see your block being included into the head for that particular page. It's not a particularly extendable solution, if you want to pass options to this template you should really create a new block, which requires creating a new module etc.
However, in your template file you can use PHP, so you should be able to get various variables you need, for example:
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>"/>
Hope this helps.

Cooliris wall fed by Picassa web albums?

I am trying to expose picassa web album by using Picassa web albums.
Following example creates wall with only 2 pictures which represents 2 album main photos:
<object id="o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="600" height="450">
<param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<embed type="application/x-shockwave-flash"
src="http://apps.cooliris.com/embed/cooliris.swf"
flashvars="feed=api://picasaweb.google.com/?user=davidinjp"
width="600"
height="450"
allowFullScreen="true"
allowScriptAccess="always">
</embed>
</object>
How it's possible to show all pictures from all albums? Seems like Cooliris does not support this, using Media RSS cross domain issue arises:
<object id="o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="600" height="450">
<param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<embed type="application/x-shockwave-flash"
src="http://apps.cooliris.com/embed/cooliris.swf"
flashvars="feed=http://picasaweb.google.com/data/feed/base/user/davidinjp?alt=rss&kind=photo&hl=en_GB&access=public"
width="600"
height="450"
allowFullScreen="true"
allowScriptAccess="always">
</embed>
</object>
Coolris reference:
http://www.cooliris.com/developer/reference/media-site-apis/
#jeffamaphone Thanks, this is what I've done. I have created simple PHP that mirrors feed on my host:
<?php
$content= file_get_contents('http://picasaweb.google.com/data/feed/base/user/USERNAME?alt=rss&kind=photo&hl=en_GB&access=public');
echo $content;
?>
Added crossdomain.xml.
Pointed feed to local PHP mirroring script.
Unfortunately what you want to do doesn't have very good support in the Cooliris embed wall. What is supported (for Picasa) is:
Get photos of user (grid of albums displayed)
Get photos of user from a specific album
Get photos matching a search term
The good news is we have tentatively scheduled these improvements to Picasa support in an upcoming release (though you know how things can change in Software development).
In the mean time, if you have personal hosting available, the dirty work-around is to make a duplicate of the feed, setup crossdomain.xml to work with *.cooliris.com and pull it from there. Not really optimal, but it will work until we add the support you need.
And to get the full out of that code, you should add a &max-results=1000 after the access=public.
It took me 2 hours to get that :D