kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

for sashwizzled

she wanted her friend's profile to show up including her's when she was viewing a friends journal in her style. here's my pathetic attempt at fulfilling the request.

its been tested by me and eduthepenguin.
here is his copy.
here is my updated copy.
finally got it done.
i had to take over EntryPage::print_linklist() to accomplish it.
"my profile" uses hardcoded information.
and because the poster member variable of EntryPage is a UserLite, i cant get the default pic or website info. now that i think about it, i could use the entry pic.
here is a preview of the 2004 april fools news entry, posted by bradfitz. it was posted with bradfitz' default icon, so, it doesnt show that it will actually load the same icon as the entry.

here we go...
function print_profile(Page p) {
# initialization
var string ljusername       = "sashwizzled";  # your livejournal username
var string defaultPicUrl    = "http://userpic.livejournal.com/17312468/1410115"; # url to default pic
var int    defaultPicWidth  = 100;            # width  of default pic
var int    defaultPicHeight = 100;            # height of default pic
var string name             = "Zarrah Bevan"; # your name
var string websiteUrl       = "";             # your website url
var string websiteName      = "";             # your website name

# if me
# my profile
# $*profile_text is the property that is set in the customization center
print_comp_header("my profile");
"""
  <table cellspacing="0" cellpadding="0" border="0">
""";
if($defaultPicUrl != ""){
  """
    <tr>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td align="center"><a href="$*SITEROOT/allpics.bml?user=$ljusername"><img src="$defaultPicUrl" width="$defaultPicWidth" height="$defaultPicHeight" alt="$name" title="$name" border="1" vspace="4" class="userPic" /></a></td>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
    </tr>
""";
}
"""
    <tr>
      <td colspan="3" class="compContent">
        <div><b>User:</b> <span class='ljuser' style='white-space:nowrap;'><a href='$*SITEROOT/userinfo.bml?user=$ljusername'><img src='$*IMGDIR/userinfo.gif' alt='$*nav_info_text' width='17' height='17' style='vertical-align:bottom;border:0;' /></a><a href='$*SITEROOT/users/$ljusername/'><b>$ljusername</b></a></span></div>
        <div><b>Name:</b> $name</div>
""";

if($websiteUrl != ""){
  var string websiteString = "<a href='$websiteUrl'>";
  if($websiteName != ""){
    $websiteString = $websiteString + $websiteName;
  }
  $websiteString = $websiteString + "</a>";
"""        <div><b>Website:</b> $websiteString</div>""";
}

"""
      </td>
    </tr>  
  </table>
""";
print_comp_footer();

# if user
# user profile
if(($p.journal.username != $ljusername) and ($p.journal.journal_type == "P")){
print_comp_header("user's profile");

"""
  <table cellspacing="0" cellpadding="0" border="0">
""";
if($p.journal.default_pic){
  """
    <tr>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td align="center"><a href="$*SITEROOT/allpics.bml?user=$p.journal.username"><img src="$p.journal.default_pic.url" width="$p.journal.default_pic.width" height="$p.journal.default_pic.height" alt="$p.journal.name" title="$p.journal.name" border="1" vspace="4" class="userPic" /></a></td>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
    </tr>
""";
}
"""
    <tr>
      <td colspan="3" class="compContent">
        <div><b>User:</b> <span class='ljuser' style='white-space:nowrap;'><a href='$*SITEROOT/userinfo.bml?user=$p.journal.username'><img src='$*IMGDIR/userinfo.gif' alt='$*nav_info_text' width='17' height='17' style='vertical-align:bottom;border:0;' /></a><a href='$*SITEROOT/users/$p.journal.username/'><b>$p.journal.username</b></a></span></div>
        <div><b>Name:</b> $p.journal.name</div>
""";

if($p.journal.website_url){
  var string websiteString = "<a href='$p.journal.website_url'>";
  if($p.journal.website_name){
    $websiteString = $websiteString + $p.journal.website_name;
  }
  $websiteString = $websiteString + "</a>";
"""        <div><b>Website:</b> $websiteString</div>""";
}

"""
      </td>
    </tr>  
  </table>
""";
print_comp_footer();
}

# if community
# community profile
if(($p.journal.username != $ljusername) and ($p.journal.journal_type == "C")){
print_comp_header("community's profile");
"""
  <table cellspacing="0" cellpadding="0" border="0">
""";
if($p.journal.default_pic){
  """
    <tr>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td align="center"><a href="$*SITEROOT/allpics.bml?user=$p.journal.username"><img src="$p.journal.default_pic.url" width="$p.journal.default_pic.width" height="$p.journal.default_pic.height" alt="$p.journal.name" title="$p.journal.name" border="1" vspace="4" class="userPic" /></a></td>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
    </tr>
""";
}
"""
    <tr>
      <td colspan="3" class="compContent">
        <div><b>User:</b> <span class='ljuser' style='white-space:nowrap;'><a href='$*SITEROOT/userinfo.bml?user=$p.journal.username'><img src='$*IMGDIR/userinfo.gif' alt='$*nav_info_text' width='17' height='17' style='vertical-align:bottom;border:0;' /></a><a href='$*SITEROOT/users/$p.journal.username/'><b>$p.journal.username</b></a></span></div>
        <div><b>Name:</b> $p.journal.name</div>
""";

if($p.journal.website_url){
  var string websiteString = "<a href='$p.journal.website_url'>";
  if($p.journal.website_name){

    $websiteString = $websiteString + $p.journal.website_name;
  }
  $websiteString = $websiteString + "</a>";
"""        <div><b>Website:</b> $websiteString</div>""";
}

"""
      </td>
    </tr>  
  </table>
""";
print_comp_footer();
}

if($p.view == "entry"){
  $p->print_linklist();
}
$*show_links = false;
}

function EntryPage::print_linklist(){
var string ljusername = "sashwizzled";
var Page     p = get_page();
var Entry    e = $.entry;
var Image    i = $e.userpic;
var UserLite u = $e.poster;
# if friend
# friend profile
if(($p.journal.username != $ljusername) and ($p.journal.journal_type == "C")){
print_comp_header("poster's profile");
"""
  <table cellspacing="0" cellpadding="0" border="0">
""";
if($i){
  """
    <tr>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td align="center"><a href="$*SITEROOT/allpics.bml?user=$u.username"><img src="$i.url" width="$i.width" height="$i.height" alt="$u.name" title="$u.name" border="1" vspace="4" class="userPic" /></a></td>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
    </tr>
""";
}
"""
    <tr>
      <td colspan="3" class="compContent">
        <div><b>User:</b> $u</div>
        <div><b>Name:</b> $u.name</div>
      </td>
    </tr>  
  </table>
""";
print_comp_footer();
}
}
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 31 comments