mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 20:21:37 +00:00
Empty commit
This commit is contained in:
parent
88d8e565f0
commit
eb6d64c3a9
@ -255,6 +255,59 @@ public static function update_site_options($UserID, $NewOptions) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a check list of release types, ordered by the user or default
|
||||
* @global array $SiteOptions
|
||||
* @param boolean $Default Returns the default list if true
|
||||
*/
|
||||
public static function release_order ($Default = false)
|
||||
{
|
||||
global $SiteOptions, $ReleaseTypes;
|
||||
|
||||
$RT = $ReleaseTypes + array(
|
||||
1024 => 'Guest Appearance',
|
||||
1023 => 'Remixed By',
|
||||
1022 => 'Composition',
|
||||
1021 => 'Produced By');
|
||||
|
||||
if ($Default || empty($SiteOptions['SortHide'])) {
|
||||
$Sort =& $RT;
|
||||
$Defaults = !empty($SiteOptions['HideTypes']);
|
||||
} else {
|
||||
$Sort =& $SiteOptions['SortHide'];
|
||||
}
|
||||
|
||||
foreach ($Sort as $Key => $Val) {
|
||||
if (isset($Defaults)) {
|
||||
$Checked = $Defaults && isset($SiteOptions['HideTypes'][$Key]) ? 'checked="checked"' : '';
|
||||
} else {
|
||||
$Checked = $Val ? 'checked="checked"' : '';
|
||||
$Val = isset($RT[$Key]) ? $RT[$Key] : 'Error';
|
||||
}
|
||||
|
||||
$ID = $Key . '_' . (int) !!$Checked;
|
||||
?>
|
||||
|
||||
<li class="sortable_item">
|
||||
<label><input type="checkbox" <?=$Checked?> id="<?=$ID?>" /> <?=$Val?></label>
|
||||
</li>
|
||||
|
||||
<?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default order for the sort list in a JS-friendly string
|
||||
* @return string
|
||||
*/
|
||||
public static function release_order_default_js ()
|
||||
{
|
||||
ob_start();
|
||||
self::release_order(true);
|
||||
$HTML = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return json_encode($HTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string
|
||||
@ -487,7 +540,7 @@ function bookmark_data ($UserID)
|
||||
|
||||
return array($K, $GroupIDs, $CollageDataList, $TorrentList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate HTML for a user's avatar or just return the avatar url
|
||||
* @param unknown $Avatar
|
||||
@ -561,7 +614,7 @@ public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $Ret
|
||||
}
|
||||
return $ToReturn;
|
||||
}
|
||||
|
||||
|
||||
public static function has_avatars_enabled() {
|
||||
global $HeavyInfo;
|
||||
return $HeavyInfo['DisableAvatars'] != 1;
|
||||
|
@ -814,6 +814,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
|
||||
|
||||
if ($TorrentCount == 0) {
|
||||
$DB->query("SELECT
|
||||
tags.Name,
|
||||
((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score
|
||||
FROM xbt_snatched AS s
|
||||
|
@ -41,7 +41,7 @@
|
||||
$Announce .= ' [' . $ReleaseTypes[$Properties['ReleaseType']] . ']';
|
||||
}
|
||||
$Announce .= " - ";
|
||||
$Announce .= trim($ExtraTorrent['Format']) . " / " . trim($ExtraTorrent['Bitrate']);
|
||||
$Announce .= trim(str_replace("'", "", $ExtraTorrent['Format'])) . " / " . trim(str_replace("'", "", $ExtraTorrent['Encoding']));
|
||||
$Announce .= " / " . trim($Properties['Media']);
|
||||
if ($T['FreeLeech'] == "1") {
|
||||
$Announce .= " / Freeleech!";
|
||||
|
@ -32,8 +32,8 @@
|
||||
}
|
||||
|
||||
$Paranoia = unserialize($Paranoia);
|
||||
if(!is_array($Paranoia)) {
|
||||
$Paranoia = array();
|
||||
if(!is_array($Paranoia)) {
|
||||
$Paranoia = array();
|
||||
}
|
||||
|
||||
function paranoia_level($Setting) {
|
||||
@ -52,22 +52,22 @@ function checked($Checked) {
|
||||
return $Checked ? 'checked="checked"' : '';
|
||||
}
|
||||
|
||||
if ($SiteOptions) {
|
||||
$SiteOptions = unserialize($SiteOptions);
|
||||
} else {
|
||||
if ($SiteOptions) {
|
||||
$SiteOptions = unserialize($SiteOptions);
|
||||
} else {
|
||||
$SiteOptions = array();
|
||||
}
|
||||
|
||||
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings');
|
||||
|
||||
$DB->query("SELECT PushService, PushOptions FROM
|
||||
$DB->query("SELECT PushService, PushOptions FROM
|
||||
users_push_notifications WHERE UserID = '$LoggedUser[ID]'");
|
||||
|
||||
list($PushService, $PushOptions) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
if ($PushOptions) {
|
||||
$PushOptions = unserialize($PushOptions);
|
||||
} else {
|
||||
if ($PushOptions) {
|
||||
$PushOptions = unserialize($PushOptions);
|
||||
} else {
|
||||
$PushOptions = array();
|
||||
}
|
||||
echo $Val->GenerateJS('userform');
|
||||
@ -153,62 +153,19 @@ function checked($Checked) {
|
||||
<tr>
|
||||
<td class="label"><strong>Sort/Hide release types</strong></td>
|
||||
<td>
|
||||
<table class="layout" style="border:none;">
|
||||
<?
|
||||
$ReleaseTypes[1024] = "Guest Appearance";
|
||||
$ReleaseTypes[1023] = "Remixed By";
|
||||
$ReleaseTypes[1022] = "Composition";
|
||||
$ReleaseTypes[1021] = "Produced By";
|
||||
?>
|
||||
|
||||
<a href="#" id="toggle_sortable" onclick="return false;">Expand</a>
|
||||
<div id="sortable_container" style="display: none;">
|
||||
<a href="#" id="reset_sortable" onclick="return false;">Reset to Default</a>
|
||||
<ul class="sortable_list" id="sortable">
|
||||
|
||||
<?
|
||||
//Generate list of release types for sorting and hiding.
|
||||
//If statement is in place because on the first usage user will not have 'SortHide' set in $SiteOptions
|
||||
if(empty($SiteOptions['SortHide'])) {
|
||||
for($i = 0; list($Key,$Val) = each($ReleaseTypes); $i++) {
|
||||
if(!empty($SiteOptions['HideTypes']) && in_array($Key, $SiteOptions['HideTypes'])) {
|
||||
$Checked = 'checked="checked" ';
|
||||
} else {
|
||||
$Checked='';
|
||||
}
|
||||
?>
|
||||
<li class="sortable_item"><input type="checkbox" <?=$Checked?>
|
||||
id="<?=$Key."_".($Checked == 'checked="checked" ' ? 1 : 0)?>"><?=$Val?></li>
|
||||
<? }
|
||||
}
|
||||
else {
|
||||
for($i = 0; list($Key,$Val) = each($SiteOptions['SortHide']); $i++) {
|
||||
if($Val == true) {
|
||||
$Checked = 'checked="checked" ';
|
||||
} else {
|
||||
$Checked='';
|
||||
}
|
||||
if(array_key_exists($Key, $ReleaseTypes)) {
|
||||
$Name = $ReleaseTypes[$Key];
|
||||
}
|
||||
else {
|
||||
$Name = "Error";
|
||||
}
|
||||
?>
|
||||
<li class="sortable_item"><input type="checkbox" <?=$Checked?>
|
||||
id="<?=$Key."_".($Checked == 'checked="checked" ' ? 1 : 0)?>"><?=$Name?></li>
|
||||
<? }
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<input type="hidden" id="sorthide" name="sorthide" value=""/>
|
||||
|
||||
<?
|
||||
unset($ReleaseTypes[1023], $ReleaseTypes[1024], $ReleaseTypes[1022]);
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<noscript>Please enable JavaScript to use these options.</noscript>
|
||||
<a href="#" id="toggle_sortable">Expand</a>
|
||||
<div id="sortable_container" style="display: none;">
|
||||
<a href="#" id="reset_sortable">Reset to Default</a>
|
||||
<ul class="sortable_list" id="sortable">
|
||||
<?Users::release_order()?>
|
||||
</ul>
|
||||
<p><small>Note: Checked items will be hidden.</small></p>
|
||||
<script type="text/javascript" id="sortable_default">
|
||||
var sortable_list_default = <?=Users::release_order_default_js()?>;
|
||||
</script>
|
||||
</div>
|
||||
<input type="hidden" id="sorthide" name="sorthide" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
@ -266,7 +223,7 @@ function checked($Checked) {
|
||||
<tr>
|
||||
<td class="label"><strong>Avatars</strong></td>
|
||||
<td>
|
||||
<select name="disableavatars" id="disableavatars" onclick="ToggleIdenticons();">
|
||||
<select name="disableavatars" id="disableavatars" onclick="ToggleIdenticons();">
|
||||
<option value="1" <? if($SiteOptions['DisableAvatars'] == 1) { ?> selected="selected" <? } ?>/>Disable avatars</option>
|
||||
<option value="0" <? if($SiteOptions['DisableAvatars'] == 0) { ?> selected="selected" <? } ?>/>Show avatars</option>
|
||||
<option value="2" <? if($SiteOptions['DisableAvatars'] == 2) { ?> selected="selected" <? } ?>/>Show avatars or:</option>
|
||||
@ -307,7 +264,7 @@ function checked($Checked) {
|
||||
<input type="checkbox" name="pushfilters[]" value="News" <? if(isset($PushOptions['PushFilters']['News'])) { ?> checked="checked" <? } ?>/>Announcements<br />
|
||||
<input type="checkbox" name="pushfilters[]" value="PM" <? if(isset($PushOptions['PushFilters']['PM'])) { ?> checked="checked" <? } ?>/>Private Messages<br />
|
||||
<? /* <input type="checkbox" name="pushfilters[]" value="Rippy" <? if(isset($PushOptions['PushFilters']['Rippy'])) { ?> checked="checked" <? } ?>/>Rippys<br /> */ ?>
|
||||
|
||||
|
||||
[<a href="user.php?action=take_push&push=1&userid=<?=$UserID?>&auth=<?=$LoggedUser['AuthKey']?>">Test Push</a>]
|
||||
[<a href="wiki.php?action=article&id=1017">Wiki Guide</a>]
|
||||
</div>
|
||||
@ -322,7 +279,7 @@ function checked($Checked) {
|
||||
<option value="PM" <? if($SiteOptions['Rippy'] == 'PM' || empty($SiteOptions['Rippy'])) { ?> selected="selected" <? } ?> >Personal rippies only</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Auto-save Text</strong></td>
|
||||
<td>
|
||||
|
@ -468,6 +468,162 @@ function check_paranoia_here($Setting) {
|
||||
</div>
|
||||
<?
|
||||
include(SERVER_ROOT.'/sections/user/community_stats.php');
|
||||
?>
|
||||
</div>
|
||||
<div class="main_column">
|
||||
<?
|
||||
if ($RatioWatchEnds!='0000-00-00 00:00:00'
|
||||
&& (time() < strtotime($RatioWatchEnds))
|
||||
&& ($Downloaded*$RequiredRatio)>$Uploaded
|
||||
) {
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="head">Ratio watch</div>
|
||||
<div class="pad">This user is currently on ratio watch and must upload <?=Format::get_size(($Downloaded*$RequiredRatio)-$Uploaded)?> in the next <?=time_diff($RatioWatchEnds)?>, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: <?=Format::get_size($Downloaded-$RatioWatchDownload)?></div>
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="box">
|
||||
<div class="head">
|
||||
<span style="float:left;">Profile<? if ($CustomTitle) { echo " - ".html_entity_decode($DisplayCustomTitle); } ?></span>
|
||||
<span style="float:right;"><?=!empty($Badges)?"$Badges ":''?><a href="#" onclick="$('#profilediv').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;">(Hide)</a></span>
|
||||
</div>
|
||||
<div class="pad" id="profilediv">
|
||||
<? if (!$Info) { ?>
|
||||
This profile is currently empty.
|
||||
<?
|
||||
} else {
|
||||
echo $Text->full_format($Info);
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
if ($Snatched > 4 && check_paranoia_here('snatched')) {
|
||||
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
|
||||
if(!is_array($RecentSnatches)){
|
||||
$DB->query("SELECT
|
||||
g.ID,
|
||||
g.Name,
|
||||
g.WikiImage
|
||||
FROM xbt_snatched AS s
|
||||
INNER JOIN torrents AS t ON t.ID=s.fid
|
||||
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
|
||||
WHERE s.uid='$UserID'
|
||||
AND g.CategoryID='1'
|
||||
AND g.WikiImage <> ''
|
||||
GROUP BY g.ID
|
||||
ORDER BY s.tstamp DESC
|
||||
LIMIT 5");
|
||||
$RecentSnatches = $DB->to_array();
|
||||
|
||||
$Artists = Artists::get_artists($DB->collect('ID'));
|
||||
foreach($RecentSnatches as $Key => $SnatchInfo) {
|
||||
$RecentSnatches[$Key]['Artist'] = Artists::display_artists($Artists[$SnatchInfo['ID']], false, true);
|
||||
}
|
||||
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0); //inf cache
|
||||
}
|
||||
?>
|
||||
<table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr class="colhead">
|
||||
<td colspan="5">Recent Snatches</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
foreach($RecentSnatches as $RS) { ?>
|
||||
<td>
|
||||
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=to_thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
if(!isset($Uploads)) { $Uploads = 0; }
|
||||
if ($Uploads > 4 && check_paranoia_here('uploads')) {
|
||||
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
|
||||
if(!is_array($RecentUploads)){
|
||||
$DB->query("SELECT
|
||||
g.ID,
|
||||
g.Name,
|
||||
g.WikiImage
|
||||
FROM torrents_group AS g
|
||||
INNER JOIN torrents AS t ON t.GroupID=g.ID
|
||||
WHERE t.UserID='$UserID'
|
||||
AND g.CategoryID='1'
|
||||
AND g.WikiImage <> ''
|
||||
GROUP BY g.ID
|
||||
ORDER BY t.Time DESC
|
||||
LIMIT 5");
|
||||
$RecentUploads = $DB->to_array();
|
||||
$Artists = Artists::get_artists($DB->collect('ID'));
|
||||
foreach($RecentUploads as $Key => $UploadInfo) {
|
||||
$RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
|
||||
}
|
||||
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0); //inf cache
|
||||
}
|
||||
?>
|
||||
<table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr class="colhead">
|
||||
<td colspan="5">Recent Uploads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<? foreach($RecentUploads as $RU) { ?>
|
||||
<td>
|
||||
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=to_thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
$DB->query("SELECT ID, Name FROM collages WHERE UserID='$UserID' AND CategoryID='0' AND Deleted='0' ORDER BY Featured DESC, Name ASC");
|
||||
$Collages = $DB->to_array();
|
||||
$FirstCol = true;
|
||||
foreach ($Collages as $CollageInfo) {
|
||||
list($CollageID, $CName) = $CollageInfo;
|
||||
$DB->query("SELECT ct.GroupID,
|
||||
tg.WikiImage,
|
||||
tg.CategoryID
|
||||
FROM collages_torrents AS ct
|
||||
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
|
||||
WHERE ct.CollageID='$CollageID'
|
||||
ORDER BY ct.Sort LIMIT 5");
|
||||
$Collage = $DB->to_array();
|
||||
?>
|
||||
<table class="layout recent" id="collage<?=$CollageID?>" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr class="colhead">
|
||||
<td colspan="5">
|
||||
<span style="float:left;">
|
||||
<?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>">see full</a>
|
||||
</span>
|
||||
<span style="float:right;">
|
||||
<a href="#" onclick="$('#collage<?=$CollageID?> .images').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;"><?=$FirstCol?'(Hide)':'(Show)'?></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="images <?=$FirstCol?'':' hidden'?>">
|
||||
<? foreach($Collage as $C) {
|
||||
$Group = Torrents::get_groups(array($C['GroupID']));
|
||||
$Group = array_pop($Group['matches']);
|
||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
|
||||
|
||||
$Name = '';
|
||||
$Name .= Artists::display_artists(array('1'=>$GroupArtists), false, true);
|
||||
$Name .= $GroupName;
|
||||
?>
|
||||
<td>
|
||||
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=to_thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
$FirstCol = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Linked accounts
|
||||
|
@ -1,40 +1,40 @@
|
||||
//Couldn't use an associative array because javascript sorting is stupid http://dev-answers.blogspot.com/2012/03/javascript-object-keys-being-sorted-in.html
|
||||
|
||||
(function($) {
|
||||
var DEFAULT = '\x3Cul class=\"sortable_list ui-sortable\" id=\"sortable\" style=\"\"\x3E\n\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1_0\"\x3EAlbum\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"3_0\"\x3ESoundtrack\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"5_0\"\x3EEP\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"6_0\"\x3EAnthology\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"7_0\"\x3ECompilation\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"9_0\"\x3ESingle\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"11_0\"\x3ELive album\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"13_0\"\x3ERemix\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"14_0\"\x3EBootleg\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"15_0\"\x3EInterview\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"16_0\"\x3EMixtape\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"21_0\"\x3EUnknown\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1024_0\"\x3EGuest Appearance\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1023_0\"\x3ERemixed By\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1022_0\"\x3EComposition\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1021_0\"\x3EProduced By\x3C\x2Fli\x3E\n\t\t\x3C\x2Ful\x3E';
|
||||
$(document).ready(function() {
|
||||
jQuery(document).ready(function ($) {
|
||||
var serialize = function () {
|
||||
var a = [];
|
||||
$('#sortable input').each(function () {
|
||||
a.push($(this).attr('id'));
|
||||
});
|
||||
$('#sorthide').val(JSON.stringify(a));
|
||||
};
|
||||
|
||||
serialize();
|
||||
$("#sortable").sortable({
|
||||
placeholder: "ui-state-highlight",
|
||||
update: function() {
|
||||
serialize();
|
||||
}
|
||||
});
|
||||
$("#toggle_sortable").click(function () {
|
||||
$('#sortable_container').slideToggle(function() {
|
||||
$("#toggle_sortable").text($(this).is(":visible") ? "Collapse" : "Expand");
|
||||
|
||||
$('#sortable')
|
||||
.on('click', 'input', function () {
|
||||
// the + converts the boolean to either 1 or 0
|
||||
var c = +$(this).is(':checked'),
|
||||
old_id = $(this).attr('id'),
|
||||
new_id = old_id.slice(0, -1) + c;
|
||||
$(this).attr('id', new_id);
|
||||
serialize();
|
||||
})
|
||||
.sortable({
|
||||
placeholder: 'ui-state-highlight',
|
||||
update: serialize
|
||||
});
|
||||
|
||||
$('#toggle_sortable').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('#sortable_container').slideToggle(function () {
|
||||
$('#toggle_sortable').text($(this).is(':visible') ? 'Collapse' : 'Expand');
|
||||
});
|
||||
});
|
||||
$("#reset_sortable").click(function () {
|
||||
$('#sortable').html(DEFAULT);
|
||||
|
||||
$('#reset_sortable').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('#sortable').html(sortable_list_default); // var sortable_list_default is found on edit.php
|
||||
serialize();
|
||||
});
|
||||
});
|
||||
function serialize() {
|
||||
var a = new Array();
|
||||
$("#sortable").find("input").each(function (i) {
|
||||
$(this).unbind("click");
|
||||
$(this).click(function() {
|
||||
var c = $(this).attr("checked") == "checked" ? 1 : 0;
|
||||
var old_id = $(this).attr("id");
|
||||
var new_id = old_id.slice(0, - 1) + c;
|
||||
$(this).attr("id", new_id);
|
||||
serialize();
|
||||
});
|
||||
a.push($(this).attr("id"));
|
||||
});
|
||||
$("#sorthide").val(JSON.stringify(a));
|
||||
}
|
||||
}
|
||||
(jQuery));
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user