Changeset 889

Show
Ignore:
Timestamp:
11/27/05 15:46:37 (3 years ago)
Author:
hirokai
Message:

massive internal cleanup for tag name storage and privacy options, plus
working test version of AJAX-editable tag names and link names inside of lists

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/feedmelinks/feedmelinks/categorize.php

    r823 r889  
    194194                        while( $count < $numRows ) { 
    195195                                $idx         = $catsRendered; # $i*$rows+$j; 
    196                                 $id         = mysql_result($q, $idx, "ID"); 
    197                                 $options    = mysql_result($q, $idx, "options"); 
     196                                $id          = mysql_result($q, $idx, "ID"); 
     197                                $isPrivate   = mysql_result($q, $idx, "isPrivate"); 
    198198                                $catName = makeSafeName( mysql_result($q, $idx, "name")); 
    199199                                $public = 0; 
    200                                 if( isPublic( $catName )) { 
     200                                if( ! $isPrivate ) { 
    201201                                        $catName = makePrettyFolderName( $catName ); 
    202202                                        ++$public; 
    203203                                } 
    204                                 $categories[$count] = array( $catName, $options, $id, $public ); 
     204                                $categories[$count] = array( $catName, "", $id, $public ); 
    205205                                $catsRendered++; 
    206206                                $count++; 
     
    250250                                        $idx        = $catsRendered; # $i*$rows+$j; 
    251251                                        $id         = $category[2]; 
    252                                         $options    = $category[1]; 
    253252                                        $catName = $category[0]; 
    254253                                        $public     = $category[3]; 
  • trunk/feedmelinks/feedmelinks/delete.php

    r559 r889  
    4545      $numRows2 = mysql_num_rows($q2); 
    4646      if( $numRows2 ) { 
    47         $folder   = urldecode( mysql_result($q2,0,"name")); 
    48         $folderID = urldecode( mysql_result($q2,0,"ID")); 
     47        $tag   = urldecode( mysql_result($q2,0,"name")); 
     48        $tagID = urldecode( mysql_result($q2,0,"ID")); 
     49        $isPrivate = urldecode( mysql_result($q2,0,"isPrivate")); 
    4950      } 
    5051    } else 
    51       $folder = "unnamed"; 
     52      $tag = "unnamed"; 
    5253    $public = 0; 
    53     if( isPublic( $folder )) { 
    54       $folder = makePrettyFolderName( $folder ); 
     54    if( ! $isPrivate ) { 
     55      $tag = makePrettyFolderName( $tag ); 
    5556      ++$public; 
    5657    } 
     
    6667%> 
    6768<form action="index"> 
    68 <input type="hidden" name="folder" value="<%= $folderID %>" /> 
     69<input type="hidden" name="folder" value="<%= $tagID %>" /> 
    6970<input type="hidden" name="from" value="popup" /> 
    7071<div class="attention"> 
     
    7374 
    7475<p> 
    75 <input type="button" value="Delete" class="default button" onClick="location.replace( '/index?op=delete&id=<%= $id %>&folder=<%= urlencode( $folder ) %>');" /> 
     76<input type="button" value="Delete" class="default button" onClick="location.replace( '/index?op=delete&id=<%= $id %>&folder=<%= urlencode( $tag ) %>');" /> 
    7677<input type="button" value="Cancel" class="default button" onClick="javascript:window.close();" /> 
    7778 
  • trunk/feedmelinks/feedmelinks/edit-folder.php

    r881 r889  
    3333                                echo "<br />DEBUG: saving \"$name\", id $id<br />"; 
    3434 
    35                         $name = $isPrivate ? $name : makePublicFolderName( $name ); 
    3635                        $name = urlencode( $name ); 
    37                         $qs = "UPDATE linksGroups SET name = '$name' WHERE id = $id AND userid = '$u'"; 
     36                        $isPrivate = $isPrivate ? 1 : "NULL"; 
     37                        $qs = "UPDATE linksGroups SET name = '$name', isPrivate = $isPrivate WHERE id = $id AND userid = '$u'"; 
    3838 
    3939                        if( $debug ) { 
     
    4343                        $q = mysql_query( $qs ); 
    4444                        if( $q ) { 
    45                                 if( $isPrivate ) { 
     45                                if( $isPrivate == 1 ) { 
    4646                                        if( $debug )  
    4747                                                echo "DEBUG: the " . getCatName() . " \"$name\" is now/still private; making links private:<br/>"; 
     
    5555%> 
    5656        <div class="attention"> 
    57                 <%= getCatName() %> renamed! 
     57                <%= getCatName() %> updated! 
    5858        </div> 
    5959<% 
     
    6161                                        echo bounceTo( "/index" ); 
    6262                                } 
    63                         } else 
    64                                 echo "fail!"; 
     63                        } else { 
     64                                echo "$qs fail!"; 
     65                        } 
    6566                } else if( $op == "confirmDelete" ) { 
    6667                        $shouldShowCreateEditForm = 0; 
     
    273274                        $links = array(); 
    274275                        while ($i < $numRows) { 
    275                                 $id   = mysql_result($q,$i,"ID"); 
    276                                 $options   = mysql_result($q,$i,"options"); 
    277                                 $name = makeSafeName( mysql_result($q,$i,"name")); 
     276                                $id        = mysql_result($q,$i,"ID"); 
     277                                $isPrivate = mysql_result($q,$i,"isPrivate"); 
     278                                $name      = makeSafeName( mysql_result($q,$i,"name")); 
    278279                                $public = 0; 
    279                                 if( isPublic( $name )) { 
     280                                if( ! $isPrivate ) { 
    280281                                        $name = makePrettyFolderName( $name ); 
    281282                                        ++$public; 
    282283                                } 
    283284                                $i++; 
    284                                 $links[$i] = array( $name, $id, $public, $options ); 
     285                                $links[$i] = array( $name, $id, $public, "" ); 
    285286                        } 
    286287                        conClose( $con_editFolder ); 
  • trunk/feedmelinks/feedmelinks/edit.php

    r874 r889  
    5050                                        $folder   = urldecode( mysql_result($q2,0,"name")); 
    5151                                        $folderID = urldecode( mysql_result($q2,0,"ID")); 
     52                                        $isPrivate = urldecode( mysql_result($q2,0,"isPrivate")); 
    5253                                } 
    5354                        } else 
    5455                                $folder = "unnamed"; 
    5556                        $public = 0; 
    56                         if( isPublic( $folder )) { 
     57                        if( ! $isPrivate ) { 
    5758                                $folder = makePrettyFolderName( $folder ); 
    5859                                ++$public; 
  • trunk/feedmelinks/feedmelinks/folder-as-rss.php

    r839 r889  
    4545                                $singleGroupName = makeSafeName( mysql_result($q,$i,"name") ); 
    4646                                $owner = mysql_result($q,$i,"userid"); 
     47                                $isPrivate = mysql_result($q,$i,"isPrivate"); 
    4748                        } else 
    4849                                $singleGroupName = "unfiled"; 
     
    5051                                if( $debug ) { 
    5152                                        echo "singleGroupName: $singleGroupName<br />"; 
    52                                         if( isPublic( $singleGroupName )) 
    53                                                 echo "isPublic( $singleGroupName ) = true<br />"; 
    54                                         else 
    55                                                 echo "isPublic( $singleGroupName ) = false<br />"; 
    5653                                } 
    5754 
     
    6259                                        $owned = true; 
    6360                                } 
    64                                 if( $owned || isPublic( $singleGroupName ))  { 
     61                                if( $owned || ! $isPrivate )  { 
    6562                                        if( $debug && $owned ) echo "owned: TRUE<br />"; 
    66                                         if( isPublic( $singleGroupName )) { 
     63                                        if( ! $isPrivate ) { 
    6764                                                $pubFolder = true; 
    6865                                                $singleGroupName = substr( $singleGroupName, 2, strlen( $singleGroupName ) ); 
     
    9592                                while ($i < $numRows) { 
    9693                                        $id = mysql_result($q,$i,"ID"); 
    97                                         $name = makeSafeName( mysql_result($q,$i,"name")); 
    98                                         if( isPublic( $name ))  { 
     94                                        $isPrivate = mysql_result($q,$i,"isPrivate"); 
     95                                        $name = makeSafeName( mysql_result($q,$i,"name" )); 
     96                                        if( ! $isPrivate )  { 
    9997                                                $groups[$id] = substr( $name, 2, strlen( $name ) ); 
    10098                                                if( $j != 0 )  
  • trunk/feedmelinks/feedmelinks/folder-as-xml.php

    r804 r889  
    2020 
    2121                                $raw_tag_name = urldecode( mysql_result($q,0,"t.name")); 
     22                                $tag_privacy = urldecode( mysql_result($q,0,"t.isPrivate")); 
    2223                                $tag_name = makePrettyFolderName( $raw_tag_name ); 
    2324 
    2425%> 
    25 <posts tag="<%= $tag_name %>" is-public="<%= isPublic( $raw_tag_name ) ? 'true' : 'false' %>" tag-id="<%= $folder %>" user="<%= $u %>"> 
     26<posts tag="<%= $tag_name %>" is-public="<%= (! $isPrivate) ? 'true' : 'false' %>" tag-id="<%= $folder %>" user="<%= $u %>"> 
    2627<% 
    2728                                $numRows = mysql_num_rows($q); 
  • trunk/feedmelinks/feedmelinks/folder-by-tag-name.php

    r812 r889  
    2222                 
    2323                # allow authenticated users to view their own private tags 
    24                 $taglist_clause = "name = 'p/$tag' OR name = 'p%2F$tag'" . ($authed ? " OR name = '$tag'" : ""); 
     24                $taglist_clause = "isPrivate IS NULL" . ($authed ? " OR name = '$tag'" : ""); 
    2525 
    2626                $qs = getQuery( "tag_by_name", $user, "($taglist_clause)" ); 
  • trunk/feedmelinks/feedmelinks/folder.php

    r869 r889  
    3737        $fName = getNameForFolder( $id ); 
    3838        if( $folder != "unfiled" ) { 
    39                 $public = isPublic( getNameForFolder( $id )) ? "1" : "0"; 
     39                $public = isPublicFolder( $id ) ? "1" : "0"; 
    4040                $owner = getOwnerForFolder( $folder ); 
    4141                if( $_internal == 1 ) { 
     
    9797                                $singleGroupName = "unfiled"; 
    9898 
    99                                 if( $debug ) { 
     99                                if( $debug ) 
    100100                                        echo d( "singleGroupName: $singleGroupName"); 
    101                                         if( isPublic( $singleGroupName )) 
    102                                                 echo d( "isPublic( $singleGroupName ) = true" ); 
    103                                         else 
    104                                                 echo d( "isPublic( $singleGroupName ) = FALSE" ); 
    105                                 } 
    106101 
    107102                        if( $unfiled || $q ) { 
     
    113108                                        $owned = true; 
    114109                                } 
    115                                 if( $owned || isPublic( $singleGroupName ))  { 
    116                                         if( isPublic( $singleGroupName )) { 
     110                                if( $owned || $public )  { 
     111                                        if( $public ) { 
    117112                                                $pubFolder = true; 
    118113                                                $singleGroupName = substr( $singleGroupName, 2, strlen( $singleGroupName ) ); 
     
    167162                        while ($i < $numRows) { 
    168163                                $id = mysql_result($q,$i,"ID"); 
     164                                $isPrivate = mysql_result($q,$i,"isPrivate"); 
    169165                                $name = makeSafeName( mysql_result($q,$i,"name")); 
    170                                 if( isPublic( $name ))  { 
     166                                if( !$isPrivate )  { 
    171167                                        $groups[$id] = substr( $name, 2, strlen( $name ) ); 
    172168                                        if( $j != 0 )  
  • trunk/feedmelinks/feedmelinks/funnel.php

    r559 r889  
    159159                                $idx         = $catsRendered; # $i*$rows+$j; 
    160160                                $id         = mysql_result($q, $idx, "ID"); 
    161                                 $options    = mysql_result($q, $idx, "options"); 
     161                                $isPrivate    = mysql_result($q, $idx, "isPrivate"); 
    162162                                $catName = makeSafeName( mysql_result($q, $idx, "name")); 
    163163                                $public = 0; 
    164                                 if( isPublic( $catName )) { 
     164                                if( !$isPrivate ) { 
    165165                                        $catName = makePrettyFolderName( $catName ); 
    166166                                        ++$public; 
    167167                                } 
    168                                 $categories[$count] = array( $catName, $options, $id, $public ); 
     168                                $categories[$count] = array( $catName, "", $id, $public ); 
    169169                                $catsRendered++; 
    170170                                $count++; 
     
    211211                                        $idx        = $catsRendered; # $i*$rows+$j; 
    212212                                        $id         = $category[2]; 
    213                                         $options    = $category[1]; 
    214213                                        $catName = $category[0]; 
    215214                                        $public     = $category[3]; 
  • trunk/feedmelinks/feedmelinks/modules/folder-list.inc.php

    r703 r889  
    2121         
    2222                        $id = $row["catID"]; 
     23                        $isPrivate = $row["isPrivate"]; 
    2324                        $numLinks = $row["num_links"]; 
    2425                        $name = makeSafeName( $row["name"] ); 
    2526 
    2627                        $public = false; 
    27                         if( isPublic( $name )) { 
     28                        if( ! $isPrivate ) { 
    2829                                $name = makePrettyFolderName( $name ); 
    2930                                $public = true; 
  • trunk/feedmelinks/feedmelinks/modules/folder-menu.inc.php

    r294 r889  
    2020                while ($i < $numRows) { 
    2121                        $id = mysql_result($q,$i,"ID"); 
     22                        $isPrivate = mysql_result($q,$i,"isPrivate"); 
    2223                        $folderName = makeSafeName( mysql_result($q,$i,"name")); 
    2324 
    2425      # we use our own hashtables instead of the raw DB,  
    2526                        # so that we can re-sort without the leading "p-slash" fucking us up.... 
    26       if( isPublic( $folderName )) { 
     27      if( ! $isPrivate ) { 
    2728        $folderName = makePrettyFolderName( $folderName ); 
    2829                                $folderName = $folderName . " (pub)"; 
  • trunk/feedmelinks/feedmelinks/modules/list-public-compact.inc.php

    r379 r889  
    7171                while ($i < $numRows) { 
    7272                        $name = makeSafeName( mysql_result($q,$i,"name")); 
    73                         $isPublic = isPublic( $name ) ? 1 : 0; 
     73                        $isPrivate = makeSafeName( mysql_result($q,$i,"isPrivate")); 
     74                        $isPublic = ! $isPrivate; 
    7475                        if( $viewedByOwner || $isPublic )  { 
    7576                                $id = mysql_result($q,$i,"ID"); 
  • trunk/feedmelinks/feedmelinks/modules/public.inc.php

    r441 r889  
    4343                        if( $q ) { 
    4444                                $singleGroupName = urldecode( mysql_result($q,$i,"name") ); 
     45                                $isPrivate = mysql_result($q,$i,"isPrivate"); 
    4546                                if( $debug)  
    4647                                        echo "group id $folder (named $singleGroupName) exists<br>";     
    47                                 if( isPublic( $singleGroupName ))  { 
     48                                if( ! $isPrivate )  { 
    4849                                        $singleGroupName = substr( $singleGroupName, 2, strlen( $singleGroupName ) ); 
    4950                                        $qs = "SELECT * FROM links WHERE groupid=$folder  
     
    6566                                while ($i < $numRows) { 
    6667                                        $id = mysql_result($q,$i,"ID"); 
     68                                        $isPrivate = mysql_result($q,$i,"isPrivate"); 
    6769                                        $name = urldecode( mysql_result($q,$i,"name")); 
    68                                         if( isPublic( $name ))  { 
     70                                        if( ! $isPrivate )  { 
    6971                                                $groups[$id] = substr( $name, 2, strlen( $name ) ); 
    7072                                                if( $j != 0 )  
  • trunk/feedmelinks/feedmelinks/modules/tag-cloud.inc.php

    r838 r889  
    22        $u == $user ? $auth = 1 : $auth = 0; 
    33        $u = $user ? $user : $u; 
    4         $qs_max = "SELECT count(*) as num_links, ID as catID, name FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY num_links DESC LIMIT 1;"; 
     4        $qs_max = "SELECT count(*) as num_links, ID as catID, name, isPrivate FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY num_links DESC LIMIT 1;"; 
    55         
    6         $qs = "SELECT count(*) as num_links, ID as catID, name FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY name ASC;"; 
     6        $qs = "SELECT count(*) as num_links, ID as catID, name, isPrivate FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY name ASC;"; 
    77 
    88%> 
     
    4848  for( $i = 0; $i < $numRows; $i++ ) { 
    4949    $name = makePrettyFolderName( urldecode( mysql_result($q, $i, "name"))); 
    50                 if( $auth || isPublic( mysql_result($q, $i, "name"))) { 
     50                if( $auth || ! ( mysql_result($q, $i, "isPrivate"))) { 
    5151                        $id = mysql_result($q, $i, "catID"); 
    5252                        $size = floor( $min_font + ($scale * mysql_result($q, $i, "num_links"))); 
  • trunk/feedmelinks/feedmelinks/modules/utils.inc.php

    r887 r889  
    1717 
    1818                if( $debug ) echo "DEBUG: $qs<br>"; 
     19                $arg = "$u, $tok, $type, $subtype, $l, $new_value, $use_xajax"; 
    1920 
    2021                $q = mysql_query( $qs ); 
     
    3435                        $objResponse = new xajaxResponse(); 
    3536                        if( $success ) 
    36                                 $objResponse->addScript( "update_" . $type . "_after_save( '" . $l . "', '$safe_value' );" ); 
     37                                $objResponse->addScript( "update_" . $type . "_after_save( '$safe_value' );" ); 
    3738                        else 
    38                                 $objResponse->addAssign( "edit-ui", "innerHTML", "holy shit, that totally fucking failed: <b>$e</b>!!!" ); 
     39                                $objResponse->addAssign( "content-hook", "innerHTML", "Oops, we messed up: <b>$qs / $arg)</b>!!!" ); 
     40                        #$objResponse->addAssign( "content-hook", "innerHTML", "Oops, we messed up: <b>Database $e (edit_$subtype / $qs / $arg)</b>!!!" ); 
     41                        // FIXME: in the above else case, also unroll the edit also so the user can try again 
    3942                        return $objResponse->getXML(); 
    4043                } else 
     
    367370                        "SELECT ID FROM linksGroups  
    368371                                WHERE  
    369                                         (name = 'linkpocket' OR name = 'p/linkpocket' OR name = 'p%2Flinkpocket') 
     372                                        name = 'linkpocket' 
    370373                                        AND userid = '$argUser';"; 
    371374                        $q = mysql_query( $qs ); 
     
    449452                        global $prof; 
    450453                        #if( isset( $prof )) $prof->startTimer( "print_css_folder_funcall" ); 
     454                         
     455                        $owned = ( $argUser == get_user() ) ? 1 : 0; 
    451456 
    452457                        $n = $argFlipFlop ? 1 : 0; 
    453458%> 
    454 <% if( $argUser == get_user() || $argIsPub ) { %> 
    455  
    456 <div class="fr r<%= $n %>"
     459<% if( $owned || $argIsPub ) { %> 
     460 
     461<div class="fr r<%= $n %> tag"<%= $owned ? " fid='$argId'" : "" %>
    457462<div style="float: left;"> 
    458463<span class="subtle"><%= printLinkCount( $argNumLinks ) %> links </span> 
    459464<big><%= makeFolderLink( $argId, $argName ) %></big> 
    460465</div> 
    461 <% if( $argUser == get_user() ) { %> 
     466<% if( $owned ) { %> 
    462467<div style="float: right"> 
    463468        <a href="edit-folder?op=edit&id=<%= $argId %>&name=<%= urlencode( $argIsPub ? makePublicFolderName( $argName ) : $argName) %>" title="edit <%= $argName %>"><img src="img/edit.gif" alt="edit <%= $argName %>" border="0" /></a> 
     
    517522 
    518523function get_taglist_query( $argUser ) { 
    519         return "SELECT count(*) as num_links, ID as catID, name FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = \"$argUser\" GROUP BY name ORDER BY num_links desc;"; 
     524        return "SELECT count(*) as num_links, ID as catID, name, isPrivate FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = \"$argUser\" GROUP BY name ORDER BY num_links desc;"; 
    520525} 
    521526 
    522527function get_category_counts_query( $argUser ) { 
    523         return "SELECT COUNT(*) AS num_links, lxf.catID, g.name FROM linksCategoriesXRef As lxf, linksGroups AS g WHERE g.ID = lxf.catID AND g.userid = \"$argUser\"  GROUP BY catID ORDER BY g.name;"; 
     528        return "SELECT COUNT(*) AS num_links, lxf.catID, g.name, g.isPrivate FROM linksCategoriesXRef As lxf, linksGroups AS g WHERE g.ID = lxf.catID AND g.userid = \"$argUser\"  GROUP BY catID ORDER BY g.name;"; 
    524529} 
    525530 
     
    12181223                UPDATE links SET url = '" . urlencode( $args[1] ) . "' WHERE ID = " . $args[2] . " AND submitter = '" . $args[3] . "'"; 
    12191224 
     1225        } else if( $argWhichQuery  == "edit_tag" ) { 
     1226                return " 
     1227                UPDATE linksGroups SET name = '" . urlencode( $args[1] ) . "' WHERE ID = " . $args[2] . " AND userid = '" . $args[3] . "'"; 
     1228 
    12201229        } else if( $argWhichQuery  == "edit_link_privacy" ) { 
    12211230                return " 
     
    12661275          ON linksGroups.ID = linksCategoriesXRef.catID 
    12671276    WHERE 
    1268     (links.isPrivate IS NULL 
    1269       AND 
    1270       (linksGroups.name LIKE 'p/%' OR linksGroups.name LIKE 'p%%F%') 
    1271       )"; 
     1277                        links.isPrivate IS NULL AND linksGroups.isPrivate IS NULL 
     1278      "; 
    12721279 
    12731280} 
     
    19461953        $name     = urlencode( $argName ); 
    19471954 
    1948         $qs = "INSERT into linksUsers values(NULL,'$userId','$email', '$password', '$name','');"; 
     1955        $qs = "INSERT INTO linksUsers values(NULL,'$userId','$email', '$password', '$name','');"; 
    19491956 
    19501957        l( "new_user: $argUserId, $argEmail" ); 
     
    19691976        if( $argFolderName &&  $argUserId ) { 
    19701977 
    1971                 if( ! $argIsPrivate ) { 
    1972                         # first make sure the folder is public,  
    1973                         # because we want new folders created public by default: 
    1974                         $folderName = makePublicFolderName( $argFolderName ); 
    1975                 } else 
    1976                         $folderName = $argFolderName; 
    1977                  
    19781978                $con_addFolderDriver = mysql_connect(); 
    19791979                mysql_selectdb( getDBName() ); 
     
    19941994                        if( $debug ) 
    19951995                                echo "DEBUG: did not see the folder already<br/>"; 
    1996                         $qs = "INSERT into linksGroups VALUES(NULL,'$argUserId','$folderName','');";  
     1996                        $qs = "INSERT INTO linksGroups VALUES(NULL,'$argUserId','$folderName','', $argIsPrivate);";  
    19971997                        if( $debug ) 
    19981998                                echo "$qs<br/>"; 
     
    20002000                        if( ! $q ) { 
    20012001                                echo "Sorry, something bad happened and your new folder wasn't created.<br />"; 
     2002                                echo "$qs"; 
    20022003                                echo "Please click your back button and choose a different folder, or email admins@feedmelinks.com.<br />\n";  
    20032004                                conClose( $con_addFolderDriver );  
     
    20892090                        # check to make sure the folder is not private; if it is, make the link private too: 
    20902091                        $folderName = getNameForFolder( $argFolderId ); 
    2091                         if( $folderName && (! isPublic( $folderName ))) { 
     2092                        if( $folderName && (! isPublicFolder( $argFolderId ))) 
    20922093                                $isPrivate = 1; 
    2093                         } 
    20942094 
    20952095                        $qs = "INSERT into links values(NULL,'$argUrl','$argName', NULL, NULL,'$argSubmitter', $argFolderId, '$argOptions', $isPrivate );"; 
     
    23512351function isInPublicFolder( $argId ) { 
    23522352        return true; 
    2353         #return isPublic( getNameForFolder( getFolderForLink( $id ))); 
    23542353} 
    23552354 
     
    24302429                mysql_selectdb( getDBName() ); 
    24312430                $qs = "SELECT ID FROM linksGroups WHERE USERID = '$argUserId' AND " 
    2432                 . "(name = 'p%2F$argName' OR name = 'p/$argName' OR name = '$argName' OR name = '" . urlencode( $argName ) . "');"; 
     2431                . "(name = '$argName' OR name = '" . urlencode( $argName ) . "');"; 
    24332432                $q = mysql_query( $qs ); 
    24342433                if( $q ) 
     
    26622661        } 
    26632662 
     2663# deprecated 
    26642664function makePrettyFolderName( $name ) { 
    2665         return str_replace ( "p/", "", $name); 
    2666 
    2667  
     2665        return $name; 
     2666
     2667 
     2668# deprecated 
    26682669function makePublicFolderName( $name ) { 
    2669         if( ! isPublic( $name )) 
    2670                 return "p/$name"; 
    2671         else 
    2672                 return $name; 
     2670        return $name; 
    26732671} 
    26742672 
     
    28622860} 
    28632861 
     2862function makeAJAXDeleteButton( $type ) { 
     2863%> 
     2864AJAX Delete Button 
     2865<% 
     2866} 
     2867 
     2868function makeInflowAJAXEditLink( $type ) { 
     2869        %><input type="image" class="editor inflow_<%= $type %>" src="img/icons/edit.png"  
     2870                height="26" width="26" hspace="5" alt="edit" border="0" /></a><% 
     2871} 
     2872 
    28642873function makeAJAXEditLink( $type ) { 
    28652874        %><input type="image" class="editor <%= $type %>" src="img/icons/edit.png"  
     
    28692878function makeAJAXToggle( $type, $id, $toggle ) { 
    28702879%> 
    2871         <span class="<%= $type %>" fid="<%= $id %>"> 
     2880        <span ftype="<%= $type %>" fid="<%= $id %>"> 
    28722881        <input type="checkbox" <%= $toggle ? "checked" : "" %> 
    28732882                onClick="execute_ajax_cb( '<%= $type %>', this.parentNode.getAttribute( 'fid' ), this);" /> 
     
    29002909                $con = mysql_connect(); 
    29012910                mysql_selectdb( getDBName() ); 
    2902                 $qs = "SELECT name FROM linksGroups WHERE id = $argFolderId;"; 
     2911                $qs = "SELECT isPrivate FROM linksGroups WHERE id = $argFolderId;"; 
    29032912                if( $debug ) 
    29042913                        echo $qs . "<br/>"; 
     
    29102919                                return false; 
    29112920                        } else { 
    2912                                 return isPublic( mysql_result($q,0,"name")); 
     2921                                return ! (mysql_result($q,0,"isPrivate")); 
    29132922                        } 
    29142923                        conClose( $con ); 
     
    29182927 
    29192928function isPublic( $folderName ) { 
    2920         if( $folderName ) 
    2921                 if( substr( $folderName, 0, 2 ) == "p/" || substr( $folderName, 0, 4 ) == "p%2F" ) 
    2922                         return true; 
     2929        echo "FUCKED!"; 
    29232930        return false; 
    29242931} 
  • trunk/feedmelinks/feedmelinks/modules/view-link.inc.php

    r886 r889  
    5353%> 
    5454 
    55         <div class="name" fid="<%= $l %>"> 
     55        <div ftype="name" fid="<%= $l %>"> 
    5656                <a class="biglink" title="<%= $name %>" href="/t/<%= $l %>"><%= $name %></a><% if( $owned ) {makeAJAXEditLink( "name" );} %> 
    5757<% if( $owned ) { %> 
     
    7373                <br /> 
    7474  <%= insertBigThumb( $link ) %> 
    75         <div class="url" fid="<%= $l %>"> 
     75        <div ftype="url" fid="<%= $l %>"> 
    7676                <a title="<%= $link %>" href="/t/<%= $l %>"><%= $displayLink %></a><% if( $owned ) {makeAJAXEditLink( "url" ); } %> 
    7777        </div> 
  • trunk/feedmelinks/feedmelinks/script/fajax.js

    r882 r889  
    44        var keyCode = evt.which ? evt.which : evt.keyCode; 
    55        if( keyCode == 13) { 
    6                  
    7                 var item_type = e.parentNode.parentNode.getAttribute( "class" ); 
    8                 execute_ajax(  
    9                         "link", 
    10                         item_type, 
    11                         e.parentNode.parentNode.getAttribute( "fid" ), // ID from the parent div 
    12                         e.value  
    13                 ); 
    14  
     6                execute_ajax( "link", e.getAttribute( "ftype" ), e.getAttribute( "fid" ), e.value ); 
    157                return false; 
    168        } 
     
    2113/* link renaming ******************************** */ 
    2214 
    23 // make this an array: 
     15// FIXME: use/make this an array: 
    2416var link_node; 
    2517var edit_button_node; 
     
    2719 
    2820function update_checkbox_after_save( edited_id, name ) { 
    29         var ui = document.getElementById( "edit-ui" ); 
     21        var ui = document.getElementById( "edit-ui-hook" ); 
    3022 
    3123        var message_slot = document.createElement("span"); 
     
    3830} 
    3931 
    40 function update_link_after_save( edited_id, name ) { 
    41         var ui = document.getElementById( "edit-ui" ); 
    42         var p = ui.parentNode; 
     32function update_link_after_save( name ) { 
    4333        link_node.setAttribute( "title", name ); 
    4434        link_node.innerHTML = name; 
    45  
    46         p.insertBefore( edit_button_node, p.firstChild ); 
    47         p.insertBefore( link_node, p.firstChild ); 
    48  
    49         p.removeChild( ui ); 
    50         Behaviour.apply(); 
     35        unroll_edit(); 
    5136} 
    5237 
    53 function unroll_edit(e) { 
    54         var p = e.parentNode.parentNode; 
    55         var id = p.getAttribute( "fid" ); // ID from the parent div 
    56         var ui = document.getElementById( "edit-ui" ); 
     38function unroll_edit() { 
     39        var content = document.getElementById( "content-hook" ); 
     40        if( content ) 
     41                content.parentNode.replaceChild( link_node, content ); 
     42        var ui = document.getElementById( "edit-ui-hook" ); 
     43        if( ui ) 
     44                ui.parentNode.replaceChild( edit_button_node, ui ); 
    5745 
    58         // restore the form 
    59         p.insertBefore( edit_button_node, p.firstChild ); 
    60         p.insertBefore( link_node, p.firstChild ); 
    61  
    62         // clean up the editing chuff 
    63         ui.parentNode.removeChild( ui ); 
    64         Behaviour.apply(); 
     46        if( ui || content )      
     47                Behaviour.apply(); 
    6548} 
    66  
    6749 
    6850function execute_ajax_cb( item, id, e ) { 
    6951        // FIXME: messy, clean up 
    70         var old_ui = document.getElementById( "edit-ui" ); 
     52        var old_ui = document.getElementById( "edit-ui-hook" ); 
    7153        if( old_ui ) 
    7254