</script>
<script type="text/javascript" src="js/jsutils/xhr.js">
</script>
+ <script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<button id=seladmin class=startbtn>Administration
</button>
</div>
- <div id=clock></div>
- <div id=roster</div>
- <div id=ideas</div>
- <div id=todo</div>
+ <div id=clock>
+ <div class=head>
+ Time Clock
+ </div>
+ <div class=main>
+ </div>
+ </div>
+ <div id=roster>
+ <div class=head>
+ Roster
+ </div>
+ <div class=main>
+ </div>
+ </div>
+ <div id=ideas>
+ <div class=head>
+ Brainstorming
+ </div>
+ <div class=main>
+ </div>
+ </div>
+ <div id=todo>
+ <div class=head>
+ ToDo
+ </div>
+ <div class=main>
+ </div>
+ </div>
+ <div id=admin>
+ <div class=head>
+ Administration
+ </div>
+ <div id=adminset class=main>
+ <br>
+ Set your initial admin password
+ <br><br>
+ <input type=password
+ placeholder="Password"
+ id=adminpw1 required>
+ <input type=password
+ placeholder="Confirm password"
+ id=adminpw2 required>
+ </div>
+ <div id=adminauth class=main>
+ </div>
+ <div id=adminmain class=main>
+ </div>
+ </div>
</body>
</html>
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* db stores */
+
+var db_admin_store = {
+ keyname: true,
+ keytype: 'autoIncrement',
+ content: {
+ 1: [
+ {
+ 'passswd': "",
+ }
+ ]
+ }
+}
+
},
startup: function() {
cl("starting stafforg app ...");
- // ui
+
+ // idb
+ var stores={
+ 'admin': db_admin_store
+ }
+ idb.init('stafforg',stafforg.dbcb,1,stores);
+
+ // ui will be initialized in db callback
+ },
+ dbcb: function() {
stafforg.activate_subapp('start');
$('.startbtn').click(function(event) {
- cl("clicked "+event.target.id);
- stafforg.event_action(event,'start');
+ var sapp=event.target.id.replace(/^sel/,'');
+ cl("clicked "+event.target.id+", starting "+sapp);
+ stafforg.event_action(sapp,'start');
});
- // db
- },
- dbcb: function() {
},
activate_subapp: function(sapp) {
$('.startbtn').each(function() {
$(sappid).css('display','none');
});
if(sapp=='start') {
- var sappid='#'+sapp;
- $(sappid).css('height','100%');
- $(sappid).css('display','block');
+ $('#start').css('height','100%');
+ $('#start').css('display','block');
+ }
+ else {
+ $('#start').css('display','none');
+ }
+ vert_align_text('.head');
+ switch(sapp) {
+ case 'admin':
+ stafforg.admin_init();
+ break;
+ }
+ },
+ event_action: function(sapp,type) {
+ switch(type) {
+ case 'start':
+ stafforg.activate_subapp(sapp);
+ break;
}
},
- event_action: function() {
+ admin_init: function() {
+ idb.get_item_by_key('admin',1,function(item) {
+ if(item.passwd==undefined) {
+ $('#adminset').css('display','block');
+ $('#adminauth').css('display','none');
+ $('#adminmain').css('display','none');
+ $('#adminpw1').keyup(function() {
+ stafforg.checkpw();
+ });
+ $('#adminpw2').keyup(function() {
+ stafforg.checkpw();
+ });
+ }
+ else {
+ }
+ });
+ },
+ checkpw: function() {
+ var pw1=$('#adminpw1').val();
+ var pw2=$('#adminpw2').val();
+
+ if(pw1=='') {
+ $('#adminpw1').css('border-color','red');
+ return
+ }
+ else {
+ $('#adminpw1').css('border-color','black');
+ }
+
+ if(pw2=='') {
+ $('#adminpw2').css('border-color','grey');
+ return
+ }
+
+ if(pw1!=pw2) {
+ $('#adminpw2').css('border-color','red');
+ return
+ }
+
+ if(pw1==pw2) {
+ alert("yep, i will store this password!");
+ }
}
};