Devices / Device Profiles - Edit: Permission adjustments.
This commit is contained in:
parent
84f61ae7d6
commit
6c37a5e125
|
|
@ -755,37 +755,47 @@
|
||||||
echo "<div class='action_bar' id='action_bar'>\n";
|
echo "<div class='action_bar' id='action_bar'>\n";
|
||||||
echo " <div class='heading'><b>".$text['header-device']."</b></div>\n";
|
echo " <div class='heading'><b>".$text['header-device']."</b></div>\n";
|
||||||
echo " <div class='actions'>\n";
|
echo " <div class='actions'>\n";
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'devices.php']);
|
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'devices.php']);
|
||||||
if (permission_exists("device_line_password") && $device_template == "grandstream/wave") {
|
if ($action == 'update') {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','onclick'=>"$('#qr_code_container').fadeIn(400);"]);
|
$button_margin = 'margin-left: 15px;';
|
||||||
}
|
if (permission_exists("device_line_password") && $device_template == "grandstream/wave") {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-provision'],'icon'=>'fax','link'=>PROJECT_PATH."/app/devices/cmd.php?cmd=check_sync&profile=".urlencode($sip_profile_name)."&user=".urlencode($user_id)."@".urlencode($server_address)."&domain=".urlencode($server_address)."&agent=".urlencode($device_vendor)]);
|
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','style'=>$button_margin,'onclick'=>"$('#qr_code_container').fadeIn(400);"]);
|
||||||
if (permission_exists("device_files")) {
|
unset($button_margin);
|
||||||
//get the template directory
|
}
|
||||||
$prov = new provision;
|
echo button::create(['type'=>'button','label'=>$text['button-provision'],'icon'=>'fax','style'=>$button_margin,'link'=>PROJECT_PATH."/app/devices/cmd.php?cmd=check_sync&profile=".urlencode($sip_profile_name)."&user=".urlencode($user_id)."@".urlencode($server_address)."&domain=".urlencode($server_address)."&agent=".urlencode($device_vendor)]);
|
||||||
$prov->domain_uuid = $domain_uuid;
|
unset($button_margin);
|
||||||
$template_dir = $prov->template_dir;
|
if (permission_exists("device_files")) {
|
||||||
$files = glob($template_dir.'/'.$device_template.'/*');
|
//get the template directory
|
||||||
//add file buttons and the file list
|
$prov = new provision;
|
||||||
echo button::create(['type'=>'button','id'=>'button_files','label'=>$text['button-files'],'icon'=>$_SESSION['theme']['button_icon_download'],'onclick'=>'show_files()']);
|
$prov->domain_uuid = $domain_uuid;
|
||||||
echo "<select class='formfld' style='display: none; width: auto;' name='target_file' id='target_file' onchange='download(this.value)'>\n";
|
$template_dir = $prov->template_dir;
|
||||||
echo " <option value=''>".$text['label-download']."</option>\n";
|
$files = glob($template_dir.'/'.$device_template.'/*');
|
||||||
foreach ($files as $file) {
|
//add file buttons and the file list
|
||||||
//format the mac address and
|
echo button::create(['type'=>'button','id'=>'button_files','label'=>$text['button-files'],'icon'=>$_SESSION['theme']['button_icon_download'],'onclick'=>'show_files()']);
|
||||||
$format = new provision();
|
echo "<select class='formfld' style='display: none; width: auto;' name='target_file' id='target_file' onchange='download(this.value)'>\n";
|
||||||
$mac = $format->format_mac($device_mac_address, $device_vendor);
|
echo " <option value=''>".$text['label-download']."</option>\n";
|
||||||
//render the file name
|
foreach ($files as $file) {
|
||||||
$file_name = str_replace("{\$mac}", $mac, basename($file));
|
//format the mac address and
|
||||||
//add the select option
|
$format = new provision();
|
||||||
echo " <option value='".basename($file)."'>".$file_name."</option>\n";
|
$mac = $format->format_mac($device_mac_address, $device_vendor);
|
||||||
}
|
//render the file name
|
||||||
echo " </select>";
|
$file_name = str_replace("{\$mac}", $mac, basename($file));
|
||||||
}
|
//add the select option
|
||||||
if (permission_exists('device_add') && $action == 'update') {
|
echo " <option value='".basename($file)."'>".$file_name."</option>\n";
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".escape($device_uuid)."&mac=' + new_mac; }"]);
|
}
|
||||||
}
|
echo " </select>";
|
||||||
if (permission_exists('device_delete') && $action == 'update') {
|
}
|
||||||
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]);
|
if (permission_exists('device_add')) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".escape($device_uuid)."&mac=' + new_mac; }"]);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
permission_exists('device_delete') ||
|
||||||
|
permission_exists('device_line_delete') ||
|
||||||
|
permission_exists('device_key_delete') ||
|
||||||
|
permission_exists('device_setting_delete')
|
||||||
|
) {
|
||||||
|
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
|
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
|
||||||
echo " </div>\n";
|
echo " </div>\n";
|
||||||
|
|
|
||||||
|
|
@ -363,14 +363,20 @@
|
||||||
echo " <div class='heading'><b>".$text['title-device_profile']."</b></div>\n";
|
echo " <div class='heading'><b>".$text['title-device_profile']."</b></div>\n";
|
||||||
echo " <div class='actions'>\n";
|
echo " <div class='actions'>\n";
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'device_profiles.php']);
|
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'device_profiles.php']);
|
||||||
$button_margin = 'margin-left: 15px;';
|
if ($action == 'update') {
|
||||||
if (permission_exists('device_profile_add') && $action == 'update') {
|
$button_margin = 'margin-left: 15px;';
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'style'=>$button_margin,'link'=>'device_profile_copy.php?id='.urlencode($device_profile_uuid),'onclick'=>"if (!confirm('".$text['confirm-copy']."')) { this.blur(); return false; }"]);
|
if (permission_exists('device_profile_add')) {
|
||||||
unset($button_margin);
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'style'=>$button_margin,'link'=>'device_profile_copy.php?id='.urlencode($device_profile_uuid),'onclick'=>"if (!confirm('".$text['confirm-copy']."')) { this.blur(); return false; }"]);
|
||||||
}
|
unset($button_margin);
|
||||||
if (permission_exists('device_profile_delete') && $action == 'update') {
|
}
|
||||||
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>$button_margin,'onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]);
|
if (
|
||||||
unset($button_margin);
|
permission_exists('device_profile_delete') ||
|
||||||
|
permission_exists('device_profile_key_delete') ||
|
||||||
|
permission_exists('device_profile_setting_delete')
|
||||||
|
) {
|
||||||
|
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>$button_margin,'onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]);
|
||||||
|
unset($button_margin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
|
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
|
||||||
echo " </div>\n";
|
echo " </div>\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue