Skip to content

Commit

Permalink
Break out the common template into a separate file.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Nov 20, 2013
1 parent 083cac0 commit 96f2ff4
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 87 deletions.
6 changes: 2 additions & 4 deletions horde/admin/activesync.php
Expand Up @@ -73,8 +73,7 @@
}

$view = new Horde_View(array(
'templatePath' => HORDE_TEMPLATES . '/admin'
));
'templatePath' => array(HORDE_TEMPLATES . '/admin', HORDE_TEMPLATES . '/activesync')));
$view->addHelper('Tag');

$selfurl = Horde::selfUrl();
Expand All @@ -89,9 +88,8 @@
);
$devs[] = $dev;
}

$view->devices = $devs;

$view->isAdmin = true;
$page_output->header(array(
'title' => _("ActiveSync Administration")
));
Expand Down
3 changes: 2 additions & 1 deletion horde/lib/Prefs/Special/Activesync.php
Expand Up @@ -33,9 +33,10 @@ public function display(Horde_Core_Prefs_Ui $ui)
$devices = $state->listDevices($registry->getAuth());

$view = new Horde_View(array(
'templatePath' => HORDE_TEMPLATES . '/prefs'
'templatePath' => array(HORDE_TEMPLATES . '/prefs', HORDE_TEMPLATES . '/activesync')
));
$view->addHelper('Tag');
$view->isAdmin = false;

$selfurl = $ui->selfUrl();
$view->reset = $selfurl->copy()->add('reset', 1);
Expand Down
47 changes: 47 additions & 0 deletions horde/templates/activesync/device_table.html.php
@@ -0,0 +1,47 @@
<table class="horde-table activesync-devices striped">
<tr class="header">
<?php if ($this->isAdmin):?><th class="smallheader"><?php echo _("User")?></th><?php endif?>
<th class="smallheader"><?php echo _("Device") ?></th>
<th class="smallheader"><?php echo _("Last Sync Time") ?></th>
<th class="smallheader"><?php echo _("Status") ?></th>
<th class="smallheader"><?php echo _("Device Information") ?></th>
<th class="smallheader"><?php echo _("Actions")?></th>
</tr>
<?php foreach ($this->devices as $d): ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<?php $status = $this->contentTag('span', _("Wipe Pending"), array('class' => 'notice')) ?>
<?php elseif ($d->rwstatus == Horde_ActiveSync::RWSTATUS_WIPED): ?>
<?php $status = $this->contentTag('span', _("Device is Wiped. Remove device state to allow device to reconnect."), array('class' => 'notice')) ?>
<?php elseif ($d->blocked):?>
<?php $status = $this->contentTag('span', _("Deivce is Blocked."), array('class' => 'notice'))?>
<?php else: ?>
<?php $status = $d->policykey ? _("Provisioned") : _("Not Provisioned") ?>
<?php endif; ?>
<tr>
<?php if ($this->isAdmin):?><td><?php echo $d->user?></td><?php endif?>
<td><?php echo $d->deviceType ?></td>
<td><?php echo $d->getLastSyncTimestamp() ? strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $d->getLastSyncTimestamp()) : _("None") ?></td>
<td><?php echo $status ?></td>
<td>
<?php foreach ($d->getFormattedDeviceProperties() as $key => $value): ?>
<?php echo '<b>' . $key . '</b>: ' . $value . '<br />' ?>
<?php endforeach; ?>
</td>
<td>
<?php if ($d->policykey): ?>
<input class="horde-delete" type="button" value="<?php echo _("Wipe") ?>" id="wipe_<?php echo $d->id ?>" />
<?php endif; ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<input type="button" value="<?php echo _("Cancel Wipe") ?>" id="cancel_<?php echo $d->id ?>" />
<?php endif; ?>
<input class="horde-delete" type="button" value="<?php echo _("Remove") ?>" id="remove_<?php echo $d->id ?>" /><br />
<br class="spacer" />
<?php if ($d->blocked && $this->isAdmin): ?>
<input class="horde-button" type="button" value="<?php echo _("Unblock")?>" id="unblock_<?php echo $d->id?>" />
<?php elseif ($this->isAdmin): ?>
<input class="horde-delete" type="button" value="<?php echo _("Block")?>" id="block_<?php echo $d->id?>" />
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
48 changes: 1 addition & 47 deletions horde/templates/admin/activesync.html.php
Expand Up @@ -23,53 +23,7 @@
</h2>

