2 * stafforg: crew organizaion app
3 * author: hackbard@hackdaworld.org
8 * Licensed to the Apache Software Foundation (ASF) under one
9 * or more contributor license agreements. See the NOTICE file
10 * distributed with this work for additional information
11 * regarding copyright ownership. The ASF licenses this file
12 * to you under the Apache License, Version 2.0 (the
13 * "License"); you may not use this file except in compliance
14 * with the License. You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing,
19 * software distributed under the License is distributed on an
20 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 * KIND, either express or implied. See the License for the
22 * specific language governing permissions and limitations
28 document.addEventListener('deviceready',this.startup,false);
29 window.addEventListener('orientationchange',function() {
30 setTimeout(function() {
31 cl("orientation change ...");
36 cl("starting stafforg app ...");
40 'admin': db_admin_store
42 idb.init('stafforg',stafforg.dbcb,1,stores);
44 // ui will be initialized in db callback
47 stafforg.activate_subapp('start');
48 $('.startbtn').click(function(event) {
49 var sapp=event.target.id.replace(/^sel/,'');
50 cl("clicked "+event.target.id+", starting "+sapp);
51 stafforg.event_action(sapp,'start');
54 activate_subapp: function(sapp) {
55 $('.startbtn').each(function() {
56 var sappname=this.id.replace(/^sel/,'');
57 var sappid='#'+sappname;
58 $(sappid).css('height','100%');
60 $(sappid).css('display','block');
62 $(sappid).css('display','none');
65 $('#start').css('height','100%');
66 $('#start').css('display','block');
69 $('#start').css('display','none');
71 vert_align_text('.head');
74 stafforg.admin_init();
78 event_action: function(sapp,type) {
81 stafforg.activate_subapp(sapp);
85 admin_init: function() {
86 idb.get_item_by_key('admin',1,function(item) {
87 if(item.passwd==undefined) {
88 $('#adminset').css('display','block');
89 $('#adminauth').css('display','none');
90 $('#adminmain').css('display','none');
91 $('#adminpw1').keyup(function() {
94 $('#adminpw2').keyup(function() {
102 checkpw: function() {
103 var pw1=$('#adminpw1').val();
104 var pw2=$('#adminpw2').val();
107 $('#adminpw1').css('border-color','red');
111 $('#adminpw1').css('border-color','black');
115 $('#adminpw2').css('border-color','grey');
120 $('#adminpw2').css('border-color','red');
125 alert("yep, i will store this password!");
130 $(document).ready(function() {
131 if('cordova' in window) {