Initial Commit
This commit is contained in:
17
html/ajax/edit.php
Normal file
17
html/ajax/edit.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if (!defined('AJAX')) die('Invalid invocation');
|
||||
$rules = new HtRule_List();
|
||||
|
||||
$rule = $rules->GetAtIndex($params['id']);
|
||||
|
||||
/* @var $rule HtRule */
|
||||
|
||||
$params = $rule->GetParams();
|
||||
|
||||
if (count($params) == 0)
|
||||
return;
|
||||
|
||||
$form = new HtRule_Form($rule);
|
||||
?>
|
||||
|
||||
<?php $form->ShowForm(); ?>
|
||||
46
html/ajax/rules.php
Normal file
46
html/ajax/rules.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if (!defined('AJAX')) die('Invalid invocation');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
$ruleList = $rules->GetRules();
|
||||
|
||||
echo_pre($rules->GetHeaderText());
|
||||
|
||||
echo '<div id="rule-list">';
|
||||
|
||||
foreach($ruleList as $index => $rule)
|
||||
{
|
||||
echo_rule($index, $rule);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo_pre($rules->GetFooterText());
|
||||
|
||||
function echo_rule($index, HtRule $rule)
|
||||
{
|
||||
$text = (string)$rule;
|
||||
$class = ($index % 2 == 0) ? 'even' : 'odd';
|
||||
echo <<<EOT
|
||||
<div class="rule $class" data-rule-id="$index">
|
||||
<div class="rule-actions">
|
||||
<a href="javascript:rules.editRule($index);" class="action-edit">Edit</a>
|
||||
<a href="javascript:rules.deleteRule($index);" class="action-delete">Delete</a>
|
||||
</div>
|
||||
<pre>
|
||||
$text
|
||||
</pre>
|
||||
</div>
|
||||
EOT;
|
||||
}
|
||||
|
||||
function echo_pre($text)
|
||||
{
|
||||
$text = htmlentities($text, ENT_IGNORE, 'UTF-8');
|
||||
echo <<<EOT
|
||||
<pre>
|
||||
$text
|
||||
</pre>
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user