<?php if ($this->devices): ?>
<table class="horde-table activesync-devices striped">
<tr class="header">
<th class="smallheader"><?php echo _("User")?></th>
<th class="smallheader"><?php echo _("Device") ?></th>
<th class="smallheader"><?php echo _("Last Sync Time") ?></th>
<th class="smallheader"><?php echo _("Status") ?></th>
<th class="smallheader"><?php echo _("Device Information") ?></th>
<th class="smallheader"><?php echo _("Actions")?></th>
</tr>
<?php foreach ($this->devices as $d): ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<?php $status = $this->contentTag('span', _("Wipe Pending"), array('class' => 'notice')) ?>
<?php elseif ($d->rwstatus == Horde_ActiveSync::RWSTATUS_WIPED): ?>
<?php $status = $this->contentTag('span', _("Device is Wiped. Remove device state to allow device to reconnect."), array('class' => 'notice')) ?>
<?php elseif ($d->blocked):?>
<?php $status = $this->contentTag('span', _("Deivce is Blocked."), array('class' => 'notice'))?>
<?php else: ?>
<?php $status = $d->policykey ? _("Provisioned") : _("Not Provisioned") ?>
<?php endif; ?>
<tr>
<td><?php echo $d->user?></td>
<td><?php echo $d->deviceType ?></td>
<td><?php echo $d->getLastSyncTimestamp() ? strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $d->getLastSyncTimestamp()) : _("None") ?></td>
<td><?php echo $status ?></td>
<td>
<?php foreach ($d->getFormattedDeviceProperties() as $key => $value): ?>
<?php echo '<b>' . $key . '</b>: ' . $value . '<br />' ?>
<?php endforeach; ?>
</td>
<td>
<?php if ($d->policykey): ?>
<input class="horde-delete" type="button" value="<?php echo _("Wipe") ?>" id="wipe_<?php echo $d->id ?>" />
<?php endif; ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<input type="button" value="<?php echo _("Cancel Wipe") ?>" id="cancel_<?php echo $d->id ?>" />
<?php endif; ?>
<input class="horde-delete" type="button" value="<?php echo _("Remove") ?>" id="remove_<?php echo $d->id ?>" /><br />
<br class="spacer" />
<?php if ($d->blocked): ?>
<input class="horde-button" type="button" value="<?php echo _("Unblock")?>" id="unblock_<?php echo $d->id?>" />
<?php else: ?>
<input class="horde-delete" type="button" value="<?php echo _("Block")?>" id="block_<?php echo $d->id?>" />
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php echo $this->render('device_table'); ?>
<?php else: ?>
<p><em><?php echo _("None") ?></em></p><br class="spacer" />
<?php endif; ?>
Expand Down
36 changes: 1 addition & 35 deletions horde/templates/prefs/activesync.html.php
Expand Up @@ -14,41 +14,7 @@
<input type="hidden" id="removedevice" name="removedevice" />
<input type="hidden" name="wipeid" id="wipeid" />
<input type="hidden" name="cancelwipe" id="cancelwipe" />
<table class="horde-table activesync-devices striped">
<tr class="header">
<th class="smallheader"><?php echo _("Device") ?></th>
<th class="smallheader"><?php echo _("Last Sync Time") ?></th>
<th class="smallheader"><?php echo _("Status") ?></th>
<th class="smallheader"><?php echo _("Device Information") ?></th>
<th class="smallheader"><?php echo _("Actions")?></th>
</tr>
<?php foreach ($this->devices as $d): ?>
<tr>
<td><?php echo $d->deviceType ?></td>
<td><?php echo $d->getLastSyncTimestamp() ? strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $d->getLastSyncTimestamp()) : _("None") ?></td>
<td><?php echo $status ?></td>
<td>
<?php foreach ($d->getFormattedDeviceProperties() as $key => $value): ?>
<?php echo '<b>' . $key . '</b>: ' . $value . '<br />' ?>
<?php endforeach; ?>
</td>
<td>
<?php if ($d->policykey): ?>
<input class="horde-delete" type="button" value="<?php echo _("Wipe") ?>" id="wipe_<?php echo $d->id ?>" />
<?php endif; ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<?php $status = $this->contentTag('span', _("Wipe Pending"), array('class' => 'notice')) ?>
<input type="button" value="<?php echo _("Cancel Wipe") ?>" id="cancel_<?php echo $d->id ?>" />
<?php elseif ($d->rwstatus == Horde_ActiveSync::RWSTATUS_WIPED): ?>
<?php $status = $this->contentTag('span', _("Device is Wiped"), array('class' => 'notice')) ?>
<?php else: ?>
<?php $status = $d->policykey ? _("Provisioned") : _("Not Provisioned") ?>
<?php endif; ?>
<input class="horde-delete" type="button" value="<?php echo _("Remove") ?>" id="remove_<?php echo $d->id ?>" />
</td>
</tr>
<?php endforeach; ?>
</table>
<?php echo $this->render('device_table'); ?>
<?php else: ?>
<p>
<em><?php echo _("None") ?></em>
Expand Down

0 comments on commit 96f2ff4

Please sign in to comment.