Commit f4e24e902b0d451c3dca0abce654482209d4aa0c
1 parent
114cc73c
Script no longer necessary - don't use buttons anymore.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5146 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
0 additions
and
132 deletions
bin/generate-buttons.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * $Id$ | |
| 5 | - * | |
| 6 | - * Copyright (c) 2006 Jam Warehouse http://www.jamwarehouse.com | |
| 7 | - * | |
| 8 | - * This program is free software; you can redistribute it and/or modify | |
| 9 | - * it under the terms of the GNU General Public License as published by | |
| 10 | - * the Free Software Foundation; using version 2 of the License. | |
| 11 | - * | |
| 12 | - * This program is distributed in the hope that it will be useful, | |
| 13 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | - * GNU General Public License for more details. | |
| 16 | - * | |
| 17 | - * You should have received a copy of the GNU General Public License | |
| 18 | - * along with this program; if not, write to the Free Software | |
| 19 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | - * | |
| 21 | - * ------------------------------------------------------------------------- | |
| 22 | - * | |
| 23 | - * You can contact the copyright owner regarding licensing via the contact | |
| 24 | - * details that can be found on the KnowledgeTree web site: | |
| 25 | - * | |
| 26 | - * http://www.ktdms.com/ | |
| 27 | - */ | |
| 28 | - | |
| 29 | -function getButtons() { | |
| 30 | - return array( | |
| 31 | - "add.png" => _("Add"), | |
| 32 | - "cancel.png" => _("Cancel"), | |
| 33 | - "next.png" => _("Next"), | |
| 34 | - "previous.png" => _("Previous"), | |
| 35 | - "back.png" => _("Back"), | |
| 36 | - "addcomment.png" => _("Add Comment"), | |
| 37 | - "subscribe.png" => _("Subscribe"), | |
| 38 | - "unsubscribe.png" => _("Unsubscribe"), | |
| 39 | - "reject.png" => _("Reject"), | |
| 40 | - "updatePassword.png" => _("Update Password"), | |
| 41 | - "delete.png" => _("Delete"), | |
| 42 | - "select.png" => _("Select"), | |
| 43 | - "update.png" => _("Update"), | |
| 44 | - "assign.png" => _("Assign"), | |
| 45 | - "search.png" => _("Search"), | |
| 46 | - "edit.png" => _("Edit"), | |
| 47 | - "approve.png" => _("Approve"), | |
| 48 | - "done.png" => _("Done"), | |
| 49 | - "publish.png" => _("Publish"), | |
| 50 | - "move.png" => _("Move"), | |
| 51 | - "remove.png" => _("Remove"), | |
| 52 | - "restore.png" => _("Restore"), | |
| 53 | - "submit.png" => _("Submit"), | |
| 54 | - "expunge.png" => _("Expunge"), | |
| 55 | - "restorehere.png" => _("Restore Here"), | |
| 56 | - "reply.png" => _("Reply"), | |
| 57 | - "new.png" => _("New"), | |
| 58 | - "reset.png" => _("Reset"), | |
| 59 | - "archive.png" => _("Archive"), | |
| 60 | - "browse.png" => _("Browse"), | |
| 61 | - "checkin.png" => _("Check In"), | |
| 62 | - "checkout.png" => _("Check Out"), | |
| 63 | - "download.png" => _("Download"), | |
| 64 | - "email.png" => _("Email"), | |
| 65 | - "movehere.png" => _("Move Here"), | |
| 66 | - "begin.png" => _("Begin"), | |
| 67 | - "login.png" => _("Login"), | |
| 68 | - "checkall.png" => _("Check All"), | |
| 69 | - "clearall.png" => _("Clear All"), | |
| 70 | - ); | |
| 71 | -} | |
| 72 | - | |
| 73 | -function generate_button($fn, $text, $height) { | |
| 74 | - global $font, $fontsize; | |
| 75 | - $text = strtoupper($text); | |
| 76 | - $size = imagettfbbox($fontsize,0, $font,$text); | |
| 77 | - $dx = abs($size[2]-$size[0]); | |
| 78 | - #$dy = abs($size[5]-$size[3]); | |
| 79 | - $dy = $height; | |
| 80 | - $xpad=9; | |
| 81 | - $ypad=9; | |
| 82 | - $im = ImageCreateTrueColor($dx+$xpad,$dy+$ypad); | |
| 83 | - $white = ImageColorAllocate($im, 255,255,255); | |
| 84 | - $black = ImageColorAllocate($im, 0,0,0); | |
| 85 | - imagefill($im, 0, 0, $white); | |
| 86 | - //ImageRectangle($im, 0, 0, $dx + $xpad - 1, $dy + $ypad - 1, $black); | |
| 87 | - ImageRectangle($im, 2, 2, $dx + $xpad - 3, $dy + $ypad - 3, $black); | |
| 88 | - ImageTTFText($im, $fontsize, 0, (int)($xpad/2), $dy+(int)($ypad/2), $black, $font, $text); | |
| 89 | - ImagePng($im, $fn); | |
| 90 | - ImageDestroy($im); | |
| 91 | -} | |
| 92 | - | |
| 93 | -function get_height($buttons) { | |
| 94 | - global $font, $fontsize; | |
| 95 | - $maxHeight = 0; | |
| 96 | - | |
| 97 | - foreach ($buttons as $fn => $text) { | |
| 98 | - $text = strtoupper($text); | |
| 99 | - $size = imagettfbbox($fontsize,0, $font,$text); | |
| 100 | - $dy = abs($size[5]-$size[3]); | |
| 101 | - if ($dy > $maxHeight) { | |
| 102 | - $maxHeight = $dy; | |
| 103 | - } | |
| 104 | - } | |
| 105 | - return $maxHeight; | |
| 106 | -} | |
| 107 | - | |
| 108 | -$argv = $_SERVER['argv']; | |
| 109 | -$sLocale = $argv[1]; | |
| 110 | - | |
| 111 | -error_reporting(E_ALL); | |
| 112 | -putenv('LANG=' . $sLocale); | |
| 113 | -putenv('LANGUAGE=' . $sLocale); | |
| 114 | -setlocale(LC_ALL, $sLocale); | |
| 115 | -// Set the text domain | |
| 116 | -$sDomain = 'knowledgeTree'; | |
| 117 | -$btd = bindtextdomain($sDomain, "/home/nbm/KnowledgeTree/cvs/i18n"); | |
| 118 | -textdomain($sDomain); | |
| 119 | - | |
| 120 | -$font = "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"; | |
| 121 | -$fontsize = 8; | |
| 122 | - | |
| 123 | -$buttons = getButtons(); | |
| 124 | -$path = "/tmp/"; | |
| 125 | - | |
| 126 | -$height = get_height($buttons); | |
| 127 | - | |
| 128 | -foreach ($buttons as $fn => $text) { | |
| 129 | - generate_button($path . $fn, $text, $height); | |
| 130 | -} | |
| 131 | - | |
| 132 | -?> |