Completed
Push — stable8 ( 944059...7e3c21 )
by Blizzz
9s
created

main.php ➔ bookmarklet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 9.6666
1
<?php
2
script('bookmarks', 'settings');
3
script('bookmarks', 'bookmarks');
4
style('bookmarks', 'bookmarks');
5
6
script('bookmarks', '3rdparty/tag-it');
7
script('bookmarks', '3rdparty/js_tpl');
8
style('bookmarks', '3rdparty/jquery.tagit');
9
10
/**
11
 * Copyright (c) 2011 Marvin Thomas Rabe <[email protected]>
12
 * Copyright (c) 2011 Arthur Schiwon <[email protected]>
13
 * This file is licensed under the Affero General Public License version 3 or
14
 * later.
15
 * See the COPYING-README file.
16
 */
17
$bookmarkleturl = $_['bookmarkleturl'];
18
$bookmarkletscript = bookmarklet($bookmarkleturl);
19
20
function bookmarklet($bookmarkleturl) {
21
	$l = new OC_l10n('bookmarks');
22
	$blet = "javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('";
23
	$blet .= $bookmarkleturl;
24
	$blet .= "?output=popup&url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=400px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();";
25
	$help_msg = $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:');
26
	$output = '<div id="bookmarklet_hint" class="bkm_hint">' . $help_msg . '</div><a class="button bookmarklet" href="' . $blet . '">' . $l->t('Add to ownCloud') . '</a>';
27
	return $output;
28
}
29
?>
30
31
<div id="app-navigation">
32
    <ul id="navigation-list">
33
        <li>
34
            <form id="add_form">
35
                <input type="text" id="add_url" value="" placeholder="<?php p($l->t('Address')); ?>"/>
36
                <input type="submit" value="<?php p($l->t('Add')); ?>" id="bookmark_add_submit" />
37
                <div id="add_form_loading"><img src="<?php print_unescaped(OCP\image_path("bookmarks", "loading.gif")); ?>"> </div>
38
            </form>
39
            <p id="tag_filter" class="open">
40
                <input type="text" value="<?php p($_['req_tag']); ?>"/>
41
42
43
            </p>
44
            <input type="hidden" id="bookmarkFilterTag" value="<?php p($_['req_tag']); ?>" />
45
            <label id="tag_select_label"><?php p($l->t('Filterable Tags')); ?></label>
46
        </li>
47
        <li class="tag_list">
48
        </li>
49
    </ul>
50
51
    <div id="app-settings">
52
        <div id="app-settings-header">
53
            <button class="settings-button generalsettings" data-apps-slide-toggle="#app-settings-content" tabindex="0"></button>
54
        </div>
55
        <div id="app-settings-content">
56
57
58
			<?php require 'settings.php'; ?>
59
        </div>
60
    </div>
61
62
</div>
63
<div id="app-content">
64
    <div id="emptycontent" style="display: none;">
65
        <p class="title"><?php
66
			p($l->t('You have no bookmarks'));
67
			$embedded = true;
68
			print_unescaped($bookmarkletscript);
69
			?></p>
70
        <br/><br/>
71
72
73
        <div class="bkm_hint">
74
            <a href="#" id="firstrun_setting">
75
				<?php p($l->t('You can also import a bookmark file')); ?>
76
            </a></div>
77
    </div>
78
    <div class="bookmarks_list"></div>
79
</div>
80
81
<?php
82
require 'js_tpl.php';
83