Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a9ce141c4f
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 248 lines (214 sloc) 5.166 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
<?php

// increment these when you change css or js files
define('CSS_VERSION', '21');
define('JS_VERSION', '20');

function render_bool($res) {
  if ($res) {
    return 'true';
  } else {
    return 'false';
  }
}


/**
* Render the dashboard and header for a page
*
* @param string $selected The tab that is currently selected
* @return void Or a type, with a description here
* @author
*/

function render_header($selected ='Home') {
  $header = '<link rel="stylesheet" type="text/css" href="'.ROOT_LOCATION.'/css/page.css?id='.CSS_VERSION.'" />';
  $header .= '<script src="'.ROOT_LOCATION.'/js/base.js?id='.JS_VERSION.'" ></script>';

  $header .= '<fb:dashboard/>';

  $header .=
    '<fb:tabs>'
      .'<fb:tab-item href="index.php" selected="' . ($selected == 'Home') .'">'
        .'<fb:fbml-attribute name="title">'
          .'<fb:intl desc="Tab label for main app page">'
.'Home'
.'</fb:intl>'
        .'</fb:attribute>'
      .'</fb:tab-item>'
      .'<fb:tab-item href="mysmilies.php" selected="' . ($selected == 'Mine') . '">'
        .'<fb:fbml-attribute name="title">'
          .'<fb:intl desc="Tab label for list of user\'s smilies">'
.'My Smilies'
.'</fb:intl>'
        .'</fb:attribute>'
      .'</fb:tab-item>'
      .'<fb:tab-item href="newsmiley.php" selected="' . ($selected == 'New') . '">'
        .'<fb:fbml-attribute name="title">'
          .'<fb:intl desc="Tab label for page to create new smiley">'
.'New Smiley'
.'</fb:intl>'
        .'</fb:attribute>'
      .'</fb:tab-item>'
      .'<fb:tab-item href="sendSmiley.php" selected="' . ($selected == 'Send') . '">'
        .'<fb:fbml-attribute name="title">'
          .'<fb:intl desc="Tab label for page to send a smiley">'
.'Send Smiley'
.'</fb:intl>'
        .'</fb:attribute>'
      .'</fb:tab-item>'
    .'</fb:tabs>';
  $header .= '<div id="main_body">';
  return $header;
}

function render_footer() {
  $footer = '</div>';
  return $footer;

}

function render_inline_style() {
 return '<style>
h2 {
font-size: 20pt !important;
text-align: center;
}

.box {
padding: 10px;
width : 100px;
height : 90px;
display : block;
float : left;
text-align: center;
border: black 1px;
margin-right: 10px;
margin-left: 10px;
cursor: pointer;
border: black solid 2px;
background: orange;
margin-left: 32px;
margin-top: 30px;
}
h3 {
text-align: center;
font-size: 11px;
color:#3B5998;

}

.big_box {
padding: 10px;
width : 300px;
height : 300px;
margin: auto;
text-align: center;
border: black 1px;
cursor: pointer;
border: black solid 2px;
background: orange;
color: black;
text-decoration: none;
}
a.box {
color: black;
}


a:hover.box {
text-decoration: none;
}

.smiley {
font-size: 25pt !important;
font-weight: bold;
padding: 10px;
color: black;
text-decoration: none;
}


.big_smiley {
font-size: 100pt !important;
font-weight: bold;
padding: 40px;
}

.past {
margin:auto;
width: 500px;
}
</style>
';
}


function render_emoticon_grid($moods) {
  $ret = '';
  $i = 0;
  $ret.='<div class="table"><div class="row">';
  foreach($moods as $mood) {
    list($title,$smiley) = $mood;
    $title = '<fb:intl desc="Mood name for \'' . $smiley . '\'">' . $title
           . '</fb:intl>';
    if ($i%3==0 && $i!=0) {
      $ret.='</div><div class="row">';
    }
    $ret .= '<div onclick="picked('.$i.')" onmouseover="over('.$i.')" onmouseout="out('.$i.')" class="box" id="sm_'.$i.'"><div class="smiley">'.$smiley.'</div><div id="smt_'.$i.'" class="title">'.$title.'</div></div>';
    $i++;
  }
  $ret .= '</div></div>';
  return $ret;

}
function render_handler_css() {
  $css = '<style>.box {

height :70px;
width : 70px;
float : left;
text-align: center;
border: black 1px;
margin-right: 10px;
margin-left: 10px;
cursor: pointer;
border: black solid 2px;
background: orange;
margin-left: 32px;
margin-top: 20px;
}
.smiley {
font-size: 20pt !important;
font-weight: bold;
padding: 0px;
padding-top: 20px;
}

.box_selected {
border: 2px dashed black;
background: #E1E1E1;
}

.title {
padding-top: 10px;
font-size: 10px;
visibility: hidden;
}

.box_selected .title {
visibility: visible;
}

.box_over .title {
visibility: visible;
}

</style>';
  return $css;
}

function render_handler_js() {
  $code .= '
<script>
var cur_picked = -1;
function over(id) {
document.getElementById("sm_"+id).addClassName("box_over");
}
function out(id) {
document.getElementById("sm_"+id).removeClassName("box_over");
}

function select(id, feed) {
document.getElementById("sm_"+id).addClassName("box_selected");
document.getElementById("picked").setValue(id);
if (feed) {
Facebook.showFeedDialog("http://www.srush3.devrs001.facebook.com/intern/howareyoufeeling/feedHandler.php", {"picked":id});
} else {
Facebook.setPublishStatus(true);
}
}

function unselect(id) {
document.getElementById("sm_"+id).removeClassName("box_selected");
}

function picked(i) {
if (cur_picked!=-1) {
unselect(cur_picked);
}
cur_picked = i;
select(i);
}
</script>
';
  return $code;

}
Something went wrong with that request. Please try again.