Example #1
0
    public static function fromName($tagName)
    {
        global $prefs;
        $tool_prefs = array();
        switch ($tagName) {
            case 'tikilink':
                $label = tra('Wiki Link');
                $iconname = 'link';
                $icon = tra('img/icons/page_link.png');
                $wysiwyg = '';
                // cke link dialog now adapted for wiki links
                $list = array(tra("Wiki Link"), '<label for="tbWLinkDesc">' . tra("Show this text") . '</label>', '<input type="text" id="tbWLinkDesc" class="ui-widget-content ui-corner-all" style="width: 98%" />', '<label for="tbWLinkPage">' . tra("Link to this page") . '</label>', '<input type="text" id="tbWLinkPage" class="ui-widget-content ui-corner-all" style="width: 98%" />', $prefs['wikiplugin_alink'] == 'y' ? '<label for="tbWLinkAnchor">' . tra("Anchor") . ':</label>' : '', $prefs['wikiplugin_alink'] == 'y' ? '<input type="text" id="tbWLinkAnchor" class="ui-widget-content ui-corner-all" style="width: 98%" />' : '', $prefs['feature_semantic'] == 'y' ? '<label for="tbWLinkRel">' . tra("Semantic relation") . ':</label>' : '', $prefs['feature_semantic'] == 'y' ? '<input type="text" id="tbWLinkRel" class="ui-widget-content ui-corner-all" style="width: 98%" />' : '', '{"open": function () { dialogInternalLinkOpen(area_id); },
						"buttons": { "' . tra("Cancel") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Insert") . '": function() { dialogInternalLinkInsert(area_id,this); }}}');
                break;
            case 'objectlink':
                $types = TikiLib::lib('unifiedsearch')->getSupportedTypes();
                $options = '';
                foreach ($types as $type => $title) {
                    $options .= '<option value="' . $type . '">' . $title . '</option>';
                }
                $label = tra('Object Link');
                $iconname = 'link-external-alt';
                $icon = tra('img/icons/page_link.png');
                $wysiwyg = 'Object Link';
                $smarty = TikiLib::lib('smarty');
                $smarty->loadPlugin('smarty_function_object_selector');
                $object_selector = smarty_function_object_selector(['_id' => 'tbOLinkObjectSelector', '_class' => 'ui-widget-content ui-corner-all', '_filter' => ['type' => ''], '_parent' => 'tbOLinkObjectType', '_parentkey' => 'type'], $smarty);
                $list = array(tra('Object Link'), '<label for="tbOLinkDesc">' . tra("Show this text") . '</label>', '<input type="text" id="tbOLinkDesc" />', '<label for="tbOLinkObjectType">' . tra("Types of object") . '</label>', '<select id="tbOLinkObjectType" class="ui-widget-content ui-corner-all" style="width: 98%">' . '<option value="*">' . tra('All') . '</option>' . $options . '</select>', '<label for="tbOLinkObjectSelector">' . tra("Link to this object") . '</label>', $object_selector, '{"open": function () { dialogObjectLinkOpen(area_id); },
						"buttons": { "' . tra("Cancel") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Insert") . '": function() { dialogObjectLinkInsert(area_id,this); }}}');
                break;
            case 'link':
                $wysiwyg = 'Link';
                $label = tra('External Link');
                $iconname = 'link-external';
                $icon = tra('img/icons/world_link.png');
                $list = array(tra('External Link'), '<label for="tbLinkDesc">' . tra("Show this text") . '</label>', '<input type="text" id="tbLinkDesc" class="ui-widget-content ui-corner-all" style="width: 98%" />', '<label for="tbLinkURL">' . tra("link to this URL") . '</label>', '<input type="text" id="tbLinkURL" class="ui-widget-content ui-corner-all" style="width: 98%" />', '<label for="tbLinkRel">' . tra("Relation") . ':</label>', '<input type="text" id="tbLinkRel" class="ui-widget-content ui-corner-all" style="width: 98%" />', $prefs['cachepages'] == 'y' ? '<br /><label for="tbLinkNoCache" style="display:inline;">' . tra("No cache") . ':</label>' : '', $prefs['cachepages'] == 'y' ? '<input type="checkbox" id="tbLinkNoCache" class="ui-widget-content ui-corner-all" />' : '', '{"width": 300, "open": function () { dialogExternalLinkOpen( area_id ) },
						"buttons": { "' . tra("Cancel") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Insert") . '": function() { dialogExternalLinkInsert(area_id,this) }}}');
                break;
            case 'table':
            case 'tikitable':
                $iconname = 'table';
                $icon = tra('img/icons/table.png');
                $wysiwyg = 'Table';
                $label = tra('Table Builder');
                $list = array(tra('Table Builder'), '{"open": function () { dialogTableOpen(area_id,this); },
						"width": 320, "buttons": { "' . tra("Cancel") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Insert") . '": function() { dialogTableInsert(area_id,this); }}}');
                break;
            case 'find':
                $icon = tra('img/icons/find.png');
                $iconname = 'search';
                $wysiwyg = 'Find';
                $label = tra('Find Text');
                $list = array(tra('Find Text'), '<label>' . tra("Search") . ':</label>', '<input type="text" id="tbFindSearch" class="ui-widget-content ui-corner-all" />', '<label for="tbFindCase" style="display:inline;">' . tra("Case Insensitivity") . ':</label>', '<input type="checkbox" id="tbFindCase" checked="checked" class="ui-widget-content ui-corner-all" />', '<p class="description">' . tra("Note: Uses regular expressions") . '</p>', '{"open": function() { dialogFindOpen(area_id); },' . '"buttons": { "' . tra("Close") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Find") . '": function() { dialogFindFind(area_id); }}}');
                break;
            case 'replace':
                $icon = tra('img/icons/text_replace.png');
                $iconname = 'repeat';
                $wysiwyg = 'Replace';
                $label = tra('Text Replace');
                $tool_prefs[] = 'feature_wiki_replace';
                $list = array(tra('Text Replace'), '<label for="tbReplaceSearch">' . tra("Search") . ':</label>', '<input type="text" id="tbReplaceSearch" class="ui-widget-content ui-corner-all" />', '<label for="tbReplaceReplace">' . tra("Replace") . ':</label>', '<input type="text" id="tbReplaceReplace" class="ui-widget-content ui-corner-all clearfix" />', '<label for="tbReplaceCase" style="display:inline;">' . tra("Case Insensitivity") . ':</label>', '<input type="checkbox" id="tbReplaceCase" checked="checked" class="ui-widget-content ui-corner-all" />', '<br /><label for="tbReplaceAll" style="display:inline;">' . tra("Replace All") . ':</label>', '<input type="checkbox" id="tbReplaceAll" checked="checked" class="ui-widget-content ui-corner-all" />', '<p class="description">' . tra("Note: Uses regular expressions") . '</p>', '{"open": function() { dialogReplaceOpen(area_id); },' . '"buttons": { "' . tra("Close") . '": function() { dialogSharedClose(area_id,this); },' . '"' . tra("Replace") . '": function() { dialogReplaceReplace(area_id); }}}');
                break;
            default:
                return;
        }
        $tag = new self();
        $tag->name = $tagName;
        $tag->setWysiwygToken($wysiwyg)->setLabel($label)->setIconName(!empty($iconname) ? $iconname : 'help')->setIcon(!empty($icon) ? $icon : 'img/icons/shading.png')->setList($list)->setType('Dialog');
        foreach ($tool_prefs as $pref) {
            $tag->addRequiredPreference($pref);
        }
        global $toolbarDialogIndex;
        ++$toolbarDialogIndex;
        $tag->index = $toolbarDialogIndex;
        ToolbarDialog::setupJs();
        return $tag;
    }
