# HG changeset patch # User Matti Hamalainen # Date 1416478993 -7200 # Node ID 1337c483b9f99924284433112b3c74326b6c9c1b # Parent 4a8bcf738bd495de3ddee8399e960d16c59b9c69 Add some comments. diff -r 4a8bcf738bd4 -r 1337c483b9f9 admajax.php --- a/admajax.php Thu Nov 20 12:22:54 2014 +0200 +++ b/admajax.php Thu Nov 20 12:23:13 2014 +0200 @@ -62,6 +62,7 @@ { $res = TRUE; + // Things common for all compo types stChkRequestItemFail("name", $fake, $res, array(CHK_ISGT, VT_STR, 0, "Name too short."), array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NAME, "Name too long.")); @@ -70,6 +71,7 @@ array(CHK_TYPE, VT_TEXT, "Invalid data."), array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NOTES, "Entry notes too long.")); + // Check based on compo type switch ($ctype) { case COMPO_NORMAL: @@ -144,7 +146,7 @@ $str2 = " ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], - "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). + "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). " ".stGetFormCheckBoxInput("show_authors", $id, $prefix, $item["show_authors"], "Show authors")."\n". " ".stGetFormOptionListFromArray($prefix."preview_type".$id, " ", FALSE, $previewTypeList, $item["preview_type"], 0, 0)."\n"; break; @@ -185,10 +187,12 @@ { global $entryFlagsList, $previewTypeList, $compoModeData; + // Fetch compo data if we don't have it already $eid = $item["id"]; if ($compo === FALSE) $compo = stFetchSQL("SELECT * FROM compos WHERE id=".$item["compo_id"]); + // Output wrapper div only if requested if ($tr) { echo @@ -196,6 +200,7 @@ "\" id=\"entry".$eid."\"".($mode == EEMODE_NORMAL ? " onClick=\"activateEntry(".$eid.")\"" : "").">\n"; } + // Only show show_id if this is a normal compo and we are not adding if ($mode != EEMODE_ADD && $compo["ctype"] == COMPO_NORMAL) { echo