GUIEditor.php
author Dan Fuhry <dan@enanocms.org>
Wed, 27 Oct 2010 03:18:51 -0400
changeset 0 640e15974415
child 1 960c1572df75
permissions -rw-r--r--
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     1
<?php
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     2
/**!info**
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     3
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     4
  "Plugin Name"  : "GUI Editor",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/plugin/guieditor",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     6
  "Description"  : "Adds a toolbar to the editor interface, allowing point-and-click insertion of most formatting elements",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     7
  "Author"       : "Dan Fuhry",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     8
  "Version"      : "0.1",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     9
  "Author URI"   : "http://enanocms.org/",
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    10
  "Version list" : ['0.1']
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    11
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    12
**!*/
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    13
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    14
$plugins->attachHook('compile_template', 'guied_attach_script();');
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    15
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    16
function guied_attach_script()
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    17
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    18
	global $template;
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    19
	$template->add_header_js('<script type="text/javascript" src="' . scriptPath . '/plugins/guieditor/editor.js"></script>');
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    20
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    21
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    22
//
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    23
// Image search autofill
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    24
//
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    25
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    26
$plugins->attachHook('autofill_json_request', 'guied_image_autofill($dataset);');
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    27
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    28
function guied_image_autofill(&$dataset)
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    29
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    30
	global $db, $session, $paths, $template, $plugins; // Common objects
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    31
	if ( $_GET['type'] == 'guied_image' )
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    32
	{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    33
		$results = perform_search($_GET['userinput'], $warnings, false, $word_list);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    34
		foreach ( $results as $i => $result )
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    35
		{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    36
			if ( $result['namespace'] != 'File' )
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    37
				unset($results[$i]);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    38
		}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    39
		if ( count($results) > 5 )
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    40
		{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    41
			$results = array_slice($results, 0, 5);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    42
		}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    43
		foreach ( $results as $result )
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    44
		{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    45
			$dataset[] = array(
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    46
					0 => $result['page_id'],
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    47
					'title' => str_replace(array('<highlight>', '</highlight>'), array('<b>', '</b>'), $result['page_name']),
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    48
					'thumbnail' => makeUrlNS('Special', "DownloadFile/{$result['page_id']}", "preview&width=80&height=80"),
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    49
					'score' => $result['score'],
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    50
					'type' => isset($result['page_note']) ? $result['page_note'] : '',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    51
					'size' => $result['page_length'],
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    52
				);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    53
		}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    54
	}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    55
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    56
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    57
/**!language**
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    58
<code>
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    59
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    60
	eng: {
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    61
		categories: ['meta', 'guied'],
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    62
		strings: {
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    63
			meta: {
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    64
				guied: 'GUI Editor',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    65
			},
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    66
			guied: {
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    67
				btn_bold: 'Bold',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    68
				btn_italic: 'Italic',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    69
				btn_underline: 'Underline',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    70
				btn_intlink: 'Internal link',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    71
				btn_extlink: 'External link',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    72
				btn_image: 'Image',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    73
				
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    74
				sample_bold: 'Bold text',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    75
				sample_italic: 'Italic text',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    76
				sample_underline: 'Underlined text',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    77
				
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    78
				intlink_title: 'Insert internal link',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    79
				intlink_lbl_page: 'Page:',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    80
				intlink_lbl_text: 'Link text:',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    81
				intlink_af_hint: 'Type a few letters to search.',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    82
				intlink_text_hint: 'If left blank, the title of the page linked to will be displayed.',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    83
				
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    84
				extlink_title: 'Insert external link',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    85
				extlink_lbl_link: 'Link:',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    86
				extlink_lbl_text: 'Link text: ',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    87
				extlink_link_hint: 'Supported link types: http, https, irc, mailto, ftp',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    88
				extlink_text_hint: 'If left blank, the link URL will be displayed.',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    89
				
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    90
				image_title: 'Insert image',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    91
				image_lbl_image: 'Image file:',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    92
				image_btn_upload: 'Upload a file',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    93
				image_lbl_caption: 'Caption:',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    94
				image_af_hint: 'Type a few letters to search.',
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    95
				
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    96
				btn_insert: 'Insert'
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    97
			}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    98
		}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    99
	}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   100
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   101
</code>
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   102
**!*/