15 define(
"TITLE_ADMIN_TAG_MANAGE", _(
"Enable/Disable Tag Display"));
21 $this->Name =
"admin_tag_manage";
22 $this->Title = TITLE_ADMIN_TAG_MANAGE;
23 $this->MenuList =
"Admin::Tag::Enable/Disable Tag";
24 $this->Version =
"1.3";
26 parent::__construct();
47 if (empty($folder_id) && empty($upload_id)) {
52 $upload_list = array();
53 if (!empty($upload_id)) {
54 $upload_list[0] = array(
'upload_pk'=>$upload_id);
59 foreach ($upload_list as $upload) {
60 $upload_id = $upload[
'upload_pk'];
62 if (
"Enable" === $manage) {
63 $manage_value =
false;
69 $sql =
"select * from tag_manage where upload_fk = $upload_id and is_disabled = true;";
72 $count = pg_num_rows($result);
73 pg_free_result($result);
74 if (empty($count) && $manage_value ==
true) {
75 $sql =
"INSERT INTO tag_manage(upload_fk, is_disabled) VALUES($upload_id, true);";
78 pg_free_result($result);
79 }
else if ($count == 1 && $manage_value ==
false) {
80 $sql =
"delete from tag_manage where upload_fk = $upload_id;";
83 pg_free_result($result);
101 $rc = $this->
ManageTag($Folder, $upload_id, $manage);
104 $text1 = _(
"all uploads in folder");
105 $text2 = _(
"in folder");
109 if (empty($upload_id)) {
112 $text =
"'$upload_name' $text2";
115 $Msg =
"$manage $text '$folder_path'";
116 $this->vars[
'message'] = $Msg;
126 $V .=
"<script language='javascript'>\n";
127 $V .=
"function Uploads_Reply()\n";
129 $V .=
" if ((Uploads.readyState==4) && (Uploads.status==200))\n";
131 $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";
132 $V .=
" document.getElementById('manage_tag').style.display= 'none';\n";
133 $V .=
" document.getElementById('manage_tag_all').style.display= 'block';\n";
140 $V .=
"<script language='javascript'>\n";
141 $V .=
"function Tagging_Reply()\n";
143 $V .=
" if ((Tagging.readyState==4) && (Tagging.status==200))\n";
145 $V .=
" document.getElementById('manage_tag_all').style.display= 'none';\n";
146 $V .=
" document.getElementById('manage_tag').style.display= 'block';\n";
147 $V .=
" document.getElementById('manage_tag').innerHTML = Tagging.responseText;\n";
152 $V .=
"<form name='formy' method='post'>\n";
153 $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");
156 $text = _(
"Select the folder containing the upload you wish to enable/disable:");
157 $V .=
"<li>$text<br>\n";
158 $V .=
"<select name='folder'\n";
159 $V .=
"onLoad='Uploads_Get((\"" .
Traceback_uri() .
"?mod=upload_options&folder=$Folder' ";
160 $V .=
"onChange='Uploads_Get(\"" .
Traceback_uri() .
"?mod=upload_options&folder=\" + this.value)' ";
161 $V .=
"class='ui-render-select2'>\n";
163 $V .=
"</select><P />\n";
165 $text = _(
"Select the upload to enable/disable:");
166 $V .=
"<li>$text<br>";
167 $V .=
"<div id='tagdiv'>\n";
168 $V .=
"<select size='10' name='upload' onChange='Tagging_Get(\"" .
Traceback_uri() .
"?mod=upload_tagging&upload=\" + this.value)'>\n";
170 foreach ($List as $L) {
171 $V .=
"<option value='" . $L[
'upload_pk'] .
"'>";
172 $V .= htmlentities($L[
'name']);
173 if (! empty($L[
'upload_desc'])) {
174 $V .=
" (" . htmlentities($L[
'upload_desc']) .
")";
178 $V .=
"</select><P />\n";
180 $V .=
"<div id='manage_tag_all'>";
181 $text = _(
"Disable");
182 $V .=
"<input type='submit' name='manage' value='$text'>\n";
184 $V .=
"<input type='submit' name='manage' value='$text'>\n";
187 $V .=
"<div id='manage_tag'>";
194 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Contains the constants and helpers for authentication of user.
ManageTag($folder_id, $upload_id, $manage)
Enable/Disable Tag on one folder(all uploads under this folder) or one upload.
Output()
This function is called when user output is requested. This function is responsible for content....
__construct()
base constructor. Most plugins will just use this
ActiveHTTPscript($RequestName, $IncludeScriptTags=1)
Given a function name, create the JavaScript needed for doing the request.
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
FolderGetName($FolderPk, $Top=-1)
Given a folder_pk, return the full path to this folder.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
FolderListUploadsRecurse($ParentFolder=-1, $FolderPath='', $perm=Auth::PERM_READ)
Get uploads and folder info, starting from $ParentFolder.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
FolderListUploads_perm($ParentFolder, $perm)
Returns an array of uploads in a folder.
Traceback_uri()
Get the URI without query to this location.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
GetUploadName($upload_pk)
Get Upload Name through upload id.
#define PERM_WRITE
Read-Write permission.
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN