/[drupal]/contributions/modules/unisaraswati/unisaraswati.module
ViewVC logotype

Contents of /contributions/modules/unisaraswati/unisaraswati.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu May 31 11:27:54 2007 UTC (2 years, 5 months ago) by tusharvjoshi
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-php
UniSaraswati Devnagari Transliterator Module

This module provides facility of typing in devnagari Indian script.  It makes one block available for changing the typing mode.  It works with all the edit-* elements of the nodes, except the edit-email and edit-recipents elements.
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 }

  ViewVC Help
Powered by ViewVC 1.1.2