Skip to content

Instantly share code, notes, and snippets.

@joshstrange
Created March 20, 2012 20:19
Show Gist options
  • Save joshstrange/2140883 to your computer and use it in GitHub Desktop.
Save joshstrange/2140883 to your computer and use it in GitHub Desktop.
Debug Code
var icons = [
{
title:"News",
icon: 'images/icon_news_'+settings.iconSize.str+'.png',
content: 'news.js'
},
{
title:"Articles",
icon: 'images/icon_articles_'+settings.iconSize.str+'.png',
content: 'articles.js'
},
{
title:"Photos",
icon: 'images/icon_photos_'+settings.iconSize.str+'.png',
content: 'photos.js'
},
{
title:"Broadcasts",
icon: 'images/icon_broadcasts_'+settings.iconSize.str+'.png',
content: 'broadcasts.js'
},
{
title:"Polls",
icon: 'images/icon_polls_'+settings.iconSize.str+'.png',
content: 'polls.js'
},
{
title:"Pages",
icon: 'images/icon_pages_'+settings.iconSize.str+'.png',
content: 'pages.js'
},
{
title:"Club ShareZ",
icon: 'images/icon_clubsharez_'+settings.iconSize.str+'.png',
content: 'clubsharez.js'
},
{
title:"Help",
icon: 'images/icon_help_'+settings.iconSize.str+'.png',
content: 'help.js'
}
];
for(var i=0;i<icons.length;i++)
{
var iconData = icons[i];
var icon = Ti.UI.createView({
width: settings.iconSize.width,
height: settings.iconSize.height,
opacity: .8,
backgroundColor: '#'+schools[s].tileColor,
borderRadius: 10,
left: ((i%3)+1)*settings.iconSize.spacing + (i%3)*settings.iconSize.width ,
top: (Math.floor(i/3)+1)*15 + Math.floor(i/3)*settings.iconSize.height,
data: iconData,
school: schools[s]
});
/*icon.add(Ti.UI.createImageView({
left: 0,
right:0,
top:0,
bottom:0,
image:Ti.Filesystem.getResourcesDirectory()+ iconData.icon,
data: iconData,
school: schools[s]
}));
icon.add(Ti.UI.createLabel({
color: '#fff',
left: 0,
right:0,
top: settings.iconSize.textOffset,
text: iconData.title,
font: {fontSize: settings.iconSize.fontSize, fontFamily: settings.iconSize.font, fontWeight:'bold'},
textAlign: 'center',
width: 'auto',
height: 'auto',
data: iconData,
school: schools[s]
}));*/
icon.addEventListener('click', function(e) {
settings.activeSchool = this.school;
//eval(Titanium.Filesystem.getFile('views/'+this.data.content).read().text);
Ti.API.error("Step 1: "+getDate());
var news = Ti.UI.createView({
width:settings.width,
top:settings.toolbar.height+'px',
bottom: settings.adBar.height+'px',
});
Ti.API.error("Step 2: "+getDate());
var newsArray = [];
var rows = ihigh.db.execute("SELECT * FROM news where sid=?;", settings.activeSchool.id);
Ti.API.error("Step 3: "+getDate());
while (rows.isValidRow()) {
var row = Ti.UI.createTableViewRow({
width: settings.width,
height: 'auto'
});
row.add(Ti.UI.createLabel({
text: rows.fieldByName('content')
}));
newsArray.push(row);
//alert(rows.fieldByName('content')),
rows.next();
}
Ti.API.error("Step 4: "+getDate());
var newsTable = Titanium.UI.createTableView({data:newsArray});
Ti.API.error("Step 5: "+getDate());
//alert(newsTable.getChildren());
rows.close();
news.add(newsTable);
Ti.API.error("Step 6: "+getDate());
main.remove(ihigh.masterDash);
ihigh.activeView = news;
main.add(ihigh.activeView);
Ti.API.error("Step 7: "+getDate());
//alert(this.data.title+" - "+settings.activeSchool.id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment