1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-19 16:54:27 +01:00

Fix style in bookmark. thanks to ci

This commit is contained in:
Brice Maron 2012-10-10 19:05:34 +00:00
parent 59b4f2ea9f
commit f813d338f2
14 changed files with 92 additions and 63 deletions

View File

@ -43,8 +43,8 @@ else{
}
OCP\Util::addscript('bookmarks','tag-it');
OCP\Util::addscript('bookmarks','addBm');
OCP\Util::addscript('bookmarks', 'tag-it');
OCP\Util::addscript('bookmarks', 'addBm');
OCP\Util::addStyle('bookmarks', 'bookmarks');
OCP\Util::addStyle('bookmarks', 'jquery.tagit');

View File

@ -26,8 +26,7 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
if(isset($_POST['old_name']))
{
if(isset($_POST['old_name'])) {
OC_Bookmarks_Bookmarks::deleteTag($_POST['old_name']);
OCP\JSON::success();
exit();

View File

@ -24,12 +24,12 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
require_once OC_App::getAppPath('bookmarks').'/bookmarksHelper.php';
$req_type=isset($_GET['type']) ? $_GET['type'] : '';
if($req_type == 'url_info' && $_GET['url']) {
$datas = getURLMetadata($_GET['url']);
$datas = getURLMetadata($_GET['url']);
$title = isset($datas['title']) ? $datas['title'] : '';
OCP\JSON::success(array('title' => $title));
exit();

View File

@ -30,8 +30,7 @@ $RUNTIME_NOSETUPFS=true;
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
if(isset($_POST['old_name']) && isset($_POST['new_name']) && $_POST['new_name'] != '')
{
if(isset($_POST['old_name']) && isset($_POST['new_name']) && $_POST['new_name'] != '') {
OC_Bookmarks_Bookmarks::renameTag($_POST['old_name'], $_POST['new_name']);
OCP\JSON::success();
exit();

View File

@ -25,7 +25,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
require_once OC_App::getAppPath('bookmarks').'/bookmarksHelper.php';
$req_type= isset($_GET['type']) ? $_GET['type'] : 'bookmark';

View File

@ -36,7 +36,10 @@ function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) {
curl_close($rch);
if (!$mr) {
if ($maxredirect === null) {
OCP\Util::writeLog('bookmark', 'Too many redirects. When following redirects, libcurl hit the maximum amount on bookmark', OCP\Util::ERROR);
OCP\Util::writeLog(
'bookmark',
'Too many redirects. When following redirects, libcurl hit the maximum amount on bookmark',
OCP\Util::ERROR);
} else {
$maxredirect = 0;
}
@ -72,7 +75,7 @@ function getURLMetadata($url) {
}
function analyzeTagRequest($line) {
$tags = explode(',',$line);
$tags = explode(',', $line);
$filterTag = array();
foreach($tags as $tag){
if(trim($tag) != '')

View File

@ -22,9 +22,10 @@ Do Not Edit! -->
<DL><p>
EOT;
$bookmarks = OC_Bookmarks_Bookmarks::findBookmarks(0, 'id', array(), true,-1);
$bookmarks = OC_Bookmarks_Bookmarks::findBookmarks(0, 'id', array(), true, -1);
foreach($bookmarks as $bm) {
$file .= '<DT><A HREF="'.$bm['url'].'" TAGS="'.implode(',',$bm['tags']).'">'.htmlspecialchars($bm['title'], ENT_QUOTES, 'UTF-8').'</A>';
$file .= '<DT><A HREF="'.$bm['url'].'" TAGS="'.implode(',', $bm['tags']).'">';
$file .= htmlspecialchars($bm['title'], ENT_QUOTES, 'UTF-8').'</A>';
if($bm['description'])
$file .= '<DD>'.htmlspecialchars($bm['description'], ENT_QUOTES, 'UTF-8');
}

View File

@ -29,13 +29,13 @@ OCP\App::checkAppEnabled('bookmarks');
OCP\App::setActiveNavigationEntry( 'bookmarks_index' );
OCP\Util::addscript('bookmarks','bookmarks');
OCP\Util::addscript('bookmarks', 'bookmarks');
OCP\Util::addStyle('bookmarks', 'bookmarks');
OCP\Util::addscript('bookmarks','addBm');
OCP\Util::addscript('bookmarks', 'addBm');
OCP\Util::addscript('bookmarks','tag-it');
OCP\Util::addscript('bookmarks','js_tpl');
OCP\Util::addscript('bookmarks', 'tag-it');
OCP\Util::addscript('bookmarks', 'js_tpl');
OCP\Util::addStyle('bookmarks', 'jquery.tagit');
$qtags = OC_Bookmarks_Bookmarks::findTags();
@ -55,6 +55,6 @@ $tmpl = new OCP\Template( 'bookmarks', 'list', 'user' );
$tmpl->assign('bookmark', $bm);
$tmpl->assign('req_tag',isset($_GET['tag']) ? $_GET['tag'] : '');
$tmpl->assign('req_tag', isset($_GET['tag']) ? $_GET['tag'] : '');
$tmpl->assign('tags', json_encode($tags), false);
$tmpl->printPage();

View File

@ -29,14 +29,16 @@ class OC_Bookmarks_Bookmarks{
* @brief Finds all tags for bookmarks
*/
public static function findTags($filterTags = array(), $offset = 0, $limit = 10){
//$query = OCP\DB::prepare('SELECT tag, count(*) as nbr from *PREFIX*bookmarks_tags group by tag LIMIT '.$offset.', '.$limit);
$params = array_merge($filterTags,$filterTags);
$params = array_merge($filterTags, $filterTags);
array_unshift($params, OCP\USER::getUser());
$not_in = '';
if(!empty($filterTags) ) {
$not_in = ' AND tag not in ('. implode(',',array_fill(0, count($filterTags) ,'?') ) .')'.
str_repeat(" AND exists (select 1 from *PREFIX*bookmarks_tags t2 where t2.bookmark_id = t.bookmark_id and tag = ?) ", count($filterTags));
$exist_clause = " AND exists (select 1 from *PREFIX*bookmarks_tags
t2 where t2.bookmark_id = t.bookmark_id and tag = ?) ";
$not_in = ' AND tag not in ('. implode(',', array_fill(0, count($filterTags), '?') ) .')'.
str_repeat($exist_clause, count($filterTags));
}
$sql = 'SELECT tag, count(*) as nbr from *PREFIX*bookmarks_tags t '.
' WHERE EXISTS( SELECT 1 from *PREFIX*bookmarks bm where t.bookmark_id = bm.id and user_id = ?) '.
@ -74,7 +76,9 @@ class OC_Bookmarks_Bookmarks{
WHERE user_id = ? ";
if($filterTagOnly) {
$sql .= str_repeat(" AND exists (select id from *PREFIX*bookmarks_tags t2 where t2.bookmark_id = b.id and tag = ?) ", count($filters));
$exist_clause = " AND exists (select id from *PREFIX*bookmarks_tags
t2 where t2.bookmark_id = b.id and tag = ?) ";
$sql .= str_repeat($exist_clause, count($filters));
$params = array_merge($params, $filters);
} else {
foreach($filters as $filter) {
@ -136,22 +140,22 @@ class OC_Bookmarks_Bookmarks{
$CONFIG_DBTYPE = OCP\Config::getSystemValue( 'dbtype', 'sqlite' );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ) {
// Update tags to the new label unless it already exists a tag like this
$query = OCP\DB::prepare("
UPDATE OR REPLACE *PREFIX*bookmarks_tags
SET tag = ?
WHERE tag = ?
AND exists( select b.id from *PREFIX*bookmarks b where b.user_id = ? and bookmark_id = b.id)
");
$query = OCP\DB::prepare("
UPDATE OR REPLACE *PREFIX*bookmarks_tags
SET tag = ?
WHERE tag = ?
AND exists( select b.id from *PREFIX*bookmarks b where b.user_id = ? and bookmark_id = b.id)
");
$params=array(
$new,
$old,
$user_id,
);
$params=array(
$new,
$old,
$user_id,
);
$result = $query->execute($params);
$result = $query->execute($params);
} else {
// Remove potentialy duplicated tags
@ -207,7 +211,7 @@ class OC_Bookmarks_Bookmarks{
);
$result = $query->execute($params);
return true;
return $result;
}
/**
@ -217,7 +221,7 @@ class OC_Bookmarks_Bookmarks{
*/
protected static function getNowValue() {
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ) {
$_ut = "strftime('%s','now')";
} elseif($CONFIG_DBTYPE == 'pgsql') {
$_ut = 'date_part(\'epoch\',now())::integer';
@ -277,7 +281,7 @@ class OC_Bookmarks_Bookmarks{
}
/**
* Add a bookmark
* Add a bookmark
* @param string $url
* @param string $title Name of the bookmark
* @param array $tags Simple array of tags to qualify the bookmark (different tags are taken from values)
@ -351,7 +355,6 @@ class OC_Bookmarks_Bookmarks{
$dom->loadHTMLFile($file);
$links = $dom->getElementsByTagName('a');
$things = array();
OCP\DB::beginTransaction();
foreach($links as $link) {
@ -360,10 +363,9 @@ class OC_Bookmarks_Bookmarks{
$tag_str = '';
if($link->hasAttribute("tags"))
$tag_str = $link->getAttribute("tags");
$tags = explode(',' , $tag_str);
$tags = explode(',', $tag_str);
self::addBookmark($ref, $title, $tags);
//$things[] = array('title' => $title, 'ref'=>$ref, 'tags' => $tags);
}
OCP\DB::commit();
return array();

View File

@ -35,7 +35,7 @@ class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
$bookmarks = OC_Bookmarks_Bookmarks::searchBookmarks($search_words);
$l = new OC_l10n('bookmarks'); //resulttype can't be localized, javascript relies on that type
foreach($bookmarks as $bookmark) {
$results[]=new OC_Search_Result($bookmark['title'],'', $bookmark['url'], (string) $l->t('Bookm.'));
$results[]=new OC_Search_Result($bookmark['title'], '', $bookmark['url'], (string) $l->t('Bookm.'));
}
return $results;

View File

@ -22,8 +22,8 @@ if (isset($_POST['bm_import'])) {
$tmpl = new OCP\Template('bookmarks', 'settings');
// Any problems?
if(count($error)){
$tmpl->assign('error',$error);
if(count($error)) {
$tmpl->assign('error', $error);
}
return $tmpl->fetchPage();
} else {

View File

@ -9,16 +9,22 @@
});
</script>
<h1><?php echo $l->t('Add a bookmark');?></h1>
<div class="close_btn"><a href="javascript:self.close()" class="ui-icon ui-icon-closethick"><?php echo $l->t('Close');?></a></div>
<div class="close_btn">
<a href="javascript:self.close()" class="ui-icon ui-icon-closethick">
<?php echo $l->t('Close');?>
</a>
</div>
<?php endif;?>
<fieldset class="bm_desc">
<ul>
<li>
<input type="text" name="title" class="title" value="<?php echo $_['bookmark']['title']; ?>" placeholder="<?php echo $l->t('The title of the page');?>" />
<input type="text" name="title" class="title" value="<?php echo $_['bookmark']['title']; ?>"
placeholder="<?php echo $l->t('The title of the page');?>" />
</li>
<li>
<input type="text" name="url" class="url_input" value="<?php echo $_['bookmark']['url']; ?>" placeholder="<?php echo $l->t('The address of the page');?>" />
<input type="text" name="url" class="url_input" value="<?php echo $_['bookmark']['url']; ?>"
placeholder="<?php echo $l->t('The address of the page');?>" />
</li>
<li>
@ -30,7 +36,8 @@
</li>
<li>
<textarea name="description" class="desc" value="<?php echo $_['bookmark']['desc']; ?>" placeholder="<?php echo $l->t('Description of the page');?>"></textarea>
<textarea name="description" class="desc" value="<?php echo $_['bookmark']['desc']; ?>"
placeholder="<?php echo $l->t('Description of the page');?>"></textarea>
</li>
<li>

View File

@ -19,8 +19,6 @@
</div>
<div id="leftcontent">
<div class="centercontent">
<!--<img class="left_img svg" src="<?php echo OCP\image_path('bookmarks','triangle-w.svg'); ?>">
<img class="right_img svg" src="<?php echo OCP\image_path('bookmarks','triangle-e.svg'); ?>">-->
<span class="left_img"> <?php echo $l->t('Hide')?> &lt;&lt;</span>
<span class="right_img"> <?php echo $l->t('Show')?> &gt;&gt;</span>
</div>
@ -48,12 +46,13 @@
var fullTags = <?php echo $_['tags'];?>;
var init_view = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'bookmarks', 'currentview', 'text');?>';
var init_sidebar = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'bookmarks', 'sidebar', 'true');?>';
var shot_provider = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'bookmarks', 'shot_provider', 'http://screenshots.bookmarkly.com/thumb?url={url}');?>';
var shot_provider = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(),
'bookmarks', 'shot_provider', 'http://screenshots.bookmarkly.com/thumb?url={url}');?>';
//http://api.thumbalizr.com/?width={width}&url={url}
</script>
<script type="text/html" id="edit_dialog_tmpl">
<?php include 'addBm.php';?>
<?php require 'addBm.php';?>
</script>
@ -61,16 +60,24 @@
<div class="bookmark_single" data-id="<%= id %>">
<p class="bookmark_actions">
<span class="bookmark_edit">
<img class="svg" src="<?php echo OCP\image_path("", "actions/rename.svg");?>" title="<?php echo $l->t('Edit');?>">
<img class="svg" src="<?php echo OCP\image_path("", "actions/rename.svg");?>"
title="<?php echo $l->t('Edit');?>">
</span>
<span class="bookmark_delete">
<img class="svg" src="<?php echo OCP\image_path("", "actions/delete.svg");?>" title="<?php echo $l->t('Delete');?>">
<img class="svg" src="<?php echo OCP\image_path("", "actions/delete.svg");?>"
title="<?php echo $l->t('Delete');?>">
</span>&nbsp;
</p>
<p class="bookmark_title">
<a href="<%= encodeEntities(url) %>" target="_blank" class="bookmark_link"><%= encodeEntities(title == '' ? url : title ) %></a>
<a href="<%= encodeEntities(url) %>" target="_blank" class="bookmark_link">
<%= encodeEntities(title == '' ? url : title ) %>
</a>
</p>
<p class="bookmark_url">
<a href="<%= encodeEntities(url) %>" target="_blank" class="bookmark_link">
<%= encodeEntities(url) %>
</a>
</p>
<p class="bookmark_url"><a href="<%= encodeEntities(url) %>" target="_blank" class="bookmark_link"><%= encodeEntities(url) %></a></p>
<p class="bookmark_date"><%= formatDate(added_date) %></p>
<p class="bookmark_desc"><%= encodeEntities(description)%> </p>
</div>
@ -81,16 +88,25 @@
<form method="post" action="<?php echo OCP\Util::linkTo('bookmarks', 'ajax/editBookmark.php');?>" >
<input type="hidden" name="record_id" value="<%= id %>" />
<p class="bookmark_form_title">
<input type="text" name="title" placeholder="<?php echo $l->t('The title of the page');?>" value="<%= title %>"/>
<input type="text" name="title" placeholder="<?php echo $l->t('The title of the page');?>"
value="<%= title %>"/>
</p>
<p class="bookmark_form_url">
<input type="text" name="url" placeholder="<?php echo $l->t('The address of the page');?>"
value="<%= encodeEntities(url)%>"/>
</p>
<p class="bookmark_form_url"><input type="text" name="url" placeholder=""<?php echo $l->t('The address of the page');?>" value="<%= encodeEntities(url)%>"/></p>
<div class="bookmark_form_tags"><ul>
<% for ( var i = 0; i < tags.length; i++ ) { %>
<li><%=tags[i]%></li>
<% } %>
</ul></div>
<p class="bookmark_form_desc"><textarea name="description" placeholder="<?php echo $l->t('Description of the page');?>"><%= description%></textarea> </p>
<p class="bookmark_form_submit"><button class="reset" ><?php echo $l->t('Cancel');?></button><input type="submit" value="<?php echo $l->t('Save');?>"></p>
<p class="bookmark_form_desc">
<textarea name="description" placeholder="<?php echo $l->t('Description of the page');?>"
><%= description%></textarea>
</p>
<p class="bookmark_form_submit"><button class="reset" ><?php echo $l->t('Cancel');?></button>
<input type="submit" value="<?php echo $l->t('Save');?>">
</p>
</form>
</div>
</script>

View File

@ -24,13 +24,15 @@
<?php endif; ?>
<legend><strong><?php echo $l->t('Import bookmarks');?></strong></legend>
<p><input type="file" id="bm_import" name="bm_import" style="width:280px;"><label for="bm_import"> <?php echo $l->t('Bookmark html file');?></label>
<p><input type="file" id="bm_import" name="bm_import" style="width:280px;">
<label for="bm_import"> <?php echo $l->t('Bookmark html file');?></label>
</p>
<input type="submit" name="bm_import" value="<?php echo $l->t('Import'); ?>" />
<legend><strong><?php echo $l->t('Export bookmarks');?></strong></legend>
<p><a href="<?php echo OCP\Util::linkTo('bookmarks', 'export.php') ;?>" class="button"><?php echo $l->t('Export'); ?></a></p>
<p><a href="<?php echo OCP\Util::linkTo('bookmarks', 'export.php') ;?>"
class="button"><?php echo $l->t('Export'); ?></a></p>
</fieldset>
</form>