Mercurial > hg > fapweb
comparison admajax.php @ 767:1337c483b9f9
Add some comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 20 Nov 2014 12:23:13 +0200 |
parents | 4a8bcf738bd4 |
children | 91c9fef38e2d |
comparison
equal
deleted
inserted
replaced
766:4a8bcf738bd4 | 767:1337c483b9f9 |
---|---|
60 | 60 |
61 function stValidateRequestEntryData(&$compo_id, $full, $ctype) | 61 function stValidateRequestEntryData(&$compo_id, $full, $ctype) |
62 { | 62 { |
63 $res = TRUE; | 63 $res = TRUE; |
64 | 64 |
65 // Things common for all compo types | |
65 stChkRequestItemFail("name", $fake, $res, | 66 stChkRequestItemFail("name", $fake, $res, |
66 array(CHK_ISGT, VT_STR, 0, "Name too short."), | 67 array(CHK_ISGT, VT_STR, 0, "Name too short."), |
67 array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NAME, "Name too long.")); | 68 array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NAME, "Name too long.")); |
68 | 69 |
69 stChkRequestItemFail("notes", $fake, $res, | 70 stChkRequestItemFail("notes", $fake, $res, |
70 array(CHK_TYPE, VT_TEXT, "Invalid data."), | 71 array(CHK_TYPE, VT_TEXT, "Invalid data."), |
71 array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NOTES, "Entry notes too long.")); | 72 array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NOTES, "Entry notes too long.")); |
72 | 73 |
74 // Check based on compo type | |
73 switch ($ctype) | 75 switch ($ctype) |
74 { | 76 { |
75 case COMPO_NORMAL: | 77 case COMPO_NORMAL: |
76 stChkRequestItemFail("compo_id", $compo_id, $res, | 78 stChkRequestItemFail("compo_id", $compo_id, $res, |
77 array(CHK_TYPE, VT_INT, "Invalid compo ID.")); | 79 array(CHK_TYPE, VT_INT, "Invalid compo ID.")); |
142 $str1 = | 144 $str1 = |
143 " File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n"; | 145 " File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n"; |
144 | 146 |
145 $str2 = | 147 $str2 = |
146 " ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], | 148 " ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], |
147 "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). | 149 "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). |
148 " ".stGetFormCheckBoxInput("show_authors", $id, $prefix, $item["show_authors"], "Show authors")."\n". | 150 " ".stGetFormCheckBoxInput("show_authors", $id, $prefix, $item["show_authors"], "Show authors")."\n". |
149 " ".stGetFormOptionListFromArray($prefix."preview_type".$id, " ", FALSE, $previewTypeList, $item["preview_type"], 0, 0)."\n"; | 151 " ".stGetFormOptionListFromArray($prefix."preview_type".$id, " ", FALSE, $previewTypeList, $item["preview_type"], 0, 0)."\n"; |
150 break; | 152 break; |
151 | 153 |
152 default: | 154 default: |
183 | 185 |
184 function stPrintEntryItemData($item, $row, $tr, $prefix, $compo, $mode) | 186 function stPrintEntryItemData($item, $row, $tr, $prefix, $compo, $mode) |
185 { | 187 { |
186 global $entryFlagsList, $previewTypeList, $compoModeData; | 188 global $entryFlagsList, $previewTypeList, $compoModeData; |
187 | 189 |
190 // Fetch compo data if we don't have it already | |
188 $eid = $item["id"]; | 191 $eid = $item["id"]; |
189 if ($compo === FALSE) | 192 if ($compo === FALSE) |
190 $compo = stFetchSQL("SELECT * FROM compos WHERE id=".$item["compo_id"]); | 193 $compo = stFetchSQL("SELECT * FROM compos WHERE id=".$item["compo_id"]); |
191 | 194 |
195 // Output wrapper div only if requested | |
192 if ($tr) | 196 if ($tr) |
193 { | 197 { |
194 echo | 198 echo |
195 " <div class=\"entryRow ".($row % 2 == 1 ? "rodd" : "reven"). | 199 " <div class=\"entryRow ".($row % 2 == 1 ? "rodd" : "reven"). |
196 "\" id=\"entry".$eid."\"".($mode == EEMODE_NORMAL ? " onClick=\"activateEntry(".$eid.")\"" : "").">\n"; | 200 "\" id=\"entry".$eid."\"".($mode == EEMODE_NORMAL ? " onClick=\"activateEntry(".$eid.")\"" : "").">\n"; |
197 } | 201 } |
198 | 202 |
203 // Only show show_id if this is a normal compo and we are not adding | |
199 if ($mode != EEMODE_ADD && $compo["ctype"] == COMPO_NORMAL) | 204 if ($mode != EEMODE_ADD && $compo["ctype"] == COMPO_NORMAL) |
200 { | 205 { |
201 echo | 206 echo |
202 " <div class=\"entryCell entryShowID\">".($item["show_id"] > 0 ? $item["show_id"] : "-")."</div>\n"; | 207 " <div class=\"entryCell entryShowID\">".($item["show_id"] > 0 ? $item["show_id"] : "-")."</div>\n"; |
203 } | 208 } |