kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

  • Mood:

control panel/login box component

my first tutorial
the code
##################################
#     CONTROL PANEL COMPONENT    #
# kunzite1, component-help/82952 #
# add to print_free_text(Page p) #
#######################################################
# Control Panel                                       #
# by kunzite1                                         #
#                                                     #
# If logged in:                                       #
#   Customize                                         #
#   *Advanced Customization                           #
#   *Your Layers                                      #
#   *Your Styles                                      #
#   *Your Link List                                   #
#   Update                                            #
#   Edit Entries                                      #
#   Your Cluster                                      #
#   Logout                                            #
#                                                     #
# If not logged in:                                   #
#   Login                                             #
#######################################################
# Title bar of component when logged in
  var string k1CPloggedInTitle = "your control panel";

# Title bar of component when not logged in
  var string k1CPloggedOutTitle = "login box";

# LOGIN BOX
# Label for entering username
  var string k1CPusername   = "username:";

# Label for entering password
  var string k1CPpassword   = "password:";

# Label for forgot password link
  var string k1CPforgot     = "forget?";

# Label for expiration options
  var string k1CPexpiration = "expiration:";

# Label for expiring when window closes
  var string k1CPclose      = "close window";

# Label for never expiring
  var string k1CPnever      = "never";

# Label for binding to ip
  var string k1CPbind       = "bind to ip:";

# Label for accepting binding to ip
  var string k1CPy          = "yes";

# Label for denying binding to ip
  var string k1CPn          = "no";

# Label for log in button
  var string k1CPsubmit     = "log in";

#######################
# CONTROL PANEL START #
#######################
if(viewer_logged_in()){
var Color  k1CPltLineColor   = $*header_bgcolor->lighter(30);
var string k1CPltLineString  = $k1CPltLineColor.as_string;
var string k1CPmedLineString = $*header_bgcolor.as_string;
var Color  k1CPdkLineColor   = $*header_bgcolor->darker(50);
var string k1CPdkLineString  = $k1CPdkLineColor.as_string;
var int    k1CPcols          = 3;

var string[] k1CPlink_urls  = [""];
var string[] k1CPlink_texts = [""];
var int      k1CPlink_index = 0;

# set one
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/customize/";
$k1CPlink_texts[$k1CPlink_index] = """customize""";
$k1CPlink_index++;

# set two
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/customize/advanced/";
$k1CPlink_texts[$k1CPlink_index] = """<i>advanced</i>""";
$k1CPlink_index++;

# set three
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/customize/advanced/layers.bml";
$k1CPlink_texts[$k1CPlink_index] = """<i>layers</i>""";
$k1CPlink_index++;

# set four
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/customize/advanced/styles.bml";
$k1CPlink_texts[$k1CPlink_index] = """<i>styles</i>""";
$k1CPlink_index++;

# set five
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/manage/links.bml";
$k1CPlink_texts[$k1CPlink_index] = """link lists""";
$k1CPlink_index++;

# set six
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/update.bml";
$k1CPlink_texts[$k1CPlink_index] = """update""";
$k1CPlink_index++;

# set seven
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/editjournal.bml";
$k1CPlink_texts[$k1CPlink_index] = """edit entries""";
$k1CPlink_index++;

# set eight
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/friends/";
$k1CPlink_texts[$k1CPlink_index] = """edit friends""";
$k1CPlink_index++;

# set nine
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/manage/profile/";
$k1CPlink_texts[$k1CPlink_index] = """edit info""";
$k1CPlink_index++;

# set ten
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/changepassword.bml";
$k1CPlink_texts[$k1CPlink_index] = """edit pass""";
$k1CPlink_index++;

# set eleven
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/editpics.bml";
$k1CPlink_texts[$k1CPlink_index] = """edit pics""";
$k1CPlink_index++;

# set twelve
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/tools/memories.bml";
$k1CPlink_texts[$k1CPlink_index] = """memories""";
$k1CPlink_index++;

# set thirteen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/misc/whereami.bml";
$k1CPlink_texts[$k1CPlink_index] = """my cluster""";
$k1CPlink_index++;

# set fourteen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/portal/";
$k1CPlink_texts[$k1CPlink_index] = """my portal""";
$k1CPlink_index++;

# set fifteen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/site/";
$k1CPlink_texts[$k1CPlink_index] = """site map""";
$k1CPlink_index++;

# set sixteen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/stats.bml";
$k1CPlink_texts[$k1CPlink_index] = """site stats""";
$k1CPlink_index++;

# set seventeen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/birthdays.bml";
$k1CPlink_texts[$k1CPlink_index] = """birthdays""";
$k1CPlink_index++;

# set eighteen
$k1CPlink_urls[$k1CPlink_index]  = "$*SITEROOT/logout.bml";
$k1CPlink_texts[$k1CPlink_index] = """logout""";
$k1CPlink_index++;

var int    k1CPcount = 0;
var string k1CPwidth = (100 / $k1CPcols) + "%";

print_comp_header("$k1CPloggedInTitle");
  """<table border="1" bordercolor="$k1CPmedLineString" cellspacing="0" frame="void" width="100%">\n""";
foreach var int i (0 .. size($k1CPlink_urls) - 1) {
  var string url  = $k1CPlink_urls[$i];
  var string text = $k1CPlink_texts[$i];
  $k1CPcount++;
  if($k1CPcount == 1) {
    """  <tr>\n""";
  }
  """    <td align="center" width="$k1CPwidth"><a href="$url">$text</a></td>\n""";
  if($k1CPcount == $k1CPcols) {
    """  </tr>\n""";
    $k1CPcount = 0;
  }
}
if($k1CPcount > 0) {
  foreach var int i ($k1CPcount .. $k1CPcols) {
    if($i < $k1CPcols) {
      """    <td>&nbsp;</td>\n""";
    } else {
      """  </tr>\n""";
    }
  }
}
  """</table>""";
} else {
print_comp_header("$k1CPloggedOutTitle");
  """
<form action="$*SITEROOT/login.bml" method="post">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td>$k1CPusername</td>
      <td><input type="text" name="user" size="15" maxlength="15" /></td>
    </tr>
    <tr>
      <td valign="top">$k1CPpassword</td>
      <td><input type="text" name="password" size="15" maxlength="30" style="background-color: $*comp_bgcolor; color: $*comp_bgcolor;" /><br />
      <a href="$*SITEROOT/lostinfo.bml"><font size="1">$k1CPforgot</font></a></td>
    </tr>
    <tr valign="top">
      <td>$k1CPexpiration:</td>
      <td><input type="radio" name="expire" value="close"  checked="checked" id="close" /> <label for="close">$k1CPclose</label><br />
      <input type="radio" name="expire" value="never"  id="never" /> <label for="never">$k1CPnever</label></td>
    </tr>
    <tr valign="top">
      <td>Bind to IP address:</td>
      <td><input type="radio" name="bindip" value="yes"  id="bindyes" /> <label for="bindyes">$k1CPy</label><br />
      <input type="radio" name="bindip" value="no"  checked="checked" id="bindipno" /> <label for="bindipno">$k1CPn</label></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input name="action:login" type="submit" value="$k1CPsubmit" /></td>
    </tr>
  </table>
</form>
  """;
}
print_comp_footer();
#####################
# CONTROL PANEL END #
#####################
Tags: admin: deprecated, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 111 comments
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →