Exemplo n.º 1
0
    static function wikiView($args)
    {
        global $tikilib, $headerlib;
        static $Feed_ForwardLink_PageLookup = 0;
        ++$Feed_ForwardLink_PageLookup;
        $wikiAttributes = Tracker_Query::tracker('Wiki Attributes')->byName()->excludeDetails()->filter(array('field' => 'Type', 'value' => 'ForwardLink'))->filter(array('field' => 'Page', 'value' => $args['object']))->render(false)->query();
        $forwardLinks = array();
        foreach ($wikiAttributes as $wikiAttribute) {
            $forwardLinks[] = $forwardLink = json_decode($wikiAttribute['Value']);
            $forwardLink->href = urldecode($forwardLink->href);
            if (isset($forwardLink->href)) {
                $result = Feed_ForwardLink_Send::send(array('page' => $args['object'], 'forwardLink' => $forwardLink, 'textlink' => array('body' => $args['data'], 'href' => $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object'])));
            }
        }
        $forwardLinks = json_encode($forwardLinks);
        if (!empty($forwardLinks)) {
            $headerlib->add_jq_onready(<<<JQ
\t\t\tvar forwardLinks = {$forwardLinks};
\t\t\t\$.each(forwardLinks, function() {
\t\t\t\tif (this.href) {
\t\t\t\t\t\$('<a>*</a>')
\t\t\t\t\t\t.attr('href', unescape(this.href))
\t\t\t\t\t\t.appendTo('#page-data');
\t\t\t\t}
\t\t\t});
JQ
);
        }
    }
Exemplo n.º 2
0
 static function wikiView($args)
 {
     return;
     global $tikilib, $headerlib;
     static $Feed_ForwardLink_PageLookup = 0;
     ++$Feed_ForwardLink_PageLookup;
     $wikiAttributes = Tracker_Query::tracker('Wiki Attributes')->byName()->excludeDetails()->filter(array('field' => 'Type', 'value' => 'ForwardLink'))->filter(array('field' => 'Page', 'value' => $args['object']))->render(false)->query();
     $forwardLinks = array();
     foreach ($wikiAttributes as $wikiAttribute) {
         $forwardLinks[] = $forwardLink = json_decode($wikiAttribute['Value']);
         if (isset($forwardLink->href)) {
             $forwardLink->href = urldecode($forwardLink->href);
             $result = Feed_ForwardLink_Send::send(array('forwardLink' => $forwardLink, 'textlink' => array('body' => $args['data'], 'href' => $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object'])));
         }
     }
 }
Exemplo n.º 3
0
 static function wikiView()
 {
     global $page, $headerlib;
     $me = new self();
     $phrase = !empty($_REQUEST['phrase']) ? $_REQUEST['phrase'] : '';
     Feed_ForwardLink_Search::restoreTextLinkPhrasesInWikiPage($me->getItems(), $phrase);
     //if we have an awaiting textlink that needs sent, we do so here
     $result = Tracker_Query::tracker('Wiki Attributes')->byName()->render(false)->filterFieldByValue('Page', $page)->filterFieldByValue('Type', 'TextLink Send')->query();
     if (count($result) > 0) {
         foreach (Feed_ForwardLink_Send::sendAll() as $text => $received) {
             $receivedJSON = json_decode($received);
             if (isset($receivedJSON->feed) && $receivedJSON->feed == 'success') {
                 Tracker_Query::tracker('Wiki Attributes')->byName()->render(false)->filterFieldByValue('Page', $page)->filterFieldByValue('Type', 'TextLink Send')->filterFieldByValue('Attribute', $text)->delete(true);
                 $headerlib->add_jq_onready("\$.notify('" . tr("TextLink and ForwardLink created...") . "');");
             }
         }
     }
 }
function wikiplugin_textlink($data, $params)
{
    global $tikilib, $headerlib, $caching, $page;
    static $textlinkI = 0;
	++$textlinkI;
	$i = $textlinkI;
	
	$params = array_merge(array("clipboarddata" => ""), $params);
	extract($params, EXTR_SKIP);
	
	$clipboarddata = json_decode(stripslashes(trim(urldecode($clipboarddata))));
	if (empty($clipboarddata)) return $data;
	
	$clipboarddata->href = urldecode($clipboarddata->href);
	
	$phraser = new JisonParser_Phraser_Handler();
	$id = implode("", $phraser->sanitizeToWords($data));
	
	Feed_ForwardLink_Send::add(
					array(
						"page"=> $page,
						"forwardlink"=> $clipboarddata,
						"textlink"=> array(
							"text"=> 	$data,
							"href"=> 	$tikilib->tikiUrl() . "tiki-index.php?page=$page#" . $id,
							"id"=>		$clipboarddata->hash. "_" . $page . "_" . $id
						)
					)
	);
	$data = addslashes(htmlspecialchars($data));
	$date = $tikilib->get_short_date($clipboarddata->date);

	$clipboarddata->href = addslashes(htmlspecialchars($clipboarddata->href));
	$clipboarddata->text = addslashes(htmlspecialchars($clipboarddata->text));

	if (!empty($clipboarddata->href)) {
		$headerlib
			->add_jsfile("lib/jquery/tablesorter/jquery.tablesorter.js")
			->add_cssfile("lib/jquery_tiki/tablesorter/themes/tiki/style.css")
			->add_jq_onready(<<<JQ
				$('#page-data').bind('rangyDone', function() {
					$('#$id').click(function() {
						var table = $('<div><table class="tablesorter">' +
							'<thead>' + 
								'<tr>' +
									'<th>' + tr('Date') + '</th>' +
									'<th>' + tr('Click below to read Citing blocks') + '</th>' +
								'</tr>' +
							'</thead>' +
							'<tbody>' +
								'<tr>' +
									'<td>$date</td>' +
									'<td><a href="$clipboarddata->href" class="read">Read</a></td>' +
								'</tr>' +
							'</tbody>' +
						'</table></div>')
							.dialog({
								title: tr("ForwardLinks To: ") + "$data",
								modal: true
							})
							.tablesorter();
						
						table.find('.read').click(function() {
							$('<form action="$clipboarddata->href" method="post">' + 
								'<input type="hidden" name="phrase" value="$clipboarddata->text" />' +
							'</form>')
								.appendTo('body')
								.submit();
							return false;
						});
						return false;
					});
				});
JQ
			);
		
    	return "~np~<span class='textlink'>~/np~".$data."~np~</span><a href='" .$clipboarddata->href ."' id='" . $id . "'>*</a>~/np~";
	} else {
    	return $data;
	}
}
Exemplo n.º 5
0
function tiki_wiki_view_forwardlink($args)
{
    Feed_ForwardLink_Receive::wikiView($args);
    Feed_ForwardLink_PageLookup::wikiView($args);
    Feed_ForwardLink::wikiView($args);
    Feed_ForwardLink_Send::wikiView($args);
}