Commit 922181ad59177fffc3fc0339698f3417c91ab775
1 parent
dac083c1
Daily Commit
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
6 changed files
with
175 additions
and
48 deletions
setup/firstlogin/steps/firstloginTemplates.php
| ... | ... | @@ -70,6 +70,7 @@ class firstloginTemplates extends Step { |
| 70 | 70 | "step_name"=>"templates", |
| 71 | 71 | "silent"=>$this->silent); |
| 72 | 72 | if(!$this->inStep("templates")) { // Landing |
| 73 | + $this->doRun(); // Set folder structure templates | |
| 73 | 74 | return 'landing'; |
| 74 | 75 | } |
| 75 | 76 | if($this->next()) { // Next click |
| ... | ... | @@ -89,7 +90,16 @@ class firstloginTemplates extends Step { |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | 92 | function applyTemplates() { |
| 93 | + $templateId = KTUtil::arrayGet($_POST['data'], "templateId", 0); | |
| 94 | + if($templateId > 0) { | |
| 95 | + if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active | |
| 96 | + $oRegistry =& KTPluginRegistry::getSingleton(); | |
| 97 | + $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin | |
| 98 | + return $oPlugin->applyFolderTemplate($templateId, 1); | |
| 99 | + } | |
| 100 | + } | |
| 92 | 101 | |
| 102 | + return false; | |
| 93 | 103 | } |
| 94 | 104 | |
| 95 | 105 | function getTemplates() { | ... | ... |
setup/firstlogin/templates/templates.tpl
| 1 | 1 | <form id="<?php echo $step_name; ?>" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> |
| 2 | - <p class="title">Apply Applying Templates</p> | |
| 2 | + <p class="title">Apply Templates</p> | |
| 3 | 3 | <p class="description">You can select a base folder layout to apply to your root folder of KnowledgeTree.</p> |
| 4 | 4 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 5 | 5 | <div class="field "> |
| 6 | 6 | <p class="descriptiveText">Choose a template, if you would like to generate predefined folders.</p> |
| 7 | - <p class="errorMessage"></p> | |
| 8 | - <select name="data[templateId]"> | |
| 9 | - <option selected="selected" value="">- No template -</option> | |
| 10 | - <?php | |
| 11 | - foreach ($aFolderTemplates as $oFolderTemplate) { | |
| 12 | - echo "<option onclick=\"javascript:{showFolderTemplateTree('{$oFolderTemplate->getId()}')}\" value=\"{$oFolderTemplate->getId()}\">".$oFolderTemplate->getName()."</option>"; | |
| 13 | - } | |
| 14 | - ?> | |
| 15 | - </select> | |
| 16 | - </div> | |
| 17 | - <div id="templates_tree"> | |
| 18 | - <table cellspacing="0" class="tree_table"> | |
| 19 | - <?php | |
| 20 | - foreach ($aFolderTemplates as $oFolderTemplate) { | |
| 7 | + <p class="errorMessage"></p> | |
| 8 | + <select name="data[templateId]"> | |
| 9 | + <option selected="selected" value="">- No template -</option> | |
| 10 | + <?php | |
| 11 | + foreach ($aFolderTemplates as $oFolderTemplate) { | |
| 12 | + echo "<option onclick=\"javascript:{fl.showFolderTemplateTree('{$oFolderTemplate->getId()}')}\" value=\"{$oFolderTemplate->getId()}\">".$oFolderTemplate->getName()."</option>"; | |
| 13 | + } | |
| 21 | 14 | ?> |
| 22 | - <tr style="display:none;" id="template_<?php echo $oFolderTemplate->getId(); ?>"> | |
| 23 | - <td> | |
| 24 | - <div class="tree_icon tree_folder closed"> </div> | |
| 25 | - </td> | |
| 26 | - <td> | |
| 27 | - <label> | |
| 28 | - <?php echo $oFolderTemplate->getName(); ?> | |
| 29 | - </label> | |
| 30 | - </td> | |
| 31 | - </tr> | |
| 32 | - <tr style="display:none;" id="templates_<?php echo $oFolderTemplate->getId(); ?>"> | |
| 33 | - <?php | |
| 34 | - } | |
| 35 | - ?> | |
| 36 | - </table> | |
| 37 | - </div> | |
| 15 | + </select> | |
| 16 | + </div> | |
| 17 | +<!-- <br>--> | |
| 18 | +<!-- <br>--> | |
| 19 | + Folder Template Layout : | |
| 20 | + <br> | |
| 21 | + <br> | |
| 22 | + <div class="tree_navigation"> | |
| 23 | + <table cellspacing="0" class="tree_table"> | |
| 24 | + <?php | |
| 25 | + foreach ($aFolderTemplates as $oFolderTemplate) { | |
| 26 | + ?> | |
| 27 | + <tr class="templates" style="display:none;" id="template_<?php echo $oFolderTemplate->getId(); ?>"> | |
| 28 | + <td> | |
| 29 | + <div class="tree_icon tree_folder closed"> </div> | |
| 30 | + </td> | |
| 31 | + <td> | |
| 32 | + <label> | |
| 33 | + <?php | |
| 34 | + echo $oFolderTemplate->getName(); | |
| 35 | + ?> | |
| 36 | + </label> | |
| 37 | + </td> | |
| 38 | + </tr> | |
| 39 | + <tr> | |
| 40 | + <td id="templates_<?php echo $oFolderTemplate->getId(); ?>" class="templates"></td> | |
| 41 | + </tr> | |
| 42 | + <?php | |
| 43 | + } | |
| 44 | + ?> | |
| 45 | + </table> | |
| 46 | + </div> | |
| 38 | 47 | </div> |
| 39 | 48 | <input type="submit" name="Skip" value="Skip" class="button_skip"/> |
| 40 | 49 | <input type="submit" name="Next" value="Next" class="button_next"/> | ... | ... |
setup/firstlogin/templates/wizard.tpl
| ... | ... | @@ -8,8 +8,8 @@ |
| 8 | 8 | <?php echo $html->js('jquery.blockUI.js'); ?> |
| 9 | 9 | <?php echo $html->js('jquery.hotkeys.js'); ?> |
| 10 | 10 | <?php echo $html->js('firstlogin.js'); ?> |
| 11 | - <?php echo $html->css('wizard.css'); ?> | |
| 12 | 11 | <?php echo $html->css('firstlogin.css'); ?> |
| 12 | + <?php echo $html->css('wizard.css'); ?> | |
| 13 | 13 | <?php if(AGENT == "IE6") echo $html->css('ie6.css'); ?> |
| 14 | 14 | <?php if(AGENT == "IE7") echo $html->css('ie7.css'); ?> |
| 15 | 15 | <?php if(AGENT == "IE8") echo $html->css('ie8.css'); ?> |
| ... | ... | @@ -49,5 +49,5 @@ |
| 49 | 49 | </body> |
| 50 | 50 | </html> |
| 51 | 51 | <script> |
| 52 | - var fl = new firstlogin(); | |
| 52 | + var fl = new firstlogin('<?php echo WIZARD_ROOTURL; ?>'); | |
| 53 | 53 | </script> |
| 54 | 54 | \ No newline at end of file | ... | ... |
setup/wizard/resources/css/firstlogin.css
| ... | ... | @@ -9,4 +9,65 @@ |
| 9 | 9 | float:right; |
| 10 | 10 | margin-left:5px; |
| 11 | 11 | margin-top:10px; |
| 12 | +} | |
| 13 | + | |
| 14 | +.tree_icon { | |
| 15 | + float:left; | |
| 16 | + height:16px; | |
| 17 | + width:16px; | |
| 18 | + cursor: pointer; | |
| 19 | +} | |
| 20 | + | |
| 21 | +.tree_folder { | |
| 22 | + background-image:url(../../../../thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png); | |
| 23 | +} | |
| 24 | + | |
| 25 | +#tree_editable { | |
| 26 | + float : right; | |
| 27 | + width: 700px; | |
| 28 | +} | |
| 29 | + | |
| 30 | +.tree_navigation { | |
| 31 | + align : left; | |
| 32 | + width:600px; | |
| 33 | + min-height: 200px; | |
| 34 | + float:left; | |
| 35 | +} | |
| 36 | + | |
| 37 | +.tree_table { | |
| 38 | + width:100%; | |
| 39 | +} | |
| 40 | + | |
| 41 | +.tree_table td { | |
| 42 | + float:left; | |
| 43 | + line-height:1.8em; | |
| 44 | + padding: 0px 0px; | |
| 45 | +} | |
| 46 | + | |
| 47 | +.outer { | |
| 48 | + align : left; | |
| 49 | +} | |
| 50 | + | |
| 51 | +.tree_node_edit { | |
| 52 | + background-image:url(../../../../thirdparty/icon-theme/16x16/actions/document-properties.png); | |
| 53 | +} | |
| 54 | + | |
| 55 | +.tree_node_delete { | |
| 56 | + background-image:url(../../../../resources/graphics/delete.png); | |
| 57 | +} | |
| 58 | + | |
| 59 | +.tree_node_add { | |
| 60 | + background-image:url(../../../../thirdparty/icon-theme/16x16/actions/add.gif); | |
| 61 | +} | |
| 62 | + | |
| 63 | +.tree_node_description { | |
| 64 | + background-image:url(graphics/question.gif); | |
| 65 | +} | |
| 66 | + | |
| 67 | +#template_options { | |
| 68 | + width : 20px; | |
| 69 | +} | |
| 70 | + | |
| 71 | +.action_form { | |
| 72 | + margin-left:35px; | |
| 12 | 73 | } |
| 13 | 74 | \ No newline at end of file | ... | ... |
setup/wizard/resources/css/wizard.css
setup/wizard/resources/js/firstlogin.js
| 1 | -// Class Wizard | |
| 2 | -var ajaxOn; | |
| 3 | -var ktfolderAccess = "plugins/commercial/folder-templates/KTFolderTemplates.php?action="; | |
| 1 | +// Class First Login | |
| 2 | +//TODO : Plugin path in js | |
| 3 | +var ktfolderAccess = "../../plugins/commercial/folder-templates/KTFolderTemplates.php?action="; | |
| 4 | 4 | var ktmanageFolderAccess = "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; |
| 5 | -var actionForm = false; | |
| 5 | +$(function() { // Document is ready | |
| 6 | + if($("#wrapper").attr('class') != 'wizard') {// Check if we in a wizard, or on the dashboard | |
| 7 | + showForm(); // Display first login wizard | |
| 8 | + } | |
| 9 | +}); | |
| 6 | 10 | |
| 7 | -function firstlogin() { | |
| 11 | +function firstlogin(rootUrl) { | |
| 12 | + this.ktfolderAccess = rootUrl + "plugins/commercial/folder-templates/KTFolderTemplates.php?action="; | |
| 13 | + this.ktmanageFolderAccess = rootUrl + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; | |
| 8 | 14 | this.ajaxOn = false; |
| 9 | 15 | } |
| 10 | 16 | |
| 11 | -var showFolderTemplateTree = function(templateId) { | |
| 12 | - alert($('template_' + templateId).attr('style')); | |
| 13 | - $('template_' + templateId).attr('style', 'display:block'); // Show template | |
| 14 | -// var address = this.ktfolderAccess + "getTemplateNodes&templateId="+templateId; | |
| 15 | -// getUrl("templates_" + templateId, "template_" + templateId, address); | |
| 17 | +firstlogin.prototype.showFolderTemplateTree = function(templateId) { | |
| 18 | + this.hideFolderTemplateTrees(); | |
| 19 | + $('#template_' + templateId).attr('style', 'display:block'); // Show template | |
| 20 | + $('#templates_' + templateId).attr('style', 'display:block'); // Show template nodes | |
| 21 | + this.showFolderTemplateNodes(templateId); | |
| 22 | +} | |
| 23 | + | |
| 24 | +firstlogin.prototype.openNode = function(node_id) { | |
| 25 | + var address = this.ktfolderAccess + "getNodes&node_id="+node_id + "&firstlogin=1"; | |
| 26 | + this.nodeAction("nodes_" + node_id, "node_" + node_id, address); | |
| 27 | +} | |
| 28 | + | |
| 29 | +firstlogin.prototype.openTemplate = function(templateId) { | |
| 30 | + var address = this.ktfolderAccess + "getTemplateNodes&templateId="+templateId + "&firstlogin=1"; | |
| 31 | + this.nodeAction("templates_" + templateId, "template_" + templateId, address); | |
| 32 | +} | |
| 33 | + | |
| 34 | +firstlogin.prototype.showFolderTemplateNodes = function(templateId) { | |
| 35 | + var address = this.ktfolderAccess + "getTemplateNodes&templateId=" + templateId + "&firstlogin=1"; | |
| 36 | + getUrl(address, "templates_" + templateId); | |
| 37 | +} | |
| 38 | + | |
| 39 | +firstlogin.prototype.hideFolderTemplateTrees = function() { | |
| 40 | + $('.templates').each( | |
| 41 | + function() { | |
| 42 | + $(this).attr('style', 'display:none'); | |
| 43 | + } | |
| 44 | + ); | |
| 45 | + $('.template_nodes').each( | |
| 46 | + function() { | |
| 47 | + $(this).attr('style', 'display:none'); | |
| 48 | + } | |
| 49 | + ); | |
| 50 | +} | |
| 51 | + | |
| 52 | +firstlogin.prototype.showNodeOptions = function() { | |
| 53 | + | |
| 16 | 54 | } |
| 17 | 55 | |
| 18 | 56 | /* |
| ... | ... | @@ -55,7 +93,17 @@ var getUrl = function (address, div) { |
| 55 | 93 | }); |
| 56 | 94 | } |
| 57 | 95 | |
| 58 | -$(function() { // Document is ready | |
| 59 | - if($("#wrapper").attr('class') != 'wizard') // Check if we in a wizard, or on the dashboard | |
| 60 | - showForm(); // Display first login wizard | |
| 61 | -}); | |
| 96 | +// Node clicked | |
| 97 | +firstlogin.prototype.nodeAction = function(updateContentDiv, updateDiv, address) { | |
| 98 | + var className = $("#"+updateDiv).attr('class'); | |
| 99 | + state = className.split(' '); | |
| 100 | + if(state[2] == 'closed') { | |
| 101 | + getUrl(address, updateContentDiv); | |
| 102 | + $("#"+updateDiv).attr('class', 'tree_icon tree_folder open'); // Replace the closed class name to open | |
| 103 | + } else { | |
| 104 | + $("#"+updateContentDiv).empty(); // Empty out that tree. | |
| 105 | + $("#"+updateDiv).attr('class', 'tree_icon tree_folder closed'); // Replace the opened class name to close | |
| 106 | + } | |
| 107 | +} | |
| 108 | + | |
| 109 | + | ... | ... |