26 define(
"TITLE_ADMIN_TAG_MANAGE", _(
"Enable/Disable Tag Display"));
30 function __construct()
32 $this->Name =
"admin_tag_manage";
33 $this->Title = TITLE_ADMIN_TAG_MANAGE;
34 $this->MenuList =
"Admin::Tag::Enable/Disable Tag";
35 $this->Version =
"1.3";
37 parent::__construct();
58 if (empty($folder_id) && empty($upload_id)) {
63 $upload_list = array();
64 if (!empty($upload_id)) {
65 $upload_list[0] = array(
'upload_pk'=>$upload_id);
70 foreach ($upload_list as $upload) {
71 $upload_id = $upload[
'upload_pk'];
73 if (
"Enable" === $manage) {
74 $manage_value =
false;
80 $sql =
"select * from tag_manage where upload_fk = $upload_id and is_disabled = true;";
81 $result = pg_query($PG_CONN, $sql);
83 $count = pg_num_rows($result);
84 pg_free_result($result);
85 if (empty($count) && $manage_value ==
true) {
86 $sql =
"INSERT INTO tag_manage(upload_fk, is_disabled) VALUES($upload_id, true);";
87 $result = pg_query($PG_CONN, $sql);
89 pg_free_result($result);
90 }
else if ($count == 1 && $manage_value ==
false) {
91 $sql =
"delete from tag_manage where upload_fk = $upload_id;";
92 $result = pg_query($PG_CONN, $sql);
94 pg_free_result($result);
108 if (empty($Folder)) {
112 $rc = $this->
ManageTag($Folder, $upload_id, $manage);
115 $text1 = _(
"all uploads in folder");
116 $text2 = _(
"in folder");
120 if (empty($upload_id)) {
123 $text =
"'$upload_name' $text2";
126 $Msg =
"$manage $text '$folder_path'";
127 $this->vars[
'message'] = $Msg;
137 $V .=
"<script language='javascript'>\n";
138 $V .=
"function Uploads_Reply()\n";
140 $V .=
" if ((Uploads.readyState==4) && (Uploads.status==200))\n";
142 $V .=
" document.getElementById('tagdiv').innerHTML = '<select size=\'10\' name=\'upload\' onChange=\'Tagging_Get(\"" .
Traceback_uri() .
"?mod=upload_tagging&upload=\" + this.value)\'>' + Uploads.responseText+ '</select><P/>';\n";
143 $V .=
" document.getElementById('manage_tag').style.display= 'none';\n";
144 $V .=
" document.getElementById('manage_tag_all').style.display= 'block';\n";
151 $V .=
"<script language='javascript'>\n";
152 $V .=
"function Tagging_Reply()\n";
154 $V .=
" if ((Tagging.readyState==4) && (Tagging.status==200))\n";
156 $V .=
" document.getElementById('manage_tag_all').style.display= 'none';\n";
157 $V .=
" document.getElementById('manage_tag').style.display= 'block';\n";
158 $V .=
" document.getElementById('manage_tag').innerHTML = Tagging.responseText;\n";
163 $V .=
"<form name='formy' method='post'>\n";
164 $V .= _(
"Displaying tags while browsing can be slow for large uploads. This interface allows you to select an upload to disable (or enable) the tag display. By default the tag display is enabled.<p>\n");
167 $text = _(
"Select the folder containing the upload you wish to enable/disable:");
168 $V .=
"<li>$text<br>\n";
169 $V .=
"<select name='folder'\n";
170 $V .=
"onLoad='Uploads_Get((\"" .
Traceback_uri() .
"?mod=upload_options&folder=$Folder' ";
171 $V .=
"onChange='Uploads_Get(\"" .
Traceback_uri() .
"?mod=upload_options&folder=\" + this.value)' ";
172 $V .=
"class='ui-render-select2'>\n";
174 $V .=
"</select><P />\n";
176 $text = _(
"Select the upload to enable/disable:");
177 $V .=
"<li>$text<br>";
178 $V .=
"<div id='tagdiv'>\n";
179 $V .=
"<select size='10' name='upload' onChange='Tagging_Get(\"" .
Traceback_uri() .
"?mod=upload_tagging&upload=\" + this.value)'>\n";
181 foreach ($List as $L) {
182 $V .=
"<option value='" . $L[
'upload_pk'] .
"'>";
183 $V .= htmlentities($L[
'name']);
184 if (! empty($L[
'upload_desc'])) {
185 $V .=
" (" . htmlentities($L[
'upload_desc']) .
")";
189 $V .=
"</select><P />\n";
191 $V .=
"<div id='manage_tag_all'>";
192 $text = _(
"Disable");
193 $V .=
"<input type='submit' name='manage' value='$text'>\n";
195 $V .=
"<input type='submit' name='manage' value='$text'>\n";
198 $V .=
"<div id='manage_tag'>";
205 $NewPlugin->Initialize();
Traceback_uri()
Get the URI without query to this location.
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
FolderListUploads_perm($ParentFolder, $perm)
Returns an array of uploads in a folder.
ActiveHTTPscript($RequestName, $IncludeScriptTags=1)
Given a function name, create the JavaScript needed for doing the request.
FolderGetName($FolderPk, $Top=-1)
Given a folder_pk, return the full path to this folder.
ManageTag($folder_id, $upload_id, $manage)
Enable/Disable Tag on one folder(all uploads under this folder) or one upload.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
FolderListUploadsRecurse($ParentFolder=-1, $FolderPath= '', $perm=Auth::PERM_READ)
Get uploads and folder info, starting from $ParentFolder.
This is the Plugin class. All plugins should:
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
GetUploadName($upload_pk)
Get Upload Name through upload id.
#define PERM_WRITE
Read-Write permission.