Changing source preview to use new syntax highlighter
fixing issue with QR OTP on user page
This commit is contained in:
parent
22de793422
commit
822e107958
@ -65,12 +65,15 @@ class IDF_FileUtil
|
|||||||
}
|
}
|
||||||
$table = array();
|
$table = array();
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach (self::splitIntoLines($content) as $line) {
|
/*foreach (self::splitIntoLines($content) as $line) {
|
||||||
$table[] = '<tr class="c-line"><td class="code-lc" id="L'.$i.'"><a href="#L'.$i.'">'.$i.'</a></td>'
|
$table[] = '<tr class="c-line"><td class="code-lc" id="L'.$i.'"><a href="#L'.$i.'">'.$i.'</a></td>'
|
||||||
.'<td class="code mono'.$pretty.'">'.self::emphasizeControlCharacters(Pluf_esc($line)).'</td></tr>';
|
.'<td class="code mono'.$pretty.'">'.self::emphasizeControlCharacters(Pluf_esc($line)).'</td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return Pluf_Template::markSafe(implode("\n", $table));
|
return Pluf_Template::markSafe(implode("\n", $table));*/
|
||||||
|
//var_dump($fileinfo);
|
||||||
|
$content = '<script type="syntaxhighlighter" class="brush: ' . $fileinfo[2] . '">' . $content . '</script>';
|
||||||
|
return Pluf_Template::markSafe($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -380,10 +380,11 @@ class IDF_Views_Source
|
|||||||
$props = $scm->getProperties($commit, $request_file);
|
$props = $scm->getProperties($commit, $request_file);
|
||||||
$cache = Pluf_Cache::factory();
|
$cache = Pluf_Cache::factory();
|
||||||
$key = sha1($request_file.$commit);
|
$key = sha1($request_file.$commit);
|
||||||
if (null === ($content=$cache->get($key))) {
|
|
||||||
$content = IDF_FileUtil::highLight($extra['mime'], $scm->getFile($request_file_info));
|
$content = IDF_FileUtil::highLight($extra['mime'], $scm->getFile($request_file_info));
|
||||||
|
/*if (null === ($content=$cache->get($key))) {
|
||||||
|
|
||||||
$cache->set($key, $content);
|
$cache->set($key, $content);
|
||||||
}
|
}*/
|
||||||
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/file.html',
|
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/file.html',
|
||||||
array(
|
array(
|
||||||
'page_title' => $page_title,
|
'page_title' => $page_title,
|
||||||
|
@ -286,11 +286,13 @@ class IDF_Views_User
|
|||||||
$user = $users[0];
|
$user = $users[0];
|
||||||
$user_data = IDF_UserData::factory($user);
|
$user_data = IDF_UserData::factory($user);
|
||||||
|
|
||||||
$ownedprojects = IDF_Views::getOwnedProjects($request->user);
|
$ownedprojects = IDF_Views::getOwnedProjects($user);
|
||||||
|
|
||||||
$pubprojects = array();
|
$pubprojects = array();
|
||||||
$privprojects = 0;
|
$privprojects = 0;
|
||||||
|
|
||||||
|
if ($ownedprojects != null && count($ownedprojects) > 0 )
|
||||||
|
{
|
||||||
foreach($ownedprojects as $proj)
|
foreach($ownedprojects as $proj)
|
||||||
{
|
{
|
||||||
if ($proj->private == 1)
|
if ($proj->private == 1)
|
||||||
@ -301,7 +303,7 @@ class IDF_Views_User
|
|||||||
$pubprojects[] = $proj;
|
$pubprojects[] = $proj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$projectstats = IDF_Views::getProjectsStatistics($pubprojects);
|
$projectstats = IDF_Views::getProjectsStatistics($pubprojects);
|
||||||
//print_r($projectstats);
|
//print_r($projectstats);
|
||||||
//echo $privprojects;
|
//echo $privprojects;
|
||||||
@ -311,10 +313,10 @@ class IDF_Views_User
|
|||||||
$pag = new Pluf_Paginator(new IDF_Issue());
|
$pag = new Pluf_Paginator(new IDF_Issue());
|
||||||
$pag->model_view = "project_find_private";
|
$pag->model_view = "project_find_private";
|
||||||
$pag->class = 'recent-issues';
|
$pag->class = 'recent-issues';
|
||||||
$pag->item_extra_props = array('current_user' => $request->user);
|
$pag->item_extra_props = array('current_user' => $user);
|
||||||
$pag->summary = __('This table shows the open issues.');
|
$pag->summary = __('This table shows the open issues.');
|
||||||
$pag->forced_where = new Pluf_SQL("owner = " . $request->user->id);
|
$pag->forced_where = new Pluf_SQL("owner = " . $user->id);
|
||||||
$pag->action = 'idf_dashboard';
|
$pag->action = array('idf_user_view', array($user->login));
|
||||||
$pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted
|
$pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted
|
||||||
$pag->sort_reverse_order = array('modif_dtime');
|
$pag->sort_reverse_order = array('modif_dtime');
|
||||||
$list_display = array(
|
$list_display = array(
|
||||||
@ -326,16 +328,17 @@ class IDF_Views_User
|
|||||||
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||||
);
|
);
|
||||||
$pag->configure($list_display, array(), array('status', 'modif_dtime'));
|
$pag->configure($list_display, array(), array('status', 'modif_dtime'));
|
||||||
$pag->items_per_page = 10;
|
$pag->items_per_page = 20;
|
||||||
$pag->no_results_text = __('This user has no issues assigned to them!');
|
$pag->no_results_text = __('This user has no issues assigned to them!');
|
||||||
$pag->setFromRequest($request);
|
$pag->setFromRequest($request);
|
||||||
|
|
||||||
$pag2 = new Pluf_Paginator(new IDF_Commit());
|
$pag2 = new Pluf_Paginator(new IDF_Commit());
|
||||||
$pag->model_view = "project_find_private";
|
$pag2->nb_items = 20;
|
||||||
|
$pag2->model_view = "project_find_private";
|
||||||
$pag2->class = 'recent-issues';
|
$pag2->class = 'recent-issues';
|
||||||
$pag2->summary = __('This table shows the latest commits of this user.');
|
$pag2->summary = __('This table shows the latest commits of this user.');
|
||||||
$pag2->forced_where = new Pluf_SQL("author = " . $request->user->id);
|
$pag2->forced_where = new Pluf_SQL("author = " . $user->id);
|
||||||
$pag2->action = 'idf_dashboard';
|
$pag2->action = array('idf_user_view', array($user->login));
|
||||||
$pag2->sort_order = array('creation_dtime', 'ASC'); // will be reverted
|
$pag2->sort_order = array('creation_dtime', 'ASC'); // will be reverted
|
||||||
$pag2->sort_reverse_order = array('creation_dtime');
|
$pag2->sort_reverse_order = array('creation_dtime');
|
||||||
$list_display = array(
|
$list_display = array(
|
||||||
@ -397,3 +400,4 @@ function IDF_Views_IssueSummaryAndLabels($field, $issue, $extra='')
|
|||||||
}
|
}
|
||||||
return sprintf('<a href="%s">%s</a>', $edit, Pluf_esc($issue->summary)).$out;
|
return sprintf('<a href="%s">%s</a>', $edit, Pluf_esc($issue->summary)).$out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,28 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
};
|
};
|
||||||
|
function gotoline()
|
||||||
|
{
|
||||||
|
if ($('.number' + window.location.hash.substring(1)).first().offset() == null)
|
||||||
|
{
|
||||||
|
window.setTimeout(gotoline, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: ($('.number' + window.location.hash.substring(1)).first().offset().top)
|
||||||
|
},500);
|
||||||
|
changegutter();
|
||||||
|
}
|
||||||
|
function changegutter()
|
||||||
|
{
|
||||||
|
if ($('.gutter > [class*=number]').first().offset() == null)
|
||||||
|
{
|
||||||
|
window.setTimeout(changegutter, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$(".gutter > [class*=number]").each(function(){ $(this).html('<a href="https://' + window.location.hostname + window.location.pathname + '#' + $(this).html() +'">' + $(this).html() + '</a>'); });
|
||||||
|
|
||||||
|
}
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
|
||||||
@ -164,7 +186,17 @@ $(function() {
|
|||||||
));
|
));
|
||||||
SyntaxHighlighter.all();
|
SyntaxHighlighter.all();
|
||||||
|
|
||||||
|
if(window.location.hash)
|
||||||
|
{
|
||||||
|
window.setTimeout(gotoline, 100);
|
||||||
|
} else {
|
||||||
|
window.setTimeout(changegutter, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -194,7 +194,7 @@ $(document).ready(function() {
|
|||||||
for(var i = 0; i < 32; i++)
|
for(var i = 0; i < 32; i++)
|
||||||
key += chars[Math.floor(Math.random() * 32)];
|
key += chars[Math.floor(Math.random() * 32)];
|
||||||
$("#id_otpkey").val(key);
|
$("#id_otpkey").val(key);
|
||||||
var url = "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=otpauth%3A%2F%2Ftotp%srchub:" + user + "?secret=" + $("#id_otpkey").val().toUpperCase() + "%26issuer=srchub&choe=UTF-8";
|
var url = "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=otpauth%3A%2F%2Ftotp%2Fsrchub:" + user + "?secret=" + $("#id_otpkey").val().toUpperCase() + "%26issuer=srchub&choe=UTF-8";
|
||||||
$("#QRcode").html('<img src="' + url + '" />')
|
$("#QRcode").html('<img src="' + url + '" />')
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user