Commit b391a4f49dde332725d1638a05d14de96a125fce

Authored by Jarrett
1 parent c8f198dd

Updated folder template structures

Commited By: Jarrett Jordaan

Reviewed By: Megan Watson
dashboard.php
@@ -146,9 +146,14 @@ class DashboardDispatcher extends KTStandardDispatcher { @@ -146,9 +146,14 @@ class DashboardDispatcher extends KTStandardDispatcher {
146 146
147 // 147 //
148 function runFirstLoginWizard($oTemplate, $aTemplateData) { 148 function runFirstLoginWizard($oTemplate, $aTemplateData) {
  149 + //$this->oPage->requireCSSResource('setup/wizard/resources/css/wizard.css');
  150 + $this->oPage->requireCSSResource('setup/wizard/resources/css/modal.css');
  151 + //$this->oPage->requireCSSResource('setup/wizard/resources/css/firstlogin.css');
  152 +
149 $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery-1.3.2.min.js'); 153 $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery-1.3.2.min.js');
150 $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery_noconflict.js'); 154 $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery_noconflict.js');
151 $this->oPage->requireJSResource('setup/wizard/resources/js/firstlogin.js'); 155 $this->oPage->requireJSResource('setup/wizard/resources/js/firstlogin.js');
  156 +
152 } 157 }
153 158
154 // return some kind of ID for each dashlet 159 // return some kind of ID for each dashlet
setup/firstlogin/steps/firstloginComplete.php
@@ -64,15 +64,32 @@ class firstloginComplete extends Step { @@ -64,15 +64,32 @@ class firstloginComplete extends Step {
64 $this->temp_variables = array( 64 $this->temp_variables = array(
65 "step_name"=>"complete", 65 "step_name"=>"complete",
66 "silent"=>$this->silent); 66 "silent"=>$this->silent);
67 - return $this->doRun(); 67 + if(!$this->inStep("complete")) {
  68 + return $this->doRun();
  69 + }
  70 + if($this->next()) { // Next click
  71 + $this->completeWizard(); // Apply folder template structures
  72 + return 'login'; // And go to next step
  73 + }
  74 +
  75 + return 'landing';
68 } 76 }
69 77
70 function doRun() { 78 function doRun() {
71 - $this->util->deleteFirstLogin(); 79 + $ft_dir = "";
  80 + if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active
  81 + $oRegistry =& KTPluginRegistry::getSingleton();
  82 + $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin
  83 + $ft_dir = $oPlugin->getDirs();
  84 + }
  85 + $this->temp_variables['ft_dir'] = $ft_dir;
  86 +
72 return 'landing'; 87 return 'landing';
73 } 88 }
74 89
75 - 90 + function completeWizard() {
  91 + $this->util->deleteFirstLogin();
  92 + }
