blob: 73d05da56930892a3cab503f1fb77512bf50968b (
plain)
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
|
<html>
<body>
{% extends "gstudio/base.html" %}
{% load pagination_tags %}
{% load adminmedia grp_tags %}
{% load i18n %}
{% block content %}
<script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$(window).load(function() {
$("#content").css({
"width": "600px",});});
$(window).load(function() {
$("#chart").hide();});
$(window).load(function() {
$("#graphcss").hide();
});
var i = 0;
</script>
<style type="text/css">
#div2
{
background-color:#E8E8E8 ;
}
#div1
{
background-color:white
}
#divsearch
{
position:absolute;
}
#upperdiv
{
position:relative;
margin-bottom:35%;
}
#divpost
{
position:absolute;
margin-left:52%;
}
</style>
{% if user.is_authenticated %}
{% autopaginate images 10 %}
<h2 style="color: teal;">Image Library</h2>
<br/>
<div id="upperdiv">
<div id="divsearch">
<form method="post" action="">
{% csrf_token %}
<h4 style="color: black; margin-left: 0px;">Search Image:</h4>
<p><input type="text" name="simg" value={{val}}></p>
<br/>
<p><div align="left">
<select name="mydropdown">
<option value="title">Title</option>
<option value="creation_date">Creation Date</option>
</select>
</div>
<input type="submit" value="Search">
</form>
</div>
<div id="divpost">
<form enctype="multipart/form-data" method="post" action="">
{% csrf_token %}
<h4 style="color: black; margin-left: 0px;">Post Image:</h4>
Title: <input type="text" name="title1"><br/><br/>
Image: <input type=file name="image[]" multiple="multiple" /><br/><br/>
Description: <input type=textarea name="contenttext"/>
<input type="hidden" name="user" value={{user.username}}><br/><br/>
<input type="submit" value=" Post " size="900" name="post" onclick="return myupload();">
</form>
</div>
</div>
<br>
<div>
<h4 style="color: teal;">IMAGES</h4>
{% for image in images %}
<div class="gbobject-image" id = "divimage">
<script type="text/javascript">
i = i+1;
if (i%2 == 0){
document.getElementById("divimage").setAttribute("id","div1");
}
else
{
document.getElementById("divimage").setAttribute("id","div2");
}
</script>
<h2>{{image.title}}</h2>
<form method="post" action="">{% csrf_token %}
<input type="hidden" name="fulid" value={{image.id}}>
<input type="submit" value="Show" name="Show">
<!-- <p> -->
<!-- <img src="{% admin_media_prefix %}img/{{image.title}}" width="300" height="225" alt="{{ image.title }}" > -->
<!-- </p> -->
<!-- <div class="gbobject-content"> -->
<!-- <\!-- {{ object_content }}-\-> -->
<!-- </div> -->
<!-- </div>-->
<!-- <h4>{{image.title}} -->
<!-- <form method="post" action=""> -->
<!-- {% csrf_token %} -->
<!-- <input type="hidden" name="fulid" value={{image.id}}> -->
<!-- <input type="submit" value="View Fullscreen"> -->
<!-- </form> -->
<!-- </h4> -->
<!-- <font color = 'black'>Posted By : </font> -->
<!-- {% for author in image.authors.all %} -->
<!-- <font color = 'teal'>{{author}}</font> -->
<!-- {% endfor %} -->
<!-- <br> -->
<!-- <font color = 'black'>Posted At : </font><font color = 'teal'>{{image.creation_date}}</font> -->
<!-- <font color = 'black'>Current rating is {{ image.rating.get_rating }} </font> -->
{% for author in image.authors.all %}
{% ifequal author.username user.username %}
<input type="hidden" name="pict" value={{image.id}}>
<input type="submit" name="delete" value="Delete" onclick="return makesure();">
<input type="hidden" name="user" value={{user.username}}>
</form>
<script type="text/javascript">
function makesure() {
if (confirm('Are you sure you want to delete this image?')) {
return true;
}
else {
return false;
}
}
</script>
{% else %}
<script type="text/javascript">
function myFunction()
{
alert("You are not authorised to delete other users image!");
}
</script>
<input type="button" onclick="myFunction()" value="Delete" />
</form>
{% endifequal %}
{% endfor %}
<!-- <br> -->
<!-- <form method="post" action=""> -->
<!-- {% csrf_token %} -->
<!-- <input name="star1" type="radio" value=1 class="star"/> -->
<!-- <input name="star1" type="radio" value=2 class="star"/> -->
<!-- <input name="star1" type="radio" value=3 class="star"/> -->
<!-- <input name="star1" type="radio" value=4 class="star"/> -->
<!-- <input name="star1" type="radio" value=5 class="star"/> -->
<!-- </br> -->
<!-- <input type="hidden" name="imgid" value={{image.id}}> -->
<!-- <input type="submit" value="Rate it!!!"> -->
<!-- </form> -->
<!-- <br> -->
<!-- <hr width="100%" style="height:5px;" color="black"/> -->
<!-- <br> -->
</div>
{% endfor %}
</div>
{% else %}
<h2 style="color: indigo;">Sorry you need to log in to see this content !</h2>
{% endif %}
<h2>
{% paginate %}</h2>
{% endblock %}
</body>
</html>
|