diff -urp HEAD/signwriter/CHANGELOG.txt 6.x-dev/signwriter/CHANGELOG.txt
--- HEAD/signwriter/CHANGELOG.txt 2007-09-04 20:27:22.000000000 -0400
+++ 6.x-dev/signwriter/CHANGELOG.txt 2008-09-02 10:57:24.000000000 -0400
@@ -1,3 +1,7 @@
+26th May 2008
+---------------
+* Upgraded to 6.2 by Catorg (www.catorg.co.uk)
+
5th September 2007
----------------------------------------------------------------
* Added farbtastic colour selectors
Only in HEAD/signwriter: CVS
Only in HEAD/signwriter: LICENSE.txt
diff -urp HEAD/signwriter/README.txt 6.x-dev/signwriter/README.txt
--- HEAD/signwriter/README.txt 2006-11-27 17:41:48.000000000 -0500
+++ 6.x-dev/signwriter/README.txt 2008-09-02 10:57:24.000000000 -0400
@@ -175,4 +175,5 @@ if ($title != '') {
-------------------------------About Signwriter------------------------------------
Signwriter was created by Agileware (http://www.agileware.net).
+And ported to Drupal6 by Catorg (http://www.catorg.co.uk).
diff -urp HEAD/signwriter/signwriter.info 6.x-dev/signwriter/signwriter.info
--- HEAD/signwriter/signwriter.info 2006-11-26 21:21:39.000000000 -0500
+++ 6.x-dev/signwriter/signwriter.info 2008-09-03 00:51:27.000000000 -0400
@@ -1,4 +1,4 @@
-; $Id: signwriter.info,v 1.1 2006/11/27 02:21:39 wrunt Exp $
+; $Id$
name = Signwriter
description = Allows you to use custom truetype fonts for headings.
-
+core = 6.x
diff -urp HEAD/signwriter/signwriter.install 6.x-dev/signwriter/signwriter.install
--- HEAD/signwriter/signwriter.install 2008-09-02 00:26:33.000000000 -0400
+++ 6.x-dev/signwriter/signwriter.install 2008-09-02 10:57:24.000000000 -0400
@@ -1,67 +1,71 @@
t('signwriter table'),
+ 'fields' => array(
+ 'id' => array(
+ 'description' => 'the primary identifier of the schema',
+ 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
+ 'name' => array(
+ 'description' => 'the name of the schema',
+ 'type' => 'varchar', 'length' => 128),
+ 'pattern' => array(
+ 'description' => 'the signwriter pattern',
+ 'type' => 'varchar', 'length' => 128),
+ 'fontfile' => array(
+ 'description' => 'the name of the font, without ttf',
+ 'type' => 'varchar', 'length' => 128),
+ 'fontsize' => array(
+ 'description' => 'the size of the font',
+ 'type' => 'int', 'not null' => TRUE, 'default' => 20),
+ 'imagetype' => array(
+ 'description' => 'the type of the image',
+ 'type' => 'varchar', 'length' => 8, 'not null' => TRUE, 'default' => 'gif' ),
+ 'background' => array(
+ 'description' => 'background color',
+ 'type' => 'varchar', 'length' => 6, 'not null' => TRUE, 'default' => 'ffffff' ),
+ 'foreground' => array(
+ 'description' => 'foreground color',
+ 'type' => 'varchar', 'length' => 6, 'not null' => TRUE, 'default' => '000000' ),
+ 'transparent' => array(
+ 'description' => 'transparent image',
+ 'type' => 'int', 'not null' => TRUE, 'default' => 1),
+ 'bgimage' => array(
+ 'description' => 'background image',
+ 'type' => 'varchar', 'length' => 128 ),
+ 'width' => array(
+ 'description' => 'width of the image',
+ 'type' => 'int'),
+ 'height' => array(
+ 'description' => 'height of the image',
+ 'type' => 'int' ),
+ 'maxwidth' => array(
+ 'description' => 'maximum width of the image',
+ 'type' => 'int'),
+ 'textalign' => array(
+ 'description' => 'alignment of text within the image',
+ 'type' => 'varchar', 'length' => 32 ),
+ 'xoffset' => array(
+ 'description' => 'x offset of the text within the image',
+ 'type' => 'int'),
+ 'yoffset' => array(
+ 'description' => 'y offset of the text within the image',
+ 'type' => 'int'),
+ ),
+ 'indexes' => array(
+ 'name' => array('name')
+ ),
+ 'primary key' => array('id'),
+ );
-/**
- * Update
- */
-function signwriter_update_1() {
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("ALTER TABLE {signwriter}
- ADD (multiline int(2) NOT NULL default '1',
- drop_shadow int(2) NOT NULL default '0',
- shadow_color varchar(6) NOT NULL default 'D2D2D2',
- shadow_xoffset int(8) default '5',
- shadow_yoffset int(8) default '5')");
- return $ret;
- }
+ return $schema;
}
diff -urp HEAD/signwriter/signwriter.module 6.x-dev/signwriter/signwriter.module
--- HEAD/signwriter/signwriter.module 2008-09-02 00:26:33.000000000 -0400
+++ 6.x-dev/signwriter/signwriter.module 2008-09-03 01:00:12.000000000 -0400
@@ -1,60 +1,58 @@
The signwriter module allows you to use custom truetype fonts for headings. It does this by creating images with the headings' text, and replacing the headings with the images.
There are several ways in which you can use signwriter:
- It can be used as an input filter to replace headers in content,
- it can be used and configured by a theme, or
- it can be used by a theme and configured in drupal.
");
break;
}
+ return '';
}
/**
* Implementation of hook_menu().
*/
-function signwriter_menu($may_cache) {
+function signwriter_menu() {
$items = array();
- if ($may_cache) {
- $items[] = array(
- 'path' => 'admin/settings/signwriter',
- 'title' => t('Signwriter'),
- 'description' => t('Manage Signwriter profiles, for custom font headings.'),
- 'callback' => 'signwriter_settings_page',
- 'access' => user_access('administer signwriter'),
- 'type' => MENU_NORMAL_ITEM);
- $items[] = array(
- 'path' => 'admin/settings/signwriter/profile/add',
- 'title' => t('Add profile'),
- 'description' => t('Add a new Signwriter profile.'),
- 'callback' => 'signwriter_profile_page',
- 'callback arguments' => null,
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -8);
- }
- else {
- if (arg(2) == 'signwriter') {
- foreach (signwriter_load_profiles() as $profile) {
- $items[] = array(
- 'path' => 'admin/settings/signwriter/profile/' . $profile->id,
- 'title' => $profile->name,
- 'description' => t('Manage the ') . $profile->name . t(' Signwriter profile.'),
- 'callback' => 'signwriter_profile_page',
- 'callback arguments' => array($profile),
- 'type' => MENU_NORMAL_ITEM,);
- $items[] = array(
- 'path' => 'admin/settings/signwriter/profile/' . $profile->id . '/delete',
- 'title' => "Delete $profile->name",
- 'description' => t('Delete the ') . $profile->name . t(' Signwriter profile'),
- 'callback' => 'signwriter_confirm_delete_profile_page',
- 'callback arguments' => array($profile),
- 'type' => MENU_NORMAL_ITEM,);
- }
- }
- }
- return $items;
+
+ $items['admin/settings/signwriter'] = array(
+ 'title' => 'Signwriter',
+ 'description' => 'Manage Signwriter profiles, for custom font headings.',
+ 'page callback' => 'signwriter_settings_page',
+ 'access arguments' => array('administer signwriter'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ $items['admin/settings/signwriter/profile/add'] = array(
+ 'title' => 'Add profile',
+ 'description' => 'Add a new Signwriter profile.',
+ 'page callback' => 'signwriter_profile_page',
+ 'access arguments' => array('administer signwriter'),
+ 'page arguments' => null,
+ 'type' => MENU_NORMAL_ITEM,
+ 'weight' => -8);
+
+ $items['admin/settings/signwriter/profile/%signwriter_profile'] = array(
+ 'title' => 'signwriter profile',
+ 'description' => t('Manage the Signwriter profile.'),
+ 'page callback' => 'signwriter_profile_page',
+ 'access arguments' => array('administer signwriter'),
+ 'page arguments' => array(4),
+ 'type' => MENU_NORMAL_ITEM,);
+
+ $items['admin/settings/signwriter/profile/%signwriter_profile/delete'] = array(
+ 'title' => "Delete signwriter profile",
+ 'description' => t('Delete the Signwriter profile'),
+ 'page callback' => 'signwriter_confirm_delete_profile_page',
+ 'access arguments' => array('administer signwriter'),
+ 'page arguments' => array(4),
+ 'type' => MENU_NORMAL_ITEM,);
+
+ return $items;
}
/**
@@ -152,10 +150,10 @@ function signwriter_confirm_delete_profi
print theme('page', drupal_get_form('signwriter_confirm_delete_profile_form', $profile));
}
-function signwriter_confirm_delete_profile_form($profile) {
- $profile = signwriter_load_profile($profile);
+function signwriter_confirm_delete_profile_form($form_state, $profile) {
+// $profile = signwriter_load_profile($profile);
$form['id'] = array('#type' => 'value', '#value' => $profile->id);
- $form['#submit'] = array('_signwriter_confirm_delete_profile_submit' => null);
+ $form['#submit'][] = '_signwriter_confirm_delete_profile_submit';
return confirm_form($form,
t('Are you sure you want to delete the \'%title\' profile?', array('%title' => $profile->name)),
'admin/settings/signwriter',
@@ -164,8 +162,8 @@ function signwriter_confirm_delete_profi
t('Cancel'));
}
-function _signwriter_confirm_delete_profile_submit($form_id, $form_values) {
- $profile = signwriter_load_profile($form_values['id']);
+function _signwriter_confirm_delete_profile_submit($form, $form_state) {
+ $profile = signwriter_load_profile($form_state['values']['id']);
return signwriter_delete_profile($profile);
}
@@ -179,7 +177,6 @@ function signwriter_save_profile($profil
$profile->is_new = false;
if (empty($profile->id)) {
$profile->is_new = true;
- $profile->id = db_next_id('{signwriter}_id');
}
$fields = _signwriter_db_fields();
@@ -267,7 +264,7 @@ function signwriter_profile_page($p = nu
print theme('page', $output);
}
-function _signwriter_profile_form($p = null) {
+function _signwriter_profile_form(&$form_state, $p = null) {
drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
drupal_add_js('misc/farbtastic/farbtastic.js');
drupal_add_js(drupal_get_path('module', 'signwriter') . '/color.js');
@@ -275,6 +272,7 @@ function _signwriter_profile_form($p = n
// TODO: add a preview, and maybe an 'Apply' button which submits the page
// then returns to it, rather than back to the main signwriter settings page.
$profileid = empty($p->id) ? null : $p->id;
+ $form = array();
$form['id'] = array('#type' => 'value', '#value' => $profileid);
$form['name'] = array(
'#type' => 'textfield',
@@ -449,8 +447,8 @@ function _signwriter_profile_form($p = n
return $form;
}
-function _signwriter_profile_submit($form_id, $form_values) {
- $profile = (object)$form_values;
+function _signwriter_profile_submit($form, &$form_state) {
+ $profile = (object)$form_state['values'];
if ($form_values['op'] == t('Delete'))
return 'admin/settings/signwriter/profile/' . $profile->id . '/delete';
signwriter_save_profile($profile);
@@ -487,7 +485,8 @@ function signwriter_settings_page() {
$rows = array();
foreach ($profiles as $profile) {
$links[] = l($profile->name, 'admin/settings/signwriter/profile/'. $profile->id);
- $rows[] = array('name' => l($profile->name, 'admin/settings/signwriter/profile/' . $profile->id),
+ $rows[] = array('name' => check_plain($profile->name),
+ 'edit' => l(t('edit'), 'admin/settings/signwriter/profile/' . $profile->id),
'delete' => l(t('delete'), "admin/settings/signwriter/profile/$profile->id/delete"));
}
if (empty($rows)) {
@@ -502,7 +501,7 @@ function signwriter_settings_page() {
}
}
-function signwriter_settings_form() {
+function signwriter_settings_form($form_state ) {
$form = array();
$form['settings'] = array('#type' => 'fieldset', '#title' => t('Settings'), '#collapsible' => true, '#collapsed' => false);
$form['settings']['cachedir'] = array(
@@ -527,9 +526,9 @@ function signwriter_settings_form() {
return $form;
}
-function signwriter_settings_form_submit($form_id, $form_values) {
- variable_set('signwriter_cachedir', $form_values['cachedir']);
- variable_set('signwriter_fontpath', $form_values['fontpath']);
+function signwriter_settings_form_submit($form, $form_state) {
+ variable_set('signwriter_cachedir', $form_state['values']['cachedir']);
+ variable_set('signwriter_fontpath', $form_state['values']['fontpath']);
drupal_set_message(t('Signwriter settings updated.'));
}
@@ -610,7 +609,6 @@ function signwriter_url($profile) {
//$urlfilename = "text:$htmltext-" . $filename;
//$filename = "text:$text-" . $filename;
$filename = serialize($profile);
- $urlfilename = "text:$htmltext-" . $filename;
$filename = "text:$text-" . $filename;
//for shorter filenames that are still unique and repeatable (for caching)
@@ -625,7 +623,7 @@ function signwriter_url($profile) {
// calculate the size of the text
$box = imagettfbbox($size, $angle, $fontfile, $text);
if (!$box) {
- drupal_set_message(t("Unable to generate a signwriter image. It may be that your font was not found by the freetype library. Do you have GD and Freetype installed? Check the output of phpinfo().", 'error'));
+ drupal_set_message(t("Unable to generate a signwriter image. Is your font set correctly in the %profilename signwriter profile?", array('%profilename' => $profile->name)), 'error');
return '';
}
@@ -886,3 +884,22 @@ function _signwriter_parse_colour($str)
return false;
}
+function signwriter_profile_load($pid)
+{
+ if (!is_numeric($pid)) {
+ return FALSE;
+ }
+ $profile = signwriter_load_profile($pid);
+ if (!isset($profile->id)) {
+ return FALSE;
+ }
+ return $profile;
+}
+
+function signwriter_theme() {
+ return array(
+ 'signwriter_text_convert' => array(
+ 'arguments' => array('text','signwriter'),
+ ),
+ );
+}