diff --git a/dashboard.php b/dashboard.php index 5e62ced..69ec601 100644 --- a/dashboard.php +++ b/dashboard.php @@ -146,9 +146,14 @@ class DashboardDispatcher extends KTStandardDispatcher { // function runFirstLoginWizard($oTemplate, $aTemplateData) { + //$this->oPage->requireCSSResource('setup/wizard/resources/css/wizard.css'); + $this->oPage->requireCSSResource('setup/wizard/resources/css/modal.css'); + //$this->oPage->requireCSSResource('setup/wizard/resources/css/firstlogin.css'); + $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery-1.3.2.min.js'); $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery_noconflict.js'); $this->oPage->requireJSResource('setup/wizard/resources/js/firstlogin.js'); + } // return some kind of ID for each dashlet diff --git a/setup/firstlogin/steps/firstloginComplete.php b/setup/firstlogin/steps/firstloginComplete.php index e6bf350..86489ce 100644 --- a/setup/firstlogin/steps/firstloginComplete.php +++ b/setup/firstlogin/steps/firstloginComplete.php @@ -64,15 +64,32 @@ class firstloginComplete extends Step { $this->temp_variables = array( "step_name"=>"complete", "silent"=>$this->silent); - return $this->doRun(); + if(!$this->inStep("complete")) { + return $this->doRun(); + } + if($this->next()) { // Next click + $this->completeWizard(); // Apply folder template structures + return 'login'; // And go to next step + } + + return 'landing'; } function doRun() { - $this->util->deleteFirstLogin(); + $ft_dir = ""; + if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin + $ft_dir = $oPlugin->getDirs(); + } + $this->temp_variables['ft_dir'] = $ft_dir; + return 'landing'; } - + function completeWizard() { + $this->util->deleteFirstLogin(); + } public function getErrors() { return $this->error; diff --git a/setup/firstlogin/steps/firstloginTemplates.php b/setup/firstlogin/steps/firstloginTemplates.php index b65ee6e..28b23e6 100644 --- a/setup/firstlogin/steps/firstloginTemplates.php +++ b/setup/firstlogin/steps/firstloginTemplates.php @@ -86,7 +86,14 @@ class firstloginTemplates extends Step { } function doRun() { + $ft_dir = ""; + if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin + $ft_dir = $oPlugin->getDirs(); + } $this->temp_variables['aFolderTemplates'] = $this->getTemplates(); + $this->temp_variables['ft_dir'] = $ft_dir; return 'landing'; } diff --git a/setup/firstlogin/templates/complete.tpl b/setup/firstlogin/templates/complete.tpl index e133376..553de77 100644 --- a/setup/firstlogin/templates/complete.tpl +++ b/setup/firstlogin/templates/complete.tpl @@ -6,8 +6,10 @@ diff --git a/setup/firstlogin/templates/templates.tpl b/setup/firstlogin/templates/templates.tpl index 51e5b90..e11a1f4 100644 --- a/setup/firstlogin/templates/templates.tpl +++ b/setup/firstlogin/templates/templates.tpl @@ -49,7 +49,8 @@ "; + return ""; } function js($name) { diff --git a/setup/wizard/path.php b/setup/wizard/path.php index e5d5c8c..c228480 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -133,8 +133,8 @@ } else { define('INSTALL_TYPE', 'community'); } - define('WIZARD_ROOTURL',guessRootUrl().DS); # Used by template resources - define('WIZARD_SETUP',WIZARD_ROOTURL . "setup"); + define('WIZARD_ROOTURL',guessRootUrl()); # Used by template resources + define('WIZARD_SETUP',WIZARD_ROOTURL . DS . "setup"); function guessRootUrl() { $urlpath = $_SERVER['SCRIPT_NAME']; diff --git a/setup/wizard/resources/css/modal.css b/setup/wizard/resources/css/modal.css new file mode 100644 index 0000000..9f077af --- /dev/null +++ b/setup/wizard/resources/css/modal.css @@ -0,0 +1,26 @@ +#mask { + position:absolute; + left:0; + top:0; + z-index:9000; + background-color:#000; + display:none; +} + +#boxes .window { + position:absolute; + left:0; + top:0; + width:440px; + height:200px; + display:none; + z-index:9999; + padding:20px; +} + +#boxes #dialog { + width:375px; + height:203px; + padding:10px; + background-color:#ffffff; +} \ No newline at end of file diff --git a/setup/wizard/resources/js/firstlogin.js b/setup/wizard/resources/js/firstlogin.js index 970ea25..18180dc 100644 --- a/setup/wizard/resources/js/firstlogin.js +++ b/setup/wizard/resources/js/firstlogin.js @@ -2,15 +2,17 @@ var win; jQuery(function() { // Document is ready if(jQuery("#wrapper").attr('class') != 'wizard') {// Check if we in a wizard, or on the dashboard - showForm(); // Display first login wizard + if(jQuery("#firstlogin").attr('id') != 'firstlogin') {// Check if we in a wizard, or on the dashboard + showForm(); // Display first login wizard, once and only once!!! + } } }); // Class First Login function firstlogin(rootUrl, pluginHandle) { - this.rootUrl = rootUrl; - this.ktfolderAccess = rootUrl + pluginHandle + "?action="; - this.ktmanageFolderAccess = rootUrl + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; + this.rootUrl = rootUrl + "/"; + this.ktfolderAccess = rootUrl + "/" + pluginHandle + "?action="; + this.ktmanageFolderAccess = rootUrl + "/" + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; this.ajaxOn = false; } @@ -58,37 +60,58 @@ firstlogin.prototype.showNodeOptions = function() { * Create the dialog */ var showForm = function() { - createForm(); // Populate the form - this.win = new Ext.Window({ // create the window - applyTo : 'firstlogin', - layout : 'fit', - width : 800, - height : 500, - closeAction :'destroy', - y : 75, - shadow: false, - modal: true - }); - this.win.show(); -} - -var createForm = function() { var holder = "
"; jQuery("#pageBody").append(holder); // Append to current dashboard + var mask = "
"; + jQuery("#firstlogin").append(mask); // Append to current dashboard + var dialog = '
'; + jQuery("#firstlogin").append(dialog); // Append to current dashboard + createModal(); var address = "setup/firstlogin/index.php"; - getUrl(address, "firstlogin"); // Pull in existing wizard + getUrl(address, "dialog"); // Pull in existing wizard } +var createModal = function() { + //Get the tag + var id = "#dialog"; + + //Get the screen height and width + var maskHeight = jQuery(document).height(); + var maskWidth = jQuery(window).width(); + + //Set heigth and width to mask to fill up the whole screen + jQuery('#mask').css({'width':maskWidth,'height':maskHeight}); + + //transition effect + jQuery('#mask').fadeIn(1000); + jQuery('#mask').fadeTo("slow",0.8); + + //Get the window height and width + var winH = jQuery(window).height(); + var winW = jQuery(window).width(); + + //Set the popup window to center + jQuery(id).css('top', 0); + jQuery(id).css('left', 200); + jQuery(id).css('background', 'transparent'); + //transition effect + jQuery(id).fadeIn(2000); +} + + + // Send request and update a div var getUrl = function (address, div) { jQuery.ajax({ url: address, - dataType: "html", + dataType: "HTML", type: "POST", cache: false, success: function(data) { - jQuery("#"+div).empty(); - jQuery("#"+div).append(data); + if(div != "" || div != undefined) { + jQuery("#"+div).empty(); + jQuery("#"+div).append(data); + } } }); } @@ -96,14 +119,9 @@ var getUrl = function (address, div) { /* * Close the popup */ -var closeFirstLogin = function () { - this.win.destroy(); - jQuery('.ext-el-mask').each( // TODO : Why does overlay hang around? - function() { - jQuery(this).remove(); - } - ); - +firstlogin.prototype.closeFirstLogin = function () { + jQuery('#mask').remove(); + jQuery('.window').remove(); } // Node clicked @@ -127,5 +145,10 @@ firstlogin.prototype.sendFirstLoginForm = function() { var templateId = jQuery("#selectedTemplate").val(); var action = jQuery("#step_name_templates").attr('action'); var address = this.rootUrl + "setup/firstlogin/" + action + "&templateId=" + templateId + "&Next=Next"; - getUrl(address, 'firstlogin'); + getUrl(address, 'dialog'); +} + +firstlogin.prototype.postComplete = function() { + var address = this.rootUrl + "setup/firstlogin/index.php?step_name=complete&Next=Next"; + getUrl(address, ""); // Pull in existing wizard }