76 93
77 public function getErrors() { 94 public function getErrors() {
78 return $this->error; 95 return $this->error;
setup/firstlogin/steps/firstloginTemplates.php
@@ -86,7 +86,14 @@ class firstloginTemplates extends Step { @@ -86,7 +86,14 @@ class firstloginTemplates extends Step {
86 } 86 }
87 87
88 function doRun() { 88 function doRun() {
  89 + $ft_dir = "";
  90 + if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active
  91 + $oRegistry =& KTPluginRegistry::getSingleton();
  92 + $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin
  93 + $ft_dir = $oPlugin->getDirs();
  94 + }
89 $this->temp_variables['aFolderTemplates'] = $this->getTemplates(); 95 $this->temp_variables['aFolderTemplates'] = $this->getTemplates();
  96 + $this->temp_variables['ft_dir'] = $ft_dir;
90 return 'landing'; 97 return 'landing';
91 } 98 }
92 99
setup/firstlogin/templates/complete.tpl
@@ -6,8 +6,10 @@ @@ -6,8 +6,10 @@
6 <input type="submit" name="Next" value="Finish" class="button_next"/> 6 <input type="submit" name="Next" value="Finish" class="button_next"/>
7 </form> 7 </form>
8 <script type="text/javascript"> 8 <script type="text/javascript">
9 - $("form").bind("submit", function() {  
10 - closeFirstLogin(); 9 + var fl = new firstlogin('<?php echo WIZARD_ROOTURL; ?>', '<?php echo $ft_dir; ?>');
  10 + jQuery("form").bind("submit", function() {
  11 + fl.closeFirstLogin();
  12 + fl.postComplete();
11 return false; 13 return false;
12 }); 14 });
13 </script> 15 </script>
setup/firstlogin/templates/templates.tpl
@@ -49,7 +49,8 @@ @@ -49,7 +49,8 @@
49 <input id="next" type="submit" name="Next" value="Next" class="button_next"/> 49 <input id="next" type="submit" name="Next" value="Next" class="button_next"/>
50 </form> 50 </form>
51 <script type="text/javascript"> 51 <script type="text/javascript">
52 - $("form").bind("submit", function() { 52 + var fl = new firstlogin('<?php echo WIZARD_ROOTURL; ?>', '<?php echo $ft_dir; ?>');
  53 + jQuery("form").bind("submit", function() {
53 fl.sendFirstLoginForm(); 54 fl.sendFirstLoginForm();
54 return false; 55 return false;
55 }); 56 });
setup/firstlogin/templates/wizard.tpl
@@ -4,9 +4,7 @@ @@ -4,9 +4,7 @@
4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon"> 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 <title>KnowledgeTree Installer</title> 5 <title>KnowledgeTree Installer</title>
6 <?php echo $html->tpjs('jquery-1.3.2.js'); ?> 6 <?php echo $html->tpjs('jquery-1.3.2.js'); ?>
7 - <?php echo $html->js('jquery.form.js'); ?>  
8 - <?php echo $html->js('jquery.blockUI.js'); ?>  
9 - <?php echo $html->js('jquery.hotkeys.js'); ?> 7 + <?php echo $html->tpjs('jquery_noconflict.js'); ?>
10 <?php echo $html->js('firstlogin.js'); ?> 8 <?php echo $html->js('firstlogin.js'); ?>
11 <?php echo $html->css('firstlogin.css'); ?> 9 <?php echo $html->css('firstlogin.css'); ?>
12 <?php echo $html->css('wizard.css'); ?> 10 <?php echo $html->css('wizard.css'); ?>
setup/wizard/lib/helpers/htmlHelper.php
@@ -103,7 +103,7 @@ class htmlHelper { @@ -103,7 +103,7 @@ class htmlHelper {
103 } 103 }
104 104
105 function tpjs($name) { 105 function tpjs($name) {
106 - return "<script type=\"text/javascript\" src=\"".WIZARD_ROOTURL."thirdpartyjs/jquery/$name\"></script>"; 106 + return "<script type=\"text/javascript\" src=\"".WIZARD_ROOTURL."/thirdpartyjs/jquery/$name\"></script>";
107 } 107 }
108 108
109 function js($name) { 109 function js($name) {
setup/wizard/path.php
@@ -133,8 +133,8 @@ @@ -133,8 +133,8 @@
133 } else { 133 } else {
134 define('INSTALL_TYPE', 'community'); 134 define('INSTALL_TYPE', 'community');
135 } 135 }
136 - define('WIZARD_ROOTURL',guessRootUrl().DS); # Used by template resources  
137 - define('WIZARD_SETUP',WIZARD_ROOTURL . "setup"); 136 + define('WIZARD_ROOTURL',guessRootUrl()); # Used by template resources
  137 + define('WIZARD_SETUP',WIZARD_ROOTURL . DS . "setup");
138 138
139 function guessRootUrl() { 139 function guessRootUrl() {
140 $urlpath = $_SERVER['SCRIPT_NAME']; 140 $urlpath = $_SERVER['SCRIPT_NAME'];
setup/wizard/resources/css/modal.css 0 โ†’ 100644
  1 +#mask {
  2 + position:absolute;
  3 + left:0;
  4 + top:0;
  5 + z-index:9000;
  6 + background-color:#000;
  7 + display:none;
  8 +}
  9 +
  10 +#boxes .window {
  11 + position:absolute;
  12 + left:0;
  13 + top:0;
  14 + width:440px;
  15 + height:200px;
  16 + display:none;
  17 + z-index:9999;
  18 + padding:20px;
  19 +}
  20 +
  21 +#boxes #dialog {
  22 + width:375px;
  23 + height:203px;
  24 + padding:10px;
  25 + background-color:#ffffff;
  26 +}
