diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 6f3f3cfaac..e92e7eb465 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -51,6 +51,10 @@ $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_files'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; $apps[$x]['permissions'][$y]['name'] = "device_extension_view"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index c0667a6139..fe7dbea165 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -1378,6 +1378,19 @@ $text['label-device_mac_address']['de-at'] = "MAC Adresse"; $text['label-device_mac_address']['ar-eg'] = ""; $text['label-device_mac_address']['he'] = ""; +$text['label-download']['en-us'] = "Download"; +$text['label-download']['es-cl'] = ""; +$text['label-download']['pt-pt'] = ""; +$text['label-download']['fr-fr'] = ""; +$text['label-download']['pt-br'] = ""; +$text['label-download']['pl'] = ""; +$text['label-download']['uk'] = ""; +$text['label-download']['sv-se'] = ""; +$text['label-download']['ro'] = ""; +$text['label-download']['de-at'] = ""; +$text['label-download']['ar-eg'] = ""; +$text['label-download']['he'] = ""; + $text['label-device_label']['en-us'] = "Label"; $text['label-device_label']['es-cl'] = "Etiqueta"; $text['label-device_label']['pt-pt'] = "Rótulo"; @@ -2599,6 +2612,32 @@ $text['button-copy']['de-at'] = "Kopieren"; $text['button-copy']['ar-eg'] = "نسخ"; $text['button-copy']['he'] = "העתקה"; +$text['button-files']['en-us'] = "Files"; +$text['button-files']['es-cl'] = ""; +$text['button-files']['pt-pt'] = ""; +$text['button-files']['fr-fr'] = ""; +$text['button-files']['pt-br'] = ""; +$text['button-files']['pl'] = ""; +$text['button-files']['uk'] = ""; +$text['button-files']['sv-se'] = ""; +$text['button-files']['ro'] = ""; +$text['button-files']['de-at'] = ""; +$text['button-files']['ar-eg'] = ""; +$text['button-files']['he'] = ""; + +$text['button-download']['en-us'] = "Download"; +$text['button-download']['es-cl'] = ""; +$text['button-download']['pt-pt'] = ""; +$text['button-download']['fr-fr'] = ""; +$text['button-download']['pt-br'] = ""; +$text['button-download']['pl'] = ""; +$text['button-download']['uk'] = ""; +$text['button-download']['sv-se'] = ""; +$text['button-download']['ro'] = ""; +$text['button-download']['de-at'] = ""; +$text['button-download']['ar-eg'] = ""; +$text['button-download']['he'] = ""; + $text['button-back']['en-us'] = "Back"; $text['button-back']['es-cl'] = "Volver"; $text['button-back']['pt-pt'] = "Voltar"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 20fc4e00c1..6039ea02bb 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -233,6 +233,9 @@ require_once "resources/require.php"; //array cleanup $x = 0; //unset($_POST["autocomplete"]); + unset($_POST["target_file"]); + unset($_POST["file_action"]); + foreach ($_POST["device_lines"] as $row) { //unset the empty row if (strlen($row["line_number"]) == 0) { @@ -515,10 +518,62 @@ require_once "resources/require.php"; }); } + \n"; + echo " var fade_speed = 400;\n"; + echo " function show_files() {\n"; + echo " document.getElementById('file_action').value = 'files';\n"; + echo " $('#button_files').fadeOut(fade_speed, function() {\n"; + echo " $('#button_back_location').fadeOut(fade_speed);\n"; + echo " $('#button_back').fadeIn(fade_speed);\n"; + echo " $('#target_file').fadeIn(fade_speed);\n"; + echo " $('#button_download').fadeIn(fade_speed);\n"; + echo " });"; + echo " }"; + echo " function hide_files() {\n"; + echo " document.getElementById('file_action').value = '';\n"; + echo " $('#button_back_location').fadeIn(fade_speed);\n"; + echo " $('#button_back').fadeOut(fade_speed);\n"; + echo " $('#target_file').fadeOut(fade_speed);\n"; + echo " $('#button_download').fadeOut(fade_speed, function() {\n"; + echo " $('#button_files').fadeIn(fade_speed);\n"; + echo " document.getElementById('target_file').selectedIndex = 0;\n"; + echo " });\n"; + echo " }\n"; + + echo " function download(d) {\n"; + echo " if (d == '".$text['label-download']."') return;\n"; + echo " window.location = 'https://".$_SESSION['domain_name']."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n"; + echo " }\n"; + + echo "\n"; + echo " $( document ).ready(function() {\n"; + echo " $('#default_setting_search').focus();\n"; + if ($search == '') { + echo " // scroll to previous category\n"; + echo " var category_span_id;\n"; + echo " var url = document.location.href;\n"; + echo " var hashindex = url.indexOf('#');\n"; + echo " if (hashindex == -1) { }\n"; + echo " else {\n"; + echo " category_span_id = url.substr(hashindex + 1);\n"; + echo " }\n"; + echo " if (category_span_id) {\n"; + echo " $('#page').animate({scrollTop: $('#anchor_'+category_span_id).offset().top - 200}, 'slow');\n"; + echo " }\n"; + } + echo " });\n"; + echo ""; + } + //show the content echo "