Example #2
0
	public static function fromName( $tagName ) // {{{
	{
		global $prefs;
		$tool_prefs = array();

		switch( $tagName ) {
		case 'tikilink':
			$label = tra('Wiki Link');
			$icon = tra('img/icons/page_link.png');
			$wysiwyg = '';	// cke link dialog now adapted for wiki links
			$list = array('Wiki Link',
						'<label for="tbWLinkDesc">Show this text</label>',
						'<input type="text" id="tbWLinkDesc" class="ui-widget-content ui-corner-all" style="width: 98%" />',
						'<label for="tbWLinkPage">Link to this page</label>',
						'<input type="text" id="tbWLinkPage" class="ui-widget-content ui-corner-all" style="width: 98%" />',
						$prefs['wikiplugin_alink'] == 'y' ? '<label for="tbWLinkAnchor">Anchor:</label>' : '',
						$prefs['wikiplugin_alink'] == 'y' ? '<input type="text" id="tbWLinkAnchor" class="ui-widget-content ui-corner-all" style="width: 98%" />' : '',
						$prefs['feature_semantic'] == 'y' ? '<label for="tbWLinkRel">Semantic relation:</label>' : '',
						$prefs['feature_semantic'] == 'y' ? '<input type="text" id="tbWLinkRel" class="ui-widget-content ui-corner-all" style="width: 98%" />' : '',
						'{"open": function () { dialogInternalLinkOpen(area_id); },
						"buttons": { "Cancel": function() { dialogSharedClose(area_id,this); },'.
									'"Insert": function() { dialogInternalLinkInsert(area_id,this); }}}'
					);

      break;
		case 'link':
			$wysiwyg = 'Link';
			$label = tra('External Link');
			$icon = tra('img/icons/world_link.png');
			$list = array('External Link',
						'<label for="tbLinkDesc">Show this text</label>',
						'<input type="text" id="tbLinkDesc" class="ui-widget-content ui-corner-all" style="width: 98%" />',
						'<label for="tbLinkURL">link to this URL</label>',
						'<input type="text" id="tbLinkURL" class="ui-widget-content ui-corner-all" style="width: 98%" />',
						'<label for="tbLinkRel">Relation:</label>',
						'<input type="text" id="tbLinkRel" class="ui-widget-content ui-corner-all" style="width: 98%" />',
						$prefs['cachepages'] == 'y' ? '<br /><label for="tbLinkNoCache" style="display:inline;">No cache:</label>' : '',
						$prefs['cachepages'] == 'y' ? '<input type="checkbox" id="tbLinkNoCache" class="ui-widget-content ui-corner-all" />' : '',
						'{"width": 300, "open": function () { dialogExternalLinkOpen( area_id ) },
						"buttons": { "Cancel": function() { dialogSharedClose(area_id,this); },'.
									'"Insert": function() { dialogExternalLinkInsert(area_id,this) }}}'
					);
      break;

		case 'table':
			$icon = tra('img/icons/table.png');
			$wysiwyg = 'Table';
			$label = tra('Table Builder');
			$list = array('Table Builder',
						'{"open": function () { dialogTableOpen(area_id,this); },
						"width": 320, "buttons": { "Cancel": function() { dialogSharedClose(area_id,this); },'.
												  '"Insert": function() { dialogTableInsert(area_id,this); }}}'
					);
      break;

		case 'find':
			$icon = tra('img/icons/find.png');
			$wysiwyg = 'Find';
			$label = tra('Find Text');
			$list = array('Find Text',
						'<label>Search:</label>',
						'<input type="text" id="tbFindSearch" class="ui-widget-content ui-corner-all" />',
						'<label for="tbFindCase" style="display:inline;">Case Insensitivity:</label>',
						'<input type="checkbox" id="tbFindCase" checked="checked" class="ui-widget-content ui-corner-all" />',
						'<p class="description">Note: Uses regular expressions</p>',	// TODO add option to not
						'{"open": function() { dialogFindOpen(area_id); },'.
						 '"buttons": { "Close": function() { dialogSharedClose(area_id,this); },'.
									  '"Find": function() { dialogFindFind(area_id); }}}'
					);

      break;

		case 'replace':
			$icon = tra('img/icons/text_replace.png');
			$wysiwyg = 'Replace';
			$label = tra('Text Replace');
			$tool_prefs[] = 'feature_wiki_replace';
			
			$list = array('Text Replace',
						'<label for="tbReplaceSearch">Search:</label>',
						'<input type="text" id="tbReplaceSearch" class="ui-widget-content ui-corner-all" />',
						'<label for="tbReplaceReplace">Replace:</label>',
						'<input type="text" id="tbReplaceReplace" class="ui-widget-content ui-corner-all clearfix" />',
						'<label for="tbReplaceCase" style="display:inline;">Case Insensitivity:</label>',
						'<input type="checkbox" id="tbReplaceCase" checked="checked" class="ui-widget-content ui-corner-all" />',
						'<br /><label for="tbReplaceAll" style="display:inline;">Replace All:</label>',
						'<input type="checkbox" id="tbReplaceAll" checked="checked" class="ui-widget-content ui-corner-all" />',
						'<p class="description">Note: Uses regular expressions</p>',	// TODO add option to not
						'{"open": function() { dialogReplaceOpen(area_id); },'.
						 '"buttons": { "Close": function() { dialogSharedClose(area_id,this); },'.
									  '"Replace": function() { dialogReplaceReplace(area_id); }}}'
					);

      break;

		default:
			return;
		}

		$tag = new self;
		$tag->name = $tagName;
		$tag->setWysiwygToken($wysiwyg)
			->setLabel($label)
			->setIcon(!empty($icon) ? $icon : 'img/icons/shading.png')
			->setList($list)
			->setType('Dialog');
		
		foreach ( $tool_prefs as $pref ) {
			$tag->addRequiredPreference($pref);
		}

		global $toolbarDialogIndex;
		++$toolbarDialogIndex;
		$tag->index = $toolbarDialogIndex;
		
		ToolbarDialog::setupJs();

		return $tag;
	} // }}}