Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 6d503ab41c2527afd6ce432d28e73856c5f08a60 @dpirek committed Nov 1, 2011
Showing with 6,106 additions and 0 deletions.
  1. BIN .DS_Store
  2. BIN app/.DS_Store
  3. BIN app/admin/.DS_Store
  4. +176 −0 app/admin/Init.js
  5. BIN app/admin/content/.DS_Store
  6. +406 −0 app/admin/content/css/1.css
  7. BIN app/admin/content/images/.DS_Store
  8. BIN app/admin/content/images/icons/.DS_Store
  9. BIN app/admin/content/images/icons/arrow_left.gif
  10. BIN app/admin/content/images/icons/arrow_right.gif
  11. +47 −0 app/admin/controllers/Admin.js
  12. +130 −0 app/admin/controllers/Blog.js
  13. +100 −0 app/admin/controllers/Comment.js
  14. +14 −0 app/admin/controllers/Dash.js
  15. +122 −0 app/admin/controllers/File.js
  16. +131 −0 app/admin/controllers/Page.js
  17. +49 −0 app/admin/controllers/Template.js
  18. +176 −0 app/admin/controllers/User.js
  19. +127 −0 app/admin/controllers/Zone.js
  20. +55 −0 app/admin/index.html
  21. +175 −0 app/admin/install.html
  22. BIN app/admin/library/.DS_Store
  23. +14 −0 app/admin/library/MVC.config.js
  24. +199 −0 app/admin/library/MVC.html.js
  25. +41 −0 app/admin/library/MVC.message.js
  26. +70 −0 app/admin/library/MVC.service.js
  27. +35 −0 app/admin/library/MVC.session.js
  28. +39 −0 app/admin/library/MVC.util.js
  29. +149 −0 app/admin/library/MVC.util.string.js
  30. +375 −0 app/admin/library/jquery/jquery.MVC.js
  31. +58 −0 app/admin/library/jquery/jquery.ajaxForm.js
  32. +590 −0 app/admin/library/jquery/jquery.min.js
  33. +10 −0 app/admin/library/jquery/jquery.tmpl.min.js
  34. +88 −0 app/admin/login.html
  35. BIN app/admin/views/.DS_Store
  36. +18 −0 app/admin/views/Admin/Index.html
  37. +37 −0 app/admin/views/Blog/Create.html
  38. +39 −0 app/admin/views/Blog/Edit.html
  39. +36 −0 app/admin/views/Blog/Index.html
  40. +30 −0 app/admin/views/Comment/Index.html
  41. +14 −0 app/admin/views/Dash/Index.html
  42. +33 −0 app/admin/views/File/Index.html
  43. +21 −0 app/admin/views/File/Upload.html
  44. +38 −0 app/admin/views/Page/Create.html
  45. +39 −0 app/admin/views/Page/Edit.html
  46. +32 −0 app/admin/views/Page/Index.html
  47. +24 −0 app/admin/views/Template/Index.html
  48. +48 −0 app/admin/views/User/Create.html
  49. +37 −0 app/admin/views/User/Edit.html
  50. +44 −0 app/admin/views/User/Index.html
  51. +29 −0 app/admin/views/User/View.html
  52. +32 −0 app/admin/views/Zone/Create.html
  53. +29 −0 app/admin/views/Zone/Edit.html
  54. +37 −0 app/admin/views/Zone/Index.html
  55. BIN app/content/.DS_Store
  56. +231 −0 app/content/css/CMS.css
  57. +155 −0 app/content/css/FNG.css
  58. BIN app/content/files/.DS_Store
  59. BIN app/content/files/sss.png
  60. BIN app/content/images/bc.png
  61. BIN app/content/images/e723b5e7-62cf-45d2-84f5-eb0f44f08c99.png
  62. BIN app/content/images/header_bc.png
  63. BIN app/content/js/.DS_Store
  64. +103 −0 app/content/js/init.js
  65. +97 −0 app/controllers/blog.js
  66. +118 −0 app/controllers/json.blog.js
  67. +29 −0 app/controllers/json.file.js
  68. +79 −0 app/controllers/json.page.js
  69. +25 −0 app/controllers/json.template.js
  70. +156 −0 app/controllers/json.user.js
  71. +58 −0 app/controllers/json.zone.js
  72. +123 −0 app/controllers/page.js
  73. +51 −0 app/lib/file.js
  74. +32 −0 app/lib/html.helpers.js
  75. +18 −0 app/lib/jquery.js
  76. +174 −0 app/lib/json.routes.js
  77. +66 −0 app/lib/loader.js
  78. +71 −0 app/lib/routes.js
  79. +112 −0 app/lib/service.js
  80. +76 −0 app/lib/util.array.js
  81. +51 −0 app/lib/util.image.js
  82. +76 −0 app/lib/util.string.js
  83. +65 −0 app/models/menu.js
  84. +51 −0 app/server.js
  85. BIN app/views/.DS_Store
  86. +39 −0 app/views/blog/detail.html
  87. +24 −0 app/views/blog/index.html
  88. +21 −0 app/views/page/index.html
  89. +12 −0 config.js
