Browse Source

Domains - Edit: Sticky Domain Settings action bar.

Nate 5 years ago
parent
commit
ebf0b72511
2 changed files with 29 additions and 14 deletions
  1. 20 2
      core/domain_settings/domain_settings.php
  2. 9 12
      core/domains/domain_edit.php

+ 20 - 2
core/domain_settings/domain_settings.php

@@ -135,9 +135,10 @@
 	}
 	}
 
 
 //show the content
 //show the content
-	echo "<div class='action_bar sub'>\n";
-	echo "	<div class='heading'><b>".$text['header-domain_settings']." (".$num_rows.")</b></div>\n";
+	echo "<div class='action_bar' id='action_bar_sub'>\n";
+	echo "	<div class='heading'><b id='heading_sub'>".$text['header-domain_settings']." (".$num_rows.")</b></div>\n";
 	echo "	<div class='actions'>\n";
 	echo "	<div class='actions'>\n";
+	echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px; display: none;','link'=>'domains.php']);
 	if (permission_exists('domain_setting_add')) {
 	if (permission_exists('domain_setting_add')) {
 		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>PROJECT_PATH."/core/domain_settings/domain_setting_edit.php?domain_uuid=".urlencode($domain_uuid)]);
 		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>PROJECT_PATH."/core/domain_settings/domain_setting_edit.php?domain_uuid=".urlencode($domain_uuid)]);
 	}
 	}
@@ -325,4 +326,21 @@
 	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "</form>\n";
 	echo "</form>\n";
 
 
+//make sub action bar sticky
+	echo "<script>\n";
+
+	echo "	window.addEventListener('scroll', function(){\n";
+	echo "		action_bar_scroll('action_bar_sub', 300, heading_modify, heading_restore);\n";
+	echo "	}, false);\n";
+
+	echo "	function heading_modify() {\n";
+	echo "		document.getElementById('action_bar_sub_button_back').style.display = 'inline-block';\n";
+	echo "	}\n";
+
+	echo "	function heading_restore() {\n";
+	echo "		document.getElementById('action_bar_sub_button_back').style.display = 'none';\n";
+	echo "	}\n";
+
+	echo "</script>\n";
+
 ?>
 ?>

+ 9 - 12
core/domains/domain_edit.php

@@ -17,7 +17,7 @@
 
 
  The Initial Developer of the Original Code is
  The Initial Developer of the Original Code is
  Mark J Crane <[email protected]>
  Mark J Crane <[email protected]>
- Portions created by the Initial Developer are Copyright (C) 2008-2019
+ Portions created by the Initial Developer are Copyright (C) 2008-2020
  the Initial Developer. All Rights Reserved.
  the Initial Developer. All Rights Reserved.
 
 
  Contributor(s):
  Contributor(s):
@@ -669,25 +669,22 @@
 	echo "</td>\n";
 	echo "</td>\n";
 	echo "</tr>\n";
 	echo "</tr>\n";
 
 
-	echo "	<tr>\n";
-	echo "		<td colspan='2' align='right'>\n";
-	if ($action == "update") {
-		echo "		<input type='hidden' name='domain_uuid' value='".escape($domain_uuid)."'>\n";
-	}
-	echo "			<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
-	echo "		</td>\n";
-	echo "	</tr>";
 	echo "</table>";
 	echo "</table>";
 	echo "<br /><br />";
 	echo "<br /><br />";
 
 
+	if ($action == "update") {
+		echo "<input type='hidden' name='domain_uuid' value='".escape($domain_uuid)."'>\n";
+	}
+	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
+
 	echo "</form>";
 	echo "</form>";
 
 
 	if ($action == "update" && permission_exists('domain_setting_view')) {
 	if ($action == "update" && permission_exists('domain_setting_view')) {
-		echo "<br />\n";
-		require "core/domain_settings/domain_settings.php";
+		require $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/domain_settings/domain_settings.php";
+		echo "<br /><br />\n";
 	}
 	}
 
 
 //include the footer
 //include the footer
 	require_once "resources/footer.php";
 	require_once "resources/footer.php";
 
 
-?>
+?>