0 \ No newline at end of file 27 \ No newline at end of file
setup/wizard/resources/js/firstlogin.js
@@ -2,15 +2,17 @@ var win; @@ -2,15 +2,17 @@ var win;
2 2
3 jQuery(function() { // Document is ready 3 jQuery(function() { // Document is ready
4 if(jQuery("#wrapper").attr('class') != 'wizard') {// Check if we in a wizard, or on the dashboard 4 if(jQuery("#wrapper").attr('class') != 'wizard') {// Check if we in a wizard, or on the dashboard
5 - showForm(); // Display first login wizard 5 + if(jQuery("#firstlogin").attr('id') != 'firstlogin') {// Check if we in a wizard, or on the dashboard
  6 + showForm(); // Display first login wizard, once and only once!!!
  7 + }
6 } 8 }
7 }); 9 });
8 10
9 // Class First Login 11 // Class First Login
10 function firstlogin(rootUrl, pluginHandle) { 12 function firstlogin(rootUrl, pluginHandle) {
11 - this.rootUrl = rootUrl;  
12 - this.ktfolderAccess = rootUrl + pluginHandle + "?action=";  
13 - this.ktmanageFolderAccess = rootUrl + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; 13 + this.rootUrl = rootUrl + "/";
  14 + this.ktfolderAccess = rootUrl + "/" + pluginHandle + "?action=";
  15 + this.ktmanageFolderAccess = rootUrl + "/" + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action=";
14 this.ajaxOn = false; 16 this.ajaxOn = false;
15 } 17 }
16 18
@@ -58,37 +60,58 @@ firstlogin.prototype.showNodeOptions = function() { @@ -58,37 +60,58 @@ firstlogin.prototype.showNodeOptions = function() {
58 * Create the dialog 60 * Create the dialog
59 */ 61 */
60 var showForm = function() { 62 var showForm = function() {
61 - createForm(); // Populate the form  
62 - this.win = new Ext.Window({ // create the window  
63 - applyTo : 'firstlogin',  
64 - layout : 'fit',  
65 - width : 800,  
66 - height : 500,  
67 - closeAction :'destroy',  
68 - y : 75,  
69 - shadow: false,  
70 - modal: true  
71 - });  
72 - this.win.show();  
73 -}  
74 -  
75 -var createForm = function() {  
76 var holder = "<div id='firstlogin'></div>"; 63 var holder = "<div id='firstlogin'></div>";
77 jQuery("#pageBody").append(holder); // Append to current dashboard 64 jQuery("#pageBody").append(holder); // Append to current dashboard
  65 + var mask = "<div id='mask'></div>";
  66 + jQuery("#firstlogin").append(mask); // Append to current dashboard
  67 + var dialog = '<div id="boxes"><div id="dialog" class="window"></div></div>';
  68 + jQuery("#firstlogin").append(dialog); // Append to current dashboard
  69 + createModal();
78 var address = "setup/firstlogin/index.php"; 70 var address = "setup/firstlogin/index.php";
79 - getUrl(address, "firstlogin"); // Pull in existing wizard 71 + getUrl(address, "dialog"); // Pull in existing wizard
80 } 72 }
81 73
  74 +var createModal = function() {
  75 + //Get the tag
  76 + var id = "#dialog";
  77 +
  78 + //Get the screen height and width
  79 + var maskHeight = jQuery(document).height();
  80 + var maskWidth = jQuery(window).width();
  81 +
  82 + //Set heigth and width to mask to fill up the whole screen
  83 + jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
  84 +
  85 + //transition effect
  86 + jQuery('#mask').fadeIn(1000);
  87 + jQuery('#mask').fadeTo("slow",0.8);
  88 +
  89 + //Get the window height and width
  90 + var winH = jQuery(window).height();
  91 + var winW = jQuery(window).width();
  92 +
  93 + //Set the popup window to center
  94 + jQuery(id).css('top', 0);
  95 + jQuery(id).css('left', 200);
  96 + jQuery(id).css('background', 'transparent');
  97 + //transition effect
  98 + jQuery(id).fadeIn(2000);
  99 +}
  100 +
  101 +
  102 +
82 // Send request and update a div 103 // Send request and update a div
83 var getUrl = function (address, div) { 104 var getUrl = function (address, div) {
84 jQuery.ajax({ 105 jQuery.ajax({
85 url: address, 106 url: address,
86 - dataType: "html", 107 + dataType: "HTML",
87 type: "POST", 108 type: "POST",
88 cache: false, 109 cache: false,
89 success: function(data) { 110 success: function(data) {
90 - jQuery("#"+div).empty();  
91 - jQuery("#"+div).append(data); 111 + if(div != "" || div != undefined) {
  112 + jQuery("#"+div).empty();
  113 + jQuery("#"+div).append(data);
  114 + }
92 } 115 }
93 }); 116 });
94 } 117 }
@@ -96,14 +119,9 @@ var getUrl = function (address, div) { @@ -96,14 +119,9 @@ var getUrl = function (address, div) {
96 /* 119 /*
97 * Close the popup 120 * Close the popup
98 */ 121 */
99 -var closeFirstLogin = function () {  
100 - this.win.destroy();  
101 - jQuery('.ext-el-mask').each( // TODO : Why does overlay hang around?  
102 - function() {  
103 - jQuery(this).remove();  
104 - }  
105 - );  
106 - 122 +firstlogin.prototype.closeFirstLogin = function () {
  123 + jQuery('#mask').remove();
  124 + jQuery('.window').remove();
107 } 125 }
108 126
109 // Node clicked 127 // Node clicked
@@ -127,5 +145,10 @@ firstlogin.prototype.sendFirstLoginForm = function() { @@ -127,5 +145,10 @@ firstlogin.prototype.sendFirstLoginForm = function() {
127 var templateId = jQuery("#selectedTemplate").val(); 145 var templateId = jQuery("#selectedTemplate").val();
128 var action = jQuery("#step_name_templates").attr('action'); 146 var action = jQuery("#step_name_templates").attr('action');
129 var address = this.rootUrl + "setup/firstlogin/" + action + "&templateId=" + templateId + "&Next=Next"; 147 var address = this.rootUrl + "setup/firstlogin/" + action + "&templateId=" + templateId + "&Next=Next";
130 - getUrl(address, 'firstlogin'); 148 + getUrl(address, 'dialog');
  149 +}
  150 +
  151 +firstlogin.prototype.postComplete = function() {
  152 + var address = this.rootUrl + "setup/firstlogin/index.php?step_name=complete&Next=Next";
  153 + getUrl(address, ""); // Pull in existing wizard
131 } 154 }