-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsharephoto.php
285 lines (247 loc) · 7.58 KB
/
sharephoto.php
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?php
$title = "Post a photo";
include "header.php";
$row = mysql_fetch_object( mysql_query("SELECT * FROM `mpac`.`attachments` WHERE `a_id` = ".$_GET['q']));
?>
<style type="text/css">
div.photo-column {
float: left ;
margin-right: 10px ;
}
div.photo-container {
border: 1px solid #333333 ;
margin-bottom: 13px ;
}
</style>
<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.tokeninput.js"></script>
<link rel="stylesheet" href="css/token-input.css" type="text/css" />
<link rel="stylesheet" href="css/token-input-facebook.css" type="text/css" />
<script>
// I am a method that cleans ColdFusion-based JSON responses.
// By default, ColdFusion upper-cases all its keys. This method
// will lowercase the ColdFusion keys.
var cleanColdFusionJSONResponse = function( apiAction, response ){
// Check to see if this it the load.
if (apiAction == "load"){
// Loop over response array.
jQuery.each(
response,
function( index, tagData ){
// Translate the ColdFusion keys
// to lowercase. This will create
// dupliate keys, but it doesn't
// matter for our use-case.
jQuery.each(
tagData,
function( key, value ){
tagData[ key.toLowerCase() ] = value;
}
);
}
);
}
// Return cleaned response.
return( response );
}
</script>
<script type="text/javascript" src="js/phototagger.jquery.js"></script>
<script type="text/javascript">
// When the DOM is ready, initialize the scripts.
jQuery(function( $ ){
$("#submitall").click(function () {
var shareo = $("#demo-input-facebook-theme-share").val();
var tago = $("#demo-input-facebook-theme-tag").val();
var commento = $("#demo-input-facebook-theme-comment").val();
var share = $("#sharestatus").val();
var tag = $("#tagstatus").val();
var comment = $("#commentstatus").val();
window.location.href= "publish.php?id=<?=$row->a_id?>&so="+shareo+"&to="+tago+"&co="+commento+"&s="+share+"&t="+tag+"&c="+comment ;
});
$("#demo-input-facebook-theme-share").tokenInput("friends_autocomplete.php", {
theme: "facebook"
});
$("#demo-input-facebook-theme-tag").tokenInput("friends_autocomplete.php", {
theme: "facebook"
});
$("#demo-input-facebook-theme-comment").tokenInput("friends_autocomplete.php", {
theme: "facebook"
});
// Set up the photo tagger.
$( "div.photo-container" ).photoTagger({
// The API urls.
loadURL: "load_tags.php",
saveURL: "save_tag.php",
deleteURL: "delete_tag.php",
// Default to turned on.
// isTagCreationEnabled: false,
// This will allow us to clean the response from
// a ColdFusion server (it will convert the
// uppercase keys to lowercase keys expected by
// the photoTagger plugin.
cleanAJAXResponse: cleanColdFusionJSONResponse
});
// Hook up the enable create links.
$( "#encreate" ).click(
function( event ){
// Prevent relocation.
event.preventDefault();
$chtml = $("#encreate").html();
if( $chtml == "Disable Create Tag" ){
$( this ).prevAll( "div.photo-container" )
.photoTagger( "disableTagCreation" )
;
$("#encreate").html("Enable Create Tag");
}
else{
$( this ).prevAll( "div.photo-container" )
.photoTagger( "enableTagCreation" )
;
$("#encreate").html("Disable Create Tag");
}
}
);
// Hook up the disabled create links.
$( "#endelete" ).click(
function( event ){
// Prevent relocation.
event.preventDefault();
$chtml = $( "#endelete" ).html();
if( $chtml == "Enable Delete Tag" ){
$( this ).prevAll( "div.photo-container" )
.photoTagger( "enableTagDeletion" )
;
$( "#endelete" ).html("Disable Delete Tag");
}
else{
$( this ).prevAll( "div.photo-container" )
.photoTagger( "disableTagDeletion" )
;
$( "#endelete" ).html("Enable Delete Tag");
}
}
);
// Hook up the enable delete links.
$("#sharestatus").change(function(){
if ( $("#sharestatus").val() == "4" ){
$("#sharestatustext").attr('class', 'show');
}
else{
$("#sharestatustext").attr('class', 'hide');
}
});
$("#tagstatus").change(function(){
if ( $("#tagstatus").val() == "4" ){
$("#tagstatustext").attr('class', 'show');
}
else{
$("#tagstatustext").attr('class', 'hide');
}
});
$("#commentstatus").change(function(){
if ( $("#commentstatus").val() == "4" ){
$("#commentstatustext").attr('class', 'show');
}
else{
$("#commentstatustext").attr('class', 'hide');
}
});
});
</script>
</head>
<body>
<div class="photo-column">
<div class="photo-container">
<img
id="<?=$row->a_id?>"
src="images/<?=$row->a_link?>"
style="height:350px;"
/>
</div>
<!-- These will toggle the tag ceation. -->
<a href="#" class="enable-create button" id="encreate" style="height:40px;line-height:8px">Enable Create Tag</a>
|
<a href="#" class="enable-create button" id="endelete" style="height:40px;line-height:8px">Enable Delete Tag</a>
<br />
<br />
</div>
<div class="row">
<div class="large-12 columns">
<div class="large-6 columns">
<label>Share With :
<select id="sharestatus" >
<option value="2">All Friends</option>
<option value="4">Specific Friends</option>
<option value="3">Only Me</option>
</select>
</label>
</div>
<div id="sharestatustext" class="hide">
<div class="large-6 columns">
<label>Specify Friends:
<input type="text" id="demo-input-facebook-theme-share" name="blah2" />
</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="large-6 columns">
<label>Who can see Tags :
<select id="tagstatus" >
<option value="2">All Friends</option>
<option value="4">Specific Friends</option>
<option value="3">Only Me</option>
</select>
</label>
</div>
<div id="tagstatustext" class="hide">
<div class="large-6 columns">
<label>Specify Friends:
<input type="text" id="demo-input-facebook-theme-tag" name="blah2" />
</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="large-6 columns">
<label>Who can comment :
<select id="commentstatus" >
<option value="2">All Friends</option>
<option value="4">Specific Friends</option>
<option value="3">Only Me</option>
</select>
</label>
</div>
<div id="commentstatustext" class="hide">
<div class="large-6 columns">
<label>Specify Friends:
<input type="text" id="demo-input-facebook-theme-comment" name="blah2" />
</label>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<div>
<input class="button" id="submitall" style="height:40px;line-height:8px;" value="Submit" />
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<?php
include "footer.php";
?>