diff --git a/bin/drupalgap-7.0.1.min.js b/bin/drupalgap-7.0.1.min.js deleted file mode 100644 index 73807002..00000000 --- a/bin/drupalgap-7.0.1.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! drupalgap 2016-04-07 */ -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:[],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{var b='"'+a.jqm_page_event+'", "'+a.jqm_page_event_callback+'", '+a.jqm_page_event_args;arguments[1]&&(b+=', "'+arguments[1]+'"');var c='";return c}catch(d){console.log("drupalgap_jqm_page_event_script_code - "+d)}}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){try{if(1==Drupal.user.uid)return!0;var b=!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 c in drupalgap.menu_links[a].access_arguments)if(drupalgap.menu_links[a].access_arguments.hasOwnProperty(c)){var d=drupalgap.menu_links[a].access_arguments[c];if(b=user_access(d))break}}else b=!0;else{var e=drupalgap.menu_links[a].access_callback;if(drupalgap_function_exists(e)){var f=window[e];if(drupalgap.menu_links[a].access_arguments){var g=drupalgap.menu_links[a].access_arguments.slice(0);if(arguments[2]){var h=arguments[2];for(var c in g)if(g.hasOwnProperty(c)){var i=g[c];if(is_int(parseInt(i))){g[c]=h;break}}}return f.apply(null,Array.prototype.slice.call(g))}return f()}console.log("drupalgap_menu_access - access call back ("+e+") does not exist")}else console.log("drupalgap_menu_access - path ("+a+") does not exist");return b}catch(j){console.log("drupalgap_menu_access - "+j)}}function drupalgap_module_load(a){try{return module_load(a)}catch(b){console.log("drupalgap_module_load - "+b)}}function drupalgap_modules_get_bundle_directory(a){try{return dir="","core"==a?dir="modules":"contrib"==a?dir="app/modules":"custom"==a&&(dir="app/modules/custom"),dir}catch(b){console.log("drupalgap_modules_get_bundle_directory - "+b)}}function drupalgap_place_args_in_path(a){try{var b=!1;if(a){var c=drupalgap_path_get();arguments[1]&&(c=arguments[1]);var d,e=arg(null,c),f=arg(null,a);if(f&&f.length>0){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){h.html('
  • '),h.listview("refresh"),_theme_autocomplete_success_handlers[d]=function(a,b,c,d){try{if(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 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&&(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{a.attributes.type="number";var b="";return b}catch(c){console.log("theme_number - "+c)}}function theme_hidden(a){try{a.attributes.type="hidden",a.attributes.value||null==a.value||(a.attributes.value=a.value);var b="";return b}catch(c){console.log("theme_hidden - "+c)}}function theme_password(a){try{a.attributes.type="password";var b="";return b}catch(c){console.log("theme_password - "+c)}}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{a.attributes.type="tel";var b="";return b}catch(c){console.log("theme_tel - "+c)}}function theme_textfield(a){try{a.attributes.type="text";var b="";return b}catch(c){console.log("theme_textfield - "+c)}}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="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){$("#"+a).empty().remove();var d=drupalgap.pages.indexOf(a);d>-1&&drupalgap.pages.splice(d,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(e){console.log("drupalgap_remove_page_from_dom - "+e)}}function drupalgap_remove_pages_from_dom(){try{var a=drupalgap_get_page_id(drupalgap_path_get());for(var b in drupalgap.pages)if(drupalgap.pages.hasOwnProperty(b)){var c=drupalgap.pages[b];a!=c&&drupalgap_remove_page_from_dom(c,null,a)}drupalgap.pages=[a],drupalgap.views.ids=[],drupalgap.page.jqm_events=[],drupalgap.back_path=[]}catch(d){console.log("drupalgap_remove_pages_from_dom - "+d)}}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{module_invoke_all("page_build",drupalgap.output);var a=drupalgap.output,b=$.type(a),c="";if("string"===b)c=a;else if("object"===b){var d=["theme","view_mode","language"];if(a.theme&&drupalgap.theme_registry[a.theme]){var e=drupalgap.theme_registry[a.theme],f=a.theme.replace(/_/g,"-")+".tpl.html",g=e.path+"/"+f;if(drupalgap_file_exists(g)){var h=drupalgap_file_get_contents(g);if(h){var i=drupalgap_get_placeholders_from_html(h);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]}h=h.replace("{:"+k+":}",l)}c+=h}else console.log("drupalgap_render_page - failed to get file contents ("+g+")")}else console.log("drupalgap_render_page - template file does not exist ("+g+")")}for(var m in a)if(a.hasOwnProperty(m)){var n=a[m];-1==$.inArray(m,d&&"undefined"!=typeof n.theme)&&(c+=theme(n.theme,n))}}return c}catch(o){console.log("drupalgap_render_page - "+o)}}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="";if(d+=_drupalgap_region_render_zone("_prefix",a,c),drupalgap.settings.blocks[drupalgap.settings.theme][a.name]){a.attributes["class"]||(a.attributes["class"]=""),a.attributes["class"]+=" region_"+a.name+" ",d+="
    ";var e=0,f=0;if(a.links&&a.links.length>0){var g=0,h=0;for(var i in a.links)if(a.links.hasOwnProperty(i)){var j=a.links[i],k=menu_region_link_get_data(j);if(drupalgap_check_visibility("region",k)){e++;var m=drupalgap_link_get_class(j);if(m){var n=menu_region_link_get_side(m);"left"==n?g++:"right"==n&&h++}}}for(var o="",p="",q=0;q1){var v={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-left"};o="
    "+o.replace(/ui-btn-left/g,"")+"
    "}if(h>1){var v={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-right"};p="
    "+p.replace(/ui-btn-right/g,"")+"
    "}d+=o+p}var w={block_count:0,block_menu_count:0},x=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];for(var y in x)if(x.hasOwnProperty(y)){var z=x[y];"_prefix"!=y&&"_suffix"!=y&&(d+=drupalgap_block_render(a,c,y,z,w))}(in_array(a.attributes["data-role"],["header","footer"])&&(0==w.block_count&&e>0||w.block_count-w.block_menu_count==0)||e>0&&f>=w.block_menu_count&&0==w.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(A){console.log("drupalgap_render_region - "+A)}}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 path_to_theme(){try{return drupalgap.theme_path?drupalgap.theme_path:(console.log("path_to_theme - drupalgap.theme_path is not set!"),!1)}catch(a){console.log("path_to_theme - "+a)}}function theme(a,b){try{if(b||(b={}),b.markup)return b.markup;var c="";if(!a)return c;var d=drupalgap.settings.theme+"_"+a;if(!function_exists(d)&&(d="theme_"+a,!function_exists(d))){var e=null;arguments.callee.caller&&(e=arguments.callee.caller.name);var f="WARNING: "+d+"() does not exist.";return e&&(f+=" Called by: "+e+"()."),console.log(f),c}"undefined"!=typeof b.attributes&&b.attributes||(b.options&&b.options.attributes?b.attributes=b.options.attributes:b.attributes={}),b.attributes["class"]||(b.attributes["class"]="");var g=window[d];return c=g.call(null,b)}catch(h){console.log("theme - "+h)}}function theme_button(a){try{a.attributes["data-role"]="button";var b=""+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="
    <"+type+">"+a.text+"
    ";return b}catch(c){console.log("theme_header - "+c)}}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){var d="undefined"!=typeof a.attributes["data-role"]&&"listview"==a.attributes["data-role"];for(var e in a.items)if(a.items.hasOwnProperty(e)){var f=a.items[e],g=null;c+=""}}return c+=""}catch(h){console.log("theme_item_list - "+h)}}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){try{var i={foo:"bar"};return i;var i,i,i,i}catch(j){console.log("hook_assemble_form_state_into_field - "+j)}}function hook_deviceready(){}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_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.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+" :last-child",500);var b="#"+drupalgap_get_page_id()+" #comment_edit";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.category={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){if(a&&a.length){for(var b in a)if(a.hasOwnProperty(b)){var c=a[b],d=1==c.selected?"selected":"",e='";$("#edit-contact-site-form-category").append(e)}$("#edit-contact-site-form-category").selectmenu("refresh"),1==a.length&&$("#contact_site_form .field-name-category").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,category:b.values.category,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,category:b.values.category,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 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;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"];h.display.drupalgap&&(i=h.display.drupalgap,"undefined"==typeof i.module&&"undefined"!=typeof h.display["default"].module&&(i.module=h.display["default"].module)),"hidden"!=i.type&&(f[g]=i,e[g]=i.weight)}var j=[];for(var g in e)if(e.hasOwnProperty(g)){var k=e[g];j.push(k)}j.sort(function(a,b){return a-b});var l=[];for(var m in j)if(j.hasOwnProperty(m)){var n=j[m];for(var g in e)if(e.hasOwnProperty(g)){var k=e[g];if(n==k&&-1==l.indexOf(g)){l.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(o){console.log("drupalgap_entity_render_content - "+o)}}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)}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")}catch(f){console.log("_drupalgap_entity_page_container_inject - "+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}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])break;if(""!=b.values[g][d][0])break;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=language_default(),h=a.title;a.title_field&&a.title_field[g]&&(h=a.title_field[g][0].safe_value);var i={theme:"node",node:a,title:{markup:h},content:{markup:a.content}};if("undefined"==typeof a.comment)_drupalgap_entity_page_container_inject("node",a.nid,"view",i);else if(0!=a.comment){if(1==a.comment||2==a.comment){var j="";if(2==a.comment&&(j=drupalgap_get_form("comment_edit",{nid:a.nid},a)),0!=a.comment_count){var k={parameters:{nid:a.nid}};comment_index(k,{success:function(b){try{var c="";for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];c+=theme("comment",{comment:e})}i.content.markup+=theme("comments",{node:a,comments:c}),2==a.comment&&user_access("post comments")&&(i.content.markup+=j),_drupalgap_entity_page_container_inject("node",a.nid,"view",i)}catch(f){var g="node_page_view_pageshow - comment_index - "+f;console.log(g)}}})}else 2==a.comment&&(i.content.markup+=theme("comments",{node:a}),user_access("post comments")&&(i.content.markup+=j)),_drupalgap_entity_page_container_inject("node",a.nid,"view",i)}}else i.content.markup+=theme("comments",{node:a}),_drupalgap_entity_page_container_inject("node",a.nid,"view",i)}})}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},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(a){drupalgap_goto(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")};drupalgap.site_settings.user_email_verification?(drupalgap_alert(d.user_mail_register_email_verification_body,e),drupalgap_goto("")):"2"==drupalgap.site_settings.user_register?(drupalgap_alert(d.user_mail_register_pending_approval_required_body,e),drupalgap_goto("")):(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(""))},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){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;if(!in_array(a.resource,["login","logout","register"]))return;if(!b.responseText)return;var c=JSON.parse(b.responseText);if($.isArray(c)){var d="";for(var e in c)if(c.hasOwnProperty(e)){var f=c[e];d+=f+"\n"}""!=d&&drupalgap_alert(d)}}catch(g){console.log("user_services_postprocess - "+g)}}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;b.results=a;var c=theme("views_view",b);b.success(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&&(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+j(c.view)}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"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(h){console.log("drupalgap_views_get_result_formats - "+h)}}function drupalgap_views_render_rows(a,b,c,d,e,f){try{var g="";for(var h in b[c])if(b[c].hasOwnProperty(h)){var i=b[c][h],j=i[d];j._position=h;var k="";a.row_callback&&function_exists(a.row_callback)?(row_callback=window[a.row_callback],k=row_callback(b.view,j)):k=JSON.stringify(j),g+=e+k+f}return g}catch(l){console.log("drupalgap_views_render_rows - "+l)}}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 diff --git a/bin/drupalgap-7.0.1.js b/bin/drupalgap-7.0.2.js similarity index 96% rename from bin/drupalgap-7.0.1.js rename to bin/drupalgap-7.0.2.js index 03458fb9..8316d76f 100644 --- a/bin/drupalgap-7.0.1.js +++ b/bin/drupalgap-7.0.2.js @@ -1,4 +1,4 @@ -/*! drupalgap 2016-04-07 */ +/*! drupalgap 2016-08-15 */ // Initialize the drupalgap json object. var drupalgap = drupalgap || drupalgap_init(); // Do not remove this line. @@ -47,6 +47,7 @@ function drupalgap_init() { back: false, /* moving backwards or not */ back_path: [], /* paths to move back to */ blocks: [], + connected: false, // Becomes true once DrupalGap performs a System Connect call. content_types_list: {}, /* holds info about each content type */ date_formats: { }, /* @see system_get_date_formats() in Drupal core */ date_types: { }, /* @see system_get_date_types() in Drupal core */ @@ -199,47 +200,41 @@ function _drupalgap_deviceready() { return; } - // Check device connection. If the device is offline, warn the user and then - // go to the offline page. - drupalgap_check_connection(); - if (!drupalgap.online) { - module_invoke_all('device_offline'); - if (drupalgap.settings.offline_message) { - drupalgap_alert(drupalgap.settings.offline_message, { - title: t('Offline'), - alertCallback: function() { drupalgap_goto('offline'); } - }); - } - else { - drupalgap_goto('offline'); + // Device is ready, let's call any implementations of hook_deviceready(). If any implementation returns + // false, that means they would like to take over the rest of the deviceready procedure (aka the System + // Connect call) + var proceed = true; + var invocation_results = module_invoke_all('deviceready'); + if (invocation_results && invocation_results.length > 0) { + for (var i = 0; i < invocation_results.length; i++) { + if (!invocation_results[i]) { + proceed = false; + break; + } } - return; } - else { - // Device is online, let's call any implementations of hook_deviceready(). - // If any implementation returns false, that means they don't want - // DrupalGap to continue with the System Connect call, so we'll skip that - // and go straight to the App's front page. - var proceed = true; - var invocation_results = module_invoke_all('deviceready'); - if (invocation_results && invocation_results.length > 0) { - for (var i = 0; i < invocation_results.length; i++) { - if (!invocation_results[i]) { - proceed = false; - break; - } + // If the device is offline, warn the user and then go to the offline page, unless someone implemented + // hook_offline, then let them handle it. + if (!drupalgap_has_connection()) { + if (!module_implements('device_offline')) { + if (drupalgap.settings.offline_message) { + drupalgap_alert(drupalgap.settings.offline_message, { + title: t('Offline'), + alertCallback: function() { drupalgap_goto('offline'); } + }); } + else { drupalgap_goto('offline'); } } - if (!proceed) { - // @todo - if module's are going to skip the System Connect call, then - // we need to make sure Drupal.user is set up with appropriate defaults. - } - else { - // Device is online, make the system connect call. - system_connect(_drupalgap_deviceready_options()); - } + else { setTimeout(function() { module_invoke_all('device_offline'); }, 1); } + } + else if (proceed) { + + // Device is online and no one has taken over the deviceready, continue with the System Connect call. + system_connect(_drupalgap_deviceready_options()); + } + } catch (error) { console.log('_drupalgap_deviceready - ' + error); } } @@ -253,6 +248,7 @@ function _drupalgap_deviceready_options() { var page_options = arguments[0] ? arguments[0] : {}; return { success: function(result) { + drupalgap.connected = true; // Call all hook_device_connected implementations then go to // the front page. module_invoke_all('device_connected'); @@ -546,10 +542,8 @@ function drupalgap_load_locales() { var fn = window[module + '_locale']; var languages = fn(); for (var j = 0; j < languages.length; j++) { - var language_code = languages[i]; - var file_path = - drupalgap_get_path('module', module) + - '/locale/' + language_code + '.json'; + var language_code = languages[j]; + var file_path = drupalgap_get_path('module', module) + '/locale/' + language_code + '.json'; var translations = drupalgap_file_get_contents( file_path, { dataType: 'json' } @@ -571,6 +565,19 @@ function drupalgap_load_locales() { catch (error) { console.log('drupalgap_load_locales - ' + error); } } +/** + * Checks for an Internet connection, returns true if connected, false otherwise. + * @returns {boolean} + */ +function drupalgap_has_connection() { + try { + drupalgap_check_connection(); + module_invoke_all('device_connection'); + return drupalgap.online; + } + catch (error) { console.log('drupalgap_has_connection - ' + error); } +} + /** * Checks the devices connection and sets drupalgap.online to true if the * device has a connection, false otherwise. @@ -579,19 +586,13 @@ function drupalgap_load_locales() { */ function drupalgap_check_connection() { try { - - // If we're not in PhoneGap (i.e. a web app environment, or Ripple), we'll - // assume we have a connection. Is this a terrible assumption? Anybody out - // there know? - // http://stackoverflow.com/q/15950382/763010 - if ( - drupalgap.settings.mode != 'phonegap' || - typeof parent.window.ripple === 'function' - ) { - drupalgap.online = true; - return 'Ethernet connection'; + // If we're not in phonegap, just use the navigator.onLine value. + if (drupalgap.settings.mode != 'phonegap' || typeof parent.window.ripple === 'function' ) { + drupalgap.online = navigator.onLine; + return 'Ethernet connection'; // @TODO detect real connection type. } + // Determine what connection phonegap has. var networkState = navigator.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown connection'; @@ -601,12 +602,7 @@ function drupalgap_check_connection() { states[Connection.CELL_3G] = 'Cell 3G connection'; states[Connection.CELL_4G] = 'Cell 4G connection'; states[Connection.NONE] = 'No network connection'; - if (states[networkState] == 'No network connection') { - drupalgap.online = false; - } - else { - drupalgap.online = true; - } + drupalgap.online = states[networkState] != 'No network connection'; return states[networkState]; } catch (error) { console.log('drupalgap_check_connection - ' + error); } @@ -2807,14 +2803,14 @@ function _drupalgap_form_render_element(form, element) { variables.attributes['placeholder'] = placeholder; } - // If there wasn't a default value provided, set one. Then set the - // default value into the variables' attributes. Although, if we have an - // item value, just use that. + // If there wasn't a default value provided, set one. Then set the default value into the variables' attributes, + // if it wasn't already set, otherwise set it to the item's value. if (!item.default_value) { item.default_value = ''; } variables.attributes.value = item.default_value; - if (typeof item.value !== 'undefined') { - variables.attributes.value = item.value; - } + if ( + typeof item.value !== 'undefined' && + (typeof variables.attributes.value === 'undefined' || empty(variables.attributes.value)) + ) { variables.attributes.value = item.value; } // Call the hook_field_widget_form() if necessary. Merge any changes // to the item back into this item. @@ -2830,8 +2826,6 @@ function _drupalgap_form_render_element(form, element) { delta, element ]); - // @TODO - sometimes an item gets merged without a type here, why? - // @UPDATE - did the recursive extend fix this? item = $.extend(true, item, items[delta]); // If the item type got lost, replace it. if (!item.type && element.type) { item.type = element.type; } @@ -4024,8 +4018,7 @@ function theme_form_required_marker(variables) { function theme_number(variables) { try { variables.attributes.type = 'number'; - var output = ''; - return output; + return ''; } catch (error) { console.log('theme_number - ' + error); } } @@ -4041,8 +4034,7 @@ function theme_hidden(variables) { if (!variables.attributes.value && variables.value != null) { variables.attributes.value = variables.value; } - var output = ''; - return output; + return ''; } catch (error) { console.log('theme_hidden - ' + error); } } @@ -4055,8 +4047,7 @@ function theme_hidden(variables) { function theme_password(variables) { try { variables.attributes.type = 'password'; - var output = ''; - return output; + return ''; } catch (error) { console.log('theme_password - ' + error); } } @@ -4178,8 +4169,7 @@ function theme_select(variables) { function theme_tel(variables) { try { variables.attributes['type'] = 'tel'; - var output = ''; - return output; + return ''; } catch (error) { console.log('theme_tel - ' + error); } } @@ -4192,8 +4182,7 @@ function theme_tel(variables) { function theme_textfield(variables) { try { variables.attributes.type = 'text'; - var output = ''; - return output; + return ''; } catch (error) { console.log('theme_textfield - ' + error); } } @@ -4349,6 +4338,7 @@ function drupalgap_goto(path) { // page and we're not in the middle of a form submission, prevent the page // from processing then change to it. if (drupalgap_page_in_dom(page_id)) { + // If there are any hook_menu() item options for this router path, bring // them into the current options without overwriting any existing values. if (drupalgap.menu_links[router_path].options) { @@ -4358,6 +4348,7 @@ function drupalgap_goto(path) { options ); } + // Reload the page? If so, remove the page from the DOM, delete the // reloadPage option, then set the reloadingPage option to true so others // down the line will know the page is reloading. We can't pass along the @@ -4396,13 +4387,7 @@ function drupalgap_goto(path) { } // Generate the page. - drupalgap_goto_generate_page_and_go( - path, - page_id, - options, - drupalgap.menu_links[router_path] - ); - + drupalgap_goto_generate_page_and_go(path, page_id, options, drupalgap.menu_links[router_path]); } catch (error) { console.log('drupalgap_goto - ' + error); } } @@ -4421,6 +4406,10 @@ function drupalgap_goto(path) { 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( @@ -4438,6 +4427,7 @@ function drupalgap_goto_generate_page_and_go( // 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' && @@ -4467,7 +4457,7 @@ function drupalgap_goto_generate_page_and_go( drupalgap.settings.mode != 'phonegap' || typeof parent.window.ripple === 'function' ) { destination = '#' + page_id; } - $.mobile.changePage(destination, options); + $.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); @@ -5707,7 +5697,11 @@ function drupalgap_remove_page_from_dom(page_id) { var options = {}; if (typeof arguments[1] !== 'undefined') { options = arguments[1]; } if (current_page_id != page_id || options.force) { + var currentPage = $('#' + current_page_id); + // Preserve and re-apply style to current page, @see https://github.com/signalpoint/DrupalGap/issues/837 + var style = $(currentPage).attr('style'); $('#' + page_id).empty().remove(); + if (style) { $(currentPage).attr('style', style); } var page_index = drupalgap.pages.indexOf(page_id); if (page_index > -1) { drupalgap.pages.splice(page_index, 1); } // We'll remove the query string, unless we were instructed to leave it. @@ -5732,9 +5726,10 @@ function drupalgap_remove_page_from_dom(page_id) { function drupalgap_remove_pages_from_dom() { try { var current_page_id = drupalgap_get_page_id(drupalgap_path_get()); - for (var index in drupalgap.pages) { - if (!drupalgap.pages.hasOwnProperty(index)) { continue; } - var page_id = drupalgap.pages[index]; + var pages = drupalgap.pages.slice(0); + for (var index in pages) { + if (!pages.hasOwnProperty(index)) { continue; } + var page_id = pages[index]; if (current_page_id != page_id) { drupalgap_remove_page_from_dom(page_id, null, current_page_id); } @@ -5827,125 +5822,12 @@ function drupalgap_jqm_active_page_url() { */ function drupalgap_render_page() { try { - module_invoke_all('page_build', drupalgap.output); - - // Since the page output has already been assembled, render the content - // based on the output type. The output type will either be an html string - // or a drupalgap render object. - var output = drupalgap.output; - var output_type = $.type(output); - var 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. - content = output; - } - 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']; - - // Is there a theme value specified in the output and the registry? - if (output.theme && drupalgap.theme_registry[output.theme]) { - - // Extract the theme object template and determine the template file - // name and path. - var template = drupalgap.theme_registry[output.theme]; - var template_file_name = output.theme.replace(/_/g, '-') + '.tpl.html'; - var template_file_path = template.path + '/' + template_file_name; - - // Make sure the template file exists. - if (drupalgap_file_exists(template_file_path)) { - - // Loads the template file's content into a string. - 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. - // @todo - each placeholder should have its own container div and - // unique id. - for (var index in placeholders) { - if (!placeholders.hasOwnProperty(index)) { continue; } - var placeholder = placeholders[index]; - var html = ''; - if (output[placeholder]) { - // Grab the element variable from the output. - var element = output[placeholder]; - // If it is markup, render it as is, if it is themeable, - // then theme it. - if (output[placeholder].markup) { - html = output[placeholder].markup; - } - else if (output[placeholder].theme) { - html = theme(output[placeholder].theme, element); - } - // Now remove the variable from the output. - delete output[placeholder]; - } - // Now replace the placeholder with the html, even if it was - // empty. - template_file_html = template_file_html.replace( - '{:' + placeholder + ':}', - html - ); - } - } - else { - // There were no place holders found, do nothing, ok. - } - - // Finally add the rendered template file to the content. - content += template_file_html; - } - else { - console.log( - 'drupalgap_render_page - failed to get file contents (' + - template_file_path + - ')' - ); - } - } - else { - console.log( - 'drupalgap_render_page - template file does not exist (' + - template_file_path + - ')' - ); - } - } - - // Iterate over any remaining variables and theme them. - // @todo - each remaining variables should have its own container div and - // unique id, similar to the placeholder div containers mentioned above. - for (var element in output) { - if (!output.hasOwnProperty(element)) { continue; } - var variables = output[element]; - if ($.inArray(element, render_variables && typeof variables.theme !== 'undefined') == -1) { - content += theme(variables.theme, variables); - } - } - } - - // Now that we are done assembling the content into an html string, we can - // return it. - return content; + return drupalgap_render(drupalgap.output); } catch (error) { console.log('drupalgap_render_page - ' + error); } } - /** * Given a region, this renders it and all the blocks in it. The blocks are * specified in the settings.js file, they are bundled under a region, which in @@ -6225,6 +6107,102 @@ function drupalgap_panel_id(key) { } +function drupalgap_render(content) { + + var output_type = $.type(content); + var html = ''; + + // 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; + } + 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; } + + // 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); + } + } + 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 + ')'); + } + } + else { + console.log('drupalgap_render - template file does not exist (' + template_file_path + ')'); + } + } + + // Iterate over any remaining variables and theme them. + for (var element in content) { + if (!content.hasOwnProperty(element)) { continue; } + var variables = content[element]; + if ($.inArray(element, render_variables) == -1) { + html += theme(typeof variables.theme === 'undefined' ? null : variables.theme, variables); + } + } + } + + // Now that we are done assembling the content into an html string, we can + // return it. + return html; +} + /** * Returns the path to the current DrupalGap theme, false otherwise. * @return {String|Boolean} @@ -6254,6 +6232,7 @@ function theme(hook, variables) { // If there is HTML markup present, just return it as is. Otherwise, run // the theme hook and send along the variables. if (!variables) { variables = {}; } + if (typeof variables.access !== 'undefined' && !variables.access) { return ''; } if (variables.markup) { return variables.markup; } var content = ''; if (!hook) { return content; } @@ -6521,9 +6500,9 @@ function theme_item_list(variables) { if (variables.items && variables.items.length > 0) { var listview = typeof variables.attributes['data-role'] !== 'undefined' && variables.attributes['data-role'] == 'listview'; - for (var index in variables.items) { - if (!variables.items.hasOwnProperty(index)) { continue; } - var item = variables.items[index]; + for (var index = 0; index < variables.items.length; index++) { + var item = variables.items[index]; + if (typeof item === 'string') { var icon = null; html += ''; + } + else if (typeof item === 'object') { + var attributes = item.attributes ? item.attributes : {}; + var content = item.content ? item.content : ''; + html += '
  • ' + drupalgap_render(content) + '
  • '; + } } } html += ''; @@ -6860,11 +6845,12 @@ function _drupalgap_page_title_pageshow_success(title) { * placed around the result object. Defaults to true. * Set the 'use_delta' boolean property to false when * a delta value is not needed. Defaults to true. + * @param {Object} form * * @return {*} */ function hook_assemble_form_state_into_field(entity_type, bundle, - form_state_value, field, instance, langcode, delta, field_key) { + form_state_value, field, instance, langcode, delta, field_key, form) { try { // Listed below are example use cases. Each show how to assemble the result, // and what the resulting field object will look like when assembled by the @@ -6945,17 +6931,38 @@ function hook_assemble_form_state_into_field(entity_type, bundle, } /** - * When the app is first loading up, DrupalGap checks to see if the device has - * a connection, if it does then this hook is called. Implementations of this - * hook need to return true if they'd like DrupalGap to continue, or return - * false if you'd like DrupalGap to NOT continue. If DrupalGap continues, it - * will perform a System Connect resource call then go to the App's front page. - * This is called during DrupalGap's "deviceready" implementation for PhoneGap. - * Note, the Drupal.user object is not initialized at this point, and always - * appears to be an anonymous user. + * When the app is first loading up, DrupalGap checks to see if the device has a connection, if it does then this hook + * is called. If DrupalGap doesn't have a connection, then hook_device_offline() is called. Implementations of + * hook_deviceready() need to return true if they'd like DrupalGap to continue, or return false if you'd like DrupalGap + * to NOT continue. If DrupalGap continues, it will perform a System Connect resource call then go to the App's front + * page. This is called during DrupalGap's "deviceready" implementation for PhoneGap. Note, the Drupal.user object is + * not initialized at this point, and will always be an anonymous user. */ function hook_deviceready() {} +/** + * When someone calls drupalgap_has_connection(), this hook has an opportunity to set drupalgap.online to true or false. + * The value of drupalgap.online is returned to anyone who calls drupalgap_has_connection(), including DrupalGap core. + */ +function hook_device_connection() { + + // If it is Saturday, take the app offline and force the user to go outside and play. + var d = new Date(); + if (d.getDay() == 6) { drupalgap.online = false; } + +} + +/** + * Called during app startup if the device does not have a connection. Note, the Drupal.user object is ot initialized at + * this point, and will always be an anonymous user. + */ +function hook_device_offline() { + + // Even though we're offline, let's just go to the front page. + drupalgap_goto(''); + +} + /** * Take action when the user presses the "back" button. This includes the soft, * hardware and browser back buttons. The browser back button is only available @@ -7035,6 +7042,44 @@ function hook_block_view(delta, region) { */ function hook_404(router_path) {} +/** + * Implements hook_entity_pre_build_content(). + */ +function hook_entity_pre_build_content(entity, entity_type, bundle) { + + // Change some weights on nodes with a date field. + if (entity_type == 'node' && typeof entity.field_date !== 'undefined') { + entity.body.weight = 0; + entity.field_date.weight = 1; + } +} + +/** + * Implements hook_entity_post_build_content(). + */ +function hook_entity_post_build_content(entity, entity_type, bundle) { + +} + +/** + * Implements hook_entity_pre_render_content(). + * Called before drupalgap_entity_render_content() assembles the entity.content + * string. Use this to make modifications to an entity before its' content is rendered. + */ +function hook_entity_pre_render_content(entity, entity_type, bundle) { + try { + + // Remove access to the date field on all nodes. + if (entity_type == 'node' && typeof entity.field_date !== 'undefined') { + entity.field_date.access = false; + } + + } + catch (error) { + console.log('hook_entity_pre_render_content - ' + error); + } +} + /** * Called after drupalgap_entity_render_content() assembles the entity.content * string. Use this to make modifications to the HTML output of the entity's @@ -7343,7 +7388,6 @@ function hook_views_exposed_filter(form, form_state, element, filter, field) { catch (error) { console.log('hook_views_exposed_filter - ' + error); } } - /** * Implements hook_menu(). * @return {Object} @@ -7511,6 +7555,7 @@ function comment_edit(form, form_state, comment, node) { var bundle = 'comment_node_' + node_type; // Setup form defaults. + form.id += '_' + comment.nid; // Append the node id the comment form id. form.entity_type = 'comment'; form.bundle = bundle; form.action = 'node/' + comment.nid; @@ -7597,9 +7642,9 @@ function comment_services_postprocess(options, result) { $(container).append( theme('comment', { comment: comment }) ).trigger('create'); - scrollToElement('#' + container_id + ' :last-child', 500); + scrollToElement('#' + container_id + ' #' + comment_container_id(comment.cid), 500); var form_selector = '#' + drupalgap_get_page_id() + - ' #comment_edit'; + ' #comment_edit' + '_' + comment.nid; drupalgap_form_clear(form_selector); } }); @@ -7795,7 +7840,7 @@ function contact_site_form(form, form_state) { type: 'textfield', required: true }; - form.elements.category = { + form.elements.cid = { title: t('Category'), type: 'select', required: true @@ -7835,21 +7880,17 @@ function contact_site_form_pageshow() { try { contact_index({ success: function(results) { + var select = $('#edit-contact-site-form-cid'); if (!results || !results.length) { return; } for (var index in results) { if (!results.hasOwnProperty(index)) { continue; } var result = results[index]; var selected = result.selected == 1 ? 'selected' : ''; - var option = - ''; - $('#edit-contact-site-form-category').append(option); - } - $('#edit-contact-site-form-category').selectmenu('refresh'); - if (results.length == 1) { - $('#contact_site_form .field-name-category').hide(); + var option = ''; + $(select).append(option); } + $(select).selectmenu('refresh'); + if (results.length == 1) { $(select).hide(); } } }); } @@ -7866,7 +7907,7 @@ function contact_site_form_submit(form, form_state) { name: form_state.values['name'], mail: form_state.values['mail'], subject: form_state.values['subject'], - category: form_state.values['category'], + cid: form_state.values['cid'], message: form_state.values['message'], copy: form_state.values['copy'] }; @@ -8005,7 +8046,6 @@ function contact_personal_form_submit(form, form_state) { mail: form_state.values['mail'], to: form_state.values['to'], subject: form_state.values['subject'], - category: form_state.values['category'], message: form_state.values['message'], copy: form_state.values['copy'] }; @@ -8049,6 +8089,25 @@ function contact_personal_form_to_container_id(recipient) { } +function drupalgap_entity_view_mode(entity_type, bundle) { + var view_mode = 'drupalgap'; + if (typeof drupalgap.settings.view_modes !== 'undefined') { + if (entity_type && bundle) { + if ( + drupalgap.settings.view_modes[entity_type] && + drupalgap.settings.view_modes[entity_type][bundle] && + drupalgap.settings.view_modes[entity_type][bundle].view_mode + ) { view_mode = drupalgap.settings.view_modes[entity_type][bundle].view_mode; } + } + else if (entity_type) { + if ( + drupalgap.settings.view_modes[entity_type] && + drupalgap.settings.view_modes[entity_type].view_mode + ) { view_mode = drupalgap.settings.view_modes[entity_type].view_mode; } + } + } + return view_mode; +} /** * Implements hook_install(). */ @@ -8186,41 +8245,51 @@ function drupalgap_entity_edit_form_delete_confirmation(entity_type, function drupalgap_entity_render_content(entity_type, entity) { try { entity.content = ''; - // Render each field on the entity, using the default display. The fields - // need to be appended according to their weight, so we'll keep track of - // the weights and displays, then at the end we'll render them and append - // them in order onto the entity's content. + + // Figure out the bundle. var bundle = entity.type; if (entity_type == 'comment') { bundle = entity.bundle; } - else if (entity_type == 'taxonomy_term') { - bundle = entity.vocabulary_machine_name; - } + else if (entity_type == 'taxonomy_term') { bundle = entity.vocabulary_machine_name; } + + // Load the field info for this entity and bundle combo. var field_info = drupalgap_field_info_instances(entity_type, bundle); if (!field_info) { return; } + + // Give modules a chance to pre build the content. + module_invoke_all('entity_pre_build_content', entity, entity_type, bundle); + + // Render each field on the entity, using the drupalgap or default display. var field_weights = {}; var field_displays = {}; for (var field_name in field_info) { if (!field_info.hasOwnProperty(field_name)) { continue; } var field = field_info[field_name]; - // Determine which display mode to use. The default mode will be used - // if the drupalgap display mode is not present. + + // Determine which display mode to use. The default mode will be used if the drupalgap display mode is not + // present, unless a view mode has been specified in settings.js then we'll use that config for the current + // entity/bundle combo. If a module isn't listed on a custom display, use the default display's module. if (!field.display) { break; } var display = field.display['default']; - if (field.display['drupalgap']) { - display = field.display['drupalgap']; - // If a module isn't listed on the drupalgap display, use the default - // display's module. - if ( - typeof display.module === 'undefined' && - typeof field.display['default'].module !== 'undefined' + var view_mode = drupalgap_entity_view_mode(entity_type, bundle); + if (field.display[view_mode]) { + display = field.display[view_mode]; + if (typeof display.module === 'undefined' && typeof field.display['default'].module !== 'undefined' ) { display.module = field.display['default'].module; } } + // Skip hidden fields. if (display.type == 'hidden') { continue; } - // Save the field display and weight. + + // Save the field display and weight. Use the weight from the field's render element if it's available, + // otherwise fallback to the weight mentioned in the display. field_displays[field_name] = display; - field_weights[field_name] = display.weight; + field_weights[field_name] = typeof entity[field_name].weight !== 'undefined' ? + entity[field_name].weight : display.weight; } + + // Give modules a chance to alter the build content. + module_invoke_all('entity_post_build_content', entity, entity_type, bundle); + // Extract the field weights and sort them. var extracted_weights = []; for (var field_name in field_weights) { @@ -8229,6 +8298,10 @@ function drupalgap_entity_render_content(entity_type, entity) { extracted_weights.push(weight); } extracted_weights.sort(function(a, b) { return a - b; }); + + // Give modules a chance to pre alter the content. + module_invoke_all('entity_pre_render_content', entity, entity_type, bundle); + // For each sorted weight, locate the field with the corresponding weight, // then render it's field content. var completed_fields = []; @@ -8236,7 +8309,8 @@ function drupalgap_entity_render_content(entity_type, entity) { if (!extracted_weights.hasOwnProperty(weight_index)) { continue; } var target_weight = extracted_weights[weight_index]; for (var field_name in field_weights) { - if (!field_weights.hasOwnProperty(field_name)) { continue; } + if (!field_weights.hasOwnProperty(field_name) || typeof entity[field_name] === 'undefined') { continue; } + if (typeof entity[field_name].access !== 'undefined' && !entity[field_name].access) { continue; } var weight = field_weights[field_name]; if (target_weight == weight) { if (completed_fields.indexOf(field_name) == -1) { @@ -8253,13 +8327,10 @@ function drupalgap_entity_render_content(entity_type, entity) { } } } + // Give modules a chance to alter the content. - module_invoke_all( - 'entity_post_render_content', - entity, - entity_type, - bundle - ); + module_invoke_all('entity_post_render_content', entity, entity_type, bundle); + // Update this entity in local storage so the content property sticks. if (entity_caching_enabled(entity_type, bundle)) { _entity_local_storage_save( @@ -8268,6 +8339,7 @@ function drupalgap_entity_render_content(entity_type, entity) { entity ); } + } catch (error) { console.log('drupalgap_entity_render_content - ' + error); @@ -8518,7 +8590,8 @@ function drupalgap_entity_build_from_form_state(form, form_state) { form.elements[name].field_info_instance, language, delta, - field_key + field_key, + form ); } @@ -8951,8 +9024,7 @@ function _drupalgap_entity_page_container_id(entity_type, entity_id, mode) { * @param {String} mode * @param {Object} build */ -function _drupalgap_entity_page_container_inject(entity_type, entity_id, mode, - build) { +function _drupalgap_entity_page_container_inject(entity_type, entity_id, mode, build) { try { // Get the container id, set the drupalgap.output to the page build, then // inject the rendered page into the container. @@ -8960,12 +9032,31 @@ function _drupalgap_entity_page_container_inject(entity_type, entity_id, mode, module_invoke_all('entity_view_alter', entity_type, entity_id, mode, build); drupalgap.output = build; $('#' + id).html(drupalgap_render_page()).trigger('create'); + _drupalgap_entity_page_add_css_class_names(entity_type, entity_id, build); } catch (error) { console.log('_drupalgap_entity_page_container_inject - ' + error); } } +/** + * An internal function used to add css class names to an entity's jQM page container. + * @param {String} entity_type + * @param {Number} entity_id + * @param {Object} build + * @private + */ +function _drupalgap_entity_page_add_css_class_names(entity_type, entity_id, build) { + try { + var className = entity_type; + var bundleName = entity_get_bundle(entity_type, build[entity_type]); + if (bundleName) { className += '-' + bundleName; } + className += ' ' + entity_type.replace(/_/g, '-') + '-' + entity_id; + $('#' + drupalgap_get_page_id()).addClass(className); + } + catch (error) { console.log('_drupalgap_entity_page_add_css_class_names - ' + error); } +} + /** * The page callback for entity edit forms. * @param {String} form_id @@ -9783,8 +9874,15 @@ function text_field_widget_form(form, form_state, field, instance, langcode, ite case 'text_with_summary': case 'text_textarea': type = 'textarea'; + break; } items[delta].type = type; + + // If the item has a value and its attribute value hasn't yet been set, then set the attribute value. + if ( + typeof items[delta].value !== 'undefined' && + typeof items[delta].options.attributes.value === 'undefined' + ) { items[delta].options.attributes.value = items[delta].value; } } catch (error) { console.log('text_field_widget_form - ' + error); } } @@ -10257,21 +10355,25 @@ function _image_phonegap_camera_getPicture_success(options) { */ function _image_field_form_process(form, form_state, options) { try { - // @todo - this needs mutli value field support (delta) + // @TODO needs mutli value field support (delta) + // @see https://www.drupal.org/node/2224803 + var lng = language_default(); var processed_an_image = false; + + // For each image field on the form... for (var index in form.image_fields) { if (!form.image_fields.hasOwnProperty(index)) { continue; } var name = form.image_fields[index]; - // Skip empty images. - if (!image_phonegap_camera_options[name][0]) { break; } - // Skip image fields that already have their file id set. - if (form_state.values[name][lng][0] != '') { break; } + + // Skip empty images and ones that already have their field id set. + if (!image_phonegap_camera_options[name][0] || form_state.values[name][lng][0] != '') { continue; } + // Create a unique file name using the UTC integer value. var d = new Date(); var image_file_name = Drupal.user.uid + '_' + d.valueOf() + '.jpg'; - // Build the data for the file create resource. If it's private, adjust - // the filepath. + + // Build the data for the file create resource. If it's private, adjust the filepath. var file = { file: { file: image_phonegap_camera_options[name][0].image, @@ -10282,6 +10384,7 @@ function _image_field_form_process(form, form_state, options) { if (!empty(Drupal.settings.file_private_path)) { file.file.filepath = 'private://' + image_file_name; } + // Change the loader mode to saving, and save the file. drupalgap.loader = 'saving'; processed_an_image = true; @@ -10301,6 +10404,7 @@ function _image_field_form_process(form, form_state, options) { } }); } + // If no images were processed, we need to continue onward anyway. if (!processed_an_image && options.success) { options.success(); } } @@ -11415,6 +11519,15 @@ function node_page_view_pageshow(nid) { return; } + // Build a done handler which will inject the given build into the page container. If there was a success + // callback attached to the page options call it. + var done = function(build) { + _drupalgap_entity_page_container_inject( + 'node', node.nid, 'view', build + ); + if (drupalgap.page.options.success) { drupalgap.page.options.success(node); } + }; + // Figure out the title, and watch for translation. var default_language = language_default(); var node_title = node.title; @@ -11429,12 +11542,10 @@ function node_page_view_pageshow(nid) { 'title': { markup: node_title }, 'content': { markup: node.content } }; + // If comments are undefined, just inject the page. - if (typeof node.comment === 'undefined') { - _drupalgap_entity_page_container_inject( - 'node', node.nid, 'view', build - ); - } + if (typeof node.comment === 'undefined') { done(build); } + // If the comments are closed (1) or open (2), show the comments. else if (node.comment != 0) { if (node.comment == 1 || node.comment == 2) { @@ -11473,15 +11584,16 @@ function node_page_view_pageshow(nid) { build.content.markup += comment_form; } // Finally, inject the page. - _drupalgap_entity_page_container_inject( - 'node', node.nid, 'view', build - ); + done(build); } catch (error) { var msg = 'node_page_view_pageshow - comment_index - ' + error; console.log(msg); } + }, + error: function(xhr, status, msg) { + if (drupalgap.page.options.error) { drupalgap.page.options.error(xhr, status, msg); } } }); } @@ -11493,9 +11605,7 @@ function node_page_view_pageshow(nid) { build.content.markup += theme('comments', { node: node }); if (user_access('post comments')) { build.content.markup += comment_form; } } - _drupalgap_entity_page_container_inject( - 'node', node.nid, 'view', build - ); + done(build); } } } @@ -11503,11 +11613,12 @@ function node_page_view_pageshow(nid) { // Comments are hidden (0), append an empty comments wrapper to the // content and inject the content into the page. build.content.markup += theme('comments', { node: node }); - _drupalgap_entity_page_container_inject( - 'node', node.nid, 'view', build - ); + done(build); } - } + }, + error: function(xhr, status, msg) { + if (drupalgap.page.options.error) { drupalgap.page.options.error(xhr, status, msg); } + } }); } catch (error) { console.log('node_page_view_pageshow - ' + error); } @@ -13330,7 +13441,10 @@ function user_login_form(form, form_state) { type: 'textfield', title: t('Username'), title_placeholder: true, - required: true + required: true, + attributes: { + autocapitalize: 'none' + } }; form.elements.pass = { type: 'password', @@ -13373,7 +13487,11 @@ function user_login_form_submit(form, form_state) { try { user_login(form_state.values.name, form_state.values.pass, { success: function(result) { - drupalgap_goto(drupalgap.settings.front, { reloadPage:true }); + drupalgap_goto( + typeof form.action !== 'undefined' ? + form.action : drupalgap.settings.front, + { reloadPage:true } + ); } }); } @@ -13488,6 +13606,8 @@ function user_register_form_submit(form, form_state) { var options = { title: t('Registered') }; + var destination = typeof form.action !== 'undefined' ? + form.action : drupalgap.settings.front; // Check if e-mail verification is required or not.. if (!drupalgap.site_settings.user_email_verification) { // E-mail verification not needed, if administrator approval is @@ -13497,7 +13617,7 @@ function user_register_form_submit(form, form_state) { config.user_mail_register_pending_approval_required_body, options ); - drupalgap_goto(''); + drupalgap_goto(destination); } else { drupalgap_alert( @@ -13513,7 +13633,7 @@ function user_register_form_submit(form, form_state) { } }); } - else { drupalgap_goto(''); } + else { drupalgap_goto(destination); } } } else { @@ -13522,7 +13642,7 @@ function user_register_form_submit(form, form_state) { config.user_mail_register_email_verification_body, options ); - drupalgap_goto(''); + drupalgap_goto(destination); } }, error: function(xhr, status, message) { @@ -13908,7 +14028,7 @@ function user_page() { */ function user_register_access() { try { - switch (drupalgap.site_settings.user_register) { + switch (drupalgap.site_settings.user_register.toString()) { case '0': // admins only can register return false; break; @@ -13930,8 +14050,9 @@ function user_services_postprocess(options, result) { try { // Don't process any other services. if (options.service != 'user') { return; } + var resources = ['login', 'logout', 'register']; // Only process login, logout and registration. - if (!in_array(options.resource, ['login', 'logout', 'register'])) { + if (!in_array(options.resource, resources) || (arg(0) != 'user' && !in_array(arg(1), resources))) { return; } // If there were any form errors, alert them to the user. @@ -13942,7 +14063,7 @@ function user_services_postprocess(options, result) { for (var index in response) { if (!response.hasOwnProperty(index)) { continue; } var message = response[index]; - msg += message + '\n'; + msg += t(message) + '\n'; } if (msg != '') { drupalgap_alert(msg); } } @@ -14557,8 +14678,17 @@ function views_embed_view(path, options) { views_embedded_view_set(options.page_id, 'options', options); if (!options.success) { return; } options.results = results; - var html = theme('views_view', options); - options.success(html); + + // Render the view if there are some results, or if there are no results and an + // empty_callback has been specified. Otherwise remove the empty div container for + // the view from the DOM. + if (results.view.count != 0 || results.view.count == 0 && options.empty_callback) { + options.success(theme('views_view', options)); + } + else { + var elem = document.getElementById(options.attributes.id); + elem.parentElement.removeChild(elem); + } } catch (error) { console.log('views_embed_view - success - ' + error); @@ -14612,9 +14742,12 @@ function theme_views_view(variables) { } } - // Render the exposed filters, if there are any. + // Render the exposed filters if there are any, and the developer didn't explicitly exclude + // them via the Views Render Array. var views_exposed_form_html = ''; - if (typeof results.view.exposed_data !== 'undefined') { + if (typeof results.view.exposed_data !== 'undefined' && + (typeof variables.exposed_filters === 'undefined' || variables.exposed_filters) + ) { views_exposed_form_html = drupalgap_get_form( 'views_exposed_form', { exposed_data: results.view.exposed_data, @@ -14649,7 +14782,7 @@ function theme_views_view(variables) { function_exists(variables.empty_callback) ) { var empty_callback = window[variables.empty_callback]; - return views_exposed_form_html + empty_callback(results.view); + return views_exposed_form_html + drupalgap_render(empty_callback(results.view)); } return html + views_exposed_form_html; } diff --git a/bin/drupalgap-7.0.2.min.js b/bin/drupalgap-7.0.2.min.js new file mode 100644 index 00000000..bbf43c18 --- /dev/null +++ b/bin/drupalgap-7.0.2.min.js @@ -0,0 +1,7 @@ +/*! drupalgap 2016-08-15 */ +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{var b='"'+a.jqm_page_event+'", "'+a.jqm_page_event_callback+'", '+a.jqm_page_event_args;arguments[1]&&(b+=', "'+arguments[1]+'"');var c='";return c}catch(d){console.log("drupalgap_jqm_page_event_script_code - "+d)}}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){try{if(1==Drupal.user.uid)return!0;var b=!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 c in drupalgap.menu_links[a].access_arguments)if(drupalgap.menu_links[a].access_arguments.hasOwnProperty(c)){var d=drupalgap.menu_links[a].access_arguments[c];if(b=user_access(d))break}}else b=!0;else{var e=drupalgap.menu_links[a].access_callback;if(drupalgap_function_exists(e)){var f=window[e];if(drupalgap.menu_links[a].access_arguments){var g=drupalgap.menu_links[a].access_arguments.slice(0);if(arguments[2]){var h=arguments[2];for(var c in g)if(g.hasOwnProperty(c)){var i=g[c];if(is_int(parseInt(i))){g[c]=h;break}}}return f.apply(null,Array.prototype.slice.call(g))}return f()}console.log("drupalgap_menu_access - access call back ("+e+") does not exist")}else console.log("drupalgap_menu_access - path ("+a+") does not exist");return b}catch(j){console.log("drupalgap_menu_access - "+j)}}function drupalgap_module_load(a){try{return module_load(a)}catch(b){console.log("drupalgap_module_load - "+b)}}function drupalgap_modules_get_bundle_directory(a){try{return dir="","core"==a?dir="modules":"contrib"==a?dir="app/modules":"custom"==a&&(dir="app/modules/custom"),dir}catch(b){console.log("drupalgap_modules_get_bundle_directory - "+b)}}function drupalgap_place_args_in_path(a){try{var b=!1;if(a){var c=drupalgap_path_get();arguments[1]&&(c=arguments[1]);var d,e=arg(null,c),f=arg(null,a);if(f&&f.length>0){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){h.html('
  • '),h.listview("refresh"),_theme_autocomplete_success_handlers[d]=function(a,b,c,d){try{if(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 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="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="";if(d+=_drupalgap_region_render_zone("_prefix",a,c),drupalgap.settings.blocks[drupalgap.settings.theme][a.name]){a.attributes["class"]||(a.attributes["class"]=""),a.attributes["class"]+=" region_"+a.name+" ",d+="
    ";var e=0,f=0;if(a.links&&a.links.length>0){var g=0,h=0;for(var i in a.links)if(a.links.hasOwnProperty(i)){var j=a.links[i],k=menu_region_link_get_data(j);if(drupalgap_check_visibility("region",k)){e++;var m=drupalgap_link_get_class(j);if(m){var n=menu_region_link_get_side(m);"left"==n?g++:"right"==n&&h++}}}for(var o="",p="",q=0;q1){var v={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-left"};o="
    "+o.replace(/ui-btn-left/g,"")+"
    "}if(h>1){var v={"data-type":"horizontal","data-role":"controlgroup","class":"ui-btn-right"};p="
    "+p.replace(/ui-btn-right/g,"")+"
    "}d+=o+p}var w={block_count:0,block_menu_count:0},x=drupalgap.settings.blocks[drupalgap.settings.theme][a.name];for(var y in x)if(x.hasOwnProperty(y)){var z=x[y];"_prefix"!=y&&"_suffix"!=y&&(d+=drupalgap_block_render(a,c,y,z,w))}(in_array(a.attributes["data-role"],["header","footer"])&&(0==w.block_count&&e>0||w.block_count-w.block_menu_count==0)||e>0&&f>=w.block_menu_count&&0==w.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(A){console.log("drupalgap_render_region - "+A)}}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){var d=["theme","view_mode","language"];if(a.markup)return a.markup;if(a.theme&&drupalgap.theme_registry[a.theme]){var e=drupalgap.theme_registry[a.theme],f=a.theme.replace(/_/g,"-")+".tpl.html",g=e.path+"/"+f;if(drupalgap_file_exists(g)){var h=drupalgap_file_get_contents(g);if(h){var i=drupalgap_get_placeholders_from_html(h);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]}h=h.replace("{:"+k+":}",l)}c+=h}else console.log("drupalgap_render - failed to get file contents ("+g+")")}else console.log("drupalgap_render - template file does not exist ("+g+")")}for(var m in a)if(a.hasOwnProperty(m)){var n=a[m];-1==$.inArray(m,d)&&(c+=theme("undefined"==typeof n.theme?null:n.theme,n))}}return c}function path_to_theme(){try{return drupalgap.theme_path?drupalgap.theme_path:(console.log("path_to_theme - drupalgap.theme_path is not set!"),!1)}catch(a){console.log("path_to_theme - "+a)}}function theme(a,b){try{if(b||(b={}),"undefined"!=typeof b.access&&!b.access)return"";if(b.markup)return b.markup;var c="";if(!a)return c;var d=drupalgap.settings.theme+"_"+a;if(!function_exists(d)&&(d="theme_"+a,!function_exists(d))){var e=null;arguments.callee.caller&&(e=arguments.callee.caller.name);var f="WARNING: "+d+"() does not exist.";return e&&(f+=" Called by: "+e+"()."),console.log(f),c}"undefined"!=typeof b.attributes&&b.attributes||(b.options&&b.options.attributes?b.attributes=b.options.attributes:b.attributes={}),b.attributes["class"]||(b.attributes["class"]="");var g=window[d];return c=g.call(null,b)}catch(h){console.log("theme - "+h)}}function theme_button(a){try{a.attributes["data-role"]="button";var b=""+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="
    <"+type+">"+a.text+"
    ";return b}catch(c){console.log("theme_header - "+c)}}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 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]="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))}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"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(h){console.log("drupalgap_views_get_result_formats - "+h)}}function drupalgap_views_render_rows(a,b,c,d,e,f){try{var g="";for(var h in b[c])if(b[c].hasOwnProperty(h)){var i=b[c][h],j=i[d];j._position=h;var k="";a.row_callback&&function_exists(a.row_callback)?(row_callback=window[a.row_callback],k=row_callback(b.view,j)):k=JSON.stringify(j),g+=e+k+f}return g}catch(l){console.log("drupalgap_views_render_rows - "+l)}}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 diff --git a/cordova.index.html b/cordova.index.html index 150417ed..c1aacf51 100644 --- a/cordova.index.html +++ b/cordova.index.html @@ -16,10 +16,10 @@ - + - + diff --git a/default.index.html b/default.index.html index 231d8c9f..a05432cd 100644 --- a/default.index.html +++ b/default.index.html @@ -16,10 +16,10 @@ - + - + diff --git a/index.html b/index.html index 231d8c9f..a05432cd 100644 --- a/index.html +++ b/index.html @@ -16,10 +16,10 @@ - + - + diff --git a/jdrupal-7.0.4.min.js b/jdrupal-7.0.4.min.js deleted file mode 100644 index 124a324e..00000000 --- a/jdrupal-7.0.4.min.js +++ /dev/null @@ -1,2 +0,0 @@ -function drupal_init(){try{Drupal||(Drupal={}),Drupal.csrf_token=!1,Drupal.sessid=null,Drupal.user=drupal_user_defaults(),Drupal.settings={app_directory:"app",base_path:"/",cache:{entity:{enabled:!1,expiration:3600},views:{enabled:!1,expiration:3600}},debug:!1,endpoint:"",file_public_path:"sites/default/files",language_default:"und",site_path:""},Drupal.includes={},Drupal.includes.module={},Drupal.modules={core:{},contrib:{},custom:{}},Drupal.services_queue={comment:{retrieve:{}},file:{retrieve:{}},node:{retrieve:{}},taxonomy_term:{retrieve:{}},taxonomy_vocabulary:{retrieve:{}},user:{retrieve:{}}},Drupal.cache_expiration=window.localStorage.getItem("cache_expiration"),Drupal.cache_expiration?Drupal.cache_expiration=JSON.parse(Drupal.cache_expiration):Drupal.cache_expiration={entities:{}}}catch(a){console.log("drupal_init - "+a)}}function date(a){try{var b=null,c=null;arguments[1]?(c=arguments[1],"string"==typeof c&&(c=parseInt(c)),b=new Date(c)):(b=new Date,c=b.getTime());for(var d="",e=0;ei?"am":"pm","A"==f&&(d=d.toUpperCase());break;case"g":var i=b.getHours();0==i||23==i?i=12:i%=12,d+=""+i;break;case"G":var i=""+b.getHours();d+=i;break;case"H":var i=""+b.getHours();1==i.length&&(i="0"+i),d+=i;break;case"i":var j=""+b.getMinutes();1==j.length&&(j="0"+j),d+=j;break;default:d+=f}}return d}catch(k){console.log("date - "+k)}}function dpm(a){try{"undefined"!=typeof a?("function"==typeof parent.window.ripple?"undefined"!=typeof arguments[1]&&0==arguments[1]?console.log(JSON.stringify(a)):console.log(a):"object"==typeof a&&console.log(JSON.stringify(a)),""==a?console.log(""):console.log(a)):console.log("")}catch(b){console.log("dpm - "+b)}}function drupal_user_defaults(){try{return{uid:"0",roles:{1:"anonymous user"},permissions:[]}}catch(a){console.log("drupal_user_defaults - "+a)}}function empty(a){try{return null===a?!0:"object"==typeof a?0===Object.keys(a).length:"undefined"==typeof a||""==a}catch(b){console.log("empty - "+b)}}function function_exists(name){try{return"function"==eval("typeof "+name)}catch(error){alert("function_exists - "+error)}}function http_status_code_title(a){try{var b="";switch(a){case 200:b="OK";break;case 401:b="Unauthorized";break;case 404:b="Not Found";break;case 406:b="Not Acceptable";break;case 500:b="Internal Server Error"}return b}catch(c){console.log("http_status_code_title - "+c)}}function in_array(a,b){try{if("undefined"==typeof b)return!1;if("string"==typeof a)return b.indexOf(a)>-1;for(var c=!1,d=0;d0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a}catch(e){console.log("shuffle - "+e)}}function time(){var a=new Date;return Math.floor(a/1e3)}function ucfirst(a){a+="";var b=a.charAt(0).toUpperCase();return b+a.substr(1)}function module_implements(a){try{var b=[];if(a)for(var c=module_types(),d=0;db.expiration}function entity_clean_local_storage(){if(entity_caching_enabled()&&Drupal.cache_expiration.entities)for(var a in Drupal.cache_expiration.entities)if(Drupal.cache_expiration.entities.hasOwnProperty(a)){var b=Drupal.cache_expiration.entities[a];if(!(b>time())){delete Drupal.cache_expiration.entities[a];var c=a.split("_"),d=c[0],e=c[1];_entity_local_storage_delete(d,e),window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}}}function _entity_get_expiration_time(a,b){try{var c=null,d=entity_get_bundle(a,b);if(entity_caching_enabled(a,d)){var c=0,e=Drupal.settings.cache;"undefined"!==e.entity.expiration&&(c=e.entity.expiration),"undefined"!==e.entity.entity_types&&(e.entity.entity_types[a]&&"undefined"!=typeof e.entity.entity_types[a].expiration&&(c=e.entity.entity_types[a].expiration),d&&e.entity.entity_types[a]&&e.entity.entity_types[a].bundles&&e.entity.entity_types[a].bundles[d]&&"undefined"!=typeof e.entity.entity_types[a].bundles[d].expiration&&(c=e.entity.entity_types[a].bundles[d].expiration))}return c&&(c+=time()),c}catch(f){console.log("_entity_get_expiration_time - "+f)}}function _entity_set_expiration_time(a,b){try{b.expiration=_entity_get_expiration_time(a,b)}catch(c){console.log("_entity_set_expiration_time - "+c)}}function entity_types(){try{return["comment","file","node","taxonomy_term","taxonomy_vocabulary","user"]}catch(a){console.log("entity_types - "+a)}}function _entity_index_local_storage_load(a,b,c){try{var d=!1;c&&c.reset&&_entity_index_local_storage_delete(b);var e=entity_index_local_storage_key(b);if(d=window.localStorage.getItem(e))if(d=JSON.parse(d),"undefined"!=typeof d.expiration&&0!=d.expiration&&time()>d.expiration)_entity_index_local_storage_delete(b),d=!1;else{for(var f=[],g=0;gd;d++)b+=c.charAt(Math.floor(Math.random()*c.length));return b}catch(e){console.log("user_password - "+e)}}function services_get_csrf_token(a){try{var b;if(a.reset&&(Drupal.sessid=null),Drupal.sessid&&(b=Drupal.sessid),b)return void(a.success&&a.success(b));var c=new XMLHttpRequest,d=Drupal.settings.site_path+Drupal.settings.base_path+"?q=services/session/token";c.onload=function(e){try{if(4==c.readyState){var f=c.status+" - "+http_status_code_title(c.status);200!=c.status?(console.log(d+" - "+f),console.log(c.responseText)):(b=c.responseText,Drupal.sessid=b,a.success&&a.success(b))}else console.log("services_get_csrf_token - readyState - "+c.readyState)}catch(g){console.log("services_get_csrf_token - token_request. onload - "+g)}},c.open("GET",d,!0),c.send(null)}catch(e){console.log("services_get_csrf_token - "+e)}}function services_ready(){try{var a=!0;return""==Drupal.settings.site_path&&(a=!1,console.log("jDrupal's Drupal.settings.site_path is not set!")),""==Drupal.settings.endpoint&&(a=!1,console.log("jDrupal's Drupal.settings.endpoint is not set!")),a}catch(b){console.log("services_ready - "+b)}}function services_resource_defaults(a,b,c){try{a.service||(a.service=b),a.resource||(a.resource=c)}catch(d){console.log("services_resource_defaults - "+d)}}function _services_queue_already_queued(a,b,c,d){try{var e=!1;if("undefined"!=typeof Drupal.services_queue[a][b][c]){var f=Drupal.services_queue[a][b][c];0!=f[d].length&&(e=!0)}return e}catch(g){console.log("_services_queue_already_queued - "+g)}}function _services_queue_add_to_queue(a,b,c){try{Drupal.services_queue[a][b][c]={entity_id:c,success:[],error:[]}}catch(d){console.log("_services_queue_add_to_queue - "+d)}}function _services_queue_remove_from_queue(a,b,c){try{console.log("WARNING: services_queue_remove_from_queue() not done yet!")}catch(d){console.log("_services_queue_remove_from_queue - "+d)}}function _services_queue_callback_add(a,b,c,d,e){try{Drupal.services_queue[a][b][c][d].push(e)}catch(f){console.log("_services_queue_callback_add - "+f)}}function _services_queue_callback_count(a,b,c,d){try{var e=Drupal.services_queue[a][b][c][d].length;return e}catch(f){console.log("_services_queue_callback_count - "+f)}}function comment_create(a,b){try{services_resource_defaults(b,"comment","create"),entity_create("comment",null,a,b)}catch(c){console.log("comment_create - "+c)}}function comment_retrieve(a,b){try{services_resource_defaults(b,"comment","retrieve"),entity_retrieve("comment",a,b)}catch(c){console.log("comment_retrieve - "+c)}}function comment_update(a,b){try{services_resource_defaults(b,"comment","update"),entity_update("comment",null,a,b)}catch(c){console.log("comment_update - "+c)}}function comment_delete(a,b){try{services_resource_defaults(b,"comment","delete"),entity_delete("comment",a,b)}catch(c){console.log("comment_delete - "+c)}}function comment_index(a,b){try{services_resource_defaults(b,"comment","index"),entity_index("comment",a,b)}catch(c){console.log("comment_index - "+c)}}function entity_create(a,b,c,d){try{Drupal.services.call({method:"POST",async:d.async,path:a+".json",service:d.service,resource:d.resource,entity_type:a,bundle:b,data:JSON.stringify(c),success:function(a){try{d.success&&d.success(a)}catch(b){console.log("entity_create - success - "+b)}},error:function(a,b,c){try{d.error&&d.error(a,b,c)}catch(e){console.log("entity_create - error - "+e)}}})}catch(e){console.log("entity_create - "+e)}}function entity_retrieve(a,b,c){try{Drupal.services.call({method:"GET",path:a+"/"+b+".json",service:c.service,resource:c.resource,entity_type:a,entity_id:b,success:function(a){try{c.success&&c.success(a)}catch(b){console.log("entity_retrieve - success - "+b)}},error:function(a,b,d){try{c.error&&c.error(a,b,d)}catch(e){console.log("entity_retrieve - error - "+e)}}})}catch(d){console.log("entity_retrieve - "+d)}}function entity_update(a,b,c,d){try{var e=_entity_wrap(a,c),f=entity_primary_key(a),g=JSON.stringify(e);Drupal.services.call({method:"PUT",path:a+"/"+c[f]+".json",service:d.service,resource:d.resource,entity_type:a,entity_id:c[entity_primary_key(a)],bundle:b,data:g,success:function(b){try{_entity_local_storage_delete(a,c[f]),d.success&&d.success(b)}catch(e){console.log("entity_update - success - "+e)}},error:function(a,b,c){try{d.error&&d.error(a,b,c)}catch(e){console.log("entity_update - error - "+e)}}})}catch(h){console.log("entity_update - "+h)}}function entity_delete(a,b,c){try{Drupal.services.call({method:"DELETE",path:a+"/"+b+".json",service:c.service,resource:c.resource,entity_type:a,entity_id:b,success:function(d){try{_entity_local_storage_delete(a,b),c.success&&c.success(d)}catch(e){console.log("entity_delete - success - "+e)}},error:function(a,b,d){try{c.error&&c.error(a,b,d)}catch(e){console.log("entity_delete - error - "+e)}}})}catch(d){console.log("entity_delete - "+d)}}function entity_index(a,b,c){try{var d;"object"==typeof b?d=entity_index_build_query_string(b):"string"==typeof b&&(d=b),d=d?"&"+d:"";var e=a+".json"+d,f=entity_caching_enabled(a);if(f){var g=_entity_index_local_storage_load(a,e,{});if(g&&c.success)return void c.success(g)}Drupal.services.call({method:"GET",path:e,service:c.service,resource:c.resource,entity_type:a,success:function(d){try{if(c.success){if(f&&b.options&&b.options.entity_load){for(var g=0;gi?"am":"pm","A"==f&&(d=d.toUpperCase());break;case"g":var i=b.getHours();0==i||23==i?i=12:i%=12,d+=""+i;break;case"G":var i=""+b.getHours();d+=i;break;case"H":var i=""+b.getHours();1==i.length&&(i="0"+i),d+=i;break;case"i":var j=""+b.getMinutes();1==j.length&&(j="0"+j),d+=j;break;default:d+=f}}return d}catch(k){console.log("date - "+k)}}function dpm(a){try{"undefined"!=typeof a?("function"==typeof parent.window.ripple?"undefined"!=typeof arguments[1]&&0==arguments[1]?console.log(JSON.stringify(a)):console.log(a):"object"==typeof a&&console.log(JSON.stringify(a)),""==a?console.log(""):console.log(a)):console.log("")}catch(b){console.log("dpm - "+b)}}function drupal_user_defaults(){try{return{uid:"0",roles:{1:"anonymous user"},permissions:[]}}catch(a){console.log("drupal_user_defaults - "+a)}}function empty(a){try{return null===a?!0:"object"==typeof a?0===Object.keys(a).length:"undefined"==typeof a||""==a}catch(b){console.log("empty - "+b)}}function function_exists(name){try{return"function"==eval("typeof "+name)}catch(error){alert("function_exists - "+error)}}function http_status_code_title(a){try{var b="";switch(a){case 200:b="OK";break;case 401:b="Unauthorized";break;case 404:b="Not Found";break;case 406:b="Not Acceptable";break;case 500:b="Internal Server Error"}return b}catch(c){console.log("http_status_code_title - "+c)}}function in_array(a,b){try{if("undefined"==typeof b)return!1;if("string"==typeof a)return b.indexOf(a)>-1;for(var c=!1,d=0;d0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a}catch(e){console.log("shuffle - "+e)}}function time(){var a=new Date;return Math.floor(a/1e3)}function ucfirst(a){a+="";var b=a.charAt(0).toUpperCase();return b+a.substr(1)}function module_implements(a){try{var b=[];if(a)for(var c=module_types(),d=0;db.expiration}function entity_clean_local_storage(){if(Drupal.cache_expiration.entities)for(var a in Drupal.cache_expiration.entities)if(Drupal.cache_expiration.entities.hasOwnProperty(a)){var b=Drupal.cache_expiration.entities[a];if(!(b>time())){delete Drupal.cache_expiration.entities[a];var c=a.split("_"),d=c[0],e=c[1];_entity_local_storage_delete(d,e),window.localStorage.setItem("cache_expiration",JSON.stringify(Drupal.cache_expiration))}}}function _entity_get_expiration_time(a,b){try{var c=null,d=entity_get_bundle(a,b);if(entity_caching_enabled(a,d)){var c=0,e=Drupal.settings.cache;"undefined"!==e.entity.expiration&&(c=e.entity.expiration),"undefined"!==e.entity.entity_types&&(e.entity.entity_types[a]&&"undefined"!=typeof e.entity.entity_types[a].expiration&&(c=e.entity.entity_types[a].expiration),d&&e.entity.entity_types[a]&&e.entity.entity_types[a].bundles&&e.entity.entity_types[a].bundles[d]&&"undefined"!=typeof e.entity.entity_types[a].bundles[d].expiration&&(c=e.entity.entity_types[a].bundles[d].expiration))}return c&&(c+=time()),c}catch(f){console.log("_entity_get_expiration_time - "+f)}}function _entity_set_expiration_time(a,b){try{b.expiration=_entity_get_expiration_time(a,b)}catch(c){console.log("_entity_set_expiration_time - "+c)}}function entity_types(){try{return["comment","file","node","taxonomy_term","taxonomy_vocabulary","user"]}catch(a){console.log("entity_types - "+a)}}function _entity_index_local_storage_load(a,b,c){try{var d=!1;c&&c.reset&&_entity_index_local_storage_delete(b);var e=entity_index_local_storage_key(b);if(d=window.localStorage.getItem(e))if(d=JSON.parse(d),"undefined"!=typeof d.expiration&&0!=d.expiration&&time()>d.expiration)_entity_index_local_storage_delete(b),d=!1;else{for(var f=[],g=0;gd;d++)b+=c.charAt(Math.floor(Math.random()*c.length));return b}catch(e){console.log("user_password - "+e)}}function services_get_csrf_token(a){try{var b;if(a.reset&&(Drupal.sessid=null),Drupal.sessid&&(b=Drupal.sessid),b)return void(a.success&&a.success(b));var c=new XMLHttpRequest;a.token_url=Drupal.settings.site_path+Drupal.settings.base_path+"?q=services/session/token",module_invoke_all("csrf_token_preprocess",a),c.onload=function(d){try{if(4==c.readyState){c.status+" - "+http_status_code_title(c.status);200!=c.status?a.error&&a.error(c,c.status,c.responseText):(b=c.responseText,Drupal.sessid=b,a.success&&a.success(b))}else console.log("services_get_csrf_token - readyState - "+c.readyState)}catch(e){console.log("services_get_csrf_token - token_request. onload - "+e)}},c.open("GET",a.token_url,!0),c.send(null)}catch(d){console.log("services_get_csrf_token - "+d)}}function services_ready(){try{var a=!0;return""==Drupal.settings.site_path&&(a=!1,console.log("jDrupal's Drupal.settings.site_path is not set!")),""==Drupal.settings.endpoint&&(a=!1,console.log("jDrupal's Drupal.settings.endpoint is not set!")),a}catch(b){console.log("services_ready - "+b)}}function services_resource_defaults(a,b,c){try{a.service||(a.service=b),a.resource||(a.resource=c)}catch(d){console.log("services_resource_defaults - "+d)}}function _services_queue_already_queued(a,b,c,d){try{var e=!1;if("undefined"!=typeof Drupal.services_queue[a][b][c]){var f=Drupal.services_queue[a][b][c];0!=f[d].length&&(e=!0)}return e}catch(g){console.log("_services_queue_already_queued - "+g)}}function _services_queue_add_to_queue(a,b,c){try{Drupal.services_queue[a][b][c]={entity_id:c,success:[],error:[]}}catch(d){console.log("_services_queue_add_to_queue - "+d)}}function _services_queue_clear(a,b,c,d){try{Drupal.services_queue[a].retrieve[c][d]=[]}catch(e){console.log("_services_queue_clear - "+e)}}function _services_queue_remove_from_queue(a,b,c){try{console.log("WARNING: services_queue_remove_from_queue() not done yet!")}catch(d){console.log("_services_queue_remove_from_queue - "+d)}}function _services_queue_callback_add(a,b,c,d,e){try{Drupal.services_queue[a][b][c][d].push(e)}catch(f){console.log("_services_queue_callback_add - "+f)}}function _services_queue_callback_count(a,b,c,d){try{var e=Drupal.services_queue[a][b][c][d].length;return e}catch(f){console.log("_services_queue_callback_count - "+f)}}function comment_create(a,b){try{services_resource_defaults(b,"comment","create"),entity_create("comment",null,a,b)}catch(c){console.log("comment_create - "+c)}}function comment_retrieve(a,b){try{services_resource_defaults(b,"comment","retrieve"),entity_retrieve("comment",a,b)}catch(c){console.log("comment_retrieve - "+c)}}function comment_update(a,b){try{services_resource_defaults(b,"comment","update"),entity_update("comment",null,a,b)}catch(c){console.log("comment_update - "+c)}}function comment_delete(a,b){try{services_resource_defaults(b,"comment","delete"),entity_delete("comment",a,b)}catch(c){console.log("comment_delete - "+c)}}function comment_index(a,b){try{services_resource_defaults(b,"comment","index"),entity_index("comment",a,b)}catch(c){console.log("comment_index - "+c)}}function entity_create(a,b,c,d){try{Drupal.services.call({method:"POST",async:d.async,path:a+".json",service:d.service,resource:d.resource,entity_type:a,bundle:b,data:JSON.stringify(c),success:function(a){try{d.success&&d.success(a)}catch(b){console.log("entity_create - success - "+b)}},error:function(a,b,c){try{d.error&&d.error(a,b,c)}catch(e){console.log("entity_create - error - "+e)}}})}catch(e){console.log("entity_create - "+e)}}function entity_retrieve(a,b,c){try{Drupal.services.call({method:"GET",path:a+"/"+b+".json",service:c.service,resource:c.resource,entity_type:a,entity_id:b,success:function(a){try{c.success&&c.success(a)}catch(b){console.log("entity_retrieve - success - "+b)}},error:function(a,b,d){try{c.error&&c.error(a,b,d)}catch(e){console.log("entity_retrieve - error - "+e)}}})}catch(d){console.log("entity_retrieve - "+d)}}function entity_update(a,b,c,d){try{var e=_entity_wrap(a,c),f=entity_primary_key(a),g=JSON.stringify(e);Drupal.services.call({method:"PUT",path:a+"/"+c[f]+".json",service:d.service,resource:d.resource,entity_type:a,entity_id:c[entity_primary_key(a)],bundle:b,data:g,success:function(b){try{_entity_local_storage_delete(a,c[f]),d.success&&d.success(b)}catch(e){console.log("entity_update - success - "+e)}},error:function(a,b,c){try{d.error&&d.error(a,b,c)}catch(e){console.log("entity_update - error - "+e)}}})}catch(h){console.log("entity_update - "+h)}}function entity_delete(a,b,c){try{Drupal.services.call({method:"DELETE",path:a+"/"+b+".json",service:c.service,resource:c.resource,entity_type:a,entity_id:b,success:function(d){try{_entity_local_storage_delete(a,b),c.success&&c.success(d)}catch(e){console.log("entity_delete - success - "+e)}},error:function(a,b,d){try{c.error&&c.error(a,b,d)}catch(e){console.log("entity_delete - error - "+e)}}})}catch(d){console.log("entity_delete - "+d)}}function entity_index(a,b,c){try{var d;"object"==typeof b?d=entity_index_build_query_string(b):"string"==typeof b&&(d=b),d=d?"&"+d:"";var e=a+".json"+d,f=entity_caching_enabled(a);if(f){var g=_entity_index_local_storage_load(a,e,{});if(g&&c.success)return void c.success(g)}Drupal.services.call({method:"GET",path:e,service:c.service,resource:c.resource,entity_type:a,query:b,success:function(d){try{if(c.success){if(f&&b.options&&b.options.entity_load){for(var g=0;g