| 1 |
<?php
|
| 2 |
/* $Id$ */
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Allows typing in devnagari.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Display help and module information
|
| 11 |
* @param section which section of the site we're displaying help
|
| 12 |
* @return help text for section
|
| 13 |
*/
|
| 14 |
function unisaraswati_help($section = '') {
|
| 15 |
$output = '';
|
| 16 |
|
| 17 |
switch ($section) {
|
| 18 |
|
| 19 |
case 'admin/help#unisaraswati':
|
| 20 |
$output = '<p>' . t('Allows devnagari-character typing. Go to <a href="?q=admin/block">block administration</a> to make sure that the UniSarasvati Devnagari Transliterator block has been enabled.') . '</p>';
|
| 21 |
return $output;
|
| 22 |
}
|
| 23 |
}
|
| 24 |
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Generate HTML for the unisaraswati block
|
| 28 |
* @param op the operation from the URL
|
| 29 |
* @param delta offset
|
| 30 |
* @returns block HTML
|
| 31 |
*/
|
| 32 |
function unisaraswati_block($op = 'list', $delta = 0) {
|
| 33 |
|
| 34 |
// listing of blocks, such as on the admin/block page
|
| 35 |
if($op == 'list'){
|
| 36 |
$block[0]['info'] = t('UniSarasvati Devnagari Transliterator');
|
| 37 |
$block[0]['weight'] = 10;
|
| 38 |
$block[0]['status'] = 1;
|
| 39 |
$block[0]['pages'] = "node/add/*\nnode/*/edit\nadmin/*\nuser/*/edit\nsearch/*\ncomment/reply/*";
|
| 40 |
$block[0]['visibility'] = 1;
|
| 41 |
return $block;
|
| 42 |
}
|
| 43 |
else if($op == 'view') {
|
| 44 |
$path = base_path() . drupal_get_path('module', 'unisaraswati') . '/marathi.js';
|
| 45 |
$devnagari = t('Devnagari');
|
| 46 |
$roman = t('Roman');
|
| 47 |
$message = t('Change language by F12');
|
| 48 |
$block['subject'] = t('');
|
| 49 |
|
| 50 |
$block['content'] =
|
| 51 |
'<form name=keybdsel><input type=radio name=keybrd value=roman onclick="toggleKBMode(event,this)" checked>' . $devnagari . '<br />' .
|
| 52 |
'<input type=radio name=keybrd value=english onclick="toggleKBMode(event,this)">' . $roman . '<br /> ' . $message . '</form>' .
|
| 53 |
'<script type="text/javascript" src="'.$path.'"></script>' ;
|
| 54 |
;
|
| 55 |
|
| 56 |
|
| 57 |
return $block;
|
| 58 |
}
|
| 59 |
}
|