Browse Source

Don't show delete on channels where you don't have +F

Nathaniel van Diepen 10 years ago
parent
commit
c079d5ba22
2 changed files with 11 additions and 5 deletions
  1. 6 2
      site/api/index.php
  2. 5 3
      site/index.php

+ 6 - 2
site/api/index.php

@@ -138,10 +138,14 @@
 							));
 						}
 						$name = preg_replace('/^Access flag\(s\) \+.+ in (.+)$/i','\1',$row);
-						array_push($channels,Array(
+						$chan = array(
 							'name'=>$name,
 							'flags'=>$flags
-						));
+						);
+						if(in_array('F',$flags_list)){
+							$chan['candrop'] = true;
+						}
+						array_push($channels,$chan);
 					}
 				}
 				die('{"code":0,"channels":'.json_encode($channels).'}');

+ 5 - 3
site/index.php

@@ -167,9 +167,11 @@
 										<li>{{this.name}}</li>
 									{{/each}}
 								</ul>
-								<button value="<?php echo __('Delete'); ?>" style="background-color:red;background-image:none;" onclick="window.DeleteChannel('{{this.name}}');">
-									<?php echo __('Delete'); ?>
-								</button>
+								{{#if this.candrop}}
+									<button value="<?php echo __('Delete'); ?>" style="background-color:red;background-image:none;" onclick="window.DeleteChannel('{{this.name}}');">
+										<?php echo __('Delete'); ?>
+									</button>
+								{{/if}}
 							</div>
 						{{/each}}
 					</script>