From 3630ec06f00e95d2dd3da7bd09456ae138ae1de1 Mon Sep 17 00:00:00 2001 From: Tyler Frankenstein Date: Thu, 13 Oct 2016 23:31:09 -0400 Subject: [PATCH] Update binaries. --- bin/drupalgap.js | 207 +++++++++++++++++-------------------------- bin/drupalgap.min.js | 12 +-- 2 files changed, 88 insertions(+), 131 deletions(-) diff --git a/bin/drupalgap.js b/bin/drupalgap.js index e3c9828a..7c8409fb 100644 --- a/bin/drupalgap.js +++ b/bin/drupalgap.js @@ -4415,76 +4415,54 @@ function drupalgap_goto(path) { * @param {Object} options * @param {Object} menu_link The menu link object from drupalgap.menu_links. */ -function drupalgap_goto_generate_page_and_go( - path, page_id, options, menu_link) { +function drupalgap_goto_generate_page_and_go(path, page_id, options, menu_link) { try { - // @TODO using a page.tpl.html is pretty dumb, this makes a disc read on each page change, use render arrays only - // be deprecating the page.tpl.html file, converting it to a render array and warning developers to upgrade their - // themes. - var page_template_path = path_to_theme() + '/page.tpl.html'; - if (!drupalgap_file_exists(page_template_path)) { - console.log( - 'drupalgap_goto_generate_page_and_go - ' + - 'page template does not exist! (' + page_template_path + ')' - ); - } + // First see if the theme implements hook_page_tpl_html() and use its string for the page placeholders, + // otherwise use the file read method from DrupalGap's early days, and notify the developer to upgrade + // their theme. + var html = ''; + var themeName = drupalgap.settings.theme; + var pageTplHtmlFunctionName = themeName + '_page_tpl_html'; + if (function_exists(pageTplHtmlFunctionName)) { html = window[pageTplHtmlFunctionName](); } else { + var pageTemplatePath = path_to_theme() + '/page.tpl.html'; + console.log('@deprecated: ' + pageTemplatePath + ' - use ' + pageTplHtmlFunctionName + '() in ' + + themeName + '.js instead, see: http://docs.drupalgap.org/7/Themes/Create_a_Custom_Theme'); + html = drupalgap_file_get_contents(pageTemplatePath); + } - // Reset the internal query string. - _drupalgap_goto_query_string = null; - - // If options wasn't set, set it as an empty JSON object. - if (typeof options === 'undefined') { options = {}; } - - // Load the page template html file. Determine if we are going to cache - // the template file or not. - // @TODO another disc read here, dumb, use render arrays and deprecate. - var file_options = {}; - if (drupalgap.settings.cache && - drupalgap.settings.cache.theme_registry !== 'undefined' && - !drupalgap.settings.cache.theme_registry) { - file_options.cache = false; - } - var html = drupalgap_file_get_contents(page_template_path, file_options); - - if (html) { - - // Add page to DOM. - drupalgap_add_page_to_dom({ - page_id: page_id, - html: html, - menu_link: menu_link - }); + // Reset the internal query string. + _drupalgap_goto_query_string = null; - // Setup change page options if necessary. - if (drupalgap_path_get() == path && options.form_submission) { - options.allowSamePageTransition = true; - } + // If options wasn't set, set it as an empty JSON object. + if (typeof options === 'undefined') { options = {}; } - // Let's change to the page. Web apps and the ripple emulator do not - // seem to like the 'index.html' prefix, so we'll remove that. - var destination = 'index.html#' + page_id; - if ( - drupalgap.settings.mode != 'phonegap' || - typeof parent.window.ripple === 'function' - ) { destination = '#' + page_id; } - $.mobile.changePage(destination, options); // @see the pagebeforechange handler in page.inc.js + // Add page to DOM. + drupalgap_add_page_to_dom({ + page_id: page_id, + html: html, + menu_link: menu_link + }); - // Invoke all implementations of hook_drupalgap_goto_post_process(). - module_invoke_all('drupalgap_goto_post_process', path); - } - else { - drupalgap_alert( - 'drupalgap_goto_generate_page_and_go - ' + - t('failed to load theme\'s page.tpl.html file') - ); - } + // Setup change page options if necessary. + if (drupalgap_path_get() == path && options.form_submission) { + options.allowSamePageTransition = true; } + + // Let's change to the page. Web apps and the ripple emulator do not + // seem to like the 'index.html' prefix, so we'll remove that. + var destination = 'index.html#' + page_id; + if ( + drupalgap.settings.mode != 'phonegap' || + typeof parent.window.ripple === 'function' + ) { destination = '#' + page_id; } + $.mobile.changePage(destination, options); // @see the pagebeforechange handler in page.inc.js + + // Invoke all implementations of hook_drupalgap_goto_post_process(). + module_invoke_all('drupalgap_goto_post_process', path); } - catch (error) { - console.log('drupalgap_goto_generate_page_and_go - ' + error); - } + catch (error) { console.log('drupalgap_goto_generate_page_and_go - ' + error); } } /** @@ -5698,10 +5676,8 @@ function drupalgap_add_page_to_dom(options) { id: options.page_id, 'data-role': 'page' }; - attributes = - $.extend(true, attributes, options.menu_link.options.attributes); - attributes['class'] += - ' ' + drupalgap_page_class_get(drupalgap.router_path); + attributes = $.extend(true, attributes, options.menu_link.options.attributes); + attributes['class'] += ' ' + drupalgap_page_class_get(drupalgap.router_path); options.html = options.html.replace( /{:drupalgap_page_attributes:}/g, drupalgap_attributes(attributes) @@ -6160,18 +6136,13 @@ function drupalgap_render(content) { // If the output came back as a string, we can render it as is. If the // output came back as on object, render each element in it through the // theme system. - if (output_type === 'string') { - // The page came back as an html string. - html = content; - } + if (output_type === 'string') { html = content; } else if (output_type === 'object') { // The page came back as a render object. Let's define the names of // variables that are reserved for theme processing. var render_variables = ['theme', 'view_mode', 'language']; - if (content.markup) { - return content.markup; - } + if (content.markup) { return content.markup; } if (content.theme && !drupalgap.theme_registry[content.theme]) { return theme(content.theme, content); } @@ -6179,63 +6150,49 @@ function drupalgap_render(content) { // Is there a theme value specified in the content and the registry? if (content.theme && drupalgap.theme_registry[content.theme]) { - // Extract the theme object template and determine the template file - // name and path. - var template = drupalgap.theme_registry[content.theme]; - var template_file_name = content.theme.replace(/_/g, '-') + '.tpl.html'; - var template_file_path = template.path + '/' + template_file_name; - - // Make sure the template file exists. - // @TODO disc read here, replace with render array! - if (drupalgap_file_exists(template_file_path)) { - - // Loads the template file's content into a string. - // @TODO there is a disc read here, it is slow for UX! Deprecate via a render array. - var template_file_html = drupalgap_file_get_contents(template_file_path); - if (template_file_html) { - - // What variable placeholders are present in the template file? - var placeholders = drupalgap_get_placeholders_from_html(template_file_html); - if (placeholders) { - - // Replace each placeholder with html. - for (var index in placeholders) { - if (!placeholders.hasOwnProperty(index)) { continue; } - var placeholder = placeholders[index]; - var _html = ''; - if (content[placeholder]) { - // Grab the element variable from the content. - var element = content[placeholder]; - // If it is markup, render it as is, if it is themeable, - // then theme it. - if (content[placeholder].markup) { - _html = content[placeholder].markup; - } - else if (content[placeholder].theme) { - _html = theme(content[placeholder].theme, element); - } - // Now remove the variable from the content. - delete content[placeholder]; - } - // Now replace the placeholder with the html, even if it was - // empty. - template_file_html = template_file_html.replace('{:' + placeholder + ':}', _html); + var themeName = drupalgap.settings.theme; + var tplHtmlFunctionName = themeName + '_' + content.theme + '_tpl_html'; + template_file_html = ''; + if (function_exists(tplHtmlFunctionName)) { template_file_html = window[tplHtmlFunctionName](); } + else { + var template = drupalgap.theme_registry[content.theme]; + var template_file_name = content.theme.replace(/_/g, '-') + '.tpl.html'; + var template_file_path = template.path + '/' + template_file_name; + console.log('@deprecated: ' + template_file_path + ' - use ' + tplHtmlFunctionName + '() in ' + + themeName + '.js instead, see: http://docs.drupalgap.org/7/Themes/Create_a_Custom_Theme'); + template_file_html = drupalgap_file_get_contents(template_file_path); + } + + // What variable placeholders are present in the template file? + var placeholders = drupalgap_get_placeholders_from_html(template_file_html); + if (placeholders) { + + // Replace each placeholder with html. + for (var index in placeholders) { + if (!placeholders.hasOwnProperty(index)) { continue; } + var placeholder = placeholders[index]; + var _html = ''; + if (content[placeholder]) { + // Grab the element variable from the content. + var element = content[placeholder]; + // If it is markup, render it as is, if it is themeable, then theme it. + if (content[placeholder].markup) { + _html = content[placeholder].markup; } + else if (content[placeholder].theme) { + _html = theme(content[placeholder].theme, element); + } + // Now remove the variable from the content. + delete content[placeholder]; } - else { - // There were no place holders found, do nothing, ok. - } - - // Finally add the rendered template file to the html. - html += template_file_html; - } - else { - console.log('drupalgap_render - failed to get file contents (' + template_file_path + ')'); + // Now replace the placeholder with the html, even if it was empty. + template_file_html = template_file_html.replace('{:' + placeholder + ':}', _html); } } - else { - console.log('drupalgap_render - template file does not exist (' + template_file_path + ')'); - } + + // Finally add the rendered template file to the html. + html += template_file_html; + } else { diff --git a/bin/drupalgap.min.js b/bin/drupalgap.min.js index bc69facb..a41fbdc4 100644 --- a/bin/drupalgap.min.js +++ b/bin/drupalgap.min.js @@ -1,7 +1,7 @@ /*! drupalgap 2016-10-13 */ -function drupalgap_init(){var a={modules:{core:[{name:"comment"},{name:"contact"},{name:"entity"},{name:"field"},{name:"file"},{name:"image"},{name:"menu"},{name:"mvc"},{name:"node"},{name:"search"},{name:"system"},{name:"taxonomy"},{name:"user"},{name:"views"}]},module_paths:[],includes:[{name:"block"},{name:"common"},{name:"form"},{name:"go"},{name:"menu"},{name:"page"},{name:"region"},{name:"theme"},{name:"title"}],online:!1,destination:"",api:{},back:!1,back_path:[],blocks:[],connected:!1,content_types_list:{},date_formats:{},date_types:{},entity_info:{},field_info_fields:{},field_info_instances:{},field_info_extra_fields:{},form_errors:{},form_states:[],loading:!1,loader:"loading",locale:{},messages:[],menus:{},menu_links:{},menu_router:{},mvc:{models:{},views:{},controllers:{}},output:"",page:{jqm_events:[],title:"",variables:{},process:!0,options:{}},pages:[],path:"",remote_addr:null,router_path:"",services:{},sessid:null,settings:{},site_settings:{},taxonomy_vocabularies:!1,theme_path:"",themes:[],theme_registry:{},toast:{shown:!1},views:{ids:[]},views_datasource:{}};return Drupal.cache_expiration||(Drupal.cache_expiration={}),Drupal.cache_expiration.forms||(Drupal.cache_expiration.forms={}),a}function drupalgap_onload(){try{window.location.hash="";for(var a=["drupalgap","block","comment","contact","entity","field","file","image","menu","mvc","node","search","system","taxonomy","user","views"],b=0;b0)for(var d=0;d",{rel:"stylesheet",href:a}).appendTo("head")}catch(b){console.log("drupalgap_add_css - "+b)}}function drupalgap_load_blocks(){try{drupalgap.blocks=module_invoke_all("block_info")}catch(a){console.log("drupalgap_load_blocks - "+a)}}function drupalgap_load_locales(){try{if("undefined"==typeof drupalgap.settings.locale)return;for(var a in drupalgap.settings.locale)if(drupalgap.settings.locale.hasOwnProperty(a)){var b=(drupalgap.settings.locale[a],"locale/"+a+".json");drupalgap_file_exists(b)&&(drupalgap.locale[a]=drupalgap_file_get_contents(b,{dataType:"json"}))}for(var c=module_implements("locale"),d=0;d=g){var h=Math.floor(a/g);e+=(e?" ":"")+drupalgap_format_plural(h,f[0],f[1]),-1!=e.indexOf("@count")&&(e=e.replace("@count",h)),a%=g,b--}if(0==b)break}return e?e:"0 sec"}catch(i){console.log("drupalgap_format_interval - "+i)}}function drupalgap_format_plural(a,b,c){return 1==a?b:c}function drupalgap_function_exists(a){try{return function_exists(a)}catch(b){console.log("drupalgap_function_exists - "+b)}}function drupalgap_get_placeholders_from_html(a){try{var b=!1;return a&&(b=a.match(/(?!{:)([\w]+)(?=:})/g)),b}catch(c){console.log("drupalgap_get_placeholders_from_html - "+c)}}function drupalgap_get_title(){try{return drupalgap.page.title}catch(a){console.log("drupalgap_get_title - "+a)}}function drupalgap_get_ip(){try{return drupalgap.remote_addr}catch(a){console.log("drupalgap_get_ip - "+a)}}function drupalgap_get_wildcards_from_router_path(a){var b=!1;return b}function drupalgap_image_path(a){try{var b=!1,c=module_implements("image_path_alter");if(c)for(var d in c)if(c.hasOwnProperty(d)){var e=c[d],f=module_invoke(e,"image_path_alter",a);if(f){b=!0,a=f;break}}if(b)return a;var g=Drupal.settings.site_path+Drupal.settings.base_path+a;return-1!=g.indexOf("public://")?g=g.replace("public://",Drupal.settings.file_public_path+"/"):-1!=g.indexOf("private://")&&(g=g.replace("private://",Drupal.settings.file_private_path+"/")),g}catch(h){console.log("drupalgap_image_path - "+h)}}function drupalgap_includes_load(){try{if(null!=drupalgap.includes&&0!=drupalgap.includes.length)for(var a in drupalgap.includes)if(drupalgap.includes.hasOwnProperty(a)){var b=drupalgap.includes[a],c="includes/"+b.name+".inc.js";jQuery.ajax({async:!1,type:"GET",url:c,data:null,success:function(){Drupal.settings.debug&&dpm(c)},dataType:"script",error:function(a,b,c){console.log(c)}})}}catch(d){console.log("drupalgap_includes_load - "+d)}}function drupalgap_item_list_populate(a,b){try{$(a).html("");for(var c=0;c",{html:b[c]}));$(a).listview("refresh").listview()}catch(d){console.log("drupalgap_item_list_populate - "+d)}}function drupalgap_table_populate(a,b){try{a+="> tbody ",$(a).html("");for(var c=0;c"+d[f]+"";$("").html(e).appendTo($(a))}$(a).rebuild()}catch(g){console.log("drupalgap_table_populate - "+g)}}function drupalgap_jqm_page_event_fire(a,b,c){try{var d=a+"-"+b;if("undefined"!=typeof arguments[3]&&arguments[3]&&(d+="-"+arguments[3]),-1==$.inArray(d,drupalgap.page.jqm_events)&&drupalgap_function_exists(b)){drupalgap.page.jqm_events.push(d);var e=window[b];c?($.isArray(c)||(c=[c]),e.apply(null,Array.prototype.slice.call(c))):e()}}catch(f){console.log("drupalgap_jqm_page_event_fire - "+f)}}function drupalgap_jqm_page_events(){return["pagebeforechange","pagebeforecreate","pagebeforehide","pagebeforeload","pagebeforeshow","pagechange","pagechangefailed","pagecreate","pagehide","pageinit","pageload","pageloadfailed","pageremove","pageshow"]}function drupalgap_jqm_page_event_script_code(a){try{a.page_id||(a.page_id=drupalgap_get_page_id()),a.jqm_page_event||(a.jqm_page_event="pageshow");var b='"'+a.jqm_page_event+'", "'+a.jqm_page_event_callback+'", '+a.jqm_page_event_args;return arguments[1]&&(b+=', "'+arguments[1]+'"'),'"}catch(c){console.log("drupalgap_jqm_page_event_script_code - "+c)}}function drupalgap_max_width(){try{var a=parseInt($(".ui-content").css("padding"));return isNaN(a)&&(a=16),$(document).width()-2*a}catch(b){console.log("drupalgap_max_width - "+b)}}function drupalgap_menu_access(a,b){try{if(1==Drupal.user.uid)return!0;var c=!1;if(drupalgap.menu_links[a])if("undefined"==typeof drupalgap.menu_links[a].access_callback)if(drupalgap.menu_links[a].access_arguments){if($.isArray(drupalgap.menu_links[a].access_arguments))for(var d in drupalgap.menu_links[a].access_arguments)if(drupalgap.menu_links[a].access_arguments.hasOwnProperty(d)){var e=drupalgap.menu_links[a].access_arguments[d];if(c=user_access(e))break}}else c=!0;else{var f=drupalgap.menu_links[a].access_callback;if(function_exists(f)){var g=window[f];if(drupalgap.menu_links[a].access_arguments){var h=drupalgap.menu_links[a].access_arguments.slice(0);if(arguments[2]){var i=arguments[2];for(var d in h)if(h.hasOwnProperty(d)){var j=h[d];if(is_int(parseInt(j))){h[d]=i;break}}}else for(var k=0;k0){for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];"%"==h&&(d||(d=[]),d.push(g))}if(d&&d.length>0){for(var g in d)if(d.hasOwnProperty(g)){var i=d[g];e[i]&&(f[i]=e[i])}b=f.join("/")}}}return b}catch(j){console.log("drupalgap_place_args_in_path - "+j)}}function drupalgap_path_has_entity_arg(a){try{return a.length>1&&("comment"==a[0]||"file"==a[0]||"node"==a[0]||"taxonomy"==a[0]&&("vocabulary"==a[1]||"term"==a[1])||"user"==a[0]||"item"==a[0])?!0:!1}catch(b){console.log("drupalgap_path_has_entity_arg - "+b)}}function drupalgap_remove_page_from_dom(a){try{$("#"+a).empty().remove()}catch(b){console.log("drupalgap_remove_page_from_dom - "+b)}}function drupalgap_restart(){try{location.reload()}catch(a){console.log("drupalgap_restart - "+a)}}function drupalgap_set_title(a){try{a&&(drupalgap.page.title=a)}catch(b){console.log("drupalgap_set_title - "+b)}}function drupalgap_services_preprocess(a){try{drupalgap_loading_message_show()}catch(b){console.log("drupalgap_services_preprocess - "+b)}}function drupalgap_services_postprocess(a,b){try{drupalgap_loading_message_hide()}catch(c){console.log("drupalgap_services_postprocess - "+c)}}function drupalgap_services_request_pre_postprocess_alter(a,b){try{if("system"==a.service&&"connect"==a.resource)drupalgap.remote_addr=b.remote_addr,drupalgap.entity_info=b.entity_info,drupalgap.field_info_instances=b.field_info_instances,drupalgap.field_info_fields=b.field_info_fields,drupalgap.field_info_extra_fields=b.field_info_extra_fields,drupalgap.taxonomy_vocabularies=drupalgap_taxonomy_vocabularies_extract(b.taxonomy_vocabularies),drupalgap_service_resource_extract_results({service:a.service,resource:a.resource,data:b});else if("user"!=a.service||"logout"!=a.resource&&"login"!=a.resource&&"register"!=a.resource){if(in_array(a.resource,["create","update","delete"])&&in_array(a.service,entity_types())){var c=a.entity_type,d=a.entity_id,e=a.bundle||null,f=[];if("create"!=a.resource){var g=c;in_array(c,["taxonomy_vocabulary","taxonomy_term"])&&(g=g.replace("_","/",g)),f.push(g+"/"+d),f.push(g+"/"+d+"/view"),f.push(g+"/"+d+"/edit")}else switch(c){case"node":f.push("node/add/"+e)}switch(c){case"node":f.push("node");break;case"taxonomy_vocabulary":f.push("taxonomy/vocabularies");break;case"user":f.push("user-listing")}var h=[];for(var i in f)if(f.hasOwnProperty(i)){var j=f[i];h.push(drupalgap_get_page_id(j))}for(var i in h)if(h.hasOwnProperty(i)){var k=h[i];drupalgap_remove_page_from_dom(k)}}}else drupalgap_remove_pages_from_dom()}catch(l){console.log("drupalgap_services_request_pre_postprocess_alter - "+l)}}function drupalgap_settings_load(){try{console.log("WARNING: drupalgap_settings_load() is deprecated!")}catch(a){console.log("drupalgap_settings_load - "+a)}}function drupalgap_theme_registry_build(){try{var a=module_implements("theme");for(var b in a)if(a.hasOwnProperty(b)){var c=a[b],d=c+"_theme",e=window[d],f=e();for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];h.path=drupalgap_get_path("theme",drupalgap.settings.theme),drupalgap.theme_registry[g]=h}}}catch(i){console.log("drupalgap_theme_registry_build - "+i)}}function variable_set(a,b){try{return b?is_int(b)?b=b.toString():"object"==typeof b&&(b=JSON.stringify(b)):b=" ",window.localStorage.setItem(a,b)}catch(c){drupalgap_error(c)}}function variable_get(a,b){try{var c=window.localStorage.getItem(a);return c||(c=b)," "==c&&(c=""),c}catch(d){drupalgap_error(d)}}function variable_del(a){try{return window.localStorage.removeItem(a)}catch(b){drupalgap_error(b)}}function date_yyyy_mm_dd_hh_mm_ss(){try{var a;return a=arguments[0]?arguments[0]:date_yyyy_mm_dd_hh_mm_ss_parts(),a.year+"-"+a.month+"-"+a.day+" "+a.hour+":"+a.minute+":"+a.second}catch(b){console.log("date_yyyy_mm_dd_hh_mm_ss - "+b)}}function date_yyyy_mm_dd_hh_mm_ss_parts(){try{var a=[],b=null;b=arguments[0]?arguments[0]:new Date;var c=""+b.getFullYear(),d=""+(b.getMonth()+1);1==d.length&&(d="0"+d);var e=""+b.getDate();1==e.length&&(e="0"+e);var f=""+b.getHours();1==f.length&&(f="0"+f);var g=""+b.getMinutes();1==g.length&&(g="0"+g);var h=""+b.getSeconds();return 1==h.length&&(h="0"+h),a.year=c,a.month=d,a.day=e,a.hour=f,a.minute=g,a.second=h,a}catch(i){console.log("date_yyyy_mm_dd_hh_mm_ss_parts - "+i)}}function date_number_of_days_in_month(a,b){try{var c=new Date(a,b,0);return c.getDate()}catch(d){console.log("date_number_of_days_in_month - "+d)}}function scrollToElement(a,b,c){try{b="undefined"!=typeof b?b:1e3,c="undefined"!=typeof c?c:0,element=$(a),offset=element.offset(),offsetTop=offset.top+c,$("html, body").animate({scrollTop:offsetTop},b)}catch(d){console.log("scrollToElement - "+d)}}function theme_autocomplete(a){try{var b="",c=null;c="undefined"!=typeof a.field_info_field?a.field_info_field.field_name+"_"+a.delta:"undefined"!=typeof a.attributes.id?a.attributes.id:user_password(),a.autocomplete_id=c,_theme_autocomplete_variables[c]={},$.extend(!0,_theme_autocomplete_variables[c],a);var d=!1;a.remote&&(d=!0),a.remote=d,_theme_autocomplete_remote[c]=a.remote;var e=null;a.attributes.id?e=a.attributes.id:(e="autocomplete_"+user_password(),a.attributes.id=e);var f={id:e};a.element&&"undefined"!=typeof a.element.default_value&&(f.value=a.element.default_value),b+=theme("hidden",{attributes:f});var g=e+"-list",h={attributes:{id:g,"data-role":"listview","data-filter":"true","data-inset":"true","data-filter-placeholder":"..."}},i="";a.remote?(h.items=[],i+=''):(h.items=_theme_autocomplete_prepare_items(a),h.attributes["data-filter-reveal"]=!0);var j="#"+drupalgap_get_page_id()+" #"+e+' + form.ui-filterable input[data-type="search"]';return i+='",a.default_value_label&&(i+=drupalgap_jqm_page_event_script_code({page_id:drupalgap_get_page_id(),jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_autocomplete_set_default_value_label",jqm_page_event_args:JSON.stringify({selector:j,default_value_label:a.default_value_label})},e)),b+=theme("item_list",h),b+=i}catch(k){console.log("theme_autocomplete - "+k)}}function _theme_autocomplete(a,b,c,d){try{var e=_theme_autocomplete_variables[d];if("undefined"==typeof e.filter)return void console.log('_theme_autocomplete - A "filter" was not supplied.');var f="undefined"!=typeof e.value,g="undefined"!=typeof e.label;if(!f&&!g)return void console.log('_theme_autocomplete - A "value" and/or "label" was not supplied.');f?g||(e.label=e.value):e.value=e.label;var h=$(a),i=$(c.input),j=i.val(),k="";if(h.html(""),j&&j.length>0&&!e._searching){e._searching=!0,h.html('
  • '),h.listview("refresh"),_theme_autocomplete_success_handlers[d]=function(a,b,c,d){try{if(e._searching=!1,0==b.length){if(e.empty_callback){var f=window[e.empty_callback];f(j)}}else{var g=[],i=e.value,l=e.label;for(var m in b)if(b.hasOwnProperty(m)){var n=b[m],o=null;o=c?n[d]:n;var p={value:o[i],label:o[l]};g.push(p)}if(0!=g.length){e.items=g;var q=_theme_autocomplete_prepare_items(e);for(var m in q)if(q.hasOwnProperty(m)){var p=q[m];k+="
  • "+p+"
  • "}h.html(k),h.listview("refresh"),h.trigger("updatelayout")}}if(e.finish_callback){var f=window[e.finish_callback];f(j)}}catch(r){console.log("_theme_autocomplete_success_handlers["+a+"] - "+r)}};var l=null;switch(l=e.custom?e.handler?e.handler:e.field_info_field&&e.field_info_field.settings.handler?e.field_info_field.settings.handler:"views":e.field_info_field?e.field_info_field.settings.handler:"views"){case"views":var m=e.path+"?"+e.filter+"="+encodeURIComponent(j);e.params&&(m+="&"+e.params),views_datasource_get_view_result(m,{success:function(a){var b=!0;e.custom&&(b=!1);var c=null;c=b?a[a.view.root]:a;var f=_theme_autocomplete_success_handlers[d];f(d,c,b,a.view.child)}});break;case"base":case"og":var n=e.field_info_field.settings,o=n.target_type+"_index";if(!drupalgap_function_exists(o))return void console.log("WARNING - _theme_autocomplete - "+o+"() does not exist!");var p={fields:[e.value,e.filter],parameters:{},parameters_op:{}};p.parameters[e.filter]="%"+j+"%",p.parameters_op[e.filter]="like";var q=entityreference_get_target_bundles(n);q&&(p.parameters[entity_get_bundle_name(n.target_type)]=q.join(",")),window[o](p,{success:function(a){_theme_autocomplete_success_handlers[d](d,a,!1)}});break;case"index":if(!e.entity_type)return void console.log("WARNING - _theme_autocomplete - no entity_type provided");var r=e.entity_type+"_index",s=window[r],t=null;if(e.query)t=e.query;else{t={parameters:{},parameters_op:{}};var u=[entity_primary_key(e.entity_type),entity_primary_key_title(e.entity_type)];"taxonomy_term"==e.entity_type&&e.vid&&(t.parameters.vid=e.vid),t.fields=u,t.parameters[e.filter]="%"+j+"%",t.parameters_op[e.filter]="like"}s.apply(null,[t,{success:function(a){var b=_theme_autocomplete_success_handlers[d];b(d,a,!1,null)}}]);break;default:if(!l)return void console.log("WARNING - _theme_autocomplete - no handler provided")}}else $("#"+e.id).val("")}catch(v){console.log("_theme_autocomplete - "+v)}}function _theme_autocomplete_prepare_items(a){try{var b=[];a.items&&(b=a.items);var c=[];if(b.length>0)for(var d in b)if(b.hasOwnProperty(d)){var e=b[d],f="",g="";"string"==typeof e?(f=e,g=e):(f=e.value,g=e.label);var h={attributes:{value:f,onclick:"_theme_autocomplete_click('"+a.attributes.id+"', this, '"+a.autocomplete_id+"')"}},i=l(g,null,h);c.push(i)}return c}catch(j){console.log("_theme_autocomplete_prepare_items - "+j)}}function _theme_autocomplete_click(a,b,c){try{var d=a+"-list";if($("#"+a).val($(b).attr("value")),$(_theme_autocomplete_input_selector[c]).val($(b).html()),_theme_autocomplete_remote[c]?$("#"+d).html(""):($("#"+d+" li").addClass("ui-screen-hidden"),$("#"+d).listview("refresh")),_theme_autocomplete_variables[c].item_onclick&&drupalgap_function_exists(_theme_autocomplete_variables[c].item_onclick)){var e=window[_theme_autocomplete_variables[c].item_onclick];e(a,$(b))}}catch(f){console.log("_theme_autocomplete_click - "+f)}}function _theme_autocomplete_set_default_value_label(a){try{setTimeout(function(){$(a.selector).val(a.default_value_label).trigger("create")},250)}catch(b){console.log("_theme_autocomplete_set_default_value_label - "+b)}}function drupalgap_block_load(a){try{var b=null;if(drupalgap.blocks)for(var c in drupalgap.blocks)if(drupalgap.blocks.hasOwnProperty(c)){var d=drupalgap.blocks[c];if(d[a]){b=d[a];break}}if(null==b){var e="drupalgap_block_load - "+t("failed to load")+' "'+a+'" '+t("block!");drupalgap_alert(e)}return b}catch(f){console.log("drupalgap_block_load - "+f)}}function drupalgap_block_render(a,b,c,d,e){try{var f="",g=!1;if(d.access_callback&&drupalgap_function_exists(d.access_callback)){var h=window[d.access_callback];g=h({path:b,delta:c,region:a.name,theme:drupalgap.settings.theme,settings:d})}else drupalgap_check_visibility("block",d)&&(g=!0,"main"==c||"offline"!=b&&"error"!=b||(g=!1));if(g){var i=drupalgap_block_load(c);e&&e.block_count++,menu_load(c)&&e&&e.block_menu_count++,i&&(f=module_invoke(i.module,"block_view",c,a))}return"string"==typeof f?f:drupalgap_render(f)}catch(j){console.log("drupalgap_block_render - "+j)}}function drupalgap_attributes(a){try{var b="";if(a)for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b+=""!=d?c+'="'+d+'" ':c+" "}return b}catch(e){console.log("drupalgap_attributes - "+e)}}function drupalgap_check_visibility(a,b){try{var c=!0;if("undefined"==typeof b)console.log("drupalgap_check_visibility - WARNING - no data provided for type ("+a+")");else if("undefined"!=typeof b.roles&&b.roles&&b.roles.value&&0!=b.roles.value.length){for(var d in b.roles.value)if(b.roles.value.hasOwnProperty(d)){var e=b.roles.value[d];if(drupalgap_user_has_role(e)?("include"==b.roles.mode&&(c=!0),"exclude"==b.roles.mode&&(c=!1)):("include"==b.roles.mode&&(c=!1),"exclude"==b.roles.mode&&(c=!0)),c)break}}else if("undefined"!=typeof b.pages&&b.pages&&b.pages.value&&0!=b.pages.value.length){var f=drupalgap_path_get(),g=f.split("/");for(var h in b.pages.value)if(b.pages.value.hasOwnProperty(h)){var i=b.pages.value[h];if(""==i&&(i=drupalgap.settings.front),i==f){"include"==b.pages.mode?c=!0:"exclude"==b.pages.mode&&(c=!1);break}if(-1!=i.indexOf("*")){var j=drupalgap_get_menu_link_router_path(f);if(j.replace(/%/g,"*")==i){"include"==b.pages.mode?c=!0:"exclude"==b.pages.mode&&(c=!1);break}var k=i.split("/"),l=!0;if(0==k.length)l=!1;else if(k.length==g.length)for(var m=0;m'+k.title+""}}return b}catch(m){console.log("_drupalgap_form_render_elements - "+m)}}function _drupalgap_form_render_element(a,b){try{var c="";if(!b)return c;var d=b.name,e=language_default(),f=!1,g=!1,h=!1,i=!1;if(b.is_field?(f=b[e],g=b.field_info_instance.widget.module):(f={0:b},g=drupalgap_form_element_get_module_name(b.type)),g&&(h=g+"_field_widget_form",drupalgap_function_exists(h)?i=window[h]:console.log("WARNING: _drupalgap_form_render_element() - "+h+'() does not exist for the "'+b.type+'" form element!')),!f||0==f.length)return c;var j={attributes:{}};j.field_info_field=b.field_info_field,j.field_info_instance=b.field_info_instance;var k=0,l="",m="",n=null;for(var k in f)if(f.hasOwnProperty(k)){var o=f[k];if(n=!0,j.attributes.id=o.id,j.element=o,f[k].children||(f[k].children=[]),b.is_field&&0==k&&(o.title=b.title,m=theme("form_element_label",{element:o})),0==k&&"undefined"!=typeof b.title_placeholder&&b.title_placeholder&&"undefined"==typeof j.attributes.placeholder){var p=b.title;j.attributes.placeholder=p}if(o.default_value||(o.default_value=""),j.attributes.value=o.default_value,"undefined"==typeof o.value||"undefined"!=typeof j.attributes.value&&!empty(j.attributes.value)||(j.attributes.value=o.value),i&&(i.apply(null,[a,null,b.field_info_field,b.field_info_instance,e,f,k,b]),o=$.extend(!0,o,f[k]),!o.type&&b.type&&(o.type=b.type)),o.options&&o.options.attributes&&(j.attributes=$.extend(!0,j.attributes,o.options.attributes)),l+=_drupalgap_form_render_element_item(a,b,j,o),"undefined"!=typeof j.default_value&&delete j.default_value,"undefined"!=typeof j.default_value_label&&delete j.default_value_label,"undefined"!=typeof j.value&&delete j.value,"undefined"==typeof l){n=!1;break}}if(!n)return"";var q=!0;"undefined"==typeof b.wrapped||b.wrapped||(q=!1),"hidden"==b.type&&(q=!1,b.wrapped&&(q=!0)),b.prefix&&(c+=b.prefix);var r={"class":drupalgap_form_get_element_container_class(d)};return q&&(c+="
    "),"submit"!=b.type&&"hidden"!=b.type&&("undefined"!=typeof b.title_placeholder&&b.title_placeholder||(c+=b.is_field?m:theme("form_element_label",{element:b}))),""!=l&&(c+=l),b.description&&"hidden"!=b.type&&(c+='
    '+t(b.description)+"
    "),q&&(c+="
    "),b.suffix&&(c+=b.suffix),c}catch(s){console.log("_drupalgap_form_render_element - "+s)}}function _drupalgap_form_render_element_item(a,b,c,d){try{var e="";switch(d.type){case"text":d.type="textfield";break;case"list_text":case"list_float":case"list_integer":d.type="select"}var f=d.type;if(b.disabled&&(c.attributes.disabled=""),"submit"==d.type&&(c.attributes.onclick="_drupalgap_form_submit('"+a.id+"');",c.attributes["data-theme"]||(c.attributes["data-theme"]="b"),"undefined"==typeof c.attributes.type&&(c.attributes.type="button"),"undefined"==typeof c.attributes["class"]&&(c.attributes["class"]=""),c.attributes["class"]+=" dg_form_submit_button "),$.extend(!0,c,d),("undefined"==typeof c.value||null==c.value)&&"undefined"!=typeof d.default_value&&(c.value=d.default_value),drupalgap_function_exists("theme_"+f))e+=theme(f,c);else{if(!d.markup&&""!=d.markup){var g="Field "+d.type+" not supported.";return console.log("WARNING: _drupalgap_form_render_element_item() - "+g),dpm(d),null}e+=d.markup}if(d.children&&d.children.length>0)for(var h=0;hdrupalgap_form_render() - missing form id!

    "+JSON.stringify(a);$("form#"+a.id).length&&$("form#"+a.id).remove();var b=a.prefix;empty(b)||(b='
    '+b+"
    ");var c=a.suffix;empty(c)||(c='
    '+c+"
    ");var d=_drupalgap_form_render_elements(a),e=drupalgap_attributes(a.options.attributes),f='
    "+b+'
    '+d+c+"
    ";return f}catch(g){console.log("drupalgap_form_render - "+g)}}function drupalgap_form_set_error(a,b){try{drupalgap.form_errors[a]=b}catch(c){console.log("drupalgap_form_set_error - "+c)}}function drupalgap_get_form(a){try{var b="",c=drupalgap_form_load.apply(null,Array.prototype.slice.call(arguments));if(c)b=drupalgap_form_render(c);else{var d="drupalgap_get_form - "+t("failed to get form")+" ("+a+")";drupalgap_alert(d)}return b}catch(e){console.log("drupalgap_get_form - "+e)}}function drupalgap_form_local_storage_delete(a){try{var b=window.localStorage.removeItem(drupalgap_form_id_local_storage_key(a));return b}catch(c){console.log("drupalgap_form_local_storage_delete - "+c)}}function drupalgap_form_local_storage_load(a){try{var b=!1;return b=window.localStorage.getItem(drupalgap_form_id_local_storage_key(a)),b=b?JSON.parse(b):!1}catch(c){console.log("drupalgap_form_local_storage_load - "+c)}}function drupalgap_form_local_storage_save(a){try{window.localStorage.setItem(drupalgap_form_id_local_storage_key(a.id),JSON.stringify(a))}catch(b){console.log("drupalgap_form_local_storage_save - "+b)}}function drupalgap_form_id_local_storage_key(a){return"drupalgap_form_"+a}function drupalgap_form_load(a){try{var b=drupalgap_form_defaults(a),c=a;if(drupalgap_function_exists(c)){var d=window[c],e=language_default(),f=[];for(var g in arguments)if(arguments.hasOwnProperty(g)){var h=arguments[g];f.push(h)}if(f.splice(0,1),b.arguments=f,0==f.length)b=d(b,null);else{var i=[],j=null;i.push(b),i.push(j);for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];i.push(h)}b=d.apply(null,Array.prototype.slice.call(i))}_drupalgap_form_load_set_element_defaults(b,e),module_invoke_all("form_alter",b,null,a),_drupalgap_form_load_set_element_defaults(b,e),drupalgap_form_local_storage_save(b),Drupal.cache_expiration.forms[a]=1,window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}else{var k="drupalgap_form_load - "+t("no callback function")+" ("+c+") "+t("available for form")+" ("+a+")";drupalgap_alert(k)}return b}catch(l){console.log("drupalgap_form_load - "+l)}}function _drupalgap_form_load_set_element_defaults(a,b){try{for(var c in a.elements)if(a.elements.hasOwnProperty(c)){var d=a.elements[c];if("undefined"==typeof d.is_field){var e=!1,f=drupalgap_field_info_field(c);f&&(e=!0,a.elements[c].field_info_field=f,a.elements[c].field_info_instance=drupalgap_field_info_instance(a.entity_type,c,a.bundle)),a.elements[c].is_field=e}a.elements[c].name||(a.elements[c].name=c);var g=null;if(e){var h=parseInt(d.field_info_field.cardinality);-1==h&&(h=1),a.elements[c][b]||(a.elements[c][b]={});for(var i=0;h>i;i++){var j=drupalgap_form_element_item_create(c,a,b,i);a.elements[c][b][i]?$.extend(!0,a.elements[c][b][i],j):a.elements[c][b][i]=j}}else"user_roles"==d.name&&console.log("defaults",d),d.options?d.options.attributes||(a.elements[c].options.attributes={}):a.elements[c].options={attributes:{}},g=drupalgap_form_get_element_id(c,a.id),a.elements[c].id=g,a.elements[c].options.attributes.id=g}}catch(k){console.log("_drupalgap_form_elements_set_defaults - "+k)}}function drupalgap_form_onkeypress(a){try{var b=window.event,c=b.which||b.keyCode;if("13"!=c)return;return $("#"+a+" button.dg_form_submit_button").click(),b.preventDefault(),!1}catch(d){console.log("drupalgap_form_onkeypress - "+d)}}function _drupalgap_form_submit(a){try{var b=drupalgap_form_local_storage_load(a);if(!b){var c="_drupalgap_form_submit - "+t("failed to load form")+": "+a;return drupalgap_alert(c),!1}var d=drupalgap_form_state_values_assemble(b);drupalgap.form_errors={};var e=function(){try{for(var a in b.validate)if(b.validate.hasOwnProperty(a)){var c=b.validate[a],e=window[c];e.apply(null,Array.prototype.slice.call([b,d]))}if(_drupalgap_form_validate(b,d),jQuery.isEmptyObject(drupalgap.form_errors))f();else{var g="";for(var h in drupalgap.form_errors)if(drupalgap.form_errors.hasOwnProperty(h)){var i=drupalgap.form_errors[h];g+=i+"\n\n"}drupalgap_alert(g)}}catch(j){console.log("_drupalgap_form_submit - form_validation - "+j)}},f=function(){try{for(var a in b.submit)if(b.submit.hasOwnProperty(a)){var c=b.submit[a],e=window[c];e.apply(null,Array.prototype.slice.call([b,d]))}}catch(f){console.log("_drupalgap_form_submit - form_submission - "+f)}};b.entity_type&&image_fields_present_on_entity_type(b.entity_type,b.bundle)?_image_field_form_process(b,d,{success:e}):e()}catch(g){console.log("_drupalgap_form_submit - "+g)}}function _drupalgap_form_validate(a,b){try{for(var c in a.elements)if(a.elements.hasOwnProperty(c)){var d=a.elements[c];if("submit"!=c&&d.required){var e=!0,f=null;if(f=d.is_field?b.values[c][language_default()][0]:b.values[c],empty(f))e=!1;else if("select"==d.type&&d.required&&""==f)e=!1;else if("checkboxes"==d.type&&d.required){var g=!1;for(var h in b.values[c])if(b.values[c].hasOwnProperty(h)){var f=b.values[c][h];if(f){g=!0;break}}g||(e=!1)}if(!e){var i=c;d.title&&(i=d.title),drupalgap_form_set_error(c,t("The")+" "+i+" "+t("field is required")+".")}}}}catch(j){console.log("_drupalgap_form_validate - "+j)}}function drupalgap_form_state_values_assemble(a){try{var b=language_default(),c={values:{}};for(var d in a.elements)if(a.elements.hasOwnProperty(d)){var e=a.elements[d];if("submit"!=d){var f=null;if(e.is_field){c.values[d]={},c.values[d][b]={};var g=e.field_info_field.cardinality;-1==g&&(g=1);for(var h=0;g>h;h++)f=drupalgap_form_get_element_id(d,a.id,b,h),c.values[d][b][h]=_drupalgap_form_state_values_assemble_get_element_value(f,e)}else f=drupalgap_form_get_element_id(d,a.id),c.values[d]=_drupalgap_form_state_values_assemble_get_element_value(f,e)}}return drupalgap.form_states[a.id]=c,c}catch(i){console.log("drupalgap_form_state_values_assemble - "+i)}}function _drupalgap_form_state_values_assemble_get_element_value(a,b){try{if(b.value_callback&&function_exists(b.value_callback)){var c=window[b.value_callback];return c(a,b)}var d=null,e="";switch(e="radios"==b.type?'input:radio[name="'+a+'"]:checked':"#"+a,b.type){case"checkbox":var f=$(e);d=$(f).is(":checked")?1:0;break;case"checkboxes":d={};var g=$('label[for="'+a+'"]').siblings(".ui-checkbox");$.each(g,function(a,b){var c=$(b).children("input"),e=$(c).attr("value");$(c).is(":checked")?d[e]=e:d[e]=0});break;case"list_boolean":var f=$(e);d=$(f).is(":checked")?$(f).attr("on"):$(f).attr("off");break;case"list_text":b.field_info_instance&&"options_buttons"==b.field_info_instance.widget.type&&(e='input:radio[name="'+a+'"]:checked')}return null===d&&(d=$(e).val()),"undefined"==typeof d&&(d=null),d}catch(h){console.log("_drupalgap_form_state_values_assemble_get_element_value - "+h)}}function _drupalgap_form_submit_response_errors(a,b,c,d,e){try{var f=JSON.parse(c.responseText);if("object"==typeof f&&f.form_errors){var g="";for(var h in f.form_errors)if(f.form_errors.hasOwnProperty(h)){var i=f.form_errors[h];if(""!=i){var j=h.indexOf("]");-1!=j&&(h=h.substr(0,j));var k=h;a.elements[h]&&a.elements[h].title&&(k=a.elements[h].title),g+=$("
    ("+k+") - "+i+"
    ").text()+"\n"}}if(""!=g)return g}return!1}catch(l){console.log("_drupalgap_form_submit_response_errors - "+l)}}function theme_checkbox(a){try{a.attributes.type="checkbox",a.checked&&(a.attributes.checked="checked");var b="";return b}catch(c){console.log("theme_checkbox - "+c)}}function theme_checkboxes(a){try{var b="";a.attributes.type="checkboxes";for(var c in a.options)if(a.options.hasOwnProperty(c)){var d=a.options[c];if("attributes"!=c){var e=c;empty(d)||(e=d);var f={value:c,attributes:{name:a.name+"["+c+"]","class":a.name,value:c}};a.value&&a.value[c]&&(f.checked=!0),b+=""}}return b}catch(g){console.log("theme_checkbox - "+g)}}function theme_email(a){try{a.attributes.type="email";var b="";return b}catch(c){console.log("theme_email - "+c)}}function theme_file(a){try{a.attributes.type="file";var b="";return b}catch(c){console.log("theme_file - "+c)}}function theme_form_element_label(a){try{var b=a.element;if(empty(b.title))return"";var c="";b.id?c=b.id:b.attributes&&b.attributes["for"]&&(c=b.attributes["for"]),"radios"==b.type&&(c=b.name);var d='"}catch(e){console.log("theme_form_element_label - "+e)}}function theme_form_required_marker(a){return"*"}function theme_number(a){try{return a.attributes.type="number",""}catch(b){console.log("theme_number - "+b)}}function theme_hidden(a){try{return a.attributes.type="hidden",a.attributes.value||null==a.value||(a.attributes.value=a.value),""}catch(b){console.log("theme_hidden - "+b)}}function theme_password(a){try{return a.attributes.type="password",""}catch(b){console.log("theme_password - "+b)}}function theme_radios(a){try{var b="";if(a.options){a.attributes.type="radio";var c="radio";a.attributes.id&&(c=a.attributes.id,delete a.attributes.id),a.attributes.name||(a.attributes.name=c);var d=0;for(var e in a.options)if(a.options.hasOwnProperty(e)){var f=a.options[e];if("attributes"!=e){var g="";a.value&&a.value==e&&(g=' checked="checked" ');var h=c+"_"+d.toString(),i='";b+='"+i,d++}}}return b}catch(j){console.log("theme_radios - "+j)}}function theme_range(a){try{a.attributes.type="range","undefined"==typeof a.attributes.value&&(a.attributes.value=a.value);var b="";return b}catch(c){console.log("theme_range - "+c)}}function theme_search(a){try{a.attributes.type="search";var b="";return b}catch(c){console.log("theme_search - "+c)}}function theme_select(a){try{var b="";if(a.options)for(var c in a.options)if(a.options.hasOwnProperty(c)){var d=a.options[c];if("attributes"!=c){var e="";"undefined"!=typeof a.value&&($.isArray(a.value)&&in_array(c,a.value)||a.value==c)&&(e=" selected "),b+='"}}return""}catch(f){console.log("theme_select - "+f)}}function theme_tel(a){try{return a.attributes.type="tel",""}catch(b){console.log("theme_tel - "+b)}}function theme_textfield(a){try{return a.attributes.type="text",""}catch(b){console.log("theme_textfield - "+b)}}function theme_textarea(a){try{var b="
    ";return b}catch(c){console.log("theme_textarea - "+c)}}function drupalgap_goto(a){try{var b={};if(arguments[1]&&(b=arguments[1],"undefined"==typeof b.form_submission&&(b.form_submission=!1)),drupalgap.page.options=b,a=_drupalgap_goto_prepare_path(a,!0),!a)return!1;module_invoke_all("drupalgap_goto_preprocess",a);var c=drupalgap_get_menu_link_router_path(a);if(!drupalgap.menu_links[c]){var d=!1,e=module_invoke_all("404",c);if(e)for(var f in e)if(e.hasOwnProperty(f)){var g=e[f];if(g!==!1){d=g;break}}a=d?d:"404",c=drupalgap_get_menu_link_router_path(a)}if("MENU_DEFAULT_LOCAL_TASK"==drupalgap.menu_links[c].type||"MENU_LOCAL_TASK"==drupalgap.menu_links[c].type||drupalgap_menu_access(c,a)||(a="401",c=drupalgap_get_menu_link_router_path(a)),c==drupalgap_router_path_get()&&a==drupalgap_path_get())if(b.form_submission);else{if(!b.reloadPage)return!1;_system_reload_page=a,a="_reload",c=drupalgap_get_menu_link_router_path(a)}var h=drupalgap_get_page_id(a);if(drupalgap_jqm_active_page_url()==h&&b.form_submission)return drupalgap_clear_messages(),!1;if(in_array(drupalgap_path_get())||drupalgap.back_path.push(drupalgap_path_get()),drupalgap_path_set(a),drupalgap_router_path_set(c),drupalgap_page_in_dom(h)){if(drupalgap.menu_links[c].options&&(b=$.extend({},drupalgap.menu_links[c].options,b)),"undefined"!=typeof b.reloadPage&&b.reloadPage){var i=_drupalgap_goto_query_string?!0:!1;drupalgap_remove_page_from_dom(h,{force:!0,leaveQuery:i}),delete b.reloadPage,b.reloadingPage=!0}else if(!b.form_submission)return drupalgap_clear_messages(),_drupalgap_goto_query_string=null,drupalgap.page.process=!1,$.mobile.changePage("#"+h,b),void module_invoke_all("drupalgap_goto_post_process",a)}else"undefined"!=typeof b.reloadPage&&b.reloadPage&&delete b.reloadPage;drupalgap_goto_generate_page_and_go(a,h,b,drupalgap.menu_links[c])}catch(j){console.log("drupalgap_goto - "+j)}}function drupalgap_goto_generate_page_and_go(a,b,c,d){try{var e=path_to_theme()+"/page.tpl.html";if(drupalgap_file_exists(e)){_drupalgap_goto_query_string=null,"undefined"==typeof c&&(c={});var f={};drupalgap.settings.cache&&"undefined"!==drupalgap.settings.cache.theme_registry&&!drupalgap.settings.cache.theme_registry&&(f.cache=!1);var g=drupalgap_file_get_contents(e,f);if(g){drupalgap_add_page_to_dom({page_id:b,html:g,menu_link:d}),drupalgap_path_get()==a&&c.form_submission&&(c.allowSamePageTransition=!0);var h="index.html#"+b;("phonegap"!=drupalgap.settings.mode||"function"==typeof parent.window.ripple)&&(h="#"+b),$.mobile.changePage(h,c),module_invoke_all("drupalgap_goto_post_process",a)}else drupalgap_alert("drupalgap_goto_generate_page_and_go - "+t("failed to load theme's page.tpl.html file"))}else console.log("drupalgap_goto_generate_page_and_go - page template does not exist! ("+e+")")}catch(i){console.log("drupalgap_goto_generate_page_and_go - "+i)}}function drupalgap_goto_prepare_path(a){try{return console.log("WARNING - drupalgap_goto_prepare_path() is deprecated, use _drupalgap_goto_prepare_path() instead!"),_drupalgap_goto_prepare_path(a)}catch(b){console.log("drupalgap_goto_prepare_path - "+b)}}function _drupalgap_goto_prepare_path(a){try{if("undefined"!=typeof arguments[1]&&arguments[1]){var b=a.indexOf("?");if(-1!=b&&b!=a.length-1){var c=a.substr(b+1,a.length-b);_drupalgap_goto_query_string=c,a=a.substr(0,b);for(var d=c.split("&"),e=0;e0&&(l=JSON.stringify(e));for(var m=0;m1&&is_int(parseInt(c[1]))&&(c[1]="%",b=c.join("/"));break;case"taxonomy":d>2&&("vocabulary"==c[1]||"term"==c[1])&&is_int(parseInt(c[2]))&&(c[2]="%",b=c.join("/"));break;default:d>1&&is_int(parseInt(c[1]))&&(c[1]="%",b=c.join("/"))}}if(!b&&c&&c.length>1)for(var e,f=c.length-1;-1!=f;f--){e="";for(var g=0;gg?c[g]:"%",g!=c.length-1&&(e+="/");if(drupalgap.menu_links[e]){b=e;break}}return drupalgap.menu_links[b]&&"MENU_DEFAULT_LOCAL_TASK"==drupalgap.menu_links[b].type&&drupalgap.menu_links[b].parent&&(b=drupalgap.menu_links[b].parent),b||(b=a),b}catch(h){console.log("drupalgap_get_menu_link_router_path - "+h)}}function drupalgap_menus_load(){try{if(drupalgap.settings.menus){for(var a in drupalgap.settings.menus)if(drupalgap.settings.menus.hasOwnProperty(a)){var b=drupalgap.settings.menus[a];if(drupalgap.menus[a])$.extend(!0,drupalgap.menus[a],b);else if(b.menu_name||(b.menu_name=a),"regions"!=a){menu_save(b);var c=b.menu_name;drupalgap.blocks[0][c]={name:c,delta:c,module:"menu"}}}for(var d in drupalgap.menu_links)if(drupalgap.menu_links.hasOwnProperty(d)){var e=drupalgap.menu_links[d];if(e.menu_name)if(drupalgap.menus[e.menu_name]){drupalgap.menus[e.menu_name].links||(drupalgap.menus[e.menu_name].links=[]),e.path=d;var f=drupalgap_menus_load_convert_menu_link_to_link_json(e);drupalgap.menus[e.menu_name].links.push(f)}else console.log("drupalgap_menus_load - menu does not exist ("+e.menu_name+"), cannot attach link to it ("+d+")");e.region&&(drupalgap.theme.regions[e.region.name].links||(drupalgap.theme.regions[e.region.name].links=[]),drupalgap.theme.regions[e.region.name].links.push(e))}if("undefined"!=typeof drupalgap.settings.menus.regions)for(var g in drupalgap.settings.menus.regions)if(drupalgap.settings.menus.regions.hasOwnProperty(g)){var b=drupalgap.settings.menus.regions[g];if("undefined"!=typeof b.links&&$.isArray(b.links)&&b.links.length>0){drupalgap.theme.regions[g].links||(drupalgap.theme.regions[g].links=[]);for(var h in b.links)if(b.links.hasOwnProperty(h)){var f=b.links[h];drupalgap.theme.regions[g].links.push(f)}}}}}catch(i){console.log("drupalgap_menus_load - "+i)}}function drupalgap_menus_load_convert_menu_link_to_link_json(a){try{var b={};return a.title&&(b.title=a.title,b.text=a.title),a.path&&(b.path=a.path),a.options&&(b.options=a.options),a.region&&a.region.options&&(b.options=a.options=a.region.options),b}catch(c){console.log("drupalgap_menus_load_convert_menu_link_to_link_json - "+c)}}function drupalgap_menu_router_build_menu_item_relationships(a,b){try{var c=arg(null,a);if(c.length>1){var d=c.splice(0,c.length-1).join("/");if(b.parent=d,drupalgap.menu_links[d]){"undefined"==typeof drupalgap.menu_links[d].children&&(drupalgap.menu_links[d].children=[]),drupalgap.menu_links[d].children.push(a),"undefined"==typeof b.siblings&&(b.siblings=[]);for(var e in drupalgap.menu_links[d].children)if(drupalgap.menu_links[d].children.hasOwnProperty(e)){var f=drupalgap.menu_links[d].children[e];f!=a&&drupalgap.menu_links[f]&&("undefined"==typeof drupalgap.menu_links[f].siblings&&(drupalgap.menu_links[f].siblings=[]),drupalgap.menu_links[f].siblings.push(a),b.siblings.push(f))}}}}catch(g){console.log("drupalgap_menu_router_build_relationships - "+g)}}function drupalgap_loading_message_show(){try{if("undefined"===drupalgap.loading&&(drupalgap.loading=!1),drupalgap.loading||drupalgap_toast_is_shown())return;var a=drupalgap_loader_options();arguments[0]&&(a=arguments[0]),setTimeout(function(){$.mobile.loading("show",a),drupalgap.loading=!0},1)}catch(b){console.log("drupalgap_loading_message_show - "+b)}}function drupalgap_loading_message_hide(){try{if(drupalgap_toast_is_shown())return;setTimeout(function(){$.mobile.loading("hide"),drupalgap.loading=!1,drupalgap.loader="loading"},100)}catch(a){console.log("drupalgap_loading_message_hide - "+a)}}function drupalgap_loader_options(){try{var a=drupalgap.loader,b=t("Loading")+"...",c=!0;if("saving"==a)var b=t("Saving")+"...";var d={text:b,textVisible:c};return drupalgap.settings.loader&&drupalgap.settings.loader[a]&&(d=$.extend(!0,d,drupalgap.settings.loader[a]),d.text&&(d.text=t(d.text))),d}catch(e){console.log("drupalgap_loader_options - "+e)}}function drupalgap_set_message(a){try{if(empty(a))return;var b="status";arguments[1]&&(b=arguments[1]);var c={message:a,type:b};drupalgap.messages.push(c)}catch(d){console.log("drupalgap_set_message - "+d)}}function drupalgap_set_messages(a){try{drupalgap.messages=a}catch(b){console.log("drupalgap_set_messages - "+b)}}function drupalgap_get_messages(){try{return drupalgap.messages}catch(a){console.log("drupalgap_get_messages - "+a)}}function drupalgap_clear_messages(){try{var a=arguments[0];empty(a)&&(a=drupalgap_get_page_id()),$("#"+a+" div.messages").remove()}catch(b){console.log("drupalgap_clear_messages - "+b)}}function drupalgap_alert(a){try{var b=null;arguments[1]&&(b=arguments[1]);var c=function(){},d=t("Alert"),e=t("OK");b&&(b.alertCallback&&(c=b.alertCallback),b.title&&(d=b.title),b.buttonName&&(e=b.buttonName)),"phonegap"!=drupalgap.settings.mode||"undefined"==typeof navigator.notification?(alert(a),c()):navigator.notification.alert(a,c,d,e)}catch(f){console.log("drupalgap_alert - "+f)}}function drupalgap_confirm(a){try{var b=null;arguments[1]&&(b=arguments[1]);var c=function(a){},d=t("Confirm"),e=[t("OK"),t("Cancel")];if(b&&(b.confirmCallback&&(c=b.confirmCallback),b.title&&(d=b.title),b.buttonLabels&&(e=b.buttonLabels)),"function"==typeof parent.window.ripple||"web-app"==drupalgap.settings.mode){var f=confirm(a); -c(1==f?1:2)}else navigator.notification.confirm(a,c,d,e);return!1}catch(g){console.log("drupalgap_confirm - "+g)}}function drupalgap_toast(a){try{var b=arguments[2]?arguments[2]:750,c=arguments[1]?arguments[1]:1500;setTimeout(function(){drupalgap.toast.shown=!0,$.mobile.loading("show",{textVisible:!0,html:a});var b=setInterval(function(){$.mobile.loading("hide"),drupalgap.toast.shown=!1,clearInterval(b)},c)},b)}catch(d){console.log("drupalgap_toast - "+d)}}function drupalgap_toast_is_shown(){return drupalgap.toast.shown}function _GET(){try{var a=!1,b=!1,c=null,d=null;if("undefined"!=typeof arguments[1]){if(b=!0,d=arguments[1],"undefined"==typeof arguments[0])return console.log("WARNING: _GET - missing key for value ("+d+")"),null;c=arguments[0]}else"undefined"!=typeof arguments[0]?(a=!0,c=arguments[0]):a=!0;if(a){var e=null;if(e="undefined"!=typeof arguments[2]?arguments[2]:drupalgap_get_page_id(),"undefined"!=typeof _dg_GET[e])return c?"undefined"!=typeof _dg_GET[e][c]?_dg_GET[e][c]:null:_dg_GET[e]}else if(b){var e=null;e="undefined"!=typeof arguments[2]?drupalgap_get_page_id(arguments[2]):drupalgap_get_page_id(),"undefined"==typeof _dg_GET[e]&&(_dg_GET[e]={}),d&&(_dg_GET[e][c]=d)}return null}catch(f){console.log("_GET - "+f)}}function template_preprocess_page(a){try{"undefined"==typeof a.attributes&&(a.attributes={}),a.attributes["data-role"]="page",module_invoke_all("preprocess_page",a),drupalgap.page.variables=a}catch(b){console.log("template_preprocess_page - "+b)}}function template_process_page(a){try{var b=drupalgap_path_get();drupalgap.output=menu_execute_active_handler();var c=drupalgap_get_page_id(b),d=$("#"+c),e=$(d).html();if(!e)return;for(var f in drupalgap.theme.regions)if(drupalgap.theme.regions.hasOwnProperty(f)){var g=drupalgap.theme.regions[f],h={};$.extend(!0,h,g),e=e.replace("{:"+g.name+":}",drupalgap_render_region(h))}$(d).html(e),module_invoke_all("post_process_page",a)}catch(i){console.log("template_process_page - "+i)}}function drupalgap_get_page_id(a){try{a||(a=drupalgap_path_get());var b=a.toLowerCase().replace(/\//g,"_").replace(/-/g,"_");return b}catch(c){console.log("drupalgap_get_page_id - "+c)}}function drupalgap_add_page_to_dom(a){try{var b={id:a.page_id,"data-role":"page"};b=$.extend(!0,b,a.menu_link.options.attributes),b["class"]+=" "+drupalgap_page_class_get(drupalgap.router_path),a.html=a.html.replace(/{:drupalgap_page_attributes:}/g,drupalgap_attributes(b)),$("body").append(a.html),drupalgap.pages.push(a.page_id)}catch(c){console.log("drupalgap_add_page_to_dom - "+c)}}function drupalgap_remove_page_from_dom(a){try{var b=null;b="undefined"!=typeof arguments[2]?arguments[2]:drupalgap_get_page_id(drupalgap_path_get());var c={};if("undefined"!=typeof arguments[1]&&(c=arguments[1]),b!=a||c.force){var d=$("#"+b),e=$(d).attr("style");$("#"+a).empty().remove(),e&&$(d).attr("style",e);var f=drupalgap.pages.indexOf(a);f>-1&&drupalgap.pages.splice(f,1),"undefined"==typeof _dg_GET[a]||"undefined"!=typeof c.leaveQuery&&c.leaveQuery||delete _dg_GET[a],views_embedded_view_delete(a)}else console.log("WARNING: drupalgap_remove_page_from_dom() - not removing the current page ("+a+") from the DOM!")}catch(g){console.log("drupalgap_remove_page_from_dom - "+g)}}function drupalgap_remove_pages_from_dom(){try{var a=drupalgap_get_page_id(drupalgap_path_get()),b=drupalgap.pages.slice(0);for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];a!=d&&drupalgap_remove_page_from_dom(d,null,a)}drupalgap.pages=[a],drupalgap.views.ids=[],drupalgap.page.jqm_events=[],drupalgap.back_path=[]}catch(e){console.log("drupalgap_remove_pages_from_dom - "+e)}}function drupalgap_page_class_get(a){try{for(var b=a.replace(/[\/%]/g,"_");b.lastIndexOf("_")==b.length-1;)b=b.substr(0,b.length-1);return b}catch(c){console.log("drupalgap_page_class_get - "+c)}}function drupalgap_page_in_dom(a){try{var b=$("body div[data-role$='page']"),c=!1;if(b&&b.length>0)for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];if($(e).attr("id")==a){c=!0;break}}return c}catch(f){console.log("drupalgap_page_in_dom - "+f)}}function drupalgap_is_front_page(){try{return drupalgap_path_get()==drupalgap.settings.front}catch(a){console.log("drupalgap_is_front_page - "+a)}}function drupalgap_jqm_active_page_url(){try{return $.mobile.activePage?$.mobile.activePage.data("url"):""}catch(a){console.log("drupalgap_jqm_active_page_url - "+a)}}function drupalgap_render_page(){try{return module_invoke_all("page_build",drupalgap.output),drupalgap_render(drupalgap.output)}catch(a){console.log("drupalgap_render_page - "+a)}}function drupalgap_render_region(a){try{if(!drupalgap.settings.blocks[drupalgap.settings.theme]){var b='WARNING: drupalgap_render_region() - there are no blocks for the "'+drupalgap.settings.theme+'" theme in the settings.js file!';return console.log(b),""}var c=drupalgap_path_get(),d="";d+=_drupalgap_region_render_zone("_prefix",a,c);var e=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];if(e){var f=0;$.each(drupalgap.settings.blocks[drupalgap.settings.theme][a.name],function(a,b){in_array(a,["_prefix","_suffix"])||f++}),e=f}if(e){a.attributes["class"]||(a.attributes["class"]=""),a.attributes["class"]+=" region_"+a.name+" ",d+="
    ";var g=0,h=0;if(a.links&&a.links.length>0){var i=0,j=0;for(var k in a.links)if(a.links.hasOwnProperty(k)){var m=a.links[k],n=menu_region_link_get_data(m);if(drupalgap_check_visibility("region",n)){g++;var o=drupalgap_link_get_class(m);if(o){var p=menu_region_link_get_side(o);"left"==p?i++:"right"==p&&j++}}}for(var q="",r="",s=0;s1){var x={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-left"};q="
    "+q.replace(/ui-btn-left/g,"")+"
    "}if(j>1){var x={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-right"};r="
    "+r.replace(/ui-btn-right/g,"")+"
    "}d+=q+r}var y={block_count:0,block_menu_count:0},z=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];for(var A in z)if(z.hasOwnProperty(A)){var B=z[A];"_prefix"!=A&&"_suffix"!=A&&(d+=drupalgap_block_render(a,c,A,B,y))}(in_array(a.attributes["data-role"],["header","footer"])&&(0==y.block_count&&g>0||y.block_count-y.block_menu_count==0)||g>0&&h>=y.block_menu_count&&0==y.block_count)&&("undefined"==typeof a.collapse_on_empty||a.collapse_on_empty===!1)&&(d+="

     

    "),d+="
    "}return d+=_drupalgap_region_render_zone("_suffix",a,c)}catch(C){console.log("drupalgap_render_region - "+C)}}function _drupalgap_region_render_zone(a,b,c){try{var d="",e=drupalgap.settings.theme;if("undefined"==typeof drupalgap.settings.blocks[e][b.name])return d;var f=drupalgap.settings.blocks[e][b.name];if("undefined"==typeof f[a])return d;var g=f[a];for(var h in g)if(g.hasOwnProperty(h)){var i=g[h];d+=drupalgap_block_render(b,c,h,i)}return d}catch(j){console.log("_drupalgap_region_render_zone - "+j)}}function drupalgap_panel_id(a){try{return a+"_"+drupalgap_get_page_id()}catch(b){console.log("drupalgap_panel_id - "+b)}}function drupalgap_render(a){var b=$.type(a),c="";if("string"===b)c=a;else if("object"===b){if(a.markup)return a.markup;if(a.theme&&!drupalgap.theme_registry[a.theme])return theme(a.theme,a);if(a.theme&&drupalgap.theme_registry[a.theme]){var d=drupalgap.theme_registry[a.theme],e=a.theme.replace(/_/g,"-")+".tpl.html",f=d.path+"/"+e;if(drupalgap_file_exists(f)){var g=drupalgap_file_get_contents(f);if(g){var h=drupalgap_get_placeholders_from_html(g);if(h)for(var i in h)if(h.hasOwnProperty(i)){var j=h[i],k="";if(a[j]){var l=a[j];a[j].markup?k=a[j].markup:a[j].theme&&(k=theme(a[j].theme,l)),delete a[j]}g=g.replace("{:"+j+":}",k)}c+=g}else console.log("drupalgap_render - failed to get file contents ("+f+")")}else console.log("drupalgap_render - template file does not exist ("+f+")")}else{var m={},n=0;for(var i in a)if(a.hasOwnProperty(i)){var o=a[i],p=typeof o;if("object"===p&&null!==o){if(o.theme&&drupalgap.theme_registry[o.theme])continue;var q="undefined"!=typeof o.weight?o.weight:0;"undefined"==typeof m[q]&&(m[q]=[]),m[q].push(drupalgap_render(o)),n++}else if("array"===p)for(var r=0;r"+a.text+"";return b}catch(c){console.log("theme_button_link - "+c)}}function theme_button_link(a){try{return a.attributes["data-role"]="button",theme_link(a)}catch(b){console.log("theme_button_link - "+b)}}function theme_collapsible(a){try{a.attributes["data-role"]="collapsible";var b="h2";a.header_type&&(b=a.header_type);var c={};a.header_attributes&&(c=a.header_attributes);var d="
    <"+b+" "+drupalgap_attributes(c)+">"+a.header+""+a.content+"
    ";return d}catch(e){console.log("theme_collapsible - "+e)}}function theme_collapsibleset(a){try{a.attributes["data-role"]="collapsible-set";var b="
    ";for(var c in a.items)if(a.items.hasOwnProperty(c)){var d=a.items[c];b+=theme("collapsible",d)}return b+="
    "}catch(e){console.log("theme_collapsibleset - "+e)}}function theme_controlgroup(a){try{a.attributes["data-role"]="controlgroup";var b="
    ";for(var c in a.items)if(a.items.hasOwnProperty(c)){var d=a.items[c];b+=d}return b+="
    "}catch(e){console.log("theme_controlgroup - "+e)}}function theme_header(a){try{a.attributes["data-role"]="header","undefined"==typeof a.type&&(type="h2");var b=a.type_attributes?" "+drupalgap_attributes(a.type_attributes):"",c="
    <"+type+b+">"+a.text+"
    ";return c}catch(d){console.log("theme_header - "+d)}}function theme_image(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),""}catch(b){console.log("theme_image - "+b)}}function theme_audio(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),""}catch(b){console.log("theme_audio - "+b)}}function theme_video(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),"undefined"!=typeof device&&"iOS"==device.platform&&"undefined"==typeof a.attributes["webkit-playsinline"]&&(a.attributes["webkit-playsinline"]=""),""}catch(b){console.log("theme_video - "+b)}}function theme_image_style(a){try{return a.path=image_style_url(a.style_name,a.path),theme_image(a)}catch(b){console.log("theme_image - "+b)}}function theme_item(a){try{var b="";for(var c in a.item)if(a.item.hasOwnProperty(c)){var d=a.item[c];b+="

    "+a.model.fields[c].title+"

    "+d+"

    "}return b}catch(e){console.log("theme_item - "+e)}}function theme_item_list(a){try{var b="ul";a.type&&(b=a.type);var c="";if(a.title&&(c+="

    "+a.title+"

    "),c+="<"+b+" "+drupalgap_attributes(a.attributes)+">",a.items&&a.items.length>0)for(var d="undefined"!=typeof a.attributes["data-role"]&&"listview"==a.attributes["data-role"],e=0;e"}else if("object"==typeof f){var h=f.attributes?f.attributes:{},i=f.content?f.content:"";c+="
  • "+drupalgap_render(i)+"
  • "}}return c+=""}catch(j){console.log("theme_item_list - "+j)}}function theme_jqm_item_list(a){try{return a.attributes?a.attributes["data-role"]&&"listview"!=a.attributes["data-role"]||(a.attributes["data-role"]="listview"):a.attributes["data-role"]="listview",theme_item_list(a)}catch(b){console.log("theme_jqm_item_list - "+b)}}function theme_link(a){try{var b="";if(a.text&&(b=a.text),"undefined"!=typeof a.path&&null!=a.path){if(0==a.path.indexOf("#"))return a.attributes.href=a.path,""+b+"";var c="drupalgap_goto('"+a.path+"');";if(a.options)if(a.options.InAppBrowser)c="window.open('"+a.path+"', '_blank', 'location=yes');";else{a.path=_drupalgap_goto_prepare_path(a.path);var d="";for(var e in a.options)if(a.options.hasOwnProperty(e)){var f=a.options[e];"attributes"!=e&&("string"==typeof f&&(f="'"+f+"'"),d+=e+":"+f+",")}c="drupalgap_goto('"+a.path+"', {"+d+"});"}return a.path==drupalgap_path_get()&&(-1==a.attributes["class"].indexOf("ui-btn-active")&&(a.attributes["class"]+=" ui-btn-active "),-1==a.attributes["class"].indexOf("ui-state-persist")&&(a.attributes["class"]+=" ui-state-persist ")),'"+b+""}return"undefined"==typeof a.attributes.href&&(a.attributes.href="#"),""+b+""}catch(g){console.log("theme_link - "+g)}}function theme_logout(a){try{return bl(t("Logout"),"user/logout",{attributes:{"data-icon":"action","data-iconpos":"right"}})}catch(b){console.log("theme_logout - "+b)}}function theme_popup(a){try{a.attributes["data-role"]="popup";var b={};a.button_attributes&&(b=a.button_attributes),b.href="#"+a.attributes.id,b["data-rel"]="popup";var c=bl(a.button_text,null,{attributes:b})+"
    "+a.content+"
    ";return c}catch(d){console.log("theme_popup - "+d)}}function theme_submit(a){try{return""}catch(b){console.log("theme_submit - "+b)}}function theme_table(a){try{var b="";if(a.header){b+="";for(var c in a.header)if(a.header.hasOwnProperty(c)){var d=a.header[c];d.data&&(b+="")}b+=""}if(b+="",a.rows)for(var e in a.rows)if(a.rows.hasOwnProperty(e)){var f=a.rows[e];if(b+="",f)for(var g in f)if(f.hasOwnProperty(g)){var d=f[g];b+=""}b+=""}return b+"
    "+d.data+"
    "+d+"
    "}catch(h){console.log("theme_table - "+h)}}function theme_jqm_table(a){try{return a.attributes["data-role"]="table",a.attributes["data-mode"]="reflow",theme_table(a)}catch(b){console.log("theme_jqm_table - "+b)}}function _drupalgap_page_title_pageshow(a){try{var b=drupalgap_router_path_get(),c=[];if("undefined"!=typeof drupalgap.menu_links[b].title&&drupalgap_set_title(drupalgap.menu_links[b].title),"undefined"!=typeof drupalgap.menu_links[b].title_callback){var d=drupalgap.menu_links[b].title_callback;if(drupalgap_function_exists(d)){var e=window[d];if(c.unshift(_drupalgap_page_title_pageshow_success),drupalgap.menu_links[b].title_arguments){var f=arg(null,drupalgap_path_get()),g=drupalgap.menu_links[b].title_arguments;for(var h in g)if(g.hasOwnProperty(h)){var i=g[h];is_int(i)&&f[i]?c.push(f[i]):c.push(i)}}drupalgap_set_title(e.apply(null,Array.prototype.slice.call(c)))}}else _drupalgap_page_title_pageshow_success(drupalgap_get_title())}catch(j){console.log("_drupalgap_page_title_pageshow - "+j)}}function _drupalgap_page_title_pageshow_success(a){try{var b=system_title_block_id(drupalgap_path_get());$("h1#"+b).html(a)}catch(c){console.log("_drupalgap_page_title_pageshow_success - "+c)}}function hook_assemble_form_state_into_field(a,b,c,d,e,f,g,h,i){try{var j={foo:"bar"};return j;var j,j,j,j}catch(k){console.log("hook_assemble_form_state_into_field - "+k)}}function hook_deviceready(){}function hook_device_connection(){var a=new Date;6==a.getDay()&&(drupalgap.online=!1)}function hook_device_offline(){drupalgap_goto("")}function hook_drupalgap_back(a,b){a==drupalgap.settings.front&&"user/login"==b&&drupalgap_toast("Please login to continue")}function hook_drupalgap_goto_preprocess(a){try{a==drupalgap.settings.front&&drupalgap_alert(t("Preprocessing the front page!"))}catch(b){console.log("hook_drupalgap_goto_preprocess - "+b)}}function hook_drupalgap_goto_post_process(a){try{a==drupalgap.settings.front&&drupalgap_alert(t("Post processing the front page!"))}catch(b){console.log("hook_drupalgap_goto_post_process - "+b)}}function hook_services_success(a,b){}function hook_block_info(){}function hook_block_view(a,b){}function hook_404(a){}function hook_entity_pre_build_content(a,b,c){"node"==b&&"undefined"!=typeof a.field_date&&(a.body.weight=0,a.field_date.weight=1)}function hook_entity_post_build_content(a,b,c){}function hook_entity_pre_render_content(a,b,c){try{"node"==b&&"undefined"!=typeof a.field_date&&(a.field_date.access=!1)}catch(d){console.log("hook_entity_pre_render_content - "+d)}}function hook_entity_post_render_content(a,b,c){try{"article"==a.type&&(a.content+="

    "+t("Example text on every article!")+"

    ")}catch(d){console.log("hook_entity_post_render_content - "+d)}}function hook_entity_view_alter(a,b,c,d){try{"user"==a&&"view"==c&&(b==Drupal.user.uid?(d.foo={markup:"

    Extra stuff when viewing own user profile...

    "},d.volume={theme:"range",attributes:{min:"0",max:"11",value:"11","data-theme":"b"}}):d.bar={markup:"

    Viewing some other profile...

    "})}catch(e){console.log("hook_entity_view_alter - "+e)}}function hook_field_info_instance_add_to_form(a,b,c,d,e){try{e.value_callback="example_field_value_callback"}catch(f){console.log("hook_field_info_instance_add_to_form - "+f)}}function hook_field_formatter_view(a,b,c,d,e,f,g){try{var h={};for(var i in f)if(f.hasOwnProperty(i)){f[i];h[i]={markup:"

    "+t("Hello!")+"

    "}}return h}catch(j){console.log("hook_field_formatter_view - "+j)}}function hook_field_widget_form(a,b,c,d,e,f,g,h){try{f[g].type="textfield"}catch(i){console.log("hook_field_widget_form - "+i)}}function hook_entity_post_render_field(a,b,c,d){"field_my_image"==b&&(d.content+="

    "+a.title+"

    ")}function hook_form_alter(a,b,c){"user_login_form"==c&&(a.elements.name.description=t("Enter your login name"))}function hook_image_path_alter(a){}function hook_install(){}function hook_locale(){return["es","it"]}function hook_menu(){try{var a={};return a.hello_world={title:t("Hello World"),page_callback:"my_module_hello_world_page"},a}catch(b){console.log("hook_menu - "+b)}}function hook_mvc_model(){var a={};return a}function hook_mvc_view(){}function hook_mvc_controller(){}function hook_node_page_view_alter_TYPE(a,b){try{var c={};c.my_markup={markup:"

    "+t("Click below to see the node!")+"

    "},c.my_collapsible={theme:"collapsible",header:a.title,content:a.content},b.success(c)}catch(d){console.log("hook_node_page_view_alter_TYPE() - "+d)}}function hook_page_build(a){try{a.node&&"article"==a.node.type&&delete a.title}catch(b){console.log("hook_page_build - "+b)}}function hook_preprocess_page(a){try{}catch(b){console.log("hook_preprocess_page - "+b)}}function hook_post_process_page(a){try{}catch(b){console.log("hook_post_process_page - "+b)}}function hook_views_exposed_filter(a,b,c,d,e){try{}catch(f){console.log("hook_views_exposed_filter - "+f)}}function comment_menu(){var a={"comment/%":{title:t("Comment"),page_callback:"comment_page_view",page_arguments:[1],pageshow:"comment_page_view_pageshow",title_callback:"comment_page_title",title_arguments:[1]},"comment/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"comment/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["comment_edit","comment",1],weight:0,type:"MENU_LOCAL_TASK",access_callback:"comment_access",access_arguments:[1],options:{reloadPage:!0}}};return a}function comment_access(a){try{return a.uid==Drupal.user.uid&&user_access("edit own comments")||user_access("administer comments")?!0:!1}catch(b){console.log("comment_access - "+b)}}function comments_container_id(a){return"comments_container_"+a}function comment_container_id(a){return"comment_container_"+a}function comment_list_id(a){try{return comments_container_id(a)}catch(b){console.log("comment_list_id - "+b)}}function comment_page_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("comment",a,"view")};return b}drupalgap_error(t("No comment id provided!"))}catch(c){console.log("comment_page_view - "+c)}}function comment_page_view_pageshow(a){try{comment_load(a,{success:function(b){var c=theme("comment",{comment:b}),d=theme("jqm_item_list",{items:[c]});_drupalgap_entity_page_container_inject("comment",a,"view",d)}})}catch(b){console.log("comment_page_view_pageshow - "+b)}}function comment_page_title(a,b){try{var c="";comment_load(b,{success:function(b){b&&b.subject&&(c=b.subject),a.call(null,c)}})}catch(d){console.log("comment_page_title - "+d)}}function comment_edit(a,b,c,d){try{c||(c={nid:arg(1)});var e=null;e=d&&d.type?d.type:c.node_type.replace("comment_node_","");var f="comment_node_"+e;a.id+="_"+c.nid,a.entity_type="comment",a.bundle=f,a.action="node/"+c.nid,drupalgap_entity_add_core_fields_to_form("comment",f,a,c),drupalgap_field_info_instances_add_to_form("comment",f,a,c),a.elements.submit={type:"submit",value:t("Save")};var g=t("Add comment");return c&&c.cid&&(g=t("Edit comment"),a.buttons.cancel=drupalgap_form_cancel_button(),a.buttons["delete"]=drupalgap_entity_edit_form_delete_button("comment",c.cid)),a.prefix+="

    "+g+"

    ",a}catch(h){console.log("comment_edit - "+h)}}function comment_edit_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("comment_edit_submit - "+d)}}function comment_services_postprocess(a,b){try{if("comment"==a.service&&"create"==a.resource){var c=drupalgap_path_get(),d=drupalgap_get_menu_link_router_path(c);if("node/%"==d){var e=arg(1),f=comments_container_id(e),g=$("#"+f);if("undefined"!=typeof g.length&&0==g.length)return;node_load(e,{reset:!0,success:function(a){comment_load(b.cid,{success:function(a){$(g).append(theme("comment",{comment:a})).trigger("create"),scrollToElement("#"+f+" #"+comment_container_id(a.cid),500);var b="#"+drupalgap_get_page_id()+" #comment_edit_"+a.nid;drupalgap_form_clear(b)}})}})}}}catch(h){console.log("comment_services_postprocess - "+h)}}function theme_comments(a){try{a.attributes.id=comments_container_id(a.node.nid),a.attributes["class"]+="comments comments-node-"+a.node.type,a.attributes["data-role"]="collapsible-set";var b="
    ";return a.node.comment_count>0&&(b+='

    Comments

    '),a.comments&&(b+=a.comments),b+="
    "}catch(c){console.log("theme_comments - "+c)}}function theme_comment(a){try{var b=a.comment;a.attributes.id=comment_container_id(b.cid),a.attributes["class"]+="comment ",a.attributes["data-role"]="collapsible",a.attributes["data-collapsed"]="false";var c="
    ",d="",e="";b.picture_uri&&(e+=theme("image",{path:drupalgap_image_path(b.picture_uri)}));var f=new Date(1e3*b.created);f=f.toLocaleDateString()+" at "+f.toLocaleTimeString();var g=e+"

    "+b.name+"

    "+f+"

    ";return g=l(g,"user/"+b.uid),d+="

    "+b.subject+'

    • '+g+"
    "+b.content,c+=d,(user_access("administer comments")||user_access("edit own comments")&&b.uid==Drupal.user.uid)&&(c+=theme("button_link",{text:t("Edit"),path:"comment/"+b.cid+"/edit",attributes:{"data-icon":"gear"}})),c+="
    "}catch(h){console.log("theme_comment - "+h)}}function contact_menu(){try{var a={};return a.contact={title:t("Contact"),page_callback:"drupalgap_get_form",page_arguments:["contact_site_form"],pageshow:"contact_site_form_pageshow",access_arguments:["access site-wide contact form"]},a["user/%/contact"]={title:t("User contact"),page_callback:"drupalgap_get_form",page_arguments:["contact_personal_form",1],pageshow:"contact_personal_form_pageshow",access_arguments:["access user contact forms"],weight:10,type:"MENU_LOCAL_TASK"},a}catch(b){console.log("contact_menu - "+b)}}function contact_index(a){try{a.method="GET",a.path="contact.json",a.service="contact",a.resource="index",Drupal.services.call(a)}catch(b){console.log("contact_index - "+b)}}function contact_site(a){try{a.method="POST",a.path="contact/site.json",a.service="contact",a.resource="site",Drupal.services.call(a)}catch(b){console.log("contact_site - "+b)}}function contact_personal(a){try{a.method="POST",a.path="contact/personal.json",a.service="contact",a.resource="personal",Drupal.services.call(a)}catch(b){console.log("contact_personal - "+b)}}function contact_site_form(a,b){try{return a.elements.name={title:t("Your name"),type:"textfield",required:!0},a.elements.mail={title:t("Your e-mail address"),type:"email",required:!0},a.elements.subject={title:t("Subject"),type:"textfield",required:!0},a.elements.cid={title:t("Category"),type:"select",required:!0},a.elements.message={title:t("Message"),type:"textarea",required:!0},a.elements.copy={title:t("Send yourself a copy?"),type:"checkbox",default_value:0,access:!1},a.elements.submit={type:"submit",value:t("Send message")},0!=Drupal.user.uid&&(a.elements.name.default_value=Drupal.user.name,a.elements.name.disabled=!0,a.elements.mail.default_value=Drupal.user.mail,a.elements.mail.disabled=!0,a.elements.copy.access=!0),a}catch(c){console.log("contact_site_form - "+c)}}function contact_site_form_pageshow(){try{contact_index({success:function(a){var b=$("#edit-contact-site-form-cid");if(a&&a.length){for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=1==d.selected?"selected":"",f='";$(b).append(f)}$(b).selectmenu("refresh"),1==a.length&&$(b).hide()}}})}catch(a){console.log("contact_site_form_pageshow - "+a)}}function contact_site_form_submit(a,b){var c={name:b.values.name,mail:b.values.mail,subject:b.values.subject,cid:b.values.cid,message:b.values.message,copy:b.values.copy};contact_site({data:JSON.stringify(c),success:function(a){a[0]?drupalgap_alert(t("Your message has been sent!")):drupalgap_alert(t("There was a problem sending your message!"),{title:t("Error")}),drupalgap_form_clear()},error:function(a,b,c){if(c&&(c=JSON.parse(c),c.form_errors)){var d="";for(var e in c.form_errors)if(c.form_errors.hasOwnProperty(e)){var f=c.form_errors[e];d+=f+"\n"}""!=d&&drupalgap_alert(d)}}})}function contact_personal_form(a,b,c){try{a.elements.name={title:t("Your name"),type:"textfield",required:!0},a.elements.mail={title:t("Your e-mail address"),type:"email",required:!0},a.elements.to={type:"hidden",required:!0};var d=contact_personal_form_to_container_id(c);return a.elements.to_display={title:"To",markup:'
    '},a.elements.subject={title:t("Subject"),type:"textfield",required:!0},a.elements.message={title:t("Message"),type:"textarea",required:!0},a.elements.copy={title:t("Send yourself a copy?"),type:"checkbox",default_value:0,access:!1},a.elements.submit={type:"submit",value:t("Send message")},0!=Drupal.user.uid&&(a.elements.name.default_value=Drupal.user.name,a.elements.name.disabled=!0,a.elements.mail.default_value=Drupal.user.mail,a.elements.mail.disabled=!0,a.elements.copy.access=!0),a}catch(e){console.log("contact_personal_form - "+e)}}function contact_personal_form_pageshow(a,b){try{user_load(b,{success:function(a){if(!a.data.contact)return void $("#"+drupalgap_get_page_id()+" #drupalgap_form_errors").html("
    "+t("Sorry, this user's contact form is disabled.")+"
    ");var c=contact_personal_form_to_container_id(b);$("#"+c).html(l(a.name,"user/"+a.uid));var d="#"+drupalgap_get_page_id()+" #edit-contact-personal-form-to";$(d).val(a.name)}})}catch(c){console.log("contact_personal_form_pageshow - "+c)}}function contact_personal_form_submit(a,b){var c={name:b.values.name,mail:b.values.mail,to:b.values.to,subject:b.values.subject,message:b.values.message,copy:b.values.copy};contact_personal({data:JSON.stringify(c),success:function(a){a[0]?drupalgap_alert(t("Your message has been sent!")):drupalgap_alert(t("There was a problem sending your message!"),{title:t("Error")}),drupalgap_form_clear()},error:function(a,b,c){if(c&&(c=JSON.parse(c),c.form_errors)){var d="";for(var e in c.form_errors)if(c.form_errors.hasOwnProperty(e)){var f=c.form_errors[e];d+=f+"\n"}""!=d&&drupalgap_alert(d)}}})}function contact_personal_form_to_container_id(a){return"contact_personal_form_user_"+a}function drupalgap_entity_view_mode(a,b){var c="drupalgap";return"undefined"!=typeof drupalgap.settings.view_modes&&(a&&b?drupalgap.settings.view_modes[a]&&drupalgap.settings.view_modes[a][b]&&drupalgap.settings.view_modes[a][b].view_mode&&(c=drupalgap.settings.view_modes[a][b].view_mode):a&&drupalgap.settings.view_modes[a]&&drupalgap.settings.view_modes[a].view_mode&&(c=drupalgap.settings.view_modes[a].view_mode)),c}function drupalgap_get_entity_container_id(a,b,c){var d="dg-entity-container-"+a+"-"+b;return c&&(d+="-"+c),d}function drupalgap_get_entity(a,b,c,d){return"
    "+drupalgap_jqm_page_event_script_code({jqm_page_event_callback:"drupalgap_get_entity_pageshow",jqm_page_event_args:JSON.stringify({handler:a,entity_type:b,entity_id:c})})}function drupalgap_get_entity_pageshow(a){var b=4==drupalgap.menu_links[drupalgap_router_path_get()].page_arguments.length?drupalgap.menu_links[drupalgap_router_path_get()].page_arguments[3]:null;entity_load(a.entity_type,a.entity_id,{success:function(c){var d=drupalgap_get_entity_container_id(a.entity_type,a.entity_id,b);$("#"+d).html(drupalgap_render(window[a.handler](c))).trigger("create")}})}function drupalgap_get_entity_form(a,b,c,d){return d=d?d:"edit","
    "+drupalgap_jqm_page_event_script_code({jqm_page_event_callback:"drupalgap_get_entity_form_pageshow",jqm_page_event_args:JSON.stringify({handler:a,entity_type:b,entity_id:c})})}function drupalgap_get_entity_form_pageshow(a){var b=4==drupalgap.menu_links[drupalgap_router_path_get()].page_arguments.length?drupalgap.menu_links[drupalgap_router_path_get()].page_arguments[3]:"edit",c=function(c){ -var d=drupalgap_get_entity_container_id(a.entity_type,a.entity_id,b);$("#"+d).html(drupalgap_get_form(a.handler,c)).trigger("create")};"add"==a.entity_id?c({}):entity_load(a.entity_type,a.entity_id,{success:c})}function entity_install(){entity_clean_local_storage()}function drupalgap_entity_add_core_fields_to_form(a,b,c,d){try{var e=drupalgap_entity_get_core_fields(a,b);for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h=g.default_value;d&&d[f]&&(h=d[f]),c.elements[f]=g,c.elements[f].default_value=h}}catch(i){console.log("drupalgap_entity_add_core_fields_to_form - "+i)}}function drupalgap_entity_assemble_data(a,b,c,d){try{return void console.log("WARNING: drupalgap_entity_assemble_data() has been deprecated! Now just call e.g. node_save() for auto assembly.")}catch(e){console.log("drupalgap_entity_assemble_data - "+e)}}function drupalgap_entity_edit_form_delete_button(a,b){return{title:t("Delete"),attributes:{onclick:"javascript:drupalgap_entity_edit_form_delete_confirmation('"+a+"', "+b+");"}}}function drupalgap_entity_edit_form_delete_confirmation(a,b){try{var c=t("Delete this content, are you sure? This action cannot be undone...");drupalgap_confirm(c,{confirmCallback:function(c){if(2!=c){drupalgap.loader="deleting";var d={};d.success=function(c){var d=a+"/"+b,e=drupalgap_get_page_id(d);drupalgap_page_in_dom(e)&&drupalgap_remove_page_from_dom(e),window.localStorage.removeItem(entity_local_storage_key(a,b));var f=drupalgap_form_local_storage_load("node_edit"),g=f.action?f.action:"";drupalgap_goto(g,{reloadPage:!0,form_submission:!0})};var e=services_get_resource_function_for_entity(a,"delete"),f=window[e];f(b,d)}}})}catch(d){console.log("drupalgap_entity_edit_form_delete_confirmation - "+d)}}function drupalgap_entity_render_content(a,b){try{b.content="";var c=b.type;"comment"==a?c=b.bundle:"taxonomy_term"==a&&(c=b.vocabulary_machine_name);var d=drupalgap_field_info_instances(a,c);if(!d)return;module_invoke_all("entity_pre_build_content",b,a,c);var e={},f={};for(var g in d)if(d.hasOwnProperty(g)){var h=d[g];if(!h.display)break;var i=h.display["default"],j=drupalgap_entity_view_mode(a,c);h.display[j]&&(i=h.display[j],"undefined"==typeof i.module&&"undefined"!=typeof h.display["default"].module&&(i.module=h.display["default"].module)),"hidden"!=i.type&&(f[g]=i,e[g]=b[g]&&"undefined"!=typeof b[g].weight?b[g].weight:i.weight)}module_invoke_all("entity_post_build_content",b,a,c);var k=[];for(var g in e)if(e.hasOwnProperty(g)){var l=e[g];k.push(l)}k.sort(function(a,b){return a-b}),module_invoke_all("entity_pre_render_content",b,a,c);var m=[];for(var n in k)if(k.hasOwnProperty(n)){var o=k[n];for(var g in e)if(e.hasOwnProperty(g)&&"undefined"!=typeof b[g]&&("undefined"==typeof b[g].access||b[g].access)){var l=e[g];if(o==l&&-1==m.indexOf(g)){m.push(g),b.content+=drupalgap_entity_render_field(a,b,g,d[g],f[g]);break}}}module_invoke_all("entity_post_render_content",b,a,c),entity_caching_enabled(a,c)&&_entity_local_storage_save(a,b[entity_primary_key(a)],b)}catch(p){console.log("drupalgap_entity_render_content - "+p)}}function drupalgap_entity_render_field(a,b,c,d,e){try{var f="",g=e.module;if(!g){if(!d.widget.module){var h="drupalgap_entity_render_field - unable to locate the module for the field ("+c+")";return console.log(h),f}g=d.widget.module}var i=g+"_field_formatter_view";if(drupalgap_function_exists(i)){var j=window[i],k=null,l=language_default(),m=b.language;b[c]&&(b[c][l]?k=b[c][l]:b[c][m]?k=b[c][m]:b[c].und?(k=b[c].und,m="und"):k=b[c]);var n=j(a,b,d,drupalgap_field_info_field(c),m,k,e);for(var o in n)if(n.hasOwnProperty(o)){var p=n[o],q="";p.markup?q=p.markup:p.theme&&(q=theme(p.theme,p)),f+=q}}else console.log("WARNING: drupalgap_entity_render_field - "+i+"() does not exist! ("+c+")");if(""!=f&&"hidden"!=e.label){var r="

    "+d.label+"

    ";switch(r="
    "+r+"
    ",e.label){case"below":f+=r;break;case"above":default:f=r+f}}f='
    '+f+"
    ";var s={content:f};return module_invoke_all("entity_post_render_field",b,c,d,s),s.content!=f?s.content:f}catch(t){console.log("drupalgap_entity_render_field - "+t)}}function drupalgap_entity_build_from_form_state(a,b){try{var c={},d=language_default();for(var e in b.values)if(b.values.hasOwnProperty(e)){var f=b.values[e];if("undefined"==typeof a.elements[e].access||a.elements[e].access){var g=!1,h=!1,i=!1;a.elements[e].is_field&&(g=!0,h=a.elements[e].field_info_field.module,i=h+"_assemble_form_state_into_field",function_exists(i)||(i=!1));var j=drupalgap_field_key(e);if(j){var k=a.elements[e].field_info_field.cardinality;if(-1==k&&(k=1),"undefined"==typeof f[d][0])continue;c[e]={};var l=!0;"taxonomy_term_reference"==a.elements[e].type||"options_select"==a.elements[e].field_info_instance.widget.type?(l=!1,c[e][d]={}):c[e][d]=[];for(var m=0;k>m;m++)if("undefined"!=typeof f[d][m]){var n=f[d][m],o={value:"value",use_key:!0,use_wrapper:!0,use_delta:l,name:e,form_id:a.id,element_id:a.elements[e][d][m].id};if(g&&i){var p=window[i];n=p(a.entity_type,a.bundle,n,a.elements[e].field_info_field,a.elements[e].field_info_instance,d,m,o,a)}if(j!=o.value&&(j=o.value),o.use_delta)if(o.use_key){var q={};q[j]=n,c[e][d].push(q)}else c[e][d].push(n);else o.use_wrapper?$.isArray(c[e][d])?(console.log("WARNING: drupalgap_entity_build_from_form_state - cannot use key ("+j+") on field ("+e+") language code array, key will be ignored."),c[e][d].push(n)):c[e][d][j]=n:c[e][d]=n;null===n&&"undefined"!=typeof c[e]&&"list_boolean"!=a.elements[e].type&&(g?0==m?delete c[e]:"undefined"!=typeof c[e][d][m]&&delete c[e][d][m]:delete c[e]),!g||l||"options_select"!=a.elements[e].field_info_instance.widget.type||a.elements[e].required||""!==n||"undefined"==typeof c[e]||delete c[e]}}else"undefined"!=typeof f&&(c[e]=f)}}return c}catch(r){console.log("drupalgap_entity_build_from_form_state - "+r)}}function drupalgap_entity_form_submit(a,b,c){try{var d=entity_primary_key(a.entity_type),e=!1;c[d]&&""!=c[d]&&(e=!0);var f={};f.success=function(b){try{var c=a.action;if(!c){var e=a.entity_type;("taxonomy_vocabulary"==e||"taxonomy_term"==e)&&(e=e.replace("_","/")),c=e+"/"+b[d]}_GET("destination")&&(c=_GET("destination"));var f={form_submission:!0};a.action_options&&(f=$.extend({},f,a.action_options)),drupalgap_goto(c,f)}catch(g){console.log("drupalgap_entity_form_submit - success - "+g)}},f.error=function(c,d,e){try{var f=_drupalgap_form_submit_response_errors(a,b,c,d,e);f&&drupalgap_alert(f)}catch(g){console.log("drupalgap_entity_form_submit - error - "+g)}},drupalgap.loader="saving";var g="create";e&&(g="update",window.localStorage.removeItem(entity_local_storage_key(a.entity_type,c[d])));var h=window[services_get_resource_function_for_entity(a.entity_type,g)];h(c,f)}catch(i){console.log("drupalgap_entity_form_submit - "+i)}}function drupalgap_entity_get_core_fields(a,b){try{var c={};switch(a){case"comment":var d=b.replace("comment_node_",""),e=drupalgap.entity_info[a].schema_fields_sql["base table"];for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h={type:"hidden",required:!1,default_value:"",title:ucfirst(g)};c[g]=h}c.nid.required=!0,c.name.type="textfield",0!=Drupal.user.uid&&(c.name.default_value=Drupal.user.name,c.name.disabled=!0),drupalgap.content_types_list[d].comment_subject_field&&(c.subject.type="textfield");var i=drupalgap.content_types_list[d].comment_anonymous;switch(i){case"0":delete c.mail,delete c.homepage;break;case"1":break;case"2":c.mail.required=!0,c.homepage.required=!0}0==Drupal.user.uid&&(c.mail&&(c.mail.type="textfield"),c.homepage&&(c.homepage.type="textfield"));break;case"node":c.nid={type:"hidden",required:!1,default_value:""},c.title={type:"textfield",title:t("Title"),required:!0,default_value:"",description:""},c.type={type:"hidden",required:!0,default_value:""},c.language={type:"hidden",required:!0,default_value:language_default()};break;case"user":c.uid={type:"hidden",required:!1,default_value:""},c.name={type:"textfield",title:t("Username"),required:!0,default_value:"",description:""},c.mail={type:"email",title:t("E-mail address"),required:!0,default_value:"",description:""},c.picture={type:"image",widget_type:"imagefield_widget",title:t("Picture"),required:!1,value:t("Add Picture")};break;case"taxonomy_term":c={vid:{type:"hidden",required:!0,default_value:""},tid:{type:"hidden",required:!1,default_value:""},name:{type:"textfield",title:t("Name"),required:!0,default_value:""},description:{type:"textarea",title:t("Description"),required:!1,default_value:""}};break;case"taxonomy_vocabulary":c={vid:{type:"hidden",required:!1,default_value:""},name:{type:"textfield",title:t("Name"),required:!0,default_value:""},machine_name:{type:"textfield",title:t("Machine Name"),required:!0,default_value:""},description:{type:"textarea",title:t("Description"),required:!1,default_value:""}};break;default:console.log("drupalgap_entity_get_core_fields - entity type not supported yet ("+a+")")}return c}catch(j){console.log("drupalgap_entity_get_core_fields - "+j)}}function drupalgap_entity_get_info(){try{if(arguments[0]){var a=arguments[0];return a&&drupalgap.entity_info[a]?drupalgap.entity_info[a]:!1}return drupalgap.entity_info}catch(b){console.log("drupalgap_entity_get_info - "+b)}}function drupalgap_entity_get_primary_key(a){try{return console.log("WARNING: drupalgap_entity_get_primary_key() is deprecated! Use entity_primary_key() instead."),entity_primary_key(a)}catch(b){console.log("drupalgap_entity_get_primary_key - "+b)}}function _drupalgap_entity_page_container(a,b,c){try{var d=_drupalgap_entity_page_container_id(a,b,c),e={id:d,"class":a+" "+a+"-"+c};return{markup:"
    "}}catch(f){console.log("_drupalgap_entity_page_container - "+f)}}function _drupalgap_entity_page_container_id(a,b,c){return a+"_"+b+"_"+c+"_container"}function _drupalgap_entity_page_container_inject(a,b,c,d){try{var e=_drupalgap_entity_page_container_id(a,b,c);module_invoke_all("entity_view_alter",a,b,c,d),drupalgap.output=d,$("#"+e).html(drupalgap_render_page()).trigger("create"),_drupalgap_entity_page_add_css_class_names(a,b,d)}catch(f){console.log("_drupalgap_entity_page_container_inject - "+f)}}function _drupalgap_entity_page_add_css_class_names(a,b,c){try{var d=a,e=entity_get_bundle(a,c[a]);e&&(d+="-"+e),d+=" "+a.replace(/_/g,"-")+"-"+b,$("#"+drupalgap_get_page_id()).addClass(d)}catch(f){console.log("_drupalgap_entity_page_add_css_class_names - "+f)}}function entity_page_edit(a,b,c){try{var d={container:_drupalgap_entity_page_container(b,c,"edit")};return d}catch(e){console.log("entity_page_edit - "+e)}}function entity_page_edit_pageshow(a,b,c){try{entity_load(b,c,{success:function(d){_drupalgap_entity_page_container_inject(b,c,"edit",drupalgap_get_form(a,d))}})}catch(d){console.log("entity_page_edit_pageshow - "+d)}}function entity_primary_key_title(a){try{var b;switch(a){case"comment":b="subject";break;case"file":b="filename";break;case"node":b="title";break;case"taxonomy_term":b="name";break;case"taxonomy_vocabulary":b="name";break;case"user":b="name";break;default:console.log("entity_primary_key_title - unsupported entity type ("+a+")")}return b}catch(c){console.log("entity_primary_key_title - "+c)}}function entity_services_request_pre_postprocess_alter(a,b){try{if("retrieve"==a.resource&&in_array(a.service,entity_types())){if("undefined"!=typeof b.content)return;drupalgap_entity_render_content(a.service,b)}else if("comment"==a.service&&"index"==a.resource)for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];"undefined"==typeof d.content&&drupalgap_entity_render_content(a.service,b[c])}}catch(e){console.log("entity_services_request_pre_postprocess_alter - "+e)}}function drupalgap_field_info_field(a){try{return drupalgap.field_info_fields[a]}catch(b){console.log("drupalgap_field_info_field - "+b)}}function drupalgap_field_info_fields(){try{return drupalgap.field_info_fields}catch(a){console.log("drupalgap_field_info_fields - "+a)}}function drupalgap_field_info_instance(a,b,c){try{var d=drupalgap_field_info_instances(a,c);if(!d){var e="WARNING: drupalgap_field_info_instance - instance was null for entity ("+a+") bundle ("+c+") using field ("+b+")";return console.log(e),null}if(!d[b]){var e='WARNING: drupalgap_field_info_instance - "'+b+'" does not exist for entity ('+a+") bundle ("+c+")";return console.log(e),null}return d[b]}catch(f){console.log("drupalgap_field_info_instance - "+f)}}function drupalgap_field_info_instances(a,b){try{var c;return b?"undefined"!=typeof drupalgap.field_info_instances[a]&&(c=drupalgap.field_info_instances[a][b]):c="commerce_product"==a?drupalgap.field_info_instances[a]:drupalgap.field_info_instances[a][a],c}catch(d){console.log("drupalgap_field_info_instances - "+d)}}function drupalgap_field_info_instances_add_to_form(a,b,c,d){try{var e=drupalgap_field_info_instances(a,b),f=language_default();if(d&&d.language&&(f=d.language),e)for(var g in e)if(e.hasOwnProperty(g)){var h=e[g];if("user_register_form"!=c.id||h.settings.user_register_form){var i=drupalgap_field_info_field(g);if(i){c.elements[g]={type:i.type,title:h.label,required:h.required,description:h.description};var j=h.default_value,k=parseInt(i.cardinality);if(-1==k&&(k=1),d&&d[g]&&0!=d[g].length){if(!d[g][f]){if(!d[g].und)continue;f="und"}c.elements[g][f]||(c.elements[g][f]={});for(var l=0;k>l;l++)d[g][f][l]&&"undefined"!=typeof d[g][f][l].value&&(j=d[g][f][l].value),null==j&&(j=""),c.elements[g][f][l]={value:j},d[g][f][l]&&(c.elements[g][f][l].item=d[g][f][l]);d&&d.language&&(f=d.language)}var m=h.widget.module+"_field_info_instance_add_to_form";drupalgap_function_exists(m)&&window[m](a,b,c,d,c.elements[g])}}}}catch(n){console.log("drupalgap_field_info_instances_add_to_form - "+n)}}function drupalgap_field_key(a){try{var b=!1,c=drupalgap_field_info_field(a);return c&&(b="value","image"==c.module&&"image"==c.type?b="fid":"taxonomy"==c.module&&"taxonomy_term_reference"==c.type&&(b="tid")),b}catch(d){console.log("drupalgap_field_key - "+d)}}function list_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if(!empty(f))for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k="";"list_default"==g.type?(k=d.settings.allowed_values[j.value],"list_boolean"==d.type&&"options_onoff"==c.widget.type&&(k=" ")):k=j.value,h[i]={markup:k}}return h}catch(l){console.log("list_field_formatter_view - "+l)}}function list_assemble_form_state_into_field(a,b,c,d,e,f,g,h){try{var i=c;switch(d.type){case"list_boolean":if("options_onoff"==e.widget.type){var j=0,k=!0;for(var l in d.settings.allowed_values)if(d.settings.allowed_values.hasOwnProperty(l)){d.settings.allowed_values[l];if(c==l&&0==j){k=!1;break}j++}k||(h.use_delta=!1,h.use_wrapper=!1,i=null)}else console.log("WARNING: list_assemble_form_state_into_field - unknown widget ("+d.type+") on list_boolean");break;case"list_text":"user"==a&&"options_buttons"==e.widget.type&&(h.use_delta=!1,h.use_wrapper=!1);break;default:console.log("WARNING: list_assemble_form_state_into_field - unknown type ("+d.type+")")}return i}catch(m){console.log("list_assemble_form_state_into_field - "+m)}}function list_views_exposed_filter(a,b,c,d,e){try{var f=d.options.group_info.widget;"select"==f?(empty(d.value)||(c.value=d.value[0]),c.options=d.value_options,c.required||(c.options.All="- "+t("Any")+" -","undefined"==typeof c.value&&(c.value="All"))):console.log("WARNING: list_views_exposed_filter - unsupported widget:"+f)}catch(g){console.log("list_views_exposed_filter - "+g)}}function number_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if("string"==typeof f&&(f={0:{value:f}}),!empty(f)){var i="";empty(c.settings.prefix)||(i=c.settings.prefix);var j="";empty(c.settings.suffix)||(j=c.settings.suffix);for(var k in f)if(f.hasOwnProperty(k)){var l=f[k];h[k]={markup:i+l.value+j}}}return h}catch(m){console.log("number_field_formatter_view - "+m)}}function number_field_widget_form(a,b,c,d,e,f,g,h){try{switch(h.type){case"number_integer":case"number_float":case"number_decimal":case"range":"range"!=h.type&&(f[g].type="number"),empty(d.settings.max)||(f[g].options.attributes.min=d.settings.min),empty(d.settings.max)||(f[g].options.attributes.max=d.settings.max);var i=1;"number_float"==h.type&&(i=.01),"number_decimal"==h.type&&(i=.01),f[g].options.attributes.step=i;break;default:console.log("number_field_widget_form - element type not supported ("+h.type+")")}}catch(j){console.log("number_field_widget_form - "+j)}}function options_field_widget_form(a,b,c,d,e,f,g,h){try{switch(h.type){case"checkbox":1==f[g].default_value&&(f[g].checked=!0);break;case"radios":break;case"list_boolean":switch(d.widget.type){case"options_onoff":f[g].type="checkbox";var i=null,j=null;if($.isArray(c.settings.allowed_values))for(var k in c.settings.allowed_values)null===i?i=k:j=k;else for(var l in c.settings.allowed_values)if(c.settings.allowed_values.hasOwnProperty(l)){c.settings.allowed_values[l];null===i?i=l:j=l}f[g].options.attributes.off=i,f[g].options.attributes.on=j,"undefined"!=typeof f[g]&&f[g].value==j&&(f[g].options.attributes.checked="checked");break;default:console.log("WARNING: options_field_widget_form list_boolean with unsupported type ("+d.widget.type+")")}break;case"select":case"list_text":case"list_float":case"list_integer":if(d){switch(d.widget.type){case"options_select":f[g].type="select";var m="- None -";f[g].required&&(m="- "+t("Select a value")+" -"),f[g].options[""]=m,empty(f[g].value)&&(f[g].value=""),1!=c.cardinality&&(f[g].options.attributes["data-native-menu"]="false",f[g].options.attributes.multiple="multiple");break;case"options_buttons":var n="checkboxes";1==c.cardinality&&(n="radios"),f[g].type=n;break;default:return console.log("WARNING: options_field_widget_form - unsupported widget ("+d.widget.type+")"),!1}if(c&&c.settings.allowed_values){for(var k in c.settings.allowed_values)if(c.settings.allowed_values.hasOwnProperty(k)){var l=c.settings.allowed_values[k];if("object"!=typeof l){if("undefined"!=typeof f[g].options[k])break;f[g].options[k]=l}}d.default_value&&d.default_value[g]&&"undefined"!=typeof d.default_value[g].value&&(f[g].value=d.default_value[g].value)}}break;case"taxonomy_term_reference":f[g].type="hidden";var o=c.settings.allowed_values[0].vocabulary,p=taxonomy_vocabulary_machine_name_load(o),q=!1;if("options_select"!=d.widget.type)return console.log("WARNING: options_field_widget_form() - "+d.widget.type+" not yet supported for "+h.type+" form elements!"),!1;q="select";var r=f[g].id+"-"+q,m="- "+t("None")+" -";f[g].required&&(m="- "+t("Select a value")+" -"),f[g].children.push({type:q,attributes:{id:r,onchange:"_theme_taxonomy_term_reference_onchange(this, '"+f[g].id+"');"},options:{"":m}});var s={page_id:drupalgap_get_page_id(drupalgap_path_get()),jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_taxonomy_term_reference_load_items",jqm_page_event_args:JSON.stringify({taxonomy_vocabulary:p,widget_id:r})};f[g].children.push({markup:drupalgap_jqm_page_event_script_code(s,c.field_name)});break;default:var u="options_field_widget_form - unknown widget type: "+h.type;console.log(u)}}catch(v){console.log("options_field_widget_form - "+v)}}function text_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if(f.length)for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k="undefined"!=typeof j.safe_value?j.safe_value:j.value;if("text_summary_or_trimmed"==g.type){var l=g.settings.trim_length;k=k.length>l?k.substring(0,l-3)+"...":k.substring(0,l)}h[i]={markup:k}}return h}catch(m){console.log("text_field_formatter_view - "+m)}}function text_field_widget_form(a,b,c,d,e,f,g,h){try{var i=null;switch(h.type){case"search":i="search";break;case"text":i="textfield";break;case"textarea":case"text_long":case"text_with_summary":case"text_textarea":i="textarea"}f[g].type=i,"undefined"!=typeof f[g].value&&"undefined"==typeof f[g].options.attributes.value&&(f[g].options.attributes.value=f[g].value)}catch(j){console.log("text_field_widget_form - "+j)}}function file_field_formatter_view(a,b,c,d,e,f,g){try{var h={};for(var i in f)if(f.hasOwnProperty(i)){var j=f[i];switch(g.type){case"file_table":h.file_table||(h.file_table={theme:"jqm_table",header:[{data:t("Attachment")},{data:t("Size")}],rows:[],attributes:{border:1}});var k=drupalgap_image_path(j.uri);"application/pdf"==j.filemime&&"undefined"!=typeof device&&"Android"==device.platform&&(k="https://docs.google.com/gview?embedded=true&url="+k),h.file_table.rows.push([l(j.filename,k,{InAppBrowser:!0}),Math.round(j.filesize/1e3).toFixed(2)+" KB"]);break;default:console.log("file_field_formatter_view() - unsupported display type: "+g.type)}}return h}catch(m){console.log("file_field_formatter_view - "+m)}}function file_entity_field_formatter_view(a,b,c,d,e,f,g){try{if("file_rendered"==g.type)return media_field_formatter_view(a,b,c,d,e,f,g);var h={};for(var i in f)if(f.hasOwnProperty(i)){f[i];switch(g.type){default:console.log("file_entity_field_formatter_view() - unsupported display type: "+g.type)}}return h}catch(j){console.log("file_entity_field_formatter_view - "+j)}}function image_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if(empty(f)&&d.settings.default_image&&(f=[{uri:d.settings.default_image_uri}]),!empty(f))for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k=empty(g.settings.image_style)?"image":"image_style",l={theme:k,alt:j.alt,title:j.title};"image_style"==k?(l.style_name=g.settings.image_style,l.path=j.uri):l.path=drupalgap_image_path(j.uri),h[i]=l}return h}catch(m){console.log("image_field_formatter_view - "+m)}}function image_field_widget_form(form,form_state,field,instance,langcode,items,delta,element){try{if(items[delta].type="hidden","user_profile_form"==form.id&&"picture"==element.name&&(field={field_name:"picture"}),"undefined"!=typeof items[delta].item&&items[delta].item.fid){items[delta].value=items[delta].item.fid;var path=drupalgap_image_path(items[delta].item.uri),html=theme("image",{path:path})+'
    '+l(items[delta].item.filename,path,{InAppBrowser:!0})+"
    ";return void items[delta].children.push({markup:html})}var button_text=t("Take Photo");items[delta].value&&(button_text=items[delta].value);var browse_button_text=t("Browse");items[delta].value2&&(browse_button_text=items[delta].value2);var item_id_base=items[delta].id.replace(/-/g,"_"),image_field_source=item_id_base+"_imagefield_source",imagefield_destination_type=item_id_base+"_imagefield_destination_type",imagefield_data=item_id_base+"_imagefield_data";eval("var "+image_field_source+" = null;"),eval("var "+imagefield_destination_type+" = null;"),eval("var "+imagefield_data+" = null;");var browse_button_id=items[delta].id+"-browse-button",html='";html+='",items[delta].children.push({markup:html})}catch(error){console.log("image_field_widget_form - "+error)}}function _image_field_widget_form_remove_image(){try{alert("_image_field_widget_form_remove_image")}catch(a){console.log("_image_field_widget_form_remove_image - "+a)}}function image_fields_present_on_entity_type(a,b){try{var c=[],d=drupalgap_field_info_instances(a,b);if(!d)return!1;for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];f.widget&&f.widget.type&&"image_image"==f.widget.type&&c.push(e)}return 0==c.length?!1:c}catch(g){console.log("image_fields_present_on_entity_type - "+g)}}function image_form_alter(a,b,c){try{if(a.entity_type){var d=a.bundle,e=image_fields_present_on_entity_type(a.entity_type,d);if(e&&(a.image_fields=e,$.isArray(e)))for(var f in e)if(e.hasOwnProperty(f)){var g=e[f];image_phonegap_camera_options[g]={0:null}}}}catch(h){console.log("image_form_alter - "+h)}}function image_style_url(a,b){try{var c=Drupal.settings.site_path+Drupal.settings.base_path+b;return-1!=c.indexOf("public://")?c=c.replace("public://",Drupal.settings.file_public_path+"/styles/"+a+"/public/"):-1!=c.indexOf("private://")&&(c=c.replace("private://",Drupal.settings.file_private_path+"/styles/"+a+"/private/")),c}catch(d){console.log("image_style_url - "+d)}}function _image_phonegap_camera_getPicture_success(a){try{image_phonegap_camera_options[a.field_name]={0:a};var b=a.id+"-imagefield",c=document.getElementById(b);c.src="data:image/jpeg;base64,"+image_phonegap_camera_options[a.field_name][0].image,c.onload=function(){var a=this.width,d=this.height,e=a/drupalgap_max_width(),f=a/e,g=d/e;c.width=f,c.height=g,$("#"+b).show()}}catch(d){console.log("_image_phonegap_camera_getPicture_success - "+d)}}function _image_field_form_process(a,b,c){try{var d=language_default(),e=!1;for(var f in a.image_fields)if(a.image_fields.hasOwnProperty(f)){var g=a.image_fields[f];if(image_phonegap_camera_options[g][0]&&""==b.values[g][d][0]){var h=new Date,i=Drupal.user.uid+"_"+h.valueOf()+".jpg",j={file:{file:image_phonegap_camera_options[g][0].image,filename:i,filepath:"public://"+i}};empty(Drupal.settings.file_private_path)||(j.file.filepath="private://"+i),drupalgap.loader="saving",e=!0,file_save(j,{async:!1,success:function(e){try{var f=drupalgap_form_get_element_id(g,a.id);$("#"+f).val(e.fid),b.values[g][d][0]=e.fid,c.success&&c.success()}catch(h){console.log("_image_field_form_process - success - "+h)}}})}}!e&&c.success&&c.success()}catch(k){console.log("_image_field_form_validate - "+k)}}function image_assemble_form_state_into_field(a,b,c,d,e,f,g,h){try{return h.value="fid",c}catch(i){console.log("image_assemble_form_state_into_field - "+i)}}function menu_block_view(a,b){try{var c=drupalgap.menus[a],d=menu_container_id(a),e=null;b.attributes&&b.attributes["data-role"]&&(e=b.attributes["data-role"]);var f={};return"undefined"!=typeof c.options&&"undefined"!=typeof c.options.wrap&&c.options.wrap&&c.options.wrap_options&&c.options.wrap_options.attributes&&(f=c.options.wrap_options.attributes),f.id=d,"
    "+drupalgap_jqm_page_event_script_code({page_id:drupalgap_get_page_id(),jqm_page_event:"pageshow",jqm_page_event_callback:"menu_block_view_pageshow",jqm_page_event_args:JSON.stringify({menu_name:a,container_id:d,"data-role":e})},a)}catch(g){console.log("menu_block_view - "+g)}}function menu_block_view_pageshow(a){try{var b="",c=drupalgap_path_get(),d=a.menu_name;if("primary_local_tasks"==d){var e=drupalgap_router_path_get();if(drupalgap.menu_links[e]){var f=null;drupalgap.menu_links[e].parent&&(f=drupalgap.menu_links[e].parent);var g=null;drupalgap.menu_links[e].children?g=drupalgap.menu_links[e].children:f&&drupalgap.menu_links[f]&&drupalgap.menu_links[f].children&&(g=drupalgap.menu_links[f].children);var h=arg(),i=function(c){try{var d=[];if(g&&!empty(g))for(var f in g)if(g.hasOwnProperty(f)){var h=g[f];!drupalgap.menu_links[h]||"MENU_DEFAULT_LOCAL_TASK"!=drupalgap.menu_links[h].type&&"MENU_LOCAL_TASK"!=drupalgap.menu_links[h].type||drupalgap_menu_access(h,null,c)&&d.push(drupalgap.menu_links[h])}if(1==d.length&&"MENU_DEFAULT_LOCAL_TASK"==d[0].type)b="";else{var i=[];for(var f in d)if(d.hasOwnProperty(f)){var j=d[f],k=jQuery.extend(!0,{},j);k.options?k.options.attributes||(k.options.attributes={}):k.options={attributes:{}};var m=k.path;"MENU_DEFAULT_LOCAL_TASK"==k.type&&k.parent&&(m=k.parent,k.path=arg(null,k.parent).join("/")),m==e&&(k.options.attributes["class"]||(k.options.attributes["class"]=""),k.options.attributes["class"]+=" ui-btn ui-btn-active ui-state-persist "),i.push(l(k.title,drupalgap_place_args_in_path(k.path),k.options))}i.length>0&&(b=theme("item_list",{items:i}))}$("#"+a.container_id).html(b).trigger("create"),a["data-role"]&&"navbar"==a["data-role"]&&$("#"+a.container_id).navbar();var n=drupalgap.menus[a.menu_name];"undefined"==typeof n.options||"undefined"!=typeof n.options.wrap&&n.options.wrap||$("#"+a.container_id).children().unwrap()}catch(o){console.log("menu_block_view_pageshow - success - "+o)}},j=!1,k=!1;if(g)for(var m in g)if(g.hasOwnProperty(m)){var n=g[m];!drupalgap.menu_links[n]||"MENU_DEFAULT_LOCAL_TASK"!=drupalgap.menu_links[n].type&&"MENU_LOCAL_TASK"!=drupalgap.menu_links[n].type||(drupalgap_path_has_entity_arg(arg(null,n))&&(j=!0),"undefined"!=typeof drupalgap.menu_links[n].access_callback&&(k=!0))}if(j&&k){for(var o=!1,p=null,q=0;q0){var C=null;x.options&&x.options.attributes&&(C=drupalgap.menus[d].options.attributes),b=theme("item_list",{items:y,attributes:C})}}$("#"+a.container_id).html(b).trigger("create");var D=!1;x&&"undefined"!=typeof x.options&&"undefined"!=typeof x.options.wrap&&x.options.wrap&&(D=!0),D||$("#"+a.container_id).children().unwrap()}}catch(E){console.log("menu_block_view_pageshow - "+E)}}function menu_install(){try{var a=menu_list_system_menus();for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];menu_save(c)}}catch(d){console.log("menu_install - "+d)}}function menu_popup_get_default_options(){return{attributes:{"data-role":"listview"},wrap:!0,wrap_options:{attributes:{"data-role":"popup"}}}}function menu_region_link_get_data(a){try{var b=null;return b="undefined"==typeof a.region?a:a.region}catch(c){console.log("menu_region_link_get_data - "+c)}}function menu_region_link_get_side(a){try{var b="left"; -return-1!=a.indexOf("ui-btn-right")&&(b="right"),b}catch(c){console.log("menu_region_link_get_side - "+c)}}function menu_save(a){try{drupalgap.menus[a.menu_name]=a}catch(b){console.log("menu_save - "+b)}}function menu_load(a){try{return"undefined"!=typeof drupalgap.menus[a]?drupalgap.menus[a]:null}catch(b){console.log("menu_load - "+b)}}function menu_container_id(a){try{var b=null;return b=arguments[1]?arguments[1]:drupalgap_get_page_id(),b+"_menu_"+a}catch(c){console.log("menu_container_id - "+c)}}function collection_list_page(a,b){try{var c={collection_list:{theme:"jqm_item_list",title:t("Collection")}},d=[],e=collection_load(a,b);if(e){for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h="mvc/item/"+a+"/"+b+"/"+f;d.push(l(g.name,h))}c.collection_list.items=d}return c}catch(i){console.log("collection_list_page - "+i)}}function collection_load(a,b){try{return JSON.parse(window.localStorage.getItem(mvc_get_collection_key("collection",a,b)))}catch(c){console.log("collection_load - "+c)}}function collection_save(a,b,c){try{window.localStorage.setItem(mvc_get_collection_key("collection",a,b),JSON.stringify(c))}catch(d){console.log("collection_save - "+d)}}function mvc_get_collection_key(a,b,c){return"mvc_"+a+"_"+b+"_"+c}function mvc_install(){try{for(var a=module_implements("mvc_model"),b=0;b"+t("Create Content")+""},node_type_listing:{theme:"jqm_item_list",title:t("Content Types"),attributes:{id:"node_type_listing_items"}}},b=[],c=Drupal.user.content_types_user_permissions;for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];e.create&&b.push(l(drupalgap.content_types_list[d].name,"node/add/"+d))}return a.node_type_listing.items=b,a}catch(f){console.log("node_add_page - "+f)}}function node_add_page_by_type(a){try{return drupalgap_get_form("node_edit",{type:a})}catch(b){console.log("node_add_page_by_type - "+b)}}function node_add_page_by_type_title(a,b){try{var c=t("Create")+" "+drupalgap.content_types_list[b].name;return a.call(null,c)}catch(d){console.log("node_add_page_by_type_title - "+d)}}function node_edit(a,b,c){try{return a.entity_type="node",a.bundle=c.type,drupalgap_entity_add_core_fields_to_form("node",c.type,a,c),drupalgap_field_info_instances_add_to_form("node",c.type,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.nid&&(a.buttons["delete"]=drupalgap_entity_edit_form_delete_button("node",c.nid)),a}catch(d){console.log("node_edit - "+d)}}function node_edit_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("node_edit_submit - "+d)}}function node_menu(){var a={node:{title:t("Content"),page_callback:"node_page",pageshow:"node_page_pageshow"},"node/add":{title:t("Add content"),page_callback:"node_add_page"},"node/add/%":{title:t("Add content"),title_callback:"node_add_page_by_type_title",title_arguments:[2],page_callback:"node_add_page_by_type",page_arguments:[2],options:{reloadPage:!0}},"node/%":{title:t("Node"),page_callback:"node_page_view",page_arguments:[1],pageshow:"node_page_view_pageshow",title_callback:"node_page_title",title_arguments:[1]},"node/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"node/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["node_edit","node",1],weight:0,type:"MENU_LOCAL_TASK",access_callback:"node_access",access_arguments:[1],options:{reloadPage:!0}}};return a}function node_page(){var a={create_content:{theme:"button_link",path:"node/add",text:t("Create Content")},node_listing:{theme:"jqm_item_list",title:t("Content List"),items:[],attributes:{id:"node_listing_items"}}};return a}function node_page_pageshow(){try{views_datasource_get_view_result("drupalgap/views_datasource/drupalgap_content",{success:function(a){var b=[];for(var c in a.nodes)if(a.nodes.hasOwnProperty(c)){var d=a.nodes[c];b.push(l(d.node.title,"node/"+d.node.nid))}drupalgap_item_list_populate("#node_listing_items",b)}})}catch(a){console.log("node_page_pageshow - "+a)}}function node_page_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("node",a,"view")};return b}drupalgap_error(t("No node id provided!"))}catch(c){console.log("node_page_view - "+c)}}function node_page_view_pageshow(a){try{node_load(a,{success:function(a){var b="node_page_view_alter_"+a.type,c=module_implements(b);if(c.length>0){if(c.length>1){var d="node_page_view_pageshow - WARNING - there is more than one module implementing hook_"+b+"(), we will use the first one: "+c[0];console.log(d)}var e=c[0]+"_"+b,f=window[e];return void f(a,{success:function(b){_drupalgap_entity_page_container_inject("node",a.nid,"view",b)}})}var g=function(b){_drupalgap_entity_page_container_inject("node",a.nid,"view",b),drupalgap.page.options.success&&drupalgap.page.options.success(a)},h=language_default(),i=a.title;a.title_field&&a.title_field[h]&&(i=a.title_field[h][0].safe_value);var j={theme:"node",node:a,title:{markup:i},content:{markup:a.content}};if("undefined"==typeof a.comment)g(j);else if(0!=a.comment){if(1==a.comment||2==a.comment){var k="";if(2==a.comment&&(k=drupalgap_get_form("comment_edit",{nid:a.nid},a)),0!=a.comment_count){var l={parameters:{nid:a.nid}};comment_index(l,{success:function(b){try{var c="";for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c+=theme("comment",{comment:e})}j.content.markup+=theme("comments",{node:a,comments:c}),2==a.comment&&user_access("post comments")&&(j.content.markup+=k),g(j)}catch(f){var h="node_page_view_pageshow - comment_index - "+f;console.log(h)}},error:function(a,b,c){drupalgap.page.options.error&&drupalgap.page.options.error(a,b,c)}})}else 2==a.comment&&(j.content.markup+=theme("comments",{node:a}),user_access("post comments")&&(j.content.markup+=k)),g(j)}}else j.content.markup+=theme("comments",{node:a}),g(j)},error:function(a,b,c){drupalgap.page.options.error&&drupalgap.page.options.error(a,b,c)}})}catch(b){console.log("node_page_view_pageshow - "+b)}}function node_page_title(a,b){try{var c="";node_load(b,{success:function(b){b&&b.title&&(c=b.title),a.call(null,c)}})}catch(d){console.log("node_page_title - "+d)}}function node_theme(){return{node:{template:"node"}}}function search_block_info(){try{var a={};return a.search={delta:"search",module:"search"},a}catch(b){console.log("search_block_info - "+b)}}function search_block_view(a,b){try{var c="";return"search"==a&&user_access("search content")&&(c=drupalgap_get_form("search_block_form")),c}catch(d){console.log("search_block_view - "+d)}}function search_menu(){try{var a={};return a["search/%/%"]={title:t("Search"),page_callback:"drupalgap_get_form",pageshow:"search_form_pageshow",page_arguments:["search_form"],access_arguments:["search content"]},a}catch(b){console.log("search_menu - "+b)}}function search_block_form(a,b){try{return a.elements.type={type:"hidden",default_value:"node"},a.elements.keys={type:"search",title:"",title_placeholder:!0,required:!0,default_value:""},a.options.attributes.onsubmit="_drupalgap_form_submit('"+a.id+"'); return false;",a}catch(c){console.log("search_block_form - "+c)}}function search_block_form_submit(a,b){try{var c=b.values.type,d=b.values.keys;drupalgap_goto("search/"+c+"/"+d)}catch(e){console.log("search_block_form_submit - "+e)}}function search_form(a,b){try{var c=arg(1),d=arg(2);return a.elements.type={type:"hidden",default_value:c?c:"node"},a.elements.keys={type:"textfield",title:t("Enter your keywords"),required:!0,default_value:d?d:""},a.elements.submit={type:"submit",value:t("Go"),options:{attributes:{"data-icon":"search"}}},a.suffix+=theme("jqm_item_list",{title:t("Search results"),items:[],options:{attributes:{id:"search_form_results"}}}),a}catch(e){console.log("search_form - "+e)}}function search_form_submit(a,b){try{var c=b.values.type,d=b.values.keys;switch(c){case"node":search_node(d,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=theme("search_result_node",d);b.push(e)}drupalgap_item_list_populate("#search_form_results",b)}});break;default:console.log("search_form_submit - unsupported type ("+c+")")}}catch(e){console.log("search_form_submit - "+e)}}function search_form_pageshow(a){try{var b=arg(1),c=arg(2);switch(b){case"node":search_node(c,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=theme("search_result_node",d);b.push(e)}drupalgap_item_list_populate("#search_form_results",b)}});break;default:console.log("search_form_pageshow - unsupported type ("+b+")")}}catch(d){console.log("search_form_pageshow - "+d)}}function search_node(a,b){try{b.method="GET",b.path="search_node/retrieve.json&keys="+encodeURIComponent(a),b.service="search_node",b.resource="retrieve",Drupal.services.call(b)}catch(c){console.log("search_node - "+c)}}function theme_search_result_node(a){try{return l("

    "+a.title+"

    "+a.snippet+"

    ","node/"+a.node.nid)}catch(b){console.log("theme_search_result_node - "+b)}}function drupalgap_services_get_entity_resource(a){try{return console.log("WARNING: drupalgap_services_get_entity_resource() is deprecated! Use services_get_resource_function_for_entity() instead."),drupalgap.services[a]?drupalgap.services[a]:null}catch(b){console.log("drupalgap_services_get_entity_resource - "+b)}}function services_get_resource_function_for_entity(a,b){var c=a+"_";switch(b){case"create":c+="save";break;case"retrieve":c+="load";break;case"update":c+="save";break;case"delete":c+="delete";break;default:c+="load"}return c}function drupalgap_service_resource_extract_results(a){try{if("system"==a.service&&"connect"==a.resource){a.data.user.permissions=[];var b=a.data.user_permissions;for(var c in b)a.data.user.permissions.push(b[c]);var d=a.data.content_types_list;for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];drupalgap.content_types_list[f.type]=f}a.data.user.content_types_user_permissions=a.data.content_types_user_permissions,drupalgap.site_settings=a.data.site_settings,"undefined"!=typeof a.data.date_formats&&(drupalgap.date_formats=a.data.date_formats),"undefined"!=typeof a.data.date_types&&(drupalgap.date_types=a.data.date_types)}}catch(g){console.log("drupalgap_service_resource_extract_results - "+g)}}function drupalgap_services_rss_extract_items(a){try{var b=null,c=$(a);if(c){var b=[];c.find("item").each(function(){var a=$(this),c={title:a.find("title").text(),link:a.find("link").text(),description:a.find("description").text(),pubDate:a.find("pubDate").text(),author:a.find("author").text()};b.push(c)})}return b}catch(d){console.log("drupalgap_services_rss_extract_items - "+d)}}function system_install(){for(var a in Drupal.cache_expiration.forms)Drupal.cache_expiration.forms.hasOwnProperty(a)&&drupalgap_form_local_storage_delete(a);Drupal.cache_expiration.forms={},window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}function system_block_info(){var a={main:{delta:"main",module:"system"},messages:{delta:"messages",module:"system"},logo:{delta:"logo",module:"system"},logout:{delta:"logout",module:"system"},title:{delta:"title",module:"system"},powered_by:{delta:"powered_by",module:"system"},help:{delta:"help",module:"system"}},b=menu_list_system_menus();for(var c in b)if(b.hasOwnProperty(c)){var d=b[c],e=d.menu_name;a[e]={name:e,delta:e,module:"menu"}}return a}function system_block_view(a){try{switch(a){case"main":return drupalgap_render_page();case"messages":var b="";if(0==drupalgap.messages.length)return b;for(var c in drupalgap.messages)if(drupalgap.messages.hasOwnProperty(c)){var d=drupalgap.messages[c];b+='
    '+d.message+"
    "}return drupalgap.messages=[],b;case"logo":return drupalgap.settings.logo?'":"";case"logout":return Drupal.user.uid?theme("logout"):"";case"title":var e=system_title_block_id(drupalgap_path_get());return'

    ';case"powered_by":return'

    '+t("Powered by")+": "+l("DrupalGap","http://www.drupalgap.org",{InAppBrowser:!0})+"

    ";case"help":return l("Help","http://www.drupalgap.org/support");default:return""}}catch(f){console.log("system_block_info - "+f)}}function system_menu(){var a={dashboard:{title:t("Dashboard"),page_callback:"system_dashboard_page"},error:{title:t("Error"),page_callback:"system_error_page"},offline:{title:t("Offline"),page_callback:"system_offline_page"},401:{title:"401 - "+t("Not Authorized"),page_callback:"system_401_page"},404:{title:"404 - "+t("Not Found"),page_callback:"system_404_page"}};return a._reload={title:t("Reloading")+"...",page_callback:"system_reload_page",pageshow:"system_reload_pageshow"},a}function system_401_page(a){return t("Sorry, you are not authorized to view this page.")}function system_404_page(a){return t("Sorry, the page you requested was not found.")}function system_reload_page(){try{var a=drupalgap_get_messages();return empty(a)||(_system_reload_messages=a.slice(),drupalgap_set_messages([])),""}catch(b){console.log("system_reload_page - "+b)}}function system_reload_pageshow(){try{if(_system_reload_messages&&!empty(_system_reload_messages)){for(var a=0;a<_system_reload_messages.length;a++)drupalgap_set_message(_system_reload_messages[a].message,_system_reload_messages[a].type);_system_reload_messages=null}drupalgap_loading_message_show()}catch(b){console.log("system_reload_pageshow - "+b)}}function system_drupalgap_goto_post_process(a){try{if("_reload"==a){if(!_system_reload_page)return;var a=""+_system_reload_page;_system_reload_page=null,drupalgap_loading_message_show(),drupalgap_goto(a,{reloadPage:!0})}}catch(b){console.log("system_drupalgap_goto_post_process - "+b)}}function system_dashboard_page(){try{var a={};return a.site_info={markup:'

    '+Drupal.settings.site_path+"

    "},a.welcome={markup:'

    '+t("Welcome to DrupalGap")+'

    '+t("The open source application development kit for Drupal!")+"

    "},drupalgap.settings.logo&&(a.logo={markup:"
    "+theme("image",{path:drupalgap.settings.logo})+"
    "}),a.get_started={theme:"button_link",text:t("Getting Started Guide"),path:"http://www.drupalgap.org/get-started",options:{InAppBrowser:!0}},a.support={theme:"button_link",text:t("Support"),path:"http://www.drupalgap.org/support",options:{InAppBrowser:!0}},a}catch(b){console.log("system_dashboard_page - "+b)}}function system_error_page(){var a={info:{markup:"

    "+t("An unexpected error has occurred!")+"

    "}};return a}function system_offline_page(){try{var a={message:{markup:"

    "+t("Failed Connection")+"

    "+t("Oops! We couldn't connect to")+":

    "+Drupal.settings.site_path+"

    "},try_again:{theme:"button",text:t("Try Again"),attributes:{onclick:"javascript:offline_try_again();"}},footer:{markup:"

    "+t("Check your device's network settings and try again.")+"

    "}};return a}catch(b){console.log("system_offline_page - "+b)}}function offline_try_again(){try{var a=drupalgap_check_connection();if(!drupalgap.online){var b=t("Sorry, no connection found!")+" ("+a+")";return drupalgap_alert(b,{title:"Offline"}),!1}system_connect({success:function(){drupalgap_goto("")}})}catch(c){console.log("offline_try_again - "+c)}}function system_regions_list(){var a=["header","content","footer"];return a}function system_settings_form(a,b){try{return a.elements.submit||(a.elements.submit={type:"submit",value:t("Save configuration")}),a.buttons.cancel||(a.buttons.cancel=drupalgap_form_cancel_button()),a.submit.push("system_settings_form_submit"),a}catch(c){console.log("system_settings_form - "+c)}}function system_settings_form_submit(a,b){try{if(b.values)for(var c in b.values)if(b.values.hasOwnProperty(c)){var d=b.values[c];variable_set(c,d)}}catch(e){console.log("system_settings_form_submit - "+e)}}function system_title_block_id(a){try{var b="drupalgap_page_title_"+drupalgap_get_page_id(a);return b}catch(c){console.log("system_title_block_id - "+c)}}function system_logout_block_access_callback(a){try{var b=arg(null,a.path);return b&&2==b.length&&"user"==b[0]&&b[1]==Drupal.user.uid?!0:!1}catch(c){console.log("system_logout_block_access_callback - "+c)}}function drupalgap_taxonomy_vocabularies_extract(a){try{var b=!1;if(a&&a.length>0){b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b[d.machine_name]=d}}return b}catch(e){console.log("drupalgap_taxonomy_vocabularies_extract - "+e)}}function taxonomy_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if("string"==typeof f&&(f={0:{tid:f}}),"undefined"!=typeof f[language_default()]&&(f=f[language_default()]),!empty(f))for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k=j.tid;j.name&&(k=j.name);var l=null;switch(g.type){case"taxonomy_term_reference_link":l={theme:"button_link",text:k,path:"taxonomy/term/"+j.tid};break;case"taxonomy_term_reference_plain":l={markup:k};break;default:l={markup:k}}h[i]=l}return h}catch(m){console.log("taxonomy_field_formatter_view - "+m)}}function taxonomy_field_widget_form(a,b,c,d,e,f,g,h){try{f[g].type="hidden";var i=f[g].id+"-list",j={theme:"item_list",items:[],attributes:{id:i,"data-role":"listview","data-filter":"true","data-inset":"true","data-filter-placeholder":"..."}};f[g].children.push(j);var k=c.settings.allowed_values[0].vocabulary,l=taxonomy_vocabulary_machine_name_load(k),m=l.vid,n='";f[g].children.push({markup:n})}catch(o){console.log("taxonomy_field_widget_form - "+o)}}function _taxonomy_field_widget_form_autocomplete(a,b,c,d,e){try{var f=$(c),g=$(e.input),h=g.val(),i="";if(_taxonomy_field_widget_form_autocomplete_input=g,$(_taxonomy_field_widget_form_autocomplete_input).on("change",function(){$("#"+a).val($(this).val())}),f.html(""),h&&h.length>0){f.html('
  • '),f.listview("refresh");var j={fields:["tid","name"],parameters:{vid:b,name:"%"+h+"%"},parameters_op:{name:"like"}};taxonomy_term_index(j,{success:function(c){if(0!=c.length){for(var d in c)if(c.hasOwnProperty(d)){var e=c[d],g={tid:e.tid,vid:b,name:e.name,onclick:"_taxonomy_field_widget_form_click('"+a+"', '"+f.attr("id")+"', this)"};i+="
  • "+e.name+"
  • "}f.html(i),f.listview("refresh"),f.trigger("updatelayout")}}})}}catch(k){console.log("_taxonomy_field_widget_form_autocomplete - "+k)}}function _taxonomy_field_widget_form_click(a,b,c){try{var d=$(c).attr("name");$("#"+a).val(d),$(_taxonomy_field_widget_form_autocomplete_input).val($(c).attr("name")),$("#"+b).html("")}catch(e){console.log("_taxonomy_field_widget_form_click - "+e)}}function taxonomy_assemble_form_state_into_field(a,b,c,d,e,f,g,h){try{var i=null;switch(e.widget.type){case"taxonomy_autocomplete":h.use_wrapper=!1,i=c;break;case"options_select":i=c}return i}catch(j){console.log("taxonomy_assemble_form_state_into_field - "+j)}}function taxonomy_menu(){var a={"taxonomy/vocabularies":{title:t("Taxonomy"),page_callback:"taxonomy_vocabularies_page",pageshow:"taxonomy_vocabularies_pageshow"},"taxonomy/vocabulary/%":{title:t("Taxonomy vocabulary"),page_callback:"taxonomy_vocabulary_page",page_arguments:[2],pageshow:"taxonomy_vocabulary_pageshow"},"taxonomy/vocabulary/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"taxonomy/vocabulary/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["taxonomy_form_vocabulary","taxonomy_vocabulary",2],weight:0,type:"MENU_LOCAL_TASK",access_arguments:["administer taxonomy"],options:{reloadPage:!0}},"taxonomy/term/%":{title:t("Taxonomy term"),page_callback:"taxonomy_term_page",page_arguments:[2],pageshow:"taxonomy_term_pageshow"},"taxonomy/term/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"taxonomy/term/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["taxonomy_form_term","taxonomy_term",2],weight:0,type:"MENU_LOCAL_TASK",access_arguments:["administer taxonomy"],options:{reloadPage:!0}}};return a}function taxonomy_form_vocabulary(a,b,c){try{return a.entity_type="taxonomy_vocabulary",a.bundle=null,a.action="taxonomy/vocabularies",drupalgap_entity_add_core_fields_to_form("taxonomy_vocabulary",null,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.vid&&user_access("administer taxonomy")&&(a.buttons["delete"]=drupalgap_entity_edit_form_delete_button("taxonomy_vocabulary",c.vid)),a}catch(d){console.log("taxonomy_form_vocabulary - "+d)}}function taxonomy_form_vocabulary_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("taxonomy_form_vocabulary_submit - "+d)}}function taxonomy_form_term(a,b,c){try{return a.entity_type="taxonomy_term",a.bundle=null,a.action="taxonomy/vocabularies",drupalgap_entity_add_core_fields_to_form("taxonomy_term",null,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.tid&&user_access("administer taxonomy")&&(a.buttons["delete"]=drupalgap_entity_edit_form_delete_button("taxonomy_term",c.tid)),a}catch(d){console.log("taxonomy_form_term - "+d)}}function taxonomy_form_term_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("taxonomy_form_term_submit - "+d)}}function taxonomy_term_page(a){try{if(a){var b={container:_drupalgap_entity_page_container("taxonomy_term",a,"view"),taxonomy_term_node_listing:{theme:"jqm_item_list",items:[],attributes:{id:"taxonomy_term_node_listing_items_"+a}}};return b}console.log("taxonomy_term_pageshow - No term id provided!")}catch(c){console.log("taxonomy_term_pageshow - "+c)}}function taxonomy_term_pageshow(a){try{taxonomy_term_load(a,{success:function(a){var b=a.description?a.description:"",c={name:{markup:"

    "+a.name+"

    "},description:{markup:"

    "+b+"

    "}};_drupalgap_entity_page_container_inject("taxonomy_term",a.tid,"view",c),taxonomy_term_selectNodes(a.tid,{success:function(b){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c.push(l(e.title,"node/"+e.nid))}drupalgap_item_list_populate("#taxonomy_term_node_listing_items_"+a.tid,c)}})}})}catch(b){console.log("taxonomy_term_pageshow - "+b)}}function taxonomy_term_selectNodes(a,b){try{b.method="POST",b.path="taxonomy_term/selectNodes.json",b.service="taxonomy_term",b.resource="selectNodes",b.data=JSON.stringify({tid:a}),Drupal.services.call(b)}catch(c){console.log("taxonomy_term_selectNodes - "+c)}}function taxonomy_vocabularies_page(){var a={vocabulary_listing:{theme:"jqm_item_list",title:t("Vocabularies"),items:[],attributes:{id:"vocabulary_listing_items"}}};return a}function taxonomy_vocabularies_pageshow(){try{taxonomy_vocabulary_index(null,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b.push(l(d.name,"taxonomy/vocabulary/"+d.vid))}drupalgap_item_list_populate("#vocabulary_listing_items",b)}})}catch(a){console.log("taxonomy_vocabularies_pageshow - "+a)}}function taxonomy_vocabulary_page(a){try{if(a){var b={container:_drupalgap_entity_page_container("taxonomy_vocabulary",a,"view"),taxonomy_term_listing:{theme:"jqm_item_list",title:t("Terms"),items:[],attributes:{id:"taxonomy_term_listing_items_"+a}}};return b}console.log("taxonomy_vocabulary_page - No vocabulary id provided!")}catch(c){console.log("taxonomy_vocabulary_page - "+c)}}function taxonomy_vocabulary_pageshow(a){try{taxonomy_vocabulary_load(a,{success:function(b){var c={name:{markup:"

    "+b.name+"

    "},description:{markup:"

    "+b.description+"

    "}};_drupalgap_entity_page_container_inject("taxonomy_vocabulary",b.vid,"view",c);var d={parameters:{vid:a}};taxonomy_term_index(d,{success:function(b){if(0!=b.length){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c.push(l(e.name,"taxonomy/term/"+e.tid))}drupalgap_item_list_populate("#taxonomy_term_listing_items_"+a,c)}}})}})}catch(b){console.log("taxonomy_vocabulary_pageshow - "+b)}}function taxonomy_vocabulary_get_vid_from_name(a){try{var b=taxonomy_vocabulary_machine_name_load(a);return b?b.vid:!1}catch(c){console.log("taxonomy_vocabulary_get_vid_from_name - "+c)}}function taxonomy_vocabulary_machine_name_load(a){try{return drupalgap.taxonomy_vocabularies&&drupalgap.taxonomy_vocabularies[a]?drupalgap.taxonomy_vocabularies[a]:!1}catch(b){console.log("taxonomy_vocabulary_machine_name_load - "+b)}}function theme_taxonomy_term_reference(a){try{var b="",c=!0;"undefined"!=typeof a.render_input_element&&(c=a.render_input_element),c&&(a.attributes.type="hidden",b+="");var d=!1;"undefined"!=typeof a.required&&(d=a.required);var e=!1;"undefined"!=typeof a.exposed&&(e=a.exposed);var f=a.field_info_field.settings.allowed_values[0].vocabulary,g=taxonomy_vocabulary_machine_name_load(f),h=a.field_info_instance.widget.type;"options_select"==h&&(h="select");var i="theme_"+h,j=a.attributes.id+"-"+h;if(drupalgap_function_exists(i)){var k=window[i],l={attributes:{id:j,onchange:"_theme_taxonomy_term_reference_onchange(this, '"+a.attributes.id+"');"}},m=!1;if(_taxonomy_term_reference_terms[a.attributes.id]&&(m=!0,l.options=_taxonomy_term_reference_terms[a.attributes.id]),"undefined"!=typeof a.value?l.value=a.value:d||(e?l.value="All":l.value=""),b+=k.call(null,l),!m){var n={page_id:drupalgap_get_page_id(drupalgap_path_get()),jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_taxonomy_term_reference_load_items",jqm_page_event_args:JSON.stringify({taxonomy_vocabulary:g,element_id:a.attributes.id,widget_id:j,required:d,exposed:e})};b+=drupalgap_jqm_page_event_script_code(n)}}else console.log("WARNING: theme_taxonomy_term_reference() - unsupported widget type! ("+h+")");return b}catch(o){console.log("theme_taxonomy_term_reference - "+o)}}function _theme_taxonomy_term_reference_load_items(a){try{var b={parameters:{vid:a.taxonomy_vocabulary.vid},options:{orderby:{weight:"asc",name:"asc"}}};taxonomy_term_index(b,{success:function(b){if(0!=b.length){_taxonomy_term_reference_terms[a.element_id]={};var c=$("#"+a.widget_id);if(!a.required){var d=null;a.exposed?(d='",_taxonomy_term_reference_terms[a.element_id].All="- Any -"):(d='",_taxonomy_term_reference_terms[a.element_id][""]="- None -"),$(c).append(d)}for(var e in b)if(b.hasOwnProperty(e)){var f=b[e],d='";$(c).append(d),_taxonomy_term_reference_terms[a.element_id][f.tid]=f.name}$(c).selectmenu("refresh",!0)}}})}catch(c){console.log("_theme_taxonomy_term_reference_load_items - "+c)}}function _theme_taxonomy_term_reference_onchange(a,b){try{$("#"+b).val($(a).val())}catch(c){console.log("_theme_taxonomy_term_reference_onchange - "+c)}}function taxonomy_views_exposed_filter(a,b,c,d,e){try{if("textfield"==d.options.type)c.type="autocomplete",c.remote=!0,c.custom=!0,c.handler="index",c.entity_type="taxonomy_term","undefined"!=typeof d.options.vocabulary&&(c.vid=taxonomy_vocabulary_get_vid_from_name(d.options.vocabulary)),c.value="name",c.label="name",c.filter="name";else{c.type="hidden";for(var f in e.settings.allowed_values)if(e.settings.allowed_values.hasOwnProperty(f)){var g=(e.settings.allowed_values[f],{required:c.required,render_input_element:!1,attributes:{id:c.options.attributes.id},field_info_field:e,field_info_instance:{widget:{type:"options_select"}},exposed:!0});empty(d.value)||(g.value=parseInt(d.value[0]),g.attributes.value=g.value);var h="";empty(c.title)||(h+=theme("form_element_label",{element:c})),h+=theme("taxonomy_term_reference",g),c.children.push({markup:h})}}}catch(i){console.log("taxonomy_views_exposed_filter - "+i)}}function user_login_form(a,b){try{return a.entity_type="user",a.bundle=null,a.elements.name={type:"textfield",title:t("Username"),title_placeholder:!0,required:!0,attributes:{autocapitalize:"none"}},a.elements.pass={type:"password",title:t("Password"),title_placeholder:!0,required:!0,attributes:{onkeypress:"drupalgap_form_onkeypress('"+a.id+"')"}},a.elements.submit={type:"submit",value:t("Login")},user_register_access()&&(a.buttons.create_new_account={title:t("Create new account"),attributes:{onclick:"drupalgap_goto('user/register')"}}),a.buttons.forgot_password={title:t("Request new password"),attributes:{onclick:"drupalgap_goto('user/password')"}},a}catch(c){console.log("user_login_form - "+c)}}function user_login_form_submit(a,b){try{user_login(b.values.name,b.values.pass,{success:function(b){drupalgap_goto("undefined"!=typeof a.action?a.action:drupalgap.settings.front,{reloadPage:!0})}})}catch(c){console.log("user_login_form_submit - "+c)}}function user_register_form(a,b){try{a.entity_type="user",a.bundle=null;var c=t("Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.");return a.elements.name={type:"textfield",title:t("Username"),title_placeholder:!0,required:!0,description:c},a.elements.mail={type:"email",title:t("E-mail address"),title_placeholder:!0, -required:!0},drupalgap.site_settings.user_email_verification||(a.elements.conf_mail={type:"email",title:t("Confirm e-mail address"),title_placeholder:!0,required:!0},a.elements.pass={type:"password",title:t("Password"),title_placeholder:!0,required:!0},a.elements.pass2={type:"password",title:t("Confirm password"),title_placeholder:!0,required:!0}),drupalgap_field_info_instances_add_to_form("user",null,a,null),a.user_register={user_mail_register_no_approval_required_body:t("Registration complete!"),user_mail_register_pending_approval_required_body:t("Registration complete, waiting for administrator approval."),user_mail_register_email_verification_body:t("Registration complete, check your e-mail inbox to verify the account.")},a.auto_user_login=!0,a.elements.submit={type:"submit",value:t("Create new account")},a}catch(d){console.log("user_register_form - "+d)}}function user_register_form_validate(a,b){try{drupalgap.site_settings.user_email_verification||b.values.pass==b.values.pass2||drupalgap_form_set_error("pass",t("Passwords do not match!")),empty(b.values.mail)||empty(b.values.conf_mail)||b.values.mail==b.values.conf_mail||drupalgap_form_set_error("mail",t("E-mail addresses do not match!"))}catch(c){console.log("user_register_form_validate - "+c)}}function user_register_form_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);user_register(c,{success:function(b){var d=a.user_register,e={title:t("Registered")},f="undefined"!=typeof a.action?a.action:drupalgap.settings.front;drupalgap.site_settings.user_email_verification?(drupalgap_alert(d.user_mail_register_email_verification_body,e),drupalgap_goto(f)):"2"==drupalgap.site_settings.user_register?(drupalgap_alert(d.user_mail_register_pending_approval_required_body,e),drupalgap_goto(f)):(drupalgap_alert(d.user_mail_register_no_approval_required_body,e),a.auto_user_login?user_login(c.name,c.pass,{success:function(a){drupalgap_goto("")}}):drupalgap_goto(f))},error:function(c,d,e){var f=_drupalgap_form_submit_response_errors(a,b,c,d,e);f&&drupalgap_alert(f)}})}catch(d){console.log("user_register_form_submit - "+d)}}function user_profile_form(a,b,c){try{return a.entity_type="user",a.bundle=null,drupalgap_entity_add_core_fields_to_form("user",null,a,c),drupalgap_field_info_instances_add_to_form("user",null,a,c),user_access("change own username")||(a.elements.name.access=!1,a.elements.name.required=!1),0==drupalgap.site_settings.user_pictures&&delete a.elements.picture,Drupal.user.uid==c.uid&&(a.elements.current_pass={title:t("Current password"),type:"password",description:t("Enter your current password to change the E-mail address or Password.")}),a.elements.pass_pass1={title:t("Password"),type:"password"},a.elements.pass_pass2={title:t("Confirm password"),type:"password",description:t("To change the current user password, enter the new password in both fields.")},a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel={title:t("Cancel"),attributes:{onclick:"javascript:drupalgap_back();"}},a}catch(d){console.log("user_profile_form - "+d)}}function user_profile_form_validate(a,b){try{empty(b.values.current_pass)?!empty(b.values.current_pass)||empty(b.values.pass_pass1)||empty(b.values.pass_pass2)||drupalgap_form_set_error("current_pass",t("You must enter your current password to change your password.")):empty(b.values.pass_pass1)||empty(b.values.pass_pass2)||b.values.pass_pass1==b.values.pass_pass2||drupalgap_form_set_error("pass_pass1",t("Passwords do not match."))}catch(c){console.log("user_profile_form_validate - "+c)}}function user_profile_form_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);!c.current_pass||empty(c.pass_pass1)||empty(c.pass_pass2)||(c.pass=c.pass_pass1,delete c.pass_pass1,delete c.pass_pass2),drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("user_profile_form_submit - "+d)}}function user_pass_form(a,b){try{return a.elements.name={type:"textfield",title:t("Username or e-mail address"),required:!0,attributes:{onkeypress:"drupalgap_form_onkeypress('"+a.id+"')"}},a.elements.submit={type:"submit",value:t("E-mail new password")},a}catch(c){console.log("user_pass_form - "+c)}}function user_pass_form_submit(a,b){try{user_request_new_password(b.values.name,{success:function(a){if(a[0]){var b=t("Further instructions have been sent to your e-mail address.");drupalgap_set_message(b)}else{var b=t("There was a problem sending an e-mail to your address.");drupalgap_set_message(b,"warning")}drupalgap_goto("user/login")}})}catch(c){console.log("user_pass_form_submit - "+c)}}function user_access(a){try{var b;if(b=arguments[1]?arguments[1]:Drupal.user,1==b.uid)return!0;var c=!1;for(var d in b.permissions)if(b.permissions.hasOwnProperty(d)){var e=b.permissions[d];if(e.permission==a){c=!0;break}}return c}catch(f){console.log("user_access - "+f)}}function user_edit_access(a){try{return Drupal.user.uid==a.uid||user_access("administer users")?!0:!1}catch(b){console.log("user_edit_access - "+b)}}function user_listing(){var a={};return a.user_list={theme:"view",format:"ul",path:"drupalgap/views_datasource/drupalgap_users",row_callback:"user_listing_row",empty_callback:"user_listing_empty",attributes:{id:"user_listing_"+user_password()}},a}function user_listing_row(a,b){try{return l(t(b.name),"user/"+b.uid)}catch(c){console.log("user_listing_row - "+c)}}function user_listing_empty(a){return t("Sorry, no users were found.")}function user_logout_callback(){return"

    "+t("Logging out")+"...

    "}function user_logout_pageshow(){try{user_logout({success:function(a){drupalgap_remove_pages_from_dom(),drupalgap_goto(drupalgap.settings.front,{reloadPage:!0})}})}catch(a){console.log("user_logout_pagechange - "+a)}}function user_menu(){var a={user:{page_callback:"user_page"},"user/login":{title:t("Login"),page_callback:"drupalgap_get_form",page_arguments:["user_login_form"],options:{reloadPage:!0}},"user/logout":{title:t("Logout"),page_callback:"user_logout_callback",pageshow:"user_logout_pageshow",options:{reloadPage:!0}},"user/register":{title:t("Register"),page_callback:"drupalgap_get_form",page_arguments:["user_register_form"],access_callback:"user_register_access",options:{reloadPage:!0}},"user/%":{title:t("My account"),title_callback:"user_view_title",title_arguments:[1],page_callback:"user_view",pageshow:"user_view_pageshow",page_arguments:[1]},"user/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"user/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["user_profile_form","user",1],access_callback:"user_edit_access",access_arguments:[1],weight:0,type:"MENU_LOCAL_TASK",options:{reloadPage:!0}}};return a["user-listing"]={title:t("Users"),page_callback:"user_listing",access_arguments:["access user profiles"]},a["user/password"]={title:t("Request new password"),page_callback:"drupalgap_get_form",page_arguments:["user_pass_form"]},a}function user_page(){return"user_page()"}function user_register_access(){try{switch(drupalgap.site_settings.user_register.toString()){case"0":return!1;case"1":case"2":return!0}}catch(a){console.log("user_register_access - "+a)}}function user_services_postprocess(a,b){try{if("user"!=a.service)return;var c=["login","logout","register"];if(!in_array(a.resource,c)||"user"!=arg(0)&&!in_array(arg(1),c))return;if(!b.responseText)return;var d=JSON.parse(b.responseText);if($.isArray(d)){var e="";for(var f in d)if(d.hasOwnProperty(f)){var g=d[f];e+=t(g)+"\n"}""!=e&&drupalgap_alert(e)}}catch(h){console.log("user_services_postprocess - "+h)}}function user_theme(){return{user_picture:{template:"user-picture"},user_profile:{template:"user-profile"}}}function user_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("user",a,"view")};return b}console.log("user_view - No user id provided!")}catch(c){console.log("user_view - "+c)}}function user_view_pageshow(a){try{user_load(a,{success:function(a){var b="full",c=null;if(arguments[1]&&(b=arguments[1]),arguments[2]&&(c=arguments[2]),c||(c=language_default()),a){var d={theme:"user_profile",account:a,view_mode:b,language:c,name:{markup:a.name},created:{markup:'"}};"undefined"!=typeof a.content&&(d.content={markup:a.content}),a.picture&&a.picture.fid&&(d.picture={theme:"image",path:image_style_url(drupalgap.site_settings.user_picture_style,a.picture.uri)}),_drupalgap_entity_page_container_inject("user",a.uid,"view",d)}}})}catch(b){console.log("user_view_pageshow - "+b)}}function user_view_title(a,b){try{user_load(b,{success:function(b){a.call(null,b.name)}})}catch(c){console.log("user_view_title - "+c)}}function drupalgap_user_has_role(a){try{var b=!1,c=null;c=arguments[1]?arguments[1]:Drupal.user;for(var d in c.roles)if(c.roles.hasOwnProperty(d)){var e=c.roles[d];if(a==e){b=!0;break}}return b}catch(f){console.log("drupalgap_user_has_role - "+f)}}function views_embedded_view_get(a){try{if(!_views_embedded_views[a])return null;var b=arguments[1];return b?_views_embedded_views[a][b]:_views_embedded_views[a]}catch(c){console.log("views_embedded_view_get - "+c)}}function views_embedded_view_set(a,b,c){try{_views_embedded_views[a]||(_views_embedded_views[a]={}),_views_embedded_views[a][b]=c}catch(d){console.log("views_embedded_view_set - "+d)}}function views_embedded_view_delete(a){try{if(!_views_embedded_views[a])return!1;var b=arguments[1];return b?delete _views_embedded_views[a][b]:delete _views_embedded_views[a],!0}catch(c){console.log("views_embedded_view_delete - "+c)}}function views_datasource_get_view_result(a,b){try{if(-1!=a.indexOf("?")){var c=a.replace("?","&");a=c}if(b.reset)window.localStorage.removeItem(a);else if(Drupal.settings.cache.views.enabled){var d=window.localStorage.getItem(a);if(d)if(d=JSON.parse(d),"undefined"!=typeof d.expiration&&0!=d.expiration&&time()>d.expiration)window.localStorage.removeItem(a);else if(b.success)return void b.success(d)}Drupal.services.call({endpoint:"",service:"views_datasource",resource:"",method:"GET",path:a,success:function(c){try{if(b.success){if(c.path=a,Drupal.settings.cache.views.enabled){var d=time()+Drupal.settings.cache.views.expiration;0==Drupal.settings.cache.views.expiration&&(d=0),c.expiration=d,window.localStorage.setItem(a,JSON.stringify(c))}b.success(c)}}catch(e){console.log("views_datasource_get_view_result - success - "+e)}},error:function(a,c,d){try{b.error&&b.error(a,c,d)}catch(e){console.log("views_datasource_get_view_result - error - "+e)}}})}catch(e){console.log("views_datasource_get_view_result - "+e)}}function views_exposed_form(a,b,c){try{a.variables=c.variables;for(var d in c.filter)if(c.filter.hasOwnProperty(d)){var e=c.filter[d],f=null,g=null;f=e.options.expose.identifier,g={id:f,type:e.options.group_info.widget,title:e.options.expose.label,required:e.options.expose.required,options:{attributes:{id:drupalgap_form_get_element_id(f,a.id)}},views_field:d,filter:e,children:[]};var h=e.definition.field_name;if(h){var i=drupalgap_field_info_field(h),j=i.module,k=j+"_views_exposed_filter";if(!drupalgap_function_exists(k)){dpm("WARNING: views_exposed_form() - "+k+"() must be created to assemble the "+i.type+" filter used by "+h);continue}window[k](a,b,g,e,i)}else if("views_handler_filter_term_node_tid"==e.definition.handler){g.type="autocomplete";var l={remote:!0,custom:!0,handler:"index",entity_type:"taxonomy_term",value:"name",label:"name",filter:"name"};""!=e.options.vocabulary&&(l.vid=taxonomy_vocabulary_get_vid_from_name(e.options.vocabulary)),$.extend(g,l,!0)}else{if("select"!=g.type){dpm('WARNING: views_exposed_form() - I do not know how to handle the exposed filter for the "'+d+'" field'),console.log(e);continue}list_views_exposed_filter(a,b,g,e,null)}f&&(a.elements[f]=g)}return a.elements.submit={type:"submit",value:c.exposed_data.submit},c.exposed_data.reset&&views_embedded_view_get(a.variables.page_id,"exposed_filter_reset")&&(a.buttons.reset={title:c.exposed_data.reset,attributes:{id:a.id+"-reset",onclick:"views_exposed_form_reset()"}}),a}catch(m){console.log("views_exposed_form - "+m)}}function views_exposed_form_submit(a,b){try{var c=a.variables.page_id,d="";for(var e in b.values)if(b.values.hasOwnProperty(e)){var f=b.values[e];empty(f)||(d+=e+"="+encodeURIComponent(f)+"&")}empty(d)||(d=d.substr(0,d.length-1));var g=views_embedded_view_get(c,"exposed_filter_query");if(g){if(g==d)return;-1!=a.variables.path.indexOf("&"+g)&&(a.variables.path=a.variables.path.replace("&"+g,""))}views_embedded_view_set(c,"exposed_filter_query",d),views_embedded_view_set(c,"exposed_filter_reset",!0),a.variables.path+="&"+d,a.variables.page=0,views_embedded_view_set(c,"exposed_filter_submit_variables",a.variables),_theme_view(a.variables)}catch(h){console.log("views_exposed_form_submit - "+h)}}function views_exposed_form_reset(){try{var a=drupalgap_get_page_id(),b=views_embedded_view_get(a,"exposed_filter_submit_variables");b.path=b.path.replace("&"+views_embedded_view_get(a,"exposed_filter_query"),""),b.page=0,views_embedded_view_set(a,"exposed_filter_submit_variables",b),views_embedded_view_set(a,"exposed_filter_reset",!1),views_embedded_view_set(a,"exposed_filter_query",null),_theme_view(b)}catch(c){console.log("views_exposed_form_reset - "+c)}}function theme_view(a){try{a.attributes.id||(console.log("WARNING: theme_view() - No id specified on attributes! A random id will be generated instead."),a.attributes.id="views-view--"+user_password()),in_array(a.attributes.id,drupalgap.views.ids)?$("#"+a.attributes.id)?dpm("WARNING: theme_view() - this id already exists in the DOM: #"+a.attributes.id+" - the view will be rendered into the first container that is located in the DOM - if you are re-using this same view, it is recommended to append a unique identifier (e.g. an entity id) to your views id, that way you can re-use the same view across multiple pages."):drupalgap.views.ids.splice($.inArray(a.attributes.id,drupalgap.views.ids),1):drupalgap.views.ids.push(a.attributes.id);var b=drupalgap_get_page_id();a.page_id=b,a.attributes["class"]+="view ";var c="
    ",d={page_id:b,jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_view",jqm_page_event_args:JSON.stringify(a)};return c+=drupalgap_jqm_page_event_script_code(d,a.attributes.id)}catch(e){console.log("theme_view - "+e)}}function _theme_view(a){try{var b=0;a.page&&(b=a.page);var c=$.extend({},{success:function(b){try{$("#"+a.attributes.id).html(b)}catch(c){console.log("_theme_view - success - "+c)}}},a);views_embed_view(a.path+"&page="+b,c)}catch(d){console.log("_theme_view - "+d)}}function views_embed_view(a,b){try{views_datasource_get_view_result(a,{success:function(a){try{if(views_embedded_view_set(b.page_id,"results",a),views_embedded_view_set(b.page_id,"options",b),!b.success)return;if(b.results=a,0!=a.view.count||0==a.view.count&&b.empty_callback)b.success(theme("views_view",b));else{var c=document.getElementById(b.attributes.id);c.parentElement.removeChild(c)}}catch(d){console.log("views_embed_view - success - "+d)}},error:function(a,c,d){try{views_embedded_view_set(b.page_id,"results",null),b.error&&b.error(a,c,d)}catch(e){console.log("views_embed_view - error - "+e)}}})}catch(c){console.log("views_embed_view - "+c)}}function theme_views_view(a){try{var b="",c=views_embedded_view_get(a.page_id,"results");if(!c)return b;a.format||(a.format="unformatted_list");var d=c.view.root,e=c.view.child;if(a.title){var f=a.title_attributes?a.title_attributes:null;b+=theme("header",{text:a.title,attributes:f}),"unformatted"!=a.format&&(b+=theme("views_spacer",null))}var g="";"undefined"==typeof c.view.exposed_data||"undefined"!=typeof a.exposed_filters&&!a.exposed_filters||(g=drupalgap_get_form("views_exposed_form",{exposed_data:c.view.exposed_data,exposed_raw_input:c.view.exposed_raw_input,filter:c.view.filter,variables:a}));var h="#"+a.page_id+" #"+a.attributes.id;views_embedded_view_set(a.page_id,"selector",h);var i=module_exists("views_litepager");if(0==c.view.count&&!i||i&&null==c.view.pages&&0==c.view.count){if($(h).hide(),setTimeout(function(){$(h).trigger("create").show("fast")},100),a.empty_callback&&function_exists(a.empty_callback)){var j=window[a.empty_callback];return g+drupalgap_render(j(c.view,a))}return b+g}b+=g;var k=drupalgap_views_get_result_formats(a),l=""+k.open+drupalgap_views_render_rows(a,c,d,e,k.open_row,k.close_row)+k.close,m="";c.view.pages&&(m=theme("pager",a));var n="top";return"undefined"!=typeof a.pager_pos&&(n=a.pager_pos),module_exists("views_infinite_scroll")&&views_infinite_scroll_ok()?b+=l:"top"==n?(b+=m,empty(m)||(b+=theme("views_spacer",null)),b+=l):"bottom"==n?(b+=l,empty(m)||(b+=theme("views_spacer",null)),b+=m):console.log("WARNING: theme_views_view - unsupported pager_pos ("+n+")"),$(h).hide(),setTimeout(function(){$(h).trigger("create").show("fast")},100),b}catch(o){console.log("theme_views_view - "+o)}}function theme_views_spacer(a){return'

     

    '}function theme_pager(a){try{var b="",c=a.results.view,d=c.page,e=c.pages,f=c.count,d=(c.limit,c.page),g=module_exists("views_litepager");if(0==f&&!g||g&&null==a.results.view.pages)return b;var h=[];if(0!=d&&h.push(theme("pager_previous",a)),(d!=e-1&&!g||g)&&h.push(theme("pager_next",a)),h.length>0){var i="theme_pager_"+user_password(),j={id:i,"class":"pager","data-role":"navbar"};b+="
    "+theme("item_list",{items:h})+'
    '}return b}catch(k){console.log("theme_pager - "+k)}}function theme_pager_link(a,b){try{b.attributes||(b.attributes={}),b.attributes.href="#";var c=drupalgap_attributes(b.attributes);return""+b.text+""}catch(d){console.log("theme_pager_link - "+d)}}function _theme_pager_link_onclick(a){try{var b=$.extend({},{},a);b.results&&delete b.results;var c="_theme_pager_link_click("+JSON.stringify(b)+")";return c}catch(d){console.log("_theme_pager_link_onclick - "+d)}}function _theme_pager_link_click(a){try{_theme_view(a)}catch(b){console.log("_theme_pager_link_click - "+b)}}function theme_pager_next(a){try{var b;a.page=parseInt(a.results.view.page)+1;var c={text:"»",attributes:{"class":"pager_next"}};return b=theme_pager_link(a,c)}catch(d){console.log("theme_pager_next - "+d)}}function theme_pager_previous(a){try{var b;a.page=parseInt(a.results.view.page)-1;var c={text:"«",attributes:{"class":"pager_previous"}};return b=theme_pager_link(a,c)}catch(d){console.log("theme_pager_previous - "+d)}}function drupalgap_views_get_result_formats(a){try{var b={};a.format||(a.format="unformatted_list");var c="",d="",e="",f="",g={};switch("undefined"!=typeof a.format_attributes&&(g=$.extend(!0,g,a.format_attributes)),"undefined"==typeof g["class"]&&(g["class"]=""),g["class"]+=" views-results ",a.format){case"grid":var h=a.columns?a.columns:2,i=null;2>h&&(i=h+" columns is not enough, a minimum of 2 is needed",h=2),h>5&&(i=h+" columns is too many enough, a maximum of 5 is allowed",h=5),a.columns=h,i&&console.log("drupalgap_views_get_result_formats - "+i);var j=null;switch(h){case 2:j="a";break;case 3:j="b";break;case 4:j="c";break;case 5:j="d"}g["class"]||(g["class"]=""),g["class"]+=" ui-grid-"+j+" ",c="
    ",d="
    ",e='
    ',f="
    ";break;case"ul":"undefined"==typeof g["data-role"]&&(g["data-role"]="listview"),c="
      ",d="
    ",e="
  • ",f="
  • ";break;case"ol":"undefined"==typeof g["data-role"]&&(g["data-role"]="listview"),c="
      ",d="
    ",e="
  • ",f="
  • ";break;case"table":case"jqm_table":"jqm_table"==a.format&&("undefined"==typeof g["data-role"]&&(g["data-role"]="table"),"undefined"==typeof g["data-mode"]&&(g["data-mode"]="reflow"),console.log("WARNING: theme_views_view() - jqm_table not supported, yet")),c="",d="
    ",e="",f="";break;case"unformatted_list":default:"undefined"==typeof g["class"]&&(g["class"]=""),g["class"]+=" views-rows",c="
    ",d="
    ",e="",f=""}return b.open=c,b.close=d,b.open_row=e,b.close_row=f,b}catch(k){console.log("drupalgap_views_get_result_formats - "+k)}}function drupalgap_views_render_rows(a,b,c,d,e,f){try{var g="";b[c].length;for(var h in b[c])if(b[c].hasOwnProperty(h)){var i=b[c][h],j=i[d];j._position=parseInt(h);var k="";if(a.row_callback&&function_exists(a.row_callback)?(row_callback=window[a.row_callback],k=row_callback(b.view,j,a)):k=JSON.stringify(j),"grid"==a.format){var l=null;switch(j._position%a.columns){case 0:l="ui-block-a";break;case 1:l="ui-block-b";break;case 2:l="ui-block-c";break;case 3:l="ui-block-d";break;case 4:l="ui-block-e"}var m=JSON.parse(JSON.stringify(e));l&&(m=m.replace("ui-block",l)),g+=m+k+f}else g+=e+k+f}return g}catch(n){console.log("drupalgap_views_render_rows - "+n)}}var drupalgap=drupalgap||drupalgap_init(),_dg_GET=_dg_GET||{},_theme_autocomplete_input_selector={},_theme_autocomplete_remote={},_theme_autocomplete_variables={},_theme_autocomplete_success_handlers={},_drupalgap_goto_query_string=null;$(window).on("navigate",function(a,b){if(!drupalgap.back&&"web-app"==drupalgap.settings.mode){var c=b.state.direction;if("back"==c&&drupalgap.back_path.length>0){drupalgap.back=!0;var d=drupalgap_path_get();drupalgap_path_set(drupalgap.back_path.pop());var e=drupalgap_path_get();drupalgap_router_path_set(drupalgap_get_menu_link_router_path(e)),module_invoke_all("drupalgap_back",d,e)}}}),$(document).on("pagebeforechange",function(a,b){try{if(drupalgap&&drupalgap.back)return void(drupalgap.back=!1);if(drupalgap_jqm_active_page_url()==drupalgap_get_page_id(drupalgap_path_get()))return;"string"==typeof b.toPage&&(drupalgap&&!drupalgap.page.process?drupalgap.page.process=!0:drupalgap&&(template_preprocess_page(drupalgap.page.variables),template_process_page(drupalgap.page.variables)))}catch(c){console.log("pagebeforechange - "+c)}});var image_phonegap_camera_options={},_system_reload_page=null,_system_reload_messages=null,_taxonomy_term_reference_terms={},_taxonomy_field_widget_form_autocomplete_input=null,_views_embedded_views={};drupalgap.views_datasource={options:{},call:function(a){try{var b="WARNING: drupalgap.views_datasource has been deprecated! Use views_datasource_get_view_result() instead.";console.log(b),views_datasource_get_view_result(a.path,a)}catch(c){console.log("drupalgap.views_datasource - "+c)}}}; \ No newline at end of file +function drupalgap_init(){var a={modules:{core:[{name:"comment"},{name:"contact"},{name:"entity"},{name:"field"},{name:"file"},{name:"image"},{name:"menu"},{name:"mvc"},{name:"node"},{name:"search"},{name:"system"},{name:"taxonomy"},{name:"user"},{name:"views"}]},module_paths:[],includes:[{name:"block"},{name:"common"},{name:"form"},{name:"go"},{name:"menu"},{name:"page"},{name:"region"},{name:"theme"},{name:"title"}],online:!1,destination:"",api:{},back:!1,back_path:[],blocks:[],connected:!1,content_types_list:{},date_formats:{},date_types:{},entity_info:{},field_info_fields:{},field_info_instances:{},field_info_extra_fields:{},form_errors:{},form_states:[],loading:!1,loader:"loading",locale:{},messages:[],menus:{},menu_links:{},menu_router:{},mvc:{models:{},views:{},controllers:{}},output:"",page:{jqm_events:[],title:"",variables:{},process:!0,options:{}},pages:[],path:"",remote_addr:null,router_path:"",services:{},sessid:null,settings:{},site_settings:{},taxonomy_vocabularies:!1,theme_path:"",themes:[],theme_registry:{},toast:{shown:!1},views:{ids:[]},views_datasource:{}};return Drupal.cache_expiration||(Drupal.cache_expiration={}),Drupal.cache_expiration.forms||(Drupal.cache_expiration.forms={}),a}function drupalgap_onload(){try{window.location.hash="";for(var a=["drupalgap","block","comment","contact","entity","field","file","image","menu","mvc","node","search","system","taxonomy","user","views"],b=0;b0)for(var d=0;d",{rel:"stylesheet",href:a}).appendTo("head")}catch(b){console.log("drupalgap_add_css - "+b)}}function drupalgap_load_blocks(){try{drupalgap.blocks=module_invoke_all("block_info")}catch(a){console.log("drupalgap_load_blocks - "+a)}}function drupalgap_load_locales(){try{if("undefined"==typeof drupalgap.settings.locale)return;for(var a in drupalgap.settings.locale)if(drupalgap.settings.locale.hasOwnProperty(a)){var b=(drupalgap.settings.locale[a],"locale/"+a+".json");drupalgap_file_exists(b)&&(drupalgap.locale[a]=drupalgap_file_get_contents(b,{dataType:"json"}))}for(var c=module_implements("locale"),d=0;d=g){var h=Math.floor(a/g);e+=(e?" ":"")+drupalgap_format_plural(h,f[0],f[1]),e.indexOf("@count")!=-1&&(e=e.replace("@count",h)),a%=g,b--}if(0==b)break}return e?e:"0 sec"}catch(i){console.log("drupalgap_format_interval - "+i)}}function drupalgap_format_plural(a,b,c){return 1==a?b:c}function drupalgap_function_exists(a){try{return function_exists(a)}catch(b){console.log("drupalgap_function_exists - "+b)}}function drupalgap_get_placeholders_from_html(a){try{var b=!1;return a&&(b=a.match(/(?!{:)([\w]+)(?=:})/g)),b}catch(c){console.log("drupalgap_get_placeholders_from_html - "+c)}}function drupalgap_get_title(){try{return drupalgap.page.title}catch(a){console.log("drupalgap_get_title - "+a)}}function drupalgap_get_ip(){try{return drupalgap.remote_addr}catch(a){console.log("drupalgap_get_ip - "+a)}}function drupalgap_get_wildcards_from_router_path(a){var b=!1;return b}function drupalgap_image_path(a){try{var b=!1,c=module_implements("image_path_alter");if(c)for(var d in c)if(c.hasOwnProperty(d)){var e=c[d],f=module_invoke(e,"image_path_alter",a);if(f){b=!0,a=f;break}}if(b)return a;var g=Drupal.settings.site_path+Drupal.settings.base_path+a;return g.indexOf("public://")!=-1?g=g.replace("public://",Drupal.settings.file_public_path+"/"):g.indexOf("private://")!=-1&&(g=g.replace("private://",Drupal.settings.file_private_path+"/")),g}catch(h){console.log("drupalgap_image_path - "+h)}}function drupalgap_includes_load(){try{if(null!=drupalgap.includes&&0!=drupalgap.includes.length)for(var a in drupalgap.includes)if(drupalgap.includes.hasOwnProperty(a)){var b=drupalgap.includes[a],c="includes/"+b.name+".inc.js";jQuery.ajax({async:!1,type:"GET",url:c,data:null,success:function(){Drupal.settings.debug&&dpm(c)},dataType:"script",error:function(a,b,c){console.log(c)}})}}catch(d){console.log("drupalgap_includes_load - "+d)}}function drupalgap_item_list_populate(a,b){try{$(a).html("");for(var c=0;c",{html:b[c]}));$(a).listview("refresh").listview()}catch(d){console.log("drupalgap_item_list_populate - "+d)}}function drupalgap_table_populate(a,b){try{a+="> tbody ",$(a).html("");for(var c=0;c"+d[f]+"";$("").html(e).appendTo($(a))}$(a).rebuild()}catch(g){console.log("drupalgap_table_populate - "+g)}}function drupalgap_jqm_page_event_fire(a,b,c){try{var d=a+"-"+b;if("undefined"!=typeof arguments[3]&&arguments[3]&&(d+="-"+arguments[3]),$.inArray(d,drupalgap.page.jqm_events)==-1&&drupalgap_function_exists(b)){drupalgap.page.jqm_events.push(d);var e=window[b];c?($.isArray(c)||(c=[c]),e.apply(null,Array.prototype.slice.call(c))):e()}}catch(f){console.log("drupalgap_jqm_page_event_fire - "+f)}}function drupalgap_jqm_page_events(){return["pagebeforechange","pagebeforecreate","pagebeforehide","pagebeforeload","pagebeforeshow","pagechange","pagechangefailed","pagecreate","pagehide","pageinit","pageload","pageloadfailed","pageremove","pageshow"]}function drupalgap_jqm_page_event_script_code(a){try{a.page_id||(a.page_id=drupalgap_get_page_id()),a.jqm_page_event||(a.jqm_page_event="pageshow");var b='"'+a.jqm_page_event+'", "'+a.jqm_page_event_callback+'", '+a.jqm_page_event_args;return arguments[1]&&(b+=', "'+arguments[1]+'"'),'"}catch(c){console.log("drupalgap_jqm_page_event_script_code - "+c)}}function drupalgap_max_width(){try{var a=parseInt($(".ui-content").css("padding"));return isNaN(a)&&(a=16),$(document).width()-2*a}catch(b){console.log("drupalgap_max_width - "+b)}}function drupalgap_menu_access(a,b){try{if(1==Drupal.user.uid)return!0;var c=!1;if(drupalgap.menu_links[a])if("undefined"==typeof drupalgap.menu_links[a].access_callback)if(drupalgap.menu_links[a].access_arguments){if($.isArray(drupalgap.menu_links[a].access_arguments))for(var d in drupalgap.menu_links[a].access_arguments)if(drupalgap.menu_links[a].access_arguments.hasOwnProperty(d)){var e=drupalgap.menu_links[a].access_arguments[d];if(c=user_access(e))break}}else c=!0;else{var f=drupalgap.menu_links[a].access_callback;if(function_exists(f)){var g=window[f];if(drupalgap.menu_links[a].access_arguments){var h=drupalgap.menu_links[a].access_arguments.slice(0);if(arguments[2]){var i=arguments[2];for(var d in h)if(h.hasOwnProperty(d)){var j=h[d];if(is_int(parseInt(j))){h[d]=i;break}}}else for(var k=0;k0){for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];"%"==h&&(d||(d=[]),d.push(g))}if(d&&d.length>0){for(var g in d)if(d.hasOwnProperty(g)){var i=d[g];e[i]&&(f[i]=e[i])}b=f.join("/")}}}return b}catch(j){console.log("drupalgap_place_args_in_path - "+j)}}function drupalgap_path_has_entity_arg(a){try{return a.length>1&&("comment"==a[0]||"file"==a[0]||"node"==a[0]||"taxonomy"==a[0]&&("vocabulary"==a[1]||"term"==a[1])||"user"==a[0]||"item"==a[0])}catch(b){console.log("drupalgap_path_has_entity_arg - "+b)}}function drupalgap_remove_page_from_dom(a){try{$("#"+a).empty().remove()}catch(b){console.log("drupalgap_remove_page_from_dom - "+b)}}function drupalgap_restart(){try{location.reload()}catch(a){console.log("drupalgap_restart - "+a)}}function drupalgap_set_title(a){try{a&&(drupalgap.page.title=a)}catch(b){console.log("drupalgap_set_title - "+b)}}function drupalgap_services_preprocess(a){try{drupalgap_loading_message_show()}catch(b){console.log("drupalgap_services_preprocess - "+b)}}function drupalgap_services_postprocess(a,b){try{drupalgap_loading_message_hide()}catch(c){console.log("drupalgap_services_postprocess - "+c)}}function drupalgap_services_request_pre_postprocess_alter(a,b){try{if("system"==a.service&&"connect"==a.resource)drupalgap.remote_addr=b.remote_addr,drupalgap.entity_info=b.entity_info,drupalgap.field_info_instances=b.field_info_instances,drupalgap.field_info_fields=b.field_info_fields,drupalgap.field_info_extra_fields=b.field_info_extra_fields,drupalgap.taxonomy_vocabularies=drupalgap_taxonomy_vocabularies_extract(b.taxonomy_vocabularies),drupalgap_service_resource_extract_results({service:a.service,resource:a.resource,data:b});else if("user"!=a.service||"logout"!=a.resource&&"login"!=a.resource&&"register"!=a.resource){if(in_array(a.resource,["create","update","delete"])&&in_array(a.service,entity_types())){var c=a.entity_type,d=a.entity_id,e=a.bundle||null,f=[];if("create"!=a.resource){var g=c;in_array(c,["taxonomy_vocabulary","taxonomy_term"])&&(g=g.replace("_","/",g)),f.push(g+"/"+d),f.push(g+"/"+d+"/view"),f.push(g+"/"+d+"/edit")}else switch(c){case"node":f.push("node/add/"+e)}switch(c){case"node":f.push("node");break;case"taxonomy_vocabulary":f.push("taxonomy/vocabularies");break;case"user":f.push("user-listing")}var h=[];for(var i in f)if(f.hasOwnProperty(i)){var j=f[i];h.push(drupalgap_get_page_id(j))}for(var i in h)if(h.hasOwnProperty(i)){var k=h[i];drupalgap_remove_page_from_dom(k)}}}else drupalgap_remove_pages_from_dom()}catch(l){console.log("drupalgap_services_request_pre_postprocess_alter - "+l)}}function drupalgap_settings_load(){try{console.log("WARNING: drupalgap_settings_load() is deprecated!")}catch(a){console.log("drupalgap_settings_load - "+a)}}function drupalgap_theme_registry_build(){try{var a=module_implements("theme");for(var b in a)if(a.hasOwnProperty(b)){var c=a[b],d=c+"_theme",e=window[d],f=e();for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];h.path=drupalgap_get_path("theme",drupalgap.settings.theme),drupalgap.theme_registry[g]=h}}}catch(i){console.log("drupalgap_theme_registry_build - "+i)}}function variable_set(a,b){try{return b?is_int(b)?b=b.toString():"object"==typeof b&&(b=JSON.stringify(b)):b=" ",window.localStorage.setItem(a,b)}catch(c){drupalgap_error(c)}}function variable_get(a,b){try{var c=window.localStorage.getItem(a);return c||(c=b)," "==c&&(c=""),c}catch(d){drupalgap_error(d)}}function variable_del(a){try{return window.localStorage.removeItem(a)}catch(b){drupalgap_error(b)}}function date_yyyy_mm_dd_hh_mm_ss(){try{var a;return a=arguments[0]?arguments[0]:date_yyyy_mm_dd_hh_mm_ss_parts(),a.year+"-"+a.month+"-"+a.day+" "+a.hour+":"+a.minute+":"+a.second}catch(b){console.log("date_yyyy_mm_dd_hh_mm_ss - "+b)}}function date_yyyy_mm_dd_hh_mm_ss_parts(){try{var a=[],b=null;b=arguments[0]?arguments[0]:new Date;var c=""+b.getFullYear(),d=""+(b.getMonth()+1);1==d.length&&(d="0"+d);var e=""+b.getDate();1==e.length&&(e="0"+e);var f=""+b.getHours();1==f.length&&(f="0"+f);var g=""+b.getMinutes();1==g.length&&(g="0"+g);var h=""+b.getSeconds();return 1==h.length&&(h="0"+h),a.year=c,a.month=d,a.day=e,a.hour=f,a.minute=g,a.second=h,a}catch(i){console.log("date_yyyy_mm_dd_hh_mm_ss_parts - "+i)}}function date_number_of_days_in_month(a,b){try{var c=new Date(a,b,0);return c.getDate()}catch(d){console.log("date_number_of_days_in_month - "+d)}}function scrollToElement(a,b,c){try{b="undefined"!=typeof b?b:1e3,c="undefined"!=typeof c?c:0,element=$(a),offset=element.offset(),offsetTop=offset.top+c,$("html, body").animate({scrollTop:offsetTop},b)}catch(d){console.log("scrollToElement - "+d)}}function theme_autocomplete(a){try{var b="",c=null;c="undefined"!=typeof a.field_info_field?a.field_info_field.field_name+"_"+a.delta:"undefined"!=typeof a.attributes.id?a.attributes.id:user_password(),a.autocomplete_id=c,_theme_autocomplete_variables[c]={},$.extend(!0,_theme_autocomplete_variables[c],a);var d=!1;a.remote&&(d=!0),a.remote=d,_theme_autocomplete_remote[c]=a.remote;var e=null;a.attributes.id?e=a.attributes.id:(e="autocomplete_"+user_password(),a.attributes.id=e);var f={id:e};a.element&&"undefined"!=typeof a.element.default_value&&(f.value=a.element.default_value),b+=theme("hidden",{attributes:f});var g=e+"-list",h={attributes:{id:g,"data-role":"listview","data-filter":"true","data-inset":"true","data-filter-placeholder":"..."}},i="";a.remote?(h.items=[],i+=''):(h.items=_theme_autocomplete_prepare_items(a),h.attributes["data-filter-reveal"]=!0);var j="#"+drupalgap_get_page_id()+" #"+e+' + form.ui-filterable input[data-type="search"]';return i+='",a.default_value_label&&(i+=drupalgap_jqm_page_event_script_code({page_id:drupalgap_get_page_id(),jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_autocomplete_set_default_value_label",jqm_page_event_args:JSON.stringify({selector:j,default_value_label:a.default_value_label})},e)),b+=theme("item_list",h),b+=i}catch(k){console.log("theme_autocomplete - "+k)}}function _theme_autocomplete(a,b,c,d){try{var e=_theme_autocomplete_variables[d];if("undefined"==typeof e.filter)return void console.log('_theme_autocomplete - A "filter" was not supplied.');var f="undefined"!=typeof e.value,g="undefined"!=typeof e.label;if(!f&&!g)return void console.log('_theme_autocomplete - A "value" and/or "label" was not supplied.');f?g||(e.label=e.value):e.value=e.label;var h=$(a),i=$(c.input),j=i.val(),k="";if(h.html(""),j&&j.length>0&&!e._searching){e._searching=!0,h.html('
  • '),h.listview("refresh"),_theme_autocomplete_success_handlers[d]=function(a,b,c,d){try{if(e._searching=!1,0==b.length){if(e.empty_callback){var f=window[e.empty_callback];f(j)}}else{var g=[],i=e.value,l=e.label;for(var m in b)if(b.hasOwnProperty(m)){var n=b[m],o=null;o=c?n[d]:n;var p={value:o[i],label:o[l]};g.push(p)}if(0!=g.length){e.items=g;var q=_theme_autocomplete_prepare_items(e);for(var m in q)if(q.hasOwnProperty(m)){var p=q[m];k+="
  • "+p+"
  • "}h.html(k),h.listview("refresh"),h.trigger("updatelayout")}}if(e.finish_callback){var f=window[e.finish_callback];f(j)}}catch(r){console.log("_theme_autocomplete_success_handlers["+a+"] - "+r)}};var l=null;switch(l=e.custom?e.handler?e.handler:e.field_info_field&&e.field_info_field.settings.handler?e.field_info_field.settings.handler:"views":e.field_info_field?e.field_info_field.settings.handler:"views"){case"views":var m=e.path+"?"+e.filter+"="+encodeURIComponent(j);e.params&&(m+="&"+e.params),views_datasource_get_view_result(m,{success:function(a){var b=!0;e.custom&&(b=!1);var c=null;c=b?a[a.view.root]:a;var f=_theme_autocomplete_success_handlers[d];f(d,c,b,a.view.child)}});break;case"base":case"og":var n=e.field_info_field.settings,o=n.target_type+"_index";if(!drupalgap_function_exists(o))return void console.log("WARNING - _theme_autocomplete - "+o+"() does not exist!");var p={fields:[e.value,e.filter],parameters:{},parameters_op:{}};p.parameters[e.filter]="%"+j+"%",p.parameters_op[e.filter]="like";var q=entityreference_get_target_bundles(n);q&&(p.parameters[entity_get_bundle_name(n.target_type)]=q.join(",")),window[o](p,{success:function(a){_theme_autocomplete_success_handlers[d](d,a,!1)}});break;case"index":if(!e.entity_type)return void console.log("WARNING - _theme_autocomplete - no entity_type provided");var r=e.entity_type+"_index",s=window[r],t=null;if(e.query)t=e.query;else{t={parameters:{},parameters_op:{}};var u=[entity_primary_key(e.entity_type),entity_primary_key_title(e.entity_type)];"taxonomy_term"==e.entity_type&&e.vid&&(t.parameters.vid=e.vid),t.fields=u,t.parameters[e.filter]="%"+j+"%",t.parameters_op[e.filter]="like"}s.apply(null,[t,{success:function(a){var b=_theme_autocomplete_success_handlers[d];b(d,a,!1,null)}}]);break;default:if(!l)return void console.log("WARNING - _theme_autocomplete - no handler provided")}}else $("#"+e.id).val("")}catch(v){console.log("_theme_autocomplete - "+v)}}function _theme_autocomplete_prepare_items(a){try{var b=[];a.items&&(b=a.items);var c=[];if(b.length>0)for(var d in b)if(b.hasOwnProperty(d)){var e=b[d],f="",g="";"string"==typeof e?(f=e,g=e):(f=e.value,g=e.label);var h={attributes:{value:f,onclick:"_theme_autocomplete_click('"+a.attributes.id+"', this, '"+a.autocomplete_id+"')"}},i=l(g,null,h);c.push(i)}return c}catch(j){console.log("_theme_autocomplete_prepare_items - "+j)}}function _theme_autocomplete_click(a,b,c){try{var d=a+"-list";if($("#"+a).val($(b).attr("value")),$(_theme_autocomplete_input_selector[c]).val($(b).html()),_theme_autocomplete_remote[c]?$("#"+d).html(""):($("#"+d+" li").addClass("ui-screen-hidden"),$("#"+d).listview("refresh")),_theme_autocomplete_variables[c].item_onclick&&drupalgap_function_exists(_theme_autocomplete_variables[c].item_onclick)){var e=window[_theme_autocomplete_variables[c].item_onclick];e(a,$(b))}}catch(f){console.log("_theme_autocomplete_click - "+f)}}function _theme_autocomplete_set_default_value_label(a){try{setTimeout(function(){$(a.selector).val(a.default_value_label).trigger("create")},250)}catch(b){console.log("_theme_autocomplete_set_default_value_label - "+b)}}function drupalgap_block_load(a){try{var b=null;if(drupalgap.blocks)for(var c in drupalgap.blocks)if(drupalgap.blocks.hasOwnProperty(c)){var d=drupalgap.blocks[c];if(d[a]){b=d[a];break}}if(null==b){var e="drupalgap_block_load - "+t("failed to load")+' "'+a+'" '+t("block!");drupalgap_alert(e)}return b}catch(f){console.log("drupalgap_block_load - "+f)}}function drupalgap_block_render(a,b,c,d,e){try{var f="",g=!1;if(d.access_callback&&drupalgap_function_exists(d.access_callback)){var h=window[d.access_callback];g=h({path:b,delta:c,region:a.name,theme:drupalgap.settings.theme,settings:d})}else drupalgap_check_visibility("block",d)&&(g=!0,"main"==c||"offline"!=b&&"error"!=b||(g=!1));if(g){var i=drupalgap_block_load(c);e&&e.block_count++,menu_load(c)&&e&&e.block_menu_count++,i&&(f=module_invoke(i.module,"block_view",c,a))}return"string"==typeof f?f:drupalgap_render(f)}catch(j){console.log("drupalgap_block_render - "+j)}}function drupalgap_attributes(a){try{var b="";if(a)for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b+=""!=d?c+'="'+d+'" ':c+" "}return b}catch(e){console.log("drupalgap_attributes - "+e)}}function drupalgap_check_visibility(a,b){try{var c=!0;if("undefined"==typeof b)console.log("drupalgap_check_visibility - WARNING - no data provided for type ("+a+")");else if("undefined"!=typeof b.roles&&b.roles&&b.roles.value&&0!=b.roles.value.length){for(var d in b.roles.value)if(b.roles.value.hasOwnProperty(d)){var e=b.roles.value[d];if(drupalgap_user_has_role(e)?("include"==b.roles.mode&&(c=!0),"exclude"==b.roles.mode&&(c=!1)):("include"==b.roles.mode&&(c=!1),"exclude"==b.roles.mode&&(c=!0)),c)break}}else if("undefined"!=typeof b.pages&&b.pages&&b.pages.value&&0!=b.pages.value.length){var f=drupalgap_path_get(),g=f.split("/");for(var h in b.pages.value)if(b.pages.value.hasOwnProperty(h)){var i=b.pages.value[h];if(""==i&&(i=drupalgap.settings.front),i==f){"include"==b.pages.mode?c=!0:"exclude"==b.pages.mode&&(c=!1);break}if(i.indexOf("*")!=-1){var j=drupalgap_get_menu_link_router_path(f);if(j.replace(/%/g,"*")==i){"include"==b.pages.mode?c=!0:"exclude"==b.pages.mode&&(c=!1);break}var k=i.split("/"),l=!0;if(0==k.length)l=!1;else if(k.length==g.length)for(var m=0;m'+k.title+""}}return b}catch(m){console.log("_drupalgap_form_render_elements - "+m)}}function _drupalgap_form_render_element(a,b){try{var c="";if(!b)return c;var d=b.name,e=language_default(),f=!1,g=!1,h=!1,i=!1;if(b.is_field?(f=b[e],g=b.field_info_instance.widget.module):(f={0:b},g=drupalgap_form_element_get_module_name(b.type)),g&&(h=g+"_field_widget_form",drupalgap_function_exists(h)?i=window[h]:console.log("WARNING: _drupalgap_form_render_element() - "+h+'() does not exist for the "'+b.type+'" form element!')),!f||0==f.length)return c;var j={attributes:{}};j.field_info_field=b.field_info_field,j.field_info_instance=b.field_info_instance;var k=0,l="",m="",n=null;for(var k in f)if(f.hasOwnProperty(k)){var o=f[k];if(n=!0,j.attributes.id=o.id,j.element=o,f[k].children||(f[k].children=[]),b.is_field&&0==k&&(o.title=b.title,m=theme("form_element_label",{element:o})),0==k&&"undefined"!=typeof b.title_placeholder&&b.title_placeholder&&"undefined"==typeof j.attributes.placeholder){var p=b.title;j.attributes.placeholder=p}if(o.default_value||(o.default_value=""),j.attributes.value=o.default_value,"undefined"==typeof o.value||"undefined"!=typeof j.attributes.value&&!empty(j.attributes.value)||(j.attributes.value=o.value),i&&(i.apply(null,[a,null,b.field_info_field,b.field_info_instance,e,f,k,b]),o=$.extend(!0,o,f[k]),!o.type&&b.type&&(o.type=b.type)),o.options&&o.options.attributes&&(j.attributes=$.extend(!0,j.attributes,o.options.attributes)),l+=_drupalgap_form_render_element_item(a,b,j,o),"undefined"!=typeof j.default_value&&delete j.default_value,"undefined"!=typeof j.default_value_label&&delete j.default_value_label,"undefined"!=typeof j.value&&delete j.value,"undefined"==typeof l){n=!1;break}}if(!n)return"";var q=!0;"undefined"==typeof b.wrapped||b.wrapped||(q=!1),"hidden"==b.type&&(q=!1,b.wrapped&&(q=!0)),b.prefix&&(c+=b.prefix);var r={class:drupalgap_form_get_element_container_class(d)};return q&&(c+="
    "),"submit"!=b.type&&"hidden"!=b.type&&("undefined"!=typeof b.title_placeholder&&b.title_placeholder||(c+=b.is_field?m:theme("form_element_label",{element:b}))),""!=l&&(c+=l),b.description&&"hidden"!=b.type&&(c+='
    '+t(b.description)+"
    "),q&&(c+="
    "),b.suffix&&(c+=b.suffix),c}catch(s){console.log("_drupalgap_form_render_element - "+s)}}function _drupalgap_form_render_element_item(a,b,c,d){try{var e="";switch(d.type){case"text":d.type="textfield";break;case"list_text":case"list_float":case"list_integer":d.type="select"}var f=d.type;if(b.disabled&&(c.attributes.disabled=""),"submit"==d.type&&(c.attributes.onclick="_drupalgap_form_submit('"+a.id+"');",c.attributes["data-theme"]||(c.attributes["data-theme"]="b"),"undefined"==typeof c.attributes.type&&(c.attributes.type="button"),"undefined"==typeof c.attributes.class&&(c.attributes.class=""),c.attributes.class+=" dg_form_submit_button "),$.extend(!0,c,d),"undefined"!=typeof c.value&&null!=c.value||"undefined"!=typeof d.default_value&&(c.value=d.default_value),drupalgap_function_exists("theme_"+f))e+=theme(f,c);else{if(!d.markup&&""!=d.markup){var g="Field "+d.type+" not supported.";return console.log("WARNING: _drupalgap_form_render_element_item() - "+g),dpm(d),null}e+=d.markup}if(d.children&&d.children.length>0)for(var h=0;hdrupalgap_form_render() - missing form id!

    "+JSON.stringify(a);$("form#"+a.id).length&&$("form#"+a.id).remove();var b=a.prefix;empty(b)||(b='
    '+b+"
    ");var c=a.suffix;empty(c)||(c='
    '+c+"
    ");var d=_drupalgap_form_render_elements(a),e=drupalgap_attributes(a.options.attributes),f='
    "+b+'
    '+d+c+"
    ";return f}catch(g){console.log("drupalgap_form_render - "+g)}}function drupalgap_form_set_error(a,b){try{drupalgap.form_errors[a]=b}catch(c){console.log("drupalgap_form_set_error - "+c)}}function drupalgap_get_form(a){try{var b="",c=drupalgap_form_load.apply(null,Array.prototype.slice.call(arguments));if(c)b=drupalgap_form_render(c);else{var d="drupalgap_get_form - "+t("failed to get form")+" ("+a+")";drupalgap_alert(d)}return b}catch(e){console.log("drupalgap_get_form - "+e)}}function drupalgap_form_local_storage_delete(a){try{var b=window.localStorage.removeItem(drupalgap_form_id_local_storage_key(a));return b}catch(c){console.log("drupalgap_form_local_storage_delete - "+c)}}function drupalgap_form_local_storage_load(a){try{var b=!1;return b=window.localStorage.getItem(drupalgap_form_id_local_storage_key(a)),b=!!b&&JSON.parse(b)}catch(c){console.log("drupalgap_form_local_storage_load - "+c)}}function drupalgap_form_local_storage_save(a){try{window.localStorage.setItem(drupalgap_form_id_local_storage_key(a.id),JSON.stringify(a))}catch(b){console.log("drupalgap_form_local_storage_save - "+b)}}function drupalgap_form_id_local_storage_key(a){return"drupalgap_form_"+a}function drupalgap_form_load(a){try{var b=drupalgap_form_defaults(a),c=a;if(drupalgap_function_exists(c)){var d=window[c],e=language_default(),f=[];for(var g in arguments)if(arguments.hasOwnProperty(g)){var h=arguments[g];f.push(h)}if(f.splice(0,1),b.arguments=f,0==f.length)b=d(b,null);else{var i=[],j=null;i.push(b),i.push(j);for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];i.push(h)}b=d.apply(null,Array.prototype.slice.call(i))}_drupalgap_form_load_set_element_defaults(b,e),module_invoke_all("form_alter",b,null,a),_drupalgap_form_load_set_element_defaults(b,e),drupalgap_form_local_storage_save(b),Drupal.cache_expiration.forms[a]=1,window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}else{var k="drupalgap_form_load - "+t("no callback function")+" ("+c+") "+t("available for form")+" ("+a+")";drupalgap_alert(k)}return b}catch(l){console.log("drupalgap_form_load - "+l)}}function _drupalgap_form_load_set_element_defaults(a,b){try{for(var c in a.elements)if(a.elements.hasOwnProperty(c)){var d=a.elements[c];if("undefined"==typeof d.is_field){var e=!1,f=drupalgap_field_info_field(c);f&&(e=!0,a.elements[c].field_info_field=f,a.elements[c].field_info_instance=drupalgap_field_info_instance(a.entity_type,c,a.bundle)),a.elements[c].is_field=e}a.elements[c].name||(a.elements[c].name=c);var g=null;if(e){var h=parseInt(d.field_info_field.cardinality);h==-1&&(h=1),a.elements[c][b]||(a.elements[c][b]={});for(var i=0;i("+k+") - "+i+"").text()+"\n"}}if(""!=g)return g}return!1}catch(l){console.log("_drupalgap_form_submit_response_errors - "+l)}}function theme_checkbox(a){try{a.attributes.type="checkbox",a.checked&&(a.attributes.checked="checked");var b="";return b}catch(c){console.log("theme_checkbox - "+c)}}function theme_checkboxes(a){try{var b="";a.attributes.type="checkboxes";for(var c in a.options)if(a.options.hasOwnProperty(c)){var d=a.options[c];if("attributes"!=c){var e=c;empty(d)||(e=d);var f={value:c,attributes:{name:a.name+"["+c+"]",class:a.name,value:c}};a.value&&a.value[c]&&(f.checked=!0),b+=""}}return b}catch(g){console.log("theme_checkbox - "+g)}}function theme_email(a){try{a.attributes.type="email";var b="";return b}catch(c){console.log("theme_email - "+c)}}function theme_file(a){try{a.attributes.type="file";var b="";return b}catch(c){console.log("theme_file - "+c)}}function theme_form_element_label(a){try{var b=a.element;if(empty(b.title))return"";var c="";b.id?c=b.id:b.attributes&&b.attributes.for&&(c=b.attributes.for),"radios"==b.type&&(c=b.name);var d='"}catch(e){console.log("theme_form_element_label - "+e)}}function theme_form_required_marker(a){return"*"}function theme_number(a){try{return a.attributes.type="number",""}catch(b){console.log("theme_number - "+b)}}function theme_hidden(a){try{return a.attributes.type="hidden",a.attributes.value||null==a.value||(a.attributes.value=a.value),""}catch(b){console.log("theme_hidden - "+b)}}function theme_password(a){try{return a.attributes.type="password",""}catch(b){console.log("theme_password - "+b)}}function theme_radios(a){try{var b="";if(a.options){a.attributes.type="radio";var c="radio";a.attributes.id&&(c=a.attributes.id,delete a.attributes.id),a.attributes.name||(a.attributes.name=c);var d=0;for(var e in a.options)if(a.options.hasOwnProperty(e)){var f=a.options[e];if("attributes"!=e){var g="";a.value&&a.value==e&&(g=' checked="checked" ');var h=c+"_"+d.toString(),i='";b+='"+i,d++}}}return b}catch(j){console.log("theme_radios - "+j)}}function theme_range(a){try{a.attributes.type="range","undefined"==typeof a.attributes.value&&(a.attributes.value=a.value);var b="";return b}catch(c){console.log("theme_range - "+c)}}function theme_search(a){try{a.attributes.type="search";var b="";return b}catch(c){console.log("theme_search - "+c)}}function theme_select(a){try{var b="";if(a.options)for(var c in a.options)if(a.options.hasOwnProperty(c)){var d=a.options[c];if("attributes"!=c){var e="";"undefined"!=typeof a.value&&($.isArray(a.value)&&in_array(c,a.value)||a.value==c)&&(e=" selected "),b+='"}}return""}catch(f){console.log("theme_select - "+f)}}function theme_tel(a){try{return a.attributes.type="tel",""}catch(b){console.log("theme_tel - "+b)}}function theme_textfield(a){try{return a.attributes.type="text",""}catch(b){console.log("theme_textfield - "+b)}}function theme_textarea(a){try{var b="
    ";return b}catch(c){console.log("theme_textarea - "+c)}}function drupalgap_goto(a){try{var b={};if(arguments[1]&&(b=arguments[1],"undefined"==typeof b.form_submission&&(b.form_submission=!1)),drupalgap.page.options=b,a=_drupalgap_goto_prepare_path(a,!0),!a)return!1;module_invoke_all("drupalgap_goto_preprocess",a);var c=drupalgap_get_menu_link_router_path(a);if(!drupalgap.menu_links[c]){var d=!1,e=module_invoke_all("404",c);if(e)for(var f in e)if(e.hasOwnProperty(f)){var g=e[f];if(g!==!1){d=g;break}}a=d?d:"404",c=drupalgap_get_menu_link_router_path(a)}if("MENU_DEFAULT_LOCAL_TASK"==drupalgap.menu_links[c].type||"MENU_LOCAL_TASK"==drupalgap.menu_links[c].type||drupalgap_menu_access(c,a)||(a="401",c=drupalgap_get_menu_link_router_path(a)),c==drupalgap_router_path_get()&&a==drupalgap_path_get())if(b.form_submission);else{if(!b.reloadPage)return!1;_system_reload_page=a,a="_reload",c=drupalgap_get_menu_link_router_path(a)}var h=drupalgap_get_page_id(a);if(drupalgap_jqm_active_page_url()==h&&b.form_submission)return drupalgap_clear_messages(),!1;if(in_array(drupalgap_path_get())||drupalgap.back_path.push(drupalgap_path_get()),drupalgap_path_set(a),drupalgap_router_path_set(c),drupalgap_page_in_dom(h)){if(drupalgap.menu_links[c].options&&(b=$.extend({},drupalgap.menu_links[c].options,b)),"undefined"!=typeof b.reloadPage&&b.reloadPage){var i=!!_drupalgap_goto_query_string;drupalgap_remove_page_from_dom(h,{force:!0,leaveQuery:i}),delete b.reloadPage,b.reloadingPage=!0}else if(!b.form_submission)return drupalgap_clear_messages(),_drupalgap_goto_query_string=null,drupalgap.page.process=!1,$.mobile.changePage("#"+h,b),void module_invoke_all("drupalgap_goto_post_process",a)}else"undefined"!=typeof b.reloadPage&&b.reloadPage&&delete b.reloadPage;drupalgap_goto_generate_page_and_go(a,h,b,drupalgap.menu_links[c])}catch(j){console.log("drupalgap_goto - "+j)}}function drupalgap_goto_generate_page_and_go(a,b,c,d){try{var e="",f=drupalgap.settings.theme,g=f+"_page_tpl_html";if(function_exists(g))e=window[g]();else{var h=path_to_theme()+"/page.tpl.html";console.log("@deprecated: "+h+" - use "+g+"() in "+f+".js instead, see: http://docs.drupalgap.org/7/Themes/Create_a_Custom_Theme"),e=drupalgap_file_get_contents(h)}_drupalgap_goto_query_string=null,"undefined"==typeof c&&(c={}),drupalgap_add_page_to_dom({page_id:b,html:e,menu_link:d}),drupalgap_path_get()==a&&c.form_submission&&(c.allowSamePageTransition=!0);var i="index.html#"+b;"phonegap"==drupalgap.settings.mode&&"function"!=typeof parent.window.ripple||(i="#"+b),$.mobile.changePage(i,c),module_invoke_all("drupalgap_goto_post_process",a)}catch(j){console.log("drupalgap_goto_generate_page_and_go - "+j)}}function drupalgap_goto_prepare_path(a){try{return console.log("WARNING - drupalgap_goto_prepare_path() is deprecated, use _drupalgap_goto_prepare_path() instead!"),_drupalgap_goto_prepare_path(a)}catch(b){console.log("drupalgap_goto_prepare_path - "+b)}}function _drupalgap_goto_prepare_path(a){try{if("undefined"!=typeof arguments[1]&&arguments[1]){var b=a.indexOf("?");if(b!=-1&&b!=a.length-1){var c=a.substr(b+1,a.length-b);_drupalgap_goto_query_string=c,a=a.substr(0,b);for(var d=c.split("&"),e=0;e0&&(l=JSON.stringify(e));for(var m=0;m1&&is_int(parseInt(c[1]))&&(c[1]="%",b=c.join("/"));break;case"taxonomy":d>2&&("vocabulary"==c[1]||"term"==c[1])&&is_int(parseInt(c[2]))&&(c[2]="%",b=c.join("/"));break;default:d>1&&is_int(parseInt(c[1]))&&(c[1]="%",b=c.join("/"))}}if(!b&&c&&c.length>1)for(var e,f=c.length-1;f!=-1;f--){e="";for(var g=0;g0){drupalgap.theme.regions[g].links||(drupalgap.theme.regions[g].links=[]);for(var h in b.links)if(b.links.hasOwnProperty(h)){var f=b.links[h];drupalgap.theme.regions[g].links.push(f)}}}}}catch(i){console.log("drupalgap_menus_load - "+i)}}function drupalgap_menus_load_convert_menu_link_to_link_json(a){try{var b={};return a.title&&(b.title=a.title,b.text=a.title),a.path&&(b.path=a.path),a.options&&(b.options=a.options),a.region&&a.region.options&&(b.options=a.options=a.region.options),b}catch(c){console.log("drupalgap_menus_load_convert_menu_link_to_link_json - "+c)}}function drupalgap_menu_router_build_menu_item_relationships(a,b){try{var c=arg(null,a);if(c.length>1){var d=c.splice(0,c.length-1).join("/");if(b.parent=d,drupalgap.menu_links[d]){"undefined"==typeof drupalgap.menu_links[d].children&&(drupalgap.menu_links[d].children=[]),drupalgap.menu_links[d].children.push(a),"undefined"==typeof b.siblings&&(b.siblings=[]);for(var e in drupalgap.menu_links[d].children)if(drupalgap.menu_links[d].children.hasOwnProperty(e)){var f=drupalgap.menu_links[d].children[e];f!=a&&drupalgap.menu_links[f]&&("undefined"==typeof drupalgap.menu_links[f].siblings&&(drupalgap.menu_links[f].siblings=[]),drupalgap.menu_links[f].siblings.push(a),b.siblings.push(f))}}}}catch(g){console.log("drupalgap_menu_router_build_relationships - "+g)}}function drupalgap_loading_message_show(){try{if("undefined"===drupalgap.loading&&(drupalgap.loading=!1),drupalgap.loading||drupalgap_toast_is_shown())return;var a=drupalgap_loader_options();arguments[0]&&(a=arguments[0]),setTimeout(function(){$.mobile.loading("show",a),drupalgap.loading=!0},1)}catch(b){console.log("drupalgap_loading_message_show - "+b)}}function drupalgap_loading_message_hide(){try{if(drupalgap_toast_is_shown())return;setTimeout(function(){$.mobile.loading("hide"),drupalgap.loading=!1,drupalgap.loader="loading"},100)}catch(a){console.log("drupalgap_loading_message_hide - "+a)}}function drupalgap_loader_options(){try{var a=drupalgap.loader,b=t("Loading")+"...",c=!0;if("saving"==a)var b=t("Saving")+"...";var d={text:b,textVisible:c};return drupalgap.settings.loader&&drupalgap.settings.loader[a]&&(d=$.extend(!0,d,drupalgap.settings.loader[a]),d.text&&(d.text=t(d.text))),d}catch(e){console.log("drupalgap_loader_options - "+e)}}function drupalgap_set_message(a){try{if(empty(a))return;var b="status";arguments[1]&&(b=arguments[1]);var c={message:a,type:b};drupalgap.messages.push(c)}catch(d){console.log("drupalgap_set_message - "+d)}}function drupalgap_set_messages(a){try{drupalgap.messages=a}catch(b){console.log("drupalgap_set_messages - "+b)}}function drupalgap_get_messages(){try{return drupalgap.messages}catch(a){console.log("drupalgap_get_messages - "+a)}}function drupalgap_clear_messages(){try{var a=arguments[0];empty(a)&&(a=drupalgap_get_page_id()),$("#"+a+" div.messages").remove()}catch(b){console.log("drupalgap_clear_messages - "+b)}}function drupalgap_alert(a){try{var b=null;arguments[1]&&(b=arguments[1]);var c=function(){},d=t("Alert"),e=t("OK");b&&(b.alertCallback&&(c=b.alertCallback),b.title&&(d=b.title),b.buttonName&&(e=b.buttonName)),"phonegap"!=drupalgap.settings.mode||"undefined"==typeof navigator.notification?(alert(a),c()):navigator.notification.alert(a,c,d,e)}catch(f){console.log("drupalgap_alert - "+f)}}function drupalgap_confirm(a){try{var b=null;arguments[1]&&(b=arguments[1]);var c=function(a){},d=t("Confirm"),e=[t("OK"),t("Cancel")];if(b&&(b.confirmCallback&&(c=b.confirmCallback),b.title&&(d=b.title),b.buttonLabels&&(e=b.buttonLabels)),"function"==typeof parent.window.ripple||"web-app"==drupalgap.settings.mode){var f=confirm(a);c(1==f?1:2)}else navigator.notification.confirm(a,c,d,e);return!1}catch(g){console.log("drupalgap_confirm - "+g)}}function drupalgap_toast(a){try{var b=arguments[2]?arguments[2]:750,c=arguments[1]?arguments[1]:1500; +setTimeout(function(){drupalgap.toast.shown=!0,$.mobile.loading("show",{textVisible:!0,html:a});var b=setInterval(function(){$.mobile.loading("hide"),drupalgap.toast.shown=!1,clearInterval(b)},c)},b)}catch(d){console.log("drupalgap_toast - "+d)}}function drupalgap_toast_is_shown(){return drupalgap.toast.shown}function _GET(){try{var a=!1,b=!1,c=null,d=null;if("undefined"!=typeof arguments[1]){if(b=!0,d=arguments[1],"undefined"==typeof arguments[0])return console.log("WARNING: _GET - missing key for value ("+d+")"),null;c=arguments[0]}else"undefined"!=typeof arguments[0]?(a=!0,c=arguments[0]):a=!0;if(a){var e=null;if(e="undefined"!=typeof arguments[2]?arguments[2]:drupalgap_get_page_id(),"undefined"!=typeof _dg_GET[e])return c?"undefined"!=typeof _dg_GET[e][c]?_dg_GET[e][c]:null:_dg_GET[e]}else if(b){var e=null;e="undefined"!=typeof arguments[2]?drupalgap_get_page_id(arguments[2]):drupalgap_get_page_id(),"undefined"==typeof _dg_GET[e]&&(_dg_GET[e]={}),d&&(_dg_GET[e][c]=d)}return null}catch(f){console.log("_GET - "+f)}}function template_preprocess_page(a){try{"undefined"==typeof a.attributes&&(a.attributes={}),a.attributes["data-role"]="page",module_invoke_all("preprocess_page",a),drupalgap.page.variables=a}catch(b){console.log("template_preprocess_page - "+b)}}function template_process_page(a){try{var b=drupalgap_path_get();drupalgap.output=menu_execute_active_handler();var c=drupalgap_get_page_id(b),d=$("#"+c),e=$(d).html();if(!e)return;for(var f in drupalgap.theme.regions)if(drupalgap.theme.regions.hasOwnProperty(f)){var g=drupalgap.theme.regions[f],h={};$.extend(!0,h,g),e=e.replace("{:"+g.name+":}",drupalgap_render_region(h))}$(d).html(e),module_invoke_all("post_process_page",a)}catch(i){console.log("template_process_page - "+i)}}function drupalgap_get_page_id(a){try{a||(a=drupalgap_path_get());var b=a.toLowerCase().replace(/\//g,"_").replace(/-/g,"_");return b}catch(c){console.log("drupalgap_get_page_id - "+c)}}function drupalgap_add_page_to_dom(a){try{var b={id:a.page_id,"data-role":"page"};b=$.extend(!0,b,a.menu_link.options.attributes),b.class+=" "+drupalgap_page_class_get(drupalgap.router_path),a.html=a.html.replace(/{:drupalgap_page_attributes:}/g,drupalgap_attributes(b)),$("body").append(a.html),drupalgap.pages.push(a.page_id)}catch(c){console.log("drupalgap_add_page_to_dom - "+c)}}function drupalgap_remove_page_from_dom(a){try{var b=null;b="undefined"!=typeof arguments[2]?arguments[2]:drupalgap_get_page_id(drupalgap_path_get());var c={};if("undefined"!=typeof arguments[1]&&(c=arguments[1]),b!=a||c.force){var d=$("#"+b),e=$(d).attr("style");$("#"+a).empty().remove(),e&&$(d).attr("style",e);var f=drupalgap.pages.indexOf(a);f>-1&&drupalgap.pages.splice(f,1),"undefined"==typeof _dg_GET[a]||"undefined"!=typeof c.leaveQuery&&c.leaveQuery||delete _dg_GET[a],views_embedded_view_delete(a)}else console.log("WARNING: drupalgap_remove_page_from_dom() - not removing the current page ("+a+") from the DOM!")}catch(g){console.log("drupalgap_remove_page_from_dom - "+g)}}function drupalgap_remove_pages_from_dom(){try{var a=drupalgap_get_page_id(drupalgap_path_get()),b=drupalgap.pages.slice(0);for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];a!=d&&drupalgap_remove_page_from_dom(d,null,a)}drupalgap.pages=[a],drupalgap.views.ids=[],drupalgap.page.jqm_events=[],drupalgap.back_path=[]}catch(e){console.log("drupalgap_remove_pages_from_dom - "+e)}}function drupalgap_page_class_get(a){try{for(var b=a.replace(/[\/%]/g,"_");b.lastIndexOf("_")==b.length-1;)b=b.substr(0,b.length-1);return b}catch(c){console.log("drupalgap_page_class_get - "+c)}}function drupalgap_page_in_dom(a){try{var b=$("body div[data-role$='page']"),c=!1;if(b&&b.length>0)for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];if($(e).attr("id")==a){c=!0;break}}return c}catch(f){console.log("drupalgap_page_in_dom - "+f)}}function drupalgap_is_front_page(){try{return drupalgap_path_get()==drupalgap.settings.front}catch(a){console.log("drupalgap_is_front_page - "+a)}}function drupalgap_jqm_active_page_url(){try{return $.mobile.activePage?$.mobile.activePage.data("url"):""}catch(a){console.log("drupalgap_jqm_active_page_url - "+a)}}function drupalgap_render_page(){try{return module_invoke_all("page_build",drupalgap.output),drupalgap_render(drupalgap.output)}catch(a){console.log("drupalgap_render_page - "+a)}}function drupalgap_render_region(a){try{if(!drupalgap.settings.blocks[drupalgap.settings.theme]){var b='WARNING: drupalgap_render_region() - there are no blocks for the "'+drupalgap.settings.theme+'" theme in the settings.js file!';return console.log(b),""}var c=drupalgap_path_get(),d="";d+=_drupalgap_region_render_zone("_prefix",a,c);var e=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];if(e){var f=0;$.each(drupalgap.settings.blocks[drupalgap.settings.theme][a.name],function(a,b){in_array(a,["_prefix","_suffix"])||f++}),e=f}if(e){a.attributes.class||(a.attributes.class=""),a.attributes.class+=" region_"+a.name+" ",d+="
    ";var g=0,h=0;if(a.links&&a.links.length>0){var i=0,j=0;for(var k in a.links)if(a.links.hasOwnProperty(k)){var m=a.links[k],n=menu_region_link_get_data(m);if(drupalgap_check_visibility("region",n)){g++;var o=drupalgap_link_get_class(m);if(o){var p=menu_region_link_get_side(o);"left"==p?i++:"right"==p&&j++}}}for(var q="",r="",s=0;s1){var x={"data-type":"horizontal","data-role":"controlgroup",class:"ui-btn-left"};q="
    "+q.replace(/ui-btn-left/g,"")+"
    "}if(j>1){var x={"data-type":"horizontal","data-role":"controlgroup",class:"ui-btn-right"};r="
    "+r.replace(/ui-btn-right/g,"")+"
    "}d+=q+r}var y={block_count:0,block_menu_count:0},z=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];for(var A in z)if(z.hasOwnProperty(A)){var B=z[A];"_prefix"!=A&&"_suffix"!=A&&(d+=drupalgap_block_render(a,c,A,B,y))}(in_array(a.attributes["data-role"],["header","footer"])&&(0==y.block_count&&g>0||y.block_count-y.block_menu_count==0)||g>0&&h>=y.block_menu_count&&0==y.block_count)&&("undefined"!=typeof a.collapse_on_empty&&a.collapse_on_empty!==!1||(d+="

     

    ")),d+="
    "}return d+=_drupalgap_region_render_zone("_suffix",a,c)}catch(C){console.log("drupalgap_render_region - "+C)}}function _drupalgap_region_render_zone(a,b,c){try{var d="",e=drupalgap.settings.theme;if("undefined"==typeof drupalgap.settings.blocks[e][b.name])return d;var f=drupalgap.settings.blocks[e][b.name];if("undefined"==typeof f[a])return d;var g=f[a];for(var h in g)if(g.hasOwnProperty(h)){var i=g[h];d+=drupalgap_block_render(b,c,h,i)}return d}catch(j){console.log("_drupalgap_region_render_zone - "+j)}}function drupalgap_panel_id(a){try{return a+"_"+drupalgap_get_page_id()}catch(b){console.log("drupalgap_panel_id - "+b)}}function drupalgap_render(a){var b=$.type(a),c="";if("string"===b)c=a;else if("object"===b){if(a.markup)return a.markup;if(a.theme&&!drupalgap.theme_registry[a.theme])return theme(a.theme,a);if(a.theme&&drupalgap.theme_registry[a.theme]){var d=drupalgap.settings.theme,e=d+"_"+a.theme+"_tpl_html";if(template_file_html="",function_exists(e))template_file_html=window[e]();else{var f=drupalgap.theme_registry[a.theme],g=a.theme.replace(/_/g,"-")+".tpl.html",h=f.path+"/"+g;console.log("@deprecated: "+h+" - use "+e+"() in "+d+".js instead, see: http://docs.drupalgap.org/7/Themes/Create_a_Custom_Theme"),template_file_html=drupalgap_file_get_contents(h)}var i=drupalgap_get_placeholders_from_html(template_file_html);if(i)for(var j in i)if(i.hasOwnProperty(j)){var k=i[j],l="";if(a[k]){var m=a[k];a[k].markup?l=a[k].markup:a[k].theme&&(l=theme(a[k].theme,m)),delete a[k]}template_file_html=template_file_html.replace("{:"+k+":}",l)}c+=template_file_html}else{var n={},o=0;for(var j in a)if(a.hasOwnProperty(j)){var p=a[j],q=typeof p;if("object"===q&&null!==p){if(p.theme&&drupalgap.theme_registry[p.theme])continue;var r="undefined"!=typeof p.weight?p.weight:0;"undefined"==typeof n[r]&&(n[r]=[]),n[r].push(drupalgap_render(p)),o++}else if("array"===q)for(var s=0;s"+a.text+"";return b}catch(c){console.log("theme_button_link - "+c)}}function theme_button_link(a){try{return a.attributes["data-role"]="button",theme_link(a)}catch(b){console.log("theme_button_link - "+b)}}function theme_collapsible(a){try{a.attributes["data-role"]="collapsible";var b="h2";a.header_type&&(b=a.header_type);var c={};a.header_attributes&&(c=a.header_attributes);var d="
    <"+b+" "+drupalgap_attributes(c)+">"+a.header+""+a.content+"
    ";return d}catch(e){console.log("theme_collapsible - "+e)}}function theme_collapsibleset(a){try{a.attributes["data-role"]="collapsible-set";var b="
    ";for(var c in a.items)if(a.items.hasOwnProperty(c)){var d=a.items[c];b+=theme("collapsible",d)}return b+="
    "}catch(e){console.log("theme_collapsibleset - "+e)}}function theme_controlgroup(a){try{a.attributes["data-role"]="controlgroup";var b="
    ";for(var c in a.items)if(a.items.hasOwnProperty(c)){var d=a.items[c];b+=d}return b+="
    "}catch(e){console.log("theme_controlgroup - "+e)}}function theme_header(a){try{a.attributes["data-role"]="header","undefined"==typeof a.type&&(type="h2");var b=a.type_attributes?" "+drupalgap_attributes(a.type_attributes):"",c="
    <"+type+b+">"+a.text+"
    ";return c}catch(d){console.log("theme_header - "+d)}}function theme_image(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),""}catch(b){console.log("theme_image - "+b)}}function theme_audio(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),""}catch(b){console.log("theme_audio - "+b)}}function theme_video(a){try{return a.path&&(a.attributes.src=a.path),a.alt&&(a.attributes.alt=a.alt),a.title&&(a.attributes.title=a.title),"undefined"!=typeof device&&"iOS"==device.platform&&"undefined"==typeof a.attributes["webkit-playsinline"]&&(a.attributes["webkit-playsinline"]=""),""}catch(b){console.log("theme_video - "+b)}}function theme_image_style(a){try{return a.path=image_style_url(a.style_name,a.path),theme_image(a)}catch(b){console.log("theme_image - "+b)}}function theme_item(a){try{var b="";for(var c in a.item)if(a.item.hasOwnProperty(c)){var d=a.item[c];b+="

    "+a.model.fields[c].title+"

    "+d+"

    "}return b}catch(e){console.log("theme_item - "+e)}}function theme_item_list(a){try{var b="ul";a.type&&(b=a.type);var c="";if(a.title&&(c+="

    "+a.title+"

    "),c+="<"+b+" "+drupalgap_attributes(a.attributes)+">",a.items&&a.items.length>0)for(var d="undefined"!=typeof a.attributes["data-role"]&&"listview"==a.attributes["data-role"],e=0;e"}else if("object"==typeof f){var h=f.attributes?f.attributes:{},i=f.content?f.content:"";c+="
  • "+drupalgap_render(i)+"
  • "}}return c+=""}catch(j){console.log("theme_item_list - "+j)}}function theme_jqm_item_list(a){try{return a.attributes?a.attributes["data-role"]&&"listview"!=a.attributes["data-role"]||(a.attributes["data-role"]="listview"):a.attributes["data-role"]="listview",theme_item_list(a)}catch(b){console.log("theme_jqm_item_list - "+b)}}function theme_link(a){try{var b="";if(a.text&&(b=a.text),"undefined"!=typeof a.path&&null!=a.path){if(0==a.path.indexOf("#"))return a.attributes.href=a.path,""+b+"";var c="drupalgap_goto('"+a.path+"');";if(a.options)if(a.options.InAppBrowser)c="window.open('"+a.path+"', '_blank', 'location=yes');";else{a.path=_drupalgap_goto_prepare_path(a.path);var d="";for(var e in a.options)if(a.options.hasOwnProperty(e)){var f=a.options[e];"attributes"!=e&&("string"==typeof f&&(f="'"+f+"'"),d+=e+":"+f+",")}c="drupalgap_goto('"+a.path+"', {"+d+"});"}return a.path==drupalgap_path_get()&&(a.attributes.class.indexOf("ui-btn-active")==-1&&(a.attributes.class+=" ui-btn-active "),a.attributes.class.indexOf("ui-state-persist")==-1&&(a.attributes.class+=" ui-state-persist ")),'"+b+""}return"undefined"==typeof a.attributes.href&&(a.attributes.href="#"),""+b+""}catch(g){console.log("theme_link - "+g)}}function theme_logout(a){try{return bl(t("Logout"),"user/logout",{attributes:{"data-icon":"action","data-iconpos":"right"}})}catch(b){console.log("theme_logout - "+b)}}function theme_popup(a){try{a.attributes["data-role"]="popup";var b={};a.button_attributes&&(b=a.button_attributes),b.href="#"+a.attributes.id,b["data-rel"]="popup";var c=bl(a.button_text,null,{attributes:b})+"
    "+a.content+"
    ";return c}catch(d){console.log("theme_popup - "+d)}}function theme_submit(a){try{return""}catch(b){console.log("theme_submit - "+b)}}function theme_table(a){try{var b="";if(a.header){b+="";for(var c in a.header)if(a.header.hasOwnProperty(c)){var d=a.header[c];d.data&&(b+="")}b+=""}if(b+="",a.rows)for(var e in a.rows)if(a.rows.hasOwnProperty(e)){var f=a.rows[e];if(b+="",f)for(var g in f)if(f.hasOwnProperty(g)){var d=f[g];b+=""}b+=""}return b+"
    "+d.data+"
    "+d+"
    "}catch(h){console.log("theme_table - "+h)}}function theme_jqm_table(a){try{return a.attributes["data-role"]="table",a.attributes["data-mode"]="reflow",theme_table(a)}catch(b){console.log("theme_jqm_table - "+b)}}function _drupalgap_page_title_pageshow(a){try{var b=drupalgap_router_path_get(),c=[];if("undefined"!=typeof drupalgap.menu_links[b].title&&drupalgap_set_title(drupalgap.menu_links[b].title),"undefined"!=typeof drupalgap.menu_links[b].title_callback){var d=drupalgap.menu_links[b].title_callback;if(drupalgap_function_exists(d)){var e=window[d];if(c.unshift(_drupalgap_page_title_pageshow_success),drupalgap.menu_links[b].title_arguments){var f=arg(null,drupalgap_path_get()),g=drupalgap.menu_links[b].title_arguments;for(var h in g)if(g.hasOwnProperty(h)){var i=g[h];is_int(i)&&f[i]?c.push(f[i]):c.push(i)}}drupalgap_set_title(e.apply(null,Array.prototype.slice.call(c)))}}else _drupalgap_page_title_pageshow_success(drupalgap_get_title())}catch(j){console.log("_drupalgap_page_title_pageshow - "+j)}}function _drupalgap_page_title_pageshow_success(a){try{var b=system_title_block_id(drupalgap_path_get());$("h1#"+b).html(a)}catch(c){console.log("_drupalgap_page_title_pageshow_success - "+c)}}function hook_assemble_form_state_into_field(a,b,c,d,e,f,g,h,i){try{var j={foo:"bar"};return j;var j,j,j,j}catch(k){console.log("hook_assemble_form_state_into_field - "+k)}}function hook_deviceready(){}function hook_device_connection(){var a=new Date;6==a.getDay()&&(drupalgap.online=!1)}function hook_device_offline(){drupalgap_goto("")}function hook_drupalgap_back(a,b){a==drupalgap.settings.front&&"user/login"==b&&drupalgap_toast("Please login to continue")}function hook_drupalgap_goto_preprocess(a){try{a==drupalgap.settings.front&&drupalgap_alert(t("Preprocessing the front page!"))}catch(b){console.log("hook_drupalgap_goto_preprocess - "+b)}}function hook_drupalgap_goto_post_process(a){try{a==drupalgap.settings.front&&drupalgap_alert(t("Post processing the front page!"))}catch(b){console.log("hook_drupalgap_goto_post_process - "+b)}}function hook_services_success(a,b){}function hook_block_info(){}function hook_block_view(a,b){}function hook_404(a){}function hook_entity_pre_build_content(a,b,c){"node"==b&&"undefined"!=typeof a.field_date&&(a.body.weight=0,a.field_date.weight=1)}function hook_entity_post_build_content(a,b,c){}function hook_entity_pre_render_content(a,b,c){try{"node"==b&&"undefined"!=typeof a.field_date&&(a.field_date.access=!1)}catch(d){console.log("hook_entity_pre_render_content - "+d)}}function hook_entity_post_render_content(a,b,c){try{"article"==a.type&&(a.content+="

    "+t("Example text on every article!")+"

    ")}catch(d){console.log("hook_entity_post_render_content - "+d)}}function hook_entity_view_alter(a,b,c,d){try{"user"==a&&"view"==c&&(b==Drupal.user.uid?(d.foo={markup:"

    Extra stuff when viewing own user profile...

    "},d.volume={theme:"range",attributes:{min:"0",max:"11",value:"11","data-theme":"b"}}):d.bar={markup:"

    Viewing some other profile...

    "})}catch(e){console.log("hook_entity_view_alter - "+e)}}function hook_field_info_instance_add_to_form(a,b,c,d,e){try{e.value_callback="example_field_value_callback"}catch(f){console.log("hook_field_info_instance_add_to_form - "+f)}}function hook_field_formatter_view(a,b,c,d,e,f,g){try{var h={};for(var i in f)if(f.hasOwnProperty(i)){f[i];h[i]={markup:"

    "+t("Hello!")+"

    "}}return h}catch(j){console.log("hook_field_formatter_view - "+j)}}function hook_field_widget_form(a,b,c,d,e,f,g,h){try{f[g].type="textfield"}catch(i){console.log("hook_field_widget_form - "+i)}}function hook_entity_post_render_field(a,b,c,d){"field_my_image"==b&&(d.content+="

    "+a.title+"

    ")}function hook_form_alter(a,b,c){"user_login_form"==c&&(a.elements.name.description=t("Enter your login name"))}function hook_image_path_alter(a){}function hook_install(){}function hook_locale(){return["es","it"]}function hook_menu(){try{var a={};return a.hello_world={title:t("Hello World"),page_callback:"my_module_hello_world_page"},a}catch(b){console.log("hook_menu - "+b)}}function hook_mvc_model(){var a={};return a}function hook_mvc_view(){}function hook_mvc_controller(){}function hook_node_page_view_alter_TYPE(a,b){try{var c={};c.my_markup={markup:"

    "+t("Click below to see the node!")+"

    "},c.my_collapsible={theme:"collapsible",header:a.title,content:a.content},b.success(c)}catch(d){console.log("hook_node_page_view_alter_TYPE() - "+d)}}function hook_page_build(a){try{a.node&&"article"==a.node.type&&delete a.title}catch(b){console.log("hook_page_build - "+b)}}function hook_preprocess_page(a){try{}catch(b){console.log("hook_preprocess_page - "+b)}}function hook_post_process_page(a){try{}catch(b){console.log("hook_post_process_page - "+b)}}function hook_views_exposed_filter(a,b,c,d,e){try{}catch(f){console.log("hook_views_exposed_filter - "+f)}}function comment_menu(){var a={"comment/%":{title:t("Comment"),page_callback:"comment_page_view",page_arguments:[1],pageshow:"comment_page_view_pageshow",title_callback:"comment_page_title",title_arguments:[1]},"comment/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"comment/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["comment_edit","comment",1],weight:0,type:"MENU_LOCAL_TASK",access_callback:"comment_access",access_arguments:[1],options:{reloadPage:!0}}};return a}function comment_access(a){try{return!!(a.uid==Drupal.user.uid&&user_access("edit own comments")||user_access("administer comments"))}catch(b){console.log("comment_access - "+b)}}function comments_container_id(a){return"comments_container_"+a}function comment_container_id(a){return"comment_container_"+a}function comment_list_id(a){try{return comments_container_id(a)}catch(b){console.log("comment_list_id - "+b)}}function comment_page_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("comment",a,"view")};return b}drupalgap_error(t("No comment id provided!"))}catch(c){console.log("comment_page_view - "+c)}}function comment_page_view_pageshow(a){try{comment_load(a,{success:function(b){var c=theme("comment",{comment:b}),d=theme("jqm_item_list",{items:[c]});_drupalgap_entity_page_container_inject("comment",a,"view",d)}})}catch(b){console.log("comment_page_view_pageshow - "+b)}}function comment_page_title(a,b){try{var c="";comment_load(b,{success:function(b){b&&b.subject&&(c=b.subject),a.call(null,c)}})}catch(d){console.log("comment_page_title - "+d)}}function comment_edit(a,b,c,d){try{c||(c={nid:arg(1)});var e=null;e=d&&d.type?d.type:c.node_type.replace("comment_node_","");var f="comment_node_"+e;a.id+="_"+c.nid,a.entity_type="comment",a.bundle=f,a.action="node/"+c.nid,drupalgap_entity_add_core_fields_to_form("comment",f,a,c),drupalgap_field_info_instances_add_to_form("comment",f,a,c),a.elements.submit={type:"submit",value:t("Save")};var g=t("Add comment");return c&&c.cid&&(g=t("Edit comment"),a.buttons.cancel=drupalgap_form_cancel_button(),a.buttons.delete=drupalgap_entity_edit_form_delete_button("comment",c.cid)),a.prefix+="

    "+g+"

    ",a}catch(h){console.log("comment_edit - "+h)}}function comment_edit_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("comment_edit_submit - "+d)}}function comment_services_postprocess(a,b){try{if("comment"==a.service&&"create"==a.resource){var c=drupalgap_path_get(),d=drupalgap_get_menu_link_router_path(c);if("node/%"==d){var e=arg(1),f=comments_container_id(e),g=$("#"+f);if("undefined"!=typeof g.length&&0==g.length)return;node_load(e,{reset:!0,success:function(a){comment_load(b.cid,{success:function(a){$(g).append(theme("comment",{comment:a})).trigger("create"),scrollToElement("#"+f+" #"+comment_container_id(a.cid),500);var b="#"+drupalgap_get_page_id()+" #comment_edit_"+a.nid;drupalgap_form_clear(b)}})}})}}}catch(h){console.log("comment_services_postprocess - "+h)}}function theme_comments(a){try{a.attributes.id=comments_container_id(a.node.nid),a.attributes.class+="comments comments-node-"+a.node.type,a.attributes["data-role"]="collapsible-set";var b="
    ";return a.node.comment_count>0&&(b+='

    Comments

    '),a.comments&&(b+=a.comments),b+="
    "}catch(c){console.log("theme_comments - "+c)}}function theme_comment(a){try{var b=a.comment;a.attributes.id=comment_container_id(b.cid),a.attributes.class+="comment ",a.attributes["data-role"]="collapsible",a.attributes["data-collapsed"]="false";var c="
    ",d="",e="";b.picture_uri&&(e+=theme("image",{path:drupalgap_image_path(b.picture_uri)}));var f=new Date(1e3*b.created);f=f.toLocaleDateString()+" at "+f.toLocaleTimeString();var g=e+"

    "+b.name+"

    "+f+"

    ";return g=l(g,"user/"+b.uid),d+="

    "+b.subject+'

    • '+g+"
    "+b.content,c+=d,(user_access("administer comments")||user_access("edit own comments")&&b.uid==Drupal.user.uid)&&(c+=theme("button_link",{text:t("Edit"),path:"comment/"+b.cid+"/edit",attributes:{"data-icon":"gear"}})),c+="
    "}catch(h){console.log("theme_comment - "+h)}}function contact_menu(){try{var a={};return a.contact={title:t("Contact"),page_callback:"drupalgap_get_form",page_arguments:["contact_site_form"],pageshow:"contact_site_form_pageshow",access_arguments:["access site-wide contact form"]},a["user/%/contact"]={title:t("User contact"),page_callback:"drupalgap_get_form",page_arguments:["contact_personal_form",1],pageshow:"contact_personal_form_pageshow",access_arguments:["access user contact forms"],weight:10,type:"MENU_LOCAL_TASK"},a}catch(b){console.log("contact_menu - "+b)}}function contact_index(a){try{a.method="GET",a.path="contact.json",a.service="contact",a.resource="index",Drupal.services.call(a)}catch(b){console.log("contact_index - "+b)}}function contact_site(a){try{a.method="POST",a.path="contact/site.json",a.service="contact",a.resource="site",Drupal.services.call(a)}catch(b){console.log("contact_site - "+b)}}function contact_personal(a){try{a.method="POST",a.path="contact/personal.json",a.service="contact",a.resource="personal",Drupal.services.call(a)}catch(b){console.log("contact_personal - "+b)}}function contact_site_form(a,b){try{return a.elements.name={title:t("Your name"),type:"textfield",required:!0},a.elements.mail={title:t("Your e-mail address"),type:"email",required:!0},a.elements.subject={title:t("Subject"),type:"textfield",required:!0},a.elements.cid={title:t("Category"),type:"select",required:!0},a.elements.message={title:t("Message"),type:"textarea",required:!0},a.elements.copy={title:t("Send yourself a copy?"),type:"checkbox",default_value:0,access:!1},a.elements.submit={type:"submit",value:t("Send message")},0!=Drupal.user.uid&&(a.elements.name.default_value=Drupal.user.name,a.elements.name.disabled=!0,a.elements.mail.default_value=Drupal.user.mail,a.elements.mail.disabled=!0,a.elements.copy.access=!0),a}catch(c){console.log("contact_site_form - "+c)}}function contact_site_form_pageshow(){try{contact_index({success:function(a){var b=$("#edit-contact-site-form-cid");if(a&&a.length){for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=1==d.selected?"selected":"",f='";$(b).append(f)}$(b).selectmenu("refresh"),1==a.length&&$(b).hide()}}})}catch(a){console.log("contact_site_form_pageshow - "+a)}}function contact_site_form_submit(a,b){var c={name:b.values.name,mail:b.values.mail,subject:b.values.subject,cid:b.values.cid,message:b.values.message,copy:b.values.copy};contact_site({data:JSON.stringify(c),success:function(a){a[0]?drupalgap_alert(t("Your message has been sent!")):drupalgap_alert(t("There was a problem sending your message!"),{title:t("Error")}),drupalgap_form_clear()},error:function(a,b,c){if(c&&(c=JSON.parse(c),c.form_errors)){var d="";for(var e in c.form_errors)if(c.form_errors.hasOwnProperty(e)){var f=c.form_errors[e];d+=f+"\n"}""!=d&&drupalgap_alert(d)}}})}function contact_personal_form(a,b,c){try{a.elements.name={title:t("Your name"),type:"textfield",required:!0},a.elements.mail={title:t("Your e-mail address"),type:"email",required:!0},a.elements.to={type:"hidden",required:!0};var d=contact_personal_form_to_container_id(c);return a.elements.to_display={title:"To",markup:'
    '},a.elements.subject={title:t("Subject"),type:"textfield",required:!0},a.elements.message={title:t("Message"),type:"textarea",required:!0},a.elements.copy={title:t("Send yourself a copy?"),type:"checkbox",default_value:0,access:!1},a.elements.submit={type:"submit",value:t("Send message")},0!=Drupal.user.uid&&(a.elements.name.default_value=Drupal.user.name,a.elements.name.disabled=!0,a.elements.mail.default_value=Drupal.user.mail,a.elements.mail.disabled=!0,a.elements.copy.access=!0),a}catch(e){console.log("contact_personal_form - "+e)}}function contact_personal_form_pageshow(a,b){try{user_load(b,{success:function(a){if(!a.data.contact)return void $("#"+drupalgap_get_page_id()+" #drupalgap_form_errors").html("
    "+t("Sorry, this user's contact form is disabled.")+"
    ");var c=contact_personal_form_to_container_id(b);$("#"+c).html(l(a.name,"user/"+a.uid));var d="#"+drupalgap_get_page_id()+" #edit-contact-personal-form-to";$(d).val(a.name)}})}catch(c){console.log("contact_personal_form_pageshow - "+c)}}function contact_personal_form_submit(a,b){var c={name:b.values.name,mail:b.values.mail,to:b.values.to,subject:b.values.subject,message:b.values.message,copy:b.values.copy};contact_personal({data:JSON.stringify(c),success:function(a){a[0]?drupalgap_alert(t("Your message has been sent!")):drupalgap_alert(t("There was a problem sending your message!"),{title:t("Error")}),drupalgap_form_clear()},error:function(a,b,c){if(c&&(c=JSON.parse(c),c.form_errors)){var d="";for(var e in c.form_errors)if(c.form_errors.hasOwnProperty(e)){var f=c.form_errors[e];d+=f+"\n"}""!=d&&drupalgap_alert(d)}}})}function contact_personal_form_to_container_id(a){return"contact_personal_form_user_"+a}function drupalgap_entity_view_mode(a,b){var c="drupalgap";return"undefined"!=typeof drupalgap.settings.view_modes&&(a&&b?drupalgap.settings.view_modes[a]&&drupalgap.settings.view_modes[a][b]&&drupalgap.settings.view_modes[a][b].view_mode&&(c=drupalgap.settings.view_modes[a][b].view_mode):a&&drupalgap.settings.view_modes[a]&&drupalgap.settings.view_modes[a].view_mode&&(c=drupalgap.settings.view_modes[a].view_mode)),c}function drupalgap_get_entity_container_id(a,b,c){var d="dg-entity-container-"+a+"-"+b;return c&&(d+="-"+c),d}function drupalgap_get_entity(a,b,c,d){return"
    "+drupalgap_jqm_page_event_script_code({jqm_page_event_callback:"drupalgap_get_entity_pageshow",jqm_page_event_args:JSON.stringify({handler:a,entity_type:b,entity_id:c})})}function drupalgap_get_entity_pageshow(a){var b=4==drupalgap.menu_links[drupalgap_router_path_get()].page_arguments.length?drupalgap.menu_links[drupalgap_router_path_get()].page_arguments[3]:null;entity_load(a.entity_type,a.entity_id,{success:function(c){var d=drupalgap_get_entity_container_id(a.entity_type,a.entity_id,b);$("#"+d).html(drupalgap_render(window[a.handler](c))).trigger("create")}})}function drupalgap_get_entity_form(a,b,c,d){return d=d?d:"edit","
    "+drupalgap_jqm_page_event_script_code({jqm_page_event_callback:"drupalgap_get_entity_form_pageshow",jqm_page_event_args:JSON.stringify({handler:a,entity_type:b,entity_id:c})})}function drupalgap_get_entity_form_pageshow(a){var b=4==drupalgap.menu_links[drupalgap_router_path_get()].page_arguments.length?drupalgap.menu_links[drupalgap_router_path_get()].page_arguments[3]:"edit",c=function(c){var d=drupalgap_get_entity_container_id(a.entity_type,a.entity_id,b); +$("#"+d).html(drupalgap_get_form(a.handler,c)).trigger("create")};"add"==a.entity_id?c({}):entity_load(a.entity_type,a.entity_id,{success:c})}function entity_install(){entity_clean_local_storage()}function drupalgap_entity_add_core_fields_to_form(a,b,c,d){try{var e=drupalgap_entity_get_core_fields(a,b);for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h=g.default_value;d&&d[f]&&(h=d[f]),c.elements[f]=g,c.elements[f].default_value=h}}catch(i){console.log("drupalgap_entity_add_core_fields_to_form - "+i)}}function drupalgap_entity_assemble_data(a,b,c,d){try{return void console.log("WARNING: drupalgap_entity_assemble_data() has been deprecated! Now just call e.g. node_save() for auto assembly.")}catch(e){console.log("drupalgap_entity_assemble_data - "+e)}}function drupalgap_entity_edit_form_delete_button(a,b){return{title:t("Delete"),attributes:{onclick:"javascript:drupalgap_entity_edit_form_delete_confirmation('"+a+"', "+b+");"}}}function drupalgap_entity_edit_form_delete_confirmation(a,b){try{var c=t("Delete this content, are you sure? This action cannot be undone...");drupalgap_confirm(c,{confirmCallback:function(c){if(2!=c){drupalgap.loader="deleting";var d={};d.success=function(c){var d=a+"/"+b,e=drupalgap_get_page_id(d);drupalgap_page_in_dom(e)&&drupalgap_remove_page_from_dom(e),window.localStorage.removeItem(entity_local_storage_key(a,b));var f=drupalgap_form_local_storage_load("node_edit"),g=f.action?f.action:"";drupalgap_goto(g,{reloadPage:!0,form_submission:!0})};var e=services_get_resource_function_for_entity(a,"delete"),f=window[e];f(b,d)}}})}catch(d){console.log("drupalgap_entity_edit_form_delete_confirmation - "+d)}}function drupalgap_entity_render_content(a,b){try{b.content="";var c=b.type;"comment"==a?c=b.bundle:"taxonomy_term"==a&&(c=b.vocabulary_machine_name);var d=drupalgap_field_info_instances(a,c);if(!d)return;module_invoke_all("entity_pre_build_content",b,a,c);var e={},f={};for(var g in d)if(d.hasOwnProperty(g)){var h=d[g];if(!h.display)break;var i=h.display.default,j=drupalgap_entity_view_mode(a,c);h.display[j]&&(i=h.display[j],"undefined"==typeof i.module&&"undefined"!=typeof h.display.default.module&&(i.module=h.display.default.module)),"hidden"!=i.type&&(f[g]=i,e[g]=b[g]&&"undefined"!=typeof b[g].weight?b[g].weight:i.weight)}module_invoke_all("entity_post_build_content",b,a,c);var k=[];for(var g in e)if(e.hasOwnProperty(g)){var l=e[g];k.push(l)}k.sort(function(a,b){return a-b}),module_invoke_all("entity_pre_render_content",b,a,c);var m=[];for(var n in k)if(k.hasOwnProperty(n)){var o=k[n];for(var g in e)if(e.hasOwnProperty(g)&&"undefined"!=typeof b[g]&&("undefined"==typeof b[g].access||b[g].access)){var l=e[g];if(o==l&&m.indexOf(g)==-1){m.push(g),b.content+=drupalgap_entity_render_field(a,b,g,d[g],f[g]);break}}}module_invoke_all("entity_post_render_content",b,a,c),entity_caching_enabled(a,c)&&_entity_local_storage_save(a,b[entity_primary_key(a)],b)}catch(p){console.log("drupalgap_entity_render_content - "+p)}}function drupalgap_entity_render_field(a,b,c,d,e){try{var f="",g=e.module;if(!g){if(!d.widget.module){var h="drupalgap_entity_render_field - unable to locate the module for the field ("+c+")";return console.log(h),f}g=d.widget.module}var i=g+"_field_formatter_view";if(drupalgap_function_exists(i)){var j=window[i],k=null,l=language_default(),m=b.language;b[c]&&(b[c][l]?k=b[c][l]:b[c][m]?k=b[c][m]:b[c].und?(k=b[c].und,m="und"):k=b[c]);var n=j(a,b,d,drupalgap_field_info_field(c),m,k,e);for(var o in n)if(n.hasOwnProperty(o)){var p=n[o],q="";p.markup?q=p.markup:p.theme&&(q=theme(p.theme,p)),f+=q}}else console.log("WARNING: drupalgap_entity_render_field - "+i+"() does not exist! ("+c+")");if(""!=f&&"hidden"!=e.label){var r="

    "+d.label+"

    ";switch(r="
    "+r+"
    ",e.label){case"below":f+=r;break;case"above":default:f=r+f}}f='
    '+f+"
    ";var s={content:f};return module_invoke_all("entity_post_render_field",b,c,d,s),s.content!=f?s.content:f}catch(t){console.log("drupalgap_entity_render_field - "+t)}}function drupalgap_entity_build_from_form_state(a,b){try{var c={},d=language_default();for(var e in b.values)if(b.values.hasOwnProperty(e)){var f=b.values[e];if("undefined"==typeof a.elements[e].access||a.elements[e].access){var g=!1,h=!1,i=!1;a.elements[e].is_field&&(g=!0,h=a.elements[e].field_info_field.module,i=h+"_assemble_form_state_into_field",function_exists(i)||(i=!1));var j=drupalgap_field_key(e);if(j){var k=a.elements[e].field_info_field.cardinality;if(k==-1&&(k=1),"undefined"==typeof f[d][0])continue;c[e]={};var l=!0;"taxonomy_term_reference"==a.elements[e].type||"options_select"==a.elements[e].field_info_instance.widget.type?(l=!1,c[e][d]={}):c[e][d]=[];for(var m=0;m"}}catch(f){console.log("_drupalgap_entity_page_container - "+f)}}function _drupalgap_entity_page_container_id(a,b,c){return a+"_"+b+"_"+c+"_container"}function _drupalgap_entity_page_container_inject(a,b,c,d){try{var e=_drupalgap_entity_page_container_id(a,b,c);module_invoke_all("entity_view_alter",a,b,c,d),drupalgap.output=d,$("#"+e).html(drupalgap_render_page()).trigger("create"),_drupalgap_entity_page_add_css_class_names(a,b,d)}catch(f){console.log("_drupalgap_entity_page_container_inject - "+f)}}function _drupalgap_entity_page_add_css_class_names(a,b,c){try{var d=a,e=entity_get_bundle(a,c[a]);e&&(d+="-"+e),d+=" "+a.replace(/_/g,"-")+"-"+b,$("#"+drupalgap_get_page_id()).addClass(d)}catch(f){console.log("_drupalgap_entity_page_add_css_class_names - "+f)}}function entity_page_edit(a,b,c){try{var d={container:_drupalgap_entity_page_container(b,c,"edit")};return d}catch(e){console.log("entity_page_edit - "+e)}}function entity_page_edit_pageshow(a,b,c){try{entity_load(b,c,{success:function(d){_drupalgap_entity_page_container_inject(b,c,"edit",drupalgap_get_form(a,d))}})}catch(d){console.log("entity_page_edit_pageshow - "+d)}}function entity_primary_key_title(a){try{var b;switch(a){case"comment":b="subject";break;case"file":b="filename";break;case"node":b="title";break;case"taxonomy_term":b="name";break;case"taxonomy_vocabulary":b="name";break;case"user":b="name";break;default:console.log("entity_primary_key_title - unsupported entity type ("+a+")")}return b}catch(c){console.log("entity_primary_key_title - "+c)}}function entity_services_request_pre_postprocess_alter(a,b){try{if("retrieve"==a.resource&&in_array(a.service,entity_types())){if("undefined"!=typeof b.content)return;drupalgap_entity_render_content(a.service,b)}else if("comment"==a.service&&"index"==a.resource)for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];"undefined"==typeof d.content&&drupalgap_entity_render_content(a.service,b[c])}}catch(e){console.log("entity_services_request_pre_postprocess_alter - "+e)}}function drupalgap_field_info_field(a){try{return drupalgap.field_info_fields[a]}catch(b){console.log("drupalgap_field_info_field - "+b)}}function drupalgap_field_info_fields(){try{return drupalgap.field_info_fields}catch(a){console.log("drupalgap_field_info_fields - "+a)}}function drupalgap_field_info_instance(a,b,c){try{var d=drupalgap_field_info_instances(a,c);if(!d){var e="WARNING: drupalgap_field_info_instance - instance was null for entity ("+a+") bundle ("+c+") using field ("+b+")";return console.log(e),null}if(!d[b]){var e='WARNING: drupalgap_field_info_instance - "'+b+'" does not exist for entity ('+a+") bundle ("+c+")";return console.log(e),null}return d[b]}catch(f){console.log("drupalgap_field_info_instance - "+f)}}function drupalgap_field_info_instances(a,b){try{var c;return b?"undefined"!=typeof drupalgap.field_info_instances[a]&&(c=drupalgap.field_info_instances[a][b]):c="commerce_product"==a?drupalgap.field_info_instances[a]:drupalgap.field_info_instances[a][a],c}catch(d){console.log("drupalgap_field_info_instances - "+d)}}function drupalgap_field_info_instances_add_to_form(a,b,c,d){try{var e=drupalgap_field_info_instances(a,b),f=language_default();if(d&&d.language&&(f=d.language),e)for(var g in e)if(e.hasOwnProperty(g)){var h=e[g];if("user_register_form"!=c.id||h.settings.user_register_form){var i=drupalgap_field_info_field(g);if(i){c.elements[g]={type:i.type,title:h.label,required:h.required,description:h.description};var j=h.default_value,k=parseInt(i.cardinality);if(k==-1&&(k=1),d&&d[g]&&0!=d[g].length){if(!d[g][f]){if(!d[g].und)continue;f="und"}c.elements[g][f]||(c.elements[g][f]={});for(var l=0;ll?k.substring(0,l-3)+"...":k.substring(0,l)}h[i]={markup:k}}return h}catch(m){console.log("text_field_formatter_view - "+m)}}function text_field_widget_form(a,b,c,d,e,f,g,h){try{var i=null;switch(h.type){case"search":i="search";break;case"text":i="textfield";break;case"textarea":case"text_long":case"text_with_summary":case"text_textarea":i="textarea"}f[g].type=i,"undefined"!=typeof f[g].value&&"undefined"==typeof f[g].options.attributes.value&&(f[g].options.attributes.value=f[g].value)}catch(j){console.log("text_field_widget_form - "+j)}}function file_field_formatter_view(a,b,c,d,e,f,g){try{var h={};for(var i in f)if(f.hasOwnProperty(i)){var j=f[i];switch(g.type){case"file_table":h.file_table||(h.file_table={theme:"jqm_table",header:[{data:t("Attachment")},{data:t("Size")}],rows:[],attributes:{border:1}});var k=drupalgap_image_path(j.uri);"application/pdf"==j.filemime&&"undefined"!=typeof device&&"Android"==device.platform&&(k="https://docs.google.com/gview?embedded=true&url="+k),h.file_table.rows.push([l(j.filename,k,{InAppBrowser:!0}),Math.round(j.filesize/1e3).toFixed(2)+" KB"]);break;default:console.log("file_field_formatter_view() - unsupported display type: "+g.type)}}return h}catch(m){console.log("file_field_formatter_view - "+m)}}function file_entity_field_formatter_view(a,b,c,d,e,f,g){try{if("file_rendered"==g.type)return media_field_formatter_view(a,b,c,d,e,f,g);var h={};for(var i in f)if(f.hasOwnProperty(i)){f[i];switch(g.type){default:console.log("file_entity_field_formatter_view() - unsupported display type: "+g.type)}}return h}catch(j){console.log("file_entity_field_formatter_view - "+j)}}function image_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if(empty(f)&&d.settings.default_image&&(f=[{uri:d.settings.default_image_uri}]),!empty(f))for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k=empty(g.settings.image_style)?"image":"image_style",l={theme:k,alt:j.alt,title:j.title};"image_style"==k?(l.style_name=g.settings.image_style,l.path=j.uri):l.path=drupalgap_image_path(j.uri),h[i]=l}return h}catch(m){console.log("image_field_formatter_view - "+m)}}function image_field_widget_form(form,form_state,field,instance,langcode,items,delta,element){try{if(items[delta].type="hidden","user_profile_form"==form.id&&"picture"==element.name&&(field={field_name:"picture"}),"undefined"!=typeof items[delta].item&&items[delta].item.fid){items[delta].value=items[delta].item.fid;var path=drupalgap_image_path(items[delta].item.uri),html=theme("image",{path:path})+'
    '+l(items[delta].item.filename,path,{InAppBrowser:!0})+"
    ";return void items[delta].children.push({markup:html})}var button_text=t("Take Photo");items[delta].value&&(button_text=items[delta].value);var browse_button_text=t("Browse");items[delta].value2&&(browse_button_text=items[delta].value2);var item_id_base=items[delta].id.replace(/-/g,"_"),image_field_source=item_id_base+"_imagefield_source",imagefield_destination_type=item_id_base+"_imagefield_destination_type",imagefield_data=item_id_base+"_imagefield_data";eval("var "+image_field_source+" = null;"),eval("var "+imagefield_destination_type+" = null;"),eval("var "+imagefield_data+" = null;");var browse_button_id=items[delta].id+"-browse-button",html='";html+='",items[delta].children.push({markup:html})}catch(error){console.log("image_field_widget_form - "+error)}}function _image_field_widget_form_remove_image(){try{alert("_image_field_widget_form_remove_image")}catch(a){console.log("_image_field_widget_form_remove_image - "+a)}}function image_fields_present_on_entity_type(a,b){try{var c=[],d=drupalgap_field_info_instances(a,b);if(!d)return!1;for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];f.widget&&f.widget.type&&"image_image"==f.widget.type&&c.push(e)}return 0!=c.length&&c}catch(g){console.log("image_fields_present_on_entity_type - "+g)}}function image_form_alter(a,b,c){try{if(a.entity_type){var d=a.bundle,e=image_fields_present_on_entity_type(a.entity_type,d);if(e&&(a.image_fields=e,$.isArray(e)))for(var f in e)if(e.hasOwnProperty(f)){var g=e[f];image_phonegap_camera_options[g]={0:null}}}}catch(h){console.log("image_form_alter - "+h)}}function image_style_url(a,b){try{var c=Drupal.settings.site_path+Drupal.settings.base_path+b;return c.indexOf("public://")!=-1?c=c.replace("public://",Drupal.settings.file_public_path+"/styles/"+a+"/public/"):c.indexOf("private://")!=-1&&(c=c.replace("private://",Drupal.settings.file_private_path+"/styles/"+a+"/private/")),c}catch(d){console.log("image_style_url - "+d)}}function _image_phonegap_camera_getPicture_success(a){try{image_phonegap_camera_options[a.field_name]={0:a};var b=a.id+"-imagefield",c=document.getElementById(b);c.src="data:image/jpeg;base64,"+image_phonegap_camera_options[a.field_name][0].image,c.onload=function(){var a=this.width,d=this.height,e=a/drupalgap_max_width(),f=a/e,g=d/e;c.width=f,c.height=g,$("#"+b).show()}}catch(d){console.log("_image_phonegap_camera_getPicture_success - "+d)}}function _image_field_form_process(a,b,c){try{var d=language_default(),e=!1;for(var f in a.image_fields)if(a.image_fields.hasOwnProperty(f)){var g=a.image_fields[f];if(image_phonegap_camera_options[g][0]&&""==b.values[g][d][0]){var h=new Date,i=Drupal.user.uid+"_"+h.valueOf()+".jpg",j={file:{file:image_phonegap_camera_options[g][0].image,filename:i,filepath:"public://"+i}};empty(Drupal.settings.file_private_path)||(j.file.filepath="private://"+i),drupalgap.loader="saving",e=!0,file_save(j,{async:!1,success:function(e){try{var f=drupalgap_form_get_element_id(g,a.id);$("#"+f).val(e.fid),b.values[g][d][0]=e.fid,c.success&&c.success()}catch(h){console.log("_image_field_form_process - success - "+h)}}})}}!e&&c.success&&c.success()}catch(k){console.log("_image_field_form_validate - "+k)}}function image_assemble_form_state_into_field(a,b,c,d,e,f,g,h){try{return h.value="fid",c}catch(i){console.log("image_assemble_form_state_into_field - "+i)}}function menu_block_view(a,b){try{var c=drupalgap.menus[a],d=menu_container_id(a),e=null;b.attributes&&b.attributes["data-role"]&&(e=b.attributes["data-role"]);var f={};return"undefined"!=typeof c.options&&"undefined"!=typeof c.options.wrap&&c.options.wrap&&c.options.wrap_options&&c.options.wrap_options.attributes&&(f=c.options.wrap_options.attributes),f.id=d,"
    "+drupalgap_jqm_page_event_script_code({page_id:drupalgap_get_page_id(),jqm_page_event:"pageshow",jqm_page_event_callback:"menu_block_view_pageshow",jqm_page_event_args:JSON.stringify({menu_name:a,container_id:d,"data-role":e})},a)}catch(g){console.log("menu_block_view - "+g)}}function menu_block_view_pageshow(a){try{var b="",c=drupalgap_path_get(),d=a.menu_name;if("primary_local_tasks"==d){var e=drupalgap_router_path_get();if(drupalgap.menu_links[e]){var f=null;drupalgap.menu_links[e].parent&&(f=drupalgap.menu_links[e].parent);var g=null;drupalgap.menu_links[e].children?g=drupalgap.menu_links[e].children:f&&drupalgap.menu_links[f]&&drupalgap.menu_links[f].children&&(g=drupalgap.menu_links[f].children);var h=arg(),i=function(c){try{var d=[];if(g&&!empty(g))for(var f in g)if(g.hasOwnProperty(f)){var h=g[f];!drupalgap.menu_links[h]||"MENU_DEFAULT_LOCAL_TASK"!=drupalgap.menu_links[h].type&&"MENU_LOCAL_TASK"!=drupalgap.menu_links[h].type||drupalgap_menu_access(h,null,c)&&d.push(drupalgap.menu_links[h])}if(1==d.length&&"MENU_DEFAULT_LOCAL_TASK"==d[0].type)b="";else{var i=[];for(var f in d)if(d.hasOwnProperty(f)){var j=d[f],k=jQuery.extend(!0,{},j);k.options?k.options.attributes||(k.options.attributes={}):k.options={attributes:{}};var m=k.path;"MENU_DEFAULT_LOCAL_TASK"==k.type&&k.parent&&(m=k.parent,k.path=arg(null,k.parent).join("/")),m==e&&(k.options.attributes.class||(k.options.attributes.class=""),k.options.attributes.class+=" ui-btn ui-btn-active ui-state-persist "),i.push(l(k.title,drupalgap_place_args_in_path(k.path),k.options))}i.length>0&&(b=theme("item_list",{items:i}))}$("#"+a.container_id).html(b).trigger("create"),a["data-role"]&&"navbar"==a["data-role"]&&$("#"+a.container_id).navbar();var n=drupalgap.menus[a.menu_name];"undefined"==typeof n.options||"undefined"!=typeof n.options.wrap&&n.options.wrap||$("#"+a.container_id).children().unwrap()}catch(o){console.log("menu_block_view_pageshow - success - "+o)}},j=!1,k=!1;if(g)for(var m in g)if(g.hasOwnProperty(m)){var n=g[m];!drupalgap.menu_links[n]||"MENU_DEFAULT_LOCAL_TASK"!=drupalgap.menu_links[n].type&&"MENU_LOCAL_TASK"!=drupalgap.menu_links[n].type||(drupalgap_path_has_entity_arg(arg(null,n))&&(j=!0),"undefined"!=typeof drupalgap.menu_links[n].access_callback&&(k=!0))}if(j&&k){for(var o=!1,p=null,q=0;q0){var C=null;x.options&&x.options.attributes&&(C=drupalgap.menus[d].options.attributes),b=theme("item_list",{items:y,attributes:C})}}$("#"+a.container_id).html(b).trigger("create");var D=!1;x&&"undefined"!=typeof x.options&&"undefined"!=typeof x.options.wrap&&x.options.wrap&&(D=!0),D||$("#"+a.container_id).children().unwrap()}}catch(E){console.log("menu_block_view_pageshow - "+E)}}function menu_install(){try{var a=menu_list_system_menus();for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];menu_save(c)}}catch(d){console.log("menu_install - "+d)}}function menu_popup_get_default_options(){return{attributes:{"data-role":"listview"},wrap:!0,wrap_options:{attributes:{"data-role":"popup"}}}}function menu_region_link_get_data(a){try{var b=null;return b="undefined"==typeof a.region?a:a.region}catch(c){console.log("menu_region_link_get_data - "+c)}}function menu_region_link_get_side(a){try{var b="left";return a.indexOf("ui-btn-right")!=-1&&(b="right"),b}catch(c){console.log("menu_region_link_get_side - "+c); +}}function menu_save(a){try{drupalgap.menus[a.menu_name]=a}catch(b){console.log("menu_save - "+b)}}function menu_load(a){try{return"undefined"!=typeof drupalgap.menus[a]?drupalgap.menus[a]:null}catch(b){console.log("menu_load - "+b)}}function menu_container_id(a){try{var b=null;return b=arguments[1]?arguments[1]:drupalgap_get_page_id(),b+"_menu_"+a}catch(c){console.log("menu_container_id - "+c)}}function collection_list_page(a,b){try{var c={collection_list:{theme:"jqm_item_list",title:t("Collection")}},d=[],e=collection_load(a,b);if(e){for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h="mvc/item/"+a+"/"+b+"/"+f;d.push(l(g.name,h))}c.collection_list.items=d}return c}catch(i){console.log("collection_list_page - "+i)}}function collection_load(a,b){try{return JSON.parse(window.localStorage.getItem(mvc_get_collection_key("collection",a,b)))}catch(c){console.log("collection_load - "+c)}}function collection_save(a,b,c){try{window.localStorage.setItem(mvc_get_collection_key("collection",a,b),JSON.stringify(c))}catch(d){console.log("collection_save - "+d)}}function mvc_get_collection_key(a,b,c){return"mvc_"+a+"_"+b+"_"+c}function mvc_install(){try{for(var a=module_implements("mvc_model"),b=0;b"+t("Create Content")+""},node_type_listing:{theme:"jqm_item_list",title:t("Content Types"),attributes:{id:"node_type_listing_items"}}},b=[],c=Drupal.user.content_types_user_permissions;for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];e.create&&b.push(l(drupalgap.content_types_list[d].name,"node/add/"+d))}return a.node_type_listing.items=b,a}catch(f){console.log("node_add_page - "+f)}}function node_add_page_by_type(a){try{return drupalgap_get_form("node_edit",{type:a})}catch(b){console.log("node_add_page_by_type - "+b)}}function node_add_page_by_type_title(a,b){try{var c=t("Create")+" "+drupalgap.content_types_list[b].name;return a.call(null,c)}catch(d){console.log("node_add_page_by_type_title - "+d)}}function node_edit(a,b,c){try{return a.entity_type="node",a.bundle=c.type,drupalgap_entity_add_core_fields_to_form("node",c.type,a,c),drupalgap_field_info_instances_add_to_form("node",c.type,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.nid&&(a.buttons.delete=drupalgap_entity_edit_form_delete_button("node",c.nid)),a}catch(d){console.log("node_edit - "+d)}}function node_edit_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("node_edit_submit - "+d)}}function node_menu(){var a={node:{title:t("Content"),page_callback:"node_page",pageshow:"node_page_pageshow"},"node/add":{title:t("Add content"),page_callback:"node_add_page"},"node/add/%":{title:t("Add content"),title_callback:"node_add_page_by_type_title",title_arguments:[2],page_callback:"node_add_page_by_type",page_arguments:[2],options:{reloadPage:!0}},"node/%":{title:t("Node"),page_callback:"node_page_view",page_arguments:[1],pageshow:"node_page_view_pageshow",title_callback:"node_page_title",title_arguments:[1]},"node/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"node/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["node_edit","node",1],weight:0,type:"MENU_LOCAL_TASK",access_callback:"node_access",access_arguments:[1],options:{reloadPage:!0}}};return a}function node_page(){var a={create_content:{theme:"button_link",path:"node/add",text:t("Create Content")},node_listing:{theme:"jqm_item_list",title:t("Content List"),items:[],attributes:{id:"node_listing_items"}}};return a}function node_page_pageshow(){try{views_datasource_get_view_result("drupalgap/views_datasource/drupalgap_content",{success:function(a){var b=[];for(var c in a.nodes)if(a.nodes.hasOwnProperty(c)){var d=a.nodes[c];b.push(l(d.node.title,"node/"+d.node.nid))}drupalgap_item_list_populate("#node_listing_items",b)}})}catch(a){console.log("node_page_pageshow - "+a)}}function node_page_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("node",a,"view")};return b}drupalgap_error(t("No node id provided!"))}catch(c){console.log("node_page_view - "+c)}}function node_page_view_pageshow(a){try{node_load(a,{success:function(a){var b="node_page_view_alter_"+a.type,c=module_implements(b);if(c.length>0){if(c.length>1){var d="node_page_view_pageshow - WARNING - there is more than one module implementing hook_"+b+"(), we will use the first one: "+c[0];console.log(d)}var e=c[0]+"_"+b,f=window[e];return void f(a,{success:function(b){_drupalgap_entity_page_container_inject("node",a.nid,"view",b)}})}var g=function(b){_drupalgap_entity_page_container_inject("node",a.nid,"view",b),drupalgap.page.options.success&&drupalgap.page.options.success(a)},h=language_default(),i=a.title;a.title_field&&a.title_field[h]&&(i=a.title_field[h][0].safe_value);var j={theme:"node",node:a,title:{markup:i},content:{markup:a.content}};if("undefined"==typeof a.comment)g(j);else if(0!=a.comment){if(1==a.comment||2==a.comment){var k="";if(2==a.comment&&(k=drupalgap_get_form("comment_edit",{nid:a.nid},a)),0!=a.comment_count){var l={parameters:{nid:a.nid}};comment_index(l,{success:function(b){try{var c="";for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c+=theme("comment",{comment:e})}j.content.markup+=theme("comments",{node:a,comments:c}),2==a.comment&&user_access("post comments")&&(j.content.markup+=k),g(j)}catch(f){var h="node_page_view_pageshow - comment_index - "+f;console.log(h)}},error:function(a,b,c){drupalgap.page.options.error&&drupalgap.page.options.error(a,b,c)}})}else 2==a.comment&&(j.content.markup+=theme("comments",{node:a}),user_access("post comments")&&(j.content.markup+=k)),g(j)}}else j.content.markup+=theme("comments",{node:a}),g(j)},error:function(a,b,c){drupalgap.page.options.error&&drupalgap.page.options.error(a,b,c)}})}catch(b){console.log("node_page_view_pageshow - "+b)}}function node_page_title(a,b){try{var c="";node_load(b,{success:function(b){b&&b.title&&(c=b.title),a.call(null,c)}})}catch(d){console.log("node_page_title - "+d)}}function node_theme(){return{node:{template:"node"}}}function search_block_info(){try{var a={};return a.search={delta:"search",module:"search"},a}catch(b){console.log("search_block_info - "+b)}}function search_block_view(a,b){try{var c="";return"search"==a&&user_access("search content")&&(c=drupalgap_get_form("search_block_form")),c}catch(d){console.log("search_block_view - "+d)}}function search_menu(){try{var a={};return a["search/%/%"]={title:t("Search"),page_callback:"drupalgap_get_form",pageshow:"search_form_pageshow",page_arguments:["search_form"],access_arguments:["search content"]},a}catch(b){console.log("search_menu - "+b)}}function search_block_form(a,b){try{return a.elements.type={type:"hidden",default_value:"node"},a.elements.keys={type:"search",title:"",title_placeholder:!0,required:!0,default_value:""},a.options.attributes.onsubmit="_drupalgap_form_submit('"+a.id+"'); return false;",a}catch(c){console.log("search_block_form - "+c)}}function search_block_form_submit(a,b){try{var c=b.values.type,d=b.values.keys;drupalgap_goto("search/"+c+"/"+d)}catch(e){console.log("search_block_form_submit - "+e)}}function search_form(a,b){try{var c=arg(1),d=arg(2);return a.elements.type={type:"hidden",default_value:c?c:"node"},a.elements.keys={type:"textfield",title:t("Enter your keywords"),required:!0,default_value:d?d:""},a.elements.submit={type:"submit",value:t("Go"),options:{attributes:{"data-icon":"search"}}},a.suffix+=theme("jqm_item_list",{title:t("Search results"),items:[],options:{attributes:{id:"search_form_results"}}}),a}catch(e){console.log("search_form - "+e)}}function search_form_submit(a,b){try{var c=b.values.type,d=b.values.keys;switch(c){case"node":search_node(d,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=theme("search_result_node",d);b.push(e)}drupalgap_item_list_populate("#search_form_results",b)}});break;default:console.log("search_form_submit - unsupported type ("+c+")")}}catch(e){console.log("search_form_submit - "+e)}}function search_form_pageshow(a){try{var b=arg(1),c=arg(2);switch(b){case"node":search_node(c,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=theme("search_result_node",d);b.push(e)}drupalgap_item_list_populate("#search_form_results",b)}});break;default:console.log("search_form_pageshow - unsupported type ("+b+")")}}catch(d){console.log("search_form_pageshow - "+d)}}function search_node(a,b){try{b.method="GET",b.path="search_node/retrieve.json&keys="+encodeURIComponent(a),b.service="search_node",b.resource="retrieve",Drupal.services.call(b)}catch(c){console.log("search_node - "+c)}}function theme_search_result_node(a){try{return l("

    "+a.title+"

    "+a.snippet+"

    ","node/"+a.node.nid)}catch(b){console.log("theme_search_result_node - "+b)}}function drupalgap_services_get_entity_resource(a){try{return console.log("WARNING: drupalgap_services_get_entity_resource() is deprecated! Use services_get_resource_function_for_entity() instead."),drupalgap.services[a]?drupalgap.services[a]:null}catch(b){console.log("drupalgap_services_get_entity_resource - "+b)}}function services_get_resource_function_for_entity(a,b){var c=a+"_";switch(b){case"create":c+="save";break;case"retrieve":c+="load";break;case"update":c+="save";break;case"delete":c+="delete";break;default:c+="load"}return c}function drupalgap_service_resource_extract_results(a){try{if("system"==a.service&&"connect"==a.resource){a.data.user.permissions=[];var b=a.data.user_permissions;for(var c in b)a.data.user.permissions.push(b[c]);var d=a.data.content_types_list;for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];drupalgap.content_types_list[f.type]=f}a.data.user.content_types_user_permissions=a.data.content_types_user_permissions,drupalgap.site_settings=a.data.site_settings,"undefined"!=typeof a.data.date_formats&&(drupalgap.date_formats=a.data.date_formats),"undefined"!=typeof a.data.date_types&&(drupalgap.date_types=a.data.date_types)}}catch(g){console.log("drupalgap_service_resource_extract_results - "+g)}}function drupalgap_services_rss_extract_items(a){try{var b=null,c=$(a);if(c){var b=[];c.find("item").each(function(){var a=$(this),c={title:a.find("title").text(),link:a.find("link").text(),description:a.find("description").text(),pubDate:a.find("pubDate").text(),author:a.find("author").text()};b.push(c)})}return b}catch(d){console.log("drupalgap_services_rss_extract_items - "+d)}}function system_install(){for(var a in Drupal.cache_expiration.forms)Drupal.cache_expiration.forms.hasOwnProperty(a)&&drupalgap_form_local_storage_delete(a);Drupal.cache_expiration.forms={},window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}function system_block_info(){var a={main:{delta:"main",module:"system"},messages:{delta:"messages",module:"system"},logo:{delta:"logo",module:"system"},logout:{delta:"logout",module:"system"},title:{delta:"title",module:"system"},powered_by:{delta:"powered_by",module:"system"},help:{delta:"help",module:"system"}},b=menu_list_system_menus();for(var c in b)if(b.hasOwnProperty(c)){var d=b[c],e=d.menu_name;a[e]={name:e,delta:e,module:"menu"}}return a}function system_block_view(a){try{switch(a){case"main":return drupalgap_render_page();case"messages":var b="";if(0==drupalgap.messages.length)return b;for(var c in drupalgap.messages)if(drupalgap.messages.hasOwnProperty(c)){var d=drupalgap.messages[c];b+='
    '+d.message+"
    "}return drupalgap.messages=[],b;case"logo":return drupalgap.settings.logo?'":"";case"logout":return Drupal.user.uid?theme("logout"):"";case"title":var e=system_title_block_id(drupalgap_path_get());return'

    ';case"powered_by":return'

    '+t("Powered by")+": "+l("DrupalGap","http://www.drupalgap.org",{InAppBrowser:!0})+"

    ";case"help":return l("Help","http://www.drupalgap.org/support");default:return""}}catch(f){console.log("system_block_info - "+f)}}function system_menu(){var a={dashboard:{title:t("Dashboard"),page_callback:"system_dashboard_page"},error:{title:t("Error"),page_callback:"system_error_page"},offline:{title:t("Offline"),page_callback:"system_offline_page"},401:{title:"401 - "+t("Not Authorized"),page_callback:"system_401_page"},404:{title:"404 - "+t("Not Found"),page_callback:"system_404_page"}};return a._reload={title:t("Reloading")+"...",page_callback:"system_reload_page",pageshow:"system_reload_pageshow"},a}function system_401_page(a){return t("Sorry, you are not authorized to view this page.")}function system_404_page(a){return t("Sorry, the page you requested was not found.")}function system_reload_page(){try{var a=drupalgap_get_messages();return empty(a)||(_system_reload_messages=a.slice(),drupalgap_set_messages([])),""}catch(b){console.log("system_reload_page - "+b)}}function system_reload_pageshow(){try{if(_system_reload_messages&&!empty(_system_reload_messages)){for(var a=0;a<_system_reload_messages.length;a++)drupalgap_set_message(_system_reload_messages[a].message,_system_reload_messages[a].type);_system_reload_messages=null}drupalgap_loading_message_show()}catch(b){console.log("system_reload_pageshow - "+b)}}function system_drupalgap_goto_post_process(a){try{if("_reload"==a){if(!_system_reload_page)return;var a=""+_system_reload_page;_system_reload_page=null,drupalgap_loading_message_show(),drupalgap_goto(a,{reloadPage:!0})}}catch(b){console.log("system_drupalgap_goto_post_process - "+b)}}function system_dashboard_page(){try{var a={};return a.site_info={markup:'

    '+Drupal.settings.site_path+"

    "},a.welcome={markup:'

    '+t("Welcome to DrupalGap")+'

    '+t("The open source application development kit for Drupal!")+"

    "},drupalgap.settings.logo&&(a.logo={markup:"
    "+theme("image",{path:drupalgap.settings.logo})+"
    "}),a.get_started={theme:"button_link",text:t("Getting Started Guide"),path:"http://www.drupalgap.org/get-started",options:{InAppBrowser:!0}},a.support={theme:"button_link",text:t("Support"),path:"http://www.drupalgap.org/support",options:{InAppBrowser:!0}},a}catch(b){console.log("system_dashboard_page - "+b)}}function system_error_page(){var a={info:{markup:"

    "+t("An unexpected error has occurred!")+"

    "}};return a}function system_offline_page(){try{var a={message:{markup:"

    "+t("Failed Connection")+"

    "+t("Oops! We couldn't connect to")+":

    "+Drupal.settings.site_path+"

    "},try_again:{theme:"button",text:t("Try Again"),attributes:{onclick:"javascript:offline_try_again();"}},footer:{markup:"

    "+t("Check your device's network settings and try again.")+"

    "}};return a}catch(b){console.log("system_offline_page - "+b)}}function offline_try_again(){try{var a=drupalgap_check_connection();if(!drupalgap.online){var b=t("Sorry, no connection found!")+" ("+a+")";return drupalgap_alert(b,{title:"Offline"}),!1}system_connect({success:function(){drupalgap_goto("")}})}catch(c){console.log("offline_try_again - "+c)}}function system_regions_list(){var a=["header","content","footer"];return a}function system_settings_form(a,b){try{return a.elements.submit||(a.elements.submit={type:"submit",value:t("Save configuration")}),a.buttons.cancel||(a.buttons.cancel=drupalgap_form_cancel_button()),a.submit.push("system_settings_form_submit"),a}catch(c){console.log("system_settings_form - "+c)}}function system_settings_form_submit(a,b){try{if(b.values)for(var c in b.values)if(b.values.hasOwnProperty(c)){var d=b.values[c];variable_set(c,d)}}catch(e){console.log("system_settings_form_submit - "+e)}}function system_title_block_id(a){try{var b="drupalgap_page_title_"+drupalgap_get_page_id(a);return b}catch(c){console.log("system_title_block_id - "+c)}}function system_logout_block_access_callback(a){try{var b=arg(null,a.path);return!(!b||2!=b.length||"user"!=b[0]||b[1]!=Drupal.user.uid)}catch(c){console.log("system_logout_block_access_callback - "+c)}}function drupalgap_taxonomy_vocabularies_extract(a){try{var b=!1;if(a&&a.length>0){b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b[d.machine_name]=d}}return b}catch(e){console.log("drupalgap_taxonomy_vocabularies_extract - "+e)}}function taxonomy_field_formatter_view(a,b,c,d,e,f,g){try{var h={};if("string"==typeof f&&(f={0:{tid:f}}),"undefined"!=typeof f[language_default()]&&(f=f[language_default()]),!empty(f))for(var i in f)if(f.hasOwnProperty(i)){var j=f[i],k=j.tid;j.name&&(k=j.name);var l=null;switch(g.type){case"taxonomy_term_reference_link":l={theme:"button_link",text:k,path:"taxonomy/term/"+j.tid};break;case"taxonomy_term_reference_plain":l={markup:k};break;default:l={markup:k}}h[i]=l}return h}catch(m){console.log("taxonomy_field_formatter_view - "+m)}}function taxonomy_field_widget_form(a,b,c,d,e,f,g,h){try{f[g].type="hidden";var i=f[g].id+"-list",j={theme:"item_list",items:[],attributes:{id:i,"data-role":"listview","data-filter":"true","data-inset":"true","data-filter-placeholder":"..."}};f[g].children.push(j);var k=c.settings.allowed_values[0].vocabulary,l=taxonomy_vocabulary_machine_name_load(k),m=l.vid,n='";f[g].children.push({markup:n})}catch(o){console.log("taxonomy_field_widget_form - "+o)}}function _taxonomy_field_widget_form_autocomplete(a,b,c,d,e){try{var f=$(c),g=$(e.input),h=g.val(),i="";if(_taxonomy_field_widget_form_autocomplete_input=g,$(_taxonomy_field_widget_form_autocomplete_input).on("change",function(){$("#"+a).val($(this).val())}),f.html(""),h&&h.length>0){f.html('
  • '),f.listview("refresh");var j={fields:["tid","name"],parameters:{vid:b,name:"%"+h+"%"},parameters_op:{name:"like"}};taxonomy_term_index(j,{success:function(c){if(0!=c.length){for(var d in c)if(c.hasOwnProperty(d)){var e=c[d],g={tid:e.tid,vid:b,name:e.name,onclick:"_taxonomy_field_widget_form_click('"+a+"', '"+f.attr("id")+"', this)"};i+="
  • "+e.name+"
  • "}f.html(i),f.listview("refresh"),f.trigger("updatelayout")}}})}}catch(k){console.log("_taxonomy_field_widget_form_autocomplete - "+k)}}function _taxonomy_field_widget_form_click(a,b,c){try{var d=$(c).attr("name");$("#"+a).val(d),$(_taxonomy_field_widget_form_autocomplete_input).val($(c).attr("name")),$("#"+b).html("")}catch(e){console.log("_taxonomy_field_widget_form_click - "+e)}}function taxonomy_assemble_form_state_into_field(a,b,c,d,e,f,g,h){try{var i=null;switch(e.widget.type){case"taxonomy_autocomplete":h.use_wrapper=!1,i=c;break;case"options_select":i=c}return i}catch(j){console.log("taxonomy_assemble_form_state_into_field - "+j)}}function taxonomy_menu(){var a={"taxonomy/vocabularies":{title:t("Taxonomy"),page_callback:"taxonomy_vocabularies_page",pageshow:"taxonomy_vocabularies_pageshow"},"taxonomy/vocabulary/%":{title:t("Taxonomy vocabulary"),page_callback:"taxonomy_vocabulary_page",page_arguments:[2],pageshow:"taxonomy_vocabulary_pageshow"},"taxonomy/vocabulary/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"taxonomy/vocabulary/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["taxonomy_form_vocabulary","taxonomy_vocabulary",2],weight:0,type:"MENU_LOCAL_TASK",access_arguments:["administer taxonomy"],options:{reloadPage:!0}},"taxonomy/term/%":{title:t("Taxonomy term"),page_callback:"taxonomy_term_page",page_arguments:[2],pageshow:"taxonomy_term_pageshow"},"taxonomy/term/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"taxonomy/term/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["taxonomy_form_term","taxonomy_term",2],weight:0,type:"MENU_LOCAL_TASK",access_arguments:["administer taxonomy"],options:{reloadPage:!0}}};return a}function taxonomy_form_vocabulary(a,b,c){try{return a.entity_type="taxonomy_vocabulary",a.bundle=null,a.action="taxonomy/vocabularies",drupalgap_entity_add_core_fields_to_form("taxonomy_vocabulary",null,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.vid&&user_access("administer taxonomy")&&(a.buttons.delete=drupalgap_entity_edit_form_delete_button("taxonomy_vocabulary",c.vid)),a}catch(d){console.log("taxonomy_form_vocabulary - "+d)}}function taxonomy_form_vocabulary_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("taxonomy_form_vocabulary_submit - "+d)}}function taxonomy_form_term(a,b,c){try{return a.entity_type="taxonomy_term",a.bundle=null,a.action="taxonomy/vocabularies",drupalgap_entity_add_core_fields_to_form("taxonomy_term",null,a,c),a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel=drupalgap_form_cancel_button(),c&&c.tid&&user_access("administer taxonomy")&&(a.buttons.delete=drupalgap_entity_edit_form_delete_button("taxonomy_term",c.tid)),a}catch(d){console.log("taxonomy_form_term - "+d)}}function taxonomy_form_term_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("taxonomy_form_term_submit - "+d)}}function taxonomy_term_page(a){try{if(a){var b={container:_drupalgap_entity_page_container("taxonomy_term",a,"view"),taxonomy_term_node_listing:{theme:"jqm_item_list",items:[],attributes:{id:"taxonomy_term_node_listing_items_"+a}}};return b}console.log("taxonomy_term_pageshow - No term id provided!")}catch(c){console.log("taxonomy_term_pageshow - "+c)}}function taxonomy_term_pageshow(a){try{taxonomy_term_load(a,{success:function(a){var b=a.description?a.description:"",c={name:{markup:"

    "+a.name+"

    "},description:{markup:"

    "+b+"

    "}};_drupalgap_entity_page_container_inject("taxonomy_term",a.tid,"view",c),taxonomy_term_selectNodes(a.tid,{success:function(b){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c.push(l(e.title,"node/"+e.nid))}drupalgap_item_list_populate("#taxonomy_term_node_listing_items_"+a.tid,c)}})}})}catch(b){console.log("taxonomy_term_pageshow - "+b)}}function taxonomy_term_selectNodes(a,b){try{b.method="POST",b.path="taxonomy_term/selectNodes.json",b.service="taxonomy_term",b.resource="selectNodes",b.data=JSON.stringify({tid:a}),Drupal.services.call(b)}catch(c){console.log("taxonomy_term_selectNodes - "+c)}}function taxonomy_vocabularies_page(){var a={vocabulary_listing:{theme:"jqm_item_list",title:t("Vocabularies"),items:[],attributes:{id:"vocabulary_listing_items"}}};return a}function taxonomy_vocabularies_pageshow(){try{taxonomy_vocabulary_index(null,{success:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b.push(l(d.name,"taxonomy/vocabulary/"+d.vid))}drupalgap_item_list_populate("#vocabulary_listing_items",b)}})}catch(a){console.log("taxonomy_vocabularies_pageshow - "+a)}}function taxonomy_vocabulary_page(a){try{if(a){var b={container:_drupalgap_entity_page_container("taxonomy_vocabulary",a,"view"),taxonomy_term_listing:{theme:"jqm_item_list",title:t("Terms"),items:[],attributes:{id:"taxonomy_term_listing_items_"+a}}};return b}console.log("taxonomy_vocabulary_page - No vocabulary id provided!")}catch(c){console.log("taxonomy_vocabulary_page - "+c)}}function taxonomy_vocabulary_pageshow(a){try{taxonomy_vocabulary_load(a,{success:function(b){var c={name:{markup:"

    "+b.name+"

    "},description:{markup:"

    "+b.description+"

    "}};_drupalgap_entity_page_container_inject("taxonomy_vocabulary",b.vid,"view",c);var d={parameters:{vid:a}};taxonomy_term_index(d,{success:function(b){if(0!=b.length){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c.push(l(e.name,"taxonomy/term/"+e.tid))}drupalgap_item_list_populate("#taxonomy_term_listing_items_"+a,c)}}})}})}catch(b){console.log("taxonomy_vocabulary_pageshow - "+b)}}function taxonomy_vocabulary_get_vid_from_name(a){try{var b=taxonomy_vocabulary_machine_name_load(a);return!!b&&b.vid}catch(c){console.log("taxonomy_vocabulary_get_vid_from_name - "+c)}}function taxonomy_vocabulary_machine_name_load(a){try{return!(!drupalgap.taxonomy_vocabularies||!drupalgap.taxonomy_vocabularies[a])&&drupalgap.taxonomy_vocabularies[a]}catch(b){console.log("taxonomy_vocabulary_machine_name_load - "+b)}}function theme_taxonomy_term_reference(a){try{var b="",c=!0;"undefined"!=typeof a.render_input_element&&(c=a.render_input_element),c&&(a.attributes.type="hidden",b+="");var d=!1;"undefined"!=typeof a.required&&(d=a.required);var e=!1;"undefined"!=typeof a.exposed&&(e=a.exposed);var f=a.field_info_field.settings.allowed_values[0].vocabulary,g=taxonomy_vocabulary_machine_name_load(f),h=a.field_info_instance.widget.type;"options_select"==h&&(h="select");var i="theme_"+h,j=a.attributes.id+"-"+h;if(drupalgap_function_exists(i)){var k=window[i],l={attributes:{id:j,onchange:"_theme_taxonomy_term_reference_onchange(this, '"+a.attributes.id+"');"}},m=!1;if(_taxonomy_term_reference_terms[a.attributes.id]&&(m=!0,l.options=_taxonomy_term_reference_terms[a.attributes.id]),"undefined"!=typeof a.value?l.value=a.value:d||(e?l.value="All":l.value=""),b+=k.call(null,l),!m){var n={page_id:drupalgap_get_page_id(drupalgap_path_get()),jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_taxonomy_term_reference_load_items",jqm_page_event_args:JSON.stringify({taxonomy_vocabulary:g,element_id:a.attributes.id,widget_id:j,required:d,exposed:e})};b+=drupalgap_jqm_page_event_script_code(n)}}else console.log("WARNING: theme_taxonomy_term_reference() - unsupported widget type! ("+h+")");return b}catch(o){console.log("theme_taxonomy_term_reference - "+o)}}function _theme_taxonomy_term_reference_load_items(a){try{var b={parameters:{vid:a.taxonomy_vocabulary.vid},options:{orderby:{weight:"asc",name:"asc"}}};taxonomy_term_index(b,{success:function(b){if(0!=b.length){_taxonomy_term_reference_terms[a.element_id]={};var c=$("#"+a.widget_id);if(!a.required){var d=null;a.exposed?(d='",_taxonomy_term_reference_terms[a.element_id].All="- Any -"):(d='",_taxonomy_term_reference_terms[a.element_id][""]="- None -"),$(c).append(d)}for(var e in b)if(b.hasOwnProperty(e)){var f=b[e],d='";$(c).append(d),_taxonomy_term_reference_terms[a.element_id][f.tid]=f.name}$(c).selectmenu("refresh",!0)}}})}catch(c){console.log("_theme_taxonomy_term_reference_load_items - "+c)}}function _theme_taxonomy_term_reference_onchange(a,b){try{$("#"+b).val($(a).val())}catch(c){console.log("_theme_taxonomy_term_reference_onchange - "+c)}}function taxonomy_views_exposed_filter(a,b,c,d,e){try{if("textfield"==d.options.type)c.type="autocomplete",c.remote=!0,c.custom=!0,c.handler="index",c.entity_type="taxonomy_term","undefined"!=typeof d.options.vocabulary&&(c.vid=taxonomy_vocabulary_get_vid_from_name(d.options.vocabulary)),c.value="name",c.label="name",c.filter="name";else{c.type="hidden";for(var f in e.settings.allowed_values)if(e.settings.allowed_values.hasOwnProperty(f)){var g=(e.settings.allowed_values[f],{required:c.required,render_input_element:!1,attributes:{id:c.options.attributes.id},field_info_field:e,field_info_instance:{widget:{type:"options_select"}},exposed:!0});empty(d.value)||(g.value=parseInt(d.value[0]),g.attributes.value=g.value);var h="";empty(c.title)||(h+=theme("form_element_label",{element:c})),h+=theme("taxonomy_term_reference",g),c.children.push({markup:h})}}}catch(i){console.log("taxonomy_views_exposed_filter - "+i)}}function user_login_form(a,b){try{return a.entity_type="user",a.bundle=null,a.elements.name={type:"textfield",title:t("Username"),title_placeholder:!0,required:!0,attributes:{autocapitalize:"none"}},a.elements.pass={type:"password",title:t("Password"),title_placeholder:!0,required:!0,attributes:{onkeypress:"drupalgap_form_onkeypress('"+a.id+"')"}},a.elements.submit={type:"submit",value:t("Login")},user_register_access()&&(a.buttons.create_new_account={title:t("Create new account"),attributes:{onclick:"drupalgap_goto('user/register')"}}),a.buttons.forgot_password={title:t("Request new password"),attributes:{onclick:"drupalgap_goto('user/password')"}},a}catch(c){console.log("user_login_form - "+c)}}function user_login_form_submit(a,b){try{user_login(b.values.name,b.values.pass,{success:function(b){drupalgap_goto("undefined"!=typeof a.action?a.action:drupalgap.settings.front,{reloadPage:!0})}})}catch(c){console.log("user_login_form_submit - "+c)}}function user_register_form(a,b){try{a.entity_type="user",a.bundle=null;var c=t("Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.");return a.elements.name={type:"textfield",title:t("Username"),title_placeholder:!0,required:!0,description:c},a.elements.mail={type:"email",title:t("E-mail address"),title_placeholder:!0,required:!0},drupalgap.site_settings.user_email_verification||(a.elements.conf_mail={type:"email",title:t("Confirm e-mail address"), +title_placeholder:!0,required:!0},a.elements.pass={type:"password",title:t("Password"),title_placeholder:!0,required:!0},a.elements.pass2={type:"password",title:t("Confirm password"),title_placeholder:!0,required:!0}),drupalgap_field_info_instances_add_to_form("user",null,a,null),a.user_register={user_mail_register_no_approval_required_body:t("Registration complete!"),user_mail_register_pending_approval_required_body:t("Registration complete, waiting for administrator approval."),user_mail_register_email_verification_body:t("Registration complete, check your e-mail inbox to verify the account.")},a.auto_user_login=!0,a.elements.submit={type:"submit",value:t("Create new account")},a}catch(d){console.log("user_register_form - "+d)}}function user_register_form_validate(a,b){try{drupalgap.site_settings.user_email_verification||b.values.pass==b.values.pass2||drupalgap_form_set_error("pass",t("Passwords do not match!")),empty(b.values.mail)||empty(b.values.conf_mail)||b.values.mail==b.values.conf_mail||drupalgap_form_set_error("mail",t("E-mail addresses do not match!"))}catch(c){console.log("user_register_form_validate - "+c)}}function user_register_form_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);user_register(c,{success:function(b){var d=a.user_register,e={title:t("Registered")},f="undefined"!=typeof a.action?a.action:drupalgap.settings.front;drupalgap.site_settings.user_email_verification?(drupalgap_alert(d.user_mail_register_email_verification_body,e),drupalgap_goto(f)):"2"==drupalgap.site_settings.user_register?(drupalgap_alert(d.user_mail_register_pending_approval_required_body,e),drupalgap_goto(f)):(drupalgap_alert(d.user_mail_register_no_approval_required_body,e),a.auto_user_login?user_login(c.name,c.pass,{success:function(a){drupalgap_goto("")}}):drupalgap_goto(f))},error:function(c,d,e){var f=_drupalgap_form_submit_response_errors(a,b,c,d,e);f&&drupalgap_alert(f)}})}catch(d){console.log("user_register_form_submit - "+d)}}function user_profile_form(a,b,c){try{return a.entity_type="user",a.bundle=null,drupalgap_entity_add_core_fields_to_form("user",null,a,c),drupalgap_field_info_instances_add_to_form("user",null,a,c),user_access("change own username")||(a.elements.name.access=!1,a.elements.name.required=!1),0==drupalgap.site_settings.user_pictures&&delete a.elements.picture,Drupal.user.uid==c.uid&&(a.elements.current_pass={title:t("Current password"),type:"password",description:t("Enter your current password to change the E-mail address or Password.")}),a.elements.pass_pass1={title:t("Password"),type:"password"},a.elements.pass_pass2={title:t("Confirm password"),type:"password",description:t("To change the current user password, enter the new password in both fields.")},a.elements.submit={type:"submit",value:t("Save")},a.buttons.cancel={title:t("Cancel"),attributes:{onclick:"javascript:drupalgap_back();"}},a}catch(d){console.log("user_profile_form - "+d)}}function user_profile_form_validate(a,b){try{empty(b.values.current_pass)?!empty(b.values.current_pass)||empty(b.values.pass_pass1)||empty(b.values.pass_pass2)||drupalgap_form_set_error("current_pass",t("You must enter your current password to change your password.")):empty(b.values.pass_pass1)||empty(b.values.pass_pass2)||b.values.pass_pass1==b.values.pass_pass2||drupalgap_form_set_error("pass_pass1",t("Passwords do not match."))}catch(c){console.log("user_profile_form_validate - "+c)}}function user_profile_form_submit(a,b){try{var c=drupalgap_entity_build_from_form_state(a,b);!c.current_pass||empty(c.pass_pass1)||empty(c.pass_pass2)||(c.pass=c.pass_pass1,delete c.pass_pass1,delete c.pass_pass2),drupalgap_entity_form_submit(a,b,c)}catch(d){console.log("user_profile_form_submit - "+d)}}function user_pass_form(a,b){try{return a.elements.name={type:"textfield",title:t("Username or e-mail address"),required:!0,attributes:{onkeypress:"drupalgap_form_onkeypress('"+a.id+"')"}},a.elements.submit={type:"submit",value:t("E-mail new password")},a}catch(c){console.log("user_pass_form - "+c)}}function user_pass_form_submit(a,b){try{user_request_new_password(b.values.name,{success:function(a){if(a[0]){var b=t("Further instructions have been sent to your e-mail address.");drupalgap_set_message(b)}else{var b=t("There was a problem sending an e-mail to your address.");drupalgap_set_message(b,"warning")}drupalgap_goto("user/login")}})}catch(c){console.log("user_pass_form_submit - "+c)}}function user_access(a){try{var b;if(b=arguments[1]?arguments[1]:Drupal.user,1==b.uid)return!0;var c=!1;for(var d in b.permissions)if(b.permissions.hasOwnProperty(d)){var e=b.permissions[d];if(e.permission==a){c=!0;break}}return c}catch(f){console.log("user_access - "+f)}}function user_edit_access(a){try{return!(Drupal.user.uid!=a.uid&&!user_access("administer users"))}catch(b){console.log("user_edit_access - "+b)}}function user_listing(){var a={};return a.user_list={theme:"view",format:"ul",path:"drupalgap/views_datasource/drupalgap_users",row_callback:"user_listing_row",empty_callback:"user_listing_empty",attributes:{id:"user_listing_"+user_password()}},a}function user_listing_row(a,b){try{return l(t(b.name),"user/"+b.uid)}catch(c){console.log("user_listing_row - "+c)}}function user_listing_empty(a){return t("Sorry, no users were found.")}function user_logout_callback(){return"

    "+t("Logging out")+"...

    "}function user_logout_pageshow(){try{user_logout({success:function(a){drupalgap_remove_pages_from_dom(),drupalgap_goto(drupalgap.settings.front,{reloadPage:!0})}})}catch(a){console.log("user_logout_pagechange - "+a)}}function user_menu(){var a={user:{page_callback:"user_page"},"user/login":{title:t("Login"),page_callback:"drupalgap_get_form",page_arguments:["user_login_form"],options:{reloadPage:!0}},"user/logout":{title:t("Logout"),page_callback:"user_logout_callback",pageshow:"user_logout_pageshow",options:{reloadPage:!0}},"user/register":{title:t("Register"),page_callback:"drupalgap_get_form",page_arguments:["user_register_form"],access_callback:"user_register_access",options:{reloadPage:!0}},"user/%":{title:t("My account"),title_callback:"user_view_title",title_arguments:[1],page_callback:"user_view",pageshow:"user_view_pageshow",page_arguments:[1]},"user/%/view":{title:t("View"),type:"MENU_DEFAULT_LOCAL_TASK",weight:-10},"user/%/edit":{title:t("Edit"),page_callback:"entity_page_edit",pageshow:"entity_page_edit_pageshow",page_arguments:["user_profile_form","user",1],access_callback:"user_edit_access",access_arguments:[1],weight:0,type:"MENU_LOCAL_TASK",options:{reloadPage:!0}}};return a["user-listing"]={title:t("Users"),page_callback:"user_listing",access_arguments:["access user profiles"]},a["user/password"]={title:t("Request new password"),page_callback:"drupalgap_get_form",page_arguments:["user_pass_form"]},a}function user_page(){return"user_page()"}function user_register_access(){try{switch(drupalgap.site_settings.user_register.toString()){case"0":return!1;case"1":case"2":return!0}}catch(a){console.log("user_register_access - "+a)}}function user_services_postprocess(a,b){try{if("user"!=a.service)return;var c=["login","logout","register"];if(!in_array(a.resource,c)||"user"!=arg(0)&&!in_array(arg(1),c))return;if(!b.responseText)return;var d=JSON.parse(b.responseText);if($.isArray(d)){var e="";for(var f in d)if(d.hasOwnProperty(f)){var g=d[f];e+=t(g)+"\n"}""!=e&&drupalgap_alert(e)}}catch(h){console.log("user_services_postprocess - "+h)}}function user_theme(){return{user_picture:{template:"user-picture"},user_profile:{template:"user-profile"}}}function user_view(a){try{if(a){var b={container:_drupalgap_entity_page_container("user",a,"view")};return b}console.log("user_view - No user id provided!")}catch(c){console.log("user_view - "+c)}}function user_view_pageshow(a){try{user_load(a,{success:function(a){var b="full",c=null;if(arguments[1]&&(b=arguments[1]),arguments[2]&&(c=arguments[2]),c||(c=language_default()),a){var d={theme:"user_profile",account:a,view_mode:b,language:c,name:{markup:a.name},created:{markup:'"}};"undefined"!=typeof a.content&&(d.content={markup:a.content}),a.picture&&a.picture.fid&&(d.picture={theme:"image",path:image_style_url(drupalgap.site_settings.user_picture_style,a.picture.uri)}),_drupalgap_entity_page_container_inject("user",a.uid,"view",d)}}})}catch(b){console.log("user_view_pageshow - "+b)}}function user_view_title(a,b){try{user_load(b,{success:function(b){a.call(null,b.name)}})}catch(c){console.log("user_view_title - "+c)}}function drupalgap_user_has_role(a){try{var b=!1,c=null;c=arguments[1]?arguments[1]:Drupal.user;for(var d in c.roles)if(c.roles.hasOwnProperty(d)){var e=c.roles[d];if(a==e){b=!0;break}}return b}catch(f){console.log("drupalgap_user_has_role - "+f)}}function views_embedded_view_get(a){try{if(!_views_embedded_views[a])return null;var b=arguments[1];return b?_views_embedded_views[a][b]:_views_embedded_views[a]}catch(c){console.log("views_embedded_view_get - "+c)}}function views_embedded_view_set(a,b,c){try{_views_embedded_views[a]||(_views_embedded_views[a]={}),_views_embedded_views[a][b]=c}catch(d){console.log("views_embedded_view_set - "+d)}}function views_embedded_view_delete(a){try{if(!_views_embedded_views[a])return!1;var b=arguments[1];return b?delete _views_embedded_views[a][b]:delete _views_embedded_views[a],!0}catch(c){console.log("views_embedded_view_delete - "+c)}}function views_datasource_get_view_result(a,b){try{if(a.indexOf("?")!=-1){var c=a.replace("?","&");a=c}if(b.reset)window.localStorage.removeItem(a);else if(Drupal.settings.cache.views.enabled){var d=window.localStorage.getItem(a);if(d)if(d=JSON.parse(d),"undefined"!=typeof d.expiration&&0!=d.expiration&&time()>d.expiration)window.localStorage.removeItem(a);else if(b.success)return void b.success(d)}Drupal.services.call({endpoint:"",service:"views_datasource",resource:"",method:"GET",path:a,success:function(c){try{if(b.success){if(c.path=a,Drupal.settings.cache.views.enabled){var d=time()+Drupal.settings.cache.views.expiration;0==Drupal.settings.cache.views.expiration&&(d=0),c.expiration=d,window.localStorage.setItem(a,JSON.stringify(c))}b.success(c)}}catch(e){console.log("views_datasource_get_view_result - success - "+e)}},error:function(a,c,d){try{b.error&&b.error(a,c,d)}catch(e){console.log("views_datasource_get_view_result - error - "+e)}}})}catch(e){console.log("views_datasource_get_view_result - "+e)}}function views_exposed_form(a,b,c){try{a.variables=c.variables;for(var d in c.filter)if(c.filter.hasOwnProperty(d)){var e=c.filter[d],f=null,g=null;f=e.options.expose.identifier,g={id:f,type:e.options.group_info.widget,title:e.options.expose.label,required:e.options.expose.required,options:{attributes:{id:drupalgap_form_get_element_id(f,a.id)}},views_field:d,filter:e,children:[]};var h=e.definition.field_name;if(h){var i=drupalgap_field_info_field(h),j=i.module,k=j+"_views_exposed_filter";if(!drupalgap_function_exists(k)){dpm("WARNING: views_exposed_form() - "+k+"() must be created to assemble the "+i.type+" filter used by "+h);continue}window[k](a,b,g,e,i)}else if("views_handler_filter_term_node_tid"==e.definition.handler){g.type="autocomplete";var l={remote:!0,custom:!0,handler:"index",entity_type:"taxonomy_term",value:"name",label:"name",filter:"name"};""!=e.options.vocabulary&&(l.vid=taxonomy_vocabulary_get_vid_from_name(e.options.vocabulary)),$.extend(g,l,!0)}else{if("select"!=g.type){dpm('WARNING: views_exposed_form() - I do not know how to handle the exposed filter for the "'+d+'" field'),console.log(e);continue}list_views_exposed_filter(a,b,g,e,null)}f&&(a.elements[f]=g)}return a.elements.submit={type:"submit",value:c.exposed_data.submit},c.exposed_data.reset&&views_embedded_view_get(a.variables.page_id,"exposed_filter_reset")&&(a.buttons.reset={title:c.exposed_data.reset,attributes:{id:a.id+"-reset",onclick:"views_exposed_form_reset()"}}),a}catch(m){console.log("views_exposed_form - "+m)}}function views_exposed_form_submit(a,b){try{var c=a.variables.page_id,d="";for(var e in b.values)if(b.values.hasOwnProperty(e)){var f=b.values[e];empty(f)||(d+=e+"="+encodeURIComponent(f)+"&")}empty(d)||(d=d.substr(0,d.length-1));var g=views_embedded_view_get(c,"exposed_filter_query");if(g){if(g==d)return;a.variables.path.indexOf("&"+g)!=-1&&(a.variables.path=a.variables.path.replace("&"+g,""))}views_embedded_view_set(c,"exposed_filter_query",d),views_embedded_view_set(c,"exposed_filter_reset",!0),a.variables.path+="&"+d,a.variables.page=0,views_embedded_view_set(c,"exposed_filter_submit_variables",a.variables),_theme_view(a.variables)}catch(h){console.log("views_exposed_form_submit - "+h)}}function views_exposed_form_reset(){try{var a=drupalgap_get_page_id(),b=views_embedded_view_get(a,"exposed_filter_submit_variables");b.path=b.path.replace("&"+views_embedded_view_get(a,"exposed_filter_query"),""),b.page=0,views_embedded_view_set(a,"exposed_filter_submit_variables",b),views_embedded_view_set(a,"exposed_filter_reset",!1),views_embedded_view_set(a,"exposed_filter_query",null),_theme_view(b)}catch(c){console.log("views_exposed_form_reset - "+c)}}function theme_view(a){try{a.attributes.id||(console.log("WARNING: theme_view() - No id specified on attributes! A random id will be generated instead."),a.attributes.id="views-view--"+user_password()),in_array(a.attributes.id,drupalgap.views.ids)?$("#"+a.attributes.id)?dpm("WARNING: theme_view() - this id already exists in the DOM: #"+a.attributes.id+" - the view will be rendered into the first container that is located in the DOM - if you are re-using this same view, it is recommended to append a unique identifier (e.g. an entity id) to your views id, that way you can re-use the same view across multiple pages."):drupalgap.views.ids.splice($.inArray(a.attributes.id,drupalgap.views.ids),1):drupalgap.views.ids.push(a.attributes.id);var b=drupalgap_get_page_id();a.page_id=b,a.attributes.class+="view ";var c="
    ",d={page_id:b,jqm_page_event:"pageshow",jqm_page_event_callback:"_theme_view",jqm_page_event_args:JSON.stringify(a)};return c+=drupalgap_jqm_page_event_script_code(d,a.attributes.id)}catch(e){console.log("theme_view - "+e)}}function _theme_view(a){try{var b=0;a.page&&(b=a.page);var c=$.extend({},{success:function(b){try{$("#"+a.attributes.id).html(b)}catch(c){console.log("_theme_view - success - "+c)}}},a);views_embed_view(a.path+"&page="+b,c)}catch(d){console.log("_theme_view - "+d)}}function views_embed_view(a,b){try{views_datasource_get_view_result(a,{success:function(a){try{if(views_embedded_view_set(b.page_id,"results",a),views_embedded_view_set(b.page_id,"options",b),!b.success)return;if(b.results=a,0!=a.view.count||0==a.view.count&&b.empty_callback)b.success(theme("views_view",b));else{var c=document.getElementById(b.attributes.id);c.parentElement.removeChild(c)}}catch(d){console.log("views_embed_view - success - "+d)}},error:function(a,c,d){try{views_embedded_view_set(b.page_id,"results",null),b.error&&b.error(a,c,d)}catch(e){console.log("views_embed_view - error - "+e)}}})}catch(c){console.log("views_embed_view - "+c)}}function theme_views_view(a){try{var b="",c=views_embedded_view_get(a.page_id,"results");if(!c)return b;a.format||(a.format="unformatted_list");var d=c.view.root,e=c.view.child;if(a.title){var f=a.title_attributes?a.title_attributes:null;b+=theme("header",{text:a.title,attributes:f}),"unformatted"!=a.format&&(b+=theme("views_spacer",null))}var g="";"undefined"==typeof c.view.exposed_data||"undefined"!=typeof a.exposed_filters&&!a.exposed_filters||(g=drupalgap_get_form("views_exposed_form",{exposed_data:c.view.exposed_data,exposed_raw_input:c.view.exposed_raw_input,filter:c.view.filter,variables:a}));var h="#"+a.page_id+" #"+a.attributes.id;views_embedded_view_set(a.page_id,"selector",h);var i=module_exists("views_litepager");if(0==c.view.count&&!i||i&&null==c.view.pages&&0==c.view.count){if($(h).hide(),setTimeout(function(){$(h).trigger("create").show("fast")},100),a.empty_callback&&function_exists(a.empty_callback)){var j=window[a.empty_callback];return g+drupalgap_render(j(c.view,a))}return b+g}b+=g;var k=drupalgap_views_get_result_formats(a),l=""+k.open+drupalgap_views_render_rows(a,c,d,e,k.open_row,k.close_row)+k.close,m="";c.view.pages&&(m=theme("pager",a));var n="top";return"undefined"!=typeof a.pager_pos&&(n=a.pager_pos),module_exists("views_infinite_scroll")&&views_infinite_scroll_ok()?b+=l:"top"==n?(b+=m,empty(m)||(b+=theme("views_spacer",null)),b+=l):"bottom"==n?(b+=l,empty(m)||(b+=theme("views_spacer",null)),b+=m):console.log("WARNING: theme_views_view - unsupported pager_pos ("+n+")"),$(h).hide(),setTimeout(function(){$(h).trigger("create").show("fast")},100),b}catch(o){console.log("theme_views_view - "+o)}}function theme_views_spacer(a){return'

     

    '}function theme_pager(a){try{var b="",c=a.results.view,d=c.page,e=c.pages,f=c.count,d=(c.limit,c.page),g=module_exists("views_litepager");if(0==f&&!g||g&&null==a.results.view.pages)return b;var h=[];if(0!=d&&h.push(theme("pager_previous",a)),(d!=e-1&&!g||g)&&h.push(theme("pager_next",a)),h.length>0){var i="theme_pager_"+user_password(),j={id:i,class:"pager","data-role":"navbar"};b+="
    "+theme("item_list",{items:h})+'
    '}return b}catch(k){console.log("theme_pager - "+k)}}function theme_pager_link(a,b){try{b.attributes||(b.attributes={}),b.attributes.href="#";var c=drupalgap_attributes(b.attributes);return""+b.text+""}catch(d){console.log("theme_pager_link - "+d)}}function _theme_pager_link_onclick(a){try{var b=$.extend({},{},a);b.results&&delete b.results;var c="_theme_pager_link_click("+JSON.stringify(b)+")";return c}catch(d){console.log("_theme_pager_link_onclick - "+d)}}function _theme_pager_link_click(a){try{_theme_view(a)}catch(b){console.log("_theme_pager_link_click - "+b)}}function theme_pager_next(a){try{var b;a.page=parseInt(a.results.view.page)+1;var c={text:"»",attributes:{class:"pager_next"}};return b=theme_pager_link(a,c)}catch(d){console.log("theme_pager_next - "+d)}}function theme_pager_previous(a){try{var b;a.page=parseInt(a.results.view.page)-1;var c={text:"«",attributes:{class:"pager_previous"}};return b=theme_pager_link(a,c)}catch(d){console.log("theme_pager_previous - "+d)}}function drupalgap_views_get_result_formats(a){try{var b={};a.format||(a.format="unformatted_list");var c="",d="",e="",f="",g={};switch("undefined"!=typeof a.format_attributes&&(g=$.extend(!0,g,a.format_attributes)),"undefined"==typeof g.class&&(g.class=""),g.class+=" views-results ",a.format){case"grid":var h=a.columns?a.columns:2,i=null;h<2&&(i=h+" columns is not enough, a minimum of 2 is needed",h=2),h>5&&(i=h+" columns is too many enough, a maximum of 5 is allowed",h=5),a.columns=h,i&&console.log("drupalgap_views_get_result_formats - "+i);var j=null;switch(h){case 2:j="a";break;case 3:j="b";break;case 4:j="c";break;case 5:j="d"}g.class||(g.class=""),g.class+=" ui-grid-"+j+" ",c="
    ",d="
    ",e='
    ',f="
    ";break;case"ul":"undefined"==typeof g["data-role"]&&(g["data-role"]="listview"),c="
      ",d="
    ",e="
  • ",f="
  • ";break;case"ol":"undefined"==typeof g["data-role"]&&(g["data-role"]="listview"),c="
      ",d="
    ",e="
  • ",f="
  • ";break;case"table":case"jqm_table":"jqm_table"==a.format&&("undefined"==typeof g["data-role"]&&(g["data-role"]="table"),"undefined"==typeof g["data-mode"]&&(g["data-mode"]="reflow"),console.log("WARNING: theme_views_view() - jqm_table not supported, yet")),c="",d="
    ",e="",f="";break;case"unformatted_list":default:"undefined"==typeof g.class&&(g.class=""),g.class+=" views-rows",c="
    ",d="
    ",e="",f=""}return b.open=c,b.close=d,b.open_row=e,b.close_row=f,b}catch(k){console.log("drupalgap_views_get_result_formats - "+k)}}function drupalgap_views_render_rows(a,b,c,d,e,f){try{var g="";b[c].length;for(var h in b[c])if(b[c].hasOwnProperty(h)){var i=b[c][h],j=i[d];j._position=parseInt(h);var k="";if(a.row_callback&&function_exists(a.row_callback)?(row_callback=window[a.row_callback],k=row_callback(b.view,j,a)):k=JSON.stringify(j),"grid"==a.format){var l=null;switch(j._position%a.columns){case 0:l="ui-block-a";break;case 1:l="ui-block-b";break;case 2:l="ui-block-c";break;case 3:l="ui-block-d";break;case 4:l="ui-block-e"}var m=JSON.parse(JSON.stringify(e));l&&(m=m.replace("ui-block",l)),g+=m+k+f}else g+=e+k+f}return g}catch(n){console.log("drupalgap_views_render_rows - "+n)}}var drupalgap=drupalgap||drupalgap_init(),_dg_GET=_dg_GET||{},_theme_autocomplete_input_selector={},_theme_autocomplete_remote={},_theme_autocomplete_variables={},_theme_autocomplete_success_handlers={},_drupalgap_goto_query_string=null;$(window).on("navigate",function(a,b){if(!drupalgap.back&&"web-app"==drupalgap.settings.mode){var c=b.state.direction;if("back"==c&&drupalgap.back_path.length>0){drupalgap.back=!0;var d=drupalgap_path_get();drupalgap_path_set(drupalgap.back_path.pop());var e=drupalgap_path_get();drupalgap_router_path_set(drupalgap_get_menu_link_router_path(e)),module_invoke_all("drupalgap_back",d,e)}}}),$(document).on("pagebeforechange",function(a,b){try{if(drupalgap&&drupalgap.back)return void(drupalgap.back=!1);if(drupalgap_jqm_active_page_url()==drupalgap_get_page_id(drupalgap_path_get()))return;"string"==typeof b.toPage&&(drupalgap&&!drupalgap.page.process?drupalgap.page.process=!0:drupalgap&&(template_preprocess_page(drupalgap.page.variables),template_process_page(drupalgap.page.variables)))}catch(c){console.log("pagebeforechange - "+c)}});var image_phonegap_camera_options={},_system_reload_page=null,_system_reload_messages=null,_taxonomy_term_reference_terms={},_taxonomy_field_widget_form_autocomplete_input=null,_views_embedded_views={};drupalgap.views_datasource={options:{},call:function(a){try{var b="WARNING: drupalgap.views_datasource has been deprecated! Use views_datasource_get_view_result() instead.";console.log(b),views_datasource_get_view_result(a.path,a)}catch(c){console.log("drupalgap.views_datasource - "+c)}}}; \ No newline at end of file