BIN .DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,176 @@
+(function ($, service) {
+
+ // Local HTML helper.
+ var html = {
+ menu: function(d){
+
+ // Define string builder.
+ var sb = MVC.util.string.stringBuilder();
+
+ $.each(d, function(i, d){
+
+ if(d.items){
+
+ // Bild child tags.
+ var childItems = MVC.util.string.stringBuilder();
+
+ $.each(d.items, function(i, d){
+ childItems.append(d.url + ' ');
+ });
+
+ sb.append('<li><a href="#' + d.url + '" childUrls="' + childItems.toString() + '">' + d.text + '</a></li>');
+ } else {
+ sb.append('<li><a href="#' + d.url + '">' + d.text + '</a></li>');
+ }
+ });
+
+ return sb.toString();
+ },
+ sideMenu: function(d){
+
+ var sb = MVC.util.string.stringBuilder();
+
+ $.each(d, function(i, d){
+ sb.append('<li><a href="#' + d.url + '">' + d.text + '</a></li>');
+ });
+
+ return '';
+ }
+ };
+
+ var messageElm = $("#message_content"),
+ content = $("#content");
+
+ // Bind logout
+ $('#user_logout').click(function () {
+
+ service.send({
+ url: 'user/logout',
+ success: function (d) {
+ window.location = 'admin/login.html';
+ }
+ });
+
+ return false;
+ });
+
+ // Authentizate:
+ service.get({
+ url: 'user/getsession',
+ success: function (d) {
+ //d.isSucessful = true;
+ if (d.isSucessful) {
+
+ // Set user session.
+ MVC.session.set('user', d.data);
+
+ // Menu.
+ var menuObj = d.data.menuItems,
+ menuHtml = $(html.menu(menuObj)),
+ nav = $('#nav'),
+ sideNav = $('.left_nav');
+
+ var sideMenuObj = {};
+ /**/
+ $.each(menuObj, function(i, d){
+
+ var firstLevelChildren = d.items;
+
+ if(firstLevelChildren){
+ sideMenuObj[d.url] = firstLevelChildren;
+
+ // Add child mapping.
+ $.each(firstLevelChildren, function(i, d){
+ sideMenuObj[d.url] = firstLevelChildren;
+ });
+ }
+ });
+
+ // Add top nav items.
+ nav.append(menuHtml);
+
+ // Put user name in the top bar.
+ $('#user_profile_email').text(d.data.userName);
+
+ content.html('<div class="padding"><p>Loading...</p></div>');
+
+ // Plugin init.
+ content.MVC({
+ rootPath: 'admin/',
+ viewsPath: "views/",
+ controllersPath: "controllers/",
+ routes: [
+ {
+ name: "Default2", // Name
+ path: "{controller}/{action}/{p1}/{p2}/{p3}", // Path.
+ params: { controller: "Dash", action: "Index", p1: "1", p2: "10", p3: ""} // Defaults.
+ }
+ ],
+ errorMessage: "<div class='padding'><h1>503 <span>Page</span></h1><p><strong>Ups, something went wrong...</strong></p></div>",
+ start: function () {
+ messageElm.text("loading...").show();
+
+ // Show loader.
+ MVC.message.showLoader();
+ },
+ success: function (d) {
+
+ MVC.message.hideLoader();
+
+ var controllerName = d.actionObject.controller,
+ allMenuItems = $('a', menuHtml),
+ currentMenuItem = $('a:[href^="#' + controllerName + '"]', menuHtml),
+ childMenuItemParent = $('a:[childUrls*="' + controllerName + '"]', menuHtml);
+
+ // Remove highliting.
+ allMenuItems.removeClass('selected');
+
+ // Add highlighting.
+ currentMenuItem.addClass('selected');
+ childMenuItemParent.addClass('selected')
+
+ // Build side nav.
+ if(sideMenuObj[controllerName]){
+
+ var sideNavHtml = $(html.menu(sideMenuObj[controllerName]));
+
+ sideNav.html(sideNavHtml);
+
+ var allSideMenuItems = $('a', sideNavHtml),
+ currentSideMenuItem = $('a:[href^="#' + controllerName + '"]', sideNavHtml);
+
+ // Remove highliting.
+ allSideMenuItems.removeClass('selected');
+
+ // Add highlighting.
+ currentSideMenuItem.addClass('selected');
+ // Side nav highlighting.
+
+ } else {
+ sideNav.html('');
+ }
+
+ $('#header').fadeIn();
+ $('#main').fadeIn();
+
+ // Build side Menu.
+ //menuHtml = $(html.menu(menuObj));
+ //sideMenu
+
+ messageElm.hide().text("");
+ },
+ error: function (ex) {
+
+ MVC.message.hideLoader();
+
+ messageElm.text(ex).show();
+ }
+ });
+
+ } else {
+ //content.html('<div class="padding"><p>You are not logged in!</p></div>');
+ window.location = 'admin/login.html';
+ }
+ }
+ });
+} (jQuery, MVC.service));
Binary file not shown.
Oops, something went wrong.

0 comments on commit 6d503ab

Please sign